diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 14:55:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 14:55:14 -0500 |
commit | a3a798c88a14b35e5d4ca30716dbc9eb9a1ddfe2 (patch) | |
tree | 393969a0f1405237483c8c29b904690f2bb90559 /drivers | |
parent | efcb3cf7f00c3c424db012380a8a974c2676a3c8 (diff) | |
parent | d97c0defba25a959a990f6d4759f43075540832e (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (94 commits)
ACPICA: hide private headers
ACPICA: create acpica/ directory
ACPI: fix build warning
ACPI : Use RSDT instead of XSDT by adding boot option of "acpi=rsdt"
ACPI: Avoid array address overflow when _CST MWAIT hint bits are set
fujitsu-laptop: Simplify SBLL/SBL2 backlight handling
fujitsu-laptop: Add BL power, LED control and radio state information
ACPICA: delete utcache.c
ACPICA: delete acdisasm.h
ACPICA: Update version to 20081204.
ACPICA: FADT: Update error msgs for consistency
ACPICA: FADT: set acpi_gbl_use_default_register_widths to TRUE by default
ACPICA: FADT parsing changes and fixes
ACPICA: Add ACPI_MUTEX_TYPE configuration option
ACPICA: Fixes for various ACPI data tables
ACPICA: Restructure includes into public/private
ACPI: remove private acpica headers from driver files
ACPI: reboot.c: use new acpi_reset interface
ACPICA: New: acpi_reset interface - write to reset register
ACPICA: Move all public H/W interfaces to new hwxface
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/Kconfig | 2 | ||||
-rw-r--r-- | drivers/Makefile | 1 | ||||
-rw-r--r-- | drivers/acpi/Kconfig | 84 | ||||
-rw-r--r-- | drivers/acpi/Makefile | 25 | ||||
-rw-r--r-- | drivers/acpi/acpica/Makefile | 44 | ||||
-rw-r--r-- | drivers/acpi/acpica/accommon.h | 63 | ||||
-rw-r--r-- | drivers/acpi/acpica/acconfig.h | 217 | ||||
-rw-r--r-- | drivers/acpi/acpica/acdebug.h | 231 | ||||
-rw-r--r-- | drivers/acpi/acpica/acdispat.h | 345 | ||||
-rw-r--r-- | drivers/acpi/acpica/acevents.h | 218 | ||||
-rw-r--r-- | drivers/acpi/acpica/acglobal.h | 394 | ||||
-rw-r--r-- | drivers/acpi/acpica/achware.h | 119 | ||||
-rw-r--r-- | drivers/acpi/acpica/acinterp.h | 529 | ||||
-rw-r--r-- | drivers/acpi/acpica/aclocal.h | 990 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 577 | ||||
-rw-r--r-- | drivers/acpi/acpica/acnamesp.h | 324 | ||||
-rw-r--r-- | drivers/acpi/acpica/acobject.h | 446 | ||||
-rw-r--r-- | drivers/acpi/acpica/acopcode.h | 323 | ||||
-rw-r--r-- | drivers/acpi/acpica/acparser.h | 234 | ||||
-rw-r--r-- | drivers/acpi/acpica/acpredef.h | 371 | ||||
-rw-r--r-- | drivers/acpi/acpica/acresrc.h | 336 | ||||
-rw-r--r-- | drivers/acpi/acpica/acstruct.h | 228 | ||||
-rw-r--r-- | drivers/acpi/acpica/actables.h | 117 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 549 | ||||
-rw-r--r-- | drivers/acpi/acpica/amlcode.h | 494 | ||||
-rw-r--r-- | drivers/acpi/acpica/amlresrc.h | 311 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsfield.c (renamed from drivers/acpi/dispatcher/dsfield.c) | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsinit.c (renamed from drivers/acpi/dispatcher/dsinit.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsmethod.c (renamed from drivers/acpi/dispatcher/dsmethod.c) | 14 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsmthdat.c (renamed from drivers/acpi/dispatcher/dsmthdat.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsobject.c (renamed from drivers/acpi/dispatcher/dsobject.c) | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsopcode.c (renamed from drivers/acpi/dispatcher/dsopcode.c) | 66 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsutils.c (renamed from drivers/acpi/dispatcher/dsutils.c) | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswexec.c (renamed from drivers/acpi/dispatcher/dswexec.c) | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload.c (renamed from drivers/acpi/dispatcher/dswload.c) | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswscope.c (renamed from drivers/acpi/dispatcher/dswscope.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswstate.c (renamed from drivers/acpi/dispatcher/dswstate.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/evevent.c (renamed from drivers/acpi/events/evevent.c) | 17 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpe.c (renamed from drivers/acpi/events/evgpe.c) | 53 | ||||
-rw-r--r-- | drivers/acpi/acpica/evgpeblk.c (renamed from drivers/acpi/events/evgpeblk.c) | 82 | ||||
-rw-r--r-- | drivers/acpi/acpica/evmisc.c (renamed from drivers/acpi/events/evmisc.c) | 62 | ||||
-rw-r--r-- | drivers/acpi/acpica/evregion.c (renamed from drivers/acpi/events/evregion.c) | 140 | ||||
-rw-r--r-- | drivers/acpi/acpica/evrgnini.c (renamed from drivers/acpi/events/evrgnini.c) | 46 | ||||
-rw-r--r-- | drivers/acpi/acpica/evsci.c (renamed from drivers/acpi/events/evsci.c) | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxface.c (renamed from drivers/acpi/events/evxface.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfevnt.c (renamed from drivers/acpi/events/evxfevnt.c) | 170 | ||||
-rw-r--r-- | drivers/acpi/acpica/evxfregn.c (renamed from drivers/acpi/events/evxfregn.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/exconfig.c (renamed from drivers/acpi/executer/exconfig.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/exconvrt.c (renamed from drivers/acpi/executer/exconvrt.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/excreate.c (renamed from drivers/acpi/executer/excreate.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exdump.c (renamed from drivers/acpi/executer/exdump.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exfield.c (renamed from drivers/acpi/executer/exfield.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/exfldio.c (renamed from drivers/acpi/executer/exfldio.c) | 20 | ||||
-rw-r--r-- | drivers/acpi/acpica/exmisc.c (renamed from drivers/acpi/executer/exmisc.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exmutex.c (renamed from drivers/acpi/executer/exmutex.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/exnames.c (renamed from drivers/acpi/executer/exnames.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/exoparg1.c (renamed from drivers/acpi/executer/exoparg1.c) | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/exoparg2.c (renamed from drivers/acpi/executer/exoparg2.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/exoparg3.c (renamed from drivers/acpi/executer/exoparg3.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exoparg6.c (renamed from drivers/acpi/executer/exoparg6.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exprep.c (renamed from drivers/acpi/executer/exprep.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exregion.c (renamed from drivers/acpi/executer/exregion.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/exresnte.c (renamed from drivers/acpi/executer/exresnte.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/exresolv.c (renamed from drivers/acpi/executer/exresolv.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/exresop.c (renamed from drivers/acpi/executer/exresop.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/exstore.c (renamed from drivers/acpi/executer/exstore.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/exstoren.c (renamed from drivers/acpi/executer/exstoren.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/exstorob.c (renamed from drivers/acpi/executer/exstorob.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/exsystem.c (renamed from drivers/acpi/executer/exsystem.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/exutils.c (renamed from drivers/acpi/executer/exutils.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwacpi.c (renamed from drivers/acpi/hardware/hwacpi.c) | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwgpe.c (renamed from drivers/acpi/hardware/hwgpe.c) | 78 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwregs.c | 353 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwsleep.c (renamed from drivers/acpi/hardware/hwsleep.c) | 76 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwtimer.c (renamed from drivers/acpi/hardware/hwtimer.c) | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwxface.c (renamed from drivers/acpi/hardware/hwregs.c) | 744 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsaccess.c (renamed from drivers/acpi/namespace/nsaccess.c) | 18 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsalloc.c (renamed from drivers/acpi/namespace/nsalloc.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsdump.c (renamed from drivers/acpi/namespace/nsdump.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsdumpdv.c (renamed from drivers/acpi/namespace/nsdumpdv.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nseval.c (renamed from drivers/acpi/namespace/nseval.c) | 77 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsinit.c (renamed from drivers/acpi/namespace/nsinit.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsload.c (renamed from drivers/acpi/namespace/nsload.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsnames.c (renamed from drivers/acpi/namespace/nsnames.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsobject.c (renamed from drivers/acpi/namespace/nsobject.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsparse.c (renamed from drivers/acpi/namespace/nsparse.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/nspredef.c (renamed from drivers/acpi/namespace/nspredef.c) | 261 | ||||
-rw-r--r-- | drivers/acpi/acpica/nssearch.c (renamed from drivers/acpi/namespace/nssearch.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsutils.c (renamed from drivers/acpi/namespace/nsutils.c) | 15 | ||||
-rw-r--r-- | drivers/acpi/acpica/nswalk.c (renamed from drivers/acpi/namespace/nswalk.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsxfeval.c (renamed from drivers/acpi/namespace/nsxfeval.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsxfname.c (renamed from drivers/acpi/namespace/nsxfname.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsxfobj.c (renamed from drivers/acpi/namespace/nsxfobj.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/psargs.c (renamed from drivers/acpi/parser/psargs.c) | 9 | ||||
-rw-r--r-- | drivers/acpi/acpica/psloop.c (renamed from drivers/acpi/parser/psloop.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/psopcode.c (renamed from drivers/acpi/parser/psopcode.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/psparse.c (renamed from drivers/acpi/parser/psparse.c) | 23 | ||||
-rw-r--r-- | drivers/acpi/acpica/psscope.c (renamed from drivers/acpi/parser/psscope.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/pstree.c (renamed from drivers/acpi/parser/pstree.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/psutils.c (renamed from drivers/acpi/parser/psutils.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/pswalk.c (renamed from drivers/acpi/parser/pswalk.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/psxface.c (renamed from drivers/acpi/parser/psxface.c) | 40 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsaddr.c (renamed from drivers/acpi/resources/rsaddr.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscalc.c (renamed from drivers/acpi/resources/rscalc.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscreate.c (renamed from drivers/acpi/resources/rscreate.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsdump.c (renamed from drivers/acpi/resources/rsdump.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsinfo.c (renamed from drivers/acpi/resources/rsinfo.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsio.c (renamed from drivers/acpi/resources/rsio.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsirq.c (renamed from drivers/acpi/resources/rsirq.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rslist.c (renamed from drivers/acpi/resources/rslist.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsmemory.c (renamed from drivers/acpi/resources/rsmemory.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsmisc.c (renamed from drivers/acpi/resources/rsmisc.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsutils.c (renamed from drivers/acpi/resources/rsutils.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/rsxface.c (renamed from drivers/acpi/resources/rsxface.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbfadt.c (renamed from drivers/acpi/tables/tbfadt.c) | 252 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbfind.c (renamed from drivers/acpi/tables/tbfind.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbinstal.c (renamed from drivers/acpi/tables/tbinstal.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbutils.c (renamed from drivers/acpi/tables/tbutils.c) | 30 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxface.c (renamed from drivers/acpi/tables/tbxface.c) | 5 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxfroot.c (renamed from drivers/acpi/tables/tbxfroot.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utalloc.c (renamed from drivers/acpi/utilities/utalloc.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utcopy.c (renamed from drivers/acpi/utilities/utcopy.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utdebug.c (renamed from drivers/acpi/utilities/utdebug.c) | 95 | ||||
-rw-r--r-- | drivers/acpi/acpica/utdelete.c (renamed from drivers/acpi/utilities/utdelete.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/uteval.c (renamed from drivers/acpi/utilities/uteval.c) | 11 | ||||
-rw-r--r-- | drivers/acpi/acpica/utglobal.c (renamed from drivers/acpi/utilities/utglobal.c) | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/utinit.c (renamed from drivers/acpi/utilities/utinit.c) | 7 | ||||
-rw-r--r-- | drivers/acpi/acpica/utmath.c (renamed from drivers/acpi/utilities/utmath.c) | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/utmisc.c (renamed from drivers/acpi/utilities/utmisc.c) | 23 | ||||
-rw-r--r-- | drivers/acpi/acpica/utmutex.c (renamed from drivers/acpi/utilities/utmutex.c) | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/utobject.c (renamed from drivers/acpi/utilities/utobject.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utresrc.c (renamed from drivers/acpi/utilities/utresrc.c) | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/utstate.c (renamed from drivers/acpi/utilities/utstate.c) | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxface.c (renamed from drivers/acpi/utilities/utxface.c) | 18 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 5 | ||||
-rw-r--r-- | drivers/acpi/cm_sbs.c | 3 | ||||
-rw-r--r-- | drivers/acpi/debug.c | 1 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/Makefile | 9 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 57 | ||||
-rw-r--r-- | drivers/acpi/events/Makefile | 9 | ||||
-rw-r--r-- | drivers/acpi/executer/Makefile | 10 | ||||
-rw-r--r-- | drivers/acpi/hardware/Makefile | 9 | ||||
-rw-r--r-- | drivers/acpi/main.c (renamed from drivers/acpi/sleep/main.c) | 79 | ||||
-rw-r--r-- | drivers/acpi/namespace/Makefile | 12 | ||||
-rw-r--r-- | drivers/acpi/numa.c | 1 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 4 | ||||
-rw-r--r-- | drivers/acpi/parser/Makefile | 8 | ||||
-rw-r--r-- | drivers/acpi/pci_bind.c | 90 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 472 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 6 | ||||
-rw-r--r-- | drivers/acpi/power.c | 6 | ||||
-rw-r--r-- | drivers/acpi/proc.c (renamed from drivers/acpi/sleep/proc.c) | 65 | ||||
-rw-r--r-- | drivers/acpi/reboot.c | 2 | ||||
-rw-r--r-- | drivers/acpi/resources/Makefile | 10 | ||||
-rw-r--r-- | drivers/acpi/sbshc.c | 1 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 1 | ||||
-rw-r--r-- | drivers/acpi/sleep.h (renamed from drivers/acpi/sleep/sleep.h) | 0 | ||||
-rw-r--r-- | drivers/acpi/sleep/Makefile | 5 | ||||
-rw-r--r-- | drivers/acpi/system.c | 63 | ||||
-rw-r--r-- | drivers/acpi/tables/Makefile | 7 | ||||
-rw-r--r-- | drivers/acpi/utilities/Makefile | 9 | ||||
-rw-r--r-- | drivers/acpi/utilities/utcache.c | 314 | ||||
-rw-r--r-- | drivers/acpi/video.c | 20 | ||||
-rw-r--r-- | drivers/acpi/video_detect.c | 4 | ||||
-rw-r--r-- | drivers/acpi/wakeup.c (renamed from drivers/acpi/sleep/wakeup.c) | 6 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_acpi.c | 6 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_bios.c | 2 | ||||
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 10 | ||||
-rw-r--r-- | drivers/ide/ide-acpi.c | 6 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 284 | ||||
-rw-r--r-- | drivers/misc/Makefile | 13 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpi_pcihp.c | 1 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 1 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 2 | ||||
-rw-r--r-- | drivers/platform/Kconfig | 5 | ||||
-rw-r--r-- | drivers/platform/Makefile | 5 | ||||
-rw-r--r-- | drivers/platform/x86/Kconfig | 375 | ||||
-rw-r--r-- | drivers/platform/x86/Makefile | 19 | ||||
-rw-r--r-- | drivers/platform/x86/acer-wmi.c (renamed from drivers/misc/acer-wmi.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/asus-laptop.c (renamed from drivers/misc/asus-laptop.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/asus_acpi.c (renamed from drivers/acpi/asus_acpi.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/compal-laptop.c (renamed from drivers/misc/compal-laptop.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c (renamed from drivers/misc/eeepc-laptop.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c (renamed from drivers/misc/fujitsu-laptop.c) | 419 | ||||
-rw-r--r-- | drivers/platform/x86/hp-wmi.c (renamed from drivers/misc/hp-wmi.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/intel_menlow.c (renamed from drivers/misc/intel_menlow.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/msi-laptop.c (renamed from drivers/misc/msi-laptop.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c (renamed from drivers/misc/panasonic-laptop.c) | 22 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c (renamed from drivers/misc/sony-laptop.c) | 15 | ||||
-rw-r--r-- | drivers/platform/x86/tc1100-wmi.c (renamed from drivers/misc/tc1100-wmi.c) | 1 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c (renamed from drivers/misc/thinkpad_acpi.c) | 1 | ||||
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c (renamed from drivers/acpi/toshiba_acpi.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/wmi.c (renamed from drivers/acpi/wmi.c) | 0 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 1 |
195 files changed, 10493 insertions, 2800 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index 2f557f570ade..00cf9553f740 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -107,4 +107,6 @@ source "drivers/uio/Kconfig" | |||
107 | source "drivers/xen/Kconfig" | 107 | source "drivers/xen/Kconfig" |
108 | 108 | ||
109 | source "drivers/staging/Kconfig" | 109 | source "drivers/staging/Kconfig" |
110 | |||
111 | source "drivers/platform/Kconfig" | ||
110 | endmenu | 112 | endmenu |
diff --git a/drivers/Makefile b/drivers/Makefile index 6326f4dbbdab..c1bf41737936 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -105,3 +105,4 @@ obj-$(CONFIG_OF) += of/ | |||
105 | obj-$(CONFIG_SSB) += ssb/ | 105 | obj-$(CONFIG_SSB) += ssb/ |
106 | obj-$(CONFIG_VIRTIO) += virtio/ | 106 | obj-$(CONFIG_VIRTIO) += virtio/ |
107 | obj-$(CONFIG_STAGING) += staging/ | 107 | obj-$(CONFIG_STAGING) += staging/ |
108 | obj-y += platform/ | ||
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b0243fd55ac0..d7f9839ba264 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -196,90 +196,6 @@ config ACPI_NUMA | |||
196 | depends on (X86 || IA64) | 196 | depends on (X86 || IA64) |
197 | default y if IA64_GENERIC || IA64_SGI_SN2 | 197 | default y if IA64_GENERIC || IA64_SGI_SN2 |
198 | 198 | ||
199 | config ACPI_WMI | ||
200 | tristate "WMI (EXPERIMENTAL)" | ||
201 | depends on X86 | ||
202 | depends on EXPERIMENTAL | ||
203 | help | ||
204 | This driver adds support for the ACPI-WMI (Windows Management | ||
205 | Instrumentation) mapper device (PNP0C14) found on some systems. | ||
206 | |||
207 | ACPI-WMI is a proprietary extension to ACPI to expose parts of the | ||
208 | ACPI firmware to userspace - this is done through various vendor | ||
209 | defined methods and data blocks in a PNP0C14 device, which are then | ||
210 | made available for userspace to call. | ||
211 | |||
212 | The implementation of this in Linux currently only exposes this to | ||
213 | other kernel space drivers. | ||
214 | |||
215 | This driver is a required dependency to build the firmware specific | ||
216 | drivers needed on many machines, including Acer and HP laptops. | ||
217 | |||
218 | It is safe to enable this driver even if your DSDT doesn't define | ||
219 | any ACPI-WMI devices. | ||
220 | |||
221 | config ACPI_ASUS | ||
222 | tristate "ASUS/Medion Laptop Extras" | ||
223 | depends on X86 | ||
224 | select BACKLIGHT_CLASS_DEVICE | ||
225 | ---help--- | ||
226 | This driver provides support for extra features of ACPI-compatible | ||
227 | ASUS laptops. As some of Medion laptops are made by ASUS, it may also | ||
228 | support some Medion laptops (such as 9675 for example). It makes all | ||
229 | the extra buttons generate standard ACPI events that go through | ||
230 | /proc/acpi/events, and (on some models) adds support for changing the | ||
231 | display brightness and output, switching the LCD backlight on and off, | ||
232 | and most importantly, allows you to blink those fancy LEDs intended | ||
233 | for reporting mail and wireless status. | ||
234 | |||
235 | Note: display switching code is currently considered EXPERIMENTAL, | ||
236 | toying with these values may even lock your machine. | ||
237 | |||
238 | All settings are changed via /proc/acpi/asus directory entries. Owner | ||
239 | and group for these entries can be set with asus_uid and asus_gid | ||
240 | parameters. | ||
241 | |||
242 | More information and a userspace daemon for handling the extra buttons | ||
243 | at <http://sourceforge.net/projects/acpi4asus/>. | ||
244 | |||
245 | If you have an ACPI-compatible ASUS laptop, say Y or M here. This | ||
246 | driver is still under development, so if your laptop is unsupported or | ||
247 | something works not quite as expected, please use the mailing list | ||
248 | available on the above page (acpi4asus-user@lists.sourceforge.net). | ||
249 | |||
250 | NOTE: This driver is deprecated and will probably be removed soon, | ||
251 | use asus-laptop instead. | ||
252 | |||
253 | config ACPI_TOSHIBA | ||
254 | tristate "Toshiba Laptop Extras" | ||
255 | depends on X86 && INPUT | ||
256 | select INPUT_POLLDEV | ||
257 | select NET | ||
258 | select RFKILL | ||
259 | select BACKLIGHT_CLASS_DEVICE | ||
260 | ---help--- | ||
261 | This driver adds support for access to certain system settings | ||
262 | on "legacy free" Toshiba laptops. These laptops can be recognized by | ||
263 | their lack of a BIOS setup menu and APM support. | ||
264 | |||
265 | On these machines, all system configuration is handled through the | ||
266 | ACPI. This driver is required for access to controls not covered | ||
267 | by the general ACPI drivers, such as LCD brightness, video output, | ||
268 | etc. | ||
269 | |||
270 | This driver differs from the non-ACPI Toshiba laptop driver (located | ||
271 | under "Processor type and features") in several aspects. | ||
272 | Configuration is accessed by reading and writing text files in the | ||
273 | /proc tree instead of by program interface to /dev. Furthermore, no | ||
274 | power management functions are exposed, as those are handled by the | ||
275 | general ACPI drivers. | ||
276 | |||
277 | More information about this driver is available at | ||
278 | <http://memebeam.org/toys/ToshibaAcpiDriver>. | ||
279 | |||
280 | If you have a legacy free Toshiba laptop (such as the Libretto L1 | ||
281 | series), say Y. | ||
282 | |||
283 | config ACPI_CUSTOM_DSDT_FILE | 199 | config ACPI_CUSTOM_DSDT_FILE |
284 | string "Custom DSDT Table file to include" | 200 | string "Custom DSDT Table file to include" |
285 | default "" | 201 | default "" |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 3c0c93300f12..d80f4cc2e0da 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -2,15 +2,8 @@ | |||
2 | # Makefile for the Linux ACPI interpreter | 2 | # Makefile for the Linux ACPI interpreter |
3 | # | 3 | # |
4 | 4 | ||
5 | export ACPI_CFLAGS | 5 | ccflags-y := -Os |
6 | 6 | ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT | |
7 | ACPI_CFLAGS := -Os | ||
8 | |||
9 | ifdef CONFIG_ACPI_DEBUG | ||
10 | ACPI_CFLAGS += -DACPI_DEBUG_OUTPUT | ||
11 | endif | ||
12 | |||
13 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
14 | 7 | ||
15 | # | 8 | # |
16 | # ACPI Boot-Time Table Parsing | 9 | # ACPI Boot-Time Table Parsing |
@@ -22,9 +15,13 @@ obj-$(CONFIG_X86) += blacklist.o | |||
22 | # ACPI Core Subsystem (Interpreter) | 15 | # ACPI Core Subsystem (Interpreter) |
23 | # | 16 | # |
24 | obj-y += osl.o utils.o reboot.o\ | 17 | obj-y += osl.o utils.o reboot.o\ |
25 | dispatcher/ events/ executer/ hardware/ \ | 18 | acpica/ |
26 | namespace/ parser/ resources/ tables/ \ | 19 | |
27 | utilities/ | 20 | # sleep related files |
21 | obj-y += wakeup.o | ||
22 | obj-y += main.o | ||
23 | obj-$(CONFIG_ACPI_SLEEP) += proc.o | ||
24 | |||
28 | 25 | ||
29 | # | 26 | # |
30 | # ACPI Bus and Device Drivers | 27 | # ACPI Bus and Device Drivers |
@@ -35,7 +32,6 @@ ifdef CONFIG_CPU_FREQ | |||
35 | processor-objs += processor_perflib.o | 32 | processor-objs += processor_perflib.o |
36 | endif | 33 | endif |
37 | 34 | ||
38 | obj-y += sleep/ | ||
39 | obj-y += bus.o glue.o | 35 | obj-y += bus.o glue.o |
40 | obj-y += scan.o | 36 | obj-y += scan.o |
41 | # Keep EC driver first. Initialization of others depend on it. | 37 | # Keep EC driver first. Initialization of others depend on it. |
@@ -59,9 +55,6 @@ obj-y += power.o | |||
59 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o | 55 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o |
60 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
61 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 57 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
62 | obj-$(CONFIG_ACPI_WMI) += wmi.o | ||
63 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | ||
64 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | ||
65 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
66 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o | 59 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
67 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 60 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile new file mode 100644 index 000000000000..3f23298ee3fd --- /dev/null +++ b/drivers/acpi/acpica/Makefile | |||
@@ -0,0 +1,44 @@ | |||
1 | # | ||
2 | # Makefile for ACPICA Core interpreter | ||
3 | # | ||
4 | |||
5 | ccflags-y := -Os | ||
6 | ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT | ||
7 | |||
8 | obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ | ||
9 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ | ||
10 | dsinit.o | ||
11 | |||
12 | obj-y += evevent.o evregion.o evsci.o evxfevnt.o \ | ||
13 | evmisc.o evrgnini.o evxface.o evxfregn.o \ | ||
14 | evgpe.o evgpeblk.o | ||
15 | |||
16 | obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ | ||
17 | exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ | ||
18 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ | ||
19 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o | ||
20 | |||
21 | obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o | ||
22 | |||
23 | obj-$(ACPI_FUTURE_USAGE) += hwtimer.o | ||
24 | |||
25 | obj-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ | ||
26 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ | ||
27 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ | ||
28 | nsparse.o nspredef.o | ||
29 | |||
30 | obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o | ||
31 | |||
32 | obj-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ | ||
33 | psopcode.o psscope.o psutils.o psxface.o | ||
34 | |||
35 | obj-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ | ||
36 | rscalc.o rsirq.o rsmemory.o rsutils.o | ||
37 | |||
38 | obj-$(ACPI_FUTURE_USAGE) += rsdump.o | ||
39 | |||
40 | obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | ||
41 | |||
42 | obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | ||
43 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | ||
44 | 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 index 000000000000..3b20786cbb0d --- /dev/null +++ b/drivers/acpi/acpica/accommon.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: accommon.h - Common include files for generation of ACPICA source | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACCOMMON_H__ | ||
45 | #define __ACCOMMON_H__ | ||
46 | |||
47 | /* | ||
48 | * Common set of includes for all ACPICA source files. | ||
49 | * We put them here because we don't want to duplicate them | ||
50 | * in the the source code again and again. | ||
51 | * | ||
52 | * Note: The order of these include files is important. | ||
53 | */ | ||
54 | #include "acconfig.h" /* Global configuration constants */ | ||
55 | #include "acmacros.h" /* C macros */ | ||
56 | #include "aclocal.h" /* Internal data types */ | ||
57 | #include "acobject.h" /* ACPI internal object */ | ||
58 | #include "acstruct.h" /* Common structures */ | ||
59 | #include "acglobal.h" /* All global variables */ | ||
60 | #include "achware.h" /* Hardware defines and interfaces */ | ||
61 | #include "acutils.h" /* Utility interfaces */ | ||
62 | |||
63 | #endif /* __ACCOMMON_H__ */ | ||
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h new file mode 100644 index 000000000000..e6777fb883d2 --- /dev/null +++ b/drivers/acpi/acpica/acconfig.h | |||
@@ -0,0 +1,217 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acconfig.h - Global configuration constants | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef _ACCONFIG_H | ||
45 | #define _ACCONFIG_H | ||
46 | |||
47 | /****************************************************************************** | ||
48 | * | ||
49 | * Configuration options | ||
50 | * | ||
51 | *****************************************************************************/ | ||
52 | |||
53 | /* | ||
54 | * ACPI_DEBUG_OUTPUT - This switch enables all the debug facilities of the | ||
55 | * ACPI subsystem. This includes the DEBUG_PRINT output | ||
56 | * statements. When disabled, all DEBUG_PRINT | ||
57 | * statements are compiled out. | ||
58 | * | ||
59 | * ACPI_APPLICATION - Use this switch if the subsystem is going to be run | ||
60 | * at the application level. | ||
61 | * | ||
62 | */ | ||
63 | |||
64 | /* | ||
65 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | ||
66 | * but there is a large base of ASL/AML code in existing machines that check | ||
67 | * for the string below. The use of this string usually guarantees that | ||
68 | * the ASL will execute down the most tested code path. Also, there is some | ||
69 | * code that will not execute the _OSI method unless _OS matches the string | ||
70 | * below. Therefore, change this string at your own risk. | ||
71 | */ | ||
72 | #define ACPI_OS_NAME "Microsoft Windows NT" | ||
73 | |||
74 | /* Maximum objects in the various object caches */ | ||
75 | |||
76 | #define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ | ||
77 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | ||
78 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ | ||
79 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ | ||
80 | #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ | ||
81 | |||
82 | /* | ||
83 | * Should the subsystem abort the loading of an ACPI table if the | ||
84 | * table checksum is incorrect? | ||
85 | */ | ||
86 | #define ACPI_CHECKSUM_ABORT FALSE | ||
87 | |||
88 | /****************************************************************************** | ||
89 | * | ||
90 | * Subsystem Constants | ||
91 | * | ||
92 | *****************************************************************************/ | ||
93 | |||
94 | /* Version of ACPI supported */ | ||
95 | |||
96 | #define ACPI_CA_SUPPORT_LEVEL 3 | ||
97 | |||
98 | /* Maximum count for a semaphore object */ | ||
99 | |||
100 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | ||
101 | |||
102 | /* Maximum object reference count (detects object deletion issues) */ | ||
103 | |||
104 | #define ACPI_MAX_REFERENCE_COUNT 0x1000 | ||
105 | |||
106 | /* Size of cached memory mapping for system memory operation region */ | ||
107 | |||
108 | #define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 | ||
109 | |||
110 | /* owner_id tracking. 8 entries allows for 255 owner_ids */ | ||
111 | |||
112 | #define ACPI_NUM_OWNERID_MASKS 8 | ||
113 | |||
114 | /* Size of the root table array is increased by this increment */ | ||
115 | |||
116 | #define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 | ||
117 | |||
118 | /* Maximum number of While() loop iterations before forced abort */ | ||
119 | |||
120 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF | ||
121 | |||
122 | /****************************************************************************** | ||
123 | * | ||
124 | * ACPI Specification constants (Do not change unless the specification changes) | ||
125 | * | ||
126 | *****************************************************************************/ | ||
127 | |||
128 | /* Number of distinct GPE register blocks and register width */ | ||
129 | |||
130 | #define ACPI_MAX_GPE_BLOCKS 2 | ||
131 | #define ACPI_GPE_REGISTER_WIDTH 8 | ||
132 | |||
133 | /* Method info (in WALK_STATE), containing local variables and argumetns */ | ||
134 | |||
135 | #define ACPI_METHOD_NUM_LOCALS 8 | ||
136 | #define ACPI_METHOD_MAX_LOCAL 7 | ||
137 | |||
138 | #define ACPI_METHOD_NUM_ARGS 7 | ||
139 | #define ACPI_METHOD_MAX_ARG 6 | ||
140 | |||
141 | /* Length of _HID, _UID, _CID, and UUID values */ | ||
142 | |||
143 | #define ACPI_DEVICE_ID_LENGTH 0x09 | ||
144 | #define ACPI_MAX_CID_LENGTH 48 | ||
145 | #define ACPI_UUID_LENGTH 16 | ||
146 | |||
147 | /* | ||
148 | * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG | ||
149 | */ | ||
150 | #define ACPI_OBJ_NUM_OPERANDS 8 | ||
151 | #define ACPI_OBJ_MAX_OPERAND 7 | ||
152 | |||
153 | /* Number of elements in the Result Stack frame, can be an arbitrary value */ | ||
154 | |||
155 | #define ACPI_RESULTS_FRAME_OBJ_NUM 8 | ||
156 | |||
157 | /* | ||
158 | * Maximal number of elements the Result Stack can contain, | ||
159 | * it may be an arbitray value not exceeding the types of | ||
160 | * result_size and result_count (now u8). | ||
161 | */ | ||
162 | #define ACPI_RESULTS_OBJ_NUM_MAX 255 | ||
163 | |||
164 | /* Names within the namespace are 4 bytes long */ | ||
165 | |||
166 | #define ACPI_NAME_SIZE 4 | ||
167 | #define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ | ||
168 | #define ACPI_PATH_SEPARATOR '.' | ||
169 | |||
170 | /* Sizes for ACPI table headers */ | ||
171 | |||
172 | #define ACPI_OEM_ID_SIZE 6 | ||
173 | #define ACPI_OEM_TABLE_ID_SIZE 8 | ||
174 | |||
175 | /* Constants used in searching for the RSDP in low memory */ | ||
176 | |||
177 | #define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ | ||
178 | #define ACPI_EBDA_PTR_LENGTH 2 | ||
179 | #define ACPI_EBDA_WINDOW_SIZE 1024 | ||
180 | #define ACPI_HI_RSDP_WINDOW_BASE 0x000E0000 /* Physical Address */ | ||
181 | #define ACPI_HI_RSDP_WINDOW_SIZE 0x00020000 | ||
182 | #define ACPI_RSDP_SCAN_STEP 16 | ||
183 | |||
184 | /* Operation regions */ | ||
185 | |||
186 | #define ACPI_NUM_PREDEFINED_REGIONS 8 | ||
187 | #define ACPI_USER_REGION_BEGIN 0x80 | ||
188 | |||
189 | /* Maximum space_ids for Operation Regions */ | ||
190 | |||
191 | #define ACPI_MAX_ADDRESS_SPACE 255 | ||
192 | |||
193 | /* Array sizes. Used for range checking also */ | ||
194 | |||
195 | #define ACPI_MAX_MATCH_OPCODE 5 | ||
196 | |||
197 | /* RSDP checksums */ | ||
198 | |||
199 | #define ACPI_RSDP_CHECKSUM_LENGTH 20 | ||
200 | #define ACPI_RSDP_XCHECKSUM_LENGTH 36 | ||
201 | |||
202 | /* SMBus bidirectional buffer size */ | ||
203 | |||
204 | #define ACPI_SMBUS_BUFFER_SIZE 34 | ||
205 | |||
206 | /****************************************************************************** | ||
207 | * | ||
208 | * ACPI AML Debugger | ||
209 | * | ||
210 | *****************************************************************************/ | ||
211 | |||
212 | #define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ | ||
213 | |||
214 | #define ACPI_DEBUGGER_COMMAND_PROMPT '-' | ||
215 | #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' | ||
216 | |||
217 | #endif /* _ACCONFIG_H */ | ||
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h new file mode 100644 index 000000000000..62c59df3b86c --- /dev/null +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -0,0 +1,231 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acdebug.h - ACPI/AML debugger | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACDEBUG_H__ | ||
45 | #define __ACDEBUG_H__ | ||
46 | |||
47 | #define ACPI_DEBUG_BUFFER_SIZE 4196 | ||
48 | |||
49 | struct command_info { | ||
50 | char *name; /* Command Name */ | ||
51 | u8 min_args; /* Minimum arguments required */ | ||
52 | }; | ||
53 | |||
54 | struct argument_info { | ||
55 | char *name; /* Argument Name */ | ||
56 | }; | ||
57 | |||
58 | #define PARAM_LIST(pl) pl | ||
59 | #define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose) | ||
60 | #define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ | ||
61 | acpi_os_printf PARAM_LIST(fp);} | ||
62 | |||
63 | #define EX_NO_SINGLE_STEP 1 | ||
64 | #define EX_SINGLE_STEP 2 | ||
65 | |||
66 | /* | ||
67 | * dbxface - external debugger interfaces | ||
68 | */ | ||
69 | acpi_status acpi_db_initialize(void); | ||
70 | |||
71 | void acpi_db_terminate(void); | ||
72 | |||
73 | acpi_status | ||
74 | acpi_db_single_step(struct acpi_walk_state *walk_state, | ||
75 | union acpi_parse_object *op, u32 op_type); | ||
76 | |||
77 | /* | ||
78 | * dbcmds - debug commands and output routines | ||
79 | */ | ||
80 | acpi_status acpi_db_disassemble_method(char *name); | ||
81 | |||
82 | void acpi_db_display_table_info(char *table_arg); | ||
83 | |||
84 | void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg); | ||
85 | |||
86 | void | ||
87 | acpi_db_set_method_breakpoint(char *location, | ||
88 | struct acpi_walk_state *walk_state, | ||
89 | union acpi_parse_object *op); | ||
90 | |||
91 | void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op); | ||
92 | |||
93 | void acpi_db_get_bus_info(void); | ||
94 | |||
95 | void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op); | ||
96 | |||
97 | void acpi_db_dump_namespace(char *start_arg, char *depth_arg); | ||
98 | |||
99 | void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); | ||
100 | |||
101 | void acpi_db_send_notify(char *name, u32 value); | ||
102 | |||
103 | void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); | ||
104 | |||
105 | acpi_status | ||
106 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); | ||
107 | |||
108 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); | ||
109 | |||
110 | void acpi_db_set_scope(char *name); | ||
111 | |||
112 | acpi_status acpi_db_sleep(char *object_arg); | ||
113 | |||
114 | void acpi_db_find_references(char *object_arg); | ||
115 | |||
116 | void acpi_db_display_locks(void); | ||
117 | |||
118 | void acpi_db_display_resources(char *object_arg); | ||
119 | |||
120 | void acpi_db_display_gpes(void); | ||
121 | |||
122 | void acpi_db_check_integrity(void); | ||
123 | |||
124 | void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); | ||
125 | |||
126 | void acpi_db_check_predefined_names(void); | ||
127 | |||
128 | void acpi_db_batch_execute(void); | ||
129 | |||
130 | /* | ||
131 | * dbdisply - debug display commands | ||
132 | */ | ||
133 | void acpi_db_display_method_info(union acpi_parse_object *op); | ||
134 | |||
135 | void acpi_db_decode_and_display_object(char *target, char *output_type); | ||
136 | |||
137 | void | ||
138 | acpi_db_display_result_object(union acpi_operand_object *obj_desc, | ||
139 | struct acpi_walk_state *walk_state); | ||
140 | |||
141 | acpi_status acpi_db_display_all_methods(char *display_count_arg); | ||
142 | |||
143 | void acpi_db_display_arguments(void); | ||
144 | |||
145 | void acpi_db_display_locals(void); | ||
146 | |||
147 | void acpi_db_display_results(void); | ||
148 | |||
149 | void acpi_db_display_calling_tree(void); | ||
150 | |||
151 | void acpi_db_display_object_type(char *object_arg); | ||
152 | |||
153 | void | ||
154 | acpi_db_display_argument_object(union acpi_operand_object *obj_desc, | ||
155 | struct acpi_walk_state *walk_state); | ||
156 | |||
157 | void acpi_db_check_predefined_names(void); | ||
158 | |||
159 | void acpi_db_batch_execute(void); | ||
160 | |||
161 | /* | ||
162 | * dbexec - debugger control method execution | ||
163 | */ | ||
164 | void acpi_db_execute(char *name, char **args, u32 flags); | ||
165 | |||
166 | void | ||
167 | acpi_db_create_execution_threads(char *num_threads_arg, | ||
168 | char *num_loops_arg, char *method_name_arg); | ||
169 | |||
170 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
171 | u32 acpi_db_get_cache_info(struct acpi_memory_list *cache); | ||
172 | #endif | ||
173 | |||
174 | /* | ||
175 | * dbfileio - Debugger file I/O commands | ||
176 | */ | ||
177 | acpi_object_type | ||
178 | acpi_db_match_argument(char *user_argument, struct argument_info *arguments); | ||
179 | |||
180 | void acpi_db_close_debug_file(void); | ||
181 | |||
182 | void acpi_db_open_debug_file(char *name); | ||
183 | |||
184 | acpi_status acpi_db_load_acpi_table(char *filename); | ||
185 | |||
186 | acpi_status | ||
187 | acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table); | ||
188 | |||
189 | acpi_status | ||
190 | acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table); | ||
191 | |||
192 | /* | ||
193 | * dbhistry - debugger HISTORY command | ||
194 | */ | ||
195 | void acpi_db_add_to_history(char *command_line); | ||
196 | |||
197 | void acpi_db_display_history(void); | ||
198 | |||
199 | char *acpi_db_get_from_history(char *command_num_arg); | ||
200 | |||
201 | /* | ||
202 | * dbinput - user front-end to the AML debugger | ||
203 | */ | ||
204 | acpi_status | ||
205 | acpi_db_command_dispatch(char *input_buffer, | ||
206 | struct acpi_walk_state *walk_state, | ||
207 | union acpi_parse_object *op); | ||
208 | |||
209 | void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); | ||
210 | |||
211 | /* | ||
212 | * dbstats - Generation and display of ACPI table statistics | ||
213 | */ | ||
214 | void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method); | ||
215 | |||
216 | acpi_status acpi_db_display_statistics(char *type_arg); | ||
217 | |||
218 | /* | ||
219 | * dbutils - AML debugger utilities | ||
220 | */ | ||
221 | void acpi_db_set_output_destination(u32 where); | ||
222 | |||
223 | void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level); | ||
224 | |||
225 | void acpi_db_prep_namestring(char *name); | ||
226 | |||
227 | struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name); | ||
228 | |||
229 | void acpi_db_uint32_to_hex_string(u32 value, char *buffer); | ||
230 | |||
231 | #endif /* __ACDEBUG_H__ */ | ||
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h new file mode 100644 index 000000000000..6291904be01e --- /dev/null +++ b/drivers/acpi/acpica/acdispat.h | |||
@@ -0,0 +1,345 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acdispat.h - dispatcher (parser to interpreter interface) | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef _ACDISPAT_H_ | ||
45 | #define _ACDISPAT_H_ | ||
46 | |||
47 | #define NAMEOF_LOCAL_NTE "__L0" | ||
48 | #define NAMEOF_ARG_NTE "__A0" | ||
49 | |||
50 | /* | ||
51 | * dsopcode - support for late evaluation | ||
52 | */ | ||
53 | acpi_status | ||
54 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); | ||
55 | |||
56 | acpi_status | ||
57 | acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc); | ||
58 | |||
59 | acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc); | ||
60 | |||
61 | acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc); | ||
62 | |||
63 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc); | ||
64 | |||
65 | acpi_status | ||
66 | acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | ||
67 | union acpi_parse_object *op); | ||
68 | |||
69 | acpi_status | ||
70 | acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | ||
71 | union acpi_parse_object *op); | ||
72 | |||
73 | acpi_status | ||
74 | acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | ||
75 | union acpi_parse_object *op); | ||
76 | |||
77 | acpi_status | ||
78 | acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | ||
79 | union acpi_parse_object *op, | ||
80 | union acpi_operand_object *obj_desc); | ||
81 | |||
82 | acpi_status | ||
83 | acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, | ||
84 | union acpi_parse_object *op); | ||
85 | |||
86 | acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); | ||
87 | |||
88 | /* | ||
89 | * dsctrl - Parser/Interpreter interface, control stack routines | ||
90 | */ | ||
91 | acpi_status | ||
92 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | ||
93 | union acpi_parse_object *op); | ||
94 | |||
95 | acpi_status | ||
96 | acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state, | ||
97 | union acpi_parse_object *op); | ||
98 | |||
99 | /* | ||
100 | * dsexec - Parser/Interpreter interface, method execution callbacks | ||
101 | */ | ||
102 | acpi_status | ||
103 | acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | ||
104 | union acpi_operand_object *result_obj); | ||
105 | |||
106 | acpi_status | ||
107 | acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | ||
108 | union acpi_parse_object **out_op); | ||
109 | |||
110 | acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state); | ||
111 | |||
112 | /* | ||
113 | * dsfield - Parser/Interpreter interface for AML fields | ||
114 | */ | ||
115 | acpi_status | ||
116 | acpi_ds_create_field(union acpi_parse_object *op, | ||
117 | struct acpi_namespace_node *region_node, | ||
118 | struct acpi_walk_state *walk_state); | ||
119 | |||
120 | acpi_status | ||
121 | acpi_ds_create_bank_field(union acpi_parse_object *op, | ||
122 | struct acpi_namespace_node *region_node, | ||
123 | struct acpi_walk_state *walk_state); | ||
124 | |||
125 | acpi_status | ||
126 | acpi_ds_create_index_field(union acpi_parse_object *op, | ||
127 | struct acpi_namespace_node *region_node, | ||
128 | struct acpi_walk_state *walk_state); | ||
129 | |||
130 | acpi_status | ||
131 | acpi_ds_create_buffer_field(union acpi_parse_object *op, | ||
132 | struct acpi_walk_state *walk_state); | ||
133 | |||
134 | acpi_status | ||
135 | acpi_ds_init_field_objects(union acpi_parse_object *op, | ||
136 | struct acpi_walk_state *walk_state); | ||
137 | |||
138 | /* | ||
139 | * dsload - Parser/Interpreter interface, namespace load callbacks | ||
140 | */ | ||
141 | acpi_status | ||
142 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | ||
143 | union acpi_parse_object **out_op); | ||
144 | |||
145 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); | ||
146 | |||
147 | acpi_status | ||
148 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | ||
149 | union acpi_parse_object **out_op); | ||
150 | |||
151 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state); | ||
152 | |||
153 | acpi_status | ||
154 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | ||
155 | |||
156 | /* | ||
157 | * dsmthdat - method data (locals/args) | ||
158 | */ | ||
159 | acpi_status | ||
160 | acpi_ds_store_object_to_local(u8 type, | ||
161 | u32 index, | ||
162 | union acpi_operand_object *src_desc, | ||
163 | struct acpi_walk_state *walk_state); | ||
164 | |||
165 | acpi_status | ||
166 | acpi_ds_method_data_get_entry(u16 opcode, | ||
167 | u32 index, | ||
168 | struct acpi_walk_state *walk_state, | ||
169 | union acpi_operand_object ***node); | ||
170 | |||
171 | void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state); | ||
172 | |||
173 | u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); | ||
174 | |||
175 | acpi_status | ||
176 | acpi_ds_method_data_get_value(u8 type, | ||
177 | u32 index, | ||
178 | struct acpi_walk_state *walk_state, | ||
179 | union acpi_operand_object **dest_desc); | ||
180 | |||
181 | acpi_status | ||
182 | acpi_ds_method_data_init_args(union acpi_operand_object **params, | ||
183 | u32 max_param_count, | ||
184 | struct acpi_walk_state *walk_state); | ||
185 | |||
186 | acpi_status | ||
187 | acpi_ds_method_data_get_node(u8 type, | ||
188 | u32 index, | ||
189 | struct acpi_walk_state *walk_state, | ||
190 | struct acpi_namespace_node **node); | ||
191 | |||
192 | void acpi_ds_method_data_init(struct acpi_walk_state *walk_state); | ||
193 | |||
194 | /* | ||
195 | * dsmethod - Parser/Interpreter interface - control method parsing | ||
196 | */ | ||
197 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node); | ||
198 | |||
199 | acpi_status | ||
200 | acpi_ds_call_control_method(struct acpi_thread_state *thread, | ||
201 | struct acpi_walk_state *walk_state, | ||
202 | union acpi_parse_object *op); | ||
203 | |||
204 | acpi_status | ||
205 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | ||
206 | union acpi_operand_object *return_desc); | ||
207 | |||
208 | void | ||
209 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
210 | struct acpi_walk_state *walk_state); | ||
211 | |||
212 | acpi_status | ||
213 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | ||
214 | union acpi_operand_object *obj_desc, | ||
215 | struct acpi_walk_state *walk_state); | ||
216 | |||
217 | acpi_status | ||
218 | acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state); | ||
219 | |||
220 | /* | ||
221 | * dsinit | ||
222 | */ | ||
223 | acpi_status | ||
224 | acpi_ds_initialize_objects(u32 table_index, | ||
225 | struct acpi_namespace_node *start_node); | ||
226 | |||
227 | /* | ||
228 | * dsobject - Parser/Interpreter interface - object initialization and conversion | ||
229 | */ | ||
230 | acpi_status | ||
231 | acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | ||
232 | union acpi_parse_object *op, | ||
233 | u32 buffer_length, | ||
234 | union acpi_operand_object **obj_desc_ptr); | ||
235 | |||
236 | acpi_status | ||
237 | acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | ||
238 | union acpi_parse_object *op, | ||
239 | u32 package_length, | ||
240 | union acpi_operand_object **obj_desc); | ||
241 | |||
242 | acpi_status | ||
243 | acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | ||
244 | union acpi_parse_object *op, | ||
245 | u16 opcode, union acpi_operand_object **obj_desc); | ||
246 | |||
247 | acpi_status | ||
248 | acpi_ds_create_node(struct acpi_walk_state *walk_state, | ||
249 | struct acpi_namespace_node *node, | ||
250 | union acpi_parse_object *op); | ||
251 | |||
252 | /* | ||
253 | * dsutils - Parser/Interpreter interface utility routines | ||
254 | */ | ||
255 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state); | ||
256 | |||
257 | u8 | ||
258 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, | ||
259 | struct acpi_walk_state *walk_state, | ||
260 | u8 add_reference); | ||
261 | |||
262 | u8 | ||
263 | acpi_ds_is_result_used(union acpi_parse_object *op, | ||
264 | struct acpi_walk_state *walk_state); | ||
265 | |||
266 | void | ||
267 | acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | ||
268 | union acpi_operand_object *result_obj, | ||
269 | struct acpi_walk_state *walk_state); | ||
270 | |||
271 | acpi_status | ||
272 | acpi_ds_create_operand(struct acpi_walk_state *walk_state, | ||
273 | union acpi_parse_object *arg, u32 args_remaining); | ||
274 | |||
275 | acpi_status | ||
276 | acpi_ds_create_operands(struct acpi_walk_state *walk_state, | ||
277 | union acpi_parse_object *first_arg); | ||
278 | |||
279 | acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state); | ||
280 | |||
281 | void acpi_ds_clear_operands(struct acpi_walk_state *walk_state); | ||
282 | |||
283 | acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state); | ||
284 | |||
285 | /* | ||
286 | * dswscope - Scope Stack manipulation | ||
287 | */ | ||
288 | acpi_status | ||
289 | acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | ||
290 | acpi_object_type type, | ||
291 | struct acpi_walk_state *walk_state); | ||
292 | |||
293 | acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state); | ||
294 | |||
295 | void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state); | ||
296 | |||
297 | /* | ||
298 | * dswstate - parser WALK_STATE management routines | ||
299 | */ | ||
300 | acpi_status | ||
301 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state); | ||
302 | |||
303 | acpi_status | ||
304 | acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state); | ||
305 | |||
306 | struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object | ||
307 | *origin, union acpi_operand_object | ||
308 | *mth_desc, struct acpi_thread_state | ||
309 | *thread); | ||
310 | |||
311 | acpi_status | ||
312 | acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | ||
313 | union acpi_parse_object *op, | ||
314 | struct acpi_namespace_node *method_node, | ||
315 | u8 * aml_start, | ||
316 | u32 aml_length, | ||
317 | struct acpi_evaluate_info *info, u8 pass_number); | ||
318 | |||
319 | void | ||
320 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | ||
321 | struct acpi_walk_state *walk_state); | ||
322 | |||
323 | void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state); | ||
324 | |||
325 | struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state | ||
326 | *thread); | ||
327 | |||
328 | void | ||
329 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, | ||
330 | struct acpi_thread_state *thread); | ||
331 | |||
332 | acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state); | ||
333 | |||
334 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | ||
335 | *thread); | ||
336 | |||
337 | acpi_status | ||
338 | acpi_ds_result_pop(union acpi_operand_object **object, | ||
339 | struct acpi_walk_state *walk_state); | ||
340 | |||
341 | acpi_status | ||
342 | acpi_ds_result_push(union acpi_operand_object *object, | ||
343 | struct acpi_walk_state *walk_state); | ||
344 | |||
345 | #endif /* _ACDISPAT_H_ */ | ||
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h new file mode 100644 index 000000000000..07e20135f01b --- /dev/null +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -0,0 +1,218 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acevents.h - Event subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACEVENTS_H__ | ||
45 | #define __ACEVENTS_H__ | ||
46 | |||
47 | /* | ||
48 | * evevent | ||
49 | */ | ||
50 | acpi_status acpi_ev_initialize_events(void); | ||
51 | |||
52 | acpi_status acpi_ev_install_xrupt_handlers(void); | ||
53 | |||
54 | acpi_status acpi_ev_install_fadt_gpes(void); | ||
55 | |||
56 | u32 acpi_ev_fixed_event_detect(void); | ||
57 | |||
58 | /* | ||
59 | * evmisc | ||
60 | */ | ||
61 | u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node); | ||
62 | |||
63 | acpi_status acpi_ev_acquire_global_lock(u16 timeout); | ||
64 | |||
65 | acpi_status acpi_ev_release_global_lock(void); | ||
66 | |||
67 | acpi_status acpi_ev_init_global_lock_handler(void); | ||
68 | |||
69 | u32 acpi_ev_get_gpe_number_index(u32 gpe_number); | ||
70 | |||
71 | acpi_status | ||
72 | acpi_ev_queue_notify_request(struct acpi_namespace_node *node, | ||
73 | u32 notify_value); | ||
74 | |||
75 | /* | ||
76 | * evgpe - GPE handling and dispatch | ||
77 | */ | ||
78 | acpi_status | ||
79 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | ||
80 | u8 type); | ||
81 | |||
82 | acpi_status | ||
83 | acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | ||
84 | u8 write_to_hardware); | ||
85 | |||
86 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
87 | |||
88 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | ||
89 | u32 gpe_number); | ||
90 | |||
91 | /* | ||
92 | * evgpeblk | ||
93 | */ | ||
94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); | ||
95 | |||
96 | acpi_status | ||
97 | acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context); | ||
98 | |||
99 | acpi_status | ||
100 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
101 | struct acpi_gpe_block_info *gpe_block, | ||
102 | void *context); | ||
103 | |||
104 | acpi_status | ||
105 | acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | ||
106 | struct acpi_generic_address *gpe_block_address, | ||
107 | u32 register_count, | ||
108 | u8 gpe_block_base_number, | ||
109 | u32 interrupt_number, | ||
110 | struct acpi_gpe_block_info **return_gpe_block); | ||
111 | |||
112 | acpi_status | ||
113 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | ||
114 | struct acpi_gpe_block_info *gpe_block); | ||
115 | |||
116 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); | ||
117 | |||
118 | u32 | ||
119 | acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, | ||
120 | u32 gpe_number); | ||
121 | |||
122 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | ||
123 | |||
124 | acpi_status | ||
125 | acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type); | ||
126 | |||
127 | acpi_status | ||
128 | acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
129 | |||
130 | acpi_status acpi_ev_gpe_initialize(void); | ||
131 | |||
132 | /* | ||
133 | * evregion - Address Space handling | ||
134 | */ | ||
135 | acpi_status acpi_ev_install_region_handlers(void); | ||
136 | |||
137 | acpi_status acpi_ev_initialize_op_regions(void); | ||
138 | |||
139 | acpi_status | ||
140 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | ||
141 | u32 function, | ||
142 | acpi_physical_address address, | ||
143 | u32 bit_width, acpi_integer * value); | ||
144 | |||
145 | acpi_status | ||
146 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, | ||
147 | union acpi_operand_object *region_obj, | ||
148 | u8 acpi_ns_is_locked); | ||
149 | |||
150 | void | ||
151 | acpi_ev_detach_region(union acpi_operand_object *region_obj, | ||
152 | u8 acpi_ns_is_locked); | ||
153 | |||
154 | acpi_status | ||
155 | acpi_ev_install_space_handler(struct acpi_namespace_node *node, | ||
156 | acpi_adr_space_type space_id, | ||
157 | acpi_adr_space_handler handler, | ||
158 | acpi_adr_space_setup setup, void *context); | ||
159 | |||
160 | acpi_status | ||
161 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | ||
162 | acpi_adr_space_type space_id); | ||
163 | |||
164 | acpi_status | ||
165 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); | ||
166 | |||
167 | /* | ||
168 | * evregini - Region initialization and setup | ||
169 | */ | ||
170 | acpi_status | ||
171 | acpi_ev_system_memory_region_setup(acpi_handle handle, | ||
172 | u32 function, | ||
173 | void *handler_context, | ||
174 | void **region_context); | ||
175 | |||
176 | acpi_status | ||
177 | acpi_ev_io_space_region_setup(acpi_handle handle, | ||
178 | u32 function, | ||
179 | void *handler_context, void **region_context); | ||
180 | |||
181 | acpi_status | ||
182 | acpi_ev_pci_config_region_setup(acpi_handle handle, | ||
183 | u32 function, | ||
184 | void *handler_context, void **region_context); | ||
185 | |||
186 | acpi_status | ||
187 | acpi_ev_cmos_region_setup(acpi_handle handle, | ||
188 | u32 function, | ||
189 | void *handler_context, void **region_context); | ||
190 | |||
191 | acpi_status | ||
192 | acpi_ev_pci_bar_region_setup(acpi_handle handle, | ||
193 | u32 function, | ||
194 | void *handler_context, void **region_context); | ||
195 | |||
196 | acpi_status | ||
197 | acpi_ev_default_region_setup(acpi_handle handle, | ||
198 | u32 function, | ||
199 | void *handler_context, void **region_context); | ||
200 | |||
201 | acpi_status | ||
202 | acpi_ev_initialize_region(union acpi_operand_object *region_obj, | ||
203 | u8 acpi_ns_locked); | ||
204 | |||
205 | /* | ||
206 | * evsci - SCI (System Control Interrupt) handling/dispatch | ||
207 | */ | ||
208 | u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context); | ||
209 | |||
210 | u32 acpi_ev_install_sci_handler(void); | ||
211 | |||
212 | acpi_status acpi_ev_remove_sci_handler(void); | ||
213 | |||
214 | u32 acpi_ev_initialize_sCI(u32 program_sCI); | ||
215 | |||
216 | void acpi_ev_terminate(void); | ||
217 | |||
218 | #endif /* __ACEVENTS_H__ */ | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h new file mode 100644 index 000000000000..ddb40f5c68fc --- /dev/null +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -0,0 +1,394 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acglobal.h - Declarations for global variables | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACGLOBAL_H__ | ||
45 | #define __ACGLOBAL_H__ | ||
46 | |||
47 | /* | ||
48 | * Ensure that the globals are actually defined and initialized only once. | ||
49 | * | ||
50 | * The use of these macros allows a single list of globals (here) in order | ||
51 | * to simplify maintenance of the code. | ||
52 | */ | ||
53 | #ifdef DEFINE_ACPI_GLOBALS | ||
54 | #define ACPI_EXTERN | ||
55 | #define ACPI_INIT_GLOBAL(a,b) a=b | ||
56 | #else | ||
57 | #define ACPI_EXTERN extern | ||
58 | #define ACPI_INIT_GLOBAL(a,b) a | ||
59 | #endif | ||
60 | |||
61 | /***************************************************************************** | ||
62 | * | ||
63 | * Runtime configuration (static defaults that can be overriden at runtime) | ||
64 | * | ||
65 | ****************************************************************************/ | ||
66 | |||
67 | /* | ||
68 | * Enable "slack" in the AML interpreter? Default is FALSE, and the | ||
69 | * interpreter strictly follows the ACPI specification. Setting to TRUE | ||
70 | * allows the interpreter to ignore certain errors and/or bad AML constructs. | ||
71 | * | ||
72 | * Currently, these features are enabled by this flag: | ||
73 | * | ||
74 | * 1) Allow "implicit return" of last value in a control method | ||
75 | * 2) Allow access beyond the end of an operation region | ||
76 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | ||
77 | * 4) Allow ANY object type to be a source operand for the Store() operator | ||
78 | * 5) Allow unresolved references (invalid target name) in package objects | ||
79 | * 6) Enable warning messages for behavior that is not ACPI spec compliant | ||
80 | */ | ||
81 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | ||
82 | |||
83 | /* | ||
84 | * Automatically serialize ALL control methods? Default is FALSE, meaning | ||
85 | * to use the Serialized/not_serialized method flags on a per method basis. | ||
86 | * Only change this if the ASL code is poorly written and cannot handle | ||
87 | * reentrancy even though methods are marked "NotSerialized". | ||
88 | */ | ||
89 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); | ||
90 | |||
91 | /* | ||
92 | * Create the predefined _OSI method in the namespace? Default is TRUE | ||
93 | * because ACPI CA is fully compatible with other ACPI implementations. | ||
94 | * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. | ||
95 | */ | ||
96 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); | ||
97 | |||
98 | /* | ||
99 | * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and | ||
100 | * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only | ||
101 | * be enabled just before going to sleep. | ||
102 | */ | ||
103 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); | ||
104 | |||
105 | /* | ||
106 | * Optionally use default values for the ACPI register widths. Set this to | ||
107 | * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. | ||
108 | */ | ||
109 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); | ||
110 | |||
111 | /***************************************************************************** | ||
112 | * | ||
113 | * Debug support | ||
114 | * | ||
115 | ****************************************************************************/ | ||
116 | |||
117 | /* Runtime configuration of debug print levels */ | ||
118 | |||
119 | extern u32 acpi_dbg_level; | ||
120 | extern u32 acpi_dbg_layer; | ||
121 | |||
122 | /* Procedure nesting level for debug output */ | ||
123 | |||
124 | extern u32 acpi_gbl_nesting_level; | ||
125 | |||
126 | /* Support for dynamic control method tracing mechanism */ | ||
127 | |||
128 | ACPI_EXTERN u32 acpi_gbl_original_dbg_level; | ||
129 | ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; | ||
130 | ACPI_EXTERN acpi_name acpi_gbl_trace_method_name; | ||
131 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; | ||
132 | ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; | ||
133 | ACPI_EXTERN u32 acpi_gbl_trace_flags; | ||
134 | |||
135 | /***************************************************************************** | ||
136 | * | ||
137 | * ACPI Table globals | ||
138 | * | ||
139 | ****************************************************************************/ | ||
140 | |||
141 | /* | ||
142 | * acpi_gbl_root_table_list is the master list of ACPI tables found in the | ||
143 | * RSDT/XSDT. | ||
144 | * | ||
145 | * acpi_gbl_FADT is a local copy of the FADT, converted to a common format. | ||
146 | */ | ||
147 | ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; | ||
148 | ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; | ||
149 | ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; | ||
150 | |||
151 | /* These addresses are calculated from FADT address values */ | ||
152 | |||
153 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; | ||
154 | ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; | ||
155 | |||
156 | /* | ||
157 | * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is | ||
158 | * determined by the revision of the DSDT: If the DSDT revision is less than | ||
159 | * 2, use only the lower 32 bits of the internal 64-bit Integer. | ||
160 | */ | ||
161 | ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | ||
162 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | ||
163 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | ||
164 | |||
165 | /***************************************************************************** | ||
166 | * | ||
167 | * Mutual exlusion within ACPICA subsystem | ||
168 | * | ||
169 | ****************************************************************************/ | ||
170 | |||
171 | /* | ||
172 | * Predefined mutex objects. This array contains the | ||
173 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. | ||
174 | * (The table maps local handles to the real OS handles) | ||
175 | */ | ||
176 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; | ||
177 | |||
178 | /* | ||
179 | * Global lock mutex is an actual AML mutex object | ||
180 | * Global lock semaphore works in conjunction with the HW global lock | ||
181 | */ | ||
182 | ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex; | ||
183 | ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore; | ||
184 | ACPI_EXTERN u16 acpi_gbl_global_lock_handle; | ||
185 | ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; | ||
186 | ACPI_EXTERN u8 acpi_gbl_global_lock_present; | ||
187 | |||
188 | /* | ||
189 | * Spinlocks are used for interfaces that can be possibly called at | ||
190 | * interrupt level | ||
191 | */ | ||
192 | ACPI_EXTERN spinlock_t _acpi_gbl_gpe_lock; /* For GPE data structs and registers */ | ||
193 | ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */ | ||
194 | #define acpi_gbl_gpe_lock &_acpi_gbl_gpe_lock | ||
195 | #define acpi_gbl_hardware_lock &_acpi_gbl_hardware_lock | ||
196 | |||
197 | /***************************************************************************** | ||
198 | * | ||
199 | * Miscellaneous globals | ||
200 | * | ||
201 | ****************************************************************************/ | ||
202 | |||
203 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
204 | |||
205 | /* Lists for tracking memory allocations */ | ||
206 | |||
207 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; | ||
208 | ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | ||
209 | ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats; | ||
210 | #endif | ||
211 | |||
212 | /* Object caches */ | ||
213 | |||
214 | ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; | ||
215 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; | ||
216 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; | ||
217 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; | ||
218 | ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache; | ||
219 | |||
220 | /* Global handlers */ | ||
221 | |||
222 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; | ||
223 | ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; | ||
224 | ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; | ||
225 | ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | ||
226 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; | ||
227 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | ||
228 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | ||
229 | |||
230 | /* Owner ID support */ | ||
231 | |||
232 | ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; | ||
233 | ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; | ||
234 | ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; | ||
235 | |||
236 | /* Misc */ | ||
237 | |||
238 | ACPI_EXTERN u32 acpi_gbl_original_mode; | ||
239 | ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; | ||
240 | ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; | ||
241 | ACPI_EXTERN u32 acpi_gbl_ps_find_count; | ||
242 | ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; | ||
243 | ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | ||
244 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | ||
245 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; | ||
246 | ACPI_EXTERN u8 acpi_gbl_events_initialized; | ||
247 | ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; | ||
248 | |||
249 | #ifndef DEFINE_ACPI_GLOBALS | ||
250 | |||
251 | /* Other miscellaneous */ | ||
252 | |||
253 | extern u8 acpi_gbl_shutdown; | ||
254 | extern u32 acpi_gbl_startup_flags; | ||
255 | extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | ||
256 | extern const char *acpi_gbl_highest_dstate_names[4]; | ||
257 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | ||
258 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | ||
259 | |||
260 | #endif | ||
261 | |||
262 | /* Exception codes */ | ||
263 | |||
264 | extern char const *acpi_gbl_exception_names_env[]; | ||
265 | extern char const *acpi_gbl_exception_names_pgm[]; | ||
266 | extern char const *acpi_gbl_exception_names_tbl[]; | ||
267 | extern char const *acpi_gbl_exception_names_aml[]; | ||
268 | extern char const *acpi_gbl_exception_names_ctrl[]; | ||
269 | |||
270 | /***************************************************************************** | ||
271 | * | ||
272 | * Namespace globals | ||
273 | * | ||
274 | ****************************************************************************/ | ||
275 | |||
276 | #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) | ||
277 | #define NUM_PREDEFINED_NAMES 10 | ||
278 | #else | ||
279 | #define NUM_PREDEFINED_NAMES 9 | ||
280 | #endif | ||
281 | |||
282 | ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; | ||
283 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; | ||
284 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; | ||
285 | |||
286 | extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; | ||
287 | extern const struct acpi_predefined_names | ||
288 | acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; | ||
289 | |||
290 | #ifdef ACPI_DEBUG_OUTPUT | ||
291 | ACPI_EXTERN u32 acpi_gbl_current_node_count; | ||
292 | ACPI_EXTERN u32 acpi_gbl_current_node_size; | ||
293 | ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; | ||
294 | ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer; | ||
295 | ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer; | ||
296 | ACPI_EXTERN u32 acpi_gbl_deepest_nesting; | ||
297 | #endif | ||
298 | |||
299 | /***************************************************************************** | ||
300 | * | ||
301 | * Interpreter globals | ||
302 | * | ||
303 | ****************************************************************************/ | ||
304 | |||
305 | ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list; | ||
306 | |||
307 | /* Control method single step flag */ | ||
308 | |||
309 | ACPI_EXTERN u8 acpi_gbl_cm_single_step; | ||
310 | |||
311 | /***************************************************************************** | ||
312 | * | ||
313 | * Hardware globals | ||
314 | * | ||
315 | ****************************************************************************/ | ||
316 | |||
317 | extern struct acpi_bit_register_info | ||
318 | acpi_gbl_bit_register_info[ACPI_NUM_BITREG]; | ||
319 | ACPI_EXTERN u8 acpi_gbl_sleep_type_a; | ||
320 | ACPI_EXTERN u8 acpi_gbl_sleep_type_b; | ||
321 | |||
322 | /***************************************************************************** | ||
323 | * | ||
324 | * Event and GPE globals | ||
325 | * | ||
326 | ****************************************************************************/ | ||
327 | |||
328 | extern struct acpi_fixed_event_info | ||
329 | acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS]; | ||
330 | ACPI_EXTERN struct acpi_fixed_event_handler | ||
331 | acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]; | ||
332 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | ||
333 | ACPI_EXTERN struct acpi_gpe_block_info | ||
334 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | ||
335 | ACPI_EXTERN u32 acpi_current_gpe_count; | ||
336 | |||
337 | /***************************************************************************** | ||
338 | * | ||
339 | * Debugger globals | ||
340 | * | ||
341 | ****************************************************************************/ | ||
342 | |||
343 | ACPI_EXTERN u8 acpi_gbl_db_output_flags; | ||
344 | |||
345 | #ifdef ACPI_DISASSEMBLER | ||
346 | |||
347 | ACPI_EXTERN u8 acpi_gbl_db_opt_disasm; | ||
348 | ACPI_EXTERN u8 acpi_gbl_db_opt_verbose; | ||
349 | #endif | ||
350 | |||
351 | #ifdef ACPI_DEBUGGER | ||
352 | |||
353 | extern u8 acpi_gbl_method_executing; | ||
354 | extern u8 acpi_gbl_abort_method; | ||
355 | extern u8 acpi_gbl_db_terminate_threads; | ||
356 | |||
357 | ACPI_EXTERN int optind; | ||
358 | ACPI_EXTERN char *optarg; | ||
359 | |||
360 | ACPI_EXTERN u8 acpi_gbl_db_opt_tables; | ||
361 | ACPI_EXTERN u8 acpi_gbl_db_opt_stats; | ||
362 | ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; | ||
363 | |||
364 | ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; | ||
365 | ACPI_EXTERN char acpi_gbl_db_line_buf[80]; | ||
366 | ACPI_EXTERN char acpi_gbl_db_parsed_buf[80]; | ||
367 | ACPI_EXTERN char acpi_gbl_db_scope_buf[40]; | ||
368 | ACPI_EXTERN char acpi_gbl_db_debug_filename[40]; | ||
369 | ACPI_EXTERN u8 acpi_gbl_db_output_to_file; | ||
370 | ACPI_EXTERN char *acpi_gbl_db_buffer; | ||
371 | ACPI_EXTERN char *acpi_gbl_db_filename; | ||
372 | ACPI_EXTERN u32 acpi_gbl_db_debug_level; | ||
373 | ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; | ||
374 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr; | ||
375 | ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; | ||
376 | |||
377 | /* | ||
378 | * Statistic globals | ||
379 | */ | ||
380 | ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; | ||
381 | ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1]; | ||
382 | ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc; | ||
383 | ACPI_EXTERN u16 acpi_gbl_node_type_count_misc; | ||
384 | ACPI_EXTERN u32 acpi_gbl_num_nodes; | ||
385 | ACPI_EXTERN u32 acpi_gbl_num_objects; | ||
386 | |||
387 | ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree; | ||
388 | ACPI_EXTERN u32 acpi_gbl_size_of_method_trees; | ||
389 | ACPI_EXTERN u32 acpi_gbl_size_of_node_entries; | ||
390 | ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects; | ||
391 | |||
392 | #endif /* ACPI_DEBUGGER */ | ||
393 | |||
394 | #endif /* __ACGLOBAL_H__ */ | ||
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h new file mode 100644 index 000000000000..58c69dc49ab4 --- /dev/null +++ b/drivers/acpi/acpica/achware.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: achware.h -- hardware specific interfaces | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACHWARE_H__ | ||
45 | #define __ACHWARE_H__ | ||
46 | |||
47 | /* Values for the _SST predefined method */ | ||
48 | |||
49 | #define ACPI_SST_INDICATOR_OFF 0 | ||
50 | #define ACPI_SST_WORKING 1 | ||
51 | #define ACPI_SST_WAKING 2 | ||
52 | #define ACPI_SST_SLEEPING 3 | ||
53 | #define ACPI_SST_SLEEP_CONTEXT 4 | ||
54 | |||
55 | /* | ||
56 | * hwacpi - high level functions | ||
57 | */ | ||
58 | acpi_status acpi_hw_set_mode(u32 mode); | ||
59 | |||
60 | u32 acpi_hw_get_mode(void); | ||
61 | |||
62 | /* | ||
63 | * hwregs - ACPI Register I/O | ||
64 | */ | ||
65 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); | ||
66 | |||
67 | acpi_status | ||
68 | acpi_hw_register_read(u32 register_id, u32 * return_value); | ||
69 | |||
70 | acpi_status acpi_hw_register_write(u32 register_id, u32 value); | ||
71 | |||
72 | acpi_status acpi_hw_clear_acpi_status(void); | ||
73 | |||
74 | /* | ||
75 | * hwgpe - GPE support | ||
76 | */ | ||
77 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
78 | |||
79 | acpi_status | ||
80 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); | ||
81 | |||
82 | acpi_status | ||
83 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
84 | struct acpi_gpe_block_info *gpe_block, void *context); | ||
85 | |||
86 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
87 | |||
88 | acpi_status | ||
89 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
90 | struct acpi_gpe_block_info *gpe_block, void *context); | ||
91 | |||
92 | acpi_status | ||
93 | acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, | ||
94 | acpi_event_status * event_status); | ||
95 | |||
96 | acpi_status acpi_hw_disable_all_gpes(void); | ||
97 | |||
98 | acpi_status acpi_hw_enable_all_runtime_gpes(void); | ||
99 | |||
100 | acpi_status acpi_hw_enable_all_wakeup_gpes(void); | ||
101 | |||
102 | acpi_status | ||
103 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
104 | struct acpi_gpe_block_info *gpe_block, | ||
105 | void *context); | ||
106 | |||
107 | #ifdef ACPI_FUTURE_USAGE | ||
108 | /* | ||
109 | * hwtimer - ACPI Timer prototypes | ||
110 | */ | ||
111 | acpi_status acpi_get_timer_resolution(u32 * resolution); | ||
112 | |||
113 | acpi_status acpi_get_timer(u32 * ticks); | ||
114 | |||
115 | acpi_status | ||
116 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed); | ||
117 | #endif /* ACPI_FUTURE_USAGE */ | ||
118 | |||
119 | #endif /* __ACHWARE_H__ */ | ||
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h new file mode 100644 index 000000000000..e8db7a3143a5 --- /dev/null +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -0,0 +1,529 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acinterp.h - Interpreter subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACINTERP_H__ | ||
45 | #define __ACINTERP_H__ | ||
46 | |||
47 | #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) | ||
48 | |||
49 | /* Macros for tables used for debug output */ | ||
50 | |||
51 | #define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f) | ||
52 | #define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f) | ||
53 | #define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info)) | ||
54 | |||
55 | /* | ||
56 | * If possible, pack the following structures to byte alignment, since we | ||
57 | * don't care about performance for debug output. Two cases where we cannot | ||
58 | * pack the structures: | ||
59 | * | ||
60 | * 1) Hardware does not support misaligned memory transfers | ||
61 | * 2) Compiler does not support pointers within packed structures | ||
62 | */ | ||
63 | #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) | ||
64 | #pragma pack(1) | ||
65 | #endif | ||
66 | |||
67 | typedef const struct acpi_exdump_info { | ||
68 | u8 opcode; | ||
69 | u8 offset; | ||
70 | char *name; | ||
71 | |||
72 | } acpi_exdump_info; | ||
73 | |||
74 | /* Values for the Opcode field above */ | ||
75 | |||
76 | #define ACPI_EXD_INIT 0 | ||
77 | #define ACPI_EXD_TYPE 1 | ||
78 | #define ACPI_EXD_UINT8 2 | ||
79 | #define ACPI_EXD_UINT16 3 | ||
80 | #define ACPI_EXD_UINT32 4 | ||
81 | #define ACPI_EXD_UINT64 5 | ||
82 | #define ACPI_EXD_LITERAL 6 | ||
83 | #define ACPI_EXD_POINTER 7 | ||
84 | #define ACPI_EXD_ADDRESS 8 | ||
85 | #define ACPI_EXD_STRING 9 | ||
86 | #define ACPI_EXD_BUFFER 10 | ||
87 | #define ACPI_EXD_PACKAGE 11 | ||
88 | #define ACPI_EXD_FIELD 12 | ||
89 | #define ACPI_EXD_REFERENCE 13 | ||
90 | |||
91 | /* restore default alignment */ | ||
92 | |||
93 | #pragma pack() | ||
94 | |||
95 | /* | ||
96 | * exconvrt - object conversion | ||
97 | */ | ||
98 | acpi_status | ||
99 | acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | ||
100 | union acpi_operand_object **result_desc, u32 flags); | ||
101 | |||
102 | acpi_status | ||
103 | acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | ||
104 | union acpi_operand_object **result_desc); | ||
105 | |||
106 | acpi_status | ||
107 | acpi_ex_convert_to_string(union acpi_operand_object *obj_desc, | ||
108 | union acpi_operand_object **result_desc, u32 type); | ||
109 | |||
110 | /* Types for ->String conversion */ | ||
111 | |||
112 | #define ACPI_EXPLICIT_BYTE_COPY 0x00000000 | ||
113 | #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 | ||
114 | #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002 | ||
115 | #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 | ||
116 | |||
117 | acpi_status | ||
118 | acpi_ex_convert_to_target_type(acpi_object_type destination_type, | ||
119 | union acpi_operand_object *source_desc, | ||
120 | union acpi_operand_object **result_desc, | ||
121 | struct acpi_walk_state *walk_state); | ||
122 | |||
123 | /* | ||
124 | * exfield - ACPI AML (p-code) execution - field manipulation | ||
125 | */ | ||
126 | acpi_status | ||
127 | acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc, | ||
128 | u32 buffer_length, u32 * datum_count); | ||
129 | |||
130 | acpi_status | ||
131 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | ||
132 | acpi_integer mask, | ||
133 | acpi_integer field_value, | ||
134 | u32 field_datum_byte_offset); | ||
135 | |||
136 | void | ||
137 | acpi_ex_get_buffer_datum(acpi_integer * datum, | ||
138 | void *buffer, | ||
139 | u32 buffer_length, | ||
140 | u32 byte_granularity, u32 buffer_offset); | ||
141 | |||
142 | void | ||
143 | acpi_ex_set_buffer_datum(acpi_integer merged_datum, | ||
144 | void *buffer, | ||
145 | u32 buffer_length, | ||
146 | u32 byte_granularity, u32 buffer_offset); | ||
147 | |||
148 | acpi_status | ||
149 | acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | ||
150 | union acpi_operand_object *obj_desc, | ||
151 | union acpi_operand_object **ret_buffer_desc); | ||
152 | |||
153 | acpi_status | ||
154 | acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | ||
155 | union acpi_operand_object *obj_desc, | ||
156 | union acpi_operand_object **result_desc); | ||
157 | |||
158 | /* | ||
159 | * exfldio - low level field I/O | ||
160 | */ | ||
161 | acpi_status | ||
162 | acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | ||
163 | void *buffer, u32 buffer_length); | ||
164 | |||
165 | acpi_status | ||
166 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | ||
167 | void *buffer, u32 buffer_length); | ||
168 | |||
169 | acpi_status | ||
170 | acpi_ex_access_region(union acpi_operand_object *obj_desc, | ||
171 | u32 field_datum_byte_offset, | ||
172 | acpi_integer * value, u32 read_write); | ||
173 | |||
174 | /* | ||
175 | * exmisc - misc support routines | ||
176 | */ | ||
177 | acpi_status | ||
178 | acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | ||
179 | union acpi_operand_object **return_desc, | ||
180 | struct acpi_walk_state *walk_state); | ||
181 | |||
182 | acpi_status | ||
183 | acpi_ex_concat_template(union acpi_operand_object *obj_desc, | ||
184 | union acpi_operand_object *obj_desc2, | ||
185 | union acpi_operand_object **actual_return_desc, | ||
186 | struct acpi_walk_state *walk_state); | ||
187 | |||
188 | acpi_status | ||
189 | acpi_ex_do_concatenate(union acpi_operand_object *obj_desc, | ||
190 | union acpi_operand_object *obj_desc2, | ||
191 | union acpi_operand_object **actual_return_desc, | ||
192 | struct acpi_walk_state *walk_state); | ||
193 | |||
194 | acpi_status | ||
195 | acpi_ex_do_logical_numeric_op(u16 opcode, | ||
196 | acpi_integer integer0, | ||
197 | acpi_integer integer1, u8 * logical_result); | ||
198 | |||
199 | acpi_status | ||
200 | acpi_ex_do_logical_op(u16 opcode, | ||
201 | union acpi_operand_object *operand0, | ||
202 | union acpi_operand_object *operand1, u8 * logical_result); | ||
203 | |||
204 | acpi_integer | ||
205 | acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1); | ||
206 | |||
207 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); | ||
208 | |||
209 | acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state); | ||
210 | |||
211 | acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state); | ||
212 | |||
213 | acpi_status | ||
214 | acpi_ex_create_region(u8 * aml_start, | ||
215 | u32 aml_length, | ||
216 | u8 region_space, struct acpi_walk_state *walk_state); | ||
217 | |||
218 | acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state); | ||
219 | |||
220 | acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state); | ||
221 | |||
222 | acpi_status | ||
223 | acpi_ex_create_method(u8 * aml_start, | ||
224 | u32 aml_length, struct acpi_walk_state *walk_state); | ||
225 | |||
226 | /* | ||
227 | * exconfig - dynamic table load/unload | ||
228 | */ | ||
229 | acpi_status | ||
230 | acpi_ex_load_op(union acpi_operand_object *obj_desc, | ||
231 | union acpi_operand_object *target, | ||
232 | struct acpi_walk_state *walk_state); | ||
233 | |||
234 | acpi_status | ||
235 | acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | ||
236 | union acpi_operand_object **return_desc); | ||
237 | |||
238 | acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle); | ||
239 | |||
240 | /* | ||
241 | * exmutex - mutex support | ||
242 | */ | ||
243 | acpi_status | ||
244 | acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | ||
245 | union acpi_operand_object *obj_desc, | ||
246 | struct acpi_walk_state *walk_state); | ||
247 | |||
248 | acpi_status | ||
249 | acpi_ex_acquire_mutex_object(u16 timeout, | ||
250 | union acpi_operand_object *obj_desc, | ||
251 | acpi_thread_id thread_id); | ||
252 | |||
253 | acpi_status | ||
254 | acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | ||
255 | struct acpi_walk_state *walk_state); | ||
256 | |||
257 | acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc); | ||
258 | |||
259 | void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread); | ||
260 | |||
261 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc); | ||
262 | |||
263 | /* | ||
264 | * exprep - ACPI AML execution - prep utilities | ||
265 | */ | ||
266 | acpi_status | ||
267 | acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | ||
268 | u8 field_flags, | ||
269 | u8 field_attribute, | ||
270 | u32 field_bit_position, u32 field_bit_length); | ||
271 | |||
272 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info); | ||
273 | |||
274 | /* | ||
275 | * exsystem - Interface to OS services | ||
276 | */ | ||
277 | acpi_status | ||
278 | acpi_ex_system_do_notify_op(union acpi_operand_object *value, | ||
279 | union acpi_operand_object *obj_desc); | ||
280 | |||
281 | acpi_status acpi_ex_system_do_suspend(acpi_integer time); | ||
282 | |||
283 | acpi_status acpi_ex_system_do_stall(u32 time); | ||
284 | |||
285 | acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc); | ||
286 | |||
287 | acpi_status | ||
288 | acpi_ex_system_wait_event(union acpi_operand_object *time, | ||
289 | union acpi_operand_object *obj_desc); | ||
290 | |||
291 | acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc); | ||
292 | |||
293 | acpi_status | ||
294 | acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout); | ||
295 | |||
296 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout); | ||
297 | |||
298 | /* | ||
299 | * exoparg1 - ACPI AML execution, 1 operand | ||
300 | */ | ||
301 | acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state); | ||
302 | |||
303 | acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state); | ||
304 | |||
305 | acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state); | ||
306 | |||
307 | acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state); | ||
308 | |||
309 | acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state); | ||
310 | |||
311 | /* | ||
312 | * exoparg2 - ACPI AML execution, 2 operands | ||
313 | */ | ||
314 | acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state); | ||
315 | |||
316 | acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state); | ||
317 | |||
318 | acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state); | ||
319 | |||
320 | acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state); | ||
321 | |||
322 | /* | ||
323 | * exoparg3 - ACPI AML execution, 3 operands | ||
324 | */ | ||
325 | acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state); | ||
326 | |||
327 | acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state); | ||
328 | |||
329 | /* | ||
330 | * exoparg6 - ACPI AML execution, 6 operands | ||
331 | */ | ||
332 | acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state); | ||
333 | |||
334 | /* | ||
335 | * exresolv - Object resolution and get value functions | ||
336 | */ | ||
337 | acpi_status | ||
338 | acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, | ||
339 | struct acpi_walk_state *walk_state); | ||
340 | |||
341 | acpi_status | ||
342 | acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | ||
343 | union acpi_operand_object *operand, | ||
344 | acpi_object_type * return_type, | ||
345 | union acpi_operand_object **return_desc); | ||
346 | |||
347 | /* | ||
348 | * exresnte - resolve namespace node | ||
349 | */ | ||
350 | acpi_status | ||
351 | acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr, | ||
352 | struct acpi_walk_state *walk_state); | ||
353 | |||
354 | /* | ||
355 | * exresop - resolve operand to value | ||
356 | */ | ||
357 | acpi_status | ||
358 | acpi_ex_resolve_operands(u16 opcode, | ||
359 | union acpi_operand_object **stack_ptr, | ||
360 | struct acpi_walk_state *walk_state); | ||
361 | |||
362 | /* | ||
363 | * exdump - Interpreter debug output routines | ||
364 | */ | ||
365 | void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth); | ||
366 | |||
367 | void | ||
368 | acpi_ex_dump_operands(union acpi_operand_object **operands, | ||
369 | const char *opcode_name, u32 num_opcodes); | ||
370 | |||
371 | #ifdef ACPI_FUTURE_USAGE | ||
372 | void | ||
373 | acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags); | ||
374 | |||
375 | void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags); | ||
376 | #endif /* ACPI_FUTURE_USAGE */ | ||
377 | |||
378 | /* | ||
379 | * exnames - AML namestring support | ||
380 | */ | ||
381 | acpi_status | ||
382 | acpi_ex_get_name_string(acpi_object_type data_type, | ||
383 | u8 * in_aml_address, | ||
384 | char **out_name_string, u32 * out_name_length); | ||
385 | |||
386 | /* | ||
387 | * exstore - Object store support | ||
388 | */ | ||
389 | acpi_status | ||
390 | acpi_ex_store(union acpi_operand_object *val_desc, | ||
391 | union acpi_operand_object *dest_desc, | ||
392 | struct acpi_walk_state *walk_state); | ||
393 | |||
394 | acpi_status | ||
395 | acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | ||
396 | struct acpi_namespace_node *node, | ||
397 | struct acpi_walk_state *walk_state, | ||
398 | u8 implicit_conversion); | ||
399 | |||
400 | #define ACPI_IMPLICIT_CONVERSION TRUE | ||
401 | #define ACPI_NO_IMPLICIT_CONVERSION FALSE | ||
402 | |||
403 | /* | ||
404 | * exstoren - resolve/store object | ||
405 | */ | ||
406 | acpi_status | ||
407 | acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | ||
408 | acpi_object_type target_type, | ||
409 | struct acpi_walk_state *walk_state); | ||
410 | |||
411 | acpi_status | ||
412 | acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | ||
413 | union acpi_operand_object *dest_desc, | ||
414 | union acpi_operand_object **new_desc, | ||
415 | struct acpi_walk_state *walk_state); | ||
416 | |||
417 | /* | ||
418 | * exstorob - store object - buffer/string | ||
419 | */ | ||
420 | acpi_status | ||
421 | acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | ||
422 | union acpi_operand_object *target_desc); | ||
423 | |||
424 | acpi_status | ||
425 | acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | ||
426 | union acpi_operand_object *target_desc); | ||
427 | |||
428 | /* | ||
429 | * excopy - object copy | ||
430 | */ | ||
431 | acpi_status | ||
432 | acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc, | ||
433 | union acpi_operand_object *target_desc); | ||
434 | |||
435 | acpi_status | ||
436 | acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc, | ||
437 | union acpi_operand_object *target_desc); | ||
438 | |||
439 | acpi_status | ||
440 | acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc, | ||
441 | struct acpi_namespace_node *node); | ||
442 | |||
443 | acpi_status | ||
444 | acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc, | ||
445 | union acpi_operand_object *target_desc); | ||
446 | |||
447 | /* | ||
448 | * exutils - interpreter/scanner utilities | ||
449 | */ | ||
450 | void acpi_ex_enter_interpreter(void); | ||
451 | |||
452 | void acpi_ex_exit_interpreter(void); | ||
453 | |||
454 | void acpi_ex_reacquire_interpreter(void); | ||
455 | |||
456 | void acpi_ex_relinquish_interpreter(void); | ||
457 | |||
458 | void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); | ||
459 | |||
460 | void acpi_ex_acquire_global_lock(u32 rule); | ||
461 | |||
462 | void acpi_ex_release_global_lock(u32 rule); | ||
463 | |||
464 | void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); | ||
465 | |||
466 | void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); | ||
467 | |||
468 | /* | ||
469 | * exregion - default op_region handlers | ||
470 | */ | ||
471 | acpi_status | ||
472 | acpi_ex_system_memory_space_handler(u32 function, | ||
473 | acpi_physical_address address, | ||
474 | u32 bit_width, | ||
475 | acpi_integer * value, | ||
476 | void *handler_context, | ||
477 | void *region_context); | ||
478 | |||
479 | acpi_status | ||
480 | acpi_ex_system_io_space_handler(u32 function, | ||
481 | acpi_physical_address address, | ||
482 | u32 bit_width, | ||
483 | acpi_integer * value, | ||
484 | void *handler_context, void *region_context); | ||
485 | |||
486 | acpi_status | ||
487 | acpi_ex_pci_config_space_handler(u32 function, | ||
488 | acpi_physical_address address, | ||
489 | u32 bit_width, | ||
490 | acpi_integer * value, | ||
491 | void *handler_context, void *region_context); | ||
492 | |||
493 | acpi_status | ||
494 | acpi_ex_cmos_space_handler(u32 function, | ||
495 | acpi_physical_address address, | ||
496 | u32 bit_width, | ||
497 | acpi_integer * value, | ||
498 | void *handler_context, void *region_context); | ||
499 | |||
500 | acpi_status | ||
501 | acpi_ex_pci_bar_space_handler(u32 function, | ||
502 | acpi_physical_address address, | ||
503 | u32 bit_width, | ||
504 | acpi_integer * value, | ||
505 | void *handler_context, void *region_context); | ||
506 | |||
507 | acpi_status | ||
508 | acpi_ex_embedded_controller_space_handler(u32 function, | ||
509 | acpi_physical_address address, | ||
510 | u32 bit_width, | ||
511 | acpi_integer * value, | ||
512 | void *handler_context, | ||
513 | void *region_context); | ||
514 | |||
515 | acpi_status | ||
516 | acpi_ex_sm_bus_space_handler(u32 function, | ||
517 | acpi_physical_address address, | ||
518 | u32 bit_width, | ||
519 | acpi_integer * value, | ||
520 | void *handler_context, void *region_context); | ||
521 | |||
522 | acpi_status | ||
523 | acpi_ex_data_table_space_handler(u32 function, | ||
524 | acpi_physical_address address, | ||
525 | u32 bit_width, | ||
526 | acpi_integer * value, | ||
527 | void *handler_context, void *region_context); | ||
528 | |||
529 | #endif /* __INTERP_H__ */ | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h new file mode 100644 index 000000000000..492d02761bb7 --- /dev/null +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -0,0 +1,990 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: aclocal.h - Internal data types used across the ACPI subsystem | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACLOCAL_H__ | ||
45 | #define __ACLOCAL_H__ | ||
46 | |||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
49 | #define ACPI_SERIALIZED 0xFF | ||
50 | |||
51 | typedef u32 acpi_mutex_handle; | ||
52 | #define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1) | ||
53 | |||
54 | /* Total number of aml opcodes defined */ | ||
55 | |||
56 | #define AML_NUM_OPCODES 0x7F | ||
57 | |||
58 | /* Forward declarations */ | ||
59 | |||
60 | struct acpi_walk_state; | ||
61 | struct acpi_obj_mutex; | ||
62 | union acpi_parse_object; | ||
63 | |||
64 | /***************************************************************************** | ||
65 | * | ||
66 | * Mutex typedefs and structs | ||
67 | * | ||
68 | ****************************************************************************/ | ||
69 | |||
70 | /* | ||
71 | * Predefined handles for the mutex objects used within the subsystem | ||
72 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. | ||
73 | * | ||
74 | * The acquire/release ordering protocol is implied via this list. Mutexes | ||
75 | * with a lower value must be acquired before mutexes with a higher value. | ||
76 | * | ||
77 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names | ||
78 | * table below also! | ||
79 | */ | ||
80 | #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ | ||
81 | #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */ | ||
82 | #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ | ||
83 | #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ | ||
84 | #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ | ||
85 | #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ | ||
86 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */ | ||
87 | #define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */ | ||
88 | |||
89 | #define ACPI_MAX_MUTEX 7 | ||
90 | #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 | ||
91 | |||
92 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
93 | #ifdef DEFINE_ACPI_GLOBALS | ||
94 | |||
95 | /* Debug names for the mutexes above */ | ||
96 | |||
97 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { | ||
98 | "ACPI_MTX_Interpreter", | ||
99 | "ACPI_MTX_Namespace", | ||
100 | "ACPI_MTX_Tables", | ||
101 | "ACPI_MTX_Events", | ||
102 | "ACPI_MTX_Caches", | ||
103 | "ACPI_MTX_Memory", | ||
104 | "ACPI_MTX_CommandComplete", | ||
105 | "ACPI_MTX_CommandReady" | ||
106 | }; | ||
107 | |||
108 | #endif | ||
109 | #endif | ||
110 | |||
111 | /* | ||
112 | * Predefined handles for spinlocks used within the subsystem. | ||
113 | * These spinlocks are created by acpi_ut_mutex_initialize | ||
114 | */ | ||
115 | #define ACPI_LOCK_GPES 0 | ||
116 | #define ACPI_LOCK_HARDWARE 1 | ||
117 | |||
118 | #define ACPI_MAX_LOCK 1 | ||
119 | #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 | ||
120 | |||
121 | /* This Thread ID means that the mutex is not in use (unlocked) */ | ||
122 | |||
123 | #define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0 | ||
124 | |||
125 | /* Table for the global mutexes */ | ||
126 | |||
127 | struct acpi_mutex_info { | ||
128 | acpi_mutex mutex; | ||
129 | u32 use_count; | ||
130 | acpi_thread_id thread_id; | ||
131 | }; | ||
132 | |||
133 | /* Lock flag parameter for various interfaces */ | ||
134 | |||
135 | #define ACPI_MTX_DO_NOT_LOCK 0 | ||
136 | #define ACPI_MTX_LOCK 1 | ||
137 | |||
138 | /* Field access granularities */ | ||
139 | |||
140 | #define ACPI_FIELD_BYTE_GRANULARITY 1 | ||
141 | #define ACPI_FIELD_WORD_GRANULARITY 2 | ||
142 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | ||
143 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | ||
144 | |||
145 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
146 | |||
147 | /***************************************************************************** | ||
148 | * | ||
149 | * Namespace typedefs and structs | ||
150 | * | ||
151 | ****************************************************************************/ | ||
152 | |||
153 | /* Operational modes of the AML interpreter/scanner */ | ||
154 | |||
155 | typedef enum { | ||
156 | ACPI_IMODE_LOAD_PASS1 = 0x01, | ||
157 | ACPI_IMODE_LOAD_PASS2 = 0x02, | ||
158 | ACPI_IMODE_EXECUTE = 0x03 | ||
159 | } acpi_interpreter_mode; | ||
160 | |||
161 | /* | ||
162 | * The Namespace Node describes a named object that appears in the AML. | ||
163 | * descriptor_type is used to differentiate between internal descriptors. | ||
164 | * | ||
165 | * The node is optimized for both 32-bit and 64-bit platforms: | ||
166 | * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. | ||
167 | * | ||
168 | * Note: The descriptor_type and Type fields must appear in the identical | ||
169 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
170 | * structures. | ||
171 | */ | ||
172 | struct acpi_namespace_node { | ||
173 | union acpi_operand_object *object; /* Interpreter object */ | ||
174 | u8 descriptor_type; /* Differentiate object descriptor types */ | ||
175 | u8 type; /* ACPI Type associated with this name */ | ||
176 | u8 flags; /* Miscellaneous flags */ | ||
177 | acpi_owner_id owner_id; /* Node creator */ | ||
178 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | ||
179 | struct acpi_namespace_node *child; /* First child */ | ||
180 | struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ | ||
181 | |||
182 | /* | ||
183 | * The following fields are used by the ASL compiler and disassembler only | ||
184 | */ | ||
185 | #ifdef ACPI_LARGE_NAMESPACE_NODE | ||
186 | union acpi_parse_object *op; | ||
187 | u32 value; | ||
188 | u32 length; | ||
189 | #endif | ||
190 | }; | ||
191 | |||
192 | /* Namespace Node flags */ | ||
193 | |||
194 | #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ | ||
195 | #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ | ||
196 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ | ||
197 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | ||
198 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ | ||
199 | #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ | ||
200 | |||
201 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ | ||
202 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ | ||
203 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ | ||
204 | #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ | ||
205 | #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ | ||
206 | |||
207 | /* One internal RSDT for table management */ | ||
208 | |||
209 | struct acpi_internal_rsdt { | ||
210 | struct acpi_table_desc *tables; | ||
211 | u32 count; | ||
212 | u32 size; | ||
213 | u8 flags; | ||
214 | }; | ||
215 | |||
216 | /* Flags for above */ | ||
217 | |||
218 | #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */ | ||
219 | #define ACPI_ROOT_ORIGIN_ALLOCATED (1) | ||
220 | #define ACPI_ROOT_ALLOW_RESIZE (2) | ||
221 | |||
222 | /* Predefined (fixed) table indexes */ | ||
223 | |||
224 | #define ACPI_TABLE_INDEX_DSDT (0) | ||
225 | #define ACPI_TABLE_INDEX_FACS (1) | ||
226 | |||
227 | struct acpi_find_context { | ||
228 | char *search_for; | ||
229 | acpi_handle *list; | ||
230 | u32 *count; | ||
231 | }; | ||
232 | |||
233 | struct acpi_ns_search_data { | ||
234 | struct acpi_namespace_node *node; | ||
235 | }; | ||
236 | |||
237 | /* Object types used during package copies */ | ||
238 | |||
239 | #define ACPI_COPY_TYPE_SIMPLE 0 | ||
240 | #define ACPI_COPY_TYPE_PACKAGE 1 | ||
241 | |||
242 | /* Info structure used to convert external<->internal namestrings */ | ||
243 | |||
244 | struct acpi_namestring_info { | ||
245 | const char *external_name; | ||
246 | const char *next_external_char; | ||
247 | char *internal_name; | ||
248 | u32 length; | ||
249 | u32 num_segments; | ||
250 | u32 num_carats; | ||
251 | u8 fully_qualified; | ||
252 | }; | ||
253 | |||
254 | /* Field creation info */ | ||
255 | |||
256 | struct acpi_create_field_info { | ||
257 | struct acpi_namespace_node *region_node; | ||
258 | struct acpi_namespace_node *field_node; | ||
259 | struct acpi_namespace_node *register_node; | ||
260 | struct acpi_namespace_node *data_register_node; | ||
261 | u32 bank_value; | ||
262 | u32 field_bit_position; | ||
263 | u32 field_bit_length; | ||
264 | u8 field_flags; | ||
265 | u8 attribute; | ||
266 | u8 field_type; | ||
267 | }; | ||
268 | |||
269 | typedef | ||
270 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
271 | |||
272 | /* | ||
273 | * Bitmapped ACPI types. Used internally only | ||
274 | */ | ||
275 | #define ACPI_BTYPE_ANY 0x00000000 | ||
276 | #define ACPI_BTYPE_INTEGER 0x00000001 | ||
277 | #define ACPI_BTYPE_STRING 0x00000002 | ||
278 | #define ACPI_BTYPE_BUFFER 0x00000004 | ||
279 | #define ACPI_BTYPE_PACKAGE 0x00000008 | ||
280 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | ||
281 | #define ACPI_BTYPE_DEVICE 0x00000020 | ||
282 | #define ACPI_BTYPE_EVENT 0x00000040 | ||
283 | #define ACPI_BTYPE_METHOD 0x00000080 | ||
284 | #define ACPI_BTYPE_MUTEX 0x00000100 | ||
285 | #define ACPI_BTYPE_REGION 0x00000200 | ||
286 | #define ACPI_BTYPE_POWER 0x00000400 | ||
287 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | ||
288 | #define ACPI_BTYPE_THERMAL 0x00001000 | ||
289 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | ||
290 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | ||
291 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | ||
292 | #define ACPI_BTYPE_REFERENCE 0x00010000 | ||
293 | #define ACPI_BTYPE_RESOURCE 0x00020000 | ||
294 | |||
295 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | ||
296 | |||
297 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | ||
298 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | ||
299 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | ||
300 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ | ||
301 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF | ||
302 | |||
303 | /* | ||
304 | * Information structure for ACPI predefined names. | ||
305 | * Each entry in the table contains the following items: | ||
306 | * | ||
307 | * Name - The ACPI reserved name | ||
308 | * param_count - Number of arguments to the method | ||
309 | * expected_return_btypes - Allowed type(s) for the return value | ||
310 | */ | ||
311 | struct acpi_name_info { | ||
312 | char name[ACPI_NAME_SIZE]; | ||
313 | u8 param_count; | ||
314 | u8 expected_btypes; | ||
315 | }; | ||
316 | |||
317 | /* | ||
318 | * Secondary information structures for ACPI predefined objects that return | ||
319 | * package objects. This structure appears as the next entry in the table | ||
320 | * after the NAME_INFO structure above. | ||
321 | * | ||
322 | * The reason for this is to minimize the size of the predefined name table. | ||
323 | */ | ||
324 | |||
325 | /* | ||
326 | * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, | ||
327 | * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT | ||
328 | */ | ||
329 | struct acpi_package_info { | ||
330 | u8 type; | ||
331 | u8 object_type1; | ||
332 | u8 count1; | ||
333 | u8 object_type2; | ||
334 | u8 count2; | ||
335 | u8 reserved; | ||
336 | }; | ||
337 | |||
338 | /* Used for ACPI_PTYPE2_FIXED */ | ||
339 | |||
340 | struct acpi_package_info2 { | ||
341 | u8 type; | ||
342 | u8 count; | ||
343 | u8 object_type[4]; | ||
344 | }; | ||
345 | |||
346 | /* Used for ACPI_PTYPE1_OPTION */ | ||
347 | |||
348 | struct acpi_package_info3 { | ||
349 | u8 type; | ||
350 | u8 count; | ||
351 | u8 object_type[2]; | ||
352 | u8 tail_object_type; | ||
353 | u8 reserved; | ||
354 | }; | ||
355 | |||
356 | union acpi_predefined_info { | ||
357 | struct acpi_name_info info; | ||
358 | struct acpi_package_info ret_info; | ||
359 | struct acpi_package_info2 ret_info2; | ||
360 | struct acpi_package_info3 ret_info3; | ||
361 | }; | ||
362 | |||
363 | /* | ||
364 | * Bitmapped return value types | ||
365 | * Note: the actual data types must be contiguous, a loop in nspredef.c | ||
366 | * depends on this. | ||
367 | */ | ||
368 | #define ACPI_RTYPE_ANY 0x00 | ||
369 | #define ACPI_RTYPE_NONE 0x01 | ||
370 | #define ACPI_RTYPE_INTEGER 0x02 | ||
371 | #define ACPI_RTYPE_STRING 0x04 | ||
372 | #define ACPI_RTYPE_BUFFER 0x08 | ||
373 | #define ACPI_RTYPE_PACKAGE 0x10 | ||
374 | #define ACPI_RTYPE_REFERENCE 0x20 | ||
375 | #define ACPI_RTYPE_ALL 0x3F | ||
376 | |||
377 | #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ | ||
378 | |||
379 | /***************************************************************************** | ||
380 | * | ||
381 | * Event typedefs and structs | ||
382 | * | ||
383 | ****************************************************************************/ | ||
384 | |||
385 | /* Dispatch info for each GPE -- either a method or handler, cannot be both */ | ||
386 | |||
387 | struct acpi_handler_info { | ||
388 | acpi_event_handler address; /* Address of handler, if any */ | ||
389 | void *context; /* Context to be passed to handler */ | ||
390 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ | ||
391 | }; | ||
392 | |||
393 | union acpi_gpe_dispatch_info { | ||
394 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ | ||
395 | struct acpi_handler_info *handler; | ||
396 | }; | ||
397 | |||
398 | /* | ||
399 | * Information about a GPE, one per each GPE in an array. | ||
400 | * NOTE: Important to keep this struct as small as possible. | ||
401 | */ | ||
402 | struct acpi_gpe_event_info { | ||
403 | union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ | ||
404 | struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ | ||
405 | u8 flags; /* Misc info about this GPE */ | ||
406 | u8 gpe_number; /* This GPE */ | ||
407 | }; | ||
408 | |||
409 | /* Information about a GPE register pair, one per each status/enable pair in an array */ | ||
410 | |||
411 | struct acpi_gpe_register_info { | ||
412 | struct acpi_generic_address status_address; /* Address of status reg */ | ||
413 | struct acpi_generic_address enable_address; /* Address of enable reg */ | ||
414 | u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ | ||
415 | u8 enable_for_run; /* GPEs to keep enabled when running */ | ||
416 | u8 base_gpe_number; /* Base GPE number for this register */ | ||
417 | }; | ||
418 | |||
419 | /* | ||
420 | * Information about a GPE register block, one per each installed block -- | ||
421 | * GPE0, GPE1, and one per each installed GPE Block Device. | ||
422 | */ | ||
423 | struct acpi_gpe_block_info { | ||
424 | struct acpi_namespace_node *node; | ||
425 | struct acpi_gpe_block_info *previous; | ||
426 | struct acpi_gpe_block_info *next; | ||
427 | struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ | ||
428 | struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ | ||
429 | struct acpi_gpe_event_info *event_info; /* One for each GPE */ | ||
430 | struct acpi_generic_address block_address; /* Base address of the block */ | ||
431 | u32 register_count; /* Number of register pairs in block */ | ||
432 | u8 block_base_number; /* Base GPE number for this block */ | ||
433 | }; | ||
434 | |||
435 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ | ||
436 | |||
437 | struct acpi_gpe_xrupt_info { | ||
438 | struct acpi_gpe_xrupt_info *previous; | ||
439 | struct acpi_gpe_xrupt_info *next; | ||
440 | struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ | ||
441 | u32 interrupt_number; /* System interrupt number */ | ||
442 | }; | ||
443 | |||
444 | struct acpi_gpe_walk_info { | ||
445 | struct acpi_namespace_node *gpe_device; | ||
446 | struct acpi_gpe_block_info *gpe_block; | ||
447 | }; | ||
448 | |||
449 | struct acpi_gpe_device_info { | ||
450 | u32 index; | ||
451 | u32 next_block_base_index; | ||
452 | acpi_status status; | ||
453 | struct acpi_namespace_node *gpe_device; | ||
454 | }; | ||
455 | |||
456 | typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
457 | struct acpi_gpe_block_info *gpe_block, void *context); | ||
458 | |||
459 | /* Information about each particular fixed event */ | ||
460 | |||
461 | struct acpi_fixed_event_handler { | ||
462 | acpi_event_handler handler; /* Address of handler. */ | ||
463 | void *context; /* Context to be passed to handler */ | ||
464 | }; | ||
465 | |||
466 | struct acpi_fixed_event_info { | ||
467 | u8 status_register_id; | ||
468 | u8 enable_register_id; | ||
469 | u16 status_bit_mask; | ||
470 | u16 enable_bit_mask; | ||
471 | }; | ||
472 | |||
473 | /* Information used during field processing */ | ||
474 | |||
475 | struct acpi_field_info { | ||
476 | u8 skip_field; | ||
477 | u8 field_flag; | ||
478 | u32 pkg_length; | ||
479 | }; | ||
480 | |||
481 | /***************************************************************************** | ||
482 | * | ||
483 | * Generic "state" object for stacks | ||
484 | * | ||
485 | ****************************************************************************/ | ||
486 | |||
487 | #define ACPI_CONTROL_NORMAL 0xC0 | ||
488 | #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 | ||
489 | #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 | ||
490 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | ||
491 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | ||
492 | |||
493 | #define ACPI_STATE_COMMON \ | ||
494 | void *next; \ | ||
495 | u8 descriptor_type; /* To differentiate various internal objs */\ | ||
496 | u8 flags; \ | ||
497 | u16 value; \ | ||
498 | u16 state; | ||
499 | |||
500 | /* There are 2 bytes available here until the next natural alignment boundary */ | ||
501 | |||
502 | struct acpi_common_state { | ||
503 | ACPI_STATE_COMMON}; | ||
504 | |||
505 | /* | ||
506 | * Update state - used to traverse complex objects such as packages | ||
507 | */ | ||
508 | struct acpi_update_state { | ||
509 | ACPI_STATE_COMMON union acpi_operand_object *object; | ||
510 | }; | ||
511 | |||
512 | /* | ||
513 | * Pkg state - used to traverse nested package structures | ||
514 | */ | ||
515 | struct acpi_pkg_state { | ||
516 | ACPI_STATE_COMMON u16 index; | ||
517 | union acpi_operand_object *source_object; | ||
518 | union acpi_operand_object *dest_object; | ||
519 | struct acpi_walk_state *walk_state; | ||
520 | void *this_target_obj; | ||
521 | u32 num_packages; | ||
522 | }; | ||
523 | |||
524 | /* | ||
525 | * Control state - one per if/else and while constructs. | ||
526 | * Allows nesting of these constructs | ||
527 | */ | ||
528 | struct acpi_control_state { | ||
529 | ACPI_STATE_COMMON u16 opcode; | ||
530 | union acpi_parse_object *predicate_op; | ||
531 | u8 *aml_predicate_start; /* Start of if/while predicate */ | ||
532 | u8 *package_end; /* End of if/while block */ | ||
533 | u32 loop_count; /* While() loop counter */ | ||
534 | }; | ||
535 | |||
536 | /* | ||
537 | * Scope state - current scope during namespace lookups | ||
538 | */ | ||
539 | struct acpi_scope_state { | ||
540 | ACPI_STATE_COMMON struct acpi_namespace_node *node; | ||
541 | }; | ||
542 | |||
543 | struct acpi_pscope_state { | ||
544 | ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ | ||
545 | union acpi_parse_object *op; /* Current op being parsed */ | ||
546 | u8 *arg_end; /* Current argument end */ | ||
547 | u8 *pkg_end; /* Current package end */ | ||
548 | u32 arg_list; /* Next argument to parse */ | ||
549 | }; | ||
550 | |||
551 | /* | ||
552 | * Thread state - one per thread across multiple walk states. Multiple walk | ||
553 | * states are created when there are nested control methods executing. | ||
554 | */ | ||
555 | struct acpi_thread_state { | ||
556 | ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
557 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
558 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | ||
559 | acpi_thread_id thread_id; /* Running thread ID */ | ||
560 | }; | ||
561 | |||
562 | /* | ||
563 | * Result values - used to accumulate the results of nested | ||
564 | * AML arguments | ||
565 | */ | ||
566 | struct acpi_result_values { | ||
567 | ACPI_STATE_COMMON | ||
568 | union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM]; | ||
569 | }; | ||
570 | |||
571 | typedef | ||
572 | acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, | ||
573 | union acpi_parse_object ** out_op); | ||
574 | |||
575 | typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); | ||
576 | |||
577 | /* | ||
578 | * Notify info - used to pass info to the deferred notify | ||
579 | * handler/dispatcher. | ||
580 | */ | ||
581 | struct acpi_notify_info { | ||
582 | ACPI_STATE_COMMON struct acpi_namespace_node *node; | ||
583 | union acpi_operand_object *handler_obj; | ||
584 | }; | ||
585 | |||
586 | /* Generic state is union of structs above */ | ||
587 | |||
588 | union acpi_generic_state { | ||
589 | struct acpi_common_state common; | ||
590 | struct acpi_control_state control; | ||
591 | struct acpi_update_state update; | ||
592 | struct acpi_scope_state scope; | ||
593 | struct acpi_pscope_state parse_scope; | ||
594 | struct acpi_pkg_state pkg; | ||
595 | struct acpi_thread_state thread; | ||
596 | struct acpi_result_values results; | ||
597 | struct acpi_notify_info notify; | ||
598 | }; | ||
599 | |||
600 | /***************************************************************************** | ||
601 | * | ||
602 | * Interpreter typedefs and structs | ||
603 | * | ||
604 | ****************************************************************************/ | ||
605 | |||
606 | typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); | ||
607 | |||
608 | /***************************************************************************** | ||
609 | * | ||
610 | * Parser typedefs and structs | ||
611 | * | ||
612 | ****************************************************************************/ | ||
613 | |||
614 | /* | ||
615 | * AML opcode, name, and argument layout | ||
616 | */ | ||
617 | struct acpi_opcode_info { | ||
618 | #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) | ||
619 | char *name; /* Opcode name (disassembler/debug only) */ | ||
620 | #endif | ||
621 | u32 parse_args; /* Grammar/Parse time arguments */ | ||
622 | u32 runtime_args; /* Interpret time arguments */ | ||
623 | u16 flags; /* Misc flags */ | ||
624 | u8 object_type; /* Corresponding internal object type */ | ||
625 | u8 class; /* Opcode class */ | ||
626 | u8 type; /* Opcode type */ | ||
627 | }; | ||
628 | |||
629 | union acpi_parse_value { | ||
630 | acpi_integer integer; /* Integer constant (Up to 64 bits) */ | ||
631 | struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ | ||
632 | u32 size; /* bytelist or field size */ | ||
633 | char *string; /* NULL terminated string */ | ||
634 | u8 *buffer; /* buffer or string */ | ||
635 | char *name; /* NULL terminated string */ | ||
636 | union acpi_parse_object *arg; /* arguments and contained ops */ | ||
637 | }; | ||
638 | |||
639 | #ifdef ACPI_DISASSEMBLER | ||
640 | #define ACPI_DISASM_ONLY_MEMBERS(a) a; | ||
641 | #else | ||
642 | #define ACPI_DISASM_ONLY_MEMBERS(a) | ||
643 | #endif | ||
644 | |||
645 | #define ACPI_PARSE_COMMON \ | ||
646 | union acpi_parse_object *parent; /* Parent op */\ | ||
647 | u8 descriptor_type; /* To differentiate various internal objs */\ | ||
648 | u8 flags; /* Type of Op */\ | ||
649 | u16 aml_opcode; /* AML opcode */\ | ||
650 | u32 aml_offset; /* Offset of declaration in AML */\ | ||
651 | union acpi_parse_object *next; /* Next op */\ | ||
652 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
653 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
654 | u8 arg_list_length; /* Number of elements in the arg list */\ | ||
655 | ACPI_DISASM_ONLY_MEMBERS (\ | ||
656 | u8 disasm_flags; /* Used during AML disassembly */\ | ||
657 | u8 disasm_opcode; /* Subtype used for disassembly */\ | ||
658 | char aml_op_name[16]) /* Op name (debug only) */ | ||
659 | |||
660 | #define ACPI_DASM_BUFFER 0x00 | ||
661 | #define ACPI_DASM_RESOURCE 0x01 | ||
662 | #define ACPI_DASM_STRING 0x02 | ||
663 | #define ACPI_DASM_UNICODE 0x03 | ||
664 | #define ACPI_DASM_EISAID 0x04 | ||
665 | #define ACPI_DASM_MATCHOP 0x05 | ||
666 | #define ACPI_DASM_LNOT_PREFIX 0x06 | ||
667 | #define ACPI_DASM_LNOT_SUFFIX 0x07 | ||
668 | #define ACPI_DASM_IGNORE 0x08 | ||
669 | |||
670 | /* | ||
671 | * Generic operation (for example: If, While, Store) | ||
672 | */ | ||
673 | struct acpi_parse_obj_common { | ||
674 | ACPI_PARSE_COMMON}; | ||
675 | |||
676 | /* | ||
677 | * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), | ||
678 | * and bytelists. | ||
679 | */ | ||
680 | struct acpi_parse_obj_named { | ||
681 | ACPI_PARSE_COMMON u8 *path; | ||
682 | u8 *data; /* AML body or bytelist data */ | ||
683 | u32 length; /* AML length */ | ||
684 | u32 name; /* 4-byte name or zero if no name */ | ||
685 | }; | ||
686 | |||
687 | /* This version is used by the i_aSL compiler only */ | ||
688 | |||
689 | #define ACPI_MAX_PARSEOP_NAME 20 | ||
690 | |||
691 | struct acpi_parse_obj_asl { | ||
692 | ACPI_PARSE_COMMON union acpi_parse_object *child; | ||
693 | union acpi_parse_object *parent_method; | ||
694 | char *filename; | ||
695 | char *external_name; | ||
696 | char *namepath; | ||
697 | char name_seg[4]; | ||
698 | u32 extra_value; | ||
699 | u32 column; | ||
700 | u32 line_number; | ||
701 | u32 logical_line_number; | ||
702 | u32 logical_byte_offset; | ||
703 | u32 end_line; | ||
704 | u32 end_logical_line; | ||
705 | u32 acpi_btype; | ||
706 | u32 aml_length; | ||
707 | u32 aml_subtree_length; | ||
708 | u32 final_aml_length; | ||
709 | u32 final_aml_offset; | ||
710 | u32 compile_flags; | ||
711 | u16 parse_opcode; | ||
712 | u8 aml_opcode_length; | ||
713 | u8 aml_pkg_len_bytes; | ||
714 | u8 extra; | ||
715 | char parse_op_name[ACPI_MAX_PARSEOP_NAME]; | ||
716 | }; | ||
717 | |||
718 | union acpi_parse_object { | ||
719 | struct acpi_parse_obj_common common; | ||
720 | struct acpi_parse_obj_named named; | ||
721 | struct acpi_parse_obj_asl asl; | ||
722 | }; | ||
723 | |||
724 | /* | ||
725 | * Parse state - one state per parser invocation and each control | ||
726 | * method. | ||
727 | */ | ||
728 | struct acpi_parse_state { | ||
729 | u8 *aml_start; /* First AML byte */ | ||
730 | u8 *aml; /* Next AML byte */ | ||
731 | u8 *aml_end; /* (last + 1) AML byte */ | ||
732 | u8 *pkg_start; /* Current package begin */ | ||
733 | u8 *pkg_end; /* Current package end */ | ||
734 | union acpi_parse_object *start_op; /* Root of parse tree */ | ||
735 | struct acpi_namespace_node *start_node; | ||
736 | union acpi_generic_state *scope; /* Current scope */ | ||
737 | union acpi_parse_object *start_scope; | ||
738 | u32 aml_size; | ||
739 | }; | ||
740 | |||
741 | /* Parse object flags */ | ||
742 | |||
743 | #define ACPI_PARSEOP_GENERIC 0x01 | ||
744 | #define ACPI_PARSEOP_NAMED 0x02 | ||
745 | #define ACPI_PARSEOP_DEFERRED 0x04 | ||
746 | #define ACPI_PARSEOP_BYTELIST 0x08 | ||
747 | #define ACPI_PARSEOP_IN_STACK 0x10 | ||
748 | #define ACPI_PARSEOP_TARGET 0x20 | ||
749 | #define ACPI_PARSEOP_IN_CACHE 0x80 | ||
750 | |||
751 | /* Parse object disasm_flags */ | ||
752 | |||
753 | #define ACPI_PARSEOP_IGNORE 0x01 | ||
754 | #define ACPI_PARSEOP_PARAMLIST 0x02 | ||
755 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | ||
756 | #define ACPI_PARSEOP_SPECIAL 0x10 | ||
757 | |||
758 | /***************************************************************************** | ||
759 | * | ||
760 | * Hardware (ACPI registers) and PNP | ||
761 | * | ||
762 | ****************************************************************************/ | ||
763 | |||
764 | struct acpi_bit_register_info { | ||
765 | u8 parent_register; | ||
766 | u8 bit_position; | ||
767 | u16 access_bit_mask; | ||
768 | }; | ||
769 | |||
770 | /* | ||
771 | * Some ACPI registers have bits that must be ignored -- meaning that they | ||
772 | * must be preserved. | ||
773 | */ | ||
774 | #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ | ||
775 | #define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */ | ||
776 | |||
777 | /* | ||
778 | * Register IDs | ||
779 | * These are the full ACPI registers | ||
780 | */ | ||
781 | #define ACPI_REGISTER_PM1_STATUS 0x01 | ||
782 | #define ACPI_REGISTER_PM1_ENABLE 0x02 | ||
783 | #define ACPI_REGISTER_PM1_CONTROL 0x03 | ||
784 | #define ACPI_REGISTER_PM1A_CONTROL 0x04 | ||
785 | #define ACPI_REGISTER_PM1B_CONTROL 0x05 | ||
786 | #define ACPI_REGISTER_PM2_CONTROL 0x06 | ||
787 | #define ACPI_REGISTER_PM_TIMER 0x07 | ||
788 | #define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 | ||
789 | #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 | ||
790 | |||
791 | /* Masks used to access the bit_registers */ | ||
792 | |||
793 | #define ACPI_BITMASK_TIMER_STATUS 0x0001 | ||
794 | #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 | ||
795 | #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 | ||
796 | #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 | ||
797 | #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 | ||
798 | #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 | ||
799 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | ||
800 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | ||
801 | |||
802 | #define ACPI_BITMASK_ALL_FIXED_STATUS (\ | ||
803 | ACPI_BITMASK_TIMER_STATUS | \ | ||
804 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | ||
805 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | ||
806 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | ||
807 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | ||
808 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | ||
809 | ACPI_BITMASK_WAKE_STATUS) | ||
810 | |||
811 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | ||
812 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | ||
813 | #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 | ||
814 | #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 | ||
815 | #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 | ||
816 | #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ | ||
817 | |||
818 | #define ACPI_BITMASK_SCI_ENABLE 0x0001 | ||
819 | #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 | ||
820 | #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 | ||
821 | #define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 | ||
822 | #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 | ||
823 | |||
824 | #define ACPI_BITMASK_ARB_DISABLE 0x0001 | ||
825 | |||
826 | /* Raw bit position of each bit_register */ | ||
827 | |||
828 | #define ACPI_BITPOSITION_TIMER_STATUS 0x00 | ||
829 | #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 | ||
830 | #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 | ||
831 | #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 | ||
832 | #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 | ||
833 | #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A | ||
834 | #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ | ||
835 | #define ACPI_BITPOSITION_WAKE_STATUS 0x0F | ||
836 | |||
837 | #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 | ||
838 | #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 | ||
839 | #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 | ||
840 | #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 | ||
841 | #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A | ||
842 | #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ | ||
843 | |||
844 | #define ACPI_BITPOSITION_SCI_ENABLE 0x00 | ||
845 | #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 | ||
846 | #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 | ||
847 | #define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A | ||
848 | #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D | ||
849 | |||
850 | #define ACPI_BITPOSITION_ARB_DISABLE 0x00 | ||
851 | |||
852 | /***************************************************************************** | ||
853 | * | ||
854 | * Resource descriptors | ||
855 | * | ||
856 | ****************************************************************************/ | ||
857 | |||
858 | /* resource_type values */ | ||
859 | |||
860 | #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 | ||
861 | #define ACPI_ADDRESS_TYPE_IO_RANGE 1 | ||
862 | #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 | ||
863 | |||
864 | /* Resource descriptor types and masks */ | ||
865 | |||
866 | #define ACPI_RESOURCE_NAME_LARGE 0x80 | ||
867 | #define ACPI_RESOURCE_NAME_SMALL 0x00 | ||
868 | |||
869 | #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ | ||
870 | #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ | ||
871 | #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ | ||
872 | |||
873 | /* | ||
874 | * Small resource descriptor "names" as defined by the ACPI specification. | ||
875 | * Note: Bits 2:0 are used for the descriptor length | ||
876 | */ | ||
877 | #define ACPI_RESOURCE_NAME_IRQ 0x20 | ||
878 | #define ACPI_RESOURCE_NAME_DMA 0x28 | ||
879 | #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 | ||
880 | #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 | ||
881 | #define ACPI_RESOURCE_NAME_IO 0x40 | ||
882 | #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 | ||
883 | #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 | ||
884 | #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 | ||
885 | #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 | ||
886 | #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 | ||
887 | #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 | ||
888 | #define ACPI_RESOURCE_NAME_END_TAG 0x78 | ||
889 | |||
890 | /* | ||
891 | * Large resource descriptor "names" as defined by the ACPI specification. | ||
892 | * Note: includes the Large Descriptor bit in bit[7] | ||
893 | */ | ||
894 | #define ACPI_RESOURCE_NAME_MEMORY24 0x81 | ||
895 | #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 | ||
896 | #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 | ||
897 | #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 | ||
898 | #define ACPI_RESOURCE_NAME_MEMORY32 0x85 | ||
899 | #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 | ||
900 | #define ACPI_RESOURCE_NAME_ADDRESS32 0x87 | ||
901 | #define ACPI_RESOURCE_NAME_ADDRESS16 0x88 | ||
902 | #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 | ||
903 | #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A | ||
904 | #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B | ||
905 | #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B | ||
906 | |||
907 | /***************************************************************************** | ||
908 | * | ||
909 | * Miscellaneous | ||
910 | * | ||
911 | ****************************************************************************/ | ||
912 | |||
913 | #define ACPI_ASCII_ZERO 0x30 | ||
914 | |||
915 | /***************************************************************************** | ||
916 | * | ||
917 | * Debugger | ||
918 | * | ||
919 | ****************************************************************************/ | ||
920 | |||
921 | struct acpi_db_method_info { | ||
922 | acpi_handle main_thread_gate; | ||
923 | acpi_handle thread_complete_gate; | ||
924 | u32 *threads; | ||
925 | u32 num_threads; | ||
926 | u32 num_created; | ||
927 | u32 num_completed; | ||
928 | |||
929 | char *name; | ||
930 | u32 flags; | ||
931 | u32 num_loops; | ||
932 | char pathname[128]; | ||
933 | char **args; | ||
934 | |||
935 | /* | ||
936 | * Arguments to be passed to method for the command | ||
937 | * Threads - | ||
938 | * the Number of threads, ID of current thread and | ||
939 | * Index of current thread inside all them created. | ||
940 | */ | ||
941 | char init_args; | ||
942 | char *arguments[4]; | ||
943 | char num_threads_str[11]; | ||
944 | char id_of_thread_str[11]; | ||
945 | char index_of_thread_str[11]; | ||
946 | }; | ||
947 | |||
948 | struct acpi_integrity_info { | ||
949 | u32 nodes; | ||
950 | u32 objects; | ||
951 | }; | ||
952 | |||
953 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | ||
954 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | ||
955 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | ||
956 | |||
957 | /***************************************************************************** | ||
958 | * | ||
959 | * Debug | ||
960 | * | ||
961 | ****************************************************************************/ | ||
962 | |||
963 | /* Entry for a memory allocation (debug only) */ | ||
964 | |||
965 | #define ACPI_MEM_MALLOC 0 | ||
966 | #define ACPI_MEM_CALLOC 1 | ||
967 | #define ACPI_MAX_MODULE_NAME 16 | ||
968 | |||
969 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | ||
970 | struct acpi_debug_mem_block *previous; \ | ||
971 | struct acpi_debug_mem_block *next; \ | ||
972 | u32 size; \ | ||
973 | u32 component; \ | ||
974 | u32 line; \ | ||
975 | char module[ACPI_MAX_MODULE_NAME]; \ | ||
976 | u8 alloc_type; | ||
977 | |||
978 | struct acpi_debug_mem_header { | ||
979 | ACPI_COMMON_DEBUG_MEM_HEADER}; | ||
980 | |||
981 | struct acpi_debug_mem_block { | ||
982 | ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space; | ||
983 | }; | ||
984 | |||
985 | #define ACPI_MEM_LIST_GLOBAL 0 | ||
986 | #define ACPI_MEM_LIST_NSNODE 1 | ||
987 | #define ACPI_MEM_LIST_MAX 1 | ||
988 | #define ACPI_NUM_MEM_LISTS 2 | ||
989 | |||
990 | #endif /* __ACLOCAL_H__ */ | ||
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h new file mode 100644 index 000000000000..9c127e8e2d6d --- /dev/null +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -0,0 +1,577 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acmacros.h - C macros for the entire subsystem. | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACMACROS_H__ | ||
45 | #define __ACMACROS_H__ | ||
46 | |||
47 | /* | ||
48 | * Extract data using a pointer. Any more than a byte and we | ||
49 | * get into potential aligment issues -- see the STORE macros below. | ||
50 | * Use with care. | ||
51 | */ | ||
52 | #define ACPI_GET8(ptr) *ACPI_CAST_PTR (u8, ptr) | ||
53 | #define ACPI_GET16(ptr) *ACPI_CAST_PTR (u16, ptr) | ||
54 | #define ACPI_GET32(ptr) *ACPI_CAST_PTR (u32, ptr) | ||
55 | #define ACPI_GET64(ptr) *ACPI_CAST_PTR (u64, ptr) | ||
56 | #define ACPI_SET8(ptr) *ACPI_CAST_PTR (u8, ptr) | ||
57 | #define ACPI_SET16(ptr) *ACPI_CAST_PTR (u16, ptr) | ||
58 | #define ACPI_SET32(ptr) *ACPI_CAST_PTR (u32, ptr) | ||
59 | #define ACPI_SET64(ptr) *ACPI_CAST_PTR (u64, ptr) | ||
60 | |||
61 | /* | ||
62 | * printf() format helpers | ||
63 | */ | ||
64 | |||
65 | /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ | ||
66 | |||
67 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) | ||
68 | |||
69 | #if ACPI_MACHINE_WIDTH == 64 | ||
70 | #define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) | ||
71 | #else | ||
72 | #define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) | ||
73 | #endif | ||
74 | |||
75 | /* | ||
76 | * Macros for moving data around to/from buffers that are possibly unaligned. | ||
77 | * If the hardware supports the transfer of unaligned data, just do the store. | ||
78 | * Otherwise, we have to move one byte at a time. | ||
79 | */ | ||
80 | #ifdef ACPI_BIG_ENDIAN | ||
81 | /* | ||
82 | * Macros for big-endian machines | ||
83 | */ | ||
84 | |||
85 | /* These macros reverse the bytes during the move, converting little-endian to big endian */ | ||
86 | |||
87 | /* Big Endian <== Little Endian */ | ||
88 | /* Hi...Lo Lo...Hi */ | ||
89 | /* 16-bit source, 16/32/64 destination */ | ||
90 | |||
91 | #define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ | ||
92 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} | ||
93 | |||
94 | #define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\ | ||
95 | ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | ||
96 | ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | ||
97 | |||
98 | #define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ | ||
99 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
100 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
101 | |||
102 | /* 32-bit source, 16/32/64 destination */ | ||
103 | |||
104 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
105 | |||
106 | #define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ | ||
107 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ | ||
108 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ | ||
109 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} | ||
110 | |||
111 | #define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\ | ||
112 | ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ | ||
113 | ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ | ||
114 | ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
115 | ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
116 | |||
117 | /* 64-bit source, 16/32/64 destination */ | ||
118 | |||
119 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
120 | |||
121 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ | ||
122 | |||
123 | #define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ | ||
124 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ | ||
125 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ | ||
126 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ | ||
127 | (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ | ||
128 | (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ | ||
129 | (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ | ||
130 | (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} | ||
131 | #else | ||
132 | /* | ||
133 | * Macros for little-endian machines | ||
134 | */ | ||
135 | |||
136 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
137 | |||
138 | /* The hardware supports unaligned transfers, just do the little-endian move */ | ||
139 | |||
140 | /* 16-bit source, 16/32/64 destination */ | ||
141 | |||
142 | #define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) | ||
143 | #define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) | ||
144 | #define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) | ||
145 | |||
146 | /* 32-bit source, 16/32/64 destination */ | ||
147 | |||
148 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
149 | #define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) | ||
150 | #define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) | ||
151 | |||
152 | /* 64-bit source, 16/32/64 destination */ | ||
153 | |||
154 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
155 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ | ||
156 | #define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) | ||
157 | |||
158 | #else | ||
159 | /* | ||
160 | * The hardware does not support unaligned transfers. We must move the | ||
161 | * data one byte at a time. These macros work whether the source or | ||
162 | * the destination (or both) is/are unaligned. (Little-endian move) | ||
163 | */ | ||
164 | |||
165 | /* 16-bit source, 16/32/64 destination */ | ||
166 | |||
167 | #define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
168 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} | ||
169 | |||
170 | #define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} | ||
171 | #define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} | ||
172 | |||
173 | /* 32-bit source, 16/32/64 destination */ | ||
174 | |||
175 | #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
176 | |||
177 | #define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
178 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | ||
179 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | ||
180 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} | ||
181 | |||
182 | #define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);} | ||
183 | |||
184 | /* 64-bit source, 16/32/64 destination */ | ||
185 | |||
186 | #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | ||
187 | #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ | ||
188 | #define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ | ||
189 | (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ | ||
190 | (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ | ||
191 | (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ | ||
192 | (( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\ | ||
193 | (( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\ | ||
194 | (( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\ | ||
195 | (( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];} | ||
196 | #endif | ||
197 | #endif | ||
198 | |||
199 | /* Macros based on machine integer width */ | ||
200 | |||
201 | #if ACPI_MACHINE_WIDTH == 32 | ||
202 | #define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s) | ||
203 | |||
204 | #elif ACPI_MACHINE_WIDTH == 64 | ||
205 | #define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s) | ||
206 | |||
207 | #else | ||
208 | #error unknown ACPI_MACHINE_WIDTH | ||
209 | #endif | ||
210 | |||
211 | /* | ||
212 | * Fast power-of-two math macros for non-optimized compilers | ||
213 | */ | ||
214 | #define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2))) | ||
215 | #define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2))) | ||
216 | #define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1))) | ||
217 | |||
218 | #define ACPI_DIV_2(a) _ACPI_DIV(a, 1) | ||
219 | #define ACPI_MUL_2(a) _ACPI_MUL(a, 1) | ||
220 | #define ACPI_MOD_2(a) _ACPI_MOD(a, 2) | ||
221 | |||
222 | #define ACPI_DIV_4(a) _ACPI_DIV(a, 2) | ||
223 | #define ACPI_MUL_4(a) _ACPI_MUL(a, 2) | ||
224 | #define ACPI_MOD_4(a) _ACPI_MOD(a, 4) | ||
225 | |||
226 | #define ACPI_DIV_8(a) _ACPI_DIV(a, 3) | ||
227 | #define ACPI_MUL_8(a) _ACPI_MUL(a, 3) | ||
228 | #define ACPI_MOD_8(a) _ACPI_MOD(a, 8) | ||
229 | |||
230 | #define ACPI_DIV_16(a) _ACPI_DIV(a, 4) | ||
231 | #define ACPI_MUL_16(a) _ACPI_MUL(a, 4) | ||
232 | #define ACPI_MOD_16(a) _ACPI_MOD(a, 16) | ||
233 | |||
234 | #define ACPI_DIV_32(a) _ACPI_DIV(a, 5) | ||
235 | #define ACPI_MUL_32(a) _ACPI_MUL(a, 5) | ||
236 | #define ACPI_MOD_32(a) _ACPI_MOD(a, 32) | ||
237 | |||
238 | /* | ||
239 | * Rounding macros (Power of two boundaries only) | ||
240 | */ | ||
241 | #define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \ | ||
242 | (~(((acpi_size) boundary)-1))) | ||
243 | |||
244 | #define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \ | ||
245 | (((acpi_size) boundary)-1)) & \ | ||
246 | (~(((acpi_size) boundary)-1))) | ||
247 | |||
248 | /* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ | ||
249 | |||
250 | #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4) | ||
251 | #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8) | ||
252 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size)) | ||
253 | |||
254 | #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4) | ||
255 | #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8) | ||
256 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size)) | ||
257 | |||
258 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) | ||
259 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) | ||
260 | |||
261 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) | ||
262 | |||
263 | /* Generic (non-power-of-two) rounding */ | ||
264 | |||
265 | #define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) | ||
266 | |||
267 | #define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1)) | ||
268 | |||
269 | /* | ||
270 | * Bitmask creation | ||
271 | * Bit positions start at zero. | ||
272 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | ||
273 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | ||
274 | */ | ||
275 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | ||
276 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | ||
277 | |||
278 | /* Bitfields within ACPI registers */ | ||
279 | |||
280 | #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) | ||
281 | #define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask) | ||
282 | |||
283 | #define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) | ||
284 | |||
285 | /* | ||
286 | * A struct acpi_namespace_node can appear in some contexts | ||
287 | * where a pointer to a union acpi_operand_object can also | ||
288 | * appear. This macro is used to distinguish them. | ||
289 | * | ||
290 | * The "Descriptor" field is the first field in both structures. | ||
291 | */ | ||
292 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) | ||
293 | #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) | ||
294 | |||
295 | /* Macro to test the object type */ | ||
296 | |||
297 | #define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) | ||
298 | |||
299 | /* | ||
300 | * Macros for the master AML opcode table | ||
301 | */ | ||
302 | #if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) | ||
303 | #define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \ | ||
304 | {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type} | ||
305 | #else | ||
306 | #define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \ | ||
307 | {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type} | ||
308 | #endif | ||
309 | |||
310 | #define ARG_TYPE_WIDTH 5 | ||
311 | #define ARG_1(x) ((u32)(x)) | ||
312 | #define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH)) | ||
313 | #define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH)) | ||
314 | #define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH)) | ||
315 | #define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH)) | ||
316 | #define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) | ||
317 | |||
318 | #define ARGI_LIST1(a) (ARG_1(a)) | ||
319 | #define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a)) | ||
320 | #define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) | ||
321 | #define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) | ||
322 | #define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) | ||
323 | #define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) | ||
324 | |||
325 | #define ARGP_LIST1(a) (ARG_1(a)) | ||
326 | #define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b)) | ||
327 | #define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) | ||
328 | #define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) | ||
329 | #define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) | ||
330 | #define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) | ||
331 | |||
332 | #define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) | ||
333 | #define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) | ||
334 | |||
335 | /* | ||
336 | * Ascii error messages can be configured out | ||
337 | */ | ||
338 | #ifndef ACPI_NO_ERROR_MESSAGES | ||
339 | |||
340 | /* | ||
341 | * Error reporting. Callers module and line number are inserted by AE_INFO, | ||
342 | * the plist contains a set of parens to allow variable-length lists. | ||
343 | * These macros are used for both the debug and non-debug versions of the code. | ||
344 | */ | ||
345 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); | ||
346 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); | ||
347 | |||
348 | #else | ||
349 | |||
350 | /* No error messages */ | ||
351 | |||
352 | #define ACPI_ERROR_NAMESPACE(s, e) | ||
353 | #define ACPI_ERROR_METHOD(s, n, p, e) | ||
354 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||
355 | |||
356 | /* | ||
357 | * Debug macros that are conditionally compiled | ||
358 | */ | ||
359 | #ifdef ACPI_DEBUG_OUTPUT | ||
360 | |||
361 | /* | ||
362 | * Function entry tracing | ||
363 | */ | ||
364 | #ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE | ||
365 | |||
366 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | ||
367 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | ||
368 | #define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ | ||
369 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b) | ||
370 | #define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \ | ||
371 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b) | ||
372 | #define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \ | ||
373 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b) | ||
374 | |||
375 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | ||
376 | |||
377 | /* | ||
378 | * Function exit tracing. | ||
379 | * WARNING: These macros include a return statement. This is usually considered | ||
380 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | ||
381 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | ||
382 | * so that "_AcpiFunctionName" is defined. | ||
383 | * | ||
384 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | ||
385 | * about these constructs. | ||
386 | */ | ||
387 | #ifdef ACPI_USE_DO_WHILE_0 | ||
388 | #define ACPI_DO_WHILE0(a) do a while(0) | ||
389 | #else | ||
390 | #define ACPI_DO_WHILE0(a) a | ||
391 | #endif | ||
392 | |||
393 | #define return_VOID ACPI_DO_WHILE0 ({ \ | ||
394 | acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ | ||
395 | return;}) | ||
396 | /* | ||
397 | * There are two versions of most of the return macros. The default version is | ||
398 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
399 | * not be evaluated twice. | ||
400 | * | ||
401 | * A less-safe version of the macros is provided for optional use if the | ||
402 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
403 | * debug case if code optimzation is disabled.) | ||
404 | */ | ||
405 | #ifndef ACPI_SIMPLE_RETURN_MACROS | ||
406 | |||
407 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
408 | register acpi_status _s = (s); \ | ||
409 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
410 | return (_s); }) | ||
411 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
412 | register void *_s = (void *) (s); \ | ||
413 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | ||
414 | return (_s); }) | ||
415 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
416 | register acpi_integer _s = (s); \ | ||
417 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
418 | return (_s); }) | ||
419 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | ||
420 | register u8 _s = (u8) (s); \ | ||
421 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | ||
422 | return (_s); }) | ||
423 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | ||
424 | register u32 _s = (u32) (s); \ | ||
425 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | ||
426 | return (_s); }) | ||
427 | #else /* Use original less-safe macros */ | ||
428 | |||
429 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
430 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ | ||
431 | return((s)); }) | ||
432 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
433 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | ||
434 | return((s)); }) | ||
435 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
436 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | ||
437 | return((s)); }) | ||
438 | #define return_UINT8(s) return_VALUE(s) | ||
439 | #define return_UINT32(s) return_VALUE(s) | ||
440 | |||
441 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
442 | |||
443 | #else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */ | ||
444 | |||
445 | #define ACPI_FUNCTION_TRACE(a) | ||
446 | #define ACPI_FUNCTION_TRACE_PTR(a,b) | ||
447 | #define ACPI_FUNCTION_TRACE_U32(a,b) | ||
448 | #define ACPI_FUNCTION_TRACE_STR(a,b) | ||
449 | #define ACPI_FUNCTION_EXIT | ||
450 | #define ACPI_FUNCTION_STATUS_EXIT(s) | ||
451 | #define ACPI_FUNCTION_VALUE_EXIT(s) | ||
452 | #define ACPI_FUNCTION_TRACE(a) | ||
453 | #define ACPI_FUNCTION_ENTRY() | ||
454 | |||
455 | #define return_VOID return | ||
456 | #define return_ACPI_STATUS(s) return(s) | ||
457 | #define return_VALUE(s) return(s) | ||
458 | #define return_UINT8(s) return(s) | ||
459 | #define return_UINT32(s) return(s) | ||
460 | #define return_PTR(s) return(s) | ||
461 | |||
462 | #endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */ | ||
463 | |||
464 | /* Conditional execution */ | ||
465 | |||
466 | #define ACPI_DEBUG_EXEC(a) a | ||
467 | #define ACPI_NORMAL_EXEC(a) | ||
468 | |||
469 | #define ACPI_DEBUG_DEFINE(a) a; | ||
470 | #define ACPI_DEBUG_ONLY_MEMBERS(a) a; | ||
471 | #define _VERBOSE_STRUCTURES | ||
472 | |||
473 | /* Stack and buffer dumping */ | ||
474 | |||
475 | #define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0) | ||
476 | #define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c) | ||
477 | |||
478 | #define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b) | ||
479 | #define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d) | ||
480 | #define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) | ||
481 | #define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) | ||
482 | |||
483 | #else | ||
484 | /* | ||
485 | * This is the non-debug case -- make everything go away, | ||
486 | * leaving no executable debug code! | ||
487 | */ | ||
488 | #define ACPI_DEBUG_EXEC(a) | ||
489 | #define ACPI_NORMAL_EXEC(a) a; | ||
490 | |||
491 | #define ACPI_DEBUG_DEFINE(a) do { } while(0) | ||
492 | #define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) | ||
493 | #define ACPI_FUNCTION_TRACE(a) do { } while(0) | ||
494 | #define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0) | ||
495 | #define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0) | ||
496 | #define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0) | ||
497 | #define ACPI_FUNCTION_EXIT do { } while(0) | ||
498 | #define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) | ||
499 | #define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) | ||
500 | #define ACPI_FUNCTION_ENTRY() do { } while(0) | ||
501 | #define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) | ||
502 | #define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0) | ||
503 | #define ACPI_DUMP_ENTRY(a, b) do { } while(0) | ||
504 | #define ACPI_DUMP_TABLES(a, b) do { } while(0) | ||
505 | #define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0) | ||
506 | #define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0) | ||
507 | #define ACPI_DUMP_BUFFER(a, b) do { } while(0) | ||
508 | |||
509 | #define return_VOID return | ||
510 | #define return_ACPI_STATUS(s) return(s) | ||
511 | #define return_VALUE(s) return(s) | ||
512 | #define return_UINT8(s) return(s) | ||
513 | #define return_UINT32(s) return(s) | ||
514 | #define return_PTR(s) return(s) | ||
515 | |||
516 | #endif /* ACPI_DEBUG_OUTPUT */ | ||
517 | |||
518 | /* | ||
519 | * Some code only gets executed when the debugger is built in. | ||
520 | * Note that this is entirely independent of whether the | ||
521 | * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. | ||
522 | */ | ||
523 | #ifdef ACPI_DEBUGGER | ||
524 | #define ACPI_DEBUGGER_EXEC(a) a | ||
525 | #else | ||
526 | #define ACPI_DEBUGGER_EXEC(a) | ||
527 | #endif | ||
528 | |||
529 | #ifdef ACPI_DEBUG_OUTPUT | ||
530 | /* | ||
531 | * 1) Set name to blanks | ||
532 | * 2) Copy the object name | ||
533 | */ | ||
534 | #define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\ | ||
535 | ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name)) | ||
536 | #else | ||
537 | |||
538 | #define ACPI_ADD_OBJECT_NAME(a,b) | ||
539 | #endif | ||
540 | |||
541 | /* | ||
542 | * Memory allocation tracking (DEBUG ONLY) | ||
543 | */ | ||
544 | #define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__ | ||
545 | |||
546 | #ifndef ACPI_DBG_TRACK_ALLOCATIONS | ||
547 | |||
548 | /* Memory allocation */ | ||
549 | |||
550 | #ifndef ACPI_ALLOCATE | ||
551 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS) | ||
552 | #endif | ||
553 | #ifndef ACPI_ALLOCATE_ZEROED | ||
554 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS) | ||
555 | #endif | ||
556 | #ifndef ACPI_FREE | ||
557 | #define ACPI_FREE(a) acpio_os_free(a) | ||
558 | #endif | ||
559 | #define ACPI_MEM_TRACKING(a) | ||
560 | |||
561 | #else | ||
562 | |||
563 | /* Memory allocation */ | ||
564 | |||
565 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) | ||
566 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS) | ||
567 | #define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS) | ||
568 | #define ACPI_MEM_TRACKING(a) a | ||
569 | |||
570 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | ||
571 | |||
572 | /* Preemption point */ | ||
573 | #ifndef ACPI_PREEMPTION_POINT | ||
574 | #define ACPI_PREEMPTION_POINT() /* no preemption */ | ||
575 | #endif | ||
576 | |||
577 | #endif /* ACMACROS_H */ | ||
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h new file mode 100644 index 000000000000..46cb5b46d280 --- /dev/null +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -0,0 +1,324 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acnamesp.h - Namespace subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACNAMESP_H__ | ||
45 | #define __ACNAMESP_H__ | ||
46 | |||
47 | /* To search the entire name space, pass this as search_base */ | ||
48 | |||
49 | #define ACPI_NS_ALL ((acpi_handle)0) | ||
50 | |||
51 | /* | ||
52 | * Elements of acpi_ns_properties are bit significant | ||
53 | * and should be one-to-one with values of acpi_object_type | ||
54 | */ | ||
55 | #define ACPI_NS_NORMAL 0 | ||
56 | #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ | ||
57 | #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ | ||
58 | |||
59 | /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */ | ||
60 | |||
61 | #define ACPI_NS_NO_UPSEARCH 0 | ||
62 | #define ACPI_NS_SEARCH_PARENT 0x01 | ||
63 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 | ||
64 | #define ACPI_NS_NO_PEER_SEARCH 0x04 | ||
65 | #define ACPI_NS_ERROR_IF_FOUND 0x08 | ||
66 | #define ACPI_NS_PREFIX_IS_SCOPE 0x10 | ||
67 | #define ACPI_NS_EXTERNAL 0x20 | ||
68 | #define ACPI_NS_TEMPORARY 0x40 | ||
69 | |||
70 | /* Flags for acpi_ns_walk_namespace */ | ||
71 | |||
72 | #define ACPI_NS_WALK_NO_UNLOCK 0 | ||
73 | #define ACPI_NS_WALK_UNLOCK 0x01 | ||
74 | #define ACPI_NS_WALK_TEMP_NODES 0x02 | ||
75 | |||
76 | /* | ||
77 | * nsinit - Namespace initialization | ||
78 | */ | ||
79 | acpi_status acpi_ns_initialize_objects(void); | ||
80 | |||
81 | acpi_status acpi_ns_initialize_devices(void); | ||
82 | |||
83 | /* | ||
84 | * nsload - Namespace loading | ||
85 | */ | ||
86 | acpi_status acpi_ns_load_namespace(void); | ||
87 | |||
88 | acpi_status | ||
89 | acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node); | ||
90 | |||
91 | /* | ||
92 | * nswalk - walk the namespace | ||
93 | */ | ||
94 | acpi_status | ||
95 | acpi_ns_walk_namespace(acpi_object_type type, | ||
96 | acpi_handle start_object, | ||
97 | u32 max_depth, | ||
98 | u32 flags, | ||
99 | acpi_walk_callback user_function, | ||
100 | void *context, void **return_value); | ||
101 | |||
102 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node | ||
103 | *parent, struct acpi_namespace_node | ||
104 | *child); | ||
105 | |||
106 | /* | ||
107 | * nsparse - table parsing | ||
108 | */ | ||
109 | acpi_status | ||
110 | acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node); | ||
111 | |||
112 | acpi_status | ||
113 | acpi_ns_one_complete_parse(u32 pass_number, | ||
114 | u32 table_index, | ||
115 | struct acpi_namespace_node *start_node); | ||
116 | |||
117 | /* | ||
118 | * nsaccess - Top-level namespace access | ||
119 | */ | ||
120 | acpi_status acpi_ns_root_initialize(void); | ||
121 | |||
122 | acpi_status | ||
123 | acpi_ns_lookup(union acpi_generic_state *scope_info, | ||
124 | char *name, | ||
125 | acpi_object_type type, | ||
126 | acpi_interpreter_mode interpreter_mode, | ||
127 | u32 flags, | ||
128 | struct acpi_walk_state *walk_state, | ||
129 | struct acpi_namespace_node **ret_node); | ||
130 | |||
131 | /* | ||
132 | * nsalloc - Named object allocation/deallocation | ||
133 | */ | ||
134 | struct acpi_namespace_node *acpi_ns_create_node(u32 name); | ||
135 | |||
136 | void acpi_ns_delete_node(struct acpi_namespace_node *node); | ||
137 | |||
138 | void | ||
139 | acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); | ||
140 | |||
141 | void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id); | ||
142 | |||
143 | void acpi_ns_detach_object(struct acpi_namespace_node *node); | ||
144 | |||
145 | void acpi_ns_delete_children(struct acpi_namespace_node *parent); | ||
146 | |||
147 | int acpi_ns_compare_names(char *name1, char *name2); | ||
148 | |||
149 | /* | ||
150 | * nsdump - Namespace dump/print utilities | ||
151 | */ | ||
152 | #ifdef ACPI_FUTURE_USAGE | ||
153 | void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth); | ||
154 | #endif /* ACPI_FUTURE_USAGE */ | ||
155 | |||
156 | void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level); | ||
157 | |||
158 | void | ||
159 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component); | ||
160 | |||
161 | void acpi_ns_print_pathname(u32 num_segments, char *pathname); | ||
162 | |||
163 | acpi_status | ||
164 | acpi_ns_dump_one_object(acpi_handle obj_handle, | ||
165 | u32 level, void *context, void **return_value); | ||
166 | |||
167 | #ifdef ACPI_FUTURE_USAGE | ||
168 | void | ||
169 | acpi_ns_dump_objects(acpi_object_type type, | ||
170 | u8 display_type, | ||
171 | u32 max_depth, | ||
172 | acpi_owner_id owner_id, acpi_handle start_handle); | ||
173 | #endif /* ACPI_FUTURE_USAGE */ | ||
174 | |||
175 | /* | ||
176 | * nseval - Namespace evaluation functions | ||
177 | */ | ||
178 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); | ||
179 | |||
180 | /* | ||
181 | * nspredef - Support for predefined/reserved names | ||
182 | */ | ||
183 | acpi_status | ||
184 | acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | ||
185 | u32 user_param_count, | ||
186 | acpi_status return_status, | ||
187 | union acpi_operand_object **return_object); | ||
188 | |||
189 | const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | ||
190 | acpi_namespace_node | ||
191 | *node); | ||
192 | |||
193 | void | ||
194 | acpi_ns_check_parameter_count(char *pathname, | ||
195 | struct acpi_namespace_node *node, | ||
196 | u32 user_param_count, | ||
197 | const union acpi_predefined_info *info); | ||
198 | |||
199 | /* | ||
200 | * nsnames - Name and Scope manipulation | ||
201 | */ | ||
202 | u32 acpi_ns_opens_scope(acpi_object_type type); | ||
203 | |||
204 | acpi_status | ||
205 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
206 | acpi_size size, char *name_buffer); | ||
207 | |||
208 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); | ||
209 | |||
210 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); | ||
211 | |||
212 | acpi_status | ||
213 | acpi_ns_handle_to_pathname(acpi_handle target_handle, | ||
214 | struct acpi_buffer *buffer); | ||
215 | |||
216 | u8 | ||
217 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); | ||
218 | |||
219 | acpi_status | ||
220 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, | ||
221 | const char *external_pathname, | ||
222 | u32 flags, struct acpi_namespace_node **out_node); | ||
223 | |||
224 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); | ||
225 | |||
226 | /* | ||
227 | * nsobject - Object management for namespace nodes | ||
228 | */ | ||
229 | acpi_status | ||
230 | acpi_ns_attach_object(struct acpi_namespace_node *node, | ||
231 | union acpi_operand_object *object, acpi_object_type type); | ||
232 | |||
233 | union acpi_operand_object *acpi_ns_get_attached_object(struct | ||
234 | acpi_namespace_node | ||
235 | *node); | ||
236 | |||
237 | union acpi_operand_object *acpi_ns_get_secondary_object(union | ||
238 | acpi_operand_object | ||
239 | *obj_desc); | ||
240 | |||
241 | acpi_status | ||
242 | acpi_ns_attach_data(struct acpi_namespace_node *node, | ||
243 | acpi_object_handler handler, void *data); | ||
244 | |||
245 | acpi_status | ||
246 | acpi_ns_detach_data(struct acpi_namespace_node *node, | ||
247 | acpi_object_handler handler); | ||
248 | |||
249 | acpi_status | ||
250 | acpi_ns_get_attached_data(struct acpi_namespace_node *node, | ||
251 | acpi_object_handler handler, void **data); | ||
252 | |||
253 | /* | ||
254 | * nssearch - Namespace searching and entry | ||
255 | */ | ||
256 | acpi_status | ||
257 | acpi_ns_search_and_enter(u32 entry_name, | ||
258 | struct acpi_walk_state *walk_state, | ||
259 | struct acpi_namespace_node *node, | ||
260 | acpi_interpreter_mode interpreter_mode, | ||
261 | acpi_object_type type, | ||
262 | u32 flags, struct acpi_namespace_node **ret_node); | ||
263 | |||
264 | acpi_status | ||
265 | acpi_ns_search_one_scope(u32 entry_name, | ||
266 | struct acpi_namespace_node *node, | ||
267 | acpi_object_type type, | ||
268 | struct acpi_namespace_node **ret_node); | ||
269 | |||
270 | void | ||
271 | acpi_ns_install_node(struct acpi_walk_state *walk_state, | ||
272 | struct acpi_namespace_node *parent_node, | ||
273 | struct acpi_namespace_node *node, acpi_object_type type); | ||
274 | |||
275 | /* | ||
276 | * nsutils - Utility functions | ||
277 | */ | ||
278 | u8 acpi_ns_valid_root_prefix(char prefix); | ||
279 | |||
280 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); | ||
281 | |||
282 | u32 acpi_ns_local(acpi_object_type type); | ||
283 | |||
284 | void | ||
285 | acpi_ns_report_error(const char *module_name, | ||
286 | u32 line_number, | ||
287 | const char *internal_name, acpi_status lookup_status); | ||
288 | |||
289 | void | ||
290 | acpi_ns_report_method_error(const char *module_name, | ||
291 | u32 line_number, | ||
292 | const char *message, | ||
293 | struct acpi_namespace_node *node, | ||
294 | const char *path, acpi_status lookup_status); | ||
295 | |||
296 | void | ||
297 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); | ||
298 | |||
299 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); | ||
300 | |||
301 | void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info); | ||
302 | |||
303 | acpi_status | ||
304 | acpi_ns_internalize_name(const char *dotted_name, char **converted_name); | ||
305 | |||
306 | acpi_status | ||
307 | acpi_ns_externalize_name(u32 internal_name_length, | ||
308 | const char *internal_name, | ||
309 | u32 * converted_name_length, char **converted_name); | ||
310 | |||
311 | struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle); | ||
312 | |||
313 | acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node); | ||
314 | |||
315 | void acpi_ns_terminate(void); | ||
316 | |||
317 | struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node | ||
318 | *node); | ||
319 | |||
320 | struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct | ||
321 | acpi_namespace_node | ||
322 | *node); | ||
323 | |||
324 | #endif /* __ACNAMESP_H__ */ | ||
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h new file mode 100644 index 000000000000..eb6f038b03d9 --- /dev/null +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -0,0 +1,446 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #ifndef _ACOBJECT_H | ||
46 | #define _ACOBJECT_H | ||
47 | |||
48 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
49 | |||
50 | /* | ||
51 | * The union acpi_operand_object is used to pass AML operands from the dispatcher | ||
52 | * to the interpreter, and to keep track of the various handlers such as | ||
53 | * address space handlers and notify handlers. The object is a constant | ||
54 | * size in order to allow it to be cached and reused. | ||
55 | * | ||
56 | * Note: The object is optimized to be aligned and will not work if it is | ||
57 | * byte-packed. | ||
58 | */ | ||
59 | #if ACPI_MACHINE_WIDTH == 64 | ||
60 | #pragma pack(8) | ||
61 | #else | ||
62 | #pragma pack(4) | ||
63 | #endif | ||
64 | |||
65 | /******************************************************************************* | ||
66 | * | ||
67 | * Common Descriptors | ||
68 | * | ||
69 | ******************************************************************************/ | ||
70 | |||
71 | /* | ||
72 | * Common area for all objects. | ||
73 | * | ||
74 | * descriptor_type is used to differentiate between internal descriptors, and | ||
75 | * must be in the same place across all descriptors | ||
76 | * | ||
77 | * Note: The descriptor_type and Type fields must appear in the identical | ||
78 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
79 | * structures. | ||
80 | */ | ||
81 | #define ACPI_OBJECT_COMMON_HEADER \ | ||
82 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | ||
83 | u8 descriptor_type; /* To differentiate various internal objs */\ | ||
84 | u8 type; /* acpi_object_type */\ | ||
85 | u16 reference_count; /* For object deletion management */\ | ||
86 | u8 flags; | ||
87 | /* | ||
88 | * Note: There are 3 bytes available here before the | ||
89 | * next natural alignment boundary (for both 32/64 cases) | ||
90 | */ | ||
91 | |||
92 | /* Values for Flag byte above */ | ||
93 | |||
94 | #define AOPOBJ_AML_CONSTANT 0x01 | ||
95 | #define AOPOBJ_STATIC_POINTER 0x02 | ||
96 | #define AOPOBJ_DATA_VALID 0x04 | ||
97 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | ||
98 | #define AOPOBJ_SETUP_COMPLETE 0x10 | ||
99 | #define AOPOBJ_SINGLE_DATUM 0x20 | ||
100 | #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ | ||
101 | |||
102 | /****************************************************************************** | ||
103 | * | ||
104 | * Basic data types | ||
105 | * | ||
106 | *****************************************************************************/ | ||
107 | |||
108 | struct acpi_object_common { | ||
109 | ACPI_OBJECT_COMMON_HEADER}; | ||
110 | |||
111 | struct acpi_object_integer { | ||
112 | ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ | ||
113 | acpi_integer value; | ||
114 | }; | ||
115 | |||
116 | /* | ||
117 | * Note: The String and Buffer object must be identical through the Pointer | ||
118 | * and length elements. There is code that depends on this. | ||
119 | * | ||
120 | * Fields common to both Strings and Buffers | ||
121 | */ | ||
122 | #define ACPI_COMMON_BUFFER_INFO(_type) \ | ||
123 | _type *pointer; \ | ||
124 | u32 length; | ||
125 | |||
126 | struct acpi_object_string { /* Null terminated, ASCII characters only */ | ||
127 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ | ||
128 | }; | ||
129 | |||
130 | struct acpi_object_buffer { | ||
131 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */ | ||
132 | u32 aml_length; | ||
133 | u8 *aml_start; | ||
134 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
135 | }; | ||
136 | |||
137 | struct acpi_object_package { | ||
138 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */ | ||
139 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ | ||
140 | u8 *aml_start; | ||
141 | u32 aml_length; | ||
142 | u32 count; /* # of elements in package */ | ||
143 | }; | ||
144 | |||
145 | /****************************************************************************** | ||
146 | * | ||
147 | * Complex data types | ||
148 | * | ||
149 | *****************************************************************************/ | ||
150 | |||
151 | struct acpi_object_event { | ||
152 | ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */ | ||
153 | }; | ||
154 | |||
155 | struct acpi_object_mutex { | ||
156 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ | ||
157 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | ||
158 | acpi_mutex os_mutex; /* Actual OS synchronization object */ | ||
159 | acpi_thread_id thread_id; /* Current owner of the mutex */ | ||
160 | struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ | ||
161 | union acpi_operand_object *prev; /* Link for list of acquired mutexes */ | ||
162 | union acpi_operand_object *next; /* Link for list of acquired mutexes */ | ||
163 | struct acpi_namespace_node *node; /* Containing namespace node */ | ||
164 | u8 original_sync_level; /* Owner's original sync level (0-15) */ | ||
165 | }; | ||
166 | |||
167 | struct acpi_object_region { | ||
168 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | ||
169 | struct acpi_namespace_node *node; /* Containing namespace node */ | ||
170 | union acpi_operand_object *handler; /* Handler for region access */ | ||
171 | union acpi_operand_object *next; | ||
172 | acpi_physical_address address; | ||
173 | u32 length; | ||
174 | }; | ||
175 | |||
176 | struct acpi_object_method { | ||
177 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
178 | u8 param_count; | ||
179 | u8 sync_level; | ||
180 | union acpi_operand_object *mutex; | ||
181 | u8 *aml_start; | ||
182 | ACPI_INTERNAL_METHOD implementation; | ||
183 | u32 aml_length; | ||
184 | u8 thread_count; | ||
185 | acpi_owner_id owner_id; | ||
186 | }; | ||
187 | |||
188 | /****************************************************************************** | ||
189 | * | ||
190 | * Objects that can be notified. All share a common notify_info area. | ||
191 | * | ||
192 | *****************************************************************************/ | ||
193 | |||
194 | /* | ||
195 | * Common fields for objects that support ASL notifications | ||
196 | */ | ||
197 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
198 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
199 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
200 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
201 | |||
202 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | ||
203 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | ||
204 | |||
205 | struct acpi_object_device { | ||
206 | ACPI_OBJECT_COMMON_HEADER | ||
207 | ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block; | ||
208 | }; | ||
209 | |||
210 | struct acpi_object_power_resource { | ||
211 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level; | ||
212 | u32 resource_order; | ||
213 | }; | ||
214 | |||
215 | struct acpi_object_processor { | ||
216 | ACPI_OBJECT_COMMON_HEADER | ||
217 | /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */ | ||
218 | u8 proc_id; | ||
219 | u8 length; | ||
220 | ACPI_COMMON_NOTIFY_INFO acpi_io_address address; | ||
221 | }; | ||
222 | |||
223 | struct acpi_object_thermal_zone { | ||
224 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | ||
225 | |||
226 | /****************************************************************************** | ||
227 | * | ||
228 | * Fields. All share a common header/info field. | ||
229 | * | ||
230 | *****************************************************************************/ | ||
231 | |||
232 | /* | ||
233 | * Common bitfield for the field objects | ||
234 | * "Field Datum" -- a datum from the actual field object | ||
235 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
236 | */ | ||
237 | #define ACPI_COMMON_FIELD_INFO \ | ||
238 | u8 field_flags; /* Access, update, and lock bits */\ | ||
239 | u8 attribute; /* From access_as keyword */\ | ||
240 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
241 | struct acpi_namespace_node *node; /* Link back to parent node */\ | ||
242 | u32 bit_length; /* Length of field in bits */\ | ||
243 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
244 | u32 value; /* Value to store into the Bank or Index register */\ | ||
245 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
246 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | ||
247 | |||
248 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | ||
249 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ | ||
250 | }; | ||
251 | |||
252 | struct acpi_object_region_field { | ||
253 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ | ||
254 | }; | ||
255 | |||
256 | struct acpi_object_bank_field { | ||
257 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */ | ||
258 | union acpi_operand_object *bank_obj; /* bank_select Register object */ | ||
259 | }; | ||
260 | |||
261 | struct acpi_object_index_field { | ||
262 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO | ||
263 | /* | ||
264 | * No "RegionObj" pointer needed since the Index and Data registers | ||
265 | * are each field definitions unto themselves. | ||
266 | */ | ||
267 | union acpi_operand_object *index_obj; /* Index register */ | ||
268 | union acpi_operand_object *data_obj; /* Data register */ | ||
269 | }; | ||
270 | |||
271 | /* The buffer_field is different in that it is part of a Buffer, not an op_region */ | ||
272 | |||
273 | struct acpi_object_buffer_field { | ||
274 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */ | ||
275 | }; | ||
276 | |||
277 | /****************************************************************************** | ||
278 | * | ||
279 | * Objects for handlers | ||
280 | * | ||
281 | *****************************************************************************/ | ||
282 | |||
283 | struct acpi_object_notify_handler { | ||
284 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ | ||
285 | acpi_notify_handler handler; | ||
286 | void *context; | ||
287 | }; | ||
288 | |||
289 | struct acpi_object_addr_handler { | ||
290 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | ||
291 | u8 handler_flags; | ||
292 | acpi_adr_space_handler handler; | ||
293 | struct acpi_namespace_node *node; /* Parent device */ | ||
294 | void *context; | ||
295 | acpi_adr_space_setup setup; | ||
296 | union acpi_operand_object *region_list; /* regions using this handler */ | ||
297 | union acpi_operand_object *next; | ||
298 | }; | ||
299 | |||
300 | /* Flags for address handler (handler_flags) */ | ||
301 | |||
302 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 | ||
303 | |||
304 | /****************************************************************************** | ||
305 | * | ||
306 | * Special internal objects | ||
307 | * | ||
308 | *****************************************************************************/ | ||
309 | |||
310 | /* | ||
311 | * The Reference object is used for these opcodes: | ||
312 | * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op | ||
313 | * The Reference.Class differentiates these types. | ||
314 | */ | ||
315 | struct acpi_object_reference { | ||
316 | ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */ | ||
317 | u8 target_type; /* Used for Index Op */ | ||
318 | u8 reserved; | ||
319 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | ||
320 | struct acpi_namespace_node *node; /* ref_of or Namepath */ | ||
321 | union acpi_operand_object **where; /* Target of Index */ | ||
322 | u32 value; /* Used for Local/Arg/Index/ddb_handle */ | ||
323 | }; | ||
324 | |||
325 | /* Values for Reference.Class above */ | ||
326 | |||
327 | typedef enum { | ||
328 | ACPI_REFCLASS_LOCAL = 0, /* Method local */ | ||
329 | ACPI_REFCLASS_ARG = 1, /* Method argument */ | ||
330 | ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */ | ||
331 | ACPI_REFCLASS_INDEX = 3, /* Result of Index() */ | ||
332 | ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */ | ||
333 | ACPI_REFCLASS_NAME = 5, /* Reference to a named object */ | ||
334 | ACPI_REFCLASS_DEBUG = 6, /* Debug object */ | ||
335 | |||
336 | ACPI_REFCLASS_MAX = 6 | ||
337 | } ACPI_REFERENCE_CLASSES; | ||
338 | |||
339 | /* | ||
340 | * Extra object is used as additional storage for types that | ||
341 | * have AML code in their declarations (term_args) that must be | ||
342 | * evaluated at run time. | ||
343 | * | ||
344 | * Currently: Region and field_unit types | ||
345 | */ | ||
346 | struct acpi_object_extra { | ||
347 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ | ||
348 | void *region_context; /* Region-specific data */ | ||
349 | u8 *aml_start; | ||
350 | u32 aml_length; | ||
351 | }; | ||
352 | |||
353 | /* Additional data that can be attached to namespace nodes */ | ||
354 | |||
355 | struct acpi_object_data { | ||
356 | ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler; | ||
357 | void *pointer; | ||
358 | }; | ||
359 | |||
360 | /* Structure used when objects are cached for reuse */ | ||
361 | |||
362 | struct acpi_object_cache_list { | ||
363 | ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */ | ||
364 | }; | ||
365 | |||
366 | /****************************************************************************** | ||
367 | * | ||
368 | * union acpi_operand_object Descriptor - a giant union of all of the above | ||
369 | * | ||
370 | *****************************************************************************/ | ||
371 | |||
372 | union acpi_operand_object { | ||
373 | struct acpi_object_common common; | ||
374 | struct acpi_object_integer integer; | ||
375 | struct acpi_object_string string; | ||
376 | struct acpi_object_buffer buffer; | ||
377 | struct acpi_object_package package; | ||
378 | struct acpi_object_event event; | ||
379 | struct acpi_object_method method; | ||
380 | struct acpi_object_mutex mutex; | ||
381 | struct acpi_object_region region; | ||
382 | struct acpi_object_notify_common common_notify; | ||
383 | struct acpi_object_device device; | ||
384 | struct acpi_object_power_resource power_resource; | ||
385 | struct acpi_object_processor processor; | ||
386 | struct acpi_object_thermal_zone thermal_zone; | ||
387 | struct acpi_object_field_common common_field; | ||
388 | struct acpi_object_region_field field; | ||
389 | struct acpi_object_buffer_field buffer_field; | ||
390 | struct acpi_object_bank_field bank_field; | ||
391 | struct acpi_object_index_field index_field; | ||
392 | struct acpi_object_notify_handler notify; | ||
393 | struct acpi_object_addr_handler address_space; | ||
394 | struct acpi_object_reference reference; | ||
395 | struct acpi_object_extra extra; | ||
396 | struct acpi_object_data data; | ||
397 | struct acpi_object_cache_list cache; | ||
398 | |||
399 | /* | ||
400 | * Add namespace node to union in order to simplify code that accepts both | ||
401 | * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share | ||
402 | * a common descriptor_type field in order to differentiate them. | ||
403 | */ | ||
404 | struct acpi_namespace_node node; | ||
405 | }; | ||
406 | |||
407 | /****************************************************************************** | ||
408 | * | ||
409 | * union acpi_descriptor - objects that share a common descriptor identifier | ||
410 | * | ||
411 | *****************************************************************************/ | ||
412 | |||
413 | /* Object descriptor types */ | ||
414 | |||
415 | #define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */ | ||
416 | #define ACPI_DESC_TYPE_STATE 0x02 | ||
417 | #define ACPI_DESC_TYPE_STATE_UPDATE 0x03 | ||
418 | #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04 | ||
419 | #define ACPI_DESC_TYPE_STATE_CONTROL 0x05 | ||
420 | #define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06 | ||
421 | #define ACPI_DESC_TYPE_STATE_PSCOPE 0x07 | ||
422 | #define ACPI_DESC_TYPE_STATE_WSCOPE 0x08 | ||
423 | #define ACPI_DESC_TYPE_STATE_RESULT 0x09 | ||
424 | #define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A | ||
425 | #define ACPI_DESC_TYPE_STATE_THREAD 0x0B | ||
426 | #define ACPI_DESC_TYPE_WALK 0x0C | ||
427 | #define ACPI_DESC_TYPE_PARSER 0x0D | ||
428 | #define ACPI_DESC_TYPE_OPERAND 0x0E | ||
429 | #define ACPI_DESC_TYPE_NAMED 0x0F | ||
430 | #define ACPI_DESC_TYPE_MAX 0x0F | ||
431 | |||
432 | struct acpi_common_descriptor { | ||
433 | void *common_pointer; | ||
434 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
435 | }; | ||
436 | |||
437 | union acpi_descriptor { | ||
438 | struct acpi_common_descriptor common; | ||
439 | union acpi_operand_object object; | ||
440 | struct acpi_namespace_node node; | ||
441 | union acpi_parse_object op; | ||
442 | }; | ||
443 | |||
444 | #pragma pack() | ||
445 | |||
446 | #endif /* _ACOBJECT_H */ | ||
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h new file mode 100644 index 000000000000..dfdf63327885 --- /dev/null +++ b/drivers/acpi/acpica/acopcode.h | |||
@@ -0,0 +1,323 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acopcode.h - AML opcode information for the AML parser and interpreter | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACOPCODE_H__ | ||
45 | #define __ACOPCODE_H__ | ||
46 | |||
47 | #define MAX_EXTENDED_OPCODE 0x88 | ||
48 | #define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1) | ||
49 | #define MAX_INTERNAL_OPCODE | ||
50 | #define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1) | ||
51 | |||
52 | /* Used for non-assigned opcodes */ | ||
53 | |||
54 | #define _UNK 0x6B | ||
55 | |||
56 | /* | ||
57 | * Reserved ASCII characters. Do not use any of these for | ||
58 | * internal opcodes, since they are used to differentiate | ||
59 | * name strings from AML opcodes | ||
60 | */ | ||
61 | #define _ASC 0x6C | ||
62 | #define _NAM 0x6C | ||
63 | #define _PFX 0x6D | ||
64 | |||
65 | /* | ||
66 | * All AML opcodes and the parse-time arguments for each. Used by the AML | ||
67 | * parser Each list is compressed into a 32-bit number and stored in the | ||
68 | * master opcode table (in psopcode.c). | ||
69 | */ | ||
70 | #define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
71 | #define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) | ||
72 | #define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
73 | #define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME) | ||
74 | #define ARGP_ARG0 ARG_NONE | ||
75 | #define ARGP_ARG1 ARG_NONE | ||
76 | #define ARGP_ARG2 ARG_NONE | ||
77 | #define ARGP_ARG3 ARG_NONE | ||
78 | #define ARGP_ARG4 ARG_NONE | ||
79 | #define ARGP_ARG5 ARG_NONE | ||
80 | #define ARGP_ARG6 ARG_NONE | ||
81 | #define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
82 | #define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
83 | #define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
84 | #define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
85 | #define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
86 | #define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
87 | #define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
88 | #define ARGP_BREAK_OP ARG_NONE | ||
89 | #define ARGP_BREAK_POINT_OP ARG_NONE | ||
90 | #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) | ||
91 | #define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) | ||
92 | #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
93 | #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | ||
96 | #define ARGP_CONTINUE_OP ARG_NONE | ||
97 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) | ||
98 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
99 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
100 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
101 | #define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
102 | #define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
103 | #define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | ||
104 | #define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
105 | #define ARGP_DEBUG_OP ARG_NONE | ||
106 | #define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
107 | #define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) | ||
108 | #define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
109 | #define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) | ||
110 | #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) | ||
111 | #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) | ||
112 | #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) | ||
113 | #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) | ||
114 | #define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
115 | #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
116 | #define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
117 | #define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
118 | #define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
119 | #define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
120 | #define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) | ||
121 | #define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
122 | #define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
123 | #define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
124 | #define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
125 | #define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
126 | #define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
127 | #define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
128 | #define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) | ||
129 | #define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
130 | #define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) | ||
131 | #define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) | ||
132 | #define ARGP_LOCAL0 ARG_NONE | ||
133 | #define ARGP_LOCAL1 ARG_NONE | ||
134 | #define ARGP_LOCAL2 ARG_NONE | ||
135 | #define ARGP_LOCAL3 ARG_NONE | ||
136 | #define ARGP_LOCAL4 ARG_NONE | ||
137 | #define ARGP_LOCAL5 ARG_NONE | ||
138 | #define ARGP_LOCAL6 ARG_NONE | ||
139 | #define ARGP_LOCAL7 ARG_NONE | ||
140 | #define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) | ||
141 | #define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
142 | #define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) | ||
143 | #define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
144 | #define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
145 | #define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
146 | #define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
147 | #define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) | ||
148 | #define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) | ||
149 | #define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
150 | #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
151 | #define ARGP_NOOP_OP ARG_NONE | ||
152 | #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
153 | #define ARGP_ONE_OP ARG_NONE | ||
154 | #define ARGP_ONES_OP ARG_NONE | ||
155 | #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) | ||
156 | #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) | ||
157 | #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) | ||
158 | #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) | ||
159 | #define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
160 | #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) | ||
161 | #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
162 | #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
163 | #define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
164 | #define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) | ||
165 | #define ARGP_REVISION_OP ARG_NONE | ||
166 | #define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) | ||
167 | #define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
168 | #define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
169 | #define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
170 | #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
171 | #define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) | ||
172 | #define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) | ||
173 | #define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) | ||
174 | #define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) | ||
175 | #define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) | ||
176 | #define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
177 | #define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) | ||
178 | #define ARGP_TIMER_OP ARG_NONE | ||
179 | #define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
180 | #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
181 | #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
182 | #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
183 | #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) | ||
184 | #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | ||
185 | #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
186 | #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) | ||
187 | #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) | ||
188 | #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) | ||
189 | #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) | ||
190 | #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) | ||
191 | #define ARGP_ZERO_OP ARG_NONE | ||
192 | |||
193 | /* | ||
194 | * All AML opcodes and the runtime arguments for each. Used by the AML | ||
195 | * interpreter Each list is compressed into a 32-bit number and stored | ||
196 | * in the master opcode table (in psopcode.c). | ||
197 | * | ||
198 | * (Used by prep_operands procedure and the ASL Compiler) | ||
199 | */ | ||
200 | #define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE | ||
201 | #define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) | ||
202 | #define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
203 | #define ARGI_ALIAS_OP ARGI_INVALID_OPCODE | ||
204 | #define ARGI_ARG0 ARG_NONE | ||
205 | #define ARGI_ARG1 ARG_NONE | ||
206 | #define ARGI_ARG2 ARG_NONE | ||
207 | #define ARGI_ARG3 ARG_NONE | ||
208 | #define ARGI_ARG4 ARG_NONE | ||
209 | #define ARGI_ARG5 ARG_NONE | ||
210 | #define ARGI_ARG6 ARG_NONE | ||
211 | #define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE | ||
212 | #define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
213 | #define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
214 | #define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
215 | #define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
216 | #define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
217 | #define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
218 | #define ARGI_BREAK_OP ARG_NONE | ||
219 | #define ARGI_BREAK_POINT_OP ARG_NONE | ||
220 | #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) | ||
221 | #define ARGI_BYTE_OP ARGI_INVALID_OPCODE | ||
222 | #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE | ||
223 | #define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) | ||
224 | #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) | ||
225 | #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) | ||
226 | #define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE | ||
227 | #define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) | ||
228 | #define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
229 | #define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
230 | #define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
231 | #define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) | ||
232 | #define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
233 | #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) | ||
234 | #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) | ||
235 | #define ARGI_DEBUG_OP ARG_NONE | ||
236 | #define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) | ||
237 | #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) | ||
238 | #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE | ||
239 | #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) | ||
240 | #define ARGI_DWORD_OP ARGI_INVALID_OPCODE | ||
241 | #define ARGI_ELSE_OP ARGI_INVALID_OPCODE | ||
242 | #define ARGI_EVENT_OP ARGI_INVALID_OPCODE | ||
243 | #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) | ||
244 | #define ARGI_FIELD_OP ARGI_INVALID_OPCODE | ||
245 | #define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
246 | #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) | ||
247 | #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
248 | #define ARGI_IF_OP ARGI_INVALID_OPCODE | ||
249 | #define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) | ||
250 | #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE | ||
251 | #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) | ||
252 | #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
253 | #define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
254 | #define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
255 | #define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE | ||
256 | #define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA) | ||
257 | #define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE | ||
258 | #define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) | ||
259 | #define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE | ||
260 | #define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF) | ||
261 | #define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE) | ||
262 | #define ARGI_LOCAL0 ARG_NONE | ||
263 | #define ARGI_LOCAL1 ARG_NONE | ||
264 | #define ARGI_LOCAL2 ARG_NONE | ||
265 | #define ARGI_LOCAL3 ARG_NONE | ||
266 | #define ARGI_LOCAL4 ARG_NONE | ||
267 | #define ARGI_LOCAL5 ARG_NONE | ||
268 | #define ARGI_LOCAL6 ARG_NONE | ||
269 | #define ARGI_LOCAL7 ARG_NONE | ||
270 | #define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
271 | #define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER) | ||
272 | #define ARGI_METHOD_OP ARGI_INVALID_OPCODE | ||
273 | #define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE | ||
274 | #define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
275 | #define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
276 | #define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
277 | #define ARGI_MUTEX_OP ARGI_INVALID_OPCODE | ||
278 | #define ARGI_NAME_OP ARGI_INVALID_OPCODE | ||
279 | #define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE | ||
280 | #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE | ||
281 | #define ARGI_NOOP_OP ARG_NONE | ||
282 | #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) | ||
283 | #define ARGI_ONE_OP ARG_NONE | ||
284 | #define ARGI_ONES_OP ARG_NONE | ||
285 | #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
286 | #define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE | ||
287 | #define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE | ||
288 | #define ARGI_QWORD_OP ARGI_INVALID_OPCODE | ||
289 | #define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) | ||
290 | #define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) | ||
291 | #define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) | ||
292 | #define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE | ||
293 | #define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) | ||
294 | #define ARGI_RETURN_OP ARGI_INVALID_OPCODE | ||
295 | #define ARGI_REVISION_OP ARG_NONE | ||
296 | #define ARGI_SCOPE_OP ARGI_INVALID_OPCODE | ||
297 | #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
298 | #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
299 | #define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) | ||
300 | #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) | ||
301 | #define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) | ||
302 | #define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) | ||
303 | #define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE | ||
304 | #define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF) | ||
305 | #define ARGI_STRING_OP ARGI_INVALID_OPCODE | ||
306 | #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) | ||
307 | #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE | ||
308 | #define ARGI_TIMER_OP ARG_NONE | ||
309 | #define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
310 | #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
311 | #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
312 | #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
313 | #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) | ||
314 | #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) | ||
315 | #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) | ||
316 | #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) | ||
317 | #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) | ||
318 | #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) | ||
319 | #define ARGI_WHILE_OP ARGI_INVALID_OPCODE | ||
320 | #define ARGI_WORD_OP ARGI_INVALID_OPCODE | ||
321 | #define ARGI_ZERO_OP ARG_NONE | ||
322 | |||
323 | #endif /* __ACOPCODE_H__ */ | ||
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h new file mode 100644 index 000000000000..23ee0fbf5619 --- /dev/null +++ b/drivers/acpi/acpica/acparser.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: acparser.h - AML Parser subcomponent prototypes and defines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACPARSER_H__ | ||
45 | #define __ACPARSER_H__ | ||
46 | |||
47 | #define OP_HAS_RETURN_VALUE 1 | ||
48 | |||
49 | /* Variable number of arguments. This field must be 32 bits */ | ||
50 | |||
51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | ||
52 | |||
53 | #define ACPI_PARSE_DELETE_TREE 0x0001 | ||
54 | #define ACPI_PARSE_NO_TREE_DELETE 0x0000 | ||
55 | #define ACPI_PARSE_TREE_MASK 0x0001 | ||
56 | |||
57 | #define ACPI_PARSE_LOAD_PASS1 0x0010 | ||
58 | #define ACPI_PARSE_LOAD_PASS2 0x0020 | ||
59 | #define ACPI_PARSE_EXECUTE 0x0030 | ||
60 | #define ACPI_PARSE_MODE_MASK 0x0030 | ||
61 | |||
62 | #define ACPI_PARSE_DEFERRED_OP 0x0100 | ||
63 | #define ACPI_PARSE_DISASSEMBLE 0x0200 | ||
64 | |||
65 | /****************************************************************************** | ||
66 | * | ||
67 | * Parser interfaces | ||
68 | * | ||
69 | *****************************************************************************/ | ||
70 | |||
71 | /* | ||
72 | * psxface - Parser external interfaces | ||
73 | */ | ||
74 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info); | ||
75 | |||
76 | /* | ||
77 | * psargs - Parse AML opcode arguments | ||
78 | */ | ||
79 | u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state); | ||
80 | |||
81 | char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state); | ||
82 | |||
83 | void | ||
84 | acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | ||
85 | u32 arg_type, union acpi_parse_object *arg); | ||
86 | |||
87 | acpi_status | ||
88 | acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | ||
89 | struct acpi_parse_state *parser_state, | ||
90 | union acpi_parse_object *arg, u8 method_call); | ||
91 | |||
92 | acpi_status | ||
93 | acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | ||
94 | struct acpi_parse_state *parser_state, | ||
95 | u32 arg_type, union acpi_parse_object **return_arg); | ||
96 | |||
97 | /* | ||
98 | * psfind | ||
99 | */ | ||
100 | union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope, | ||
101 | u32 name, u32 opcode); | ||
102 | |||
103 | union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op); | ||
104 | |||
105 | /* | ||
106 | * psopcode - AML Opcode information | ||
107 | */ | ||
108 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); | ||
109 | |||
110 | char *acpi_ps_get_opcode_name(u16 opcode); | ||
111 | |||
112 | u8 acpi_ps_get_argument_count(u32 op_type); | ||
113 | |||
114 | /* | ||
115 | * psparse - top level parsing routines | ||
116 | */ | ||
117 | acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state); | ||
118 | |||
119 | u32 acpi_ps_get_opcode_size(u32 opcode); | ||
120 | |||
121 | u16 acpi_ps_peek_opcode(struct acpi_parse_state *state); | ||
122 | |||
123 | acpi_status | ||
124 | acpi_ps_complete_this_op(struct acpi_walk_state *walk_state, | ||
125 | union acpi_parse_object *op); | ||
126 | |||
127 | acpi_status | ||
128 | acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | ||
129 | union acpi_parse_object *op, | ||
130 | acpi_status callback_status); | ||
131 | |||
132 | /* | ||
133 | * psloop - main parse loop | ||
134 | */ | ||
135 | acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state); | ||
136 | |||
137 | /* | ||
138 | * psscope - Scope stack management routines | ||
139 | */ | ||
140 | acpi_status | ||
141 | acpi_ps_init_scope(struct acpi_parse_state *parser_state, | ||
142 | union acpi_parse_object *root); | ||
143 | |||
144 | union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state | ||
145 | *state); | ||
146 | |||
147 | u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state); | ||
148 | |||
149 | void | ||
150 | acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | ||
151 | union acpi_parse_object **op, | ||
152 | u32 * arg_list, u32 * arg_count); | ||
153 | |||
154 | acpi_status | ||
155 | acpi_ps_push_scope(struct acpi_parse_state *parser_state, | ||
156 | union acpi_parse_object *op, | ||
157 | u32 remaining_args, u32 arg_count); | ||
158 | |||
159 | void acpi_ps_cleanup_scope(struct acpi_parse_state *state); | ||
160 | |||
161 | /* | ||
162 | * pstree - parse tree manipulation routines | ||
163 | */ | ||
164 | void | ||
165 | acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg); | ||
166 | |||
167 | union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope, | ||
168 | char *path, u16 opcode, u32 create); | ||
169 | |||
170 | union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn); | ||
171 | |||
172 | #ifdef ACPI_FUTURE_USAGE | ||
173 | union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, | ||
174 | union acpi_parse_object *op); | ||
175 | #endif /* ACPI_FUTURE_USAGE */ | ||
176 | |||
177 | /* | ||
178 | * pswalk - parse tree walk routines | ||
179 | */ | ||
180 | acpi_status | ||
181 | acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op, | ||
182 | union acpi_parse_object *end_op, | ||
183 | union acpi_operand_object *mth_desc, | ||
184 | struct acpi_namespace_node *start_node, | ||
185 | union acpi_operand_object **params, | ||
186 | union acpi_operand_object **caller_return_desc, | ||
187 | acpi_owner_id owner_id, | ||
188 | acpi_parse_downwards descending_callback, | ||
189 | acpi_parse_upwards ascending_callback); | ||
190 | |||
191 | acpi_status | ||
192 | acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state, | ||
193 | union acpi_parse_object *op, | ||
194 | acpi_parse_upwards ascending_callback); | ||
195 | |||
196 | acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state); | ||
197 | |||
198 | void acpi_ps_delete_parse_tree(union acpi_parse_object *root); | ||
199 | |||
200 | /* | ||
201 | * psutils - parser utilities | ||
202 | */ | ||
203 | union acpi_parse_object *acpi_ps_create_scope_op(void); | ||
204 | |||
205 | void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode); | ||
206 | |||
207 | union acpi_parse_object *acpi_ps_alloc_op(u16 opcode); | ||
208 | |||
209 | void acpi_ps_free_op(union acpi_parse_object *op); | ||
210 | |||
211 | u8 acpi_ps_is_leading_char(u32 c); | ||
212 | |||
213 | u8 acpi_ps_is_prefix_char(u32 c); | ||
214 | |||
215 | #ifdef ACPI_FUTURE_USAGE | ||
216 | u32 acpi_ps_get_name(union acpi_parse_object *op); | ||
217 | #endif /* ACPI_FUTURE_USAGE */ | ||
218 | |||
219 | void acpi_ps_set_name(union acpi_parse_object *op, u32 name); | ||
220 | |||
221 | /* | ||
222 | * psdump - display parser tree | ||
223 | */ | ||
224 | u32 | ||
225 | acpi_ps_sprint_path(char *buffer_start, | ||
226 | u32 buffer_size, union acpi_parse_object *op); | ||
227 | |||
228 | u32 | ||
229 | acpi_ps_sprint_op(char *buffer_start, | ||
230 | u32 buffer_size, union acpi_parse_object *op); | ||
231 | |||
232 | void acpi_ps_show(union acpi_parse_object *op); | ||
233 | |||
234 | #endif /* __ACPARSER_H__ */ | ||
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h new file mode 100644 index 000000000000..16a9ca9a66e4 --- /dev/null +++ b/drivers/acpi/acpica/acpredef.h | |||
@@ -0,0 +1,371 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acpredef - Information table for ACPI predefined methods and objects | ||
4 | * $Revision: 1.1 $ | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #ifndef __ACPREDEF_H__ | ||
46 | #define __ACPREDEF_H__ | ||
47 | |||
48 | /****************************************************************************** | ||
49 | * | ||
50 | * Return Package types | ||
51 | * | ||
52 | * 1) PTYPE1 packages do not contain sub-packages. | ||
53 | * | ||
54 | * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: | ||
55 | * object type | ||
56 | * count | ||
57 | * object type | ||
58 | * count | ||
59 | * | ||
60 | * ACPI_PTYPE1_VAR: Variable length: | ||
61 | * object type (Int/Buf/Ref) | ||
62 | * | ||
63 | * ACPI_PTYPE1_OPTION: Package has some required and some optional elements: | ||
64 | * Used for _PRW | ||
65 | * | ||
66 | * | ||
67 | * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the | ||
68 | * different types describe the contents of each of the sub-packages. | ||
69 | * | ||
70 | * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: | ||
71 | * object type | ||
72 | * count | ||
73 | * object type | ||
74 | * count | ||
75 | * | ||
76 | * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: | ||
77 | * object type | ||
78 | * | ||
79 | * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: | ||
80 | * object type | ||
81 | * count | ||
82 | * object type | ||
83 | * count | ||
84 | * | ||
85 | * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length: | ||
86 | * Used for _PRT | ||
87 | * | ||
88 | * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length | ||
89 | * Used for _HPX | ||
90 | * | ||
91 | *****************************************************************************/ | ||
92 | |||
93 | enum acpi_return_package_types { | ||
94 | ACPI_PTYPE1_FIXED = 1, | ||
95 | ACPI_PTYPE1_VAR = 2, | ||
96 | ACPI_PTYPE1_OPTION = 3, | ||
97 | ACPI_PTYPE2 = 4, | ||
98 | ACPI_PTYPE2_COUNT = 5, | ||
99 | ACPI_PTYPE2_PKG_COUNT = 6, | ||
100 | ACPI_PTYPE2_FIXED = 7, | ||
101 | ACPI_PTYPE2_MIN = 8 | ||
102 | }; | ||
103 | |||
104 | /* | ||
105 | * Predefined method/object information table. | ||
106 | * | ||
107 | * These are the names that can actually be evaluated via acpi_evaluate_object. | ||
108 | * Not present in this table are the following: | ||
109 | * | ||
110 | * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object: | ||
111 | * _Lxx and _Exx GPE methods | ||
112 | * _Qxx EC methods | ||
113 | * _T_x compiler temporary variables | ||
114 | * | ||
115 | * 2) Predefined names that never actually exist within the AML code: | ||
116 | * Predefined resource descriptor field names | ||
117 | * | ||
118 | * 3) Predefined names that are implemented within ACPICA: | ||
119 | * _OSI | ||
120 | * | ||
121 | * 4) Some predefined names that are not documented within the ACPI spec. | ||
122 | * _WDG, _WED | ||
123 | * | ||
124 | * The main entries in the table each contain the following items: | ||
125 | * | ||
126 | * Name - The ACPI reserved name | ||
127 | * param_count - Number of arguments to the method | ||
128 | * expected_btypes - Allowed type(s) for the return value. | ||
129 | * 0 means that no return value is expected. | ||
130 | * | ||
131 | * For methods that return packages, the next entry in the table contains | ||
132 | * information about the expected structure of the package. This information | ||
133 | * is saved here (rather than in a separate table) in order to minimize the | ||
134 | * overall size of the stored data. | ||
135 | */ | ||
136 | static const union acpi_predefined_info predefined_names[] = { | ||
137 | {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}}, | ||
138 | {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}}, | ||
139 | {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}}, | ||
140 | {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}}, | ||
141 | {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}}, | ||
142 | {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}}, | ||
143 | {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}}, | ||
144 | {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}}, | ||
145 | {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}}, | ||
146 | {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}}, | ||
147 | {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}}, | ||
148 | {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
149 | {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
150 | {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
151 | {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
152 | {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
153 | {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
154 | {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
155 | {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
156 | {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
157 | {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
158 | {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}}, | ||
159 | {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}}, | ||
160 | {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}}, | ||
161 | {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */ | ||
162 | {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}}, | ||
163 | {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}}, | ||
164 | {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
165 | {.info = {"_BCM", 1, 0}}, | ||
166 | {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}}, | ||
167 | {.info = {"_BFS", 1, 0}}, | ||
168 | {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, | ||
169 | 9, | ||
170 | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */ | ||
171 | {.info = {"_BLT", 3, 0}}, | ||
172 | {.info = {"_BMC", 1, 0}}, | ||
173 | {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */ | ||
174 | {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}}, | ||
175 | {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
176 | {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}}, | ||
177 | {.info = {"_BTP", 1, 0}}, | ||
178 | {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */ | ||
179 | {.info = {"_CID", 0, | ||
180 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, | ||
181 | {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */ | ||
182 | {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}}, | ||
183 | {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}}, | ||
184 | {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */ | ||
185 | {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT, | ||
186 | ACPI_RTYPE_BUFFER, 1, | ||
187 | ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */ | ||
188 | {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}}, | ||
189 | {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}}, | ||
190 | {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, | ||
191 | {.info = {"_DDN", 0, ACPI_RTYPE_STRING}}, | ||
192 | {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}}, | ||
193 | {.info = {"_DIS", 0, 0}}, | ||
194 | {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}}, | ||
195 | {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
196 | {.info = {"_DOS", 1, 0}}, | ||
197 | {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ | ||
198 | {.info = {"_DSS", 1, 0}}, | ||
199 | {.info = {"_DSW", 3, 0}}, | ||
200 | {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}}, | ||
201 | {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
202 | {.info = {"_EJ0", 1, 0}}, | ||
203 | {.info = {"_EJ1", 1, 0}}, | ||
204 | {.info = {"_EJ2", 1, 0}}, | ||
205 | {.info = {"_EJ3", 1, 0}}, | ||
206 | {.info = {"_EJ4", 1, 0}}, | ||
207 | {.info = {"_EJD", 0, ACPI_RTYPE_STRING}}, | ||
208 | {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}}, | ||
209 | {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */ | ||
210 | {.info = {"_FDM", 1, 0}}, | ||
211 | {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ | ||
212 | {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}}, | ||
213 | {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}}, | ||
214 | {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ | ||
215 | {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}}, | ||
216 | {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}}, | ||
217 | {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}}, | ||
218 | {.info = {"_GTS", 1, 0}}, | ||
219 | {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | ||
220 | {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}}, | ||
221 | {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
222 | |||
223 | /* | ||
224 | * For _HPX, a single package is returned, containing a variable number of sub-packages. | ||
225 | * Each sub-package contains a PCI record setting. There are several different type of | ||
226 | * record settings, of different lengths, but all elements of all settings are Integers. | ||
227 | */ | ||
228 | {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */ | ||
229 | {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ | ||
230 | {.info = {"_INI", 0, 0}}, | ||
231 | {.info = {"_IRC", 0, 0}}, | ||
232 | {.info = {"_LCK", 1, 0}}, | ||
233 | {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}}, | ||
234 | {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}}, | ||
235 | {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */ | ||
236 | {.info = {"_MSG", 1, 0}}, | ||
237 | {.info = {"_OFF", 0, 0}}, | ||
238 | {.info = {"_ON_", 0, 0}}, | ||
239 | {.info = {"_OS_", 0, ACPI_RTYPE_STRING}}, | ||
240 | {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}}, | ||
241 | {.info = {"_OST", 3, 0}}, | ||
242 | {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
243 | {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ | ||
244 | {.info = {"_PDC", 1, 0}}, | ||
245 | {.info = {"_PIC", 1, 0}}, | ||
246 | {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */ | ||
247 | {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}}, | ||
248 | {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */ | ||
249 | {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
250 | {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
251 | {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
252 | {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}}, | ||
253 | |||
254 | /* | ||
255 | * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there | ||
256 | * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow | ||
257 | * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE | ||
258 | * type to the 2nd element (index 1) in the statement below. | ||
259 | */ | ||
260 | {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4, | ||
261 | ACPI_RTYPE_INTEGER, | ||
262 | ACPI_RTYPE_INTEGER, | ||
263 | ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */ | ||
264 | |||
265 | {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2, | ||
266 | ACPI_RTYPE_INTEGER | | ||
267 | ACPI_RTYPE_PACKAGE, | ||
268 | ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */ | ||
269 | |||
270 | {.info = {"_PS0", 0, 0}}, | ||
271 | {.info = {"_PS1", 0, 0}}, | ||
272 | {.info = {"_PS2", 0, 0}}, | ||
273 | {.info = {"_PS3", 0, 0}}, | ||
274 | {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}}, | ||
275 | {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */ | ||
276 | {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
277 | {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}}, | ||
278 | {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */ | ||
279 | {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}}, | ||
280 | {.info = {"_PSW", 1, 0}}, | ||
281 | {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ | ||
282 | {.info = {"_PTS", 1, 0}}, | ||
283 | {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}}, | ||
284 | {.info = {"_REG", 2, 0}}, | ||
285 | {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}}, | ||
286 | {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}}, | ||
287 | {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}}, | ||
288 | {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}}, | ||
289 | |||
290 | /* | ||
291 | * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer, | ||
292 | * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length", | ||
293 | * but all elements must be Integers. | ||
294 | */ | ||
295 | {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
296 | {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
297 | {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
298 | {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
299 | {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
300 | {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ | ||
301 | |||
302 | {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}}, | ||
303 | {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}}, | ||
304 | {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}}, | ||
305 | {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}}, | ||
306 | {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}}, | ||
307 | {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}}, | ||
308 | {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}}, | ||
309 | {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}}, | ||
310 | {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}}, | ||
311 | {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}}, | ||
312 | {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ | ||
313 | /* Note: the 3-arg definition may be removed for ACPI 4.0 */ | ||
314 | {.info = {"_SDD", 1, 0}}, | ||
315 | {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}}, | ||
316 | {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}}, | ||
317 | {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}}, | ||
318 | {.info = {"_SRS", 1, 0}}, | ||
319 | {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ | ||
320 | {.info = {"_SST", 1, 0}}, | ||
321 | {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}}, | ||
322 | {.info = {"_STM", 3, 0}}, | ||
323 | {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}}, | ||
324 | {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}}, | ||
325 | {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}}, | ||
326 | {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}}, | ||
327 | {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}}, | ||
328 | {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}}, | ||
329 | {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}}, | ||
330 | {.info = {"_TPT", 1, 0}}, | ||
331 | {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, | ||
332 | ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */ | ||
333 | {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */ | ||
334 | {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}}, | ||
335 | {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */ | ||
336 | {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}}, | ||
337 | {.info = {"_TTS", 1, 0}}, | ||
338 | {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ | ||
339 | {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}}, | ||
340 | {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}}, | ||
341 | {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, | ||
342 | {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ | ||
343 | {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}}, | ||
344 | {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}}, | ||
345 | {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}}, | ||
346 | |||
347 | /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ | ||
348 | |||
349 | {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, | ||
350 | {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */ | ||
351 | {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */ | ||
352 | }; | ||
353 | |||
354 | #if 0 | ||
355 | /* Not implemented */ | ||
356 | |||
357 | { | ||
358 | "_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */ | ||
359 | |||
360 | { | ||
361 | "_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */ | ||
362 | |||
363 | /* This is an internally implemented control method, no need to check */ | ||
364 | { | ||
365 | "_OSI", 1, ACPI_RTYPE_INTEGER}, | ||
366 | |||
367 | /* TBD: */ | ||
368 | _PRT - currently ignore reversed entries.attempt to fix here ? | ||
369 | think about code that attempts to fix package elements like _BIF, etc. | ||
370 | #endif | ||
371 | #endif | ||
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h new file mode 100644 index 000000000000..eef5bd7a59fa --- /dev/null +++ b/drivers/acpi/acpica/acresrc.h | |||
@@ -0,0 +1,336 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acresrc.h - Resource Manager function prototypes | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACRESRC_H__ | ||
45 | #define __ACRESRC_H__ | ||
46 | |||
47 | /* Need the AML resource descriptor structs */ | ||
48 | |||
49 | #include "amlresrc.h" | ||
50 | |||
51 | /* | ||
52 | * If possible, pack the following structures to byte alignment, since we | ||
53 | * don't care about performance for debug output. Two cases where we cannot | ||
54 | * pack the structures: | ||
55 | * | ||
56 | * 1) Hardware does not support misaligned memory transfers | ||
57 | * 2) Compiler does not support pointers within packed structures | ||
58 | */ | ||
59 | #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) | ||
60 | #pragma pack(1) | ||
61 | #endif | ||
62 | |||
63 | /* | ||
64 | * Individual entry for the resource conversion tables | ||
65 | */ | ||
66 | typedef const struct acpi_rsconvert_info { | ||
67 | u8 opcode; | ||
68 | u8 resource_offset; | ||
69 | u8 aml_offset; | ||
70 | u8 value; | ||
71 | |||
72 | } acpi_rsconvert_info; | ||
73 | |||
74 | /* Resource conversion opcodes */ | ||
75 | |||
76 | #define ACPI_RSC_INITGET 0 | ||
77 | #define ACPI_RSC_INITSET 1 | ||
78 | #define ACPI_RSC_FLAGINIT 2 | ||
79 | #define ACPI_RSC_1BITFLAG 3 | ||
80 | #define ACPI_RSC_2BITFLAG 4 | ||
81 | #define ACPI_RSC_COUNT 5 | ||
82 | #define ACPI_RSC_COUNT16 6 | ||
83 | #define ACPI_RSC_LENGTH 7 | ||
84 | #define ACPI_RSC_MOVE8 8 | ||
85 | #define ACPI_RSC_MOVE16 9 | ||
86 | #define ACPI_RSC_MOVE32 10 | ||
87 | #define ACPI_RSC_MOVE64 11 | ||
88 | #define ACPI_RSC_SET8 12 | ||
89 | #define ACPI_RSC_DATA8 13 | ||
90 | #define ACPI_RSC_ADDRESS 14 | ||
91 | #define ACPI_RSC_SOURCE 15 | ||
92 | #define ACPI_RSC_SOURCEX 16 | ||
93 | #define ACPI_RSC_BITMASK 17 | ||
94 | #define ACPI_RSC_BITMASK16 18 | ||
95 | #define ACPI_RSC_EXIT_NE 19 | ||
96 | #define ACPI_RSC_EXIT_LE 20 | ||
97 | #define ACPI_RSC_EXIT_EQ 21 | ||
98 | |||
99 | /* Resource Conversion sub-opcodes */ | ||
100 | |||
101 | #define ACPI_RSC_COMPARE_AML_LENGTH 0 | ||
102 | #define ACPI_RSC_COMPARE_VALUE 1 | ||
103 | |||
104 | #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) | ||
105 | |||
106 | #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) | ||
107 | #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) | ||
108 | |||
109 | typedef const struct acpi_rsdump_info { | ||
110 | u8 opcode; | ||
111 | u8 offset; | ||
112 | char *name; | ||
113 | const char **pointer; | ||
114 | |||
115 | } acpi_rsdump_info; | ||
116 | |||
117 | /* Values for the Opcode field above */ | ||
118 | |||
119 | #define ACPI_RSD_TITLE 0 | ||
120 | #define ACPI_RSD_LITERAL 1 | ||
121 | #define ACPI_RSD_STRING 2 | ||
122 | #define ACPI_RSD_UINT8 3 | ||
123 | #define ACPI_RSD_UINT16 4 | ||
124 | #define ACPI_RSD_UINT32 5 | ||
125 | #define ACPI_RSD_UINT64 6 | ||
126 | #define ACPI_RSD_1BITFLAG 7 | ||
127 | #define ACPI_RSD_2BITFLAG 8 | ||
128 | #define ACPI_RSD_SHORTLIST 9 | ||
129 | #define ACPI_RSD_LONGLIST 10 | ||
130 | #define ACPI_RSD_DWORDLIST 11 | ||
131 | #define ACPI_RSD_ADDRESS 12 | ||
132 | #define ACPI_RSD_SOURCE 13 | ||
133 | |||
134 | /* restore default alignment */ | ||
135 | |||
136 | #pragma pack() | ||
137 | |||
138 | /* Resource tables indexed by internal resource type */ | ||
139 | |||
140 | extern const u8 acpi_gbl_aml_resource_sizes[]; | ||
141 | extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; | ||
142 | |||
143 | /* Resource tables indexed by raw AML resource descriptor type */ | ||
144 | |||
145 | extern const u8 acpi_gbl_resource_struct_sizes[]; | ||
146 | extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; | ||
147 | |||
148 | struct acpi_vendor_walk_info { | ||
149 | struct acpi_vendor_uuid *uuid; | ||
150 | struct acpi_buffer *buffer; | ||
151 | acpi_status status; | ||
152 | }; | ||
153 | |||
154 | /* | ||
155 | * rscreate | ||
156 | */ | ||
157 | acpi_status | ||
158 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | ||
159 | struct acpi_buffer *output_buffer); | ||
160 | |||
161 | acpi_status | ||
162 | acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | ||
163 | struct acpi_buffer *output_buffer); | ||
164 | |||
165 | acpi_status | ||
166 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | ||
167 | struct acpi_buffer *output_buffer); | ||
168 | |||
169 | /* | ||
170 | * rsutils | ||
171 | */ | ||
172 | |||
173 | acpi_status | ||
174 | acpi_rs_get_prt_method_data(struct acpi_namespace_node *node, | ||
175 | struct acpi_buffer *ret_buffer); | ||
176 | |||
177 | acpi_status | ||
178 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, | ||
179 | struct acpi_buffer *ret_buffer); | ||
180 | |||
181 | acpi_status | ||
182 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, | ||
183 | struct acpi_buffer *ret_buffer); | ||
184 | |||
185 | acpi_status | ||
186 | acpi_rs_get_method_data(acpi_handle handle, | ||
187 | char *path, struct acpi_buffer *ret_buffer); | ||
188 | |||
189 | acpi_status | ||
190 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, | ||
191 | struct acpi_buffer *ret_buffer); | ||
192 | |||
193 | /* | ||
194 | * rscalc | ||
195 | */ | ||
196 | acpi_status | ||
197 | acpi_rs_get_list_length(u8 * aml_buffer, | ||
198 | u32 aml_buffer_length, acpi_size * size_needed); | ||
199 | |||
200 | acpi_status | ||
201 | acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, | ||
202 | acpi_size * size_needed); | ||
203 | |||
204 | acpi_status | ||
205 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | ||
206 | acpi_size * buffer_size_needed); | ||
207 | |||
208 | acpi_status | ||
209 | acpi_rs_convert_aml_to_resources(u8 * aml, | ||
210 | u32 length, | ||
211 | u32 offset, u8 resource_index, void **context); | ||
212 | |||
213 | acpi_status | ||
214 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | ||
215 | acpi_size aml_size_needed, u8 * output_buffer); | ||
216 | |||
217 | /* | ||
218 | * rsaddr | ||
219 | */ | ||
220 | void | ||
221 | acpi_rs_set_address_common(union aml_resource *aml, | ||
222 | struct acpi_resource *resource); | ||
223 | |||
224 | u8 | ||
225 | acpi_rs_get_address_common(struct acpi_resource *resource, | ||
226 | union aml_resource *aml); | ||
227 | |||
228 | /* | ||
229 | * rsmisc | ||
230 | */ | ||
231 | acpi_status | ||
232 | acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | ||
233 | union aml_resource *aml, | ||
234 | struct acpi_rsconvert_info *info); | ||
235 | |||
236 | acpi_status | ||
237 | acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | ||
238 | union aml_resource *aml, | ||
239 | struct acpi_rsconvert_info *info); | ||
240 | |||
241 | /* | ||
242 | * rsutils | ||
243 | */ | ||
244 | void | ||
245 | acpi_rs_move_data(void *destination, | ||
246 | void *source, u16 item_count, u8 move_type); | ||
247 | |||
248 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); | ||
249 | |||
250 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count); | ||
251 | |||
252 | acpi_rs_length | ||
253 | acpi_rs_get_resource_source(acpi_rs_length resource_length, | ||
254 | acpi_rs_length minimum_length, | ||
255 | struct acpi_resource_source *resource_source, | ||
256 | union aml_resource *aml, char *string_ptr); | ||
257 | |||
258 | acpi_rsdesc_size | ||
259 | acpi_rs_set_resource_source(union aml_resource *aml, | ||
260 | acpi_rs_length minimum_length, | ||
261 | struct acpi_resource_source *resource_source); | ||
262 | |||
263 | void | ||
264 | acpi_rs_set_resource_header(u8 descriptor_type, | ||
265 | acpi_rsdesc_size total_length, | ||
266 | union aml_resource *aml); | ||
267 | |||
268 | void | ||
269 | acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | ||
270 | union aml_resource *aml); | ||
271 | |||
272 | /* | ||
273 | * rsdump | ||
274 | */ | ||
275 | void acpi_rs_dump_resource_list(struct acpi_resource *resource); | ||
276 | |||
277 | void acpi_rs_dump_irq_list(u8 * route_table); | ||
278 | |||
279 | /* | ||
280 | * Resource conversion tables | ||
281 | */ | ||
282 | extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; | ||
283 | extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; | ||
284 | extern struct acpi_rsconvert_info acpi_rs_convert_io[]; | ||
285 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; | ||
286 | extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; | ||
287 | extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; | ||
288 | extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; | ||
289 | extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; | ||
290 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; | ||
291 | extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; | ||
292 | extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; | ||
293 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; | ||
294 | extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; | ||
295 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; | ||
296 | |||
297 | /* These resources require separate get/set tables */ | ||
298 | |||
299 | extern struct acpi_rsconvert_info acpi_rs_get_irq[]; | ||
300 | extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; | ||
301 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; | ||
302 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; | ||
303 | |||
304 | extern struct acpi_rsconvert_info acpi_rs_set_irq[]; | ||
305 | extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; | ||
306 | extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; | ||
307 | |||
308 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
309 | /* | ||
310 | * rsinfo | ||
311 | */ | ||
312 | extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; | ||
313 | |||
314 | /* | ||
315 | * rsdump | ||
316 | */ | ||
317 | extern struct acpi_rsdump_info acpi_rs_dump_irq[]; | ||
318 | extern struct acpi_rsdump_info acpi_rs_dump_dma[]; | ||
319 | extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; | ||
320 | extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; | ||
321 | extern struct acpi_rsdump_info acpi_rs_dump_io[]; | ||
322 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; | ||
323 | extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; | ||
324 | extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; | ||
325 | extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; | ||
326 | extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; | ||
327 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; | ||
328 | extern struct acpi_rsdump_info acpi_rs_dump_address16[]; | ||
329 | extern struct acpi_rsdump_info acpi_rs_dump_address32[]; | ||
330 | extern struct acpi_rsdump_info acpi_rs_dump_address64[]; | ||
331 | extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; | ||
332 | extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; | ||
333 | extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; | ||
334 | #endif | ||
335 | |||
336 | #endif /* __ACRESRC_H__ */ | ||
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h new file mode 100644 index 000000000000..7980a26bad35 --- /dev/null +++ b/drivers/acpi/acpica/acstruct.h | |||
@@ -0,0 +1,228 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acstruct.h - Internal structs | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACSTRUCT_H__ | ||
45 | #define __ACSTRUCT_H__ | ||
46 | |||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
49 | /***************************************************************************** | ||
50 | * | ||
51 | * Tree walking typedefs and structs | ||
52 | * | ||
53 | ****************************************************************************/ | ||
54 | |||
55 | /* | ||
56 | * Walk state - current state of a parse tree walk. Used for both a leisurely | ||
57 | * stroll through the tree (for whatever reason), and for control method | ||
58 | * execution. | ||
59 | */ | ||
60 | #define ACPI_NEXT_OP_DOWNWARD 1 | ||
61 | #define ACPI_NEXT_OP_UPWARD 2 | ||
62 | |||
63 | /* | ||
64 | * Groups of definitions for walk_type used for different implementations of | ||
65 | * walkers (never simultaneously) - flags for interpreter: | ||
66 | */ | ||
67 | #define ACPI_WALK_NON_METHOD 0 | ||
68 | #define ACPI_WALK_METHOD 0x01 | ||
69 | #define ACPI_WALK_METHOD_RESTART 0x02 | ||
70 | |||
71 | /* Flags for i_aSL compiler only */ | ||
72 | |||
73 | #define ACPI_WALK_CONST_REQUIRED 0x10 | ||
74 | #define ACPI_WALK_CONST_OPTIONAL 0x20 | ||
75 | |||
76 | struct acpi_walk_state { | ||
77 | struct acpi_walk_state *next; /* Next walk_state in list */ | ||
78 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
79 | u8 walk_type; | ||
80 | u16 opcode; /* Current AML opcode */ | ||
81 | u8 next_op_info; /* Info about next_op */ | ||
82 | u8 num_operands; /* Stack pointer for Operands[] array */ | ||
83 | u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */ | ||
84 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | ||
85 | u8 last_predicate; /* Result of last predicate */ | ||
86 | u8 current_result; | ||
87 | u8 return_used; | ||
88 | u8 scope_depth; | ||
89 | u8 pass_number; /* Parse pass during table load */ | ||
90 | u8 result_size; /* Total elements for the result stack */ | ||
91 | u8 result_count; /* Current number of occupied elements of result stack */ | ||
92 | u32 aml_offset; | ||
93 | u32 arg_types; | ||
94 | u32 method_breakpoint; /* For single stepping */ | ||
95 | u32 user_breakpoint; /* User AML breakpoint */ | ||
96 | u32 parse_flags; | ||
97 | |||
98 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
99 | u32 prev_arg_types; | ||
100 | u32 arg_count; /* push for fixed or var args */ | ||
101 | |||
102 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ | ||
103 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
104 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
105 | union acpi_operand_object **params; | ||
106 | |||
107 | u8 *aml_last_while; | ||
108 | union acpi_operand_object **caller_return_desc; | ||
109 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ | ||
110 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ | ||
111 | union acpi_operand_object *implicit_return_obj; | ||
112 | struct acpi_namespace_node *method_call_node; /* Called method Node */ | ||
113 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ | ||
114 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ | ||
115 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ | ||
116 | union acpi_parse_object *op; /* Current parser op */ | ||
117 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ | ||
118 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ | ||
119 | union acpi_operand_object *result_obj; | ||
120 | union acpi_generic_state *results; /* Stack of accumulated results */ | ||
121 | union acpi_operand_object *return_desc; /* Return object, if any */ | ||
122 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ | ||
123 | union acpi_parse_object *prev_op; /* Last op that was processed */ | ||
124 | union acpi_parse_object *next_op; /* next op to be processed */ | ||
125 | struct acpi_thread_state *thread; | ||
126 | acpi_parse_downwards descending_callback; | ||
127 | acpi_parse_upwards ascending_callback; | ||
128 | }; | ||
129 | |||
130 | /* Info used by acpi_ps_init_objects */ | ||
131 | |||
132 | struct acpi_init_walk_info { | ||
133 | u16 method_count; | ||
134 | u16 device_count; | ||
135 | u16 op_region_count; | ||
136 | u16 field_count; | ||
137 | u16 buffer_count; | ||
138 | u16 package_count; | ||
139 | u16 op_region_init; | ||
140 | u16 field_init; | ||
141 | u16 buffer_init; | ||
142 | u16 package_init; | ||
143 | u16 object_count; | ||
144 | acpi_owner_id owner_id; | ||
145 | u32 table_index; | ||
146 | }; | ||
147 | |||
148 | struct acpi_get_devices_info { | ||
149 | acpi_walk_callback user_function; | ||
150 | void *context; | ||
151 | const char *hid; | ||
152 | }; | ||
153 | |||
154 | union acpi_aml_operands { | ||
155 | union acpi_operand_object *operands[7]; | ||
156 | |||
157 | struct { | ||
158 | struct acpi_object_integer *type; | ||
159 | struct acpi_object_integer *code; | ||
160 | struct acpi_object_integer *argument; | ||
161 | |||
162 | } fatal; | ||
163 | |||
164 | struct { | ||
165 | union acpi_operand_object *source; | ||
166 | struct acpi_object_integer *index; | ||
167 | union acpi_operand_object *target; | ||
168 | |||
169 | } index; | ||
170 | |||
171 | struct { | ||
172 | union acpi_operand_object *source; | ||
173 | struct acpi_object_integer *index; | ||
174 | struct acpi_object_integer *length; | ||
175 | union acpi_operand_object *target; | ||
176 | |||
177 | } mid; | ||
178 | }; | ||
179 | |||
180 | /* | ||
181 | * Structure used to pass object evaluation parameters. | ||
182 | * Purpose is to reduce CPU stack use. | ||
183 | */ | ||
184 | struct acpi_evaluate_info { | ||
185 | struct acpi_namespace_node *prefix_node; | ||
186 | char *pathname; | ||
187 | union acpi_operand_object *obj_desc; | ||
188 | union acpi_operand_object **parameters; | ||
189 | struct acpi_namespace_node *resolved_node; | ||
190 | union acpi_operand_object *return_object; | ||
191 | u8 param_count; | ||
192 | u8 pass_number; | ||
193 | u8 return_object_type; | ||
194 | u8 flags; | ||
195 | }; | ||
196 | |||
197 | /* Values for Flags above */ | ||
198 | |||
199 | #define ACPI_IGNORE_RETURN_VALUE 1 | ||
200 | |||
201 | /* Info used by acpi_ns_initialize_devices */ | ||
202 | |||
203 | struct acpi_device_walk_info { | ||
204 | u16 device_count; | ||
205 | u16 num_STA; | ||
206 | u16 num_INI; | ||
207 | struct acpi_table_desc *table_desc; | ||
208 | struct acpi_evaluate_info *evaluate_info; | ||
209 | }; | ||
210 | |||
211 | /* TBD: [Restructure] Merge with struct above */ | ||
212 | |||
213 | struct acpi_walk_info { | ||
214 | u32 debug_level; | ||
215 | u32 count; | ||
216 | acpi_owner_id owner_id; | ||
217 | u8 display_type; | ||
218 | }; | ||
219 | |||
220 | /* Display Types */ | ||
221 | |||
222 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | ||
223 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | ||
224 | #define ACPI_DISPLAY_MASK (u8) 1 | ||
225 | |||
226 | #define ACPI_DISPLAY_SHORT (u8) 2 | ||
227 | |||
228 | #endif | ||
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h new file mode 100644 index 000000000000..7ce6e33c7f78 --- /dev/null +++ b/drivers/acpi/acpica/actables.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: actables.h - ACPI table management | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef __ACTABLES_H__ | ||
45 | #define __ACTABLES_H__ | ||
46 | |||
47 | acpi_status acpi_allocate_root_table(u32 initial_table_count); | ||
48 | |||
49 | /* | ||
50 | * tbfadt - FADT parse/convert/validate | ||
51 | */ | ||
52 | void acpi_tb_parse_fadt(u32 table_index, u8 flags); | ||
53 | |||
54 | void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length); | ||
55 | |||
56 | /* | ||
57 | * tbfind - find ACPI table | ||
58 | */ | ||
59 | acpi_status | ||
60 | acpi_tb_find_table(char *signature, | ||
61 | char *oem_id, char *oem_table_id, u32 *table_index); | ||
62 | |||
63 | /* | ||
64 | * tbinstal - Table removal and deletion | ||
65 | */ | ||
66 | acpi_status acpi_tb_resize_root_table_list(void); | ||
67 | |||
68 | acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc); | ||
69 | |||
70 | acpi_status | ||
71 | acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index); | ||
72 | |||
73 | acpi_status | ||
74 | acpi_tb_store_table(acpi_physical_address address, | ||
75 | struct acpi_table_header *table, | ||
76 | u32 length, u8 flags, u32 *table_index); | ||
77 | |||
78 | void acpi_tb_delete_table(struct acpi_table_desc *table_desc); | ||
79 | |||
80 | void acpi_tb_terminate(void); | ||
81 | |||
82 | void acpi_tb_delete_namespace_by_owner(u32 table_index); | ||
83 | |||
84 | acpi_status acpi_tb_allocate_owner_id(u32 table_index); | ||
85 | |||
86 | acpi_status acpi_tb_release_owner_id(u32 table_index); | ||
87 | |||
88 | acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id); | ||
89 | |||
90 | u8 acpi_tb_is_table_loaded(u32 table_index); | ||
91 | |||
92 | void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded); | ||
93 | |||
94 | /* | ||
95 | * tbutils - table manager utilities | ||
96 | */ | ||
97 | acpi_status acpi_tb_initialize_facs(void); | ||
98 | |||
99 | u8 acpi_tb_tables_loaded(void); | ||
100 | |||
101 | void | ||
102 | acpi_tb_print_table_header(acpi_physical_address address, | ||
103 | struct acpi_table_header *header); | ||
104 | |||
105 | u8 acpi_tb_checksum(u8 *buffer, u32 length); | ||
106 | |||
107 | acpi_status | ||
108 | acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length); | ||
109 | |||
110 | void | ||
111 | acpi_tb_install_table(acpi_physical_address address, | ||
112 | u8 flags, char *signature, u32 table_index); | ||
113 | |||
114 | acpi_status | ||
115 | acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags); | ||
116 | |||
117 | #endif /* __ACTABLES_H__ */ | ||
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h new file mode 100644 index 000000000000..80d8813484fe --- /dev/null +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -0,0 +1,549 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #ifndef _ACUTILS_H | ||
45 | #define _ACUTILS_H | ||
46 | |||
47 | extern const u8 acpi_gbl_resource_aml_sizes[]; | ||
48 | |||
49 | /* Strings used by the disassembler and debugger resource dump routines */ | ||
50 | |||
51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | ||
52 | |||
53 | extern const char *acpi_gbl_bm_decode[]; | ||
54 | extern const char *acpi_gbl_config_decode[]; | ||
55 | extern const char *acpi_gbl_consume_decode[]; | ||
56 | extern const char *acpi_gbl_dec_decode[]; | ||
57 | extern const char *acpi_gbl_he_decode[]; | ||
58 | extern const char *acpi_gbl_io_decode[]; | ||
59 | extern const char *acpi_gbl_ll_decode[]; | ||
60 | extern const char *acpi_gbl_max_decode[]; | ||
61 | extern const char *acpi_gbl_mem_decode[]; | ||
62 | extern const char *acpi_gbl_min_decode[]; | ||
63 | extern const char *acpi_gbl_mtp_decode[]; | ||
64 | extern const char *acpi_gbl_rng_decode[]; | ||
65 | extern const char *acpi_gbl_rw_decode[]; | ||
66 | extern const char *acpi_gbl_shr_decode[]; | ||
67 | extern const char *acpi_gbl_siz_decode[]; | ||
68 | extern const char *acpi_gbl_trs_decode[]; | ||
69 | extern const char *acpi_gbl_ttp_decode[]; | ||
70 | extern const char *acpi_gbl_typ_decode[]; | ||
71 | #endif | ||
72 | |||
73 | /* Types for Resource descriptor entries */ | ||
74 | |||
75 | #define ACPI_INVALID_RESOURCE 0 | ||
76 | #define ACPI_FIXED_LENGTH 1 | ||
77 | #define ACPI_VARIABLE_LENGTH 2 | ||
78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 | ||
79 | |||
80 | typedef | ||
81 | acpi_status(*acpi_walk_aml_callback) (u8 * aml, | ||
82 | u32 length, | ||
83 | u32 offset, | ||
84 | u8 resource_index, void **context); | ||
85 | |||
86 | typedef | ||
87 | acpi_status(*acpi_pkg_callback) (u8 object_type, | ||
88 | union acpi_operand_object * source_object, | ||
89 | union acpi_generic_state * state, | ||
90 | void *context); | ||
91 | |||
92 | struct acpi_pkg_info { | ||
93 | u8 *free_space; | ||
94 | acpi_size length; | ||
95 | u32 object_space; | ||
96 | u32 num_packages; | ||
97 | }; | ||
98 | |||
99 | #define REF_INCREMENT (u16) 0 | ||
100 | #define REF_DECREMENT (u16) 1 | ||
101 | #define REF_FORCE_DELETE (u16) 2 | ||
102 | |||
103 | /* acpi_ut_dump_buffer */ | ||
104 | |||
105 | #define DB_BYTE_DISPLAY 1 | ||
106 | #define DB_WORD_DISPLAY 2 | ||
107 | #define DB_DWORD_DISPLAY 4 | ||
108 | #define DB_QWORD_DISPLAY 8 | ||
109 | |||
110 | /* | ||
111 | * utglobal - Global data structures and procedures | ||
112 | */ | ||
113 | acpi_status acpi_ut_init_globals(void); | ||
114 | |||
115 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
116 | |||
117 | char *acpi_ut_get_mutex_name(u32 mutex_id); | ||
118 | |||
119 | const char *acpi_ut_get_notify_name(u32 notify_value); | ||
120 | |||
121 | #endif | ||
122 | |||
123 | char *acpi_ut_get_type_name(acpi_object_type type); | ||
124 | |||
125 | char *acpi_ut_get_node_name(void *object); | ||
126 | |||
127 | char *acpi_ut_get_descriptor_name(void *object); | ||
128 | |||
129 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object); | ||
130 | |||
131 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); | ||
132 | |||
133 | char *acpi_ut_get_region_name(u8 space_id); | ||
134 | |||
135 | char *acpi_ut_get_event_name(u32 event_id); | ||
136 | |||
137 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); | ||
138 | |||
139 | u8 acpi_ut_valid_object_type(acpi_object_type type); | ||
140 | |||
141 | /* | ||
142 | * utinit - miscellaneous initialization and shutdown | ||
143 | */ | ||
144 | acpi_status acpi_ut_hardware_initialize(void); | ||
145 | |||
146 | void acpi_ut_subsystem_shutdown(void); | ||
147 | |||
148 | /* | ||
149 | * utclib - Local implementations of C library functions | ||
150 | */ | ||
151 | #ifndef ACPI_USE_SYSTEM_CLIBRARY | ||
152 | |||
153 | acpi_size acpi_ut_strlen(const char *string); | ||
154 | |||
155 | char *acpi_ut_strcpy(char *dst_string, const char *src_string); | ||
156 | |||
157 | char *acpi_ut_strncpy(char *dst_string, | ||
158 | const char *src_string, acpi_size count); | ||
159 | |||
160 | int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count); | ||
161 | |||
162 | int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count); | ||
163 | |||
164 | int acpi_ut_strcmp(const char *string1, const char *string2); | ||
165 | |||
166 | char *acpi_ut_strcat(char *dst_string, const char *src_string); | ||
167 | |||
168 | char *acpi_ut_strncat(char *dst_string, | ||
169 | const char *src_string, acpi_size count); | ||
170 | |||
171 | u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base); | ||
172 | |||
173 | char *acpi_ut_strstr(char *string1, char *string2); | ||
174 | |||
175 | void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count); | ||
176 | |||
177 | void *acpi_ut_memset(void *dest, u8 value, acpi_size count); | ||
178 | |||
179 | int acpi_ut_to_upper(int c); | ||
180 | |||
181 | int acpi_ut_to_lower(int c); | ||
182 | |||
183 | extern const u8 _acpi_ctype[]; | ||
184 | |||
185 | #define _ACPI_XA 0x00 /* extra alphabetic - not supported */ | ||
186 | #define _ACPI_XS 0x40 /* extra space */ | ||
187 | #define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ | ||
188 | #define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ | ||
189 | #define _ACPI_DI 0x04 /* '0'-'9' */ | ||
190 | #define _ACPI_LO 0x02 /* 'a'-'z' */ | ||
191 | #define _ACPI_PU 0x10 /* punctuation */ | ||
192 | #define _ACPI_SP 0x08 /* space */ | ||
193 | #define _ACPI_UP 0x01 /* 'A'-'Z' */ | ||
194 | #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ | ||
195 | |||
196 | #define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) | ||
197 | #define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) | ||
198 | #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) | ||
199 | #define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) | ||
200 | #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) | ||
201 | #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) | ||
202 | #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) | ||
203 | |||
204 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | ||
205 | |||
206 | /* | ||
207 | * utcopy - Object construction and conversion interfaces | ||
208 | */ | ||
209 | acpi_status | ||
210 | acpi_ut_build_simple_object(union acpi_operand_object *obj, | ||
211 | union acpi_object *user_obj, | ||
212 | u8 * data_space, u32 * buffer_space_used); | ||
213 | |||
214 | acpi_status | ||
215 | acpi_ut_build_package_object(union acpi_operand_object *obj, | ||
216 | u8 * buffer, u32 * space_used); | ||
217 | |||
218 | acpi_status | ||
219 | acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj, | ||
220 | struct acpi_buffer *ret_buffer); | ||
221 | |||
222 | acpi_status | ||
223 | acpi_ut_copy_eobject_to_iobject(union acpi_object *obj, | ||
224 | union acpi_operand_object **internal_obj); | ||
225 | |||
226 | acpi_status | ||
227 | acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj, | ||
228 | union acpi_operand_object *dest_obj); | ||
229 | |||
230 | acpi_status | ||
231 | acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | ||
232 | union acpi_operand_object **dest_desc, | ||
233 | struct acpi_walk_state *walk_state); | ||
234 | |||
235 | /* | ||
236 | * utcreate - Object creation | ||
237 | */ | ||
238 | acpi_status | ||
239 | acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action); | ||
240 | |||
241 | /* | ||
242 | * utdebug - Debug interfaces | ||
243 | */ | ||
244 | void acpi_ut_init_stack_ptr_trace(void); | ||
245 | |||
246 | void acpi_ut_track_stack_ptr(void); | ||
247 | |||
248 | void | ||
249 | acpi_ut_trace(u32 line_number, | ||
250 | const char *function_name, | ||
251 | const char *module_name, u32 component_id); | ||
252 | |||
253 | void | ||
254 | acpi_ut_trace_ptr(u32 line_number, | ||
255 | const char *function_name, | ||
256 | const char *module_name, u32 component_id, void *pointer); | ||
257 | |||
258 | void | ||
259 | acpi_ut_trace_u32(u32 line_number, | ||
260 | const char *function_name, | ||
261 | const char *module_name, u32 component_id, u32 integer); | ||
262 | |||
263 | void | ||
264 | acpi_ut_trace_str(u32 line_number, | ||
265 | const char *function_name, | ||
266 | const char *module_name, u32 component_id, char *string); | ||
267 | |||
268 | void | ||
269 | acpi_ut_exit(u32 line_number, | ||
270 | const char *function_name, | ||
271 | const char *module_name, u32 component_id); | ||
272 | |||
273 | void | ||
274 | acpi_ut_status_exit(u32 line_number, | ||
275 | const char *function_name, | ||
276 | const char *module_name, | ||
277 | u32 component_id, acpi_status status); | ||
278 | |||
279 | void | ||
280 | acpi_ut_value_exit(u32 line_number, | ||
281 | const char *function_name, | ||
282 | const char *module_name, | ||
283 | u32 component_id, acpi_integer value); | ||
284 | |||
285 | void | ||
286 | acpi_ut_ptr_exit(u32 line_number, | ||
287 | const char *function_name, | ||
288 | const char *module_name, u32 component_id, u8 *ptr); | ||
289 | |||
290 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); | ||
291 | |||
292 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display); | ||
293 | |||
294 | void acpi_ut_report_error(char *module_name, u32 line_number); | ||
295 | |||
296 | void acpi_ut_report_info(char *module_name, u32 line_number); | ||
297 | |||
298 | void acpi_ut_report_warning(char *module_name, u32 line_number); | ||
299 | |||
300 | /* | ||
301 | * utdelete - Object deletion and reference counts | ||
302 | */ | ||
303 | void acpi_ut_add_reference(union acpi_operand_object *object); | ||
304 | |||
305 | void acpi_ut_remove_reference(union acpi_operand_object *object); | ||
306 | |||
307 | void acpi_ut_delete_internal_package_object(union acpi_operand_object *object); | ||
308 | |||
309 | void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object); | ||
310 | |||
311 | void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); | ||
312 | |||
313 | /* | ||
314 | * uteval - object evaluation | ||
315 | */ | ||
316 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | ||
317 | |||
318 | acpi_status | ||
319 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | ||
320 | char *path, | ||
321 | u32 expected_return_btypes, | ||
322 | union acpi_operand_object **return_desc); | ||
323 | |||
324 | acpi_status | ||
325 | acpi_ut_evaluate_numeric_object(char *object_name, | ||
326 | struct acpi_namespace_node *device_node, | ||
327 | acpi_integer * address); | ||
328 | |||
329 | acpi_status | ||
330 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | ||
331 | struct acpica_device_id *hid); | ||
332 | |||
333 | acpi_status | ||
334 | acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | ||
335 | struct acpi_compatible_id_list **return_cid_list); | ||
336 | |||
337 | acpi_status | ||
338 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, | ||
339 | u32 * status_flags); | ||
340 | |||
341 | acpi_status | ||
342 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | ||
343 | struct acpica_device_id *uid); | ||
344 | |||
345 | acpi_status | ||
346 | acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); | ||
347 | |||
348 | /* | ||
349 | * utobject - internal object create/delete/cache routines | ||
350 | */ | ||
351 | union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char | ||
352 | *module_name, | ||
353 | u32 line_number, | ||
354 | u32 component_id, | ||
355 | acpi_object_type | ||
356 | type); | ||
357 | |||
358 | void *acpi_ut_allocate_object_desc_dbg(const char *module_name, | ||
359 | u32 line_number, u32 component_id); | ||
360 | |||
361 | #define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t) | ||
362 | #define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT) | ||
363 | |||
364 | void acpi_ut_delete_object_desc(union acpi_operand_object *object); | ||
365 | |||
366 | u8 acpi_ut_valid_internal_object(void *object); | ||
367 | |||
368 | union acpi_operand_object *acpi_ut_create_package_object(u32 count); | ||
369 | |||
370 | union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); | ||
371 | |||
372 | union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); | ||
373 | |||
374 | acpi_status | ||
375 | acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); | ||
376 | |||
377 | /* | ||
378 | * utstate - Generic state creation/cache routines | ||
379 | */ | ||
380 | void | ||
381 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, | ||
382 | union acpi_generic_state *state); | ||
383 | |||
384 | union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | ||
385 | **list_head); | ||
386 | |||
387 | union acpi_generic_state *acpi_ut_create_generic_state(void); | ||
388 | |||
389 | struct acpi_thread_state *acpi_ut_create_thread_state(void); | ||
390 | |||
391 | union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | ||
392 | *object, u16 action); | ||
393 | |||
394 | union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | ||
395 | void *external_object, | ||
396 | u16 index); | ||
397 | |||
398 | acpi_status | ||
399 | acpi_ut_create_update_state_and_push(union acpi_operand_object *object, | ||
400 | u16 action, | ||
401 | union acpi_generic_state **state_list); | ||
402 | |||
403 | #ifdef ACPI_FUTURE_USAGE | ||
404 | acpi_status | ||
405 | acpi_ut_create_pkg_state_and_push(void *internal_object, | ||
406 | void *external_object, | ||
407 | u16 index, | ||
408 | union acpi_generic_state **state_list); | ||
409 | #endif /* ACPI_FUTURE_USAGE */ | ||
410 | |||
411 | union acpi_generic_state *acpi_ut_create_control_state(void); | ||
412 | |||
413 | void acpi_ut_delete_generic_state(union acpi_generic_state *state); | ||
414 | |||
415 | /* | ||
416 | * utmath | ||
417 | */ | ||
418 | acpi_status | ||
419 | acpi_ut_divide(acpi_integer in_dividend, | ||
420 | acpi_integer in_divisor, | ||
421 | acpi_integer * out_quotient, acpi_integer * out_remainder); | ||
422 | |||
423 | acpi_status | ||
424 | acpi_ut_short_divide(acpi_integer in_dividend, | ||
425 | u32 divisor, | ||
426 | acpi_integer * out_quotient, u32 * out_remainder); | ||
427 | |||
428 | /* | ||
429 | * utmisc | ||
430 | */ | ||
431 | const char *acpi_ut_validate_exception(acpi_status status); | ||
432 | |||
433 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); | ||
434 | |||
435 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | ||
436 | |||
437 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); | ||
438 | |||
439 | acpi_status | ||
440 | acpi_ut_walk_package_tree(union acpi_operand_object *source_object, | ||
441 | void *target_object, | ||
442 | acpi_pkg_callback walk_callback, void *context); | ||
443 | |||
444 | void acpi_ut_strupr(char *src_string); | ||
445 | |||
446 | void acpi_ut_print_string(char *string, u8 max_length); | ||
447 | |||
448 | u8 acpi_ut_valid_acpi_name(u32 name); | ||
449 | |||
450 | acpi_name acpi_ut_repair_name(char *name); | ||
451 | |||
452 | u8 acpi_ut_valid_acpi_char(char character, u32 position); | ||
453 | |||
454 | acpi_status | ||
455 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | ||
456 | |||
457 | /* Values for Base above (16=Hex, 10=Decimal) */ | ||
458 | |||
459 | #define ACPI_ANY_BASE 0 | ||
460 | |||
461 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
462 | |||
463 | void acpi_ut_set_integer_width(u8 revision); | ||
464 | |||
465 | #ifdef ACPI_DEBUG_OUTPUT | ||
466 | void | ||
467 | acpi_ut_display_init_pathname(u8 type, | ||
468 | struct acpi_namespace_node *obj_handle, | ||
469 | char *path); | ||
470 | #endif | ||
471 | |||
472 | /* | ||
473 | * utresrc | ||
474 | */ | ||
475 | acpi_status | ||
476 | acpi_ut_walk_aml_resources(u8 * aml, | ||
477 | acpi_size aml_length, | ||
478 | acpi_walk_aml_callback user_function, | ||
479 | void **context); | ||
480 | |||
481 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); | ||
482 | |||
483 | u32 acpi_ut_get_descriptor_length(void *aml); | ||
484 | |||
485 | u16 acpi_ut_get_resource_length(void *aml); | ||
486 | |||
487 | u8 acpi_ut_get_resource_header_length(void *aml); | ||
488 | |||
489 | u8 acpi_ut_get_resource_type(void *aml); | ||
490 | |||
491 | acpi_status | ||
492 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, | ||
493 | u8 ** end_tag); | ||
494 | |||
495 | /* | ||
496 | * utmutex - mutex support | ||
497 | */ | ||
498 | acpi_status acpi_ut_mutex_initialize(void); | ||
499 | |||
500 | void acpi_ut_mutex_terminate(void); | ||
501 | |||
502 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id); | ||
503 | |||
504 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id); | ||
505 | |||
506 | /* | ||
507 | * utalloc - memory allocation and object caching | ||
508 | */ | ||
509 | acpi_status acpi_ut_create_caches(void); | ||
510 | |||
511 | acpi_status acpi_ut_delete_caches(void); | ||
512 | |||
513 | acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer); | ||
514 | |||
515 | acpi_status | ||
516 | acpi_ut_initialize_buffer(struct acpi_buffer *buffer, | ||
517 | acpi_size required_length); | ||
518 | |||
519 | void *acpi_ut_allocate(acpi_size size, | ||
520 | u32 component, const char *module, u32 line); | ||
521 | |||
522 | void *acpi_ut_allocate_zeroed(acpi_size size, | ||
523 | u32 component, const char *module, u32 line); | ||
524 | |||
525 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
526 | void *acpi_ut_allocate_and_track(acpi_size size, | ||
527 | u32 component, const char *module, u32 line); | ||
528 | |||
529 | void *acpi_ut_allocate_zeroed_and_track(acpi_size size, | ||
530 | u32 component, | ||
531 | const char *module, u32 line); | ||
532 | |||
533 | void | ||
534 | acpi_ut_free_and_track(void *address, | ||
535 | u32 component, const char *module, u32 line); | ||
536 | |||
537 | #ifdef ACPI_FUTURE_USAGE | ||
538 | void acpi_ut_dump_allocation_info(void); | ||
539 | #endif /* ACPI_FUTURE_USAGE */ | ||
540 | |||
541 | void acpi_ut_dump_allocations(u32 component, const char *module); | ||
542 | |||
543 | acpi_status | ||
544 | acpi_ut_create_list(char *list_name, | ||
545 | u16 object_size, struct acpi_memory_list **return_cache); | ||
546 | |||
547 | #endif | ||
548 | |||
549 | #endif /* _ACUTILS_H */ | ||
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h new file mode 100644 index 000000000000..ff851c5df698 --- /dev/null +++ b/drivers/acpi/acpica/amlcode.h | |||
@@ -0,0 +1,494 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Name: amlcode.h - Definitions for AML, as included in "definition blocks" | ||
4 | * Declarations and definitions contained herein are derived | ||
5 | * directly from the ACPI specification. | ||
6 | * | ||
7 | *****************************************************************************/ | ||
8 | |||
9 | /* | ||
10 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
11 | * All rights reserved. | ||
12 | * | ||
13 | * Redistribution and use in source and binary forms, with or without | ||
14 | * modification, are permitted provided that the following conditions | ||
15 | * are met: | ||
16 | * 1. Redistributions of source code must retain the above copyright | ||
17 | * notice, this list of conditions, and the following disclaimer, | ||
18 | * without modification. | ||
19 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
20 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
21 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
22 | * including a substantially similar Disclaimer requirement for further | ||
23 | * binary redistribution. | ||
24 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
25 | * of any contributors may be used to endorse or promote products derived | ||
26 | * from this software without specific prior written permission. | ||
27 | * | ||
28 | * Alternatively, this software may be distributed under the terms of the | ||
29 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
30 | * Software Foundation. | ||
31 | * | ||
32 | * NO WARRANTY | ||
33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
34 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
36 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
37 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
41 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
42 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
43 | * POSSIBILITY OF SUCH DAMAGES. | ||
44 | */ | ||
45 | |||
46 | #ifndef __AMLCODE_H__ | ||
47 | #define __AMLCODE_H__ | ||
48 | |||
49 | /* primary opcodes */ | ||
50 | |||
51 | #define AML_NULL_CHAR (u16) 0x00 | ||
52 | |||
53 | #define AML_ZERO_OP (u16) 0x00 | ||
54 | #define AML_ONE_OP (u16) 0x01 | ||
55 | #define AML_UNASSIGNED (u16) 0x02 | ||
56 | #define AML_ALIAS_OP (u16) 0x06 | ||
57 | #define AML_NAME_OP (u16) 0x08 | ||
58 | #define AML_BYTE_OP (u16) 0x0a | ||
59 | #define AML_WORD_OP (u16) 0x0b | ||
60 | #define AML_DWORD_OP (u16) 0x0c | ||
61 | #define AML_STRING_OP (u16) 0x0d | ||
62 | #define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */ | ||
63 | #define AML_SCOPE_OP (u16) 0x10 | ||
64 | #define AML_BUFFER_OP (u16) 0x11 | ||
65 | #define AML_PACKAGE_OP (u16) 0x12 | ||
66 | #define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */ | ||
67 | #define AML_METHOD_OP (u16) 0x14 | ||
68 | #define AML_DUAL_NAME_PREFIX (u16) 0x2e | ||
69 | #define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f | ||
70 | #define AML_NAME_CHAR_SUBSEQ (u16) 0x30 | ||
71 | #define AML_NAME_CHAR_FIRST (u16) 0x41 | ||
72 | #define AML_EXTENDED_OP_PREFIX (u16) 0x5b | ||
73 | #define AML_ROOT_PREFIX (u16) 0x5c | ||
74 | #define AML_PARENT_PREFIX (u16) 0x5e | ||
75 | #define AML_LOCAL_OP (u16) 0x60 | ||
76 | #define AML_LOCAL0 (u16) 0x60 | ||
77 | #define AML_LOCAL1 (u16) 0x61 | ||
78 | #define AML_LOCAL2 (u16) 0x62 | ||
79 | #define AML_LOCAL3 (u16) 0x63 | ||
80 | #define AML_LOCAL4 (u16) 0x64 | ||
81 | #define AML_LOCAL5 (u16) 0x65 | ||
82 | #define AML_LOCAL6 (u16) 0x66 | ||
83 | #define AML_LOCAL7 (u16) 0x67 | ||
84 | #define AML_ARG_OP (u16) 0x68 | ||
85 | #define AML_ARG0 (u16) 0x68 | ||
86 | #define AML_ARG1 (u16) 0x69 | ||
87 | #define AML_ARG2 (u16) 0x6a | ||
88 | #define AML_ARG3 (u16) 0x6b | ||
89 | #define AML_ARG4 (u16) 0x6c | ||
90 | #define AML_ARG5 (u16) 0x6d | ||
91 | #define AML_ARG6 (u16) 0x6e | ||
92 | #define AML_STORE_OP (u16) 0x70 | ||
93 | #define AML_REF_OF_OP (u16) 0x71 | ||
94 | #define AML_ADD_OP (u16) 0x72 | ||
95 | #define AML_CONCAT_OP (u16) 0x73 | ||
96 | #define AML_SUBTRACT_OP (u16) 0x74 | ||
97 | #define AML_INCREMENT_OP (u16) 0x75 | ||
98 | #define AML_DECREMENT_OP (u16) 0x76 | ||
99 | #define AML_MULTIPLY_OP (u16) 0x77 | ||
100 | #define AML_DIVIDE_OP (u16) 0x78 | ||
101 | #define AML_SHIFT_LEFT_OP (u16) 0x79 | ||
102 | #define AML_SHIFT_RIGHT_OP (u16) 0x7a | ||
103 | #define AML_BIT_AND_OP (u16) 0x7b | ||
104 | #define AML_BIT_NAND_OP (u16) 0x7c | ||
105 | #define AML_BIT_OR_OP (u16) 0x7d | ||
106 | #define AML_BIT_NOR_OP (u16) 0x7e | ||
107 | #define AML_BIT_XOR_OP (u16) 0x7f | ||
108 | #define AML_BIT_NOT_OP (u16) 0x80 | ||
109 | #define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81 | ||
110 | #define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82 | ||
111 | #define AML_DEREF_OF_OP (u16) 0x83 | ||
112 | #define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */ | ||
113 | #define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */ | ||
114 | #define AML_NOTIFY_OP (u16) 0x86 | ||
115 | #define AML_SIZE_OF_OP (u16) 0x87 | ||
116 | #define AML_INDEX_OP (u16) 0x88 | ||
117 | #define AML_MATCH_OP (u16) 0x89 | ||
118 | #define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a | ||
119 | #define AML_CREATE_WORD_FIELD_OP (u16) 0x8b | ||
120 | #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c | ||
121 | #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d | ||
122 | #define AML_TYPE_OP (u16) 0x8e | ||
123 | #define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ | ||
124 | #define AML_LAND_OP (u16) 0x90 | ||
125 | #define AML_LOR_OP (u16) 0x91 | ||
126 | #define AML_LNOT_OP (u16) 0x92 | ||
127 | #define AML_LEQUAL_OP (u16) 0x93 | ||
128 | #define AML_LGREATER_OP (u16) 0x94 | ||
129 | #define AML_LLESS_OP (u16) 0x95 | ||
130 | #define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */ | ||
131 | #define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */ | ||
132 | #define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */ | ||
133 | #define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */ | ||
134 | #define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */ | ||
135 | #define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */ | ||
136 | #define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */ | ||
137 | #define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */ | ||
138 | #define AML_IF_OP (u16) 0xa0 | ||
139 | #define AML_ELSE_OP (u16) 0xa1 | ||
140 | #define AML_WHILE_OP (u16) 0xa2 | ||
141 | #define AML_NOOP_OP (u16) 0xa3 | ||
142 | #define AML_RETURN_OP (u16) 0xa4 | ||
143 | #define AML_BREAK_OP (u16) 0xa5 | ||
144 | #define AML_BREAK_POINT_OP (u16) 0xcc | ||
145 | #define AML_ONES_OP (u16) 0xff | ||
146 | |||
147 | /* prefixed opcodes */ | ||
148 | |||
149 | #define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */ | ||
150 | |||
151 | #define AML_MUTEX_OP (u16) 0x5b01 | ||
152 | #define AML_EVENT_OP (u16) 0x5b02 | ||
153 | #define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10 | ||
154 | #define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11 | ||
155 | #define AML_COND_REF_OF_OP (u16) 0x5b12 | ||
156 | #define AML_CREATE_FIELD_OP (u16) 0x5b13 | ||
157 | #define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */ | ||
158 | #define AML_LOAD_OP (u16) 0x5b20 | ||
159 | #define AML_STALL_OP (u16) 0x5b21 | ||
160 | #define AML_SLEEP_OP (u16) 0x5b22 | ||
161 | #define AML_ACQUIRE_OP (u16) 0x5b23 | ||
162 | #define AML_SIGNAL_OP (u16) 0x5b24 | ||
163 | #define AML_WAIT_OP (u16) 0x5b25 | ||
164 | #define AML_RESET_OP (u16) 0x5b26 | ||
165 | #define AML_RELEASE_OP (u16) 0x5b27 | ||
166 | #define AML_FROM_BCD_OP (u16) 0x5b28 | ||
167 | #define AML_TO_BCD_OP (u16) 0x5b29 | ||
168 | #define AML_UNLOAD_OP (u16) 0x5b2a | ||
169 | #define AML_REVISION_OP (u16) 0x5b30 | ||
170 | #define AML_DEBUG_OP (u16) 0x5b31 | ||
171 | #define AML_FATAL_OP (u16) 0x5b32 | ||
172 | #define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */ | ||
173 | #define AML_REGION_OP (u16) 0x5b80 | ||
174 | #define AML_FIELD_OP (u16) 0x5b81 | ||
175 | #define AML_DEVICE_OP (u16) 0x5b82 | ||
176 | #define AML_PROCESSOR_OP (u16) 0x5b83 | ||
177 | #define AML_POWER_RES_OP (u16) 0x5b84 | ||
178 | #define AML_THERMAL_ZONE_OP (u16) 0x5b85 | ||
179 | #define AML_INDEX_FIELD_OP (u16) 0x5b86 | ||
180 | #define AML_BANK_FIELD_OP (u16) 0x5b87 | ||
181 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ | ||
182 | |||
183 | /* | ||
184 | * Combination opcodes (actually two one-byte opcodes) | ||
185 | * Used by the disassembler and i_aSL compiler | ||
186 | */ | ||
187 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 | ||
188 | #define AML_LLESSEQUAL_OP (u16) 0x9294 | ||
189 | #define AML_LNOTEQUAL_OP (u16) 0x9293 | ||
190 | |||
191 | /* | ||
192 | * Internal opcodes | ||
193 | * Use only "Unknown" AML opcodes, don't attempt to use | ||
194 | * any valid ACPI ASCII values (A-Z, 0-9, '-') | ||
195 | */ | ||
196 | #define AML_INT_NAMEPATH_OP (u16) 0x002d | ||
197 | #define AML_INT_NAMEDFIELD_OP (u16) 0x0030 | ||
198 | #define AML_INT_RESERVEDFIELD_OP (u16) 0x0031 | ||
199 | #define AML_INT_ACCESSFIELD_OP (u16) 0x0032 | ||
200 | #define AML_INT_BYTELIST_OP (u16) 0x0033 | ||
201 | #define AML_INT_STATICSTRING_OP (u16) 0x0034 | ||
202 | #define AML_INT_METHODCALL_OP (u16) 0x0035 | ||
203 | #define AML_INT_RETURN_VALUE_OP (u16) 0x0036 | ||
204 | #define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037 | ||
205 | |||
206 | #define ARG_NONE 0x0 | ||
207 | |||
208 | /* | ||
209 | * Argument types for the AML Parser | ||
210 | * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments. | ||
211 | * There can be up to 31 unique argument types | ||
212 | * Zero is reserved as end-of-list indicator | ||
213 | */ | ||
214 | #define ARGP_BYTEDATA 0x01 | ||
215 | #define ARGP_BYTELIST 0x02 | ||
216 | #define ARGP_CHARLIST 0x03 | ||
217 | #define ARGP_DATAOBJ 0x04 | ||
218 | #define ARGP_DATAOBJLIST 0x05 | ||
219 | #define ARGP_DWORDDATA 0x06 | ||
220 | #define ARGP_FIELDLIST 0x07 | ||
221 | #define ARGP_NAME 0x08 | ||
222 | #define ARGP_NAMESTRING 0x09 | ||
223 | #define ARGP_OBJLIST 0x0A | ||
224 | #define ARGP_PKGLENGTH 0x0B | ||
225 | #define ARGP_SUPERNAME 0x0C | ||
226 | #define ARGP_TARGET 0x0D | ||
227 | #define ARGP_TERMARG 0x0E | ||
228 | #define ARGP_TERMLIST 0x0F | ||
229 | #define ARGP_WORDDATA 0x10 | ||
230 | #define ARGP_QWORDDATA 0x11 | ||
231 | #define ARGP_SIMPLENAME 0x12 | ||
232 | |||
233 | /* | ||
234 | * Resolved argument types for the AML Interpreter | ||
235 | * Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments. | ||
236 | * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) | ||
237 | * | ||
238 | * Note1: These values are completely independent from the ACPI_TYPEs | ||
239 | * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER | ||
240 | * | ||
241 | * Note2: If and when 5 bits becomes insufficient, it would probably be best | ||
242 | * to convert to a 6-byte array of argument types, allowing 8 bits per argument. | ||
243 | */ | ||
244 | |||
245 | /* Single, simple types */ | ||
246 | |||
247 | #define ARGI_ANYTYPE 0x01 /* Don't care */ | ||
248 | #define ARGI_PACKAGE 0x02 | ||
249 | #define ARGI_EVENT 0x03 | ||
250 | #define ARGI_MUTEX 0x04 | ||
251 | #define ARGI_DDBHANDLE 0x05 | ||
252 | |||
253 | /* Interchangeable types (via implicit conversion) */ | ||
254 | |||
255 | #define ARGI_INTEGER 0x06 | ||
256 | #define ARGI_STRING 0x07 | ||
257 | #define ARGI_BUFFER 0x08 | ||
258 | #define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ | ||
259 | #define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ | ||
260 | |||
261 | /* Reference objects */ | ||
262 | |||
263 | #define ARGI_INTEGER_REF 0x0B | ||
264 | #define ARGI_OBJECT_REF 0x0C | ||
265 | #define ARGI_DEVICE_REF 0x0D | ||
266 | #define ARGI_REFERENCE 0x0E | ||
267 | #define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ | ||
268 | #define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ | ||
269 | #define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ | ||
270 | |||
271 | /* Multiple/complex types */ | ||
272 | |||
273 | #define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */ | ||
274 | #define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ | ||
275 | #define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ | ||
276 | #define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ | ||
277 | #define ARGI_DATAREFOBJ 0x16 | ||
278 | |||
279 | /* Note: types above can expand to 0x1F maximum */ | ||
280 | |||
281 | #define ARGI_INVALID_OPCODE 0xFFFFFFFF | ||
282 | |||
283 | /* | ||
284 | * hash offsets | ||
285 | */ | ||
286 | #define AML_EXTOP_HASH_OFFSET 22 | ||
287 | #define AML_LNOT_HASH_OFFSET 19 | ||
288 | |||
289 | /* | ||
290 | * opcode groups and types | ||
291 | */ | ||
292 | #define OPGRP_NAMED 0x01 | ||
293 | #define OPGRP_FIELD 0x02 | ||
294 | #define OPGRP_BYTELIST 0x04 | ||
295 | |||
296 | /* | ||
297 | * Opcode information | ||
298 | */ | ||
299 | |||
300 | /* Opcode flags */ | ||
301 | |||
302 | #define AML_LOGICAL 0x0001 | ||
303 | #define AML_LOGICAL_NUMERIC 0x0002 | ||
304 | #define AML_MATH 0x0004 | ||
305 | #define AML_CREATE 0x0008 | ||
306 | #define AML_FIELD 0x0010 | ||
307 | #define AML_DEFER 0x0020 | ||
308 | #define AML_NAMED 0x0040 | ||
309 | #define AML_NSNODE 0x0080 | ||
310 | #define AML_NSOPCODE 0x0100 | ||
311 | #define AML_NSOBJECT 0x0200 | ||
312 | #define AML_HAS_RETVAL 0x0400 | ||
313 | #define AML_HAS_TARGET 0x0800 | ||
314 | #define AML_HAS_ARGS 0x1000 | ||
315 | #define AML_CONSTANT 0x2000 | ||
316 | #define AML_NO_OPERAND_RESOLVE 0x4000 | ||
317 | |||
318 | /* Convenient flag groupings */ | ||
319 | |||
320 | #define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL | ||
321 | #define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ | ||
322 | #define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ | ||
323 | #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET | ||
324 | #define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */ | ||
325 | #define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ | ||
326 | #define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ | ||
327 | #define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */ | ||
328 | #define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL | ||
329 | #define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS | ||
330 | #define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL | ||
331 | #define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL | ||
332 | |||
333 | /* | ||
334 | * The opcode Type is used in a dispatch table, do not change | ||
335 | * without updating the table. | ||
336 | */ | ||
337 | #define AML_TYPE_EXEC_0A_0T_1R 0x00 | ||
338 | #define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ | ||
339 | #define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ | ||
340 | #define AML_TYPE_EXEC_1A_1T_0R 0x03 | ||
341 | #define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */ | ||
342 | #define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ | ||
343 | #define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ | ||
344 | #define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */ | ||
345 | #define AML_TYPE_EXEC_2A_2T_1R 0x08 | ||
346 | #define AML_TYPE_EXEC_3A_0T_0R 0x09 | ||
347 | #define AML_TYPE_EXEC_3A_1T_1R 0x0A | ||
348 | #define AML_TYPE_EXEC_6A_0T_1R 0x0B | ||
349 | /* End of types used in dispatch table */ | ||
350 | |||
351 | #define AML_TYPE_LITERAL 0x0B | ||
352 | #define AML_TYPE_CONSTANT 0x0C | ||
353 | #define AML_TYPE_METHOD_ARGUMENT 0x0D | ||
354 | #define AML_TYPE_LOCAL_VARIABLE 0x0E | ||
355 | #define AML_TYPE_DATA_TERM 0x0F | ||
356 | |||
357 | /* Generic for an op that returns a value */ | ||
358 | |||
359 | #define AML_TYPE_METHOD_CALL 0x10 | ||
360 | |||
361 | /* Misc */ | ||
362 | |||
363 | #define AML_TYPE_CREATE_FIELD 0x11 | ||
364 | #define AML_TYPE_CREATE_OBJECT 0x12 | ||
365 | #define AML_TYPE_CONTROL 0x13 | ||
366 | #define AML_TYPE_NAMED_NO_OBJ 0x14 | ||
367 | #define AML_TYPE_NAMED_FIELD 0x15 | ||
368 | #define AML_TYPE_NAMED_SIMPLE 0x16 | ||
369 | #define AML_TYPE_NAMED_COMPLEX 0x17 | ||
370 | #define AML_TYPE_RETURN 0x18 | ||
371 | |||
372 | #define AML_TYPE_UNDEFINED 0x19 | ||
373 | #define AML_TYPE_BOGUS 0x1A | ||
374 | |||
375 | /* AML Package Length encodings */ | ||
376 | |||
377 | #define ACPI_AML_PACKAGE_TYPE1 0x40 | ||
378 | #define ACPI_AML_PACKAGE_TYPE2 0x4000 | ||
379 | #define ACPI_AML_PACKAGE_TYPE3 0x400000 | ||
380 | #define ACPI_AML_PACKAGE_TYPE4 0x40000000 | ||
381 | |||
382 | /* | ||
383 | * Opcode classes | ||
384 | */ | ||
385 | #define AML_CLASS_EXECUTE 0x00 | ||
386 | #define AML_CLASS_CREATE 0x01 | ||
387 | #define AML_CLASS_ARGUMENT 0x02 | ||
388 | #define AML_CLASS_NAMED_OBJECT 0x03 | ||
389 | #define AML_CLASS_CONTROL 0x04 | ||
390 | #define AML_CLASS_ASCII 0x05 | ||
391 | #define AML_CLASS_PREFIX 0x06 | ||
392 | #define AML_CLASS_INTERNAL 0x07 | ||
393 | #define AML_CLASS_RETURN_VALUE 0x08 | ||
394 | #define AML_CLASS_METHOD_CALL 0x09 | ||
395 | #define AML_CLASS_UNKNOWN 0x0A | ||
396 | |||
397 | /* Predefined Operation Region space_iDs */ | ||
398 | |||
399 | typedef enum { | ||
400 | REGION_MEMORY = 0, | ||
401 | REGION_IO, | ||
402 | REGION_PCI_CONFIG, | ||
403 | REGION_EC, | ||
404 | REGION_SMBUS, | ||
405 | REGION_CMOS, | ||
406 | REGION_PCI_BAR, | ||
407 | REGION_DATA_TABLE, /* Internal use only */ | ||
408 | REGION_FIXED_HW = 0x7F | ||
409 | } AML_REGION_TYPES; | ||
410 | |||
411 | /* Comparison operation codes for match_op operator */ | ||
412 | |||
413 | typedef enum { | ||
414 | MATCH_MTR = 0, | ||
415 | MATCH_MEQ = 1, | ||
416 | MATCH_MLE = 2, | ||
417 | MATCH_MLT = 3, | ||
418 | MATCH_MGE = 4, | ||
419 | MATCH_MGT = 5 | ||
420 | } AML_MATCH_OPERATOR; | ||
421 | |||
422 | #define MAX_MATCH_OPERATOR 5 | ||
423 | |||
424 | /* | ||
425 | * field_flags | ||
426 | * | ||
427 | * This byte is extracted from the AML and includes three separate | ||
428 | * pieces of information about the field: | ||
429 | * 1) The field access type | ||
430 | * 2) The field update rule | ||
431 | * 3) The lock rule for the field | ||
432 | * | ||
433 | * Bits 00 - 03 : access_type (any_acc, byte_acc, etc.) | ||
434 | * 04 : lock_rule (1 == Lock) | ||
435 | * 05 - 06 : update_rule | ||
436 | */ | ||
437 | #define AML_FIELD_ACCESS_TYPE_MASK 0x0F | ||
438 | #define AML_FIELD_LOCK_RULE_MASK 0x10 | ||
439 | #define AML_FIELD_UPDATE_RULE_MASK 0x60 | ||
440 | |||
441 | /* 1) Field Access Types */ | ||
442 | |||
443 | typedef enum { | ||
444 | AML_FIELD_ACCESS_ANY = 0x00, | ||
445 | AML_FIELD_ACCESS_BYTE = 0x01, | ||
446 | AML_FIELD_ACCESS_WORD = 0x02, | ||
447 | AML_FIELD_ACCESS_DWORD = 0x03, | ||
448 | AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ | ||
449 | AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ | ||
450 | } AML_ACCESS_TYPE; | ||
451 | |||
452 | /* 2) Field Lock Rules */ | ||
453 | |||
454 | typedef enum { | ||
455 | AML_FIELD_LOCK_NEVER = 0x00, | ||
456 | AML_FIELD_LOCK_ALWAYS = 0x10 | ||
457 | } AML_LOCK_RULE; | ||
458 | |||
459 | /* 3) Field Update Rules */ | ||
460 | |||
461 | typedef enum { | ||
462 | AML_FIELD_UPDATE_PRESERVE = 0x00, | ||
463 | AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, | ||
464 | AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 | ||
465 | } AML_UPDATE_RULE; | ||
466 | |||
467 | /* | ||
468 | * Field Access Attributes. | ||
469 | * This byte is extracted from the AML via the | ||
470 | * access_as keyword | ||
471 | */ | ||
472 | typedef enum { | ||
473 | AML_FIELD_ATTRIB_SMB_QUICK = 0x02, | ||
474 | AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, | ||
475 | AML_FIELD_ATTRIB_SMB_BYTE = 0x06, | ||
476 | AML_FIELD_ATTRIB_SMB_WORD = 0x08, | ||
477 | AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, | ||
478 | AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, | ||
479 | AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D | ||
480 | } AML_ACCESS_ATTRIBUTE; | ||
481 | |||
482 | /* Bit fields in method_flags byte */ | ||
483 | |||
484 | #define AML_METHOD_ARG_COUNT 0x07 | ||
485 | #define AML_METHOD_SERIALIZED 0x08 | ||
486 | #define AML_METHOD_SYNCH_LEVEL 0xF0 | ||
487 | |||
488 | /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ | ||
489 | |||
490 | #define AML_METHOD_INTERNAL_ONLY 0x01 | ||
491 | #define AML_METHOD_RESERVED1 0x02 | ||
492 | #define AML_METHOD_RESERVED2 0x04 | ||
493 | |||
494 | #endif /* __AMLCODE_H__ */ | ||
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h new file mode 100644 index 000000000000..7b070e42b7c5 --- /dev/null +++ b/drivers/acpi/acpica/amlresrc.h | |||
@@ -0,0 +1,311 @@ | |||
1 | |||
2 | /****************************************************************************** | ||
3 | * | ||
4 | * Module Name: amlresrc.h - AML resource descriptors | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
46 | |||
47 | #ifndef __AMLRESRC_H | ||
48 | #define __AMLRESRC_H | ||
49 | |||
50 | /* | ||
51 | * Resource descriptor tags, as defined in the ACPI specification. | ||
52 | * Used to symbolically reference fields within a descriptor. | ||
53 | */ | ||
54 | #define ACPI_RESTAG_ADDRESS "_ADR" | ||
55 | #define ACPI_RESTAG_ALIGNMENT "_ALN" | ||
56 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" | ||
57 | #define ACPI_RESTAG_ACCESSSIZE "_ASZ" | ||
58 | #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" | ||
59 | #define ACPI_RESTAG_BASEADDRESS "_BAS" | ||
60 | #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ | ||
61 | #define ACPI_RESTAG_DECODE "_DEC" | ||
62 | #define ACPI_RESTAG_DMA "_DMA" | ||
63 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ | ||
64 | #define ACPI_RESTAG_GRANULARITY "_GRA" | ||
65 | #define ACPI_RESTAG_INTERRUPT "_INT" | ||
66 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ | ||
67 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ | ||
68 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ | ||
69 | #define ACPI_RESTAG_LENGTH "_LEN" | ||
70 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ | ||
71 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ | ||
72 | #define ACPI_RESTAG_MAXADDR "_MAX" | ||
73 | #define ACPI_RESTAG_MINADDR "_MIN" | ||
74 | #define ACPI_RESTAG_MAXTYPE "_MAF" | ||
75 | #define ACPI_RESTAG_MINTYPE "_MIF" | ||
76 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" | ||
77 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" | ||
78 | #define ACPI_RESTAG_RANGETYPE "_RNG" | ||
79 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ | ||
80 | #define ACPI_RESTAG_TRANSLATION "_TRA" | ||
81 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | ||
82 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ | ||
83 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ | ||
84 | |||
85 | /* Default sizes for "small" resource descriptors */ | ||
86 | |||
87 | #define ASL_RDESC_IRQ_SIZE 0x02 | ||
88 | #define ASL_RDESC_DMA_SIZE 0x02 | ||
89 | #define ASL_RDESC_ST_DEPEND_SIZE 0x00 | ||
90 | #define ASL_RDESC_END_DEPEND_SIZE 0x00 | ||
91 | #define ASL_RDESC_IO_SIZE 0x07 | ||
92 | #define ASL_RDESC_FIXED_IO_SIZE 0x03 | ||
93 | #define ASL_RDESC_END_TAG_SIZE 0x01 | ||
94 | |||
95 | struct asl_resource_node { | ||
96 | u32 buffer_length; | ||
97 | void *buffer; | ||
98 | struct asl_resource_node *next; | ||
99 | }; | ||
100 | |||
101 | /* Macros used to generate AML resource length fields */ | ||
102 | |||
103 | #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header)) | ||
104 | #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header)) | ||
105 | |||
106 | /* | ||
107 | * Resource descriptors defined in the ACPI specification. | ||
108 | * | ||
109 | * Packing/alignment must be BYTE because these descriptors | ||
110 | * are used to overlay the raw AML byte stream. | ||
111 | */ | ||
112 | #pragma pack(1) | ||
113 | |||
114 | /* | ||
115 | * SMALL descriptors | ||
116 | */ | ||
117 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ | ||
118 | u8 descriptor_type; | ||
119 | |||
120 | struct aml_resource_small_header { | ||
121 | AML_RESOURCE_SMALL_HEADER_COMMON}; | ||
122 | |||
123 | struct aml_resource_irq { | ||
124 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; | ||
125 | u8 flags; | ||
126 | }; | ||
127 | |||
128 | struct aml_resource_irq_noflags { | ||
129 | AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask; | ||
130 | }; | ||
131 | |||
132 | struct aml_resource_dma { | ||
133 | AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask; | ||
134 | u8 flags; | ||
135 | }; | ||
136 | |||
137 | struct aml_resource_start_dependent { | ||
138 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; | ||
139 | }; | ||
140 | |||
141 | struct aml_resource_start_dependent_noprio { | ||
142 | AML_RESOURCE_SMALL_HEADER_COMMON}; | ||
143 | |||
144 | struct aml_resource_end_dependent { | ||
145 | AML_RESOURCE_SMALL_HEADER_COMMON}; | ||
146 | |||
147 | struct aml_resource_io { | ||
148 | AML_RESOURCE_SMALL_HEADER_COMMON u8 flags; | ||
149 | u16 minimum; | ||
150 | u16 maximum; | ||
151 | u8 alignment; | ||
152 | u8 address_length; | ||
153 | }; | ||
154 | |||
155 | struct aml_resource_fixed_io { | ||
156 | AML_RESOURCE_SMALL_HEADER_COMMON u16 address; | ||
157 | u8 address_length; | ||
158 | }; | ||
159 | |||
160 | struct aml_resource_vendor_small { | ||
161 | AML_RESOURCE_SMALL_HEADER_COMMON}; | ||
162 | |||
163 | struct aml_resource_end_tag { | ||
164 | AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum; | ||
165 | }; | ||
166 | |||
167 | /* | ||
168 | * LARGE descriptors | ||
169 | */ | ||
170 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ | ||
171 | u8 descriptor_type;\ | ||
172 | u16 resource_length; | ||
173 | |||
174 | struct aml_resource_large_header { | ||
175 | AML_RESOURCE_LARGE_HEADER_COMMON}; | ||
176 | |||
177 | struct aml_resource_memory24 { | ||
178 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; | ||
179 | u16 minimum; | ||
180 | u16 maximum; | ||
181 | u16 alignment; | ||
182 | u16 address_length; | ||
183 | }; | ||
184 | |||
185 | struct aml_resource_vendor_large { | ||
186 | AML_RESOURCE_LARGE_HEADER_COMMON}; | ||
187 | |||
188 | struct aml_resource_memory32 { | ||
189 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; | ||
190 | u32 minimum; | ||
191 | u32 maximum; | ||
192 | u32 alignment; | ||
193 | u32 address_length; | ||
194 | }; | ||
195 | |||
196 | struct aml_resource_fixed_memory32 { | ||
197 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; | ||
198 | u32 address; | ||
199 | u32 address_length; | ||
200 | }; | ||
201 | |||
202 | #define AML_RESOURCE_ADDRESS_COMMON \ | ||
203 | u8 resource_type; \ | ||
204 | u8 flags; \ | ||
205 | u8 specific_flags; | ||
206 | |||
207 | struct aml_resource_address { | ||
208 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; | ||
209 | |||
210 | struct aml_resource_extended_address64 { | ||
211 | AML_RESOURCE_LARGE_HEADER_COMMON | ||
212 | AML_RESOURCE_ADDRESS_COMMON u8 revision_iD; | ||
213 | u8 reserved; | ||
214 | u64 granularity; | ||
215 | u64 minimum; | ||
216 | u64 maximum; | ||
217 | u64 translation_offset; | ||
218 | u64 address_length; | ||
219 | u64 type_specific; | ||
220 | }; | ||
221 | |||
222 | #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */ | ||
223 | |||
224 | struct aml_resource_address64 { | ||
225 | AML_RESOURCE_LARGE_HEADER_COMMON | ||
226 | AML_RESOURCE_ADDRESS_COMMON u64 granularity; | ||
227 | u64 minimum; | ||
228 | u64 maximum; | ||
229 | u64 translation_offset; | ||
230 | u64 address_length; | ||
231 | }; | ||
232 | |||
233 | struct aml_resource_address32 { | ||
234 | AML_RESOURCE_LARGE_HEADER_COMMON | ||
235 | AML_RESOURCE_ADDRESS_COMMON u32 granularity; | ||
236 | u32 minimum; | ||
237 | u32 maximum; | ||
238 | u32 translation_offset; | ||
239 | u32 address_length; | ||
240 | }; | ||
241 | |||
242 | struct aml_resource_address16 { | ||
243 | AML_RESOURCE_LARGE_HEADER_COMMON | ||
244 | AML_RESOURCE_ADDRESS_COMMON u16 granularity; | ||
245 | u16 minimum; | ||
246 | u16 maximum; | ||
247 | u16 translation_offset; | ||
248 | u16 address_length; | ||
249 | }; | ||
250 | |||
251 | struct aml_resource_extended_irq { | ||
252 | AML_RESOURCE_LARGE_HEADER_COMMON u8 flags; | ||
253 | u8 interrupt_count; | ||
254 | u32 interrupts[1]; | ||
255 | /* res_source_index, res_source optional fields follow */ | ||
256 | }; | ||
257 | |||
258 | struct aml_resource_generic_register { | ||
259 | AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id; | ||
260 | u8 bit_width; | ||
261 | u8 bit_offset; | ||
262 | u8 access_size; /* ACPI 3.0, was previously Reserved */ | ||
263 | u64 address; | ||
264 | }; | ||
265 | |||
266 | /* restore default alignment */ | ||
267 | |||
268 | #pragma pack() | ||
269 | |||
270 | /* Union of all resource descriptors, so we can allocate the worst case */ | ||
271 | |||
272 | union aml_resource { | ||
273 | /* Descriptor headers */ | ||
274 | |||
275 | u8 descriptor_type; | ||
276 | struct aml_resource_small_header small_header; | ||
277 | struct aml_resource_large_header large_header; | ||
278 | |||
279 | /* Small resource descriptors */ | ||
280 | |||
281 | struct aml_resource_irq irq; | ||
282 | struct aml_resource_dma dma; | ||
283 | struct aml_resource_start_dependent start_dpf; | ||
284 | struct aml_resource_end_dependent end_dpf; | ||
285 | struct aml_resource_io io; | ||
286 | struct aml_resource_fixed_io fixed_io; | ||
287 | struct aml_resource_vendor_small vendor_small; | ||
288 | struct aml_resource_end_tag end_tag; | ||
289 | |||
290 | /* Large resource descriptors */ | ||
291 | |||
292 | struct aml_resource_memory24 memory24; | ||
293 | struct aml_resource_generic_register generic_reg; | ||
294 | struct aml_resource_vendor_large vendor_large; | ||
295 | struct aml_resource_memory32 memory32; | ||
296 | struct aml_resource_fixed_memory32 fixed_memory32; | ||
297 | struct aml_resource_address16 address16; | ||
298 | struct aml_resource_address32 address32; | ||
299 | struct aml_resource_address64 address64; | ||
300 | struct aml_resource_extended_address64 ext_address64; | ||
301 | struct aml_resource_extended_irq extended_irq; | ||
302 | |||
303 | /* Utility overlays */ | ||
304 | |||
305 | struct aml_resource_address address; | ||
306 | u32 dword_item; | ||
307 | u16 word_item; | ||
308 | u8 byte_item; | ||
309 | }; | ||
310 | |||
311 | #endif | ||
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/acpica/dsfield.c index f988a5e7d2b4..53e27bc5a734 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -42,11 +42,12 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "amlcode.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include <acpi/acnamesp.h> | 48 | #include "acinterp.h" |
49 | #include <acpi/acparser.h> | 49 | #include "acnamesp.h" |
50 | #include "acparser.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsfield") | 53 | ACPI_MODULE_NAME("dsfield") |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/acpica/dsinit.c index 949f7c75029e..eb144b13d8fa 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acdispat.h" |
47 | #include <acpi/actables.h> | 47 | #include "acnamesp.h" |
48 | #include "actables.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME("dsinit") | 51 | ACPI_MODULE_NAME("dsinit") |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 279a5a60a0dd..14b8b8ed8023 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -42,11 +42,14 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "amlcode.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include <acpi/acnamesp.h> | 48 | #include "acinterp.h" |
49 | #include "acnamesp.h" | ||
50 | #ifdef ACPI_DISASSEMBLER | ||
49 | #include <acpi/acdisasm.h> | 51 | #include <acpi/acdisasm.h> |
52 | #endif | ||
50 | 53 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsmethod") | 55 | ACPI_MODULE_NAME("dsmethod") |
@@ -412,6 +415,9 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
412 | 415 | ||
413 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 416 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
414 | status = obj_desc->method.implementation(next_walk_state); | 417 | status = obj_desc->method.implementation(next_walk_state); |
418 | if (status == AE_OK) { | ||
419 | status = AE_CTRL_TERMINATE; | ||
420 | } | ||
415 | } | 421 | } |
416 | 422 | ||
417 | return_ACPI_STATUS(status); | 423 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index d03f81bd1bcb..da0f5468184c 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acdispat.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acnamesp.h" |
48 | #include "acinterp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME("dsmthdat") | 51 | ACPI_MODULE_NAME("dsmthdat") |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/acpica/dsobject.c index 4f08e599d07e..15c628e6aa00 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -42,11 +42,12 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acnamesp.h> | 48 | #include "acdispat.h" |
49 | #include <acpi/acinterp.h> | 49 | #include "acnamesp.h" |
50 | #include "acinterp.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
52 | ACPI_MODULE_NAME("dsobject") | 53 | ACPI_MODULE_NAME("dsobject") |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 69fae5905bb8..0c3b4dd60e8a 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -43,13 +43,14 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acparser.h" |
48 | #include <acpi/acdispat.h> | 48 | #include "amlcode.h" |
49 | #include <acpi/acinterp.h> | 49 | #include "acdispat.h" |
50 | #include <acpi/acnamesp.h> | 50 | #include "acinterp.h" |
51 | #include <acpi/acevents.h> | 51 | #include "acnamesp.h" |
52 | #include <acpi/actables.h> | 52 | #include "acevents.h" |
53 | #include "actables.h" | ||
53 | 54 | ||
54 | #define _COMPONENT ACPI_DISPATCHER | 55 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME("dsopcode") | 56 | ACPI_MODULE_NAME("dsopcode") |
@@ -1140,10 +1141,29 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
1140 | op->common.aml_opcode, walk_state)); | 1141 | op->common.aml_opcode, walk_state)); |
1141 | 1142 | ||
1142 | switch (op->common.aml_opcode) { | 1143 | switch (op->common.aml_opcode) { |
1143 | case AML_IF_OP: | ||
1144 | case AML_WHILE_OP: | 1144 | case AML_WHILE_OP: |
1145 | 1145 | ||
1146 | /* | 1146 | /* |
1147 | * If this is an additional iteration of a while loop, continue. | ||
1148 | * There is no need to allocate a new control state. | ||
1149 | */ | ||
1150 | if (walk_state->control_state) { | ||
1151 | if (walk_state->control_state->control.aml_predicate_start | ||
1152 | == (walk_state->parser_state.aml - 1)) { | ||
1153 | |||
1154 | /* Reset the state to start-of-loop */ | ||
1155 | |||
1156 | walk_state->control_state->common.state = | ||
1157 | ACPI_CONTROL_CONDITIONAL_EXECUTING; | ||
1158 | break; | ||
1159 | } | ||
1160 | } | ||
1161 | |||
1162 | /*lint -fallthrough */ | ||
1163 | |||
1164 | case AML_IF_OP: | ||
1165 | |||
1166 | /* | ||
1147 | * IF/WHILE: Create a new control state to manage these | 1167 | * IF/WHILE: Create a new control state to manage these |
1148 | * constructs. We need to manage these as a stack, in order | 1168 | * constructs. We need to manage these as a stack, in order |
1149 | * to handle nesting. | 1169 | * to handle nesting. |
@@ -1243,13 +1263,36 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1243 | 1263 | ||
1244 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1264 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
1245 | 1265 | ||
1246 | if (walk_state->control_state->common.value) { | 1266 | control_state = walk_state->control_state; |
1267 | if (control_state->common.value) { | ||
1247 | 1268 | ||
1248 | /* Predicate was true, go back and evaluate it again! */ | 1269 | /* Predicate was true, the body of the loop was just executed */ |
1249 | 1270 | ||
1271 | /* | ||
1272 | * This loop counter mechanism allows the interpreter to escape | ||
1273 | * possibly infinite loops. This can occur in poorly written AML | ||
1274 | * when the hardware does not respond within a while loop and the | ||
1275 | * loop does not implement a timeout. | ||
1276 | */ | ||
1277 | control_state->control.loop_count++; | ||
1278 | if (control_state->control.loop_count > | ||
1279 | ACPI_MAX_LOOP_ITERATIONS) { | ||
1280 | status = AE_AML_INFINITE_LOOP; | ||
1281 | break; | ||
1282 | } | ||
1283 | |||
1284 | /* | ||
1285 | * Go back and evaluate the predicate and maybe execute the loop | ||
1286 | * another time | ||
1287 | */ | ||
1250 | status = AE_CTRL_PENDING; | 1288 | status = AE_CTRL_PENDING; |
1289 | walk_state->aml_last_while = | ||
1290 | control_state->control.aml_predicate_start; | ||
1291 | break; | ||
1251 | } | 1292 | } |
1252 | 1293 | ||
1294 | /* Predicate was false, terminate this while loop */ | ||
1295 | |||
1253 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1296 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1254 | "[WHILE_OP] termination! Op=%p\n", op)); | 1297 | "[WHILE_OP] termination! Op=%p\n", op)); |
1255 | 1298 | ||
@@ -1257,9 +1300,6 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1257 | 1300 | ||
1258 | control_state = | 1301 | control_state = |
1259 | acpi_ut_pop_generic_state(&walk_state->control_state); | 1302 | acpi_ut_pop_generic_state(&walk_state->control_state); |
1260 | |||
1261 | walk_state->aml_last_while = | ||
1262 | control_state->control.aml_predicate_start; | ||
1263 | acpi_ut_delete_generic_state(control_state); | 1303 | acpi_ut_delete_generic_state(control_state); |
1264 | break; | 1304 | break; |
1265 | 1305 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/acpica/dsutils.c index b398982f0d8b..dabc23a46176 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -42,12 +42,13 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acinterp.h> | 48 | #include "acdispat.h" |
49 | #include <acpi/acnamesp.h> | 49 | #include "acinterp.h" |
50 | #include <acpi/acdebug.h> | 50 | #include "acnamesp.h" |
51 | #include "acdebug.h" | ||
51 | 52 | ||
52 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME("dsutils") | 54 | ACPI_MODULE_NAME("dsutils") |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/acpica/dswexec.c index 396fe12078cd..350e6656bc89 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -43,12 +43,13 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acparser.h" |
48 | #include <acpi/acdispat.h> | 48 | #include "amlcode.h" |
49 | #include <acpi/acinterp.h> | 49 | #include "acdispat.h" |
50 | #include <acpi/acnamesp.h> | 50 | #include "acinterp.h" |
51 | #include <acpi/acdebug.h> | 51 | #include "acnamesp.h" |
52 | #include "acdebug.h" | ||
52 | 53 | ||
53 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME("dswexec") | 55 | ACPI_MODULE_NAME("dswexec") |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/acpica/dswload.c index dff7a3e445a8..3023ceaa8d54 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -42,12 +42,13 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acinterp.h> | 48 | #include "acdispat.h" |
49 | #include <acpi/acnamesp.h> | 49 | #include "acinterp.h" |
50 | #include <acpi/acevents.h> | 50 | #include "acnamesp.h" |
51 | #include "acevents.h" | ||
51 | 52 | ||
52 | #ifdef ACPI_ASL_COMPILER | 53 | #ifdef ACPI_ASL_COMPILER |
53 | #include <acpi/acdisasm.h> | 54 | #include <acpi/acdisasm.h> |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/acpica/dswscope.c index 9e6073265873..908645e72f03 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include "accommon.h" |
46 | #include "acdispat.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_DISPATCHER | 48 | #define _COMPONENT ACPI_DISPATCHER |
48 | ACPI_MODULE_NAME("dswscope") | 49 | ACPI_MODULE_NAME("dswscope") |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/acpica/dswstate.c index b00d4af791aa..40f92bf7dce5 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acnamesp.h> | 47 | #include "acdispat.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME("dswstate") | 51 | ACPI_MODULE_NAME("dswstate") |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/acpica/evevent.c index c56c5c6ea77b..803edd9e3f6a 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include "acevents.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_EVENTS | 48 | #define _COMPONENT ACPI_EVENTS |
48 | ACPI_MODULE_NAME("evevent") | 49 | ACPI_MODULE_NAME("evevent") |
@@ -72,8 +73,8 @@ acpi_status acpi_ev_initialize_events(void) | |||
72 | 73 | ||
73 | /* | 74 | /* |
74 | * Initialize the Fixed and General Purpose Events. This is done prior to | 75 | * Initialize the Fixed and General Purpose Events. This is done prior to |
75 | * enabling SCIs to prevent interrupts from occurring before the handlers are | 76 | * enabling SCIs to prevent interrupts from occurring before the handlers |
76 | * installed. | 77 | * are installed. |
77 | */ | 78 | */ |
78 | status = acpi_ev_fixed_event_initialize(); | 79 | status = acpi_ev_fixed_event_initialize(); |
79 | if (ACPI_FAILURE(status)) { | 80 | if (ACPI_FAILURE(status)) { |
@@ -192,8 +193,8 @@ static acpi_status acpi_ev_fixed_event_initialize(void) | |||
192 | acpi_status status; | 193 | acpi_status status; |
193 | 194 | ||
194 | /* | 195 | /* |
195 | * Initialize the structure that keeps track of fixed event handlers | 196 | * Initialize the structure that keeps track of fixed event handlers and |
196 | * and enable the fixed events. | 197 | * enable the fixed events. |
197 | */ | 198 | */ |
198 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 199 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
199 | acpi_gbl_fixed_event_handlers[i].handler = NULL; | 200 | acpi_gbl_fixed_event_handlers[i].handler = NULL; |
@@ -237,7 +238,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
237 | 238 | ||
238 | /* | 239 | /* |
239 | * Read the fixed feature status and enable registers, as all the cases | 240 | * Read the fixed feature status and enable registers, as all the cases |
240 | * depend on their values. Ignore errors here. | 241 | * depend on their values. Ignore errors here. |
241 | */ | 242 | */ |
242 | (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status); | 243 | (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status); |
243 | (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable); | 244 | (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable); |
@@ -291,8 +292,8 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) | |||
291 | status_register_id, 1); | 292 | status_register_id, 1); |
292 | 293 | ||
293 | /* | 294 | /* |
294 | * Make sure we've got a handler. If not, report an error. | 295 | * Make sure we've got a handler. If not, report an error. The event is |
295 | * The event is disabled to prevent further interrupts. | 296 | * disabled to prevent further interrupts. |
296 | */ | 297 | */ |
297 | if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { | 298 | if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { |
298 | (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. | 299 | (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/acpica/evgpe.c index f45c74fe745e..f345ced36477 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME("evgpe") | 50 | ACPI_MODULE_NAME("evgpe") |
@@ -125,7 +126,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
125 | (1 << | 126 | (1 << |
126 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | 127 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); |
127 | 128 | ||
128 | /* 1) Disable case. Simply clear all enable bits */ | 129 | /* 1) Disable case. Simply clear all enable bits */ |
129 | 130 | ||
130 | if (type == ACPI_GPE_DISABLE) { | 131 | if (type == ACPI_GPE_DISABLE) { |
131 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, | 132 | 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, | |||
134 | return_ACPI_STATUS(AE_OK); | 135 | return_ACPI_STATUS(AE_OK); |
135 | } | 136 | } |
136 | 137 | ||
137 | /* 2) Enable case. Set/Clear the appropriate enable bits */ | 138 | /* 2) Enable case. Set/Clear the appropriate enable bits */ |
138 | 139 | ||
139 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { | 140 | switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { |
140 | case ACPI_GPE_TYPE_WAKE: | 141 | case ACPI_GPE_TYPE_WAKE: |
@@ -295,7 +296,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
295 | * | 296 | * |
296 | * FUNCTION: acpi_ev_get_gpe_event_info | 297 | * FUNCTION: acpi_ev_get_gpe_event_info |
297 | * | 298 | * |
298 | * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 | 299 | * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 |
299 | * gpe_number - Raw GPE number | 300 | * gpe_number - Raw GPE number |
300 | * | 301 | * |
301 | * RETURN: A GPE event_info struct. NULL if not a valid GPE | 302 | * 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, | |||
372 | * | 373 | * |
373 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED | 374 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
374 | * | 375 | * |
375 | * DESCRIPTION: Detect if any GP events have occurred. This function is | 376 | * DESCRIPTION: Detect if any GP events have occurred. This function is |
376 | * executed at interrupt level. | 377 | * executed at interrupt level. |
377 | * | 378 | * |
378 | ******************************************************************************/ | 379 | ******************************************************************************/ |
@@ -400,8 +401,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
400 | 401 | ||
401 | /* | 402 | /* |
402 | * We need to obtain the GPE lock for both the data structs and registers | 403 | * We need to obtain the GPE lock for both the data structs and registers |
403 | * Note: Not necessary to obtain the hardware lock, since the GPE registers | 404 | * Note: Not necessary to obtain the hardware lock, since the GPE |
404 | * are owned by the gpe_lock. | 405 | * registers are owned by the gpe_lock. |
405 | */ | 406 | */ |
406 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 407 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
407 | 408 | ||
@@ -410,9 +411,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
410 | gpe_block = gpe_xrupt_list->gpe_block_list_head; | 411 | gpe_block = gpe_xrupt_list->gpe_block_list_head; |
411 | while (gpe_block) { | 412 | while (gpe_block) { |
412 | /* | 413 | /* |
413 | * Read all of the 8-bit GPE status and enable registers | 414 | * Read all of the 8-bit GPE status and enable registers in this GPE |
414 | * in this GPE block, saving all of them. | 415 | * block, saving all of them. Find all currently active GP events. |
415 | * Find all currently active GP events. | ||
416 | */ | 416 | */ |
417 | for (i = 0; i < gpe_block->register_count; i++) { | 417 | for (i = 0; i < gpe_block->register_count; i++) { |
418 | 418 | ||
@@ -423,10 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
423 | /* Read the Status Register */ | 423 | /* Read the Status Register */ |
424 | 424 | ||
425 | status = | 425 | status = |
426 | acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, | 426 | acpi_read(&status_reg, |
427 | &status_reg, | 427 | &gpe_register_info->status_address); |
428 | &gpe_register_info-> | ||
429 | status_address); | ||
430 | if (ACPI_FAILURE(status)) { | 428 | if (ACPI_FAILURE(status)) { |
431 | goto unlock_and_exit; | 429 | goto unlock_and_exit; |
432 | } | 430 | } |
@@ -434,10 +432,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
434 | /* Read the Enable Register */ | 432 | /* Read the Enable Register */ |
435 | 433 | ||
436 | status = | 434 | status = |
437 | acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, | 435 | acpi_read(&enable_reg, |
438 | &enable_reg, | 436 | &gpe_register_info->enable_address); |
439 | &gpe_register_info-> | ||
440 | enable_address); | ||
441 | if (ACPI_FAILURE(status)) { | 437 | if (ACPI_FAILURE(status)) { |
442 | goto unlock_and_exit; | 438 | goto unlock_and_exit; |
443 | } | 439 | } |
@@ -527,8 +523,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
527 | (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); | 523 | (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); |
528 | 524 | ||
529 | /* | 525 | /* |
530 | * Take a snapshot of the GPE info for this level - we copy the | 526 | * Take a snapshot of the GPE info for this level - we copy the info to |
531 | * info to prevent a race condition with remove_handler/remove_block. | 527 | * prevent a race condition with remove_handler/remove_block. |
532 | */ | 528 | */ |
533 | ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, | 529 | ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, |
534 | sizeof(struct acpi_gpe_event_info)); | 530 | sizeof(struct acpi_gpe_event_info)); |
@@ -539,8 +535,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
539 | } | 535 | } |
540 | 536 | ||
541 | /* | 537 | /* |
542 | * Must check for control method type dispatch one more | 538 | * Must check for control method type dispatch one more time to avoid a |
543 | * time to avoid race with ev_gpe_install_handler | 539 | * race with ev_gpe_install_handler |
544 | */ | 540 | */ |
545 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == | 541 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
546 | ACPI_GPE_DISPATCH_METHOD) { | 542 | ACPI_GPE_DISPATCH_METHOD) { |
@@ -584,8 +580,8 @@ static void acpi_ev_asynch_enable_gpe(void *context) | |||
584 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == | 580 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
585 | ACPI_GPE_LEVEL_TRIGGERED) { | 581 | ACPI_GPE_LEVEL_TRIGGERED) { |
586 | /* | 582 | /* |
587 | * GPE is level-triggered, we clear the GPE status bit after | 583 | * GPE is level-triggered, we clear the GPE status bit after handling |
588 | * handling the event. | 584 | * the event. |
589 | */ | 585 | */ |
590 | status = acpi_hw_clear_gpe(gpe_event_info); | 586 | status = acpi_hw_clear_gpe(gpe_event_info); |
591 | if (ACPI_FAILURE(status)) { | 587 | if (ACPI_FAILURE(status)) { |
@@ -624,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
624 | acpi_os_gpe_count(gpe_number); | 620 | acpi_os_gpe_count(gpe_number); |
625 | 621 | ||
626 | /* | 622 | /* |
627 | * If edge-triggered, clear the GPE status bit now. Note that | 623 | * If edge-triggered, clear the GPE status bit now. Note that |
628 | * level-triggered events are cleared after the GPE is serviced. | 624 | * level-triggered events are cleared after the GPE is serviced. |
629 | */ | 625 | */ |
630 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == | 626 | 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) | |||
650 | 646 | ||
651 | /* | 647 | /* |
652 | * Invoke the installed handler (at interrupt level) | 648 | * Invoke the installed handler (at interrupt level) |
653 | * Ignore return status for now. TBD: leave GPE disabled on error? | 649 | * Ignore return status for now. |
650 | * TBD: leave GPE disabled on error? | ||
654 | */ | 651 | */ |
655 | (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> | 652 | (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> |
656 | dispatch. | 653 | dispatch. |
@@ -708,7 +705,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
708 | gpe_number)); | 705 | gpe_number)); |
709 | 706 | ||
710 | /* | 707 | /* |
711 | * Disable the GPE. The GPE will remain disabled until the ACPI | 708 | * Disable the GPE. The GPE will remain disabled until the ACPICA |
712 | * Core Subsystem is restarted, or a handler is installed. | 709 | * Core Subsystem is restarted, or a handler is installed. |
713 | */ | 710 | */ |
714 | status = acpi_ev_disable_gpe(gpe_event_info); | 711 | status = acpi_ev_disable_gpe(gpe_event_info); |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 73c058e2f5c2..484cc0565d5b 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME("evgpeblk") | 50 | ACPI_MODULE_NAME("evgpeblk") |
@@ -124,6 +125,7 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) | |||
124 | * FUNCTION: acpi_ev_walk_gpe_list | 125 | * FUNCTION: acpi_ev_walk_gpe_list |
125 | * | 126 | * |
126 | * PARAMETERS: gpe_walk_callback - Routine called for each GPE block | 127 | * PARAMETERS: gpe_walk_callback - Routine called for each GPE block |
128 | * Context - Value passed to callback | ||
127 | * | 129 | * |
128 | * RETURN: Status | 130 | * RETURN: Status |
129 | * | 131 | * |
@@ -131,7 +133,8 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) | |||
131 | * | 133 | * |
132 | ******************************************************************************/ | 134 | ******************************************************************************/ |
133 | 135 | ||
134 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) | 136 | acpi_status |
137 | acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context) | ||
135 | { | 138 | { |
136 | struct acpi_gpe_block_info *gpe_block; | 139 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 140 | 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) | |||
154 | 157 | ||
155 | /* One callback per GPE block */ | 158 | /* One callback per GPE block */ |
156 | 159 | ||
157 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); | 160 | status = |
161 | gpe_walk_callback(gpe_xrupt_info, gpe_block, | ||
162 | context); | ||
158 | if (ACPI_FAILURE(status)) { | 163 | if (ACPI_FAILURE(status)) { |
164 | if (status == AE_CTRL_END) { /* Callback abort */ | ||
165 | status = AE_OK; | ||
166 | } | ||
159 | goto unlock_and_exit; | 167 | goto unlock_and_exit; |
160 | } | 168 | } |
161 | 169 | ||
@@ -186,7 +194,8 @@ acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) | |||
186 | 194 | ||
187 | acpi_status | 195 | acpi_status |
188 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 196 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
189 | struct acpi_gpe_block_info *gpe_block) | 197 | struct acpi_gpe_block_info *gpe_block, |
198 | void *context) | ||
190 | { | 199 | { |
191 | struct acpi_gpe_event_info *gpe_event_info; | 200 | struct acpi_gpe_event_info *gpe_event_info; |
192 | u32 i; | 201 | u32 i; |
@@ -309,17 +318,17 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
309 | (gpe_block->block_base_number + | 318 | (gpe_block->block_base_number + |
310 | (gpe_block->register_count * 8)))) { | 319 | (gpe_block->register_count * 8)))) { |
311 | /* | 320 | /* |
312 | * Not valid for this GPE block, just ignore it | 321 | * Not valid for this GPE block, just ignore it. However, it may be |
313 | * However, it may be valid for a different GPE block, since GPE0 and GPE1 | 322 | * valid for a different GPE block, since GPE0 and GPE1 methods both |
314 | * methods both appear under \_GPE. | 323 | * appear under \_GPE. |
315 | */ | 324 | */ |
316 | return_ACPI_STATUS(AE_OK); | 325 | return_ACPI_STATUS(AE_OK); |
317 | } | 326 | } |
318 | 327 | ||
319 | /* | 328 | /* |
320 | * Now we can add this information to the gpe_event_info block | 329 | * Now we can add this information to the gpe_event_info block for use |
321 | * for use during dispatch of this GPE. Default type is RUNTIME, although | 330 | * during dispatch of this GPE. Default type is RUNTIME, although this may |
322 | * this may change when the _PRW methods are executed later. | 331 | * change when the _PRW methods are executed later. |
323 | */ | 332 | */ |
324 | gpe_event_info = | 333 | gpe_event_info = |
325 | &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; | 334 | &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, | |||
394 | gpe_block = gpe_info->gpe_block; | 403 | gpe_block = gpe_info->gpe_block; |
395 | 404 | ||
396 | /* | 405 | /* |
397 | * The _PRW object must return a package, we are only interested | 406 | * The _PRW object must return a package, we are only interested in the |
398 | * in the first element | 407 | * first element |
399 | */ | 408 | */ |
400 | obj_desc = pkg_desc->package.elements[0]; | 409 | obj_desc = pkg_desc->package.elements[0]; |
401 | 410 | ||
@@ -434,7 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
434 | /* | 443 | /* |
435 | * Is this GPE within this block? | 444 | * Is this GPE within this block? |
436 | * | 445 | * |
437 | * TRUE iff these conditions are true: | 446 | * TRUE if and only if these conditions are true: |
438 | * 1) The GPE devices match. | 447 | * 1) The GPE devices match. |
439 | * 2) The GPE index(number) is within the range of the Gpe Block | 448 | * 2) The GPE index(number) is within the range of the Gpe Block |
440 | * associated with the GPE device. | 449 | * associated with the GPE device. |
@@ -457,6 +466,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
457 | if (ACPI_FAILURE(status)) { | 466 | if (ACPI_FAILURE(status)) { |
458 | goto cleanup; | 467 | goto cleanup; |
459 | } | 468 | } |
469 | |||
460 | status = | 470 | status = |
461 | acpi_ev_update_gpe_enable_masks(gpe_event_info, | 471 | acpi_ev_update_gpe_enable_masks(gpe_event_info, |
462 | ACPI_GPE_DISABLE); | 472 | ACPI_GPE_DISABLE); |
@@ -476,9 +486,9 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
476 | * RETURN: A GPE interrupt block | 486 | * RETURN: A GPE interrupt block |
477 | * | 487 | * |
478 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt | 488 | * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt |
479 | * block per unique interrupt level used for GPEs. | 489 | * block per unique interrupt level used for GPEs. Should be |
480 | * Should be called only when the GPE lists are semaphore locked | 490 | * called only when the GPE lists are semaphore locked and not |
481 | * and not subject to change. | 491 | * subject to change. |
482 | * | 492 | * |
483 | ******************************************************************************/ | 493 | ******************************************************************************/ |
484 | 494 | ||
@@ -608,8 +618,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
608 | * | 618 | * |
609 | * FUNCTION: acpi_ev_install_gpe_block | 619 | * FUNCTION: acpi_ev_install_gpe_block |
610 | * | 620 | * |
611 | * PARAMETERS: gpe_block - New GPE block | 621 | * PARAMETERS: gpe_block - New GPE block |
612 | * interrupt_number - Xrupt to be associated with this GPE block | 622 | * interrupt_number - Xrupt to be associated with this |
623 | * GPE block | ||
613 | * | 624 | * |
614 | * RETURN: Status | 625 | * RETURN: Status |
615 | * | 626 | * |
@@ -666,7 +677,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
666 | * | 677 | * |
667 | * FUNCTION: acpi_ev_delete_gpe_block | 678 | * FUNCTION: acpi_ev_delete_gpe_block |
668 | * | 679 | * |
669 | * PARAMETERS: gpe_block - Existing GPE block | 680 | * PARAMETERS: gpe_block - Existing GPE block |
670 | * | 681 | * |
671 | * RETURN: Status | 682 | * RETURN: Status |
672 | * | 683 | * |
@@ -688,7 +699,8 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
688 | 699 | ||
689 | /* Disable all GPEs in this block */ | 700 | /* Disable all GPEs in this block */ |
690 | 701 | ||
691 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); | 702 | status = |
703 | acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block, NULL); | ||
692 | 704 | ||
693 | if (!gpe_block->previous && !gpe_block->next) { | 705 | if (!gpe_block->previous && !gpe_block->next) { |
694 | 706 | ||
@@ -715,6 +727,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
715 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 727 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
716 | } | 728 | } |
717 | 729 | ||
730 | acpi_current_gpe_count -= | ||
731 | gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH; | ||
732 | |||
718 | /* Free the gpe_block */ | 733 | /* Free the gpe_block */ |
719 | 734 | ||
720 | ACPI_FREE(gpe_block->register_info); | 735 | ACPI_FREE(gpe_block->register_info); |
@@ -786,9 +801,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
786 | 801 | ||
787 | /* | 802 | /* |
788 | * Initialize the GPE Register and Event structures. A goal of these | 803 | * Initialize the GPE Register and Event structures. A goal of these |
789 | * tables is to hide the fact that there are two separate GPE register sets | 804 | * tables is to hide the fact that there are two separate GPE register |
790 | * in a given GPE hardware block, the status registers occupy the first half, | 805 | * sets in a given GPE hardware block, the status registers occupy the |
791 | * and the enable registers occupy the second half. | 806 | * first half, and the enable registers occupy the second half. |
792 | */ | 807 | */ |
793 | this_register = gpe_register_info; | 808 | this_register = gpe_register_info; |
794 | this_event = gpe_event_info; | 809 | this_event = gpe_event_info; |
@@ -816,10 +831,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
816 | ACPI_GPE_REGISTER_WIDTH; | 831 | ACPI_GPE_REGISTER_WIDTH; |
817 | this_register->enable_address.bit_width = | 832 | this_register->enable_address.bit_width = |
818 | ACPI_GPE_REGISTER_WIDTH; | 833 | ACPI_GPE_REGISTER_WIDTH; |
819 | this_register->status_address.bit_offset = | 834 | this_register->status_address.bit_offset = 0; |
820 | ACPI_GPE_REGISTER_WIDTH; | 835 | this_register->enable_address.bit_offset = 0; |
821 | this_register->enable_address.bit_offset = | ||
822 | ACPI_GPE_REGISTER_WIDTH; | ||
823 | 836 | ||
824 | /* Init the event_info for each GPE within this register */ | 837 | /* Init the event_info for each GPE within this register */ |
825 | 838 | ||
@@ -832,18 +845,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
832 | 845 | ||
833 | /* Disable all GPEs within this register */ | 846 | /* Disable all GPEs within this register */ |
834 | 847 | ||
835 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, | 848 | status = acpi_write(0x00, &this_register->enable_address); |
836 | &this_register-> | ||
837 | enable_address); | ||
838 | if (ACPI_FAILURE(status)) { | 849 | if (ACPI_FAILURE(status)) { |
839 | goto error_exit; | 850 | goto error_exit; |
840 | } | 851 | } |
841 | 852 | ||
842 | /* Clear any pending GPE events within this register */ | 853 | /* Clear any pending GPE events within this register */ |
843 | 854 | ||
844 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, | 855 | status = acpi_write(0xFF, &this_register->status_address); |
845 | &this_register-> | ||
846 | status_address); | ||
847 | if (ACPI_FAILURE(status)) { | 856 | if (ACPI_FAILURE(status)) { |
848 | goto error_exit; | 857 | goto error_exit; |
849 | } | 858 | } |
@@ -956,6 +965,9 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
956 | gpe_device->name.ascii, gpe_block->register_count, | 965 | gpe_device->name.ascii, gpe_block->register_count, |
957 | interrupt_number)); | 966 | interrupt_number)); |
958 | 967 | ||
968 | /* Update global count of currently available GPEs */ | ||
969 | |||
970 | acpi_current_gpe_count += register_count * ACPI_GPE_REGISTER_WIDTH; | ||
959 | return_ACPI_STATUS(AE_OK); | 971 | return_ACPI_STATUS(AE_OK); |
960 | } | 972 | } |
961 | 973 | ||
@@ -1055,7 +1067,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1055 | 1067 | ||
1056 | /* Enable all valid runtime GPEs found above */ | 1068 | /* Enable all valid runtime GPEs found above */ |
1057 | 1069 | ||
1058 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | 1070 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block, NULL); |
1059 | if (ACPI_FAILURE(status)) { | 1071 | if (ACPI_FAILURE(status)) { |
1060 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", | 1072 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", |
1061 | gpe_block)); | 1073 | gpe_block)); |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/acpica/evmisc.c index 1d5670be729a..5f893057bcc6 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
@@ -42,18 +42,15 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acnamesp.h" |
48 | #include "acinterp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evmisc") | 51 | ACPI_MODULE_NAME("evmisc") |
51 | 52 | ||
52 | /* Pointer to FACS needed for the Global Lock */ | ||
53 | static struct acpi_table_facs *facs = NULL; | ||
54 | |||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); | 54 | static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); |
58 | 55 | ||
59 | static u32 acpi_ev_global_lock_handler(void *context); | 56 | static u32 acpi_ev_global_lock_handler(void *context); |
@@ -152,7 +149,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
152 | break; | 149 | break; |
153 | 150 | ||
154 | default: | 151 | default: |
152 | |||
155 | /* All other types are not supported */ | 153 | /* All other types are not supported */ |
154 | |||
156 | return (AE_TYPE); | 155 | return (AE_TYPE); |
157 | } | 156 | } |
158 | } | 157 | } |
@@ -193,9 +192,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
193 | acpi_ut_delete_generic_state(notify_info); | 192 | acpi_ut_delete_generic_state(notify_info); |
194 | } | 193 | } |
195 | } else { | 194 | } else { |
196 | /* | 195 | /* There is no notify handler (per-device or system) for this device */ |
197 | * There is no notify handler (per-device or system) for this device. | 196 | |
198 | */ | ||
199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 197 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
200 | "No notify handler for Notify (%4.4s, %X) node %p\n", | 198 | "No notify handler for Notify (%4.4s, %X) node %p\n", |
201 | acpi_ut_get_node_name(node), notify_value, | 199 | acpi_ut_get_node_name(node), notify_value, |
@@ -229,9 +227,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) | |||
229 | ACPI_FUNCTION_ENTRY(); | 227 | ACPI_FUNCTION_ENTRY(); |
230 | 228 | ||
231 | /* | 229 | /* |
232 | * We will invoke a global notify handler if installed. | 230 | * We will invoke a global notify handler if installed. This is done |
233 | * This is done _before_ we invoke the per-device handler attached | 231 | * _before_ we invoke the per-device handler attached to the device. |
234 | * to the device. | ||
235 | */ | 232 | */ |
236 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 233 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
237 | 234 | ||
@@ -299,7 +296,7 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
299 | * If we don't get it now, it will be marked pending and we will | 296 | * If we don't get it now, it will be marked pending and we will |
300 | * take another interrupt when it becomes free. | 297 | * take another interrupt when it becomes free. |
301 | */ | 298 | */ |
302 | ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); | 299 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired); |
303 | if (acquired) { | 300 | if (acquired) { |
304 | 301 | ||
305 | /* Got the lock, now wake all threads waiting for it */ | 302 | /* Got the lock, now wake all threads waiting for it */ |
@@ -336,34 +333,27 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
336 | 333 | ||
337 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); | 334 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
338 | 335 | ||
339 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 336 | /* Attempt installation of the global lock handler */ |
340 | ACPI_CAST_INDIRECT_PTR(struct | ||
341 | acpi_table_header, | ||
342 | &facs)); | ||
343 | if (ACPI_FAILURE(status)) { | ||
344 | return_ACPI_STATUS(status); | ||
345 | } | ||
346 | 337 | ||
347 | acpi_gbl_global_lock_present = TRUE; | ||
348 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, | 338 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, |
349 | acpi_ev_global_lock_handler, | 339 | acpi_ev_global_lock_handler, |
350 | NULL); | 340 | NULL); |
351 | 341 | ||
352 | /* | 342 | /* |
353 | * If the global lock does not exist on this platform, the attempt | 343 | * If the global lock does not exist on this platform, the attempt to |
354 | * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick) | 344 | * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). |
355 | * Map to AE_OK, but mark global lock as not present. | 345 | * Map to AE_OK, but mark global lock as not present. Any attempt to |
356 | * Any attempt to actually use the global lock will be flagged | 346 | * actually use the global lock will be flagged with an error. |
357 | * with an error. | ||
358 | */ | 347 | */ |
359 | if (status == AE_NO_HARDWARE_RESPONSE) { | 348 | if (status == AE_NO_HARDWARE_RESPONSE) { |
360 | ACPI_ERROR((AE_INFO, | 349 | ACPI_ERROR((AE_INFO, |
361 | "No response from Global Lock hardware, disabling lock")); | 350 | "No response from Global Lock hardware, disabling lock")); |
362 | 351 | ||
363 | acpi_gbl_global_lock_present = FALSE; | 352 | acpi_gbl_global_lock_present = FALSE; |
364 | status = AE_OK; | 353 | return_ACPI_STATUS(AE_OK); |
365 | } | 354 | } |
366 | 355 | ||
356 | acpi_gbl_global_lock_present = TRUE; | ||
367 | return_ACPI_STATUS(status); | 357 | return_ACPI_STATUS(status); |
368 | } | 358 | } |
369 | 359 | ||
@@ -462,8 +452,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
462 | } | 452 | } |
463 | 453 | ||
464 | /* | 454 | /* |
465 | * Make sure that a global lock actually exists. If not, just treat | 455 | * Make sure that a global lock actually exists. If not, just treat the |
466 | * the lock as a standard mutex. | 456 | * lock as a standard mutex. |
467 | */ | 457 | */ |
468 | if (!acpi_gbl_global_lock_present) { | 458 | if (!acpi_gbl_global_lock_present) { |
469 | acpi_gbl_global_lock_acquired = TRUE; | 459 | acpi_gbl_global_lock_acquired = TRUE; |
@@ -472,7 +462,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
472 | 462 | ||
473 | /* Attempt to acquire the actual hardware lock */ | 463 | /* Attempt to acquire the actual hardware lock */ |
474 | 464 | ||
475 | ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); | 465 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired); |
476 | if (acquired) { | 466 | if (acquired) { |
477 | 467 | ||
478 | /* We got the lock */ | 468 | /* We got the lock */ |
@@ -536,7 +526,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
536 | 526 | ||
537 | /* Allow any thread to release the lock */ | 527 | /* Allow any thread to release the lock */ |
538 | 528 | ||
539 | ACPI_RELEASE_GLOBAL_LOCK(facs, pending); | 529 | ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending); |
540 | 530 | ||
541 | /* | 531 | /* |
542 | * If the pending bit was set, we must write GBL_RLS to the control | 532 | * If the pending bit was set, we must write GBL_RLS to the control |
@@ -582,8 +572,8 @@ void acpi_ev_terminate(void) | |||
582 | 572 | ||
583 | if (acpi_gbl_events_initialized) { | 573 | if (acpi_gbl_events_initialized) { |
584 | /* | 574 | /* |
585 | * Disable all event-related functionality. | 575 | * Disable all event-related functionality. In all cases, on error, |
586 | * In all cases, on error, print a message but obviously we don't abort. | 576 | * print a message but obviously we don't abort. |
587 | */ | 577 | */ |
588 | 578 | ||
589 | /* Disable all fixed events */ | 579 | /* Disable all fixed events */ |
@@ -599,7 +589,7 @@ void acpi_ev_terminate(void) | |||
599 | 589 | ||
600 | /* Disable all GPEs in all GPE blocks */ | 590 | /* Disable all GPEs in all GPE blocks */ |
601 | 591 | ||
602 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 592 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); |
603 | 593 | ||
604 | /* Remove SCI handler */ | 594 | /* Remove SCI handler */ |
605 | 595 | ||
@@ -617,7 +607,7 @@ void acpi_ev_terminate(void) | |||
617 | 607 | ||
618 | /* Deallocate all handler objects installed within GPE info structs */ | 608 | /* Deallocate all handler objects installed within GPE info structs */ |
619 | 609 | ||
620 | status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers); | 610 | status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL); |
621 | 611 | ||
622 | /* Return to original mode if necessary */ | 612 | /* Return to original mode if necessary */ |
623 | 613 | ||
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/acpica/evregion.c index 236fbd1ca438..665c0887ab4d 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -42,22 +42,15 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acnamesp.h" |
48 | #include "acinterp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evregion") | 51 | ACPI_MODULE_NAME("evregion") |
51 | #define ACPI_NUM_DEFAULT_SPACES 4 | ||
52 | static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { | ||
53 | ACPI_ADR_SPACE_SYSTEM_MEMORY, | ||
54 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
55 | ACPI_ADR_SPACE_PCI_CONFIG, | ||
56 | ACPI_ADR_SPACE_DATA_TABLE | ||
57 | }; | ||
58 | 52 | ||
59 | /* Local prototypes */ | 53 | /* Local prototypes */ |
60 | |||
61 | static acpi_status | 54 | static acpi_status |
62 | acpi_ev_reg_run(acpi_handle obj_handle, | 55 | acpi_ev_reg_run(acpi_handle obj_handle, |
63 | u32 level, void *context, void **return_value); | 56 | u32 level, void *context, void **return_value); |
@@ -66,6 +59,17 @@ static acpi_status | |||
66 | acpi_ev_install_handler(acpi_handle obj_handle, | 59 | acpi_ev_install_handler(acpi_handle obj_handle, |
67 | u32 level, void *context, void **return_value); | 60 | u32 level, void *context, void **return_value); |
68 | 61 | ||
62 | /* These are the address spaces that will get default handlers */ | ||
63 | |||
64 | #define ACPI_NUM_DEFAULT_SPACES 4 | ||
65 | |||
66 | static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = { | ||
67 | ACPI_ADR_SPACE_SYSTEM_MEMORY, | ||
68 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
69 | ACPI_ADR_SPACE_PCI_CONFIG, | ||
70 | ACPI_ADR_SPACE_DATA_TABLE | ||
71 | }; | ||
72 | |||
69 | /******************************************************************************* | 73 | /******************************************************************************* |
70 | * | 74 | * |
71 | * FUNCTION: acpi_ev_install_region_handlers | 75 | * FUNCTION: acpi_ev_install_region_handlers |
@@ -91,18 +95,19 @@ acpi_status acpi_ev_install_region_handlers(void) | |||
91 | } | 95 | } |
92 | 96 | ||
93 | /* | 97 | /* |
94 | * All address spaces (PCI Config, EC, SMBus) are scope dependent | 98 | * All address spaces (PCI Config, EC, SMBus) are scope dependent and |
95 | * and registration must occur for a specific device. | 99 | * registration must occur for a specific device. |
96 | * | 100 | * |
97 | * In the case of the system memory and IO address spaces there is currently | 101 | * In the case of the system memory and IO address spaces there is |
98 | * no device associated with the address space. For these we use the root. | 102 | * currently no device associated with the address space. For these we |
103 | * use the root. | ||
99 | * | 104 | * |
100 | * We install the default PCI config space handler at the root so | 105 | * We install the default PCI config space handler at the root so that |
101 | * that this space is immediately available even though the we have | 106 | * this space is immediately available even though the we have not |
102 | * not enumerated all the PCI Root Buses yet. This is to conform | 107 | * enumerated all the PCI Root Buses yet. This is to conform to the ACPI |
103 | * to the ACPI specification which states that the PCI config | 108 | * specification which states that the PCI config space must be always |
104 | * space must be always available -- even though we are nowhere | 109 | * available -- even though we are nowhere near ready to find the PCI root |
105 | * near ready to find the PCI root buses at this point. | 110 | * buses at this point. |
106 | * | 111 | * |
107 | * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler | 112 | * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler |
108 | * has already been installed (via acpi_install_address_space_handler). | 113 | * has already been installed (via acpi_install_address_space_handler). |
@@ -160,12 +165,11 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
160 | return_ACPI_STATUS(status); | 165 | return_ACPI_STATUS(status); |
161 | } | 166 | } |
162 | 167 | ||
163 | /* | 168 | /* Run the _REG methods for op_regions in each default address space */ |
164 | * Run the _REG methods for op_regions in each default address space | ||
165 | */ | ||
166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | ||
167 | 169 | ||
168 | /* TBD: Make sure handler is the DEFAULT handler, otherwise | 170 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { |
171 | /* | ||
172 | * TBD: Make sure handler is the DEFAULT handler, otherwise | ||
169 | * _REG will have already been run. | 173 | * _REG will have already been run. |
170 | */ | 174 | */ |
171 | status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, | 175 | 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, | |||
318 | } | 322 | } |
319 | 323 | ||
320 | /* | 324 | /* |
321 | * It may be the case that the region has never been initialized | 325 | * It may be the case that the region has never been initialized. |
322 | * Some types of regions require special init code | 326 | * Some types of regions require special init code |
323 | */ | 327 | */ |
324 | if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { | 328 | if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { |
325 | /* | 329 | |
326 | * This region has not been initialized yet, do it | 330 | /* This region has not been initialized yet, do it */ |
327 | */ | 331 | |
328 | region_setup = handler_desc->address_space.setup; | 332 | region_setup = handler_desc->address_space.setup; |
329 | if (!region_setup) { | 333 | if (!region_setup) { |
330 | 334 | ||
@@ -339,9 +343,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
339 | } | 343 | } |
340 | 344 | ||
341 | /* | 345 | /* |
342 | * We must exit the interpreter because the region | 346 | * We must exit the interpreter because the region setup will |
343 | * setup will potentially execute control methods | 347 | * potentially execute control methods (for example, the _REG method |
344 | * (e.g., _REG method for this region) | 348 | * for this region) |
345 | */ | 349 | */ |
346 | acpi_ex_exit_interpreter(); | 350 | acpi_ex_exit_interpreter(); |
347 | 351 | ||
@@ -364,9 +368,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
364 | return_ACPI_STATUS(status); | 368 | return_ACPI_STATUS(status); |
365 | } | 369 | } |
366 | 370 | ||
367 | /* | 371 | /* Region initialization may have been completed by region_setup */ |
368 | * Region initialization may have been completed by region_setup | 372 | |
369 | */ | ||
370 | if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { | 373 | if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { |
371 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; | 374 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; |
372 | 375 | ||
@@ -521,8 +524,8 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
521 | } | 524 | } |
522 | 525 | ||
523 | /* | 526 | /* |
524 | * If the region has been activated, call the setup handler | 527 | * If the region has been activated, call the setup handler with |
525 | * with the deactivate notification | 528 | * the deactivate notification |
526 | */ | 529 | */ |
527 | if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { | 530 | if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { |
528 | region_setup = handler_obj->address_space.setup; | 531 | region_setup = handler_obj->address_space.setup; |
@@ -668,8 +671,8 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
668 | } | 671 | } |
669 | 672 | ||
670 | /* | 673 | /* |
671 | * We only care about regions.and objects | 674 | * We only care about regions and objects that are allowed to have |
672 | * that are allowed to have address space handlers | 675 | * address space handlers |
673 | */ | 676 | */ |
674 | if ((node->type != ACPI_TYPE_DEVICE) && | 677 | if ((node->type != ACPI_TYPE_DEVICE) && |
675 | (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { | 678 | (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { |
@@ -710,9 +713,9 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
710 | /* | 713 | /* |
711 | * Since the object we found it on was a device, then it | 714 | * Since the object we found it on was a device, then it |
712 | * means that someone has already installed a handler for | 715 | * means that someone has already installed a handler for |
713 | * the branch of the namespace from this device on. Just | 716 | * the branch of the namespace from this device on. Just |
714 | * bail out telling the walk routine to not traverse this | 717 | * bail out telling the walk routine to not traverse this |
715 | * branch. This preserves the scoping rule for handlers. | 718 | * branch. This preserves the scoping rule for handlers. |
716 | */ | 719 | */ |
717 | return (AE_CTRL_DEPTH); | 720 | return (AE_CTRL_DEPTH); |
718 | } | 721 | } |
@@ -723,9 +726,8 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
723 | } | 726 | } |
724 | 727 | ||
725 | /* | 728 | /* |
726 | * As long as the device didn't have a handler for this | 729 | * As long as the device didn't have a handler for this space we |
727 | * space we don't care about it. We just ignore it and | 730 | * don't care about it. We just ignore it and proceed. |
728 | * proceed. | ||
729 | */ | 731 | */ |
730 | return (AE_OK); | 732 | return (AE_OK); |
731 | } | 733 | } |
@@ -733,16 +735,14 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
733 | /* Object is a Region */ | 735 | /* Object is a Region */ |
734 | 736 | ||
735 | if (obj_desc->region.space_id != handler_obj->address_space.space_id) { | 737 | if (obj_desc->region.space_id != handler_obj->address_space.space_id) { |
736 | /* | 738 | |
737 | * This region is for a different address space | 739 | /* This region is for a different address space, just ignore it */ |
738 | * -- just ignore it | 740 | |
739 | */ | ||
740 | return (AE_OK); | 741 | return (AE_OK); |
741 | } | 742 | } |
742 | 743 | ||
743 | /* | 744 | /* |
744 | * Now we have a region and it is for the handler's address | 745 | * Now we have a region and it is for the handler's address space type. |
745 | * space type. | ||
746 | * | 746 | * |
747 | * First disconnect region for any previous handler (if any) | 747 | * First disconnect region for any previous handler (if any) |
748 | */ | 748 | */ |
@@ -786,9 +786,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
786 | ACPI_FUNCTION_TRACE(ev_install_space_handler); | 786 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
787 | 787 | ||
788 | /* | 788 | /* |
789 | * This registration is valid for only the types below | 789 | * This registration is valid for only the types below and the root. This |
790 | * and the root. This is where the default handlers | 790 | * is where the default handlers get placed. |
791 | * get placed. | ||
792 | */ | 791 | */ |
793 | if ((node->type != ACPI_TYPE_DEVICE) && | 792 | if ((node->type != ACPI_TYPE_DEVICE) && |
794 | (node->type != ACPI_TYPE_PROCESSOR) && | 793 | (node->type != ACPI_TYPE_PROCESSOR) && |
@@ -848,8 +847,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
848 | obj_desc = acpi_ns_get_attached_object(node); | 847 | obj_desc = acpi_ns_get_attached_object(node); |
849 | if (obj_desc) { | 848 | if (obj_desc) { |
850 | /* | 849 | /* |
851 | * The attached device object already exists. | 850 | * The attached device object already exists. Make sure the handler |
852 | * Make sure the handler is not already installed. | 851 | * is not already installed. |
853 | */ | 852 | */ |
854 | handler_obj = obj_desc->device.handler; | 853 | handler_obj = obj_desc->device.handler; |
855 | 854 | ||
@@ -864,8 +863,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
864 | handler) { | 863 | handler) { |
865 | /* | 864 | /* |
866 | * It is (relatively) OK to attempt to install the SAME | 865 | * It is (relatively) OK to attempt to install the SAME |
867 | * handler twice. This can easily happen | 866 | * handler twice. This can easily happen with the |
868 | * with PCI_Config space. | 867 | * PCI_Config space. |
869 | */ | 868 | */ |
870 | status = AE_SAME_HANDLER; | 869 | status = AE_SAME_HANDLER; |
871 | goto unlock_and_exit; | 870 | goto unlock_and_exit; |
@@ -925,9 +924,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
925 | /* | 924 | /* |
926 | * Install the handler | 925 | * Install the handler |
927 | * | 926 | * |
928 | * At this point there is no existing handler. | 927 | * At this point there is no existing handler. Just allocate the object |
929 | * Just allocate the object for the handler and link it | 928 | * for the handler and link it into the list. |
930 | * into the list. | ||
931 | */ | 929 | */ |
932 | handler_obj = | 930 | handler_obj = |
933 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); | 931 | acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); |
@@ -1000,11 +998,10 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
1000 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); | 998 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); |
1001 | 999 | ||
1002 | /* | 1000 | /* |
1003 | * Run all _REG methods for all Operation Regions for this | 1001 | * Run all _REG methods for all Operation Regions for this space ID. This |
1004 | * space ID. This is a separate walk in order to handle any | 1002 | * is a separate walk in order to handle any interdependencies between |
1005 | * interdependencies between regions and _REG methods. (i.e. handlers | 1003 | * regions and _REG methods. (i.e. handlers must be installed for all |
1006 | * must be installed for all regions of this Space ID before we | 1004 | * regions of this Space ID before we can run any _REG methods) |
1007 | * can run any _REG methods) | ||
1008 | */ | 1005 | */ |
1009 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, | 1006 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, |
1010 | ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, | 1007 | ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, |
@@ -1042,8 +1039,8 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
1042 | } | 1039 | } |
1043 | 1040 | ||
1044 | /* | 1041 | /* |
1045 | * We only care about regions.and objects | 1042 | * We only care about regions.and objects that are allowed to have address |
1046 | * that are allowed to have address space handlers | 1043 | * space handlers |
1047 | */ | 1044 | */ |
1048 | if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { | 1045 | if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { |
1049 | return (AE_OK); | 1046 | return (AE_OK); |
@@ -1062,10 +1059,9 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
1062 | /* Object is a Region */ | 1059 | /* Object is a Region */ |
1063 | 1060 | ||
1064 | if (obj_desc->region.space_id != space_id) { | 1061 | if (obj_desc->region.space_id != space_id) { |
1065 | /* | 1062 | |
1066 | * This region is for a different address space | 1063 | /* This region is for a different address space, just ignore it */ |
1067 | * -- just ignore it | 1064 | |
1068 | */ | ||
1069 | return (AE_OK); | 1065 | return (AE_OK); |
1070 | } | 1066 | } |
1071 | 1067 | ||
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 6b94b38df07d..f3f1fb45c3dc 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME("evrgnini") | 50 | ACPI_MODULE_NAME("evrgnini") |
@@ -233,9 +234,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
233 | if (ACPI_FAILURE(status)) { | 234 | if (ACPI_FAILURE(status)) { |
234 | if (status == AE_SAME_HANDLER) { | 235 | if (status == AE_SAME_HANDLER) { |
235 | /* | 236 | /* |
236 | * It is OK if the handler is already installed on the root | 237 | * It is OK if the handler is already installed on the |
237 | * bridge. Still need to return a context object for the | 238 | * root bridge. Still need to return a context object |
238 | * new PCI_Config operation region, however. | 239 | * for the new PCI_Config operation region, however. |
239 | */ | 240 | */ |
240 | status = AE_OK; | 241 | status = AE_OK; |
241 | } else { | 242 | } else { |
@@ -272,8 +273,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
272 | } | 273 | } |
273 | 274 | ||
274 | /* | 275 | /* |
275 | * For PCI_Config space access, we need the segment, bus, | 276 | * For PCI_Config space access, we need the segment, bus, device and |
276 | * device and function numbers. Acquire them here. | 277 | * function numbers. Acquire them here. |
277 | * | 278 | * |
278 | * Find the parent device object. (This allows the operation region to be | 279 | * Find the parent device object. (This allows the operation region to be |
279 | * within a subscope under the device, such as a control method.) | 280 | * within a subscope under the device, such as a control method.) |
@@ -289,16 +290,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
289 | } | 290 | } |
290 | 291 | ||
291 | /* | 292 | /* |
292 | * Get the PCI device and function numbers from the _ADR object | 293 | * Get the PCI device and function numbers from the _ADR object contained |
293 | * contained in the parent's scope. | 294 | * in the parent's scope. |
294 | */ | 295 | */ |
295 | status = | 296 | status = |
296 | acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node, | 297 | acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node, |
297 | &pci_value); | 298 | &pci_value); |
298 | 299 | ||
299 | /* | 300 | /* |
300 | * The default is zero, and since the allocation above zeroed | 301 | * The default is zero, and since the allocation above zeroed the data, |
301 | * the data, just do nothing on failure. | 302 | * just do nothing on failure. |
302 | */ | 303 | */ |
303 | if (ACPI_SUCCESS(status)) { | 304 | if (ACPI_SUCCESS(status)) { |
304 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value)); | 305 | 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) | |||
382 | struct acpi_compatible_id_list *cid; | 383 | struct acpi_compatible_id_list *cid; |
383 | u32 i; | 384 | u32 i; |
384 | 385 | ||
385 | /* | 386 | /* Get the _HID and check for a PCI Root Bridge */ |
386 | * Get the _HID and check for a PCI Root Bridge | 387 | |
387 | */ | ||
388 | status = acpi_ut_execute_HID(node, &hid); | 388 | status = acpi_ut_execute_HID(node, &hid); |
389 | if (ACPI_FAILURE(status)) { | 389 | if (ACPI_FAILURE(status)) { |
390 | return (FALSE); | 390 | return (FALSE); |
@@ -394,10 +394,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | |||
394 | return (TRUE); | 394 | return (TRUE); |
395 | } | 395 | } |
396 | 396 | ||
397 | /* | 397 | /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */ |
398 | * The _HID did not match. | 398 | |
399 | * Get the _CID and check for a PCI Root Bridge | ||
400 | */ | ||
401 | status = acpi_ut_execute_CID(node, &cid); | 399 | status = acpi_ut_execute_CID(node, &cid); |
402 | if (ACPI_FAILURE(status)) { | 400 | if (ACPI_FAILURE(status)) { |
403 | return (FALSE); | 401 | return (FALSE); |
@@ -516,9 +514,9 @@ acpi_ev_default_region_setup(acpi_handle handle, | |||
516 | * Get the appropriate address space handler for a newly | 514 | * Get the appropriate address space handler for a newly |
517 | * created region. | 515 | * created region. |
518 | * | 516 | * |
519 | * This also performs address space specific initialization. For | 517 | * This also performs address space specific initialization. For |
520 | * example, PCI regions must have an _ADR object that contains | 518 | * example, PCI regions must have an _ADR object that contains |
521 | * a PCI address in the scope of the definition. This address is | 519 | * a PCI address in the scope of the definition. This address is |
522 | * required to perform an access to PCI config space. | 520 | * required to perform an access to PCI config space. |
523 | * | 521 | * |
524 | * MUTEX: Interpreter should be unlocked, because we may run the _REG | 522 | * 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, | |||
572 | if (ACPI_SUCCESS(status)) { | 570 | if (ACPI_SUCCESS(status)) { |
573 | /* | 571 | /* |
574 | * The _REG method is optional and there can be only one per region | 572 | * The _REG method is optional and there can be only one per region |
575 | * definition. This will be executed when the handler is attached | 573 | * definition. This will be executed when the handler is attached |
576 | * or removed | 574 | * or removed |
577 | */ | 575 | */ |
578 | region_obj2->extra.method_REG = method_node; | 576 | region_obj2->extra.method_REG = method_node; |
@@ -670,10 +668,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
670 | } | 668 | } |
671 | } | 669 | } |
672 | 670 | ||
673 | /* | 671 | /* This node does not have the handler we need; Pop up one level */ |
674 | * This node does not have the handler we need; | 672 | |
675 | * Pop up one level | ||
676 | */ | ||
677 | node = acpi_ns_get_parent_node(node); | 673 | node = acpi_ns_get_parent_node(node); |
678 | } | 674 | } |
679 | 675 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/acpica/evsci.c index 2a8b77877610..567b356c85af 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acevents.h> | 46 | #include "accommon.h" |
47 | #include "acevents.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
49 | ACPI_MODULE_NAME("evsci") | 50 | ACPI_MODULE_NAME("evsci") |
@@ -115,10 +116,8 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
115 | * if this interrupt handler is installed, ACPI is enabled. | 116 | * if this interrupt handler is installed, ACPI is enabled. |
116 | */ | 117 | */ |
117 | 118 | ||
118 | /* | 119 | /* GPEs: Check for and dispatch any GPEs that have occurred */ |
119 | * GPEs: | 120 | |
120 | * Check for and dispatch any GPEs that have occurred | ||
121 | */ | ||
122 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); | 121 | interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); |
123 | 122 | ||
124 | return_UINT32(interrupt_handled); | 123 | return_UINT32(interrupt_handled); |
@@ -158,11 +157,11 @@ u32 acpi_ev_install_sci_handler(void) | |||
158 | * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not | 157 | * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not |
159 | * installed to begin with | 158 | * installed to begin with |
160 | * | 159 | * |
161 | * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be | 160 | * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be |
162 | * taken. | 161 | * taken. |
163 | * | 162 | * |
164 | * Note: It doesn't seem important to disable all events or set the event | 163 | * Note: It doesn't seem important to disable all events or set the event |
165 | * enable registers to their original values. The OS should disable | 164 | * enable registers to their original values. The OS should disable |
166 | * the SCI interrupt level when the handler is removed, so no more | 165 | * the SCI interrupt level when the handler is removed, so no more |
167 | * events will come in. | 166 | * events will come in. |
168 | * | 167 | * |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/acpica/evxface.c index 94a6efe020be..3aca9010a11e 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acevents.h> | 46 | #include "acnamesp.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acevents.h" |
48 | #include "acinterp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evxface") | 51 | ACPI_MODULE_NAME("evxface") |
@@ -267,7 +268,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
267 | /* | 268 | /* |
268 | * Root Object: | 269 | * Root Object: |
269 | * Registering a notify handler on the root object indicates that the | 270 | * Registering a notify handler on the root object indicates that the |
270 | * caller wishes to receive notifications for all objects. Note that | 271 | * caller wishes to receive notifications for all objects. Note that |
271 | * only one <external> global handler can be regsitered (per notify type). | 272 | * only one <external> global handler can be regsitered (per notify type). |
272 | */ | 273 | */ |
273 | if (device == ACPI_ROOT_OBJECT) { | 274 | if (device == ACPI_ROOT_OBJECT) { |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 41554f736b68..35485e4b60a6 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -42,13 +42,19 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include <acpi/actables.h> | 47 | #include "acnamesp.h" |
48 | #include "actables.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evxfevnt") | 51 | ACPI_MODULE_NAME("evxfevnt") |
51 | 52 | ||
53 | /* Local prototypes */ | ||
54 | acpi_status | ||
55 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
56 | struct acpi_gpe_block_info *gpe_block, void *context); | ||
57 | |||
52 | /******************************************************************************* | 58 | /******************************************************************************* |
53 | * | 59 | * |
54 | * FUNCTION: acpi_enable | 60 | * FUNCTION: acpi_enable |
@@ -60,6 +66,7 @@ ACPI_MODULE_NAME("evxfevnt") | |||
60 | * DESCRIPTION: Transfers the system into ACPI mode. | 66 | * DESCRIPTION: Transfers the system into ACPI mode. |
61 | * | 67 | * |
62 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | |||
63 | acpi_status acpi_enable(void) | 70 | acpi_status acpi_enable(void) |
64 | { | 71 | { |
65 | acpi_status status = AE_OK; | 72 | acpi_status status = AE_OK; |
@@ -161,8 +168,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) | |||
161 | } | 168 | } |
162 | 169 | ||
163 | /* | 170 | /* |
164 | * Enable the requested fixed event (by writing a one to the | 171 | * Enable the requested fixed event (by writing a one to the enable |
165 | * enable register bit) | 172 | * register bit) |
166 | */ | 173 | */ |
167 | status = | 174 | status = |
168 | acpi_set_register(acpi_gbl_fixed_event_info[event]. | 175 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
@@ -343,8 +350,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags) | |||
343 | } | 350 | } |
344 | 351 | ||
345 | /* | 352 | /* |
346 | * Disable the requested fixed event (by writing a zero to the | 353 | * Disable the requested fixed event (by writing a zero to the enable |
347 | * enable register bit) | 354 | * register bit) |
348 | */ | 355 | */ |
349 | status = | 356 | status = |
350 | acpi_set_register(acpi_gbl_fixed_event_info[event]. | 357 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
@@ -396,8 +403,8 @@ acpi_status acpi_clear_event(u32 event) | |||
396 | } | 403 | } |
397 | 404 | ||
398 | /* | 405 | /* |
399 | * Clear the requested fixed event (By writing a one to the | 406 | * Clear the requested fixed event (By writing a one to the status |
400 | * status register bit) | 407 | * register bit) |
401 | */ | 408 | */ |
402 | status = | 409 | status = |
403 | acpi_set_register(acpi_gbl_fixed_event_info[event]. | 410 | acpi_set_register(acpi_gbl_fixed_event_info[event]. |
@@ -717,3 +724,148 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
717 | } | 724 | } |
718 | 725 | ||
719 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) | 726 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) |
727 | |||
728 | /******************************************************************************* | ||
729 | * | ||
730 | * FUNCTION: acpi_get_gpe_device | ||
731 | * | ||
732 | * PARAMETERS: Index - System GPE index (0-current_gpe_count) | ||
733 | * gpe_device - Where the parent GPE Device is returned | ||
734 | * | ||
735 | * RETURN: Status | ||
736 | * | ||
737 | * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL | ||
738 | * gpe device indicates that the gpe number is contained in one of | ||
739 | * the FADT-defined gpe blocks. Otherwise, the GPE block device. | ||
740 | * | ||
741 | ******************************************************************************/ | ||
742 | acpi_status | ||
743 | acpi_get_gpe_device(u32 index, acpi_handle *gpe_device) | ||
744 | { | ||
745 | struct acpi_gpe_device_info info; | ||
746 | acpi_status status; | ||
747 | |||
748 | ACPI_FUNCTION_TRACE(acpi_get_gpe_device); | ||
749 | |||
750 | if (!gpe_device) { | ||
751 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
752 | } | ||
753 | |||
754 | if (index >= acpi_current_gpe_count) { | ||
755 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
756 | } | ||
757 | |||
758 | /* Setup and walk the GPE list */ | ||
759 | |||
760 | info.index = index; | ||
761 | info.status = AE_NOT_EXIST; | ||
762 | info.gpe_device = NULL; | ||
763 | info.next_block_base_index = 0; | ||
764 | |||
765 | status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info); | ||
766 | if (ACPI_FAILURE(status)) { | ||
767 | return_ACPI_STATUS(status); | ||
768 | } | ||
769 | |||
770 | *gpe_device = info.gpe_device; | ||
771 | return_ACPI_STATUS(info.status); | ||
772 | } | ||
773 | |||
774 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_device) | ||
775 | |||
776 | /******************************************************************************* | ||
777 | * | ||
778 | * FUNCTION: acpi_ev_get_gpe_device | ||
779 | * | ||
780 | * PARAMETERS: GPE_WALK_CALLBACK | ||
781 | * | ||
782 | * RETURN: Status | ||
783 | * | ||
784 | * DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE | ||
785 | * block device. NULL if the GPE is one of the FADT-defined GPEs. | ||
786 | * | ||
787 | ******************************************************************************/ | ||
788 | acpi_status | ||
789 | acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | ||
790 | struct acpi_gpe_block_info *gpe_block, void *context) | ||
791 | { | ||
792 | struct acpi_gpe_device_info *info = context; | ||
793 | |||
794 | /* Increment Index by the number of GPEs in this block */ | ||
795 | |||
796 | info->next_block_base_index += | ||
797 | (gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH); | ||
798 | |||
799 | if (info->index < info->next_block_base_index) { | ||
800 | /* | ||
801 | * The GPE index is within this block, get the node. Leave the node | ||
802 | * NULL for the FADT-defined GPEs | ||
803 | */ | ||
804 | if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) { | ||
805 | info->gpe_device = gpe_block->node; | ||
806 | } | ||
807 | |||
808 | info->status = AE_OK; | ||
809 | return (AE_CTRL_END); | ||
810 | } | ||
811 | |||
812 | return (AE_OK); | ||
813 | } | ||
814 | |||
815 | /****************************************************************************** | ||
816 | * | ||
817 | * FUNCTION: acpi_disable_all_gpes | ||
818 | * | ||
819 | * PARAMETERS: None | ||
820 | * | ||
821 | * RETURN: Status | ||
822 | * | ||
823 | * DESCRIPTION: Disable and clear all GPEs in all GPE blocks | ||
824 | * | ||
825 | ******************************************************************************/ | ||
826 | |||
827 | acpi_status acpi_disable_all_gpes(void) | ||
828 | { | ||
829 | acpi_status status; | ||
830 | |||
831 | ACPI_FUNCTION_TRACE(acpi_disable_all_gpes); | ||
832 | |||
833 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
834 | if (ACPI_FAILURE(status)) { | ||
835 | return_ACPI_STATUS(status); | ||
836 | } | ||
837 | |||
838 | status = acpi_hw_disable_all_gpes(); | ||
839 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
840 | |||
841 | return_ACPI_STATUS(status); | ||
842 | } | ||
843 | |||
844 | /****************************************************************************** | ||
845 | * | ||
846 | * FUNCTION: acpi_enable_all_runtime_gpes | ||
847 | * | ||
848 | * PARAMETERS: None | ||
849 | * | ||
850 | * RETURN: Status | ||
851 | * | ||
852 | * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks | ||
853 | * | ||
854 | ******************************************************************************/ | ||
855 | |||
856 | acpi_status acpi_enable_all_runtime_gpes(void) | ||
857 | { | ||
858 | acpi_status status; | ||
859 | |||
860 | ACPI_FUNCTION_TRACE(acpi_enable_all_runtime_gpes); | ||
861 | |||
862 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
863 | if (ACPI_FAILURE(status)) { | ||
864 | return_ACPI_STATUS(status); | ||
865 | } | ||
866 | |||
867 | status = acpi_hw_enable_all_runtime_gpes(); | ||
868 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
869 | |||
870 | return_ACPI_STATUS(status); | ||
871 | } | ||
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index e8750807e57d..479e7a3721be 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acevents.h> | 47 | #include "acnamesp.h" |
48 | #include "acevents.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EVENTS | 50 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evxfregn") | 51 | ACPI_MODULE_NAME("evxfregn") |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/acpica/exconfig.c index 74da6fa52ef1..932bbc26aa04 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -42,10 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acinterp.h" |
47 | #include <acpi/actables.h> | 47 | #include "acnamesp.h" |
48 | #include <acpi/acdispat.h> | 48 | #include "actables.h" |
49 | #include "acdispat.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exconfig") | 52 | ACPI_MODULE_NAME("exconfig") |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 1d1f35adddde..0be10188316e 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acinterp.h" |
47 | #include "amlcode.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
49 | ACPI_MODULE_NAME("exconvrt") | 50 | ACPI_MODULE_NAME("exconvrt") |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/acpica/excreate.c index ad09696d5069..a57ad2564ab0 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acinterp.h" |
47 | #include <acpi/acnamesp.h> | 47 | #include "amlcode.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("excreate") | 51 | ACPI_MODULE_NAME("excreate") |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/acpica/exdump.c index d087a7d28aa5..aa313574b0df 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acinterp.h" |
47 | #include <acpi/acnamesp.h> | 47 | #include "amlcode.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exdump") | 51 | ACPI_MODULE_NAME("exdump") |
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/acpica/exfield.c index 3e440d84226a..a352d0233857 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdispat.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acinterp.h> | 46 | #include "acdispat.h" |
47 | #include "acinterp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
49 | ACPI_MODULE_NAME("exfield") | 50 | ACPI_MODULE_NAME("exfield") |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/acpica/exfldio.c index 9ff9d1f4615d..ef58ac4e687b 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -42,10 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acinterp.h" |
47 | #include <acpi/acevents.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acdispat.h> | 48 | #include "acevents.h" |
49 | #include "acdispat.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exfldio") | 52 | ACPI_MODULE_NAME("exfldio") |
@@ -498,14 +499,13 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
498 | return_ACPI_STATUS(status); | 499 | return_ACPI_STATUS(status); |
499 | } | 500 | } |
500 | 501 | ||
501 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
502 | "I/O to Data Register: ValuePtr %p\n", | ||
503 | value)); | ||
504 | |||
505 | if (read_write == ACPI_READ) { | 502 | if (read_write == ACPI_READ) { |
506 | 503 | ||
507 | /* Read the datum from the data_register */ | 504 | /* Read the datum from the data_register */ |
508 | 505 | ||
506 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
507 | "Read from Data Register\n")); | ||
508 | |||
509 | status = | 509 | status = |
510 | acpi_ex_extract_from_field(obj_desc->index_field. | 510 | acpi_ex_extract_from_field(obj_desc->index_field. |
511 | data_obj, value, | 511 | data_obj, value, |
@@ -513,6 +513,10 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
513 | } else { | 513 | } else { |
514 | /* Write the datum to the data_register */ | 514 | /* Write the datum to the data_register */ |
515 | 515 | ||
516 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
517 | "Write to Data Register: Value %8.8X%8.8X\n", | ||
518 | ACPI_FORMAT_UINT64(*value))); | ||
519 | |||
516 | status = | 520 | status = |
517 | acpi_ex_insert_into_field(obj_desc->index_field. | 521 | acpi_ex_insert_into_field(obj_desc->index_field. |
518 | data_obj, value, | 522 | data_obj, value, |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/acpica/exmisc.c index efb191340059..6b0747ac683b 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acinterp.h" |
48 | #include <acpi/amlresrc.h> | 48 | #include "amlcode.h" |
49 | #include "amlresrc.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exmisc") | 52 | ACPI_MODULE_NAME("exmisc") |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/acpica/exmutex.c index a8bf3d713e28..d301c1f363ef 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acevents.h> | 47 | #include "acinterp.h" |
48 | #include "acevents.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exmutex") | 51 | ACPI_MODULE_NAME("exmutex") |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/acpica/exnames.c index 817e67be3697..ffdae122d94a 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acinterp.h" |
48 | #include "amlcode.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exnames") | 51 | ACPI_MODULE_NAME("exnames") |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index f622f9eac8a1..b530480cc7d5 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
@@ -43,11 +43,12 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "acparser.h" |
48 | #include <acpi/acinterp.h> | 48 | #include "acdispat.h" |
49 | #include <acpi/amlcode.h> | 49 | #include "acinterp.h" |
50 | #include <acpi/acnamesp.h> | 50 | #include "amlcode.h" |
51 | #include "acnamesp.h" | ||
51 | 52 | ||
52 | #define _COMPONENT ACPI_EXECUTER | 53 | #define _COMPONENT ACPI_EXECUTER |
53 | ACPI_MODULE_NAME("exoparg1") | 54 | ACPI_MODULE_NAME("exoparg1") |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index 368def5dffce..0b4f513ca885 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
@@ -42,10 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acinterp.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acevents.h> | 47 | #include "acinterp.h" |
48 | #include <acpi/amlcode.h> | 48 | #include "acevents.h" |
49 | #include "amlcode.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exoparg2") | 52 | ACPI_MODULE_NAME("exoparg2") |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index 9cb4197681af..c6520bbf882b 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acparser.h> | 47 | #include "acinterp.h" |
48 | #include <acpi/amlcode.h> | 48 | #include "acparser.h" |
49 | #include "amlcode.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exoparg3") | 52 | ACPI_MODULE_NAME("exoparg3") |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 67d48737af53..ae43f7670a6c 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acparser.h> | 47 | #include "acinterp.h" |
48 | #include <acpi/amlcode.h> | 48 | #include "acparser.h" |
49 | #include "amlcode.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exoparg6") | 52 | ACPI_MODULE_NAME("exoparg6") |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/acpica/exprep.c index a7dc87ecee37..a226f74d4a5c 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acinterp.h" |
48 | #include <acpi/acnamesp.h> | 48 | #include "amlcode.h" |
49 | #include "acnamesp.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exprep") | 52 | ACPI_MODULE_NAME("exprep") |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/acpica/exregion.c index 7a41c409ae4d..76ec8ff903b8 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include "acinterp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
49 | ACPI_MODULE_NAME("exregion") | 50 | ACPI_MODULE_NAME("exregion") |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/acpica/exresnte.c index 423ad3635f3d..a063a74006f6 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acdispat.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include <acpi/acnamesp.h> | 48 | #include "acinterp.h" |
49 | #include "acnamesp.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exresnte") | 52 | ACPI_MODULE_NAME("exresnte") |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/acpica/exresolv.c index 60e8c47128e9..f6105a6d6126 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
@@ -43,10 +43,11 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/amlcode.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acinterp.h> | 48 | #include "acdispat.h" |
49 | #include <acpi/acnamesp.h> | 49 | #include "acinterp.h" |
50 | #include "acnamesp.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("exresolv") | 53 | ACPI_MODULE_NAME("exresolv") |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/acpica/exresop.c index 0bb82593da72..3c3802764bfb 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
@@ -43,10 +43,11 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/amlcode.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acparser.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acinterp.h> | 48 | #include "acparser.h" |
49 | #include <acpi/acnamesp.h> | 49 | #include "acinterp.h" |
50 | #include "acnamesp.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("exresop") | 53 | ACPI_MODULE_NAME("exresop") |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/acpica/exstore.c index 1c118ba78adb..e35e9b4f6a4e 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
@@ -43,10 +43,11 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acdispat.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include <acpi/amlcode.h> | 48 | #include "acinterp.h" |
49 | #include <acpi/acnamesp.h> | 49 | #include "amlcode.h" |
50 | #include "acnamesp.h" | ||
50 | 51 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 52 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("exstore") | 53 | ACPI_MODULE_NAME("exstore") |
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/acpica/exstoren.c index eef61a00803e..145d15305f70 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
@@ -44,8 +44,9 @@ | |||
44 | */ | 44 | */ |
45 | 45 | ||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/acinterp.h> | 47 | #include "accommon.h" |
48 | #include <acpi/amlcode.h> | 48 | #include "acinterp.h" |
49 | #include "amlcode.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
51 | ACPI_MODULE_NAME("exstoren") | 52 | ACPI_MODULE_NAME("exstoren") |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/acpica/exstorob.c index 9a75ff09fb0c..67340cc70142 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include "acinterp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
49 | ACPI_MODULE_NAME("exstorob") | 50 | ACPI_MODULE_NAME("exstorob") |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/acpica/exsystem.c index 68990f1df371..3d00b9357233 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include "accommon.h" |
47 | #include "acinterp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_EXECUTER | 49 | #define _COMPONENT ACPI_EXECUTER |
49 | ACPI_MODULE_NAME("exsystem") | 50 | ACPI_MODULE_NAME("exsystem") |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/acpica/exutils.c index 86c03880b523..32b85d68e756 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -59,8 +59,9 @@ | |||
59 | #define DEFINE_AML_GLOBALS | 59 | #define DEFINE_AML_GLOBALS |
60 | 60 | ||
61 | #include <acpi/acpi.h> | 61 | #include <acpi/acpi.h> |
62 | #include <acpi/acinterp.h> | 62 | #include "accommon.h" |
63 | #include <acpi/amlcode.h> | 63 | #include "acinterp.h" |
64 | #include "amlcode.h" | ||
64 | 65 | ||
65 | #define _COMPONENT ACPI_EXECUTER | 66 | #define _COMPONENT ACPI_EXECUTER |
66 | ACPI_MODULE_NAME("exutils") | 67 | ACPI_MODULE_NAME("exutils") |
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index 816894ea839e..a9d4fea4167f 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
@@ -43,6 +43,7 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
48 | ACPI_MODULE_NAME("hwacpi") | 49 | ACPI_MODULE_NAME("hwacpi") |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 0b80db9d9197..2013b66745d2 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acevents.h> | 46 | #include "accommon.h" |
47 | #include "acevents.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 49 | #define _COMPONENT ACPI_HARDWARE |
49 | ACPI_MODULE_NAME("hwgpe") | 50 | ACPI_MODULE_NAME("hwgpe") |
@@ -51,7 +52,8 @@ ACPI_MODULE_NAME("hwgpe") | |||
51 | /* Local prototypes */ | 52 | /* Local prototypes */ |
52 | static acpi_status | 53 | static acpi_status |
53 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 54 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
54 | struct acpi_gpe_block_info *gpe_block); | 55 | struct acpi_gpe_block_info *gpe_block, |
56 | void *context); | ||
55 | 57 | ||
56 | /****************************************************************************** | 58 | /****************************************************************************** |
57 | * | 59 | * |
@@ -80,8 +82,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
80 | 82 | ||
81 | /* Get current value of the enable register that contains this GPE */ | 83 | /* Get current value of the enable register that contains this GPE */ |
82 | 84 | ||
83 | status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask, | 85 | status = acpi_read(&enable_mask, &gpe_register_info->enable_address); |
84 | &gpe_register_info->enable_address); | ||
85 | if (ACPI_FAILURE(status)) { | 86 | if (ACPI_FAILURE(status)) { |
86 | return (status); | 87 | return (status); |
87 | } | 88 | } |
@@ -95,9 +96,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
95 | 96 | ||
96 | /* Write the updated enable mask */ | 97 | /* Write the updated enable mask */ |
97 | 98 | ||
98 | status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask, | 99 | status = acpi_write(enable_mask, &gpe_register_info->enable_address); |
99 | &gpe_register_info->enable_address); | ||
100 | |||
101 | return (status); | 100 | return (status); |
102 | } | 101 | } |
103 | 102 | ||
@@ -132,8 +131,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | |||
132 | 131 | ||
133 | /* Write the entire GPE (runtime) enable register */ | 132 | /* Write the entire GPE (runtime) enable register */ |
134 | 133 | ||
135 | status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run, | 134 | status = acpi_write(gpe_register_info->enable_for_run, |
136 | &gpe_register_info->enable_address); | 135 | &gpe_register_info->enable_address); |
137 | 136 | ||
138 | return (status); | 137 | return (status); |
139 | } | 138 | } |
@@ -166,9 +165,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | |||
166 | * Write a one to the appropriate bit in the status register to | 165 | * Write a one to the appropriate bit in the status register to |
167 | * clear this GPE. | 166 | * clear this GPE. |
168 | */ | 167 | */ |
169 | status = acpi_hw_low_level_write(8, register_bit, | 168 | status = acpi_write(register_bit, |
170 | &gpe_event_info->register_info-> | 169 | &gpe_event_info->register_info->status_address); |
171 | status_address); | ||
172 | 170 | ||
173 | return (status); | 171 | return (status); |
174 | } | 172 | } |
@@ -227,9 +225,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
227 | 225 | ||
228 | /* GPE currently active (status bit == 1)? */ | 226 | /* GPE currently active (status bit == 1)? */ |
229 | 227 | ||
230 | status = | 228 | status = acpi_read(&in_byte, &gpe_register_info->status_address); |
231 | acpi_hw_low_level_read(8, &in_byte, | ||
232 | &gpe_register_info->status_address); | ||
233 | if (ACPI_FAILURE(status)) { | 229 | if (ACPI_FAILURE(status)) { |
234 | goto unlock_and_exit; | 230 | goto unlock_and_exit; |
235 | } | 231 | } |
@@ -260,8 +256,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
260 | ******************************************************************************/ | 256 | ******************************************************************************/ |
261 | 257 | ||
262 | acpi_status | 258 | acpi_status |
263 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 259 | acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
264 | struct acpi_gpe_block_info * gpe_block) | 260 | struct acpi_gpe_block_info *gpe_block, void *context) |
265 | { | 261 | { |
266 | u32 i; | 262 | u32 i; |
267 | acpi_status status; | 263 | acpi_status status; |
@@ -272,9 +268,9 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
272 | 268 | ||
273 | /* Disable all GPEs in this register */ | 269 | /* Disable all GPEs in this register */ |
274 | 270 | ||
275 | status = acpi_hw_low_level_write(8, 0x00, | 271 | status = |
276 | &gpe_block->register_info[i]. | 272 | acpi_write(0x00, |
277 | enable_address); | 273 | &gpe_block->register_info[i].enable_address); |
278 | if (ACPI_FAILURE(status)) { | 274 | if (ACPI_FAILURE(status)) { |
279 | return (status); | 275 | return (status); |
280 | } | 276 | } |
@@ -297,8 +293,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
297 | ******************************************************************************/ | 293 | ******************************************************************************/ |
298 | 294 | ||
299 | acpi_status | 295 | acpi_status |
300 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 296 | acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
301 | struct acpi_gpe_block_info * gpe_block) | 297 | struct acpi_gpe_block_info *gpe_block, void *context) |
302 | { | 298 | { |
303 | u32 i; | 299 | u32 i; |
304 | acpi_status status; | 300 | acpi_status status; |
@@ -309,9 +305,9 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
309 | 305 | ||
310 | /* Clear status on all GPEs in this register */ | 306 | /* Clear status on all GPEs in this register */ |
311 | 307 | ||
312 | status = acpi_hw_low_level_write(8, 0xFF, | 308 | status = |
313 | &gpe_block->register_info[i]. | 309 | acpi_write(0xFF, |
314 | status_address); | 310 | &gpe_block->register_info[i].status_address); |
315 | if (ACPI_FAILURE(status)) { | 311 | if (ACPI_FAILURE(status)) { |
316 | return (status); | 312 | return (status); |
317 | } | 313 | } |
@@ -335,8 +331,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
335 | ******************************************************************************/ | 331 | ******************************************************************************/ |
336 | 332 | ||
337 | acpi_status | 333 | acpi_status |
338 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | 334 | acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
339 | struct acpi_gpe_block_info * gpe_block) | 335 | struct acpi_gpe_block_info *gpe_block, void *context) |
340 | { | 336 | { |
341 | u32 i; | 337 | u32 i; |
342 | acpi_status status; | 338 | acpi_status status; |
@@ -352,12 +348,9 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
352 | 348 | ||
353 | /* Enable all "runtime" GPEs in this register */ | 349 | /* Enable all "runtime" GPEs in this register */ |
354 | 350 | ||
355 | status = | 351 | status = acpi_write(gpe_block->register_info[i].enable_for_run, |
356 | acpi_hw_low_level_write(8, | 352 | &gpe_block->register_info[i]. |
357 | gpe_block->register_info[i]. | 353 | enable_address); |
358 | enable_for_run, | ||
359 | &gpe_block->register_info[i]. | ||
360 | enable_address); | ||
361 | if (ACPI_FAILURE(status)) { | 354 | if (ACPI_FAILURE(status)) { |
362 | return (status); | 355 | return (status); |
363 | } | 356 | } |
@@ -382,7 +375,8 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
382 | 375 | ||
383 | static acpi_status | 376 | static acpi_status |
384 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 377 | acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
385 | struct acpi_gpe_block_info *gpe_block) | 378 | struct acpi_gpe_block_info *gpe_block, |
379 | void *context) | ||
386 | { | 380 | { |
387 | u32 i; | 381 | u32 i; |
388 | acpi_status status; | 382 | acpi_status status; |
@@ -396,11 +390,9 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
396 | 390 | ||
397 | /* Enable all "wake" GPEs in this register */ | 391 | /* Enable all "wake" GPEs in this register */ |
398 | 392 | ||
399 | status = acpi_hw_low_level_write(8, | 393 | status = acpi_write(gpe_block->register_info[i].enable_for_wake, |
400 | gpe_block->register_info[i]. | 394 | &gpe_block->register_info[i]. |
401 | enable_for_wake, | 395 | enable_address); |
402 | &gpe_block->register_info[i]. | ||
403 | enable_address); | ||
404 | if (ACPI_FAILURE(status)) { | 396 | if (ACPI_FAILURE(status)) { |
405 | return (status); | 397 | return (status); |
406 | } | 398 | } |
@@ -427,8 +419,8 @@ acpi_status acpi_hw_disable_all_gpes(void) | |||
427 | 419 | ||
428 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); | 420 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
429 | 421 | ||
430 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 422 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); |
431 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 423 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); |
432 | return_ACPI_STATUS(status); | 424 | return_ACPI_STATUS(status); |
433 | } | 425 | } |
434 | 426 | ||
@@ -450,7 +442,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) | |||
450 | 442 | ||
451 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); | 443 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
452 | 444 | ||
453 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); | 445 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block, NULL); |
454 | return_ACPI_STATUS(status); | 446 | return_ACPI_STATUS(status); |
455 | } | 447 | } |
456 | 448 | ||
@@ -472,6 +464,6 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) | |||
472 | 464 | ||
473 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); | 465 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
474 | 466 | ||
475 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); | 467 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block, NULL); |
476 | return_ACPI_STATUS(status); | 468 | return_ACPI_STATUS(status); |
477 | } | 469 | } |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c new file mode 100644 index 000000000000..4dc43b018517 --- /dev/null +++ b/drivers/acpi/acpica/hwregs.c | |||
@@ -0,0 +1,353 @@ | |||
1 | |||
2 | /******************************************************************************* | ||
3 | * | ||
4 | * Module Name: hwregs - Read/write access functions for the various ACPI | ||
5 | * control and status registers. | ||
6 | * | ||
7 | ******************************************************************************/ | ||
8 | |||
9 | /* | ||
10 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
11 | * All rights reserved. | ||
12 | * | ||
13 | * Redistribution and use in source and binary forms, with or without | ||
14 | * modification, are permitted provided that the following conditions | ||
15 | * are met: | ||
16 | * 1. Redistributions of source code must retain the above copyright | ||
17 | * notice, this list of conditions, and the following disclaimer, | ||
18 | * without modification. | ||
19 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
20 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
21 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
22 | * including a substantially similar Disclaimer requirement for further | ||
23 | * binary redistribution. | ||
24 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
25 | * of any contributors may be used to endorse or promote products derived | ||
26 | * from this software without specific prior written permission. | ||
27 | * | ||
28 | * Alternatively, this software may be distributed under the terms of the | ||
29 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
30 | * Software Foundation. | ||
31 | * | ||
32 | * NO WARRANTY | ||
33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
34 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
35 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
36 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
37 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
41 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
42 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
43 | * POSSIBILITY OF SUCH DAMAGES. | ||
44 | */ | ||
45 | |||
46 | #include <acpi/acpi.h> | ||
47 | #include "accommon.h" | ||
48 | #include "acnamesp.h" | ||
49 | #include "acevents.h" | ||
50 | |||
51 | #define _COMPONENT ACPI_HARDWARE | ||
52 | ACPI_MODULE_NAME("hwregs") | ||
53 | |||
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_hw_clear_acpi_status | ||
57 | * | ||
58 | * PARAMETERS: None | ||
59 | * | ||
60 | * RETURN: Status | ||
61 | * | ||
62 | * DESCRIPTION: Clears all fixed and general purpose status bits | ||
63 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | ||
64 | * | ||
65 | ******************************************************************************/ | ||
66 | acpi_status acpi_hw_clear_acpi_status(void) | ||
67 | { | ||
68 | acpi_status status; | ||
69 | acpi_cpu_flags lock_flags = 0; | ||
70 | |||
71 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); | ||
72 | |||
73 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | ||
74 | ACPI_BITMASK_ALL_FIXED_STATUS, | ||
75 | (u16) acpi_gbl_FADT.xpm1a_event_block.address)); | ||
76 | |||
77 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
78 | |||
79 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, | ||
80 | ACPI_BITMASK_ALL_FIXED_STATUS); | ||
81 | if (ACPI_FAILURE(status)) { | ||
82 | goto unlock_and_exit; | ||
83 | } | ||
84 | |||
85 | /* Clear the fixed events */ | ||
86 | |||
87 | if (acpi_gbl_FADT.xpm1b_event_block.address) { | ||
88 | status = acpi_write(ACPI_BITMASK_ALL_FIXED_STATUS, | ||
89 | &acpi_gbl_FADT.xpm1b_event_block); | ||
90 | if (ACPI_FAILURE(status)) { | ||
91 | goto unlock_and_exit; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ | ||
96 | |||
97 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); | ||
98 | |||
99 | unlock_and_exit: | ||
100 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | /******************************************************************************* | ||
105 | * | ||
106 | * FUNCTION: acpi_hw_get_register_bit_mask | ||
107 | * | ||
108 | * PARAMETERS: register_id - Index of ACPI Register to access | ||
109 | * | ||
110 | * RETURN: The bitmask to be used when accessing the register | ||
111 | * | ||
112 | * DESCRIPTION: Map register_id into a register bitmask. | ||
113 | * | ||
114 | ******************************************************************************/ | ||
115 | |||
116 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | ||
117 | { | ||
118 | ACPI_FUNCTION_ENTRY(); | ||
119 | |||
120 | if (register_id > ACPI_BITREG_MAX) { | ||
121 | ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", | ||
122 | register_id)); | ||
123 | return (NULL); | ||
124 | } | ||
125 | |||
126 | return (&acpi_gbl_bit_register_info[register_id]); | ||
127 | } | ||
128 | |||
129 | /****************************************************************************** | ||
130 | * | ||
131 | * FUNCTION: acpi_hw_register_read | ||
132 | * | ||
133 | * PARAMETERS: register_id - ACPI Register ID | ||
134 | * return_value - Where the register value is returned | ||
135 | * | ||
136 | * RETURN: Status and the value read. | ||
137 | * | ||
138 | * DESCRIPTION: Read from the specified ACPI register | ||
139 | * | ||
140 | ******************************************************************************/ | ||
141 | acpi_status | ||
142 | acpi_hw_register_read(u32 register_id, u32 * return_value) | ||
143 | { | ||
144 | u32 value1 = 0; | ||
145 | u32 value2 = 0; | ||
146 | acpi_status status; | ||
147 | |||
148 | ACPI_FUNCTION_TRACE(hw_register_read); | ||
149 | |||
150 | switch (register_id) { | ||
151 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | ||
152 | |||
153 | status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_event_block); | ||
154 | if (ACPI_FAILURE(status)) { | ||
155 | goto exit; | ||
156 | } | ||
157 | |||
158 | /* PM1B is optional */ | ||
159 | |||
160 | status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_event_block); | ||
161 | value1 |= value2; | ||
162 | break; | ||
163 | |||
164 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
165 | |||
166 | status = acpi_read(&value1, &acpi_gbl_xpm1a_enable); | ||
167 | if (ACPI_FAILURE(status)) { | ||
168 | goto exit; | ||
169 | } | ||
170 | |||
171 | /* PM1B is optional */ | ||
172 | |||
173 | status = acpi_read(&value2, &acpi_gbl_xpm1b_enable); | ||
174 | value1 |= value2; | ||
175 | break; | ||
176 | |||
177 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
178 | |||
179 | status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_control_block); | ||
180 | if (ACPI_FAILURE(status)) { | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_control_block); | ||
185 | value1 |= value2; | ||
186 | break; | ||
187 | |||
188 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
189 | |||
190 | status = acpi_read(&value1, &acpi_gbl_FADT.xpm2_control_block); | ||
191 | break; | ||
192 | |||
193 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
194 | |||
195 | status = acpi_read(&value1, &acpi_gbl_FADT.xpm_timer_block); | ||
196 | break; | ||
197 | |||
198 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | ||
199 | |||
200 | status = | ||
201 | acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); | ||
202 | break; | ||
203 | |||
204 | default: | ||
205 | ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id)); | ||
206 | status = AE_BAD_PARAMETER; | ||
207 | break; | ||
208 | } | ||
209 | |||
210 | exit: | ||
211 | |||
212 | if (ACPI_SUCCESS(status)) { | ||
213 | *return_value = value1; | ||
214 | } | ||
215 | |||
216 | return_ACPI_STATUS(status); | ||
217 | } | ||
218 | |||
219 | /****************************************************************************** | ||
220 | * | ||
221 | * FUNCTION: acpi_hw_register_write | ||
222 | * | ||
223 | * PARAMETERS: register_id - ACPI Register ID | ||
224 | * Value - The value to write | ||
225 | * | ||
226 | * RETURN: Status | ||
227 | * | ||
228 | * DESCRIPTION: Write to the specified ACPI register | ||
229 | * | ||
230 | * NOTE: In accordance with the ACPI specification, this function automatically | ||
231 | * preserves the value of the following bits, meaning that these bits cannot be | ||
232 | * changed via this interface: | ||
233 | * | ||
234 | * PM1_CONTROL[0] = SCI_EN | ||
235 | * PM1_CONTROL[9] | ||
236 | * PM1_STATUS[11] | ||
237 | * | ||
238 | * ACPI References: | ||
239 | * 1) Hardware Ignored Bits: When software writes to a register with ignored | ||
240 | * bit fields, it preserves the ignored bit fields | ||
241 | * 2) SCI_EN: OSPM always preserves this bit position | ||
242 | * | ||
243 | ******************************************************************************/ | ||
244 | |||
245 | acpi_status acpi_hw_register_write(u32 register_id, u32 value) | ||
246 | { | ||
247 | acpi_status status; | ||
248 | u32 read_value; | ||
249 | |||
250 | ACPI_FUNCTION_TRACE(hw_register_write); | ||
251 | |||
252 | switch (register_id) { | ||
253 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | ||
254 | |||
255 | /* Perform a read first to preserve certain bits (per ACPI spec) */ | ||
256 | |||
257 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, | ||
258 | &read_value); | ||
259 | if (ACPI_FAILURE(status)) { | ||
260 | goto exit; | ||
261 | } | ||
262 | |||
263 | /* Insert the bits to be preserved */ | ||
264 | |||
265 | ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, | ||
266 | read_value); | ||
267 | |||
268 | /* Now we can write the data */ | ||
269 | |||
270 | status = acpi_write(value, &acpi_gbl_FADT.xpm1a_event_block); | ||
271 | if (ACPI_FAILURE(status)) { | ||
272 | goto exit; | ||
273 | } | ||
274 | |||
275 | /* PM1B is optional */ | ||
276 | |||
277 | status = acpi_write(value, &acpi_gbl_FADT.xpm1b_event_block); | ||
278 | break; | ||
279 | |||
280 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
281 | |||
282 | status = acpi_write(value, &acpi_gbl_xpm1a_enable); | ||
283 | if (ACPI_FAILURE(status)) { | ||
284 | goto exit; | ||
285 | } | ||
286 | |||
287 | /* PM1B is optional */ | ||
288 | |||
289 | status = acpi_write(value, &acpi_gbl_xpm1b_enable); | ||
290 | break; | ||
291 | |||
292 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
293 | |||
294 | /* | ||
295 | * Perform a read first to preserve certain bits (per ACPI spec) | ||
296 | */ | ||
297 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, | ||
298 | &read_value); | ||
299 | if (ACPI_FAILURE(status)) { | ||
300 | goto exit; | ||
301 | } | ||
302 | |||
303 | /* Insert the bits to be preserved */ | ||
304 | |||
305 | ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, | ||
306 | read_value); | ||
307 | |||
308 | /* Now we can write the data */ | ||
309 | |||
310 | status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block); | ||
311 | if (ACPI_FAILURE(status)) { | ||
312 | goto exit; | ||
313 | } | ||
314 | |||
315 | status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block); | ||
316 | break; | ||
317 | |||
318 | case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ | ||
319 | |||
320 | status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block); | ||
321 | break; | ||
322 | |||
323 | case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ | ||
324 | |||
325 | status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block); | ||
326 | break; | ||
327 | |||
328 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
329 | |||
330 | status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); | ||
331 | break; | ||
332 | |||
333 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
334 | |||
335 | status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block); | ||
336 | break; | ||
337 | |||
338 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | ||
339 | |||
340 | /* SMI_CMD is currently always in IO space */ | ||
341 | |||
342 | status = | ||
343 | acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); | ||
344 | break; | ||
345 | |||
346 | default: | ||
347 | status = AE_BAD_PARAMETER; | ||
348 | break; | ||
349 | } | ||
350 | |||
351 | exit: | ||
352 | return_ACPI_STATUS(status); | ||
353 | } | ||
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 25dccdf179b9..a2af2a4f2f26 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/actables.h> | 46 | #include "accommon.h" |
47 | #include "actables.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 49 | #define _COMPONENT ACPI_HARDWARE |
49 | ACPI_MODULE_NAME("hwsleep") | 50 | ACPI_MODULE_NAME("hwsleep") |
@@ -52,31 +53,19 @@ ACPI_MODULE_NAME("hwsleep") | |||
52 | * | 53 | * |
53 | * FUNCTION: acpi_set_firmware_waking_vector | 54 | * FUNCTION: acpi_set_firmware_waking_vector |
54 | * | 55 | * |
55 | * PARAMETERS: physical_address - Physical address of ACPI real mode | 56 | * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode |
56 | * entry point. | 57 | * entry point. |
57 | * | 58 | * |
58 | * RETURN: Status | 59 | * RETURN: Status |
59 | * | 60 | * |
60 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS | 61 | * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS |
61 | * | 62 | * |
62 | ******************************************************************************/ | 63 | ******************************************************************************/ |
63 | acpi_status | 64 | acpi_status |
64 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | 65 | acpi_set_firmware_waking_vector(u32 physical_address) |
65 | { | 66 | { |
66 | struct acpi_table_facs *facs; | ||
67 | acpi_status status; | ||
68 | |||
69 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); | 67 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
70 | 68 | ||
71 | /* Get the FACS */ | ||
72 | |||
73 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | ||
74 | ACPI_CAST_INDIRECT_PTR(struct | ||
75 | acpi_table_header, | ||
76 | &facs)); | ||
77 | if (ACPI_FAILURE(status)) { | ||
78 | return_ACPI_STATUS(status); | ||
79 | } | ||
80 | 69 | ||
81 | /* | 70 | /* |
82 | * According to the ACPI specification 2.0c and later, the 64-bit | 71 | * 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) | |||
85 | * Protected Mode. Some systems (for example HP dv5-1004nr) are known | 74 | * Protected Mode. Some systems (for example HP dv5-1004nr) are known |
86 | * to fail to resume if the 64-bit vector is used. | 75 | * to fail to resume if the 64-bit vector is used. |
87 | */ | 76 | */ |
88 | if (facs->version >= 1) | ||
89 | facs->xfirmware_waking_vector = 0; | ||
90 | 77 | ||
91 | facs->firmware_waking_vector = (u32)physical_address; | 78 | /* Set the 32-bit vector */ |
79 | |||
80 | acpi_gbl_FACS->firmware_waking_vector = physical_address; | ||
81 | |||
82 | /* Clear the 64-bit vector if it exists */ | ||
83 | |||
84 | if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) { | ||
85 | acpi_gbl_FACS->xfirmware_waking_vector = 0; | ||
86 | } | ||
92 | 87 | ||
93 | return_ACPI_STATUS(AE_OK); | 88 | return_ACPI_STATUS(AE_OK); |
94 | } | 89 | } |
@@ -97,48 +92,39 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) | |||
97 | 92 | ||
98 | /******************************************************************************* | 93 | /******************************************************************************* |
99 | * | 94 | * |
100 | * FUNCTION: acpi_get_firmware_waking_vector | 95 | * FUNCTION: acpi_set_firmware_waking_vector64 |
101 | * | 96 | * |
102 | * PARAMETERS: *physical_address - Where the contents of | 97 | * PARAMETERS: physical_address - 64-bit physical address of ACPI protected |
103 | * the firmware_waking_vector field of | 98 | * mode entry point. |
104 | * the FACS will be returned. | ||
105 | * | 99 | * |
106 | * RETURN: Status, vector | 100 | * RETURN: Status |
107 | * | 101 | * |
108 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS | 102 | * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if |
103 | * it exists in the table. | ||
109 | * | 104 | * |
110 | ******************************************************************************/ | 105 | ******************************************************************************/ |
111 | #ifdef ACPI_FUTURE_USAGE | ||
112 | acpi_status | 106 | acpi_status |
113 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | 107 | acpi_set_firmware_waking_vector64(u64 physical_address) |
114 | { | 108 | { |
115 | struct acpi_table_facs *facs; | 109 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); |
116 | acpi_status status; | ||
117 | 110 | ||
118 | ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); | ||
119 | |||
120 | if (!physical_address) { | ||
121 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
122 | } | ||
123 | 111 | ||
124 | /* Get the FACS */ | 112 | /* Determine if the 64-bit vector actually exists */ |
125 | 113 | ||
126 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 114 | if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) { |
127 | ACPI_CAST_INDIRECT_PTR(struct | 115 | return_ACPI_STATUS(AE_NOT_EXIST); |
128 | acpi_table_header, | ||
129 | &facs)); | ||
130 | if (ACPI_FAILURE(status)) { | ||
131 | return_ACPI_STATUS(status); | ||
132 | } | 116 | } |
133 | 117 | ||
134 | /* Get the vector */ | 118 | /* Clear 32-bit vector, set the 64-bit X_ vector */ |
135 | *physical_address = (acpi_physical_address)facs->firmware_waking_vector; | 119 | |
120 | acpi_gbl_FACS->firmware_waking_vector = 0; | ||
121 | acpi_gbl_FACS->xfirmware_waking_vector = physical_address; | ||
136 | 122 | ||
137 | return_ACPI_STATUS(AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
138 | } | 124 | } |
139 | 125 | ||
140 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) | 126 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) |
141 | #endif | 127 | |
142 | /******************************************************************************* | 128 | /******************************************************************************* |
143 | * | 129 | * |
144 | * FUNCTION: acpi_enter_sleep_state_prep | 130 | * FUNCTION: acpi_enter_sleep_state_prep |
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index b53d575491b9..b7f522c8f023 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c | |||
@@ -43,6 +43,7 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_HARDWARE | 48 | #define _COMPONENT ACPI_HARDWARE |
48 | ACPI_MODULE_NAME("hwtimer") | 49 | ACPI_MODULE_NAME("hwtimer") |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/acpica/hwxface.c index ddf792adcf96..ae597c0ab53f 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -1,10 +1,9 @@ | |||
1 | 1 | ||
2 | /******************************************************************************* | 2 | /****************************************************************************** |
3 | * | 3 | * |
4 | * Module Name: hwregs - Read/write access functions for the various ACPI | 4 | * Module Name: hwxface - Public ACPICA hardware interfaces |
5 | * control and status registers. | ||
6 | * | 5 | * |
7 | ******************************************************************************/ | 6 | *****************************************************************************/ |
8 | 7 | ||
9 | /* | 8 | /* |
10 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
@@ -44,209 +43,208 @@ | |||
44 | */ | 43 | */ |
45 | 44 | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
48 | #include <acpi/acevents.h> | 47 | #include "acnamesp.h" |
49 | 48 | ||
50 | #define _COMPONENT ACPI_HARDWARE | 49 | #define _COMPONENT ACPI_HARDWARE |
51 | ACPI_MODULE_NAME("hwregs") | 50 | ACPI_MODULE_NAME("hwxface") |
52 | 51 | ||
53 | /******************************************************************************* | 52 | /****************************************************************************** |
54 | * | 53 | * |
55 | * FUNCTION: acpi_hw_clear_acpi_status | 54 | * FUNCTION: acpi_reset |
56 | * | 55 | * |
57 | * PARAMETERS: None | 56 | * PARAMETERS: None |
58 | * | 57 | * |
59 | * RETURN: None | 58 | * RETURN: Status |
60 | * | 59 | * |
61 | * DESCRIPTION: Clears all fixed and general purpose status bits | 60 | * DESCRIPTION: Set reset register in memory or IO space. Note: Does not |
62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 61 | * support reset register in PCI config space, this must be |
62 | * handled separately. | ||
63 | * | 63 | * |
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | acpi_status acpi_hw_clear_acpi_status(void) | 65 | acpi_status acpi_reset(void) |
66 | { | 66 | { |
67 | struct acpi_generic_address *reset_reg; | ||
67 | acpi_status status; | 68 | acpi_status status; |
68 | acpi_cpu_flags lock_flags = 0; | ||
69 | 69 | ||
70 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); | 70 | ACPI_FUNCTION_TRACE(acpi_reset); |
71 | 71 | ||
72 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | 72 | reset_reg = &acpi_gbl_FADT.reset_register; |
73 | ACPI_BITMASK_ALL_FIXED_STATUS, | ||
74 | (u16) acpi_gbl_FADT.xpm1a_event_block.address)); | ||
75 | 73 | ||
76 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | 74 | /* Check if the reset register is supported */ |
77 | 75 | ||
78 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, | 76 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
79 | ACPI_BITMASK_ALL_FIXED_STATUS); | 77 | !reset_reg->address) { |
80 | if (ACPI_FAILURE(status)) { | 78 | return_ACPI_STATUS(AE_NOT_EXIST); |
81 | goto unlock_and_exit; | ||
82 | } | 79 | } |
83 | 80 | ||
84 | /* Clear the fixed events */ | 81 | /* Write the reset value to the reset register */ |
85 | |||
86 | if (acpi_gbl_FADT.xpm1b_event_block.address) { | ||
87 | status = | ||
88 | acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS, | ||
89 | &acpi_gbl_FADT.xpm1b_event_block); | ||
90 | if (ACPI_FAILURE(status)) { | ||
91 | goto unlock_and_exit; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /* Clear the GPE Bits in all GPE registers in all GPE blocks */ | ||
96 | |||
97 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | ||
98 | 82 | ||
99 | unlock_and_exit: | 83 | status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg); |
100 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); | ||
101 | return_ACPI_STATUS(status); | 84 | return_ACPI_STATUS(status); |
102 | } | 85 | } |
103 | 86 | ||
104 | /******************************************************************************* | 87 | ACPI_EXPORT_SYMBOL(acpi_reset) |
88 | |||
89 | /****************************************************************************** | ||
105 | * | 90 | * |
106 | * FUNCTION: acpi_get_sleep_type_data | 91 | * FUNCTION: acpi_read |
107 | * | 92 | * |
108 | * PARAMETERS: sleep_state - Numeric sleep state | 93 | * PARAMETERS: Value - Where the value is returned |
109 | * *sleep_type_a - Where SLP_TYPa is returned | 94 | * Reg - GAS register structure |
110 | * *sleep_type_b - Where SLP_TYPb is returned | ||
111 | * | 95 | * |
112 | * RETURN: Status - ACPI status | 96 | * RETURN: Status |
113 | * | 97 | * |
114 | * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep | 98 | * DESCRIPTION: Read from either memory or IO space. |
115 | * state. | ||
116 | * | 99 | * |
117 | ******************************************************************************/ | 100 | ******************************************************************************/ |
118 | 101 | acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) | |
119 | acpi_status | ||
120 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | ||
121 | { | 102 | { |
122 | acpi_status status = AE_OK; | 103 | u32 width; |
123 | struct acpi_evaluate_info *info; | 104 | u64 address; |
124 | 105 | acpi_status status; | |
125 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); | ||
126 | |||
127 | /* Validate parameters */ | ||
128 | |||
129 | if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { | ||
130 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
131 | } | ||
132 | 106 | ||
133 | /* Allocate the evaluation information block */ | 107 | ACPI_FUNCTION_NAME(acpi_read); |
134 | 108 | ||
135 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | 109 | /* |
136 | if (!info) { | 110 | * Must have a valid pointer to a GAS structure, and |
137 | return_ACPI_STATUS(AE_NO_MEMORY); | 111 | * a non-zero address within. However, don't return an error |
112 | * because the PM1A/B code must not fail if B isn't present. | ||
113 | */ | ||
114 | if (!reg) { | ||
115 | return (AE_OK); | ||
138 | } | 116 | } |
139 | 117 | ||
140 | info->pathname = | 118 | /* Get a local copy of the address. Handles possible alignment issues */ |
141 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | ||
142 | |||
143 | /* Evaluate the namespace object containing the values for this state */ | ||
144 | |||
145 | status = acpi_ns_evaluate(info); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
148 | "%s while evaluating SleepState [%s]\n", | ||
149 | acpi_format_exception(status), | ||
150 | info->pathname)); | ||
151 | 119 | ||
152 | goto cleanup; | 120 | ACPI_MOVE_64_TO_64(&address, ®->address); |
121 | if (!address) { | ||
122 | return (AE_OK); | ||
153 | } | 123 | } |
154 | 124 | ||
155 | /* Must have a return object */ | 125 | /* Supported widths are 8/16/32 */ |
156 | 126 | ||
157 | if (!info->return_object) { | 127 | width = reg->bit_width; |
158 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 128 | if ((width != 8) && (width != 16) && (width != 32)) { |
159 | info->pathname)); | 129 | return (AE_SUPPORT); |
160 | status = AE_NOT_EXIST; | ||
161 | } | 130 | } |
162 | 131 | ||
163 | /* It must be of type Package */ | 132 | /* Initialize entire 32-bit return value to zero */ |
164 | 133 | ||
165 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { | 134 | *value = 0; |
166 | ACPI_ERROR((AE_INFO, | ||
167 | "Sleep State return object is not a Package")); | ||
168 | status = AE_AML_OPERAND_TYPE; | ||
169 | } | ||
170 | 135 | ||
171 | /* | 136 | /* |
172 | * The package must have at least two elements. NOTE (March 2005): This | 137 | * Two address spaces supported: Memory or IO. |
173 | * goes against the current ACPI spec which defines this object as a | 138 | * PCI_Config is not supported here because the GAS struct is insufficient |
174 | * package with one encoded DWORD element. However, existing practice | ||
175 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
176 | * one per sleep type (A/B). | ||
177 | */ | 139 | */ |
178 | else if (info->return_object->package.count < 2) { | 140 | switch (reg->space_id) { |
179 | ACPI_ERROR((AE_INFO, | 141 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
180 | "Sleep State return package does not have at least two elements")); | ||
181 | status = AE_AML_NO_OPERAND; | ||
182 | } | ||
183 | 142 | ||
184 | /* The first two elements must both be of type Integer */ | 143 | status = acpi_os_read_memory((acpi_physical_address) address, |
144 | value, width); | ||
145 | break; | ||
185 | 146 | ||
186 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) | 147 | case ACPI_ADR_SPACE_SYSTEM_IO: |
187 | != ACPI_TYPE_INTEGER) || | ||
188 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) | ||
189 | != ACPI_TYPE_INTEGER)) { | ||
190 | ACPI_ERROR((AE_INFO, | ||
191 | "Sleep State return package elements are not both Integers (%s, %s)", | ||
192 | acpi_ut_get_object_type_name(info->return_object-> | ||
193 | package.elements[0]), | ||
194 | acpi_ut_get_object_type_name(info->return_object-> | ||
195 | package.elements[1]))); | ||
196 | status = AE_AML_OPERAND_TYPE; | ||
197 | } else { | ||
198 | /* Valid _Sx_ package size, type, and value */ | ||
199 | 148 | ||
200 | *sleep_type_a = (u8) | 149 | status = |
201 | (info->return_object->package.elements[0])->integer.value; | 150 | acpi_os_read_port((acpi_io_address) address, value, width); |
202 | *sleep_type_b = (u8) | 151 | break; |
203 | (info->return_object->package.elements[1])->integer.value; | ||
204 | } | ||
205 | 152 | ||
206 | if (ACPI_FAILURE(status)) { | 153 | default: |
207 | ACPI_EXCEPTION((AE_INFO, status, | 154 | ACPI_ERROR((AE_INFO, |
208 | "While evaluating SleepState [%s], bad Sleep object %p type %s", | 155 | "Unsupported address space: %X", reg->space_id)); |
209 | info->pathname, info->return_object, | 156 | return (AE_BAD_PARAMETER); |
210 | acpi_ut_get_object_type_name(info-> | ||
211 | return_object))); | ||
212 | } | 157 | } |
213 | 158 | ||
214 | acpi_ut_remove_reference(info->return_object); | 159 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
160 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | ||
161 | *value, width, ACPI_FORMAT_UINT64(address), | ||
162 | acpi_ut_get_region_name(reg->space_id))); | ||
215 | 163 | ||
216 | cleanup: | 164 | return (status); |
217 | ACPI_FREE(info); | ||
218 | return_ACPI_STATUS(status); | ||
219 | } | 165 | } |
220 | 166 | ||
221 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) | 167 | ACPI_EXPORT_SYMBOL(acpi_read) |
222 | 168 | ||
223 | /******************************************************************************* | 169 | /****************************************************************************** |
224 | * | 170 | * |
225 | * FUNCTION: acpi_hw_get_register_bit_mask | 171 | * FUNCTION: acpi_write |
226 | * | 172 | * |
227 | * PARAMETERS: register_id - Index of ACPI Register to access | 173 | * PARAMETERS: Value - To be written |
174 | * Reg - GAS register structure | ||
228 | * | 175 | * |
229 | * RETURN: The bitmask to be used when accessing the register | 176 | * RETURN: Status |
230 | * | 177 | * |
231 | * DESCRIPTION: Map register_id into a register bitmask. | 178 | * DESCRIPTION: Write to either memory or IO space. |
232 | * | 179 | * |
233 | ******************************************************************************/ | 180 | ******************************************************************************/ |
234 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | 181 | acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) |
235 | { | 182 | { |
236 | ACPI_FUNCTION_ENTRY(); | 183 | u32 width; |
184 | u64 address; | ||
185 | acpi_status status; | ||
237 | 186 | ||
238 | if (register_id > ACPI_BITREG_MAX) { | 187 | ACPI_FUNCTION_NAME(acpi_write); |
239 | ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", | 188 | |
240 | register_id)); | 189 | /* |
241 | return (NULL); | 190 | * Must have a valid pointer to a GAS structure, and |
191 | * a non-zero address within. However, don't return an error | ||
192 | * because the PM1A/B code must not fail if B isn't present. | ||
193 | */ | ||
194 | if (!reg) { | ||
195 | return (AE_OK); | ||
242 | } | 196 | } |
243 | 197 | ||
244 | return (&acpi_gbl_bit_register_info[register_id]); | 198 | /* Get a local copy of the address. Handles possible alignment issues */ |
199 | |||
200 | ACPI_MOVE_64_TO_64(&address, ®->address); | ||
201 | if (!address) { | ||
202 | return (AE_OK); | ||
203 | } | ||
204 | |||
205 | /* Supported widths are 8/16/32 */ | ||
206 | |||
207 | width = reg->bit_width; | ||
208 | if ((width != 8) && (width != 16) && (width != 32)) { | ||
209 | return (AE_SUPPORT); | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Two address spaces supported: Memory or IO. | ||
214 | * PCI_Config is not supported here because the GAS struct is insufficient | ||
215 | */ | ||
216 | switch (reg->space_id) { | ||
217 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
218 | |||
219 | status = acpi_os_write_memory((acpi_physical_address) address, | ||
220 | value, width); | ||
221 | break; | ||
222 | |||
223 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
224 | |||
225 | status = acpi_os_write_port((acpi_io_address) address, value, | ||
226 | width); | ||
227 | break; | ||
228 | |||
229 | default: | ||
230 | ACPI_ERROR((AE_INFO, | ||
231 | "Unsupported address space: %X", reg->space_id)); | ||
232 | return (AE_BAD_PARAMETER); | ||
233 | } | ||
234 | |||
235 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | ||
236 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | ||
237 | value, width, ACPI_FORMAT_UINT64(address), | ||
238 | acpi_ut_get_region_name(reg->space_id))); | ||
239 | |||
240 | return (status); | ||
245 | } | 241 | } |
246 | 242 | ||
243 | ACPI_EXPORT_SYMBOL(acpi_write) | ||
244 | |||
247 | /******************************************************************************* | 245 | /******************************************************************************* |
248 | * | 246 | * |
249 | * FUNCTION: acpi_get_register | 247 | * FUNCTION: acpi_get_register_unlocked |
250 | * | 248 | * |
251 | * PARAMETERS: register_id - ID of ACPI bit_register to access | 249 | * PARAMETERS: register_id - ID of ACPI bit_register to access |
252 | * return_value - Value that was read from the register | 250 | * 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) | |||
254 | * RETURN: Status and the value read from specified Register. Value | 252 | * RETURN: Status and the value read from specified Register. Value |
255 | * returned is normalized to bit0 (is shifted all the way right) | 253 | * returned is normalized to bit0 (is shifted all the way right) |
256 | * | 254 | * |
257 | * DESCRIPTION: ACPI bit_register read function. | 255 | * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock. |
258 | * | 256 | * |
259 | ******************************************************************************/ | 257 | ******************************************************************************/ |
260 | 258 | acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) | |
261 | acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) | ||
262 | { | 259 | { |
263 | u32 register_value = 0; | 260 | u32 register_value = 0; |
264 | struct acpi_bit_register_info *bit_reg_info; | 261 | struct acpi_bit_register_info *bit_reg_info; |
265 | acpi_status status; | 262 | acpi_status status; |
266 | 263 | ||
267 | ACPI_FUNCTION_TRACE(acpi_get_register); | 264 | ACPI_FUNCTION_TRACE(acpi_get_register_unlocked); |
268 | 265 | ||
269 | /* Get the info structure corresponding to the requested ACPI Register */ | 266 | /* Get the info structure corresponding to the requested ACPI Register */ |
270 | 267 | ||
@@ -296,14 +293,31 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) | |||
296 | return_ACPI_STATUS(status); | 293 | return_ACPI_STATUS(status); |
297 | } | 294 | } |
298 | 295 | ||
299 | acpi_status acpi_get_register(u32 register_id, u32 * return_value) | 296 | ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked) |
297 | |||
298 | /******************************************************************************* | ||
299 | * | ||
300 | * FUNCTION: acpi_get_register | ||
301 | * | ||
302 | * PARAMETERS: register_id - ID of ACPI bit_register to access | ||
303 | * return_value - Value that was read from the register | ||
304 | * | ||
305 | * RETURN: Status and the value read from specified Register. Value | ||
306 | * returned is normalized to bit0 (is shifted all the way right) | ||
307 | * | ||
308 | * DESCRIPTION: ACPI bit_register read function. | ||
309 | * | ||
310 | ******************************************************************************/ | ||
311 | acpi_status acpi_get_register(u32 register_id, u32 *return_value) | ||
300 | { | 312 | { |
301 | acpi_status status; | 313 | acpi_status status; |
302 | acpi_cpu_flags flags; | 314 | acpi_cpu_flags flags; |
315 | |||
303 | flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | 316 | flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
304 | status = acpi_get_register_unlocked(register_id, return_value); | 317 | status = acpi_get_register_unlocked(register_id, return_value); |
305 | acpi_os_release_lock(acpi_gbl_hardware_lock, flags); | 318 | acpi_os_release_lock(acpi_gbl_hardware_lock, flags); |
306 | return status; | 319 | |
320 | return (status); | ||
307 | } | 321 | } |
308 | 322 | ||
309 | ACPI_EXPORT_SYMBOL(acpi_get_register) | 323 | ACPI_EXPORT_SYMBOL(acpi_get_register) |
@@ -370,8 +384,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value) | |||
370 | bit_reg_info-> | 384 | bit_reg_info-> |
371 | access_bit_mask); | 385 | access_bit_mask); |
372 | if (value) { | 386 | if (value) { |
373 | status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, | 387 | status = |
374 | (u16) value); | 388 | acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, |
389 | (u16) value); | ||
375 | register_value = 0; | 390 | register_value = 0; |
376 | } | 391 | } |
377 | break; | 392 | break; |
@@ -459,399 +474,120 @@ acpi_status acpi_set_register(u32 register_id, u32 value) | |||
459 | 474 | ||
460 | ACPI_EXPORT_SYMBOL(acpi_set_register) | 475 | ACPI_EXPORT_SYMBOL(acpi_set_register) |
461 | 476 | ||
462 | /****************************************************************************** | 477 | /******************************************************************************* |
463 | * | 478 | * |
464 | * FUNCTION: acpi_hw_register_read | 479 | * FUNCTION: acpi_get_sleep_type_data |
465 | * | 480 | * |
466 | * PARAMETERS: register_id - ACPI Register ID | 481 | * PARAMETERS: sleep_state - Numeric sleep state |
467 | * return_value - Where the register value is returned | 482 | * *sleep_type_a - Where SLP_TYPa is returned |
483 | * *sleep_type_b - Where SLP_TYPb is returned | ||
468 | * | 484 | * |
469 | * RETURN: Status and the value read. | 485 | * RETURN: Status - ACPI status |
470 | * | 486 | * |
471 | * DESCRIPTION: Read from the specified ACPI register | 487 | * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep |
488 | * state. | ||
472 | * | 489 | * |
473 | ******************************************************************************/ | 490 | ******************************************************************************/ |
474 | acpi_status | 491 | acpi_status |
475 | acpi_hw_register_read(u32 register_id, u32 * return_value) | 492 | acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) |
476 | { | 493 | { |
477 | u32 value1 = 0; | 494 | acpi_status status = AE_OK; |
478 | u32 value2 = 0; | 495 | struct acpi_evaluate_info *info; |
479 | acpi_status status; | ||
480 | |||
481 | ACPI_FUNCTION_TRACE(hw_register_read); | ||
482 | |||
483 | switch (register_id) { | ||
484 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | ||
485 | |||
486 | status = | ||
487 | acpi_hw_low_level_read(16, &value1, | ||
488 | &acpi_gbl_FADT.xpm1a_event_block); | ||
489 | if (ACPI_FAILURE(status)) { | ||
490 | goto exit; | ||
491 | } | ||
492 | |||
493 | /* PM1B is optional */ | ||
494 | |||
495 | status = | ||
496 | acpi_hw_low_level_read(16, &value2, | ||
497 | &acpi_gbl_FADT.xpm1b_event_block); | ||
498 | value1 |= value2; | ||
499 | break; | ||
500 | |||
501 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
502 | |||
503 | status = | ||
504 | acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); | ||
505 | if (ACPI_FAILURE(status)) { | ||
506 | goto exit; | ||
507 | } | ||
508 | |||
509 | /* PM1B is optional */ | ||
510 | |||
511 | status = | ||
512 | acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable); | ||
513 | value1 |= value2; | ||
514 | break; | ||
515 | |||
516 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
517 | |||
518 | status = | ||
519 | acpi_hw_low_level_read(16, &value1, | ||
520 | &acpi_gbl_FADT.xpm1a_control_block); | ||
521 | if (ACPI_FAILURE(status)) { | ||
522 | goto exit; | ||
523 | } | ||
524 | |||
525 | status = | ||
526 | acpi_hw_low_level_read(16, &value2, | ||
527 | &acpi_gbl_FADT.xpm1b_control_block); | ||
528 | value1 |= value2; | ||
529 | break; | ||
530 | |||
531 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
532 | |||
533 | status = | ||
534 | acpi_hw_low_level_read(8, &value1, | ||
535 | &acpi_gbl_FADT.xpm2_control_block); | ||
536 | break; | ||
537 | |||
538 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
539 | |||
540 | status = | ||
541 | acpi_hw_low_level_read(32, &value1, | ||
542 | &acpi_gbl_FADT.xpm_timer_block); | ||
543 | break; | ||
544 | 496 | ||
545 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | 497 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
546 | 498 | ||
547 | status = | 499 | /* Validate parameters */ |
548 | acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); | ||
549 | break; | ||
550 | 500 | ||
551 | default: | 501 | if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) { |
552 | ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id)); | 502 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
553 | status = AE_BAD_PARAMETER; | ||
554 | break; | ||
555 | } | 503 | } |
556 | 504 | ||
557 | exit: | 505 | /* Allocate the evaluation information block */ |
558 | 506 | ||
559 | if (ACPI_SUCCESS(status)) { | 507 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
560 | *return_value = value1; | 508 | if (!info) { |
509 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
561 | } | 510 | } |
562 | 511 | ||
563 | return_ACPI_STATUS(status); | 512 | info->pathname = |
564 | } | 513 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
565 | |||
566 | /****************************************************************************** | ||
567 | * | ||
568 | * FUNCTION: acpi_hw_register_write | ||
569 | * | ||
570 | * PARAMETERS: register_id - ACPI Register ID | ||
571 | * Value - The value to write | ||
572 | * | ||
573 | * RETURN: Status | ||
574 | * | ||
575 | * DESCRIPTION: Write to the specified ACPI register | ||
576 | * | ||
577 | * NOTE: In accordance with the ACPI specification, this function automatically | ||
578 | * preserves the value of the following bits, meaning that these bits cannot be | ||
579 | * changed via this interface: | ||
580 | * | ||
581 | * PM1_CONTROL[0] = SCI_EN | ||
582 | * PM1_CONTROL[9] | ||
583 | * PM1_STATUS[11] | ||
584 | * | ||
585 | * ACPI References: | ||
586 | * 1) Hardware Ignored Bits: When software writes to a register with ignored | ||
587 | * bit fields, it preserves the ignored bit fields | ||
588 | * 2) SCI_EN: OSPM always preserves this bit position | ||
589 | * | ||
590 | ******************************************************************************/ | ||
591 | |||
592 | acpi_status acpi_hw_register_write(u32 register_id, u32 value) | ||
593 | { | ||
594 | acpi_status status; | ||
595 | u32 read_value; | ||
596 | |||
597 | ACPI_FUNCTION_TRACE(hw_register_write); | ||
598 | |||
599 | switch (register_id) { | ||
600 | case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ | ||
601 | |||
602 | /* Perform a read first to preserve certain bits (per ACPI spec) */ | ||
603 | |||
604 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, | ||
605 | &read_value); | ||
606 | if (ACPI_FAILURE(status)) { | ||
607 | goto exit; | ||
608 | } | ||
609 | |||
610 | /* Insert the bits to be preserved */ | ||
611 | |||
612 | ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, | ||
613 | read_value); | ||
614 | |||
615 | /* Now we can write the data */ | ||
616 | |||
617 | status = | ||
618 | acpi_hw_low_level_write(16, value, | ||
619 | &acpi_gbl_FADT.xpm1a_event_block); | ||
620 | if (ACPI_FAILURE(status)) { | ||
621 | goto exit; | ||
622 | } | ||
623 | |||
624 | /* PM1B is optional */ | ||
625 | |||
626 | status = | ||
627 | acpi_hw_low_level_write(16, value, | ||
628 | &acpi_gbl_FADT.xpm1b_event_block); | ||
629 | break; | ||
630 | |||
631 | case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ | ||
632 | |||
633 | status = | ||
634 | acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); | ||
635 | if (ACPI_FAILURE(status)) { | ||
636 | goto exit; | ||
637 | } | ||
638 | |||
639 | /* PM1B is optional */ | ||
640 | |||
641 | status = | ||
642 | acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable); | ||
643 | break; | ||
644 | |||
645 | case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ | ||
646 | |||
647 | /* | ||
648 | * Perform a read first to preserve certain bits (per ACPI spec) | ||
649 | */ | ||
650 | status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, | ||
651 | &read_value); | ||
652 | if (ACPI_FAILURE(status)) { | ||
653 | goto exit; | ||
654 | } | ||
655 | |||
656 | /* Insert the bits to be preserved */ | ||
657 | |||
658 | ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, | ||
659 | read_value); | ||
660 | |||
661 | /* Now we can write the data */ | ||
662 | |||
663 | status = | ||
664 | acpi_hw_low_level_write(16, value, | ||
665 | &acpi_gbl_FADT.xpm1a_control_block); | ||
666 | if (ACPI_FAILURE(status)) { | ||
667 | goto exit; | ||
668 | } | ||
669 | |||
670 | status = | ||
671 | acpi_hw_low_level_write(16, value, | ||
672 | &acpi_gbl_FADT.xpm1b_control_block); | ||
673 | break; | ||
674 | |||
675 | case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ | ||
676 | |||
677 | status = | ||
678 | acpi_hw_low_level_write(16, value, | ||
679 | &acpi_gbl_FADT.xpm1a_control_block); | ||
680 | break; | ||
681 | |||
682 | case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ | ||
683 | |||
684 | status = | ||
685 | acpi_hw_low_level_write(16, value, | ||
686 | &acpi_gbl_FADT.xpm1b_control_block); | ||
687 | break; | ||
688 | |||
689 | case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ | ||
690 | |||
691 | status = | ||
692 | acpi_hw_low_level_write(8, value, | ||
693 | &acpi_gbl_FADT.xpm2_control_block); | ||
694 | break; | ||
695 | |||
696 | case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ | ||
697 | |||
698 | status = | ||
699 | acpi_hw_low_level_write(32, value, | ||
700 | &acpi_gbl_FADT.xpm_timer_block); | ||
701 | break; | ||
702 | |||
703 | case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ | ||
704 | 514 | ||
705 | /* SMI_CMD is currently always in IO space */ | 515 | /* Evaluate the namespace object containing the values for this state */ |
706 | 516 | ||
707 | status = | 517 | status = acpi_ns_evaluate(info); |
708 | acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); | 518 | if (ACPI_FAILURE(status)) { |
709 | break; | 519 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
520 | "%s while evaluating SleepState [%s]\n", | ||
521 | acpi_format_exception(status), | ||
522 | info->pathname)); | ||
710 | 523 | ||
711 | default: | 524 | goto cleanup; |
712 | status = AE_BAD_PARAMETER; | ||
713 | break; | ||
714 | } | 525 | } |
715 | 526 | ||
716 | exit: | 527 | /* Must have a return object */ |
717 | return_ACPI_STATUS(status); | ||
718 | } | ||
719 | |||
720 | /****************************************************************************** | ||
721 | * | ||
722 | * FUNCTION: acpi_hw_low_level_read | ||
723 | * | ||
724 | * PARAMETERS: Width - 8, 16, or 32 | ||
725 | * Value - Where the value is returned | ||
726 | * Reg - GAS register structure | ||
727 | * | ||
728 | * RETURN: Status | ||
729 | * | ||
730 | * DESCRIPTION: Read from either memory or IO space. | ||
731 | * | ||
732 | ******************************************************************************/ | ||
733 | |||
734 | acpi_status | ||
735 | acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) | ||
736 | { | ||
737 | u64 address; | ||
738 | acpi_status status; | ||
739 | |||
740 | ACPI_FUNCTION_NAME(hw_low_level_read); | ||
741 | 528 | ||
742 | /* | 529 | if (!info->return_object) { |
743 | * Must have a valid pointer to a GAS structure, and | 530 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
744 | * a non-zero address within. However, don't return an error | 531 | info->pathname)); |
745 | * because the PM1A/B code must not fail if B isn't present. | 532 | status = AE_NOT_EXIST; |
746 | */ | ||
747 | if (!reg) { | ||
748 | return (AE_OK); | ||
749 | } | 533 | } |
750 | 534 | ||
751 | /* Get a local copy of the address. Handles possible alignment issues */ | 535 | /* It must be of type Package */ |
752 | 536 | ||
753 | ACPI_MOVE_64_TO_64(&address, ®->address); | 537 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { |
754 | if (!address) { | 538 | ACPI_ERROR((AE_INFO, |
755 | return (AE_OK); | 539 | "Sleep State return object is not a Package")); |
540 | status = AE_AML_OPERAND_TYPE; | ||
756 | } | 541 | } |
757 | *value = 0; | ||
758 | 542 | ||
759 | /* | 543 | /* |
760 | * Two address spaces supported: Memory or IO. | 544 | * The package must have at least two elements. NOTE (March 2005): This |
761 | * PCI_Config is not supported here because the GAS struct is insufficient | 545 | * goes against the current ACPI spec which defines this object as a |
546 | * package with one encoded DWORD element. However, existing practice | ||
547 | * by BIOS vendors seems to be to have 2 or more elements, at least | ||
548 | * one per sleep type (A/B). | ||
762 | */ | 549 | */ |
763 | switch (reg->space_id) { | 550 | else if (info->return_object->package.count < 2) { |
764 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
765 | |||
766 | status = acpi_os_read_memory((acpi_physical_address) address, | ||
767 | value, width); | ||
768 | break; | ||
769 | |||
770 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
771 | |||
772 | status = | ||
773 | acpi_os_read_port((acpi_io_address) address, value, width); | ||
774 | break; | ||
775 | |||
776 | default: | ||
777 | ACPI_ERROR((AE_INFO, | 551 | ACPI_ERROR((AE_INFO, |
778 | "Unsupported address space: %X", reg->space_id)); | 552 | "Sleep State return package does not have at least two elements")); |
779 | return (AE_BAD_PARAMETER); | 553 | status = AE_AML_NO_OPERAND; |
780 | } | 554 | } |
781 | 555 | ||
782 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | 556 | /* The first two elements must both be of type Integer */ |
783 | "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", | ||
784 | *value, width, ACPI_FORMAT_UINT64(address), | ||
785 | acpi_ut_get_region_name(reg->space_id))); | ||
786 | |||
787 | return (status); | ||
788 | } | ||
789 | |||
790 | /****************************************************************************** | ||
791 | * | ||
792 | * FUNCTION: acpi_hw_low_level_write | ||
793 | * | ||
794 | * PARAMETERS: Width - 8, 16, or 32 | ||
795 | * Value - To be written | ||
796 | * Reg - GAS register structure | ||
797 | * | ||
798 | * RETURN: Status | ||
799 | * | ||
800 | * DESCRIPTION: Write to either memory or IO space. | ||
801 | * | ||
802 | ******************************************************************************/ | ||
803 | |||
804 | acpi_status | ||
805 | acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) | ||
806 | { | ||
807 | u64 address; | ||
808 | acpi_status status; | ||
809 | |||
810 | ACPI_FUNCTION_NAME(hw_low_level_write); | ||
811 | |||
812 | /* | ||
813 | * Must have a valid pointer to a GAS structure, and | ||
814 | * a non-zero address within. However, don't return an error | ||
815 | * because the PM1A/B code must not fail if B isn't present. | ||
816 | */ | ||
817 | if (!reg) { | ||
818 | return (AE_OK); | ||
819 | } | ||
820 | 557 | ||
821 | /* Get a local copy of the address. Handles possible alignment issues */ | 558 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) |
559 | != ACPI_TYPE_INTEGER) || | ||
560 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) | ||
561 | != ACPI_TYPE_INTEGER)) { | ||
562 | ACPI_ERROR((AE_INFO, | ||
563 | "Sleep State return package elements are not both Integers (%s, %s)", | ||
564 | acpi_ut_get_object_type_name(info->return_object-> | ||
565 | package.elements[0]), | ||
566 | acpi_ut_get_object_type_name(info->return_object-> | ||
567 | package.elements[1]))); | ||
568 | status = AE_AML_OPERAND_TYPE; | ||
569 | } else { | ||
570 | /* Valid _Sx_ package size, type, and value */ | ||
822 | 571 | ||
823 | ACPI_MOVE_64_TO_64(&address, ®->address); | 572 | *sleep_type_a = (u8) |
824 | if (!address) { | 573 | (info->return_object->package.elements[0])->integer.value; |
825 | return (AE_OK); | 574 | *sleep_type_b = (u8) |
575 | (info->return_object->package.elements[1])->integer.value; | ||
826 | } | 576 | } |
827 | 577 | ||
828 | /* | 578 | if (ACPI_FAILURE(status)) { |
829 | * Two address spaces supported: Memory or IO. | 579 | ACPI_EXCEPTION((AE_INFO, status, |
830 | * PCI_Config is not supported here because the GAS struct is insufficient | 580 | "While evaluating SleepState [%s], bad Sleep object %p type %s", |
831 | */ | 581 | info->pathname, info->return_object, |
832 | switch (reg->space_id) { | 582 | acpi_ut_get_object_type_name(info-> |
833 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | 583 | return_object))); |
834 | |||
835 | status = acpi_os_write_memory((acpi_physical_address) address, | ||
836 | value, width); | ||
837 | break; | ||
838 | |||
839 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
840 | |||
841 | status = acpi_os_write_port((acpi_io_address) address, value, | ||
842 | width); | ||
843 | break; | ||
844 | |||
845 | default: | ||
846 | ACPI_ERROR((AE_INFO, | ||
847 | "Unsupported address space: %X", reg->space_id)); | ||
848 | return (AE_BAD_PARAMETER); | ||
849 | } | 584 | } |
850 | 585 | ||
851 | ACPI_DEBUG_PRINT((ACPI_DB_IO, | 586 | acpi_ut_remove_reference(info->return_object); |
852 | "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", | ||
853 | value, width, ACPI_FORMAT_UINT64(address), | ||
854 | acpi_ut_get_region_name(reg->space_id))); | ||
855 | 587 | ||
856 | return (status); | 588 | cleanup: |
589 | ACPI_FREE(info); | ||
590 | return_ACPI_STATUS(status); | ||
857 | } | 591 | } |
592 | |||
593 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) | ||
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index c39a7f68b889..88303ebe924c 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "amlcode.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "acnamesp.h" |
48 | #include "acdispat.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsaccess") | 51 | ACPI_MODULE_NAME("nsaccess") |
@@ -165,12 +166,9 @@ acpi_status acpi_ns_root_initialize(void) | |||
165 | 166 | ||
166 | obj_desc->method.method_flags = | 167 | obj_desc->method.method_flags = |
167 | AML_METHOD_INTERNAL_ONLY; | 168 | AML_METHOD_INTERNAL_ONLY; |
168 | |||
169 | #ifndef ACPI_DUMP_APP | ||
170 | obj_desc->method.implementation = | 169 | obj_desc->method.implementation = |
171 | acpi_ut_osi_implementation; | 170 | acpi_ut_osi_implementation; |
172 | #endif | 171 | #endif |
173 | #endif | ||
174 | break; | 172 | break; |
175 | 173 | ||
176 | case ACPI_TYPE_INTEGER: | 174 | case ACPI_TYPE_INTEGER: |
@@ -521,11 +519,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
521 | } | 519 | } |
522 | 520 | ||
523 | /* | 521 | /* |
524 | * Search namespace for each segment of the name. Loop through and | 522 | * Search namespace for each segment of the name. Loop through and |
525 | * verify (or add to the namespace) each name segment. | 523 | * verify (or add to the namespace) each name segment. |
526 | * | 524 | * |
527 | * The object type is significant only at the last name | 525 | * The object type is significant only at the last name |
528 | * segment. (We don't care about the types along the path, only | 526 | * segment. (We don't care about the types along the path, only |
529 | * the type of the final target object.) | 527 | * the type of the final target object.) |
530 | */ | 528 | */ |
531 | this_search_type = ACPI_TYPE_ANY; | 529 | this_search_type = ACPI_TYPE_ANY; |
@@ -591,6 +589,10 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
591 | * segments). | 589 | * segments). |
592 | */ | 590 | */ |
593 | if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { | 591 | if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { |
592 | if (!this_node->object) { | ||
593 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
594 | } | ||
595 | |||
594 | if (acpi_ns_opens_scope | 596 | if (acpi_ns_opens_scope |
595 | (((struct acpi_namespace_node *)this_node-> | 597 | (((struct acpi_namespace_node *)this_node-> |
596 | object)->type)) { | 598 | object)->type)) { |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 3a1740ac2edc..f976d848fe82 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsalloc") | 49 | ACPI_MODULE_NAME("nsalloc") |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/acpica/nsdump.c index cc0ae39440e4..0da33c8e9ba2 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsdump") | 49 | ACPI_MODULE_NAME("nsdump") |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 428f50fde11a..41994fe7fbb8 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
@@ -42,6 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
45 | 46 | ||
46 | /* TBD: This entire module is apparently obsolete and should be removed */ | 47 | /* TBD: This entire module is apparently obsolete and should be removed */ |
47 | 48 | ||
@@ -49,7 +50,7 @@ | |||
49 | ACPI_MODULE_NAME("nsdumpdv") | 50 | ACPI_MODULE_NAME("nsdumpdv") |
50 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 51 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 52 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
52 | #include <acpi/acnamesp.h> | 53 | #include "acnamesp.h" |
53 | /******************************************************************************* | 54 | /******************************************************************************* |
54 | * | 55 | * |
55 | * FUNCTION: acpi_ns_dump_one_device | 56 | * FUNCTION: acpi_ns_dump_one_device |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/acpica/nseval.c index 4cdf03ac2b46..0f3d5f9b5966 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acinterp.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acnamesp.h> | 47 | #include "acinterp.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nseval") | 51 | ACPI_MODULE_NAME("nseval") |
@@ -89,6 +90,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
89 | /* Initialize the return value to an invalid object */ | 90 | /* Initialize the return value to an invalid object */ |
90 | 91 | ||
91 | info->return_object = NULL; | 92 | info->return_object = NULL; |
93 | info->param_count = 0; | ||
92 | 94 | ||
93 | /* | 95 | /* |
94 | * Get the actual namespace node for the target object. Handles these cases: | 96 | * 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) | |||
141 | return_ACPI_STATUS(AE_NULL_OBJECT); | 143 | return_ACPI_STATUS(AE_NULL_OBJECT); |
142 | } | 144 | } |
143 | 145 | ||
144 | /* | 146 | /* Count the number of arguments being passed to the method */ |
145 | * Calculate the number of arguments being passed to the method | ||
146 | */ | ||
147 | 147 | ||
148 | info->param_count = 0; | ||
149 | if (info->parameters) { | 148 | if (info->parameters) { |
150 | while (info->parameters[info->param_count]) | 149 | while (info->parameters[info->param_count]) { |
150 | if (info->param_count > ACPI_METHOD_MAX_ARG) { | ||
151 | return_ACPI_STATUS(AE_LIMIT); | ||
152 | } | ||
151 | info->param_count++; | 153 | info->param_count++; |
154 | } | ||
152 | } | 155 | } |
153 | 156 | ||
154 | /* | ||
155 | * Warning if too few or too many arguments have been passed by the | ||
156 | * caller. We don't want to abort here with an error because an | ||
157 | * incorrect number of arguments may not cause the method to fail. | ||
158 | * However, the method will fail if there are too few arguments passed | ||
159 | * and the method attempts to use one of the missing ones. | ||
160 | */ | ||
161 | |||
162 | if (info->param_count < info->obj_desc->method.param_count) { | ||
163 | ACPI_WARNING((AE_INFO, | ||
164 | "Insufficient arguments - " | ||
165 | "method [%4.4s] needs %d, found %d", | ||
166 | acpi_ut_get_node_name(info->resolved_node), | ||
167 | info->obj_desc->method.param_count, | ||
168 | info->param_count)); | ||
169 | } else if (info->param_count > | ||
170 | info->obj_desc->method.param_count) { | ||
171 | ACPI_WARNING((AE_INFO, | ||
172 | "Excess arguments - " | ||
173 | "method [%4.4s] needs %d, found %d", | ||
174 | acpi_ut_get_node_name(info-> | ||
175 | resolved_node), | ||
176 | info->obj_desc->method.param_count, | ||
177 | info->param_count)); | ||
178 | } | ||
179 | 157 | ||
180 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", | 158 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
181 | ACPI_LV_INFO, _COMPONENT); | 159 | ACPI_LV_INFO, _COMPONENT); |
@@ -264,32 +242,13 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) | |||
264 | } | 242 | } |
265 | } | 243 | } |
266 | 244 | ||
267 | /* Validation of return values for ACPI-predefined methods and objects */ | 245 | /* |
268 | 246 | * Check input argument count against the ASL-defined count for a method. | |
269 | if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) { | 247 | * Also check predefined names: argument count and return value against |
270 | /* | 248 | * the ACPI specification. Some incorrect return value types are repaired. |
271 | * If this is the first evaluation, check the return value. This | 249 | */ |
272 | * ensures that any warnings will only be emitted during the very | 250 | (void)acpi_ns_check_predefined_names(node, info->param_count, |
273 | * first evaluation of the object. | 251 | status, &info->return_object); |
274 | */ | ||
275 | if (!(node->flags & ANOBJ_EVALUATED)) { | ||
276 | /* | ||
277 | * Check for a predefined ACPI name. If found, validate the | ||
278 | * returned object. | ||
279 | * | ||
280 | * Note: Ignore return status for now, emit warnings if there are | ||
281 | * problems with the returned object. May change later to abort | ||
282 | * the method on invalid return object. | ||
283 | */ | ||
284 | (void)acpi_ns_check_predefined_names(node, | ||
285 | info-> | ||
286 | return_object); | ||
287 | } | ||
288 | |||
289 | /* Mark the node as having been evaluated */ | ||
290 | |||
291 | node->flags |= ANOBJ_EVALUATED; | ||
292 | } | ||
293 | 252 | ||
294 | /* Check if there is a return value that must be dealt with */ | 253 | /* Check if there is a return value that must be dealt with */ |
295 | 254 | ||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/acpica/nsinit.c index e4c57510d798..13501cb81863 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "acnamesp.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include "acinterp.h" | ||
48 | #include <linux/nmi.h> | 49 | #include <linux/nmi.h> |
49 | 50 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/acpica/nsload.c index a4a412b7c029..a0ba9e12379e 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "acnamesp.h" |
47 | #include <acpi/actables.h> | 47 | #include "acdispat.h" |
48 | #include "actables.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsload") | 51 | ACPI_MODULE_NAME("nsload") |
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/acpica/nsnames.c index 42a39a7c96e9..ae3dc10a7e81 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "amlcode.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsnames") | 50 | ACPI_MODULE_NAME("nsnames") |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/acpica/nsobject.c index 15fe09e24f71..08a97a57f8f9 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsobject") | 50 | ACPI_MODULE_NAME("nsobject") |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/acpica/nsparse.c index a82271a9dbb3..b9e8d0070b6f 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
@@ -42,10 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acparser.h> | 46 | #include "acnamesp.h" |
47 | #include <acpi/acdispat.h> | 47 | #include "acparser.h" |
48 | #include <acpi/actables.h> | 48 | #include "acdispat.h" |
49 | #include "actables.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nsparse") | 52 | ACPI_MODULE_NAME("nsparse") |
diff --git a/drivers/acpi/namespace/nspredef.c b/drivers/acpi/acpica/nspredef.c index 0f17cf0898c9..452703290d35 100644 --- a/drivers/acpi/namespace/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acpredef.h> | 47 | #include "acnamesp.h" |
48 | #include "acpredef.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nspredef") | 51 | ACPI_MODULE_NAME("nspredef") |
@@ -72,7 +73,7 @@ ACPI_MODULE_NAME("nspredef") | |||
72 | /* Local prototypes */ | 73 | /* Local prototypes */ |
73 | static acpi_status | 74 | static acpi_status |
74 | acpi_ns_check_package(char *pathname, | 75 | acpi_ns_check_package(char *pathname, |
75 | union acpi_operand_object *return_object, | 76 | union acpi_operand_object **return_object_ptr, |
76 | const union acpi_predefined_info *predefined); | 77 | const union acpi_predefined_info *predefined); |
77 | 78 | ||
78 | static acpi_status | 79 | static acpi_status |
@@ -82,13 +83,18 @@ acpi_ns_check_package_elements(char *pathname, | |||
82 | 83 | ||
83 | static acpi_status | 84 | static acpi_status |
84 | acpi_ns_check_object_type(char *pathname, | 85 | acpi_ns_check_object_type(char *pathname, |
85 | union acpi_operand_object *return_object, | 86 | union acpi_operand_object **return_object_ptr, |
86 | u32 expected_btypes, u32 package_index); | 87 | u32 expected_btypes, u32 package_index); |
87 | 88 | ||
88 | static acpi_status | 89 | static acpi_status |
89 | acpi_ns_check_reference(char *pathname, | 90 | acpi_ns_check_reference(char *pathname, |
90 | union acpi_operand_object *return_object); | 91 | union acpi_operand_object *return_object); |
91 | 92 | ||
93 | static acpi_status | ||
94 | acpi_ns_repair_object(u32 expected_btypes, | ||
95 | u32 package_index, | ||
96 | union acpi_operand_object **return_object_ptr); | ||
97 | |||
92 | /* | 98 | /* |
93 | * Names for the types that can be returned by the predefined objects. | 99 | * Names for the types that can be returned by the predefined objects. |
94 | * Used for warning messages. Must be in the same order as the ACPI_RTYPEs | 100 | * Used for warning messages. Must be in the same order as the ACPI_RTYPEs |
@@ -108,8 +114,8 @@ static const char *acpi_rtype_names[] = { | |||
108 | * FUNCTION: acpi_ns_check_predefined_names | 114 | * FUNCTION: acpi_ns_check_predefined_names |
109 | * | 115 | * |
110 | * PARAMETERS: Node - Namespace node for the method/object | 116 | * PARAMETERS: Node - Namespace node for the method/object |
111 | * return_object - Object returned from the evaluation of this | 117 | * return_object_ptr - Pointer to the object returned from the |
112 | * method/object | 118 | * evaluation of a method or object |
113 | * | 119 | * |
114 | * RETURN: Status | 120 | * RETURN: Status |
115 | * | 121 | * |
@@ -119,8 +125,11 @@ static const char *acpi_rtype_names[] = { | |||
119 | 125 | ||
120 | acpi_status | 126 | acpi_status |
121 | acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | 127 | acpi_ns_check_predefined_names(struct acpi_namespace_node *node, |
122 | union acpi_operand_object *return_object) | 128 | u32 user_param_count, |
129 | acpi_status return_status, | ||
130 | union acpi_operand_object **return_object_ptr) | ||
123 | { | 131 | { |
132 | union acpi_operand_object *return_object = *return_object_ptr; | ||
124 | acpi_status status = AE_OK; | 133 | acpi_status status = AE_OK; |
125 | const union acpi_predefined_info *predefined; | 134 | const union acpi_predefined_info *predefined; |
126 | char *pathname; | 135 | char *pathname; |
@@ -128,12 +137,6 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
128 | /* Match the name for this method/object against the predefined list */ | 137 | /* Match the name for this method/object against the predefined list */ |
129 | 138 | ||
130 | predefined = acpi_ns_check_for_predefined_name(node); | 139 | predefined = acpi_ns_check_for_predefined_name(node); |
131 | if (!predefined) { | ||
132 | |||
133 | /* Name was not one of the predefined names */ | ||
134 | |||
135 | return (AE_OK); | ||
136 | } | ||
137 | 140 | ||
138 | /* Get the full pathname to the object, for use in error messages */ | 141 | /* Get the full pathname to the object, for use in error messages */ |
139 | 142 | ||
@@ -143,10 +146,37 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
143 | } | 146 | } |
144 | 147 | ||
145 | /* | 148 | /* |
146 | * Check that the parameter count for this method is in accordance | 149 | * Check that the parameter count for this method matches the ASL |
147 | * with the ACPI specification. | 150 | * definition. For predefined names, ensure that both the caller and |
151 | * the method itself are in accordance with the ACPI specification. | ||
148 | */ | 152 | */ |
149 | acpi_ns_check_parameter_count(pathname, node, predefined); | 153 | acpi_ns_check_parameter_count(pathname, node, user_param_count, |
154 | predefined); | ||
155 | |||
156 | /* If not a predefined name, we cannot validate the return object */ | ||
157 | |||
158 | if (!predefined) { | ||
159 | goto exit; | ||
160 | } | ||
161 | |||
162 | /* If the method failed, we cannot validate the return object */ | ||
163 | |||
164 | if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { | ||
165 | goto exit; | ||
166 | } | ||
167 | |||
168 | /* | ||
169 | * Only validate the return value on the first successful evaluation of | ||
170 | * the method. This ensures that any warnings will only be emitted during | ||
171 | * the very first evaluation of the method/object. | ||
172 | */ | ||
173 | if (node->flags & ANOBJ_EVALUATED) { | ||
174 | goto exit; | ||
175 | } | ||
176 | |||
177 | /* Mark the node as having been successfully evaluated */ | ||
178 | |||
179 | node->flags |= ANOBJ_EVALUATED; | ||
150 | 180 | ||
151 | /* | 181 | /* |
152 | * If there is no return value, check if we require a return value for | 182 | * If there is no return value, check if we require a return value for |
@@ -171,7 +201,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
171 | * We have a return value, but if one wasn't expected, just exit, this is | 201 | * We have a return value, but if one wasn't expected, just exit, this is |
172 | * not a problem | 202 | * not a problem |
173 | * | 203 | * |
174 | * For example, if "Implicit return value" is enabled, methods will | 204 | * For example, if the "Implicit Return" feature is enabled, methods will |
175 | * always return a value | 205 | * always return a value |
176 | */ | 206 | */ |
177 | if (!predefined->info.expected_btypes) { | 207 | if (!predefined->info.expected_btypes) { |
@@ -182,7 +212,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
182 | * Check that the type of the return object is what is expected for | 212 | * Check that the type of the return object is what is expected for |
183 | * this predefined name | 213 | * this predefined name |
184 | */ | 214 | */ |
185 | status = acpi_ns_check_object_type(pathname, return_object, | 215 | status = acpi_ns_check_object_type(pathname, return_object_ptr, |
186 | predefined->info.expected_btypes, | 216 | predefined->info.expected_btypes, |
187 | ACPI_NOT_PACKAGE); | 217 | ACPI_NOT_PACKAGE); |
188 | if (ACPI_FAILURE(status)) { | 218 | if (ACPI_FAILURE(status)) { |
@@ -193,11 +223,12 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
193 | 223 | ||
194 | if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) { | 224 | if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) { |
195 | status = | 225 | status = |
196 | acpi_ns_check_package(pathname, return_object, predefined); | 226 | acpi_ns_check_package(pathname, return_object_ptr, |
227 | predefined); | ||
197 | } | 228 | } |
198 | 229 | ||
199 | exit: | 230 | exit: |
200 | if (pathname) { | 231 | if (pathname != predefined->info.name) { |
201 | ACPI_FREE(pathname); | 232 | ACPI_FREE(pathname); |
202 | } | 233 | } |
203 | 234 | ||
@@ -210,6 +241,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
210 | * | 241 | * |
211 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | 242 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) |
212 | * Node - Namespace node for the method/object | 243 | * Node - Namespace node for the method/object |
244 | * user_param_count - Number of args passed in by the caller | ||
213 | * Predefined - Pointer to entry in predefined name table | 245 | * Predefined - Pointer to entry in predefined name table |
214 | * | 246 | * |
215 | * RETURN: None | 247 | * RETURN: None |
@@ -223,32 +255,76 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
223 | void | 255 | void |
224 | acpi_ns_check_parameter_count(char *pathname, | 256 | acpi_ns_check_parameter_count(char *pathname, |
225 | struct acpi_namespace_node *node, | 257 | struct acpi_namespace_node *node, |
258 | u32 user_param_count, | ||
226 | const union acpi_predefined_info *predefined) | 259 | const union acpi_predefined_info *predefined) |
227 | { | 260 | { |
228 | u32 param_count; | 261 | u32 param_count; |
229 | u32 required_params_current; | 262 | u32 required_params_current; |
230 | u32 required_params_old; | 263 | u32 required_params_old; |
231 | 264 | ||
232 | /* | 265 | /* Methods have 0-7 parameters. All other types have zero. */ |
233 | * Check that the ASL-defined parameter count is what is expected for | 266 | |
234 | * this predefined name. | ||
235 | * | ||
236 | * Methods have 0-7 parameters. All other types have zero. | ||
237 | */ | ||
238 | param_count = 0; | 267 | param_count = 0; |
239 | if (node->type == ACPI_TYPE_METHOD) { | 268 | if (node->type == ACPI_TYPE_METHOD) { |
240 | param_count = node->object->method.param_count; | 269 | param_count = node->object->method.param_count; |
241 | } | 270 | } |
242 | 271 | ||
243 | /* Validate parameter count - allow two different legal counts (_SCP) */ | 272 | /* Argument count check for non-predefined methods/objects */ |
273 | |||
274 | if (!predefined) { | ||
275 | /* | ||
276 | * Warning if too few or too many arguments have been passed by the | ||
277 | * caller. An incorrect number of arguments may not cause the method | ||
278 | * to fail. However, the method will fail if there are too few | ||
279 | * arguments and the method attempts to use one of the missing ones. | ||
280 | */ | ||
281 | if (user_param_count < param_count) { | ||
282 | ACPI_WARNING((AE_INFO, | ||
283 | "%s: Insufficient arguments - needs %d, found %d", | ||
284 | pathname, param_count, user_param_count)); | ||
285 | } else if (user_param_count > param_count) { | ||
286 | ACPI_WARNING((AE_INFO, | ||
287 | "%s: Excess arguments - needs %d, found %d", | ||
288 | pathname, param_count, user_param_count)); | ||
289 | } | ||
290 | return; | ||
291 | } | ||
292 | |||
293 | /* Allow two different legal argument counts (_SCP, etc.) */ | ||
244 | 294 | ||
245 | required_params_current = predefined->info.param_count & 0x0F; | 295 | required_params_current = predefined->info.param_count & 0x0F; |
246 | required_params_old = predefined->info.param_count >> 4; | 296 | required_params_old = predefined->info.param_count >> 4; |
247 | 297 | ||
298 | if (user_param_count != ACPI_UINT32_MAX) { | ||
299 | |||
300 | /* Validate the user-supplied parameter count */ | ||
301 | |||
302 | if ((user_param_count != required_params_current) && | ||
303 | (user_param_count != required_params_old)) { | ||
304 | ACPI_WARNING((AE_INFO, | ||
305 | "%s: Parameter count mismatch - caller passed %d, ACPI requires %d", | ||
306 | pathname, user_param_count, | ||
307 | required_params_current)); | ||
308 | } | ||
309 | } | ||
310 | |||
311 | /* | ||
312 | * Only validate the argument count on the first successful evaluation of | ||
313 | * the method. This ensures that any warnings will only be emitted during | ||
314 | * the very first evaluation of the method/object. | ||
315 | */ | ||
316 | if (node->flags & ANOBJ_EVALUATED) { | ||
317 | return; | ||
318 | } | ||
319 | |||
320 | /* | ||
321 | * Check that the ASL-defined parameter count is what is expected for | ||
322 | * this predefined name. | ||
323 | */ | ||
248 | if ((param_count != required_params_current) && | 324 | if ((param_count != required_params_current) && |
249 | (param_count != required_params_old)) { | 325 | (param_count != required_params_old)) { |
250 | ACPI_WARNING((AE_INFO, | 326 | ACPI_WARNING((AE_INFO, |
251 | "%s: Parameter count mismatch - ASL declared %d, expected %d", | 327 | "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", |
252 | pathname, param_count, required_params_current)); | 328 | pathname, param_count, required_params_current)); |
253 | } | 329 | } |
254 | } | 330 | } |
@@ -307,8 +383,8 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | |||
307 | * FUNCTION: acpi_ns_check_package | 383 | * FUNCTION: acpi_ns_check_package |
308 | * | 384 | * |
309 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | 385 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) |
310 | * return_object - Object returned from the evaluation of a | 386 | * return_object_ptr - Pointer to the object returned from the |
311 | * method or object | 387 | * evaluation of a method or object |
312 | * Predefined - Pointer to entry in predefined name table | 388 | * Predefined - Pointer to entry in predefined name table |
313 | * | 389 | * |
314 | * RETURN: Status | 390 | * RETURN: Status |
@@ -320,9 +396,10 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct | |||
320 | 396 | ||
321 | static acpi_status | 397 | static acpi_status |
322 | acpi_ns_check_package(char *pathname, | 398 | acpi_ns_check_package(char *pathname, |
323 | union acpi_operand_object *return_object, | 399 | union acpi_operand_object **return_object_ptr, |
324 | const union acpi_predefined_info *predefined) | 400 | const union acpi_predefined_info *predefined) |
325 | { | 401 | { |
402 | union acpi_operand_object *return_object = *return_object_ptr; | ||
326 | const union acpi_predefined_info *package; | 403 | const union acpi_predefined_info *package; |
327 | union acpi_operand_object *sub_package; | 404 | union acpi_operand_object *sub_package; |
328 | union acpi_operand_object **elements; | 405 | union acpi_operand_object **elements; |
@@ -408,7 +485,7 @@ acpi_ns_check_package(char *pathname, | |||
408 | * elements must be of the same type | 485 | * elements must be of the same type |
409 | */ | 486 | */ |
410 | for (i = 0; i < count; i++) { | 487 | for (i = 0; i < count; i++) { |
411 | status = acpi_ns_check_object_type(pathname, *elements, | 488 | status = acpi_ns_check_object_type(pathname, elements, |
412 | package->ret_info. | 489 | package->ret_info. |
413 | object_type1, i); | 490 | object_type1, i); |
414 | if (ACPI_FAILURE(status)) { | 491 | if (ACPI_FAILURE(status)) { |
@@ -441,7 +518,7 @@ acpi_ns_check_package(char *pathname, | |||
441 | 518 | ||
442 | status = | 519 | status = |
443 | acpi_ns_check_object_type(pathname, | 520 | acpi_ns_check_object_type(pathname, |
444 | *elements, | 521 | elements, |
445 | package-> | 522 | package-> |
446 | ret_info3. | 523 | ret_info3. |
447 | object_type[i], | 524 | object_type[i], |
@@ -454,7 +531,7 @@ acpi_ns_check_package(char *pathname, | |||
454 | 531 | ||
455 | status = | 532 | status = |
456 | acpi_ns_check_object_type(pathname, | 533 | acpi_ns_check_object_type(pathname, |
457 | *elements, | 534 | elements, |
458 | package-> | 535 | package-> |
459 | ret_info3. | 536 | ret_info3. |
460 | tail_object_type, | 537 | tail_object_type, |
@@ -471,7 +548,7 @@ acpi_ns_check_package(char *pathname, | |||
471 | 548 | ||
472 | /* First element is the (Integer) count of sub-packages to follow */ | 549 | /* First element is the (Integer) count of sub-packages to follow */ |
473 | 550 | ||
474 | status = acpi_ns_check_object_type(pathname, *elements, | 551 | status = acpi_ns_check_object_type(pathname, elements, |
475 | ACPI_RTYPE_INTEGER, 0); | 552 | ACPI_RTYPE_INTEGER, 0); |
476 | if (ACPI_FAILURE(status)) { | 553 | if (ACPI_FAILURE(status)) { |
477 | return (status); | 554 | return (status); |
@@ -509,7 +586,7 @@ acpi_ns_check_package(char *pathname, | |||
509 | /* Each sub-object must be of type Package */ | 586 | /* Each sub-object must be of type Package */ |
510 | 587 | ||
511 | status = | 588 | status = |
512 | acpi_ns_check_object_type(pathname, sub_package, | 589 | acpi_ns_check_object_type(pathname, &sub_package, |
513 | ACPI_RTYPE_PACKAGE, i); | 590 | ACPI_RTYPE_PACKAGE, i); |
514 | if (ACPI_FAILURE(status)) { | 591 | if (ACPI_FAILURE(status)) { |
515 | return (status); | 592 | return (status); |
@@ -567,12 +644,8 @@ acpi_ns_check_package(char *pathname, | |||
567 | for (j = 0; j < expected_count; j++) { | 644 | for (j = 0; j < expected_count; j++) { |
568 | status = | 645 | status = |
569 | acpi_ns_check_object_type(pathname, | 646 | acpi_ns_check_object_type(pathname, |
570 | sub_elements | 647 | &sub_elements[j], |
571 | [j], | 648 | package->ret_info2.object_type[j], j); |
572 | package-> | ||
573 | ret_info2. | ||
574 | object_type | ||
575 | [j], j); | ||
576 | if (ACPI_FAILURE(status)) { | 649 | if (ACPI_FAILURE(status)) { |
577 | return (status); | 650 | return (status); |
578 | } | 651 | } |
@@ -611,7 +684,7 @@ acpi_ns_check_package(char *pathname, | |||
611 | 684 | ||
612 | status = | 685 | status = |
613 | acpi_ns_check_object_type(pathname, | 686 | acpi_ns_check_object_type(pathname, |
614 | *sub_elements, | 687 | sub_elements, |
615 | ACPI_RTYPE_INTEGER, | 688 | ACPI_RTYPE_INTEGER, |
616 | 0); | 689 | 0); |
617 | if (ACPI_FAILURE(status)) { | 690 | if (ACPI_FAILURE(status)) { |
@@ -708,7 +781,7 @@ acpi_ns_check_package_elements(char *pathname, | |||
708 | * The second group can have a count of zero. | 781 | * The second group can have a count of zero. |
709 | */ | 782 | */ |
710 | for (i = 0; i < count1; i++) { | 783 | for (i = 0; i < count1; i++) { |
711 | status = acpi_ns_check_object_type(pathname, *this_element, | 784 | status = acpi_ns_check_object_type(pathname, this_element, |
712 | type1, i); | 785 | type1, i); |
713 | if (ACPI_FAILURE(status)) { | 786 | if (ACPI_FAILURE(status)) { |
714 | return (status); | 787 | return (status); |
@@ -717,7 +790,7 @@ acpi_ns_check_package_elements(char *pathname, | |||
717 | } | 790 | } |
718 | 791 | ||
719 | for (i = 0; i < count2; i++) { | 792 | for (i = 0; i < count2; i++) { |
720 | status = acpi_ns_check_object_type(pathname, *this_element, | 793 | status = acpi_ns_check_object_type(pathname, this_element, |
721 | type2, (i + count1)); | 794 | type2, (i + count1)); |
722 | if (ACPI_FAILURE(status)) { | 795 | if (ACPI_FAILURE(status)) { |
723 | return (status); | 796 | return (status); |
@@ -733,8 +806,8 @@ acpi_ns_check_package_elements(char *pathname, | |||
733 | * FUNCTION: acpi_ns_check_object_type | 806 | * FUNCTION: acpi_ns_check_object_type |
734 | * | 807 | * |
735 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | 808 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) |
736 | * return_object - Object return from the execution of this | 809 | * return_object_ptr - Pointer to the object returned from the |
737 | * method/object | 810 | * evaluation of a method or object |
738 | * expected_btypes - Bitmap of expected return type(s) | 811 | * expected_btypes - Bitmap of expected return type(s) |
739 | * package_index - Index of object within parent package (if | 812 | * package_index - Index of object within parent package (if |
740 | * applicable - ACPI_NOT_PACKAGE otherwise) | 813 | * applicable - ACPI_NOT_PACKAGE otherwise) |
@@ -748,9 +821,10 @@ acpi_ns_check_package_elements(char *pathname, | |||
748 | 821 | ||
749 | static acpi_status | 822 | static acpi_status |
750 | acpi_ns_check_object_type(char *pathname, | 823 | acpi_ns_check_object_type(char *pathname, |
751 | union acpi_operand_object *return_object, | 824 | union acpi_operand_object **return_object_ptr, |
752 | u32 expected_btypes, u32 package_index) | 825 | u32 expected_btypes, u32 package_index) |
753 | { | 826 | { |
827 | union acpi_operand_object *return_object = *return_object_ptr; | ||
754 | acpi_status status = AE_OK; | 828 | acpi_status status = AE_OK; |
755 | u32 return_btype; | 829 | u32 return_btype; |
756 | char type_buffer[48]; /* Room for 5 types */ | 830 | char type_buffer[48]; /* Room for 5 types */ |
@@ -814,6 +888,14 @@ acpi_ns_check_object_type(char *pathname, | |||
814 | /* Is the object one of the expected types? */ | 888 | /* Is the object one of the expected types? */ |
815 | 889 | ||
816 | if (!(return_btype & expected_btypes)) { | 890 | if (!(return_btype & expected_btypes)) { |
891 | |||
892 | /* Type mismatch -- attempt repair of the returned object */ | ||
893 | |||
894 | status = acpi_ns_repair_object(expected_btypes, package_index, | ||
895 | return_object_ptr); | ||
896 | if (ACPI_SUCCESS(status)) { | ||
897 | return (status); | ||
898 | } | ||
817 | goto type_error_exit; | 899 | goto type_error_exit; |
818 | } | 900 | } |
819 | 901 | ||
@@ -898,3 +980,86 @@ acpi_ns_check_reference(char *pathname, | |||
898 | 980 | ||
899 | return (AE_AML_OPERAND_TYPE); | 981 | return (AE_AML_OPERAND_TYPE); |
900 | } | 982 | } |
983 | |||
984 | /******************************************************************************* | ||
985 | * | ||
986 | * FUNCTION: acpi_ns_repair_object | ||
987 | * | ||
988 | * PARAMETERS: Pathname - Full pathname to the node (for error msgs) | ||
989 | * package_index - Used to determine if target is in a package | ||
990 | * return_object_ptr - Pointer to the object returned from the | ||
991 | * evaluation of a method or object | ||
992 | * | ||
993 | * RETURN: Status. AE_OK if repair was successful. | ||
994 | * | ||
995 | * DESCRIPTION: Attempt to repair/convert a return object of a type that was | ||
996 | * not expected. | ||
997 | * | ||
998 | ******************************************************************************/ | ||
999 | |||
1000 | static acpi_status | ||
1001 | acpi_ns_repair_object(u32 expected_btypes, | ||
1002 | u32 package_index, | ||
1003 | union acpi_operand_object **return_object_ptr) | ||
1004 | { | ||
1005 | union acpi_operand_object *return_object = *return_object_ptr; | ||
1006 | union acpi_operand_object *new_object; | ||
1007 | acpi_size length; | ||
1008 | |||
1009 | switch (ACPI_GET_OBJECT_TYPE(return_object)) { | ||
1010 | case ACPI_TYPE_BUFFER: | ||
1011 | |||
1012 | if (!(expected_btypes & ACPI_RTYPE_STRING)) { | ||
1013 | return (AE_AML_OPERAND_TYPE); | ||
1014 | } | ||
1015 | |||
1016 | /* | ||
1017 | * Have a Buffer, expected a String, convert. Use a to_string | ||
1018 | * conversion, no transform performed on the buffer data. The best | ||
1019 | * example of this is the _BIF method, where the string data from | ||
1020 | * the battery is often (incorrectly) returned as buffer object(s). | ||
1021 | */ | ||
1022 | length = 0; | ||
1023 | while ((length < return_object->buffer.length) && | ||
1024 | (return_object->buffer.pointer[length])) { | ||
1025 | length++; | ||
1026 | } | ||
1027 | |||
1028 | /* Allocate a new string object */ | ||
1029 | |||
1030 | new_object = acpi_ut_create_string_object(length); | ||
1031 | if (!new_object) { | ||
1032 | return (AE_NO_MEMORY); | ||
1033 | } | ||
1034 | |||
1035 | /* | ||
1036 | * Copy the raw buffer data with no transform. String is already NULL | ||
1037 | * terminated at Length+1. | ||
1038 | */ | ||
1039 | ACPI_MEMCPY(new_object->string.pointer, | ||
1040 | return_object->buffer.pointer, length); | ||
1041 | |||
1042 | /* Install the new return object */ | ||
1043 | |||
1044 | acpi_ut_remove_reference(return_object); | ||
1045 | *return_object_ptr = new_object; | ||
1046 | |||
1047 | /* | ||
1048 | * If the object is a package element, we need to: | ||
1049 | * 1. Decrement the reference count of the orignal object, it was | ||
1050 | * incremented when building the package | ||
1051 | * 2. Increment the reference count of the new object, it will be | ||
1052 | * decremented when releasing the package | ||
1053 | */ | ||
1054 | if (package_index != ACPI_NOT_PACKAGE) { | ||
1055 | acpi_ut_remove_reference(return_object); | ||
1056 | acpi_ut_add_reference(new_object); | ||
1057 | } | ||
1058 | return (AE_OK); | ||
1059 | |||
1060 | default: | ||
1061 | break; | ||
1062 | } | ||
1063 | |||
1064 | return (AE_AML_OPERAND_TYPE); | ||
1065 | } | ||
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/acpica/nssearch.c index a9a80bf811b3..6fea13f3f52d 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nssearch") | 49 | ACPI_MODULE_NAME("nssearch") |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/acpica/nsutils.c index b0817e1127b1..3e1149bf4aa5 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -43,9 +43,10 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acnamesp.h" |
48 | #include <acpi/actables.h> | 48 | #include "amlcode.h" |
49 | #include "actables.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nsutils") | 52 | ACPI_MODULE_NAME("nsutils") |
@@ -314,9 +315,15 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) | |||
314 | * | 315 | * |
315 | * strlen() + 1 covers the first name_seg, which has no path separator | 316 | * strlen() + 1 covers the first name_seg, which has no path separator |
316 | */ | 317 | */ |
317 | if (acpi_ns_valid_root_prefix(next_external_char[0])) { | 318 | if (acpi_ns_valid_root_prefix(*next_external_char)) { |
318 | info->fully_qualified = TRUE; | 319 | info->fully_qualified = TRUE; |
319 | next_external_char++; | 320 | next_external_char++; |
321 | |||
322 | /* Skip redundant root_prefix, like \\_SB.PCI0.SBRG.EC0 */ | ||
323 | |||
324 | while (acpi_ns_valid_root_prefix(*next_external_char)) { | ||
325 | next_external_char++; | ||
326 | } | ||
320 | } else { | 327 | } else { |
321 | /* | 328 | /* |
322 | * Handle Carat prefixes | 329 | * Handle Carat prefixes |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/acpica/nswalk.c index 3c905ce26d7d..200895fa2728 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nswalk") | 49 | ACPI_MODULE_NAME("nswalk") |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index a085cc39c055..22a7171ac1ed 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acnamesp.h" |
48 | #include "acinterp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsxfeval") | 51 | ACPI_MODULE_NAME("nsxfeval") |
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 5efa4e7ddb0b..9589fea24997 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsxfname") | 50 | ACPI_MODULE_NAME("nsxfname") |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 2b375ee80cef..1c7efc15225f 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
@@ -43,7 +43,8 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsxfobj") | 50 | ACPI_MODULE_NAME("nsxfobj") |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/acpica/psargs.c index d830b29b85b1..b161f3544b51 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
@@ -42,10 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acnamesp.h> | 47 | #include "amlcode.h" |
48 | #include <acpi/acdispat.h> | 48 | #include "acnamesp.h" |
49 | #include "acdispat.h" | ||
49 | 50 | ||
50 | #define _COMPONENT ACPI_PARSER | 51 | #define _COMPONENT ACPI_PARSER |
51 | ACPI_MODULE_NAME("psargs") | 52 | ACPI_MODULE_NAME("psargs") |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/acpica/psloop.c index 4647039a0d8a..c5f6ce19a401 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
@@ -50,9 +50,10 @@ | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include <acpi/acpi.h> | 52 | #include <acpi/acpi.h> |
53 | #include <acpi/acparser.h> | 53 | #include "accommon.h" |
54 | #include <acpi/acdispat.h> | 54 | #include "acparser.h" |
55 | #include <acpi/amlcode.h> | 55 | #include "acdispat.h" |
56 | #include "amlcode.h" | ||
56 | 57 | ||
57 | #define _COMPONENT ACPI_PARSER | 58 | #define _COMPONENT ACPI_PARSER |
58 | ACPI_MODULE_NAME("psloop") | 59 | ACPI_MODULE_NAME("psloop") |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/acpica/psopcode.c index f425ab30eae8..3bc3a60194d6 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acopcode.h> | 46 | #include "acparser.h" |
47 | #include <acpi/amlcode.h> | 47 | #include "acopcode.h" |
48 | #include "amlcode.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_PARSER | 50 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME("psopcode") | 51 | ACPI_MODULE_NAME("psopcode") |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/acpica/psparse.c index 68e932f215ea..70838e9b608c 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
@@ -51,11 +51,12 @@ | |||
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <acpi/acpi.h> | 53 | #include <acpi/acpi.h> |
54 | #include <acpi/acparser.h> | 54 | #include "accommon.h" |
55 | #include <acpi/acdispat.h> | 55 | #include "acparser.h" |
56 | #include <acpi/amlcode.h> | 56 | #include "acdispat.h" |
57 | #include <acpi/acnamesp.h> | 57 | #include "amlcode.h" |
58 | #include <acpi/acinterp.h> | 58 | #include "acnamesp.h" |
59 | #include "acinterp.h" | ||
59 | 60 | ||
60 | #define _COMPONENT ACPI_PARSER | 61 | #define _COMPONENT ACPI_PARSER |
61 | ACPI_MODULE_NAME("psparse") | 62 | ACPI_MODULE_NAME("psparse") |
@@ -447,10 +448,22 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
447 | walk_state, walk_state->parser_state.aml, | 448 | walk_state, walk_state->parser_state.aml, |
448 | walk_state->parser_state.aml_size)); | 449 | walk_state->parser_state.aml_size)); |
449 | 450 | ||
451 | if (!walk_state->parser_state.aml) { | ||
452 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
453 | } | ||
454 | |||
450 | /* Create and initialize a new thread state */ | 455 | /* Create and initialize a new thread state */ |
451 | 456 | ||
452 | thread = acpi_ut_create_thread_state(); | 457 | thread = acpi_ut_create_thread_state(); |
453 | if (!thread) { | 458 | if (!thread) { |
459 | if (walk_state->method_desc) { | ||
460 | |||
461 | /* Executing a control method - additional cleanup */ | ||
462 | |||
463 | acpi_ds_terminate_control_method( | ||
464 | walk_state->method_desc, walk_state); | ||
465 | } | ||
466 | |||
454 | acpi_ds_delete_walk_state(walk_state); | 467 | acpi_ds_delete_walk_state(walk_state); |
455 | return_ACPI_STATUS(AE_NO_MEMORY); | 468 | return_ACPI_STATUS(AE_NO_MEMORY); |
456 | } | 469 | } |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/acpica/psscope.c index ee50e67c9443..2feca5ca9581 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/acpica/psscope.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include "acparser.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_PARSER | 48 | #define _COMPONENT ACPI_PARSER |
48 | ACPI_MODULE_NAME("psscope") | 49 | ACPI_MODULE_NAME("psscope") |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/acpica/pstree.c index 1dd355ddd182..4d3389118ec3 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/acpica/pstree.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include "amlcode.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
49 | ACPI_MODULE_NAME("pstree") | 50 | ACPI_MODULE_NAME("pstree") |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/acpica/psutils.c index 7cf1f65cd5bb..e636e078ad3d 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/amlcode.h> | 46 | #include "acparser.h" |
47 | #include "amlcode.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
49 | ACPI_MODULE_NAME("psutils") | 50 | ACPI_MODULE_NAME("psutils") |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/acpica/pswalk.c index 8b86ad5a3201..78b8b791f2ae 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include "acparser.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_PARSER | 48 | #define _COMPONENT ACPI_PARSER |
48 | ACPI_MODULE_NAME("pswalk") | 49 | ACPI_MODULE_NAME("pswalk") |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/acpica/psxface.c index 270469aae842..ff06032c0f06 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
@@ -42,9 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acdispat.h> | 46 | #include "acparser.h" |
47 | #include <acpi/acinterp.h> | 47 | #include "acdispat.h" |
48 | #include "acinterp.h" | ||
49 | #include "amlcode.h" | ||
48 | 50 | ||
49 | #define _COMPONENT ACPI_PARSER | 51 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME("psxface") | 52 | ACPI_MODULE_NAME("psxface") |
@@ -278,6 +280,38 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) | |||
278 | goto cleanup; | 280 | goto cleanup; |
279 | } | 281 | } |
280 | 282 | ||
283 | /* Invoke an internal method if necessary */ | ||
284 | |||
285 | if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | ||
286 | status = info->obj_desc->method.implementation(walk_state); | ||
287 | info->return_object = walk_state->return_desc; | ||
288 | |||
289 | /* Cleanup states */ | ||
290 | |||
291 | acpi_ds_scope_stack_clear(walk_state); | ||
292 | acpi_ps_cleanup_scope(&walk_state->parser_state); | ||
293 | acpi_ds_terminate_control_method(walk_state->method_desc, | ||
294 | walk_state); | ||
295 | acpi_ds_delete_walk_state(walk_state); | ||
296 | goto cleanup; | ||
297 | } | ||
298 | |||
299 | /* | ||
300 | * Start method evaluation with an implicit return of zero. | ||
301 | * This is done for Windows compatibility. | ||
302 | */ | ||
303 | if (acpi_gbl_enable_interpreter_slack) { | ||
304 | walk_state->implicit_return_obj = | ||
305 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
306 | if (!walk_state->implicit_return_obj) { | ||
307 | status = AE_NO_MEMORY; | ||
308 | acpi_ds_delete_walk_state(walk_state); | ||
309 | goto cleanup; | ||
310 | } | ||
311 | |||
312 | walk_state->implicit_return_obj->integer.value = 0; | ||
313 | } | ||
314 | |||
281 | /* Parse the AML */ | 315 | /* Parse the AML */ |
282 | 316 | ||
283 | status = acpi_ps_parse_aml(walk_state); | 317 | status = acpi_ps_parse_aml(walk_state); |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 7f96332822bf..1e437bfd8db5 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsaddr") | 49 | ACPI_MODULE_NAME("rsaddr") |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/acpica/rscalc.c index 8eaaecf92009..52865ee6bc77 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acresrc.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME("rscalc") | 50 | ACPI_MODULE_NAME("rscalc") |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/acpica/rscreate.c index 08b8d73e6ee5..61566b1a0616 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acresrc.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME("rscreate") | 50 | ACPI_MODULE_NAME("rscreate") |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/acpica/rsdump.c index 6bbbb7b8941a..3f0ca5a12d34 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsdump") | 49 | ACPI_MODULE_NAME("rsdump") |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index 3f0a1fedbe0e..77b25fdb459c 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsinfo") | 49 | ACPI_MODULE_NAME("rsinfo") |
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/acpica/rsio.c index b66d42e7402e..35a49aa95609 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/acpica/rsio.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsio") | 49 | ACPI_MODULE_NAME("rsio") |
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/acpica/rsirq.c index a8805efc0366..2e0256983aa6 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsirq") | 49 | ACPI_MODULE_NAME("rsirq") |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/acpica/rslist.c index b78c7e797a19..1b1dbc69f087 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rslist") | 49 | ACPI_MODULE_NAME("rslist") |
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index 63b21abd90bb..ddc76cebdc92 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsmemory") | 49 | ACPI_MODULE_NAME("rsmemory") |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index 96a6c0353255..5bc49a553284 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include "acresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsmisc") | 49 | ACPI_MODULE_NAME("rsmisc") |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/acpica/rsutils.c index f7b3bcd59ba7..bc03d5966829 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acresrc.h> | 46 | #include "acnamesp.h" |
47 | #include "acresrc.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME("rsutils") | 50 | ACPI_MODULE_NAME("rsutils") |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/acpica/rsxface.c index f59f4c4e034c..69a2aa5b5d83 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acresrc.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acresrc.h" |
47 | #include "acnamesp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
49 | ACPI_MODULE_NAME("rsxface") | 50 | ACPI_MODULE_NAME("rsxface") |
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 2817158fb6a1..3636e4f8fb73 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -42,15 +42,16 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/actables.h> | 45 | #include "accommon.h" |
46 | #include "actables.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_TABLES | 48 | #define _COMPONENT ACPI_TABLES |
48 | ACPI_MODULE_NAME("tbfadt") | 49 | ACPI_MODULE_NAME("tbfadt") |
49 | 50 | ||
50 | /* Local prototypes */ | 51 | /* Local prototypes */ |
51 | static void inline | 52 | static inline void |
52 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
53 | u8 byte_width, u64 address); | 54 | u8 space_id, u8 byte_width, u64 address); |
54 | 55 | ||
55 | static void acpi_tb_convert_fadt(void); | 56 | static void acpi_tb_convert_fadt(void); |
56 | 57 | ||
@@ -60,9 +61,10 @@ static void acpi_tb_validate_fadt(void); | |||
60 | 61 | ||
61 | typedef struct acpi_fadt_info { | 62 | typedef struct acpi_fadt_info { |
62 | char *name; | 63 | char *name; |
63 | u8 target; | 64 | u8 address64; |
64 | u8 source; | 65 | u8 address32; |
65 | u8 length; | 66 | u8 length; |
67 | u8 default_length; | ||
66 | u8 type; | 68 | u8 type; |
67 | 69 | ||
68 | } acpi_fadt_info; | 70 | } acpi_fadt_info; |
@@ -71,37 +73,61 @@ typedef struct acpi_fadt_info { | |||
71 | #define ACPI_FADT_SEPARATE_LENGTH 2 | 73 | #define ACPI_FADT_SEPARATE_LENGTH 2 |
72 | 74 | ||
73 | static struct acpi_fadt_info fadt_info_table[] = { | 75 | static struct acpi_fadt_info fadt_info_table[] = { |
74 | {"Pm1aEventBlock", ACPI_FADT_OFFSET(xpm1a_event_block), | 76 | {"Pm1aEventBlock", |
77 | ACPI_FADT_OFFSET(xpm1a_event_block), | ||
75 | ACPI_FADT_OFFSET(pm1a_event_block), | 78 | ACPI_FADT_OFFSET(pm1a_event_block), |
76 | ACPI_FADT_OFFSET(pm1_event_length), ACPI_FADT_REQUIRED}, | 79 | ACPI_FADT_OFFSET(pm1_event_length), |
80 | ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ | ||
81 | ACPI_FADT_REQUIRED}, | ||
77 | 82 | ||
78 | {"Pm1bEventBlock", ACPI_FADT_OFFSET(xpm1b_event_block), | 83 | {"Pm1bEventBlock", |
84 | ACPI_FADT_OFFSET(xpm1b_event_block), | ||
79 | ACPI_FADT_OFFSET(pm1b_event_block), | 85 | ACPI_FADT_OFFSET(pm1b_event_block), |
80 | ACPI_FADT_OFFSET(pm1_event_length), 0}, | 86 | ACPI_FADT_OFFSET(pm1_event_length), |
87 | ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ | ||
88 | 0}, | ||
81 | 89 | ||
82 | {"Pm1aControlBlock", ACPI_FADT_OFFSET(xpm1a_control_block), | 90 | {"Pm1aControlBlock", |
91 | ACPI_FADT_OFFSET(xpm1a_control_block), | ||
83 | ACPI_FADT_OFFSET(pm1a_control_block), | 92 | ACPI_FADT_OFFSET(pm1a_control_block), |
84 | ACPI_FADT_OFFSET(pm1_control_length), ACPI_FADT_REQUIRED}, | 93 | ACPI_FADT_OFFSET(pm1_control_length), |
94 | ACPI_PM1_REGISTER_WIDTH, | ||
95 | ACPI_FADT_REQUIRED}, | ||
85 | 96 | ||
86 | {"Pm1bControlBlock", ACPI_FADT_OFFSET(xpm1b_control_block), | 97 | {"Pm1bControlBlock", |
98 | ACPI_FADT_OFFSET(xpm1b_control_block), | ||
87 | ACPI_FADT_OFFSET(pm1b_control_block), | 99 | ACPI_FADT_OFFSET(pm1b_control_block), |
88 | ACPI_FADT_OFFSET(pm1_control_length), 0}, | 100 | ACPI_FADT_OFFSET(pm1_control_length), |
101 | ACPI_PM1_REGISTER_WIDTH, | ||
102 | 0}, | ||
89 | 103 | ||
90 | {"Pm2ControlBlock", ACPI_FADT_OFFSET(xpm2_control_block), | 104 | {"Pm2ControlBlock", |
105 | ACPI_FADT_OFFSET(xpm2_control_block), | ||
91 | ACPI_FADT_OFFSET(pm2_control_block), | 106 | ACPI_FADT_OFFSET(pm2_control_block), |
92 | ACPI_FADT_OFFSET(pm2_control_length), ACPI_FADT_SEPARATE_LENGTH}, | 107 | ACPI_FADT_OFFSET(pm2_control_length), |
108 | ACPI_PM2_REGISTER_WIDTH, | ||
109 | ACPI_FADT_SEPARATE_LENGTH}, | ||
93 | 110 | ||
94 | {"PmTimerBlock", ACPI_FADT_OFFSET(xpm_timer_block), | 111 | {"PmTimerBlock", |
112 | ACPI_FADT_OFFSET(xpm_timer_block), | ||
95 | ACPI_FADT_OFFSET(pm_timer_block), | 113 | ACPI_FADT_OFFSET(pm_timer_block), |
96 | ACPI_FADT_OFFSET(pm_timer_length), ACPI_FADT_REQUIRED}, | 114 | ACPI_FADT_OFFSET(pm_timer_length), |
115 | ACPI_PM_TIMER_WIDTH, | ||
116 | ACPI_FADT_REQUIRED}, | ||
97 | 117 | ||
98 | {"Gpe0Block", ACPI_FADT_OFFSET(xgpe0_block), | 118 | {"Gpe0Block", |
119 | ACPI_FADT_OFFSET(xgpe0_block), | ||
99 | ACPI_FADT_OFFSET(gpe0_block), | 120 | ACPI_FADT_OFFSET(gpe0_block), |
100 | ACPI_FADT_OFFSET(gpe0_block_length), ACPI_FADT_SEPARATE_LENGTH}, | 121 | ACPI_FADT_OFFSET(gpe0_block_length), |
122 | 0, | ||
123 | ACPI_FADT_SEPARATE_LENGTH}, | ||
101 | 124 | ||
102 | {"Gpe1Block", ACPI_FADT_OFFSET(xgpe1_block), | 125 | {"Gpe1Block", |
126 | ACPI_FADT_OFFSET(xgpe1_block), | ||
103 | ACPI_FADT_OFFSET(gpe1_block), | 127 | ACPI_FADT_OFFSET(gpe1_block), |
104 | ACPI_FADT_OFFSET(gpe1_block_length), ACPI_FADT_SEPARATE_LENGTH} | 128 | ACPI_FADT_OFFSET(gpe1_block_length), |
129 | 0, | ||
130 | ACPI_FADT_SEPARATE_LENGTH} | ||
105 | }; | 131 | }; |
106 | 132 | ||
107 | #define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) | 133 | #define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) |
@@ -122,9 +148,9 @@ static struct acpi_fadt_info fadt_info_table[] = { | |||
122 | * | 148 | * |
123 | ******************************************************************************/ | 149 | ******************************************************************************/ |
124 | 150 | ||
125 | static void inline | 151 | static inline void |
126 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 152 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
127 | u8 byte_width, u64 address) | 153 | u8 space_id, u8 byte_width, u64 address) |
128 | { | 154 | { |
129 | 155 | ||
130 | /* | 156 | /* |
@@ -135,10 +161,10 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
135 | 161 | ||
136 | /* All other fields are byte-wide */ | 162 | /* All other fields are byte-wide */ |
137 | 163 | ||
138 | generic_address->space_id = ACPI_ADR_SPACE_SYSTEM_IO; | 164 | generic_address->space_id = space_id; |
139 | generic_address->bit_width = byte_width << 3; | 165 | generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); |
140 | generic_address->bit_offset = 0; | 166 | generic_address->bit_offset = 0; |
141 | generic_address->access_width = 0; | 167 | generic_address->access_width = 0; /* Access width ANY */ |
142 | } | 168 | } |
143 | 169 | ||
144 | /******************************************************************************* | 170 | /******************************************************************************* |
@@ -225,7 +251,8 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
225 | */ | 251 | */ |
226 | if (length > sizeof(struct acpi_table_fadt)) { | 252 | if (length > sizeof(struct acpi_table_fadt)) { |
227 | ACPI_WARNING((AE_INFO, | 253 | ACPI_WARNING((AE_INFO, |
228 | "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%zX", | 254 | "FADT (revision %u) is longer than ACPI 2.0 version, " |
255 | "truncating length 0x%X to 0x%zX", | ||
229 | table->revision, (unsigned)length, | 256 | table->revision, (unsigned)length, |
230 | sizeof(struct acpi_table_fadt))); | 257 | sizeof(struct acpi_table_fadt))); |
231 | } | 258 | } |
@@ -244,7 +271,6 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
244 | * 2) Validate some of the important values within the FADT | 271 | * 2) Validate some of the important values within the FADT |
245 | */ | 272 | */ |
246 | acpi_tb_convert_fadt(); | 273 | acpi_tb_convert_fadt(); |
247 | acpi_tb_validate_fadt(); | ||
248 | } | 274 | } |
249 | 275 | ||
250 | /******************************************************************************* | 276 | /******************************************************************************* |
@@ -278,22 +304,36 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
278 | 304 | ||
279 | static void acpi_tb_convert_fadt(void) | 305 | static void acpi_tb_convert_fadt(void) |
280 | { | 306 | { |
281 | u8 pm1_register_length; | 307 | u8 pm1_register_bit_width; |
282 | struct acpi_generic_address *target; | 308 | u8 pm1_register_byte_width; |
309 | struct acpi_generic_address *target64; | ||
283 | u32 i; | 310 | u32 i; |
284 | 311 | ||
285 | /* Update the local FADT table header length */ | 312 | /* Update the local FADT table header length */ |
286 | 313 | ||
287 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); | 314 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); |
288 | 315 | ||
289 | /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */ | 316 | /* |
290 | 317 | * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. | |
318 | * Later code will always use the X 64-bit field. Also, check for an | ||
319 | * address mismatch between the 32-bit and 64-bit address fields | ||
320 | * (FIRMWARE_CTRL/X_FIRMWARE_CTRL, DSDT/X_DSDT) which would indicate | ||
321 | * the presence of two FACS or two DSDT tables. | ||
322 | */ | ||
291 | if (!acpi_gbl_FADT.Xfacs) { | 323 | if (!acpi_gbl_FADT.Xfacs) { |
292 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; | 324 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; |
325 | } else if (acpi_gbl_FADT.facs && | ||
326 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { | ||
327 | ACPI_WARNING((AE_INFO, | ||
328 | "32/64 FACS address mismatch in FADT - two FACS tables!")); | ||
293 | } | 329 | } |
294 | 330 | ||
295 | if (!acpi_gbl_FADT.Xdsdt) { | 331 | if (!acpi_gbl_FADT.Xdsdt) { |
296 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; | 332 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; |
333 | } else if (acpi_gbl_FADT.dsdt && | ||
334 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { | ||
335 | ACPI_WARNING((AE_INFO, | ||
336 | "32/64 DSDT address mismatch in FADT - two DSDT tables!")); | ||
297 | } | 337 | } |
298 | 338 | ||
299 | /* | 339 | /* |
@@ -312,18 +352,23 @@ static void acpi_tb_convert_fadt(void) | |||
312 | } | 352 | } |
313 | 353 | ||
314 | /* | 354 | /* |
315 | * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X" | 355 | * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" |
316 | * generic address structures as necessary. | 356 | * generic address structures as necessary. Later code will always use |
357 | * the 64-bit address structures. | ||
317 | */ | 358 | */ |
318 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 359 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
319 | target = | 360 | target64 = |
320 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, | 361 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, |
321 | fadt_info_table[i].target); | 362 | fadt_info_table[i].address64); |
322 | 363 | ||
323 | /* Expand only if the X target is null */ | 364 | /* Expand only if the 64-bit X target is null */ |
324 | 365 | ||
325 | if (!target->address) { | 366 | if (!target64->address) { |
326 | acpi_tb_init_generic_address(target, | 367 | |
368 | /* The space_id is always I/O for the 32-bit legacy address fields */ | ||
369 | |||
370 | acpi_tb_init_generic_address(target64, | ||
371 | ACPI_ADR_SPACE_SYSTEM_IO, | ||
327 | *ACPI_ADD_PTR(u8, | 372 | *ACPI_ADD_PTR(u8, |
328 | &acpi_gbl_FADT, | 373 | &acpi_gbl_FADT, |
329 | fadt_info_table | 374 | fadt_info_table |
@@ -332,11 +377,64 @@ static void acpi_tb_convert_fadt(void) | |||
332 | &acpi_gbl_FADT, | 377 | &acpi_gbl_FADT, |
333 | fadt_info_table | 378 | fadt_info_table |
334 | [i]. | 379 | [i]. |
335 | source)); | 380 | address32)); |
381 | } | ||
382 | } | ||
383 | |||
384 | /* Validate FADT values now, before we make any changes */ | ||
385 | |||
386 | acpi_tb_validate_fadt(); | ||
387 | |||
388 | /* | ||
389 | * Optionally check all register lengths against the default values and | ||
390 | * update them if they are incorrect. | ||
391 | */ | ||
392 | if (acpi_gbl_use_default_register_widths) { | ||
393 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | ||
394 | target64 = | ||
395 | ACPI_ADD_PTR(struct acpi_generic_address, | ||
396 | &acpi_gbl_FADT, | ||
397 | fadt_info_table[i].address64); | ||
398 | |||
399 | /* | ||
400 | * If a valid register (Address != 0) and the (default_length > 0) | ||
401 | * (Not a GPE register), then check the width against the default. | ||
402 | */ | ||
403 | if ((target64->address) && | ||
404 | (fadt_info_table[i].default_length > 0) && | ||
405 | (fadt_info_table[i].default_length != | ||
406 | target64->bit_width)) { | ||
407 | ACPI_WARNING((AE_INFO, | ||
408 | "Invalid length for %s: %d, using default %d", | ||
409 | fadt_info_table[i].name, | ||
410 | target64->bit_width, | ||
411 | fadt_info_table[i]. | ||
412 | default_length)); | ||
413 | |||
414 | /* Incorrect size, set width to the default */ | ||
415 | |||
416 | target64->bit_width = | ||
417 | fadt_info_table[i].default_length; | ||
418 | } | ||
336 | } | 419 | } |
337 | } | 420 | } |
338 | 421 | ||
339 | /* | 422 | /* |
423 | * Get the length of the individual PM1 registers (enable and status). | ||
424 | * Each register is defined to be (event block length / 2). | ||
425 | */ | ||
426 | pm1_register_bit_width = | ||
427 | (u8)ACPI_DIV_2(acpi_gbl_FADT.xpm1a_event_block.bit_width); | ||
428 | pm1_register_byte_width = (u8)ACPI_DIV_8(pm1_register_bit_width); | ||
429 | |||
430 | /* | ||
431 | * Adjust the lengths of the PM1 Event Blocks so that they can be used to | ||
432 | * access the PM1 status register(s). Use (width / 2) | ||
433 | */ | ||
434 | acpi_gbl_FADT.xpm1a_event_block.bit_width = pm1_register_bit_width; | ||
435 | acpi_gbl_FADT.xpm1b_event_block.bit_width = pm1_register_bit_width; | ||
436 | |||
437 | /* | ||
340 | * Calculate separate GAS structs for the PM1 Enable registers. | 438 | * Calculate separate GAS structs for the PM1 Enable registers. |
341 | * These addresses do not appear (directly) in the FADT, so it is | 439 | * These addresses do not appear (directly) in the FADT, so it is |
342 | * useful to calculate them once, here. | 440 | * useful to calculate them once, here. |
@@ -356,14 +454,14 @@ static void acpi_tb_convert_fadt(void) | |||
356 | " PM1_EVT_LEN (%u)\n", | 454 | " PM1_EVT_LEN (%u)\n", |
357 | acpi_gbl_FADT.xpm1a_event_block.bit_width, | 455 | acpi_gbl_FADT.xpm1a_event_block.bit_width, |
358 | acpi_gbl_FADT.pm1_event_length); | 456 | acpi_gbl_FADT.pm1_event_length); |
359 | pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length); | ||
360 | 457 | ||
361 | /* The PM1A register block is required */ | 458 | /* The PM1A register block is required */ |
362 | 459 | ||
363 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, | 460 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, |
364 | pm1_register_length, | 461 | acpi_gbl_FADT.xpm1a_event_block.space_id, |
462 | pm1_register_byte_width, | ||
365 | (acpi_gbl_FADT.xpm1a_event_block.address + | 463 | (acpi_gbl_FADT.xpm1a_event_block.address + |
366 | pm1_register_length)); | 464 | pm1_register_byte_width)); |
367 | /* Don't forget to copy space_id of the GAS */ | 465 | /* Don't forget to copy space_id of the GAS */ |
368 | acpi_gbl_xpm1a_enable.space_id = | 466 | acpi_gbl_xpm1a_enable.space_id = |
369 | acpi_gbl_FADT.xpm1a_event_block.space_id; | 467 | acpi_gbl_FADT.xpm1a_event_block.space_id; |
@@ -379,9 +477,10 @@ static void acpi_tb_convert_fadt(void) | |||
379 | acpi_gbl_FADT.xpm1b_event_block.bit_width, | 477 | acpi_gbl_FADT.xpm1b_event_block.bit_width, |
380 | acpi_gbl_FADT.pm1_event_length); | 478 | acpi_gbl_FADT.pm1_event_length); |
381 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, | 479 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
382 | pm1_register_length, | 480 | acpi_gbl_FADT.xpm1b_event_block.space_id, |
481 | pm1_register_byte_width, | ||
383 | (acpi_gbl_FADT.xpm1b_event_block. | 482 | (acpi_gbl_FADT.xpm1b_event_block. |
384 | address + pm1_register_length)); | 483 | address + pm1_register_byte_width)); |
385 | /* Don't forget to copy space_id of the GAS */ | 484 | /* Don't forget to copy space_id of the GAS */ |
386 | acpi_gbl_xpm1b_enable.space_id = | 485 | acpi_gbl_xpm1b_enable.space_id = |
387 | acpi_gbl_FADT.xpm1b_event_block.space_id; | 486 | acpi_gbl_FADT.xpm1b_event_block.space_id; |
@@ -411,26 +510,63 @@ static void acpi_tb_convert_fadt(void) | |||
411 | 510 | ||
412 | static void acpi_tb_validate_fadt(void) | 511 | static void acpi_tb_validate_fadt(void) |
413 | { | 512 | { |
513 | char *name; | ||
414 | u32 *address32; | 514 | u32 *address32; |
415 | struct acpi_generic_address *address64; | 515 | struct acpi_generic_address *address64; |
416 | u8 length; | 516 | u8 length; |
417 | u32 i; | 517 | u32 i; |
418 | 518 | ||
419 | /* Examine all of the 64-bit extended address fields (X fields) */ | 519 | /* |
520 | * Check for FACS and DSDT address mismatches. An address mismatch between | ||
521 | * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and | ||
522 | * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. | ||
523 | */ | ||
524 | if (acpi_gbl_FADT.facs && | ||
525 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { | ||
526 | ACPI_WARNING((AE_INFO, | ||
527 | "32/64X FACS address mismatch in FADT - " | ||
528 | "two FACS tables! %8.8X/%8.8X%8.8X", | ||
529 | acpi_gbl_FADT.facs, | ||
530 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); | ||
531 | } | ||
420 | 532 | ||
421 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 533 | if (acpi_gbl_FADT.dsdt && |
534 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { | ||
535 | ACPI_WARNING((AE_INFO, | ||
536 | "32/64X DSDT address mismatch in FADT - " | ||
537 | "two DSDT tables! %8.8X/%8.8X%8.8X", | ||
538 | acpi_gbl_FADT.dsdt, | ||
539 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); | ||
540 | } | ||
422 | 541 | ||
423 | /* Generate pointers to the 32-bit and 64-bit addresses and get the length */ | 542 | /* Examine all of the 64-bit extended address fields (X fields) */ |
424 | 543 | ||
425 | address64 = | 544 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
426 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, | 545 | /* |
427 | fadt_info_table[i].target); | 546 | * Generate pointers to the 32-bit and 64-bit addresses, get the |
547 | * register length (width), and the register name | ||
548 | */ | ||
549 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, | ||
550 | &acpi_gbl_FADT, | ||
551 | fadt_info_table[i].address64); | ||
428 | address32 = | 552 | address32 = |
429 | ACPI_ADD_PTR(u32, &acpi_gbl_FADT, | 553 | ACPI_ADD_PTR(u32, &acpi_gbl_FADT, |
430 | fadt_info_table[i].source); | 554 | fadt_info_table[i].address32); |
431 | length = | 555 | length = |
432 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, | 556 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, |
433 | fadt_info_table[i].length); | 557 | fadt_info_table[i].length); |
558 | name = fadt_info_table[i].name; | ||
559 | |||
560 | /* | ||
561 | * For each extended field, check for length mismatch between the | ||
562 | * legacy length field and the corresponding 64-bit X length field. | ||
563 | */ | ||
564 | if (address64 && (address64->bit_width != ACPI_MUL_8(length))) { | ||
565 | ACPI_WARNING((AE_INFO, | ||
566 | "32/64X length mismatch in %s: %d/%d", | ||
567 | name, ACPI_MUL_8(length), | ||
568 | address64->bit_width)); | ||
569 | } | ||
434 | 570 | ||
435 | if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { | 571 | if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { |
436 | /* | 572 | /* |
@@ -439,8 +575,8 @@ static void acpi_tb_validate_fadt(void) | |||
439 | */ | 575 | */ |
440 | if (!address64->address || !length) { | 576 | if (!address64->address || !length) { |
441 | ACPI_ERROR((AE_INFO, | 577 | ACPI_ERROR((AE_INFO, |
442 | "Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X", | 578 | "Required field %s has zero address and/or length: %8.8X%8.8X/%X", |
443 | fadt_info_table[i].name, | 579 | name, |
444 | ACPI_FORMAT_UINT64(address64-> | 580 | ACPI_FORMAT_UINT64(address64-> |
445 | address), | 581 | address), |
446 | length)); | 582 | length)); |
@@ -453,8 +589,8 @@ static void acpi_tb_validate_fadt(void) | |||
453 | if ((address64->address && !length) | 589 | if ((address64->address && !length) |
454 | || (!address64->address && length)) { | 590 | || (!address64->address && length)) { |
455 | ACPI_WARNING((AE_INFO, | 591 | ACPI_WARNING((AE_INFO, |
456 | "Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X", | 592 | "Optional field %s has zero address or length: %8.8X%8.8X/%X", |
457 | fadt_info_table[i].name, | 593 | name, |
458 | ACPI_FORMAT_UINT64(address64-> | 594 | ACPI_FORMAT_UINT64(address64-> |
459 | address), | 595 | address), |
460 | length)); | 596 | length)); |
@@ -466,8 +602,8 @@ static void acpi_tb_validate_fadt(void) | |||
466 | if (address64->address && *address32 && | 602 | if (address64->address && *address32 && |
467 | (address64->address != (u64) * address32)) { | 603 | (address64->address != (u64) * address32)) { |
468 | ACPI_ERROR((AE_INFO, | 604 | ACPI_ERROR((AE_INFO, |
469 | "32/64X address mismatch in \"%s\": [%8.8X] [%8.8X%8.8X], using 64X", | 605 | "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 64X", |
470 | fadt_info_table[i].name, *address32, | 606 | name, *address32, |
471 | ACPI_FORMAT_UINT64(address64->address))); | 607 | ACPI_FORMAT_UINT64(address64->address))); |
472 | } | 608 | } |
473 | } | 609 | } |
diff --git a/drivers/acpi/tables/tbfind.c b/drivers/acpi/acpica/tbfind.c index 531584defbb8..1054dfd49207 100644 --- a/drivers/acpi/tables/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/actables.h> | 45 | #include "accommon.h" |
46 | #include "actables.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_TABLES | 48 | #define _COMPONENT ACPI_TABLES |
48 | ACPI_MODULE_NAME("tbfind") | 49 | ACPI_MODULE_NAME("tbfind") |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 18747ce8dd2f..37374b21969d 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/actables.h> | 46 | #include "acnamesp.h" |
47 | #include "actables.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
49 | ACPI_MODULE_NAME("tbinstal") | 50 | ACPI_MODULE_NAME("tbinstal") |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/acpica/tbutils.c index 0cc92ef5236f..9684cc827930 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/actables.h> | 45 | #include "accommon.h" |
46 | #include "actables.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_TABLES | 48 | #define _COMPONENT ACPI_TABLES |
48 | ACPI_MODULE_NAME("tbutils") | 49 | ACPI_MODULE_NAME("tbutils") |
@@ -113,6 +114,30 @@ acpi_tb_check_xsdt(acpi_physical_address address) | |||
113 | 114 | ||
114 | /******************************************************************************* | 115 | /******************************************************************************* |
115 | * | 116 | * |
117 | * FUNCTION: acpi_tb_initialize_facs | ||
118 | * | ||
119 | * PARAMETERS: None | ||
120 | * | ||
121 | * RETURN: Status | ||
122 | * | ||
123 | * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global | ||
124 | * for accessing the Global Lock and Firmware Waking Vector | ||
125 | * | ||
126 | ******************************************************************************/ | ||
127 | |||
128 | acpi_status acpi_tb_initialize_facs(void) | ||
129 | { | ||
130 | acpi_status status; | ||
131 | |||
132 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | ||
133 | ACPI_CAST_INDIRECT_PTR(struct | ||
134 | acpi_table_header, | ||
135 | &acpi_gbl_FACS)); | ||
136 | return status; | ||
137 | } | ||
138 | |||
139 | /******************************************************************************* | ||
140 | * | ||
116 | * FUNCTION: acpi_tb_tables_loaded | 141 | * FUNCTION: acpi_tb_tables_loaded |
117 | * | 142 | * |
118 | * PARAMETERS: None | 143 | * PARAMETERS: None |
@@ -420,7 +445,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
420 | 445 | ||
421 | /* Differentiate between RSDT and XSDT root tables */ | 446 | /* Differentiate between RSDT and XSDT root tables */ |
422 | 447 | ||
423 | if (rsdp->revision > 1 && rsdp->xsdt_physical_address) { | 448 | if (rsdp->revision > 1 && rsdp->xsdt_physical_address |
449 | && !acpi_rsdt_forced) { | ||
424 | /* | 450 | /* |
425 | * Root table is an XSDT (64-bit physical addresses). We must use the | 451 | * Root table is an XSDT (64-bit physical addresses). We must use the |
426 | * XSDT if the revision is > 1 and the XSDT pointer is present, as per | 452 | * XSDT if the revision is > 1 and the XSDT pointer is present, as per |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/acpica/tbxface.c index fd7770aa1061..c3e841f3cde9 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -43,8 +43,9 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 46 | #include "accommon.h" |
47 | #include <acpi/actables.h> | 47 | #include "acnamesp.h" |
48 | #include "actables.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME("tbxface") | 51 | ACPI_MODULE_NAME("tbxface") |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 2d157e0f98d2..b7fc8dd43341 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/actables.h> | 45 | #include "accommon.h" |
46 | #include "actables.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_TABLES | 48 | #define _COMPONENT ACPI_TABLES |
48 | ACPI_MODULE_NAME("tbxfroot") | 49 | ACPI_MODULE_NAME("tbxfroot") |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/acpica/utalloc.c index 241c535c1753..7580f6b3069e 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acdebug.h> | 45 | #include "accommon.h" |
46 | #include "acdebug.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utalloc") | 49 | ACPI_MODULE_NAME("utalloc") |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/acpica/utcopy.c index 5b2f7c27b705..b0dcfd3c872a 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/acpica/utdebug.c index fd66ecb6741e..38821f53042c 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -42,6 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
45 | 46 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utdebug") | 48 | ACPI_MODULE_NAME("utdebug") |
@@ -136,7 +137,7 @@ static const char *acpi_ut_trim_function_name(const char *function_name) | |||
136 | 137 | ||
137 | /******************************************************************************* | 138 | /******************************************************************************* |
138 | * | 139 | * |
139 | * FUNCTION: acpi_ut_debug_print | 140 | * FUNCTION: acpi_debug_print |
140 | * | 141 | * |
141 | * PARAMETERS: requested_debug_level - Requested debug print level | 142 | * PARAMETERS: requested_debug_level - Requested debug print level |
142 | * line_number - Caller's line number (for error output) | 143 | * line_number - Caller's line number (for error output) |
@@ -154,11 +155,11 @@ static const char *acpi_ut_trim_function_name(const char *function_name) | |||
154 | ******************************************************************************/ | 155 | ******************************************************************************/ |
155 | 156 | ||
156 | void ACPI_INTERNAL_VAR_XFACE | 157 | void ACPI_INTERNAL_VAR_XFACE |
157 | acpi_ut_debug_print(u32 requested_debug_level, | 158 | acpi_debug_print(u32 requested_debug_level, |
158 | u32 line_number, | 159 | u32 line_number, |
159 | const char *function_name, | 160 | const char *function_name, |
160 | const char *module_name, | 161 | const char *module_name, |
161 | u32 component_id, const char *format, ...) | 162 | u32 component_id, const char *format, ...) |
162 | { | 163 | { |
163 | acpi_thread_id thread_id; | 164 | acpi_thread_id thread_id; |
164 | va_list args; | 165 | va_list args; |
@@ -205,11 +206,11 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
205 | va_end(args); | 206 | va_end(args); |
206 | } | 207 | } |
207 | 208 | ||
208 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) | 209 | ACPI_EXPORT_SYMBOL(acpi_debug_print) |
209 | 210 | ||
210 | /******************************************************************************* | 211 | /******************************************************************************* |
211 | * | 212 | * |
212 | * FUNCTION: acpi_ut_debug_print_raw | 213 | * FUNCTION: acpi_debug_print_raw |
213 | * | 214 | * |
214 | * PARAMETERS: requested_debug_level - Requested debug print level | 215 | * PARAMETERS: requested_debug_level - Requested debug print level |
215 | * line_number - Caller's line number | 216 | * line_number - Caller's line number |
@@ -226,11 +227,11 @@ ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) | |||
226 | * | 227 | * |
227 | ******************************************************************************/ | 228 | ******************************************************************************/ |
228 | void ACPI_INTERNAL_VAR_XFACE | 229 | void ACPI_INTERNAL_VAR_XFACE |
229 | acpi_ut_debug_print_raw(u32 requested_debug_level, | 230 | acpi_debug_print_raw(u32 requested_debug_level, |
230 | u32 line_number, | 231 | u32 line_number, |
231 | const char *function_name, | 232 | const char *function_name, |
232 | const char *module_name, | 233 | const char *module_name, |
233 | u32 component_id, const char *format, ...) | 234 | u32 component_id, const char *format, ...) |
234 | { | 235 | { |
235 | va_list args; | 236 | va_list args; |
236 | 237 | ||
@@ -244,7 +245,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, | |||
244 | va_end(args); | 245 | va_end(args); |
245 | } | 246 | } |
246 | 247 | ||
247 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) | 248 | ACPI_EXPORT_SYMBOL(acpi_debug_print_raw) |
248 | 249 | ||
249 | /******************************************************************************* | 250 | /******************************************************************************* |
250 | * | 251 | * |
@@ -270,9 +271,9 @@ acpi_ut_trace(u32 line_number, | |||
270 | acpi_gbl_nesting_level++; | 271 | acpi_gbl_nesting_level++; |
271 | acpi_ut_track_stack_ptr(); | 272 | acpi_ut_track_stack_ptr(); |
272 | 273 | ||
273 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 274 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
274 | line_number, function_name, module_name, | 275 | line_number, function_name, module_name, component_id, |
275 | component_id, "%s\n", acpi_gbl_fn_entry_str); | 276 | "%s\n", acpi_gbl_fn_entry_str); |
276 | } | 277 | } |
277 | 278 | ||
278 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) | 279 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
@@ -301,10 +302,9 @@ acpi_ut_trace_ptr(u32 line_number, | |||
301 | acpi_gbl_nesting_level++; | 302 | acpi_gbl_nesting_level++; |
302 | acpi_ut_track_stack_ptr(); | 303 | acpi_ut_track_stack_ptr(); |
303 | 304 | ||
304 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 305 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
305 | line_number, function_name, module_name, | 306 | line_number, function_name, module_name, component_id, |
306 | component_id, "%s %p\n", acpi_gbl_fn_entry_str, | 307 | "%s %p\n", acpi_gbl_fn_entry_str, pointer); |
307 | pointer); | ||
308 | } | 308 | } |
309 | 309 | ||
310 | /******************************************************************************* | 310 | /******************************************************************************* |
@@ -333,10 +333,9 @@ acpi_ut_trace_str(u32 line_number, | |||
333 | acpi_gbl_nesting_level++; | 333 | acpi_gbl_nesting_level++; |
334 | acpi_ut_track_stack_ptr(); | 334 | acpi_ut_track_stack_ptr(); |
335 | 335 | ||
336 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 336 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
337 | line_number, function_name, module_name, | 337 | line_number, function_name, module_name, component_id, |
338 | component_id, "%s %s\n", acpi_gbl_fn_entry_str, | 338 | "%s %s\n", acpi_gbl_fn_entry_str, string); |
339 | string); | ||
340 | } | 339 | } |
341 | 340 | ||
342 | /******************************************************************************* | 341 | /******************************************************************************* |
@@ -365,10 +364,9 @@ acpi_ut_trace_u32(u32 line_number, | |||
365 | acpi_gbl_nesting_level++; | 364 | acpi_gbl_nesting_level++; |
366 | acpi_ut_track_stack_ptr(); | 365 | acpi_ut_track_stack_ptr(); |
367 | 366 | ||
368 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 367 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
369 | line_number, function_name, module_name, | 368 | line_number, function_name, module_name, component_id, |
370 | component_id, "%s %08X\n", acpi_gbl_fn_entry_str, | 369 | "%s %08X\n", acpi_gbl_fn_entry_str, integer); |
371 | integer); | ||
372 | } | 370 | } |
373 | 371 | ||
374 | /******************************************************************************* | 372 | /******************************************************************************* |
@@ -393,9 +391,9 @@ acpi_ut_exit(u32 line_number, | |||
393 | const char *module_name, u32 component_id) | 391 | const char *module_name, u32 component_id) |
394 | { | 392 | { |
395 | 393 | ||
396 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 394 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
397 | line_number, function_name, module_name, | 395 | line_number, function_name, module_name, component_id, |
398 | component_id, "%s\n", acpi_gbl_fn_exit_str); | 396 | "%s\n", acpi_gbl_fn_exit_str); |
399 | 397 | ||
400 | acpi_gbl_nesting_level--; | 398 | acpi_gbl_nesting_level--; |
401 | } | 399 | } |
@@ -426,17 +424,16 @@ acpi_ut_status_exit(u32 line_number, | |||
426 | { | 424 | { |
427 | 425 | ||
428 | if (ACPI_SUCCESS(status)) { | 426 | if (ACPI_SUCCESS(status)) { |
429 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 427 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
430 | line_number, function_name, module_name, | 428 | line_number, function_name, module_name, |
431 | component_id, "%s %s\n", | 429 | component_id, "%s %s\n", acpi_gbl_fn_exit_str, |
432 | acpi_gbl_fn_exit_str, | 430 | acpi_format_exception(status)); |
433 | acpi_format_exception(status)); | ||
434 | } else { | 431 | } else { |
435 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 432 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
436 | line_number, function_name, module_name, | 433 | line_number, function_name, module_name, |
437 | component_id, "%s ****Exception****: %s\n", | 434 | component_id, "%s ****Exception****: %s\n", |
438 | acpi_gbl_fn_exit_str, | 435 | acpi_gbl_fn_exit_str, |
439 | acpi_format_exception(status)); | 436 | acpi_format_exception(status)); |
440 | } | 437 | } |
441 | 438 | ||
442 | acpi_gbl_nesting_level--; | 439 | acpi_gbl_nesting_level--; |
@@ -467,10 +464,10 @@ acpi_ut_value_exit(u32 line_number, | |||
467 | u32 component_id, acpi_integer value) | 464 | u32 component_id, acpi_integer value) |
468 | { | 465 | { |
469 | 466 | ||
470 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 467 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
471 | line_number, function_name, module_name, | 468 | line_number, function_name, module_name, component_id, |
472 | component_id, "%s %8.8X%8.8X\n", | 469 | "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, |
473 | acpi_gbl_fn_exit_str, ACPI_FORMAT_UINT64(value)); | 470 | ACPI_FORMAT_UINT64(value)); |
474 | 471 | ||
475 | acpi_gbl_nesting_level--; | 472 | acpi_gbl_nesting_level--; |
476 | } | 473 | } |
@@ -499,9 +496,9 @@ acpi_ut_ptr_exit(u32 line_number, | |||
499 | const char *module_name, u32 component_id, u8 *ptr) | 496 | const char *module_name, u32 component_id, u8 *ptr) |
500 | { | 497 | { |
501 | 498 | ||
502 | acpi_ut_debug_print(ACPI_LV_FUNCTIONS, | 499 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
503 | line_number, function_name, module_name, | 500 | line_number, function_name, module_name, component_id, |
504 | component_id, "%s %p\n", acpi_gbl_fn_exit_str, ptr); | 501 | "%s %p\n", acpi_gbl_fn_exit_str, ptr); |
505 | 502 | ||
506 | acpi_gbl_nesting_level--; | 503 | acpi_gbl_nesting_level--; |
507 | } | 504 | } |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/acpica/utdelete.c index d197c6b29e17..a0be9e39531e 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acinterp.h" |
47 | #include <acpi/acevents.h> | 47 | #include "acnamesp.h" |
48 | #include "acevents.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utdelete") | 51 | ACPI_MODULE_NAME("utdelete") |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/acpica/uteval.c index 352747e49c7a..da9450bc60f7 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -42,8 +42,9 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acinterp.h> | 46 | #include "acnamesp.h" |
47 | #include "acinterp.h" | ||
47 | 48 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("uteval") | 50 | ACPI_MODULE_NAME("uteval") |
@@ -129,7 +130,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
129 | 130 | ||
130 | /* The interface is supported */ | 131 | /* The interface is supported */ |
131 | 132 | ||
132 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 133 | return_ACPI_STATUS(AE_OK); |
133 | } | 134 | } |
134 | } | 135 | } |
135 | 136 | ||
@@ -143,13 +144,13 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
143 | 144 | ||
144 | /* The interface is supported */ | 145 | /* The interface is supported */ |
145 | 146 | ||
146 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 147 | return_ACPI_STATUS(AE_OK); |
147 | } | 148 | } |
148 | 149 | ||
149 | /* The interface is not supported */ | 150 | /* The interface is not supported */ |
150 | 151 | ||
151 | return_desc->integer.value = 0; | 152 | return_desc->integer.value = 0; |
152 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 153 | return_ACPI_STATUS(AE_OK); |
153 | } | 154 | } |
154 | 155 | ||
155 | /******************************************************************************* | 156 | /******************************************************************************* |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/acpica/utglobal.c index 17ed5ac840f7..a3ab9d9da299 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -44,11 +44,11 @@ | |||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include "accommon.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | ||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utglobal") | 51 | ACPI_MODULE_NAME("utglobal") |
52 | 52 | ||
53 | /******************************************************************************* | 53 | /******************************************************************************* |
54 | * | 54 | * |
@@ -352,7 +352,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | |||
352 | "PCI_Config", | 352 | "PCI_Config", |
353 | "EmbeddedControl", | 353 | "EmbeddedControl", |
354 | "SMBus", | 354 | "SMBus", |
355 | "CMOS", | 355 | "SystemCMOS", |
356 | "PCIBARTarget", | 356 | "PCIBARTarget", |
357 | "DataTable" | 357 | "DataTable" |
358 | }; | 358 | }; |
@@ -756,6 +756,7 @@ acpi_status acpi_ut_init_globals(void) | |||
756 | acpi_gbl_gpe_xrupt_list_head = NULL; | 756 | acpi_gbl_gpe_xrupt_list_head = NULL; |
757 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 757 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
758 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 758 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
759 | acpi_current_gpe_count = 0; | ||
759 | 760 | ||
760 | /* Global handlers */ | 761 | /* Global handlers */ |
761 | 762 | ||
@@ -771,6 +772,7 @@ acpi_status acpi_ut_init_globals(void) | |||
771 | acpi_gbl_global_lock_mutex = NULL; | 772 | acpi_gbl_global_lock_mutex = NULL; |
772 | acpi_gbl_global_lock_acquired = FALSE; | 773 | acpi_gbl_global_lock_acquired = FALSE; |
773 | acpi_gbl_global_lock_handle = 0; | 774 | acpi_gbl_global_lock_handle = 0; |
775 | acpi_gbl_global_lock_present = FALSE; | ||
774 | 776 | ||
775 | /* Miscellaneous variables */ | 777 | /* Miscellaneous variables */ |
776 | 778 | ||
@@ -815,5 +817,7 @@ acpi_status acpi_ut_init_globals(void) | |||
815 | return_ACPI_STATUS(AE_OK); | 817 | return_ACPI_STATUS(AE_OK); |
816 | } | 818 | } |
817 | 819 | ||
820 | ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | ||
818 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 821 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
819 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 822 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
823 | ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) | ||
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/acpica/utinit.c index cae515fc02d3..a54ca84eb362 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -42,9 +42,10 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acevents.h> | 46 | #include "acnamesp.h" |
47 | #include <acpi/actables.h> | 47 | #include "acevents.h" |
48 | #include "actables.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utinit") | 51 | ACPI_MODULE_NAME("utinit") |
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/acpica/utmath.c index c927324fdd26..c9f682d640ef 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
@@ -42,6 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
45 | 46 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utmath") | 48 | ACPI_MODULE_NAME("utmath") |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/acpica/utmisc.c index 9089a158a874..c1f7f4e1a72d 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -44,7 +44,8 @@ | |||
44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
45 | 45 | ||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include "accommon.h" |
48 | #include "acnamesp.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utmisc") | 51 | ACPI_MODULE_NAME("utmisc") |
@@ -1016,7 +1017,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1016 | 1017 | ||
1017 | /******************************************************************************* | 1018 | /******************************************************************************* |
1018 | * | 1019 | * |
1019 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info | 1020 | * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info |
1020 | * | 1021 | * |
1021 | * PARAMETERS: module_name - Caller's module name (for error output) | 1022 | * PARAMETERS: module_name - Caller's module name (for error output) |
1022 | * line_number - Caller's line number (for error output) | 1023 | * line_number - Caller's line number (for error output) |
@@ -1029,7 +1030,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1029 | ******************************************************************************/ | 1030 | ******************************************************************************/ |
1030 | 1031 | ||
1031 | void ACPI_INTERNAL_VAR_XFACE | 1032 | void ACPI_INTERNAL_VAR_XFACE |
1032 | acpi_ut_error(const char *module_name, u32 line_number, const char *format, ...) | 1033 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) |
1033 | { | 1034 | { |
1034 | va_list args; | 1035 | va_list args; |
1035 | 1036 | ||
@@ -1042,8 +1043,8 @@ acpi_ut_error(const char *module_name, u32 line_number, const char *format, ...) | |||
1042 | } | 1043 | } |
1043 | 1044 | ||
1044 | void ACPI_INTERNAL_VAR_XFACE | 1045 | void ACPI_INTERNAL_VAR_XFACE |
1045 | acpi_ut_exception(const char *module_name, | 1046 | acpi_exception(const char *module_name, |
1046 | u32 line_number, acpi_status status, const char *format, ...) | 1047 | u32 line_number, acpi_status status, const char *format, ...) |
1047 | { | 1048 | { |
1048 | va_list args; | 1049 | va_list args; |
1049 | 1050 | ||
@@ -1056,11 +1057,8 @@ acpi_ut_exception(const char *module_name, | |||
1056 | va_end(args); | 1057 | va_end(args); |
1057 | } | 1058 | } |
1058 | 1059 | ||
1059 | EXPORT_SYMBOL(acpi_ut_exception); | ||
1060 | |||
1061 | void ACPI_INTERNAL_VAR_XFACE | 1060 | void ACPI_INTERNAL_VAR_XFACE |
1062 | acpi_ut_warning(const char *module_name, | 1061 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) |
1063 | u32 line_number, const char *format, ...) | ||
1064 | { | 1062 | { |
1065 | va_list args; | 1063 | va_list args; |
1066 | 1064 | ||
@@ -1073,7 +1071,7 @@ acpi_ut_warning(const char *module_name, | |||
1073 | } | 1071 | } |
1074 | 1072 | ||
1075 | void ACPI_INTERNAL_VAR_XFACE | 1073 | void ACPI_INTERNAL_VAR_XFACE |
1076 | acpi_ut_info(const char *module_name, u32 line_number, const char *format, ...) | 1074 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) |
1077 | { | 1075 | { |
1078 | va_list args; | 1076 | va_list args; |
1079 | 1077 | ||
@@ -1088,3 +1086,8 @@ acpi_ut_info(const char *module_name, u32 line_number, const char *format, ...) | |||
1088 | acpi_os_printf("\n"); | 1086 | acpi_os_printf("\n"); |
1089 | va_end(args); | 1087 | va_end(args); |
1090 | } | 1088 | } |
1089 | |||
1090 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
1091 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
1092 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
1093 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/acpica/utmutex.c index 7331dde9e1b3..14eb52c4d647 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -42,6 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
45 | 46 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utmutex") | 48 | ACPI_MODULE_NAME("utmutex") |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/acpica/utobject.c index 4bef3cfbaccb..fd5ea7543e5b 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acnamesp.h> | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utobject") | 49 | ACPI_MODULE_NAME("utobject") |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/acpica/utresrc.c index c3e3e1308edc..91b7c00236f4 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
@@ -42,7 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlresrc.h> | 45 | #include "accommon.h" |
46 | #include "amlresrc.h" | ||
46 | 47 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utresrc") | 49 | ACPI_MODULE_NAME("utresrc") |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/acpica/utstate.c index 63a6d3d77d88..0440c958f5a4 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
@@ -42,6 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include "accommon.h" | ||
45 | 46 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utstate") | 48 | ACPI_MODULE_NAME("utstate") |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/acpica/utxface.c index c198a4d40583..078a22728c6b 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -42,9 +42,11 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acevents.h> | 45 | #include "accommon.h" |
46 | #include <acpi/acnamesp.h> | 46 | #include "acevents.h" |
47 | #include <acpi/acdebug.h> | 47 | #include "acnamesp.h" |
48 | #include "acdebug.h" | ||
49 | #include "actables.h" | ||
48 | 50 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 51 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utxface") | 52 | ACPI_MODULE_NAME("utxface") |
@@ -148,6 +150,16 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
148 | } | 150 | } |
149 | 151 | ||
150 | /* | 152 | /* |
153 | * Obtain a permanent mapping for the FACS. This is required for the | ||
154 | * Global Lock and the Firmware Waking Vector | ||
155 | */ | ||
156 | status = acpi_tb_initialize_facs(); | ||
157 | if (ACPI_FAILURE(status)) { | ||
158 | ACPI_WARNING((AE_INFO, "Could not map the FACS table")); | ||
159 | return_ACPI_STATUS(status); | ||
160 | } | ||
161 | |||
162 | /* | ||
151 | * Install the default op_region handlers. These are installed unless | 163 | * Install the default op_region handlers. These are installed unless |
152 | * other handlers have already been installed via the | 164 | * other handlers have already been installed via the |
153 | * install_address_space_handler interface. | 165 | * install_address_space_handler interface. |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1423b0c0cd2e..65132f920459 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -471,7 +471,7 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
471 | 471 | ||
472 | static int acpi_battery_update(struct acpi_battery *battery) | 472 | static int acpi_battery_update(struct acpi_battery *battery) |
473 | { | 473 | { |
474 | int result; | 474 | int result, old_present = acpi_battery_present(battery); |
475 | result = acpi_battery_get_status(battery); | 475 | result = acpi_battery_get_status(battery); |
476 | if (result) | 476 | if (result) |
477 | return result; | 477 | return result; |
@@ -482,7 +482,8 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
482 | return 0; | 482 | return 0; |
483 | } | 483 | } |
484 | #endif | 484 | #endif |
485 | if (!battery->update_time) { | 485 | if (!battery->update_time || |
486 | old_present != acpi_battery_present(battery)) { | ||
486 | result = acpi_battery_get_info(battery); | 487 | result = acpi_battery_get_info(battery); |
487 | if (result) | 488 | if (result) |
488 | return result; | 489 | return result; |
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index 307963bd1043..332fe4b21708 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
@@ -27,9 +27,6 @@ | |||
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <acpi/acpi_bus.h> | 28 | #include <acpi/acpi_bus.h> |
29 | #include <acpi/acpi_drivers.h> | 29 | #include <acpi/acpi_drivers.h> |
30 | #include <acpi/acmacros.h> | ||
31 | #include <acpi/actypes.h> | ||
32 | #include <acpi/acutils.h> | ||
33 | 30 | ||
34 | ACPI_MODULE_NAME("cm_sbs"); | 31 | ACPI_MODULE_NAME("cm_sbs"); |
35 | #define ACPI_AC_CLASS "ac_adapter" | 32 | #define ACPI_AC_CLASS "ac_adapter" |
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index c48396892008..20223cbd0d1c 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/moduleparam.h> | 9 | #include <linux/moduleparam.h> |
10 | #include <asm/uaccess.h> | 10 | #include <asm/uaccess.h> |
11 | #include <acpi/acpi_drivers.h> | 11 | #include <acpi/acpi_drivers.h> |
12 | #include <acpi/acglobal.h> | ||
13 | 12 | ||
14 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 13 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
15 | ACPI_MODULE_NAME("debug"); | 14 | ACPI_MODULE_NAME("debug"); |
diff --git a/drivers/acpi/dispatcher/Makefile b/drivers/acpi/dispatcher/Makefile deleted file mode 100644 index eb7e602a83cd..000000000000 --- a/drivers/acpi/dispatcher/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ | ||
6 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ | ||
7 | dsinit.o | ||
8 | |||
9 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 30f3ef236ecb..8dfcbb8aff73 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
45 | #include <acpi/actypes.h> | ||
46 | 45 | ||
47 | #define ACPI_EC_CLASS "embedded_controller" | 46 | #define ACPI_EC_CLASS "embedded_controller" |
48 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" | 47 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" |
@@ -370,7 +369,7 @@ unlock: | |||
370 | * Note: samsung nv5000 doesn't work with ec burst mode. | 369 | * Note: samsung nv5000 doesn't work with ec burst mode. |
371 | * http://bugzilla.kernel.org/show_bug.cgi?id=4980 | 370 | * http://bugzilla.kernel.org/show_bug.cgi?id=4980 |
372 | */ | 371 | */ |
373 | int acpi_ec_burst_enable(struct acpi_ec *ec) | 372 | static int acpi_ec_burst_enable(struct acpi_ec *ec) |
374 | { | 373 | { |
375 | u8 d; | 374 | u8 d; |
376 | struct transaction t = {.command = ACPI_EC_BURST_ENABLE, | 375 | struct transaction t = {.command = ACPI_EC_BURST_ENABLE, |
@@ -380,7 +379,7 @@ int acpi_ec_burst_enable(struct acpi_ec *ec) | |||
380 | return acpi_ec_transaction(ec, &t, 0); | 379 | return acpi_ec_transaction(ec, &t, 0); |
381 | } | 380 | } |
382 | 381 | ||
383 | int acpi_ec_burst_disable(struct acpi_ec *ec) | 382 | static int acpi_ec_burst_disable(struct acpi_ec *ec) |
384 | { | 383 | { |
385 | struct transaction t = {.command = ACPI_EC_BURST_DISABLE, | 384 | struct transaction t = {.command = ACPI_EC_BURST_DISABLE, |
386 | .wdata = NULL, .rdata = NULL, | 385 | .wdata = NULL, .rdata = NULL, |
@@ -756,10 +755,15 @@ static acpi_status | |||
756 | acpi_ec_register_query_methods(acpi_handle handle, u32 level, | 755 | acpi_ec_register_query_methods(acpi_handle handle, u32 level, |
757 | void *context, void **return_value) | 756 | void *context, void **return_value) |
758 | { | 757 | { |
759 | struct acpi_namespace_node *node = handle; | 758 | char node_name[5]; |
759 | struct acpi_buffer buffer = { sizeof(node_name), node_name }; | ||
760 | struct acpi_ec *ec = context; | 760 | struct acpi_ec *ec = context; |
761 | int value = 0; | 761 | int value = 0; |
762 | if (sscanf(node->name.ascii, "_Q%x", &value) == 1) { | 762 | acpi_status status; |
763 | |||
764 | status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); | ||
765 | |||
766 | if (ACPI_SUCCESS(status) && sscanf(node_name, "_Q%x", &value) == 1) { | ||
763 | acpi_ec_add_query_handler(ec, value, handle, NULL, NULL); | 767 | acpi_ec_add_query_handler(ec, value, handle, NULL, NULL); |
764 | } | 768 | } |
765 | return AE_OK; | 769 | return AE_OK; |
@@ -978,9 +982,9 @@ static const struct acpi_device_id ec_device_ids[] = { | |||
978 | 982 | ||
979 | int __init acpi_ec_ecdt_probe(void) | 983 | int __init acpi_ec_ecdt_probe(void) |
980 | { | 984 | { |
981 | int ret; | ||
982 | acpi_status status; | 985 | acpi_status status; |
983 | struct acpi_table_ecdt *ecdt_ptr; | 986 | struct acpi_table_ecdt *ecdt_ptr; |
987 | acpi_handle dummy; | ||
984 | 988 | ||
985 | boot_ec = make_acpi_ec(); | 989 | boot_ec = make_acpi_ec(); |
986 | if (!boot_ec) | 990 | if (!boot_ec) |
@@ -1006,30 +1010,31 @@ int __init acpi_ec_ecdt_probe(void) | |||
1006 | boot_ec->gpe = ecdt_ptr->gpe; | 1010 | boot_ec->gpe = ecdt_ptr->gpe; |
1007 | boot_ec->handle = ACPI_ROOT_OBJECT; | 1011 | boot_ec->handle = ACPI_ROOT_OBJECT; |
1008 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | 1012 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); |
1009 | } else { | 1013 | /* Add some basic check against completely broken table */ |
1010 | /* This workaround is needed only on some broken machines, | 1014 | if (boot_ec->data_addr != boot_ec->command_addr) |
1011 | * which require early EC, but fail to provide ECDT */ | 1015 | goto install; |
1012 | acpi_handle x; | 1016 | /* fall through */ |
1013 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | ||
1014 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | ||
1015 | boot_ec, NULL); | ||
1016 | /* Check that acpi_get_devices actually find something */ | ||
1017 | if (ACPI_FAILURE(status) || !boot_ec->handle) | ||
1018 | goto error; | ||
1019 | /* We really need to limit this workaround, the only ASUS, | ||
1020 | * which needs it, has fake EC._INI method, so use it as flag. | ||
1021 | * Keep boot_ec struct as it will be needed soon. | ||
1022 | */ | ||
1023 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) | ||
1024 | return -ENODEV; | ||
1025 | } | 1017 | } |
1026 | 1018 | /* This workaround is needed only on some broken machines, | |
1027 | ret = ec_install_handlers(boot_ec); | 1019 | * which require early EC, but fail to provide ECDT */ |
1028 | if (!ret) { | 1020 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
1021 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | ||
1022 | boot_ec, NULL); | ||
1023 | /* Check that acpi_get_devices actually find something */ | ||
1024 | if (ACPI_FAILURE(status) || !boot_ec->handle) | ||
1025 | goto error; | ||
1026 | /* We really need to limit this workaround, the only ASUS, | ||
1027 | * which needs it, has fake EC._INI method, so use it as flag. | ||
1028 | * Keep boot_ec struct as it will be needed soon. | ||
1029 | */ | ||
1030 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy))) | ||
1031 | return -ENODEV; | ||
1032 | install: | ||
1033 | if (!ec_install_handlers(boot_ec)) { | ||
1029 | first_ec = boot_ec; | 1034 | first_ec = boot_ec; |
1030 | return 0; | 1035 | return 0; |
1031 | } | 1036 | } |
1032 | error: | 1037 | error: |
1033 | kfree(boot_ec); | 1038 | kfree(boot_ec); |
1034 | boot_ec = NULL; | 1039 | boot_ec = NULL; |
1035 | return -ENODEV; | 1040 | return -ENODEV; |
diff --git a/drivers/acpi/events/Makefile b/drivers/acpi/events/Makefile deleted file mode 100644 index d29f2ee449cc..000000000000 --- a/drivers/acpi/events/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := evevent.o evregion.o evsci.o evxfevnt.o \ | ||
6 | evmisc.o evrgnini.o evxface.o evxfregn.o \ | ||
7 | evgpe.o evgpeblk.o | ||
8 | |||
9 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/executer/Makefile b/drivers/acpi/executer/Makefile deleted file mode 100644 index e09998aa012f..000000000000 --- a/drivers/acpi/executer/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ | ||
6 | exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ | ||
7 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ | ||
8 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o | ||
9 | |||
10 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/hardware/Makefile b/drivers/acpi/hardware/Makefile deleted file mode 100644 index 438ad373b9ad..000000000000 --- a/drivers/acpi/hardware/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := hwacpi.o hwgpe.o hwregs.o hwsleep.o | ||
6 | |||
7 | obj-$(ACPI_FUTURE_USAGE) += hwtimer.o | ||
8 | |||
9 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/main.c index 28a691cc625e..7e3c609cbef2 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/main.c | |||
@@ -101,13 +101,26 @@ void __init acpi_old_suspend_ordering(void) | |||
101 | * cases. | 101 | * cases. |
102 | */ | 102 | */ |
103 | static bool set_sci_en_on_resume; | 103 | static bool set_sci_en_on_resume; |
104 | /* | ||
105 | * The ACPI specification wants us to save NVS memory regions during hibernation | ||
106 | * and to restore them during the subsequent resume. However, it is not certain | ||
107 | * if this mechanism is going to work on all machines, so we allow the user to | ||
108 | * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line | ||
109 | * option. | ||
110 | */ | ||
111 | static bool s4_no_nvs; | ||
112 | |||
113 | void __init acpi_s4_no_nvs(void) | ||
114 | { | ||
115 | s4_no_nvs = true; | ||
116 | } | ||
104 | 117 | ||
105 | /** | 118 | /** |
106 | * acpi_pm_disable_gpes - Disable the GPEs. | 119 | * acpi_pm_disable_gpes - Disable the GPEs. |
107 | */ | 120 | */ |
108 | static int acpi_pm_disable_gpes(void) | 121 | static int acpi_pm_disable_gpes(void) |
109 | { | 122 | { |
110 | acpi_hw_disable_all_gpes(); | 123 | acpi_disable_all_gpes(); |
111 | return 0; | 124 | return 0; |
112 | } | 125 | } |
113 | 126 | ||
@@ -135,7 +148,7 @@ static int acpi_pm_prepare(void) | |||
135 | int error = __acpi_pm_prepare(); | 148 | int error = __acpi_pm_prepare(); |
136 | 149 | ||
137 | if (!error) | 150 | if (!error) |
138 | acpi_hw_disable_all_gpes(); | 151 | acpi_disable_all_gpes(); |
139 | return error; | 152 | return error; |
140 | } | 153 | } |
141 | 154 | ||
@@ -267,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
267 | * (like wakeup GPE) haven't handler, this can avoid such GPE misfire. | 280 | * (like wakeup GPE) haven't handler, this can avoid such GPE misfire. |
268 | * acpi_leave_sleep_state will reenable specific GPEs later | 281 | * acpi_leave_sleep_state will reenable specific GPEs later |
269 | */ | 282 | */ |
270 | acpi_hw_disable_all_gpes(); | 283 | acpi_disable_all_gpes(); |
271 | 284 | ||
272 | local_irq_restore(flags); | 285 | local_irq_restore(flags); |
273 | printk(KERN_DEBUG "Back to C!\n"); | 286 | printk(KERN_DEBUG "Back to C!\n"); |
@@ -394,9 +407,25 @@ void __init acpi_no_s4_hw_signature(void) | |||
394 | 407 | ||
395 | static int acpi_hibernation_begin(void) | 408 | static int acpi_hibernation_begin(void) |
396 | { | 409 | { |
397 | acpi_target_sleep_state = ACPI_STATE_S4; | 410 | int error; |
398 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 411 | |
399 | return 0; | 412 | error = s4_no_nvs ? 0 : hibernate_nvs_alloc(); |
413 | if (!error) { | ||
414 | acpi_target_sleep_state = ACPI_STATE_S4; | ||
415 | acpi_sleep_tts_switch(acpi_target_sleep_state); | ||
416 | } | ||
417 | |||
418 | return error; | ||
419 | } | ||
420 | |||
421 | static int acpi_hibernation_pre_snapshot(void) | ||
422 | { | ||
423 | int error = acpi_pm_prepare(); | ||
424 | |||
425 | if (!error) | ||
426 | hibernate_nvs_save(); | ||
427 | |||
428 | return error; | ||
400 | } | 429 | } |
401 | 430 | ||
402 | static int acpi_hibernation_enter(void) | 431 | static int acpi_hibernation_enter(void) |
@@ -417,6 +446,12 @@ static int acpi_hibernation_enter(void) | |||
417 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 446 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
418 | } | 447 | } |
419 | 448 | ||
449 | static void acpi_hibernation_finish(void) | ||
450 | { | ||
451 | hibernate_nvs_free(); | ||
452 | acpi_pm_finish(); | ||
453 | } | ||
454 | |||
420 | static void acpi_hibernation_leave(void) | 455 | static void acpi_hibernation_leave(void) |
421 | { | 456 | { |
422 | /* | 457 | /* |
@@ -432,18 +467,20 @@ static void acpi_hibernation_leave(void) | |||
432 | "cannot resume!\n"); | 467 | "cannot resume!\n"); |
433 | panic("ACPI S4 hardware signature mismatch"); | 468 | panic("ACPI S4 hardware signature mismatch"); |
434 | } | 469 | } |
470 | /* Restore the NVS memory area */ | ||
471 | hibernate_nvs_restore(); | ||
435 | } | 472 | } |
436 | 473 | ||
437 | static void acpi_pm_enable_gpes(void) | 474 | static void acpi_pm_enable_gpes(void) |
438 | { | 475 | { |
439 | acpi_hw_enable_all_runtime_gpes(); | 476 | acpi_enable_all_runtime_gpes(); |
440 | } | 477 | } |
441 | 478 | ||
442 | static struct platform_hibernation_ops acpi_hibernation_ops = { | 479 | static struct platform_hibernation_ops acpi_hibernation_ops = { |
443 | .begin = acpi_hibernation_begin, | 480 | .begin = acpi_hibernation_begin, |
444 | .end = acpi_pm_end, | 481 | .end = acpi_pm_end, |
445 | .pre_snapshot = acpi_pm_prepare, | 482 | .pre_snapshot = acpi_hibernation_pre_snapshot, |
446 | .finish = acpi_pm_finish, | 483 | .finish = acpi_hibernation_finish, |
447 | .prepare = acpi_pm_prepare, | 484 | .prepare = acpi_pm_prepare, |
448 | .enter = acpi_hibernation_enter, | 485 | .enter = acpi_hibernation_enter, |
449 | .leave = acpi_hibernation_leave, | 486 | .leave = acpi_hibernation_leave, |
@@ -469,8 +506,22 @@ static int acpi_hibernation_begin_old(void) | |||
469 | 506 | ||
470 | error = acpi_sleep_prepare(ACPI_STATE_S4); | 507 | error = acpi_sleep_prepare(ACPI_STATE_S4); |
471 | 508 | ||
509 | if (!error) { | ||
510 | if (!s4_no_nvs) | ||
511 | error = hibernate_nvs_alloc(); | ||
512 | if (!error) | ||
513 | acpi_target_sleep_state = ACPI_STATE_S4; | ||
514 | } | ||
515 | return error; | ||
516 | } | ||
517 | |||
518 | static int acpi_hibernation_pre_snapshot_old(void) | ||
519 | { | ||
520 | int error = acpi_pm_disable_gpes(); | ||
521 | |||
472 | if (!error) | 522 | if (!error) |
473 | acpi_target_sleep_state = ACPI_STATE_S4; | 523 | hibernate_nvs_save(); |
524 | |||
474 | return error; | 525 | return error; |
475 | } | 526 | } |
476 | 527 | ||
@@ -481,8 +532,8 @@ static int acpi_hibernation_begin_old(void) | |||
481 | static struct platform_hibernation_ops acpi_hibernation_ops_old = { | 532 | static struct platform_hibernation_ops acpi_hibernation_ops_old = { |
482 | .begin = acpi_hibernation_begin_old, | 533 | .begin = acpi_hibernation_begin_old, |
483 | .end = acpi_pm_end, | 534 | .end = acpi_pm_end, |
484 | .pre_snapshot = acpi_pm_disable_gpes, | 535 | .pre_snapshot = acpi_hibernation_pre_snapshot_old, |
485 | .finish = acpi_pm_finish, | 536 | .finish = acpi_hibernation_finish, |
486 | .prepare = acpi_pm_disable_gpes, | 537 | .prepare = acpi_pm_disable_gpes, |
487 | .enter = acpi_hibernation_enter, | 538 | .enter = acpi_hibernation_enter, |
488 | .leave = acpi_hibernation_leave, | 539 | .leave = acpi_hibernation_leave, |
@@ -622,7 +673,7 @@ static void acpi_power_off_prepare(void) | |||
622 | { | 673 | { |
623 | /* Prepare to power off the system */ | 674 | /* Prepare to power off the system */ |
624 | acpi_sleep_prepare(ACPI_STATE_S5); | 675 | acpi_sleep_prepare(ACPI_STATE_S5); |
625 | acpi_hw_disable_all_gpes(); | 676 | acpi_disable_all_gpes(); |
626 | } | 677 | } |
627 | 678 | ||
628 | static void acpi_power_off(void) | 679 | static void acpi_power_off(void) |
@@ -671,7 +722,7 @@ int __init acpi_sleep_init(void) | |||
671 | sleep_states[ACPI_STATE_S4] = 1; | 722 | sleep_states[ACPI_STATE_S4] = 1; |
672 | printk(" S4"); | 723 | printk(" S4"); |
673 | if (!nosigcheck) { | 724 | if (!nosigcheck) { |
674 | acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 725 | acpi_get_table(ACPI_SIG_FACS, 1, |
675 | (struct acpi_table_header **)&facs); | 726 | (struct acpi_table_header **)&facs); |
676 | if (facs) | 727 | if (facs) |
677 | s4_hardware_signature = | 728 | s4_hardware_signature = |
diff --git a/drivers/acpi/namespace/Makefile b/drivers/acpi/namespace/Makefile deleted file mode 100644 index 371a2daf837f..000000000000 --- a/drivers/acpi/namespace/Makefile +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := nsaccess.o nsload.o nssearch.o nsxfeval.o \ | ||
6 | nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ | ||
7 | nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ | ||
8 | nsparse.o nspredef.o | ||
9 | |||
10 | obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o | ||
11 | |||
12 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 25ceae9191ef..c5e292aab0e3 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/acpi.h> | 30 | #include <linux/acpi.h> |
31 | #include <acpi/acpi_bus.h> | 31 | #include <acpi/acpi_bus.h> |
32 | #include <acpi/acmacros.h> | ||
33 | 32 | ||
34 | #define ACPI_NUMA 0x80000000 | 33 | #define ACPI_NUMA 0x80000000 |
35 | #define _COMPONENT ACPI_NUMA | 34 | #define _COMPONENT ACPI_NUMA |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c8111424dcb8..6729a4992f2b 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -726,7 +726,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
726 | 726 | ||
727 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); | 727 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); |
728 | if (!dpc) | 728 | if (!dpc) |
729 | return_ACPI_STATUS(AE_NO_MEMORY); | 729 | return AE_NO_MEMORY; |
730 | 730 | ||
731 | dpc->function = function; | 731 | dpc->function = function; |
732 | dpc->context = context; | 732 | dpc->context = context; |
@@ -747,7 +747,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
747 | status = AE_ERROR; | 747 | status = AE_ERROR; |
748 | kfree(dpc); | 748 | kfree(dpc); |
749 | } | 749 | } |
750 | return_ACPI_STATUS(status); | 750 | return status; |
751 | } | 751 | } |
752 | 752 | ||
753 | acpi_status acpi_os_execute(acpi_execute_type type, | 753 | acpi_status acpi_os_execute(acpi_execute_type type, |
diff --git a/drivers/acpi/parser/Makefile b/drivers/acpi/parser/Makefile deleted file mode 100644 index db24ee09cf11..000000000000 --- a/drivers/acpi/parser/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := psargs.o psparse.o psloop.o pstree.o pswalk.o \ | ||
6 | psopcode.o psscope.o psutils.o psxface.o | ||
7 | |||
8 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 4b252ea0e952..95650f83ce2e 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -99,7 +99,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) | |||
99 | */ | 99 | */ |
100 | 100 | ||
101 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 101 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
102 | "Device %s has PCI address %02x:%02x:%02x.%02x\n", | 102 | "Device %s has PCI address %04x:%02x:%02x.%d\n", |
103 | acpi_device_bid(device), id->segment, id->bus, | 103 | acpi_device_bid(device), id->segment, id->bus, |
104 | id->device, id->function)); | 104 | id->device, id->function)); |
105 | 105 | ||
@@ -111,12 +111,11 @@ EXPORT_SYMBOL(acpi_get_pci_id); | |||
111 | int acpi_pci_bind(struct acpi_device *device) | 111 | int acpi_pci_bind(struct acpi_device *device) |
112 | { | 112 | { |
113 | int result = 0; | 113 | int result = 0; |
114 | acpi_status status = AE_OK; | 114 | acpi_status status; |
115 | struct acpi_pci_data *data = NULL; | 115 | struct acpi_pci_data *data; |
116 | struct acpi_pci_data *pdata = NULL; | 116 | struct acpi_pci_data *pdata; |
117 | char *pathname = NULL; | 117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
118 | struct acpi_buffer buffer = { 0, NULL }; | 118 | acpi_handle handle; |
119 | acpi_handle handle = NULL; | ||
120 | struct pci_dev *dev; | 119 | struct pci_dev *dev; |
121 | struct pci_bus *bus; | 120 | struct pci_bus *bus; |
122 | 121 | ||
@@ -124,21 +123,18 @@ int acpi_pci_bind(struct acpi_device *device) | |||
124 | if (!device || !device->parent) | 123 | if (!device || !device->parent) |
125 | return -EINVAL; | 124 | return -EINVAL; |
126 | 125 | ||
127 | pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); | ||
128 | if (!pathname) | ||
129 | return -ENOMEM; | ||
130 | buffer.length = ACPI_PATHNAME_MAX; | ||
131 | buffer.pointer = pathname; | ||
132 | |||
133 | data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); | 126 | data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); |
134 | if (!data) { | 127 | if (!data) |
135 | kfree(pathname); | ||
136 | return -ENOMEM; | 128 | return -ENOMEM; |
129 | |||
130 | status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); | ||
131 | if (ACPI_FAILURE(status)) { | ||
132 | kfree(data); | ||
133 | return -ENODEV; | ||
137 | } | 134 | } |
138 | 135 | ||
139 | acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); | ||
140 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", | 136 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", |
141 | pathname)); | 137 | (char *)buffer.pointer)); |
142 | 138 | ||
143 | /* | 139 | /* |
144 | * Segment & Bus | 140 | * Segment & Bus |
@@ -166,7 +162,7 @@ int acpi_pci_bind(struct acpi_device *device) | |||
166 | data->id.device = device->pnp.bus_address >> 16; | 162 | data->id.device = device->pnp.bus_address >> 16; |
167 | data->id.function = device->pnp.bus_address & 0xFFFF; | 163 | data->id.function = device->pnp.bus_address & 0xFFFF; |
168 | 164 | ||
169 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n", | 165 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %04x:%02x:%02x.%d\n", |
170 | data->id.segment, data->id.bus, data->id.device, | 166 | data->id.segment, data->id.bus, data->id.device, |
171 | data->id.function)); | 167 | data->id.function)); |
172 | 168 | ||
@@ -196,7 +192,7 @@ int acpi_pci_bind(struct acpi_device *device) | |||
196 | } | 192 | } |
197 | if (!data->dev) { | 193 | if (!data->dev) { |
198 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 194 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
199 | "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", | 195 | "Device %04x:%02x:%02x.%d not present in PCI namespace\n", |
200 | data->id.segment, data->id.bus, | 196 | data->id.segment, data->id.bus, |
201 | data->id.device, data->id.function)); | 197 | data->id.device, data->id.function)); |
202 | result = -ENODEV; | 198 | result = -ENODEV; |
@@ -204,7 +200,7 @@ int acpi_pci_bind(struct acpi_device *device) | |||
204 | } | 200 | } |
205 | if (!data->dev->bus) { | 201 | if (!data->dev->bus) { |
206 | printk(KERN_ERR PREFIX | 202 | printk(KERN_ERR PREFIX |
207 | "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", | 203 | "Device %04x:%02x:%02x.%d has invalid 'bus' field\n", |
208 | data->id.segment, data->id.bus, | 204 | data->id.segment, data->id.bus, |
209 | data->id.device, data->id.function); | 205 | data->id.device, data->id.function); |
210 | result = -ENODEV; | 206 | result = -ENODEV; |
@@ -219,7 +215,7 @@ int acpi_pci_bind(struct acpi_device *device) | |||
219 | */ | 215 | */ |
220 | if (data->dev->subordinate) { | 216 | if (data->dev->subordinate) { |
221 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 217 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
222 | "Device %02x:%02x:%02x.%02x is a PCI bridge\n", | 218 | "Device %04x:%02x:%02x.%d is a PCI bridge\n", |
223 | data->id.segment, data->id.bus, | 219 | data->id.segment, data->id.bus, |
224 | data->id.device, data->id.function)); | 220 | data->id.device, data->id.function)); |
225 | data->bus = data->dev->subordinate; | 221 | data->bus = data->dev->subordinate; |
@@ -262,7 +258,7 @@ int acpi_pci_bind(struct acpi_device *device) | |||
262 | } | 258 | } |
263 | 259 | ||
264 | end: | 260 | end: |
265 | kfree(pathname); | 261 | kfree(buffer.pointer); |
266 | if (result) | 262 | if (result) |
267 | kfree(data); | 263 | kfree(data); |
268 | 264 | ||
@@ -272,25 +268,21 @@ int acpi_pci_bind(struct acpi_device *device) | |||
272 | static int acpi_pci_unbind(struct acpi_device *device) | 268 | static int acpi_pci_unbind(struct acpi_device *device) |
273 | { | 269 | { |
274 | int result = 0; | 270 | int result = 0; |
275 | acpi_status status = AE_OK; | 271 | acpi_status status; |
276 | struct acpi_pci_data *data = NULL; | 272 | struct acpi_pci_data *data; |
277 | char *pathname = NULL; | 273 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
278 | struct acpi_buffer buffer = { 0, NULL }; | ||
279 | 274 | ||
280 | 275 | ||
281 | if (!device || !device->parent) | 276 | if (!device || !device->parent) |
282 | return -EINVAL; | 277 | return -EINVAL; |
283 | 278 | ||
284 | pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); | 279 | status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); |
285 | if (!pathname) | 280 | if (ACPI_FAILURE(status)) |
286 | return -ENOMEM; | 281 | return -ENODEV; |
287 | 282 | ||
288 | buffer.length = ACPI_PATHNAME_MAX; | ||
289 | buffer.pointer = pathname; | ||
290 | acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); | ||
291 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", | 283 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", |
292 | pathname)); | 284 | (char *) buffer.pointer)); |
293 | kfree(pathname); | 285 | kfree(buffer.pointer); |
294 | 286 | ||
295 | status = | 287 | status = |
296 | acpi_get_data(device->handle, acpi_pci_data_handler, | 288 | acpi_get_data(device->handle, acpi_pci_data_handler, |
@@ -322,50 +314,44 @@ acpi_pci_bind_root(struct acpi_device *device, | |||
322 | struct acpi_pci_id *id, struct pci_bus *bus) | 314 | struct acpi_pci_id *id, struct pci_bus *bus) |
323 | { | 315 | { |
324 | int result = 0; | 316 | int result = 0; |
325 | acpi_status status = AE_OK; | 317 | acpi_status status; |
326 | struct acpi_pci_data *data = NULL; | 318 | struct acpi_pci_data *data = NULL; |
327 | char *pathname = NULL; | 319 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
328 | struct acpi_buffer buffer = { 0, NULL }; | ||
329 | |||
330 | pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); | ||
331 | if (!pathname) | ||
332 | return -ENOMEM; | ||
333 | |||
334 | buffer.length = ACPI_PATHNAME_MAX; | ||
335 | buffer.pointer = pathname; | ||
336 | 320 | ||
337 | if (!device || !id || !bus) { | 321 | if (!device || !id || !bus) { |
338 | kfree(pathname); | ||
339 | return -EINVAL; | 322 | return -EINVAL; |
340 | } | 323 | } |
341 | 324 | ||
342 | data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); | 325 | data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); |
343 | if (!data) { | 326 | if (!data) |
344 | kfree(pathname); | ||
345 | return -ENOMEM; | 327 | return -ENOMEM; |
346 | } | ||
347 | 328 | ||
348 | data->id = *id; | 329 | data->id = *id; |
349 | data->bus = bus; | 330 | data->bus = bus; |
350 | device->ops.bind = acpi_pci_bind; | 331 | device->ops.bind = acpi_pci_bind; |
351 | device->ops.unbind = acpi_pci_unbind; | 332 | device->ops.unbind = acpi_pci_unbind; |
352 | 333 | ||
353 | acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); | 334 | status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); |
335 | if (ACPI_FAILURE(status)) { | ||
336 | kfree (data); | ||
337 | return -ENODEV; | ||
338 | } | ||
354 | 339 | ||
355 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to " | 340 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to " |
356 | "%02x:%02x\n", pathname, id->segment, id->bus)); | 341 | "%04x:%02x\n", (char *)buffer.pointer, |
342 | id->segment, id->bus)); | ||
357 | 343 | ||
358 | status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); | 344 | status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); |
359 | if (ACPI_FAILURE(status)) { | 345 | if (ACPI_FAILURE(status)) { |
360 | ACPI_EXCEPTION((AE_INFO, status, | 346 | ACPI_EXCEPTION((AE_INFO, status, |
361 | "Unable to attach ACPI-PCI context to device %s", | 347 | "Unable to attach ACPI-PCI context to device %s", |
362 | pathname)); | 348 | (char *)buffer.pointer)); |
363 | result = -ENODEV; | 349 | result = -ENODEV; |
364 | goto end; | 350 | goto end; |
365 | } | 351 | } |
366 | 352 | ||
367 | end: | 353 | end: |
368 | kfree(pathname); | 354 | kfree(buffer.pointer); |
369 | if (result != 0) | 355 | if (result != 0) |
370 | kfree(data); | 356 | kfree(data); |
371 | 357 | ||
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index bf79d83bdfbb..891bdf6679f3 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> | 6 | * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de> |
7 | * (c) Copyright 2008 Hewlett-Packard Development Company, L.P. | ||
8 | * Bjorn Helgaas <bjorn.helgaas@hp.com> | ||
7 | * | 9 | * |
8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
9 | * | 11 | * |
@@ -41,29 +43,36 @@ | |||
41 | #define _COMPONENT ACPI_PCI_COMPONENT | 43 | #define _COMPONENT ACPI_PCI_COMPONENT |
42 | ACPI_MODULE_NAME("pci_irq"); | 44 | ACPI_MODULE_NAME("pci_irq"); |
43 | 45 | ||
44 | static struct acpi_prt_list acpi_prt; | 46 | struct acpi_prt_entry { |
47 | struct list_head list; | ||
48 | struct acpi_pci_id id; | ||
49 | u8 pin; | ||
50 | acpi_handle link; | ||
51 | u32 index; /* GSI, or link _CRS index */ | ||
52 | }; | ||
53 | |||
54 | static LIST_HEAD(acpi_prt_list); | ||
45 | static DEFINE_SPINLOCK(acpi_prt_lock); | 55 | static DEFINE_SPINLOCK(acpi_prt_lock); |
46 | 56 | ||
57 | static inline char pin_name(int pin) | ||
58 | { | ||
59 | return 'A' + pin - 1; | ||
60 | } | ||
61 | |||
47 | /* -------------------------------------------------------------------------- | 62 | /* -------------------------------------------------------------------------- |
48 | PCI IRQ Routing Table (PRT) Support | 63 | PCI IRQ Routing Table (PRT) Support |
49 | -------------------------------------------------------------------------- */ | 64 | -------------------------------------------------------------------------- */ |
50 | 65 | ||
51 | static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | 66 | static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(struct pci_dev *dev, |
52 | int bus, | 67 | int pin) |
53 | int device, int pin) | ||
54 | { | 68 | { |
55 | struct acpi_prt_entry *entry = NULL; | 69 | struct acpi_prt_entry *entry; |
56 | 70 | int segment = pci_domain_nr(dev->bus); | |
57 | if (!acpi_prt.count) | 71 | int bus = dev->bus->number; |
58 | return NULL; | 72 | int device = PCI_SLOT(dev->devfn); |
59 | 73 | ||
60 | /* | ||
61 | * Parse through all PRT entries looking for a match on the specified | ||
62 | * PCI device's segment, bus, device, and pin (don't care about func). | ||
63 | * | ||
64 | */ | ||
65 | spin_lock(&acpi_prt_lock); | 74 | spin_lock(&acpi_prt_lock); |
66 | list_for_each_entry(entry, &acpi_prt.entries, node) { | 75 | list_for_each_entry(entry, &acpi_prt_list, list) { |
67 | if ((segment == entry->id.segment) | 76 | if ((segment == entry->id.segment) |
68 | && (bus == entry->id.bus) | 77 | && (bus == entry->id.bus) |
69 | && (device == entry->id.device) | 78 | && (device == entry->id.device) |
@@ -72,7 +81,6 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | |||
72 | return entry; | 81 | return entry; |
73 | } | 82 | } |
74 | } | 83 | } |
75 | |||
76 | spin_unlock(&acpi_prt_lock); | 84 | spin_unlock(&acpi_prt_lock); |
77 | return NULL; | 85 | return NULL; |
78 | } | 86 | } |
@@ -124,25 +132,27 @@ struct prt_quirk { | |||
124 | char *actual_source; | 132 | char *actual_source; |
125 | }; | 133 | }; |
126 | 134 | ||
135 | #define PCI_INTX_PIN(c) (c - 'A' + 1) | ||
136 | |||
127 | /* | 137 | /* |
128 | * These systems have incorrect _PRT entries. The BIOS claims the PCI | 138 | * These systems have incorrect _PRT entries. The BIOS claims the PCI |
129 | * interrupt at the listed segment/bus/device/pin is connected to the first | 139 | * interrupt at the listed segment/bus/device/pin is connected to the first |
130 | * link device, but it is actually connected to the second. | 140 | * link device, but it is actually connected to the second. |
131 | */ | 141 | */ |
132 | static struct prt_quirk prt_quirks[] = { | 142 | static struct prt_quirk prt_quirks[] = { |
133 | { medion_md9580, 0, 0, 9, 'A', | 143 | { medion_md9580, 0, 0, 9, PCI_INTX_PIN('A'), |
134 | "\\_SB_.PCI0.ISA_.LNKA", | 144 | "\\_SB_.PCI0.ISA_.LNKA", |
135 | "\\_SB_.PCI0.ISA_.LNKB"}, | 145 | "\\_SB_.PCI0.ISA_.LNKB"}, |
136 | { dell_optiplex, 0, 0, 0xd, 'A', | 146 | { dell_optiplex, 0, 0, 0xd, PCI_INTX_PIN('A'), |
137 | "\\_SB_.LNKB", | 147 | "\\_SB_.LNKB", |
138 | "\\_SB_.LNKA"}, | 148 | "\\_SB_.LNKA"}, |
139 | { hp_t5710, 0, 0, 1, 'A', | 149 | { hp_t5710, 0, 0, 1, PCI_INTX_PIN('A'), |
140 | "\\_SB_.PCI0.LNK1", | 150 | "\\_SB_.PCI0.LNK1", |
141 | "\\_SB_.PCI0.LNK3"}, | 151 | "\\_SB_.PCI0.LNK3"}, |
142 | }; | 152 | }; |
143 | 153 | ||
144 | static void | 154 | static void do_prt_fixups(struct acpi_prt_entry *entry, |
145 | do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | 155 | struct acpi_pci_routing_table *prt) |
146 | { | 156 | { |
147 | int i; | 157 | int i; |
148 | struct prt_quirk *quirk; | 158 | struct prt_quirk *quirk; |
@@ -158,42 +168,43 @@ do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | |||
158 | entry->id.segment == quirk->segment && | 168 | entry->id.segment == quirk->segment && |
159 | entry->id.bus == quirk->bus && | 169 | entry->id.bus == quirk->bus && |
160 | entry->id.device == quirk->device && | 170 | entry->id.device == quirk->device && |
161 | entry->pin + 'A' == quirk->pin && | 171 | entry->pin == quirk->pin && |
162 | !strcmp(prt->source, quirk->source) && | 172 | !strcmp(prt->source, quirk->source) && |
163 | strlen(prt->source) >= strlen(quirk->actual_source)) { | 173 | strlen(prt->source) >= strlen(quirk->actual_source)) { |
164 | printk(KERN_WARNING PREFIX "firmware reports " | 174 | printk(KERN_WARNING PREFIX "firmware reports " |
165 | "%04x:%02x:%02x PCI INT %c connected to %s; " | 175 | "%04x:%02x:%02x PCI INT %c connected to %s; " |
166 | "changing to %s\n", | 176 | "changing to %s\n", |
167 | entry->id.segment, entry->id.bus, | 177 | entry->id.segment, entry->id.bus, |
168 | entry->id.device, 'A' + entry->pin, | 178 | entry->id.device, pin_name(entry->pin), |
169 | prt->source, quirk->actual_source); | 179 | prt->source, quirk->actual_source); |
170 | strcpy(prt->source, quirk->actual_source); | 180 | strcpy(prt->source, quirk->actual_source); |
171 | } | 181 | } |
172 | } | 182 | } |
173 | } | 183 | } |
174 | 184 | ||
175 | static int | 185 | static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, |
176 | acpi_pci_irq_add_entry(acpi_handle handle, | 186 | struct acpi_pci_routing_table *prt) |
177 | int segment, int bus, struct acpi_pci_routing_table *prt) | ||
178 | { | 187 | { |
179 | struct acpi_prt_entry *entry = NULL; | 188 | struct acpi_prt_entry *entry; |
180 | |||
181 | |||
182 | if (!prt) | ||
183 | return -EINVAL; | ||
184 | 189 | ||
185 | entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); | 190 | entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); |
186 | if (!entry) | 191 | if (!entry) |
187 | return -ENOMEM; | 192 | return -ENOMEM; |
188 | 193 | ||
194 | /* | ||
195 | * Note that the _PRT uses 0=INTA, 1=INTB, etc, while PCI uses | ||
196 | * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert | ||
197 | * it here. | ||
198 | */ | ||
189 | entry->id.segment = segment; | 199 | entry->id.segment = segment; |
190 | entry->id.bus = bus; | 200 | entry->id.bus = bus; |
191 | entry->id.device = (prt->address >> 16) & 0xFFFF; | 201 | entry->id.device = (prt->address >> 16) & 0xFFFF; |
192 | entry->id.function = prt->address & 0xFFFF; | 202 | entry->pin = prt->pin + 1; |
193 | entry->pin = prt->pin; | ||
194 | 203 | ||
195 | do_prt_fixups(entry, prt); | 204 | do_prt_fixups(entry, prt); |
196 | 205 | ||
206 | entry->index = prt->source_index; | ||
207 | |||
197 | /* | 208 | /* |
198 | * Type 1: Dynamic | 209 | * Type 1: Dynamic |
199 | * --------------- | 210 | * --------------- |
@@ -207,10 +218,9 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
207 | * (e.g. exists somewhere 'below' this _PRT entry in the ACPI | 218 | * (e.g. exists somewhere 'below' this _PRT entry in the ACPI |
208 | * namespace). | 219 | * namespace). |
209 | */ | 220 | */ |
210 | if (prt->source[0]) { | 221 | if (prt->source[0]) |
211 | acpi_get_handle(handle, prt->source, &entry->link.handle); | 222 | acpi_get_handle(handle, prt->source, &entry->link); |
212 | entry->link.index = prt->source_index; | 223 | |
213 | } | ||
214 | /* | 224 | /* |
215 | * Type 2: Static | 225 | * Type 2: Static |
216 | * -------------- | 226 | * -------------- |
@@ -218,84 +228,38 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
218 | * the IRQ value, which is hardwired to specific interrupt inputs on | 228 | * the IRQ value, which is hardwired to specific interrupt inputs on |
219 | * the interrupt controller. | 229 | * the interrupt controller. |
220 | */ | 230 | */ |
221 | else | ||
222 | entry->link.index = prt->source_index; | ||
223 | 231 | ||
224 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, | 232 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, |
225 | " %02X:%02X:%02X[%c] -> %s[%d]\n", | 233 | " %04x:%02x:%02x[%c] -> %s[%d]\n", |
226 | entry->id.segment, entry->id.bus, | 234 | entry->id.segment, entry->id.bus, |
227 | entry->id.device, ('A' + entry->pin), prt->source, | 235 | entry->id.device, pin_name(entry->pin), |
228 | entry->link.index)); | 236 | prt->source, entry->index)); |
229 | 237 | ||
230 | spin_lock(&acpi_prt_lock); | 238 | spin_lock(&acpi_prt_lock); |
231 | list_add_tail(&entry->node, &acpi_prt.entries); | 239 | list_add_tail(&entry->list, &acpi_prt_list); |
232 | acpi_prt.count++; | ||
233 | spin_unlock(&acpi_prt_lock); | 240 | spin_unlock(&acpi_prt_lock); |
234 | 241 | ||
235 | return 0; | 242 | return 0; |
236 | } | 243 | } |
237 | 244 | ||
238 | static void | ||
239 | acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry) | ||
240 | { | ||
241 | if (segment == entry->id.segment && bus == entry->id.bus) { | ||
242 | acpi_prt.count--; | ||
243 | list_del(&entry->node); | ||
244 | kfree(entry); | ||
245 | } | ||
246 | } | ||
247 | |||
248 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | 245 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) |
249 | { | 246 | { |
250 | acpi_status status = AE_OK; | 247 | acpi_status status; |
251 | char *pathname = NULL; | 248 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
252 | struct acpi_buffer buffer = { 0, NULL }; | 249 | struct acpi_pci_routing_table *entry; |
253 | struct acpi_pci_routing_table *prt = NULL; | ||
254 | struct acpi_pci_routing_table *entry = NULL; | ||
255 | static int first_time = 1; | ||
256 | |||
257 | |||
258 | pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); | ||
259 | if (!pathname) | ||
260 | return -ENOMEM; | ||
261 | |||
262 | if (first_time) { | ||
263 | acpi_prt.count = 0; | ||
264 | INIT_LIST_HEAD(&acpi_prt.entries); | ||
265 | first_time = 0; | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * NOTE: We're given a 'handle' to the _PRT object's parent device | ||
270 | * (either a PCI root bridge or PCI-PCI bridge). | ||
271 | */ | ||
272 | 250 | ||
273 | buffer.length = ACPI_PATHNAME_MAX; | 251 | /* 'handle' is the _PRT's parent (root bridge or PCI-PCI bridge) */ |
274 | buffer.pointer = pathname; | 252 | status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); |
275 | acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); | 253 | if (ACPI_FAILURE(status)) |
254 | return -ENODEV; | ||
276 | 255 | ||
277 | printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n", | 256 | printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n", |
278 | pathname); | 257 | (char *) buffer.pointer); |
279 | 258 | ||
280 | /* | 259 | kfree(buffer.pointer); |
281 | * Evaluate this _PRT and add its entries to our global list (acpi_prt). | ||
282 | */ | ||
283 | 260 | ||
284 | buffer.length = 0; | 261 | buffer.length = ACPI_ALLOCATE_BUFFER; |
285 | buffer.pointer = NULL; | 262 | buffer.pointer = NULL; |
286 | kfree(pathname); | ||
287 | status = acpi_get_irq_routing_table(handle, &buffer); | ||
288 | if (status != AE_BUFFER_OVERFLOW) { | ||
289 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", | ||
290 | acpi_format_exception(status))); | ||
291 | return -ENODEV; | ||
292 | } | ||
293 | |||
294 | prt = kzalloc(buffer.length, GFP_KERNEL); | ||
295 | if (!prt) { | ||
296 | return -ENOMEM; | ||
297 | } | ||
298 | buffer.pointer = prt; | ||
299 | 263 | ||
300 | status = acpi_get_irq_routing_table(handle, &buffer); | 264 | status = acpi_get_irq_routing_table(handle, &buffer); |
301 | if (ACPI_FAILURE(status)) { | 265 | if (ACPI_FAILURE(status)) { |
@@ -305,36 +269,30 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) | |||
305 | return -ENODEV; | 269 | return -ENODEV; |
306 | } | 270 | } |
307 | 271 | ||
308 | entry = prt; | 272 | entry = buffer.pointer; |
309 | |||
310 | while (entry && (entry->length > 0)) { | 273 | while (entry && (entry->length > 0)) { |
311 | acpi_pci_irq_add_entry(handle, segment, bus, entry); | 274 | acpi_pci_irq_add_entry(handle, segment, bus, entry); |
312 | entry = (struct acpi_pci_routing_table *) | 275 | entry = (struct acpi_pci_routing_table *) |
313 | ((unsigned long)entry + entry->length); | 276 | ((unsigned long)entry + entry->length); |
314 | } | 277 | } |
315 | 278 | ||
316 | kfree(prt); | 279 | kfree(buffer.pointer); |
317 | |||
318 | return 0; | 280 | return 0; |
319 | } | 281 | } |
320 | 282 | ||
321 | void acpi_pci_irq_del_prt(int segment, int bus) | 283 | void acpi_pci_irq_del_prt(int segment, int bus) |
322 | { | 284 | { |
323 | struct list_head *node = NULL, *n = NULL; | 285 | struct acpi_prt_entry *entry, *tmp; |
324 | struct acpi_prt_entry *entry = NULL; | ||
325 | |||
326 | if (!acpi_prt.count) { | ||
327 | return; | ||
328 | } | ||
329 | 286 | ||
330 | printk(KERN_DEBUG | 287 | printk(KERN_DEBUG |
331 | "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment, | 288 | "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", |
332 | bus); | 289 | segment, bus); |
333 | spin_lock(&acpi_prt_lock); | 290 | spin_lock(&acpi_prt_lock); |
334 | list_for_each_safe(node, n, &acpi_prt.entries) { | 291 | list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { |
335 | entry = list_entry(node, struct acpi_prt_entry, node); | 292 | if (segment == entry->id.segment && bus == entry->id.bus) { |
336 | 293 | list_del(&entry->list); | |
337 | acpi_pci_irq_del_entry(segment, bus, entry); | 294 | kfree(entry); |
295 | } | ||
338 | } | 296 | } |
339 | spin_unlock(&acpi_prt_lock); | 297 | spin_unlock(&acpi_prt_lock); |
340 | } | 298 | } |
@@ -342,162 +300,26 @@ void acpi_pci_irq_del_prt(int segment, int bus) | |||
342 | /* -------------------------------------------------------------------------- | 300 | /* -------------------------------------------------------------------------- |
343 | PCI Interrupt Routing Support | 301 | PCI Interrupt Routing Support |
344 | -------------------------------------------------------------------------- */ | 302 | -------------------------------------------------------------------------- */ |
345 | typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **); | 303 | static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) |
346 | |||
347 | static int | ||
348 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | ||
349 | int *triggering, int *polarity, char **link) | ||
350 | { | ||
351 | int irq; | ||
352 | |||
353 | |||
354 | if (entry->link.handle) { | ||
355 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | ||
356 | entry->link.index, triggering, | ||
357 | polarity, link); | ||
358 | if (irq < 0) { | ||
359 | printk(KERN_WARNING PREFIX | ||
360 | "Invalid IRQ link routing entry\n"); | ||
361 | return -1; | ||
362 | } | ||
363 | } else { | ||
364 | irq = entry->link.index; | ||
365 | *triggering = ACPI_LEVEL_SENSITIVE; | ||
366 | *polarity = ACPI_ACTIVE_LOW; | ||
367 | } | ||
368 | |||
369 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | ||
370 | return irq; | ||
371 | } | ||
372 | |||
373 | static int | ||
374 | acpi_pci_free_irq(struct acpi_prt_entry *entry, | ||
375 | int *triggering, int *polarity, char **link) | ||
376 | { | ||
377 | int irq; | ||
378 | |||
379 | if (entry->link.handle) { | ||
380 | irq = acpi_pci_link_free_irq(entry->link.handle); | ||
381 | } else { | ||
382 | irq = entry->link.index; | ||
383 | } | ||
384 | return irq; | ||
385 | } | ||
386 | |||
387 | #ifdef CONFIG_X86_IO_APIC | ||
388 | extern int noioapicquirk; | ||
389 | |||
390 | static int bridge_has_boot_interrupt_variant(struct pci_bus *bus) | ||
391 | { | 304 | { |
392 | struct pci_bus *bus_it; | 305 | struct acpi_prt_entry *entry; |
393 | 306 | struct pci_dev *bridge; | |
394 | for (bus_it = bus ; bus_it ; bus_it = bus_it->parent) { | 307 | u8 bridge_pin, orig_pin = pin; |
395 | if (!bus_it->self) | 308 | |
396 | return 0; | 309 | entry = acpi_pci_irq_find_prt_entry(dev, pin); |
397 | 310 | if (entry) { | |
398 | printk(KERN_INFO "vendor=%04x device=%04x\n", bus_it->self->vendor, | 311 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %s[%c] _PRT entry\n", |
399 | bus_it->self->device); | 312 | pci_name(dev), pin_name(pin))); |
400 | 313 | return entry; | |
401 | if (bus_it->self->irq_reroute_variant) | ||
402 | return bus_it->self->irq_reroute_variant; | ||
403 | } | ||
404 | return 0; | ||
405 | } | ||
406 | #endif /* CONFIG_X86_IO_APIC */ | ||
407 | |||
408 | /* | ||
409 | * acpi_pci_irq_lookup | ||
410 | * success: return IRQ >= 0 | ||
411 | * failure: return -1 | ||
412 | */ | ||
413 | static int | ||
414 | acpi_pci_irq_lookup(struct pci_bus *bus, | ||
415 | int device, | ||
416 | int pin, | ||
417 | int *triggering, | ||
418 | int *polarity, char **link, irq_lookup_func func) | ||
419 | { | ||
420 | struct acpi_prt_entry *entry = NULL; | ||
421 | int segment = pci_domain_nr(bus); | ||
422 | int bus_nr = bus->number; | ||
423 | int ret; | ||
424 | |||
425 | |||
426 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
427 | "Searching for PRT entry for %02x:%02x:%02x[%c]\n", | ||
428 | segment, bus_nr, device, ('A' + pin))); | ||
429 | |||
430 | entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); | ||
431 | if (!entry) { | ||
432 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); | ||
433 | return -1; | ||
434 | } | ||
435 | |||
436 | ret = func(entry, triggering, polarity, link); | ||
437 | |||
438 | #ifdef CONFIG_X86_IO_APIC | ||
439 | /* | ||
440 | * Some chipsets (e.g. intel 6700PXH) generate a legacy INTx when the | ||
441 | * IRQ entry in the chipset's IO-APIC is masked (as, e.g. the RT kernel | ||
442 | * does during interrupt handling). When this INTx generation cannot be | ||
443 | * disabled, we reroute these interrupts to their legacy equivalent to | ||
444 | * get rid of spurious interrupts. | ||
445 | */ | ||
446 | if (!noioapicquirk) { | ||
447 | switch (bridge_has_boot_interrupt_variant(bus)) { | ||
448 | case 0: | ||
449 | /* no rerouting necessary */ | ||
450 | break; | ||
451 | |||
452 | case INTEL_IRQ_REROUTE_VARIANT: | ||
453 | /* | ||
454 | * Remap according to INTx routing table in 6700PXH | ||
455 | * specs, intel order number 302628-002, section | ||
456 | * 2.15.2. Other chipsets (80332, ...) have the same | ||
457 | * mapping and are handled here as well. | ||
458 | */ | ||
459 | printk(KERN_INFO "pci irq %d -> rerouted to legacy " | ||
460 | "irq %d\n", ret, (ret % 4) + 16); | ||
461 | ret = (ret % 4) + 16; | ||
462 | break; | ||
463 | |||
464 | default: | ||
465 | printk(KERN_INFO "not rerouting irq %d to legacy irq: " | ||
466 | "unknown mapping\n", ret); | ||
467 | break; | ||
468 | } | ||
469 | } | 314 | } |
470 | #endif /* CONFIG_X86_IO_APIC */ | ||
471 | |||
472 | return ret; | ||
473 | } | ||
474 | |||
475 | /* | ||
476 | * acpi_pci_irq_derive | ||
477 | * success: return IRQ >= 0 | ||
478 | * failure: return < 0 | ||
479 | */ | ||
480 | static int | ||
481 | acpi_pci_irq_derive(struct pci_dev *dev, | ||
482 | int pin, | ||
483 | int *triggering, | ||
484 | int *polarity, char **link, irq_lookup_func func) | ||
485 | { | ||
486 | struct pci_dev *bridge = dev; | ||
487 | int irq = -1; | ||
488 | u8 bridge_pin = 0, orig_pin = pin; | ||
489 | |||
490 | |||
491 | if (!dev) | ||
492 | return -EINVAL; | ||
493 | 315 | ||
494 | /* | 316 | /* |
495 | * Attempt to derive an IRQ for this device from a parent bridge's | 317 | * Attempt to derive an IRQ for this device from a parent bridge's |
496 | * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). | 318 | * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). |
497 | */ | 319 | */ |
498 | while (irq < 0 && bridge->bus->self) { | 320 | bridge = dev->bus->self; |
499 | pin = (pin + PCI_SLOT(bridge->devfn)) % 4; | 321 | while (bridge) { |
500 | bridge = bridge->bus->self; | 322 | pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; |
501 | 323 | ||
502 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { | 324 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { |
503 | /* PC card has the same IRQ as its cardbridge */ | 325 | /* PC card has the same IRQ as its cardbridge */ |
@@ -506,50 +328,40 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
506 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 328 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
507 | "No interrupt pin configured for device %s\n", | 329 | "No interrupt pin configured for device %s\n", |
508 | pci_name(bridge))); | 330 | pci_name(bridge))); |
509 | return -1; | 331 | return NULL; |
510 | } | 332 | } |
511 | /* Pin is from 0 to 3 */ | ||
512 | bridge_pin--; | ||
513 | pin = bridge_pin; | 333 | pin = bridge_pin; |
514 | } | 334 | } |
515 | 335 | ||
516 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), | 336 | entry = acpi_pci_irq_find_prt_entry(bridge, pin); |
517 | pin, triggering, polarity, | 337 | if (entry) { |
518 | link, func); | 338 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
519 | } | 339 | "Derived GSI for %s INT %c from %s\n", |
340 | pci_name(dev), pin_name(orig_pin), | ||
341 | pci_name(bridge))); | ||
342 | return entry; | ||
343 | } | ||
520 | 344 | ||
521 | if (irq < 0) { | 345 | dev = bridge; |
522 | dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", | 346 | bridge = dev->bus->self; |
523 | 'A' + orig_pin); | ||
524 | return -1; | ||
525 | } | 347 | } |
526 | 348 | ||
527 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", | 349 | dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n", |
528 | irq, pci_name(dev), pci_name(bridge))); | 350 | pin_name(orig_pin)); |
529 | 351 | return NULL; | |
530 | return irq; | ||
531 | } | 352 | } |
532 | 353 | ||
533 | /* | ||
534 | * acpi_pci_irq_enable | ||
535 | * success: return 0 | ||
536 | * failure: return < 0 | ||
537 | */ | ||
538 | |||
539 | int acpi_pci_irq_enable(struct pci_dev *dev) | 354 | int acpi_pci_irq_enable(struct pci_dev *dev) |
540 | { | 355 | { |
541 | int irq = 0; | 356 | struct acpi_prt_entry *entry; |
542 | u8 pin = 0; | 357 | int gsi; |
358 | u8 pin; | ||
543 | int triggering = ACPI_LEVEL_SENSITIVE; | 359 | int triggering = ACPI_LEVEL_SENSITIVE; |
544 | int polarity = ACPI_ACTIVE_LOW; | 360 | int polarity = ACPI_ACTIVE_LOW; |
545 | char *link = NULL; | 361 | char *link = NULL; |
546 | char link_desc[16]; | 362 | char link_desc[16]; |
547 | int rc; | 363 | int rc; |
548 | 364 | ||
549 | |||
550 | if (!dev) | ||
551 | return -EINVAL; | ||
552 | |||
553 | pin = dev->pin; | 365 | pin = dev->pin; |
554 | if (!pin) { | 366 | if (!pin) { |
555 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 367 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -557,31 +369,9 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
557 | pci_name(dev))); | 369 | pci_name(dev))); |
558 | return 0; | 370 | return 0; |
559 | } | 371 | } |
560 | pin--; | ||
561 | |||
562 | if (!dev->bus) { | ||
563 | dev_err(&dev->dev, "invalid (NULL) 'bus' field\n"); | ||
564 | return -ENODEV; | ||
565 | } | ||
566 | |||
567 | /* | ||
568 | * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT | ||
569 | * values override any BIOS-assigned IRQs set during boot. | ||
570 | */ | ||
571 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | ||
572 | &triggering, &polarity, &link, | ||
573 | acpi_pci_allocate_irq); | ||
574 | |||
575 | /* | ||
576 | * If no PRT entry was found, we'll try to derive an IRQ from the | ||
577 | * device's parent bridge. | ||
578 | */ | ||
579 | if (irq < 0) | ||
580 | irq = acpi_pci_irq_derive(dev, pin, &triggering, | ||
581 | &polarity, &link, | ||
582 | acpi_pci_allocate_irq); | ||
583 | 372 | ||
584 | if (irq < 0) { | 373 | entry = acpi_pci_irq_lookup(dev, pin); |
374 | if (!entry) { | ||
585 | /* | 375 | /* |
586 | * IDE legacy mode controller IRQs are magic. Why do compat | 376 | * IDE legacy mode controller IRQs are magic. Why do compat |
587 | * extensions always make such a nasty mess. | 377 | * extensions always make such a nasty mess. |
@@ -590,12 +380,24 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
590 | (dev->class & 0x05) == 0) | 380 | (dev->class & 0x05) == 0) |
591 | return 0; | 381 | return 0; |
592 | } | 382 | } |
383 | |||
384 | if (entry) { | ||
385 | if (entry->link) | ||
386 | gsi = acpi_pci_link_allocate_irq(entry->link, | ||
387 | entry->index, | ||
388 | &triggering, &polarity, | ||
389 | &link); | ||
390 | else | ||
391 | gsi = entry->index; | ||
392 | } else | ||
393 | gsi = -1; | ||
394 | |||
593 | /* | 395 | /* |
594 | * No IRQ known to the ACPI subsystem - maybe the BIOS / | 396 | * No IRQ known to the ACPI subsystem - maybe the BIOS / |
595 | * driver reported one, then use it. Exit in any case. | 397 | * driver reported one, then use it. Exit in any case. |
596 | */ | 398 | */ |
597 | if (irq < 0) { | 399 | if (gsi < 0) { |
598 | dev_warn(&dev->dev, "PCI INT %c: no GSI", 'A' + pin); | 400 | dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin)); |
599 | /* Interrupt Line values above 0xF are forbidden */ | 401 | /* Interrupt Line values above 0xF are forbidden */ |
600 | if (dev->irq > 0 && (dev->irq <= 0xF)) { | 402 | if (dev->irq > 0 && (dev->irq <= 0xF)) { |
601 | printk(" - using IRQ %d\n", dev->irq); | 403 | printk(" - using IRQ %d\n", dev->irq); |
@@ -608,10 +410,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
608 | } | 410 | } |
609 | } | 411 | } |
610 | 412 | ||
611 | rc = acpi_register_gsi(irq, triggering, polarity); | 413 | rc = acpi_register_gsi(gsi, triggering, polarity); |
612 | if (rc < 0) { | 414 | if (rc < 0) { |
613 | dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", | 415 | dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n", |
614 | 'A' + pin); | 416 | pin_name(pin)); |
615 | return rc; | 417 | return rc; |
616 | } | 418 | } |
617 | dev->irq = rc; | 419 | dev->irq = rc; |
@@ -622,7 +424,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
622 | link_desc[0] = '\0'; | 424 | link_desc[0] = '\0'; |
623 | 425 | ||
624 | dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", | 426 | dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n", |
625 | 'A' + pin, link_desc, irq, | 427 | pin_name(pin), link_desc, gsi, |
626 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", | 428 | (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", |
627 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); | 429 | (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); |
628 | 430 | ||
@@ -636,42 +438,28 @@ void __attribute__ ((weak)) acpi_unregister_gsi(u32 i) | |||
636 | 438 | ||
637 | void acpi_pci_irq_disable(struct pci_dev *dev) | 439 | void acpi_pci_irq_disable(struct pci_dev *dev) |
638 | { | 440 | { |
639 | int gsi = 0; | 441 | struct acpi_prt_entry *entry; |
640 | u8 pin = 0; | 442 | int gsi; |
641 | int triggering = ACPI_LEVEL_SENSITIVE; | 443 | u8 pin; |
642 | int polarity = ACPI_ACTIVE_LOW; | ||
643 | |||
644 | |||
645 | if (!dev || !dev->bus) | ||
646 | return; | ||
647 | 444 | ||
648 | pin = dev->pin; | 445 | pin = dev->pin; |
649 | if (!pin) | 446 | if (!pin) |
650 | return; | 447 | return; |
651 | pin--; | ||
652 | 448 | ||
653 | /* | 449 | entry = acpi_pci_irq_lookup(dev, pin); |
654 | * First we check the PCI IRQ routing table (PRT) for an IRQ. | 450 | if (!entry) |
655 | */ | ||
656 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | ||
657 | &triggering, &polarity, NULL, | ||
658 | acpi_pci_free_irq); | ||
659 | /* | ||
660 | * If no PRT entry was found, we'll try to derive an IRQ from the | ||
661 | * device's parent bridge. | ||
662 | */ | ||
663 | if (gsi < 0) | ||
664 | gsi = acpi_pci_irq_derive(dev, pin, | ||
665 | &triggering, &polarity, NULL, | ||
666 | acpi_pci_free_irq); | ||
667 | if (gsi < 0) | ||
668 | return; | 451 | return; |
669 | 452 | ||
453 | if (entry->link) | ||
454 | gsi = acpi_pci_link_free_irq(entry->link); | ||
455 | else | ||
456 | gsi = entry->index; | ||
457 | |||
670 | /* | 458 | /* |
671 | * TBD: It might be worth clearing dev->irq by magic constant | 459 | * TBD: It might be worth clearing dev->irq by magic constant |
672 | * (e.g. PCI_UNDEFINED_IRQ). | 460 | * (e.g. PCI_UNDEFINED_IRQ). |
673 | */ | 461 | */ |
674 | 462 | ||
675 | dev_info(&dev->dev, "PCI INT %c disabled\n", 'A' + pin); | 463 | dev_info(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); |
676 | acpi_unregister_gsi(gsi); | 464 | acpi_unregister_gsi(gsi); |
677 | } | 465 | } |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index e52ad91ce2dc..1c6e73c7865e 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -796,10 +796,6 @@ static int irqrouter_resume(struct sys_device *dev) | |||
796 | struct list_head *node = NULL; | 796 | struct list_head *node = NULL; |
797 | struct acpi_pci_link *link = NULL; | 797 | struct acpi_pci_link *link = NULL; |
798 | 798 | ||
799 | |||
800 | /* Make sure SCI is enabled again (Apple firmware bug?) */ | ||
801 | acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1); | ||
802 | |||
803 | list_for_each(node, &acpi_link.entries) { | 799 | list_for_each(node, &acpi_link.entries) { |
804 | link = list_entry(node, struct acpi_pci_link, node); | 800 | link = list_entry(node, struct acpi_pci_link, node); |
805 | if (!link) { | 801 | if (!link) { |
@@ -912,7 +908,7 @@ static int __init acpi_irq_nobalance_set(char *str) | |||
912 | 908 | ||
913 | __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); | 909 | __setup("acpi_irq_nobalance", acpi_irq_nobalance_set); |
914 | 910 | ||
915 | int __init acpi_irq_balance_set(char *str) | 911 | static int __init acpi_irq_balance_set(char *str) |
916 | { | 912 | { |
917 | acpi_irq_balance = 1; | 913 | acpi_irq_balance = 1; |
918 | return 1; | 914 | return 1; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index bb7d50dd2818..c926e7d4a0d6 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -139,6 +139,8 @@ static int acpi_power_get_state(acpi_handle handle, int *state) | |||
139 | { | 139 | { |
140 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
141 | unsigned long long sta = 0; | 141 | unsigned long long sta = 0; |
142 | char node_name[5]; | ||
143 | struct acpi_buffer buffer = { sizeof(node_name), node_name }; | ||
142 | 144 | ||
143 | 145 | ||
144 | if (!handle || !state) | 146 | if (!handle || !state) |
@@ -151,8 +153,10 @@ static int acpi_power_get_state(acpi_handle handle, int *state) | |||
151 | *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON: | 153 | *state = (sta & 0x01)?ACPI_POWER_RESOURCE_STATE_ON: |
152 | ACPI_POWER_RESOURCE_STATE_OFF; | 154 | ACPI_POWER_RESOURCE_STATE_OFF; |
153 | 155 | ||
156 | acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); | ||
157 | |||
154 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", | 158 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", |
155 | acpi_ut_get_node_name(handle), | 159 | node_name, |
156 | *state ? "on" : "off")); | 160 | *state ? "on" : "off")); |
157 | 161 | ||
158 | return 0; | 162 | return 0; |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/proc.c index 4dbc2271acf5..428c911dba08 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -28,8 +28,6 @@ static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) | |||
28 | { | 28 | { |
29 | int i; | 29 | int i; |
30 | 30 | ||
31 | ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show"); | ||
32 | |||
33 | for (i = 0; i <= ACPI_STATE_S5; i++) { | 31 | for (i = 0; i <= ACPI_STATE_S5; i++) { |
34 | if (sleep_states[i]) { | 32 | if (sleep_states[i]) { |
35 | seq_printf(seq, "S%d ", i); | 33 | seq_printf(seq, "S%d ", i); |
@@ -86,49 +84,44 @@ acpi_system_write_sleep(struct file *file, | |||
86 | 84 | ||
87 | #ifdef HAVE_ACPI_LEGACY_ALARM | 85 | #ifdef HAVE_ACPI_LEGACY_ALARM |
88 | 86 | ||
87 | static u32 cmos_bcd_read(int offset, int rtc_control); | ||
88 | |||
89 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | 89 | static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) |
90 | { | 90 | { |
91 | u32 sec, min, hr; | 91 | u32 sec, min, hr; |
92 | u32 day, mo, yr, cent = 0; | 92 | u32 day, mo, yr, cent = 0; |
93 | u32 today = 0; | ||
93 | unsigned char rtc_control = 0; | 94 | unsigned char rtc_control = 0; |
94 | unsigned long flags; | 95 | unsigned long flags; |
95 | 96 | ||
96 | ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show"); | ||
97 | |||
98 | spin_lock_irqsave(&rtc_lock, flags); | 97 | spin_lock_irqsave(&rtc_lock, flags); |
99 | 98 | ||
100 | sec = CMOS_READ(RTC_SECONDS_ALARM); | ||
101 | min = CMOS_READ(RTC_MINUTES_ALARM); | ||
102 | hr = CMOS_READ(RTC_HOURS_ALARM); | ||
103 | rtc_control = CMOS_READ(RTC_CONTROL); | 99 | rtc_control = CMOS_READ(RTC_CONTROL); |
100 | sec = cmos_bcd_read(RTC_SECONDS_ALARM, rtc_control); | ||
101 | min = cmos_bcd_read(RTC_MINUTES_ALARM, rtc_control); | ||
102 | hr = cmos_bcd_read(RTC_HOURS_ALARM, rtc_control); | ||
104 | 103 | ||
105 | /* If we ever get an FACP with proper values... */ | 104 | /* If we ever get an FACP with proper values... */ |
106 | if (acpi_gbl_FADT.day_alarm) | 105 | if (acpi_gbl_FADT.day_alarm) { |
107 | /* ACPI spec: only low 6 its should be cared */ | 106 | /* ACPI spec: only low 6 its should be cared */ |
108 | day = CMOS_READ(acpi_gbl_FADT.day_alarm) & 0x3F; | 107 | day = CMOS_READ(acpi_gbl_FADT.day_alarm) & 0x3F; |
109 | else | 108 | if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
110 | day = CMOS_READ(RTC_DAY_OF_MONTH); | 109 | day = bcd2bin(day); |
110 | } else | ||
111 | day = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control); | ||
111 | if (acpi_gbl_FADT.month_alarm) | 112 | if (acpi_gbl_FADT.month_alarm) |
112 | mo = CMOS_READ(acpi_gbl_FADT.month_alarm); | 113 | mo = cmos_bcd_read(acpi_gbl_FADT.month_alarm, rtc_control); |
113 | else | 114 | else { |
114 | mo = CMOS_READ(RTC_MONTH); | 115 | mo = cmos_bcd_read(RTC_MONTH, rtc_control); |
116 | today = cmos_bcd_read(RTC_DAY_OF_MONTH, rtc_control); | ||
117 | } | ||
115 | if (acpi_gbl_FADT.century) | 118 | if (acpi_gbl_FADT.century) |
116 | cent = CMOS_READ(acpi_gbl_FADT.century); | 119 | cent = cmos_bcd_read(acpi_gbl_FADT.century, rtc_control); |
117 | 120 | ||
118 | yr = CMOS_READ(RTC_YEAR); | 121 | yr = cmos_bcd_read(RTC_YEAR, rtc_control); |
119 | 122 | ||
120 | spin_unlock_irqrestore(&rtc_lock, flags); | 123 | spin_unlock_irqrestore(&rtc_lock, flags); |
121 | 124 | ||
122 | if (!(rtc_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | ||
123 | sec = bcd2bin(sec); | ||
124 | min = bcd2bin(min); | ||
125 | hr = bcd2bin(hr); | ||
126 | day = bcd2bin(day); | ||
127 | mo = bcd2bin(mo); | ||
128 | yr = bcd2bin(yr); | ||
129 | cent = bcd2bin(cent); | ||
130 | } | ||
131 | |||
132 | /* we're trusting the FADT (see above) */ | 125 | /* we're trusting the FADT (see above) */ |
133 | if (!acpi_gbl_FADT.century) | 126 | if (!acpi_gbl_FADT.century) |
134 | /* If we're not trusting the FADT, we should at least make it | 127 | /* If we're not trusting the FADT, we should at least make it |
@@ -153,6 +146,20 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | |||
153 | else | 146 | else |
154 | yr += cent * 100; | 147 | yr += cent * 100; |
155 | 148 | ||
149 | /* | ||
150 | * Show correct dates for alarms up to a month into the future. | ||
151 | * This solves issues for nearly all situations with the common | ||
152 | * 30-day alarm clocks in PC hardware. | ||
153 | */ | ||
154 | if (day < today) { | ||
155 | if (mo < 12) { | ||
156 | mo += 1; | ||
157 | } else { | ||
158 | mo = 1; | ||
159 | yr += 1; | ||
160 | } | ||
161 | } | ||
162 | |||
156 | seq_printf(seq, "%4.4u-", yr); | 163 | seq_printf(seq, "%4.4u-", yr); |
157 | (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); | 164 | (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo); |
158 | (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day); | 165 | (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day); |
@@ -227,13 +234,11 @@ acpi_system_write_alarm(struct file *file, | |||
227 | int adjust = 0; | 234 | int adjust = 0; |
228 | unsigned char rtc_control = 0; | 235 | unsigned char rtc_control = 0; |
229 | 236 | ||
230 | ACPI_FUNCTION_TRACE("acpi_system_write_alarm"); | ||
231 | |||
232 | if (count > sizeof(alarm_string) - 1) | 237 | if (count > sizeof(alarm_string) - 1) |
233 | return_VALUE(-EINVAL); | 238 | return -EINVAL; |
234 | 239 | ||
235 | if (copy_from_user(alarm_string, buffer, count)) | 240 | if (copy_from_user(alarm_string, buffer, count)) |
236 | return_VALUE(-EFAULT); | 241 | return -EFAULT; |
237 | 242 | ||
238 | alarm_string[count] = '\0'; | 243 | alarm_string[count] = '\0'; |
239 | 244 | ||
@@ -334,7 +339,7 @@ acpi_system_write_alarm(struct file *file, | |||
334 | 339 | ||
335 | result = 0; | 340 | result = 0; |
336 | end: | 341 | end: |
337 | return_VALUE(result ? result : count); | 342 | return result ? result : count; |
338 | } | 343 | } |
339 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 344 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
340 | 345 | ||
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index a6b662c00b67..93f91142d7ad 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
@@ -42,7 +42,7 @@ void acpi_reboot(void) | |||
42 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | 42 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: |
43 | case ACPI_ADR_SPACE_SYSTEM_IO: | 43 | case ACPI_ADR_SPACE_SYSTEM_IO: |
44 | printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); | 44 | printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n"); |
45 | acpi_hw_low_level_write(8, reset_value, rr); | 45 | acpi_reset(); |
46 | break; | 46 | break; |
47 | } | 47 | } |
48 | /* Wait ten seconds */ | 48 | /* Wait ten seconds */ |
diff --git a/drivers/acpi/resources/Makefile b/drivers/acpi/resources/Makefile deleted file mode 100644 index 8de4f69dfa09..000000000000 --- a/drivers/acpi/resources/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ | ||
6 | rscalc.o rsirq.o rsmemory.o rsutils.o | ||
7 | |||
8 | obj-$(ACPI_FUTURE_USAGE) += rsdump.o | ||
9 | |||
10 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index e53e590252c0..0619734895b2 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <acpi/acpi_bus.h> | 11 | #include <acpi/acpi_bus.h> |
12 | #include <acpi/acpi_drivers.h> | 12 | #include <acpi/acpi_drivers.h> |
13 | #include <acpi/actypes.h> | ||
14 | #include <linux/wait.h> | 13 | #include <linux/wait.h> |
15 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
16 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 39b7233c3485..c54d7b6c4066 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/kthread.h> | 10 | #include <linux/kthread.h> |
11 | 11 | ||
12 | #include <acpi/acpi_drivers.h> | 12 | #include <acpi/acpi_drivers.h> |
13 | #include <acpi/acinterp.h> /* for acpi_ex_eisa_id_to_string() */ | ||
14 | 13 | ||
15 | #define _COMPONENT ACPI_BUS_COMPONENT | 14 | #define _COMPONENT ACPI_BUS_COMPONENT |
16 | ACPI_MODULE_NAME("scan"); | 15 | ACPI_MODULE_NAME("scan"); |
diff --git a/drivers/acpi/sleep/sleep.h b/drivers/acpi/sleep.h index cfaf8f5b0a14..cfaf8f5b0a14 100644 --- a/drivers/acpi/sleep/sleep.h +++ b/drivers/acpi/sleep.h | |||
diff --git a/drivers/acpi/sleep/Makefile b/drivers/acpi/sleep/Makefile deleted file mode 100644 index f1fb888c2d29..000000000000 --- a/drivers/acpi/sleep/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | obj-y := wakeup.o | ||
2 | obj-y += main.o | ||
3 | obj-$(CONFIG_ACPI_SLEEP) += proc.o | ||
4 | |||
5 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 6e4107f82403..391d0358a592 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -192,65 +192,6 @@ static struct attribute_group interrupt_stats_attr_group = { | |||
192 | }; | 192 | }; |
193 | static struct kobj_attribute *counter_attrs; | 193 | static struct kobj_attribute *counter_attrs; |
194 | 194 | ||
195 | static int count_num_gpes(void) | ||
196 | { | ||
197 | int count = 0; | ||
198 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
199 | struct acpi_gpe_block_info *gpe_block; | ||
200 | acpi_cpu_flags flags; | ||
201 | |||
202 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
203 | |||
204 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
205 | while (gpe_xrupt_info) { | ||
206 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
207 | while (gpe_block) { | ||
208 | count += gpe_block->register_count * | ||
209 | ACPI_GPE_REGISTER_WIDTH; | ||
210 | gpe_block = gpe_block->next; | ||
211 | } | ||
212 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
213 | } | ||
214 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
215 | |||
216 | return count; | ||
217 | } | ||
218 | |||
219 | static int get_gpe_device(int index, acpi_handle *handle) | ||
220 | { | ||
221 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
222 | struct acpi_gpe_block_info *gpe_block; | ||
223 | acpi_cpu_flags flags; | ||
224 | struct acpi_namespace_node *node; | ||
225 | |||
226 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
227 | |||
228 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
229 | while (gpe_xrupt_info) { | ||
230 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
231 | node = gpe_block->node; | ||
232 | while (gpe_block) { | ||
233 | index -= gpe_block->register_count * | ||
234 | ACPI_GPE_REGISTER_WIDTH; | ||
235 | if (index < 0) { | ||
236 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
237 | /* return NULL if it's FADT GPE */ | ||
238 | if (node->type != ACPI_TYPE_DEVICE) | ||
239 | *handle = NULL; | ||
240 | else | ||
241 | *handle = node; | ||
242 | return 0; | ||
243 | } | ||
244 | node = gpe_block->node; | ||
245 | gpe_block = gpe_block->next; | ||
246 | } | ||
247 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
248 | } | ||
249 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
250 | |||
251 | return -ENODEV; | ||
252 | } | ||
253 | |||
254 | static void delete_gpe_attr_array(void) | 195 | static void delete_gpe_attr_array(void) |
255 | { | 196 | { |
256 | struct event_counter *tmp = all_counters; | 197 | struct event_counter *tmp = all_counters; |
@@ -309,7 +250,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
309 | goto end; | 250 | goto end; |
310 | 251 | ||
311 | if (index < num_gpes) { | 252 | if (index < num_gpes) { |
312 | result = get_gpe_device(index, handle); | 253 | result = acpi_get_gpe_device(index, handle); |
313 | if (result) { | 254 | if (result) { |
314 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, | 255 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, |
315 | "Invalid GPE 0x%x\n", index)); | 256 | "Invalid GPE 0x%x\n", index)); |
@@ -436,7 +377,7 @@ void acpi_irq_stats_init(void) | |||
436 | if (all_counters) | 377 | if (all_counters) |
437 | return; | 378 | return; |
438 | 379 | ||
439 | num_gpes = count_num_gpes(); | 380 | num_gpes = acpi_current_gpe_count; |
440 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; | 381 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; |
441 | 382 | ||
442 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), | 383 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), |
diff --git a/drivers/acpi/tables/Makefile b/drivers/acpi/tables/Makefile deleted file mode 100644 index 7385efa61622..000000000000 --- a/drivers/acpi/tables/Makefile +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | ||
6 | |||
7 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/utilities/Makefile b/drivers/acpi/utilities/Makefile deleted file mode 100644 index 88eff14c4894..000000000000 --- a/drivers/acpi/utilities/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for all Linux ACPI interpreter subdirectories | ||
3 | # | ||
4 | |||
5 | obj-y := utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | ||
6 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | ||
7 | utstate.o utmutex.o utobject.o utcache.o utresrc.o | ||
8 | |||
9 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c deleted file mode 100644 index 245fa80cf600..000000000000 --- a/drivers/acpi/utilities/utcache.c +++ /dev/null | |||
@@ -1,314 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utcache - local cache allocation routines | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2008, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | |||
46 | #define _COMPONENT ACPI_UTILITIES | ||
47 | ACPI_MODULE_NAME("utcache") | ||
48 | #ifdef ACPI_USE_LOCAL_CACHE | ||
49 | /******************************************************************************* | ||
50 | * | ||
51 | * FUNCTION: acpi_os_create_cache | ||
52 | * | ||
53 | * PARAMETERS: cache_name - Ascii name for the cache | ||
54 | * object_size - Size of each cached object | ||
55 | * max_depth - Maximum depth of the cache (in objects) | ||
56 | * return_cache - Where the new cache object is returned | ||
57 | * | ||
58 | * RETURN: Status | ||
59 | * | ||
60 | * DESCRIPTION: Create a cache object | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | acpi_status | ||
64 | acpi_os_create_cache(char *cache_name, | ||
65 | u16 object_size, | ||
66 | u16 max_depth, struct acpi_memory_list ** return_cache) | ||
67 | { | ||
68 | struct acpi_memory_list *cache; | ||
69 | |||
70 | ACPI_FUNCTION_ENTRY(); | ||
71 | |||
72 | if (!cache_name || !return_cache || (object_size < 16)) { | ||
73 | return (AE_BAD_PARAMETER); | ||
74 | } | ||
75 | |||
76 | /* Create the cache object */ | ||
77 | |||
78 | cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); | ||
79 | if (!cache) { | ||
80 | return (AE_NO_MEMORY); | ||
81 | } | ||
82 | |||
83 | /* Populate the cache object and return it */ | ||
84 | |||
85 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | ||
86 | cache->link_offset = 8; | ||
87 | cache->list_name = cache_name; | ||
88 | cache->object_size = object_size; | ||
89 | cache->max_depth = max_depth; | ||
90 | |||
91 | *return_cache = cache; | ||
92 | return (AE_OK); | ||
93 | } | ||
94 | |||
95 | /******************************************************************************* | ||
96 | * | ||
97 | * FUNCTION: acpi_os_purge_cache | ||
98 | * | ||
99 | * PARAMETERS: Cache - Handle to cache object | ||
100 | * | ||
101 | * RETURN: Status | ||
102 | * | ||
103 | * DESCRIPTION: Free all objects within the requested cache. | ||
104 | * | ||
105 | ******************************************************************************/ | ||
106 | |||
107 | acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | ||
108 | { | ||
109 | char *next; | ||
110 | |||
111 | ACPI_FUNCTION_ENTRY(); | ||
112 | |||
113 | if (!cache) { | ||
114 | return (AE_BAD_PARAMETER); | ||
115 | } | ||
116 | |||
117 | /* Walk the list of objects in this cache */ | ||
118 | |||
119 | while (cache->list_head) { | ||
120 | |||
121 | /* Delete and unlink one cached state object */ | ||
122 | |||
123 | next = *(ACPI_CAST_INDIRECT_PTR(char, | ||
124 | &(((char *)cache-> | ||
125 | list_head)[cache-> | ||
126 | link_offset]))); | ||
127 | ACPI_FREE(cache->list_head); | ||
128 | |||
129 | cache->list_head = next; | ||
130 | cache->current_depth--; | ||
131 | } | ||
132 | |||
133 | return (AE_OK); | ||
134 | } | ||
135 | |||
136 | /******************************************************************************* | ||
137 | * | ||
138 | * FUNCTION: acpi_os_delete_cache | ||
139 | * | ||
140 | * PARAMETERS: Cache - Handle to cache object | ||
141 | * | ||
142 | * RETURN: Status | ||
143 | * | ||
144 | * DESCRIPTION: Free all objects within the requested cache and delete the | ||
145 | * cache object. | ||
146 | * | ||
147 | ******************************************************************************/ | ||
148 | |||
149 | acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache) | ||
150 | { | ||
151 | acpi_status status; | ||
152 | |||
153 | ACPI_FUNCTION_ENTRY(); | ||
154 | |||
155 | /* Purge all objects in the cache */ | ||
156 | |||
157 | status = acpi_os_purge_cache(cache); | ||
158 | if (ACPI_FAILURE(status)) { | ||
159 | return (status); | ||
160 | } | ||
161 | |||
162 | /* Now we can delete the cache object */ | ||
163 | |||
164 | ACPI_FREE(cache); | ||
165 | return (AE_OK); | ||
166 | } | ||
167 | |||
168 | /******************************************************************************* | ||
169 | * | ||
170 | * FUNCTION: acpi_os_release_object | ||
171 | * | ||
172 | * PARAMETERS: Cache - Handle to cache object | ||
173 | * Object - The object to be released | ||
174 | * | ||
175 | * RETURN: None | ||
176 | * | ||
177 | * DESCRIPTION: Release an object to the specified cache. If cache is full, | ||
178 | * the object is deleted. | ||
179 | * | ||
180 | ******************************************************************************/ | ||
181 | |||
182 | acpi_status | ||
183 | acpi_os_release_object(struct acpi_memory_list * cache, void *object) | ||
184 | { | ||
185 | acpi_status status; | ||
186 | |||
187 | ACPI_FUNCTION_ENTRY(); | ||
188 | |||
189 | if (!cache || !object) { | ||
190 | return (AE_BAD_PARAMETER); | ||
191 | } | ||
192 | |||
193 | /* If cache is full, just free this object */ | ||
194 | |||
195 | if (cache->current_depth >= cache->max_depth) { | ||
196 | ACPI_FREE(object); | ||
197 | ACPI_MEM_TRACKING(cache->total_freed++); | ||
198 | } | ||
199 | |||
200 | /* Otherwise put this object back into the cache */ | ||
201 | |||
202 | else { | ||
203 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
204 | if (ACPI_FAILURE(status)) { | ||
205 | return (status); | ||
206 | } | ||
207 | |||
208 | /* Mark the object as cached */ | ||
209 | |||
210 | ACPI_MEMSET(object, 0xCA, cache->object_size); | ||
211 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED); | ||
212 | |||
213 | /* Put the object at the head of the cache list */ | ||
214 | |||
215 | *(ACPI_CAST_INDIRECT_PTR(char, | ||
216 | &(((char *)object)[cache-> | ||
217 | link_offset]))) = | ||
218 | cache->list_head; | ||
219 | cache->list_head = object; | ||
220 | cache->current_depth++; | ||
221 | |||
222 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
223 | } | ||
224 | |||
225 | return (AE_OK); | ||
226 | } | ||
227 | |||
228 | /******************************************************************************* | ||
229 | * | ||
230 | * FUNCTION: acpi_os_acquire_object | ||
231 | * | ||
232 | * PARAMETERS: Cache - Handle to cache object | ||
233 | * | ||
234 | * RETURN: the acquired object. NULL on error | ||
235 | * | ||
236 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | ||
237 | * the object is allocated. | ||
238 | * | ||
239 | ******************************************************************************/ | ||
240 | |||
241 | void *acpi_os_acquire_object(struct acpi_memory_list *cache) | ||
242 | { | ||
243 | acpi_status status; | ||
244 | void *object; | ||
245 | |||
246 | ACPI_FUNCTION_NAME(os_acquire_object); | ||
247 | |||
248 | if (!cache) { | ||
249 | return (NULL); | ||
250 | } | ||
251 | |||
252 | status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES); | ||
253 | if (ACPI_FAILURE(status)) { | ||
254 | return (NULL); | ||
255 | } | ||
256 | |||
257 | ACPI_MEM_TRACKING(cache->requests++); | ||
258 | |||
259 | /* Check the cache first */ | ||
260 | |||
261 | if (cache->list_head) { | ||
262 | |||
263 | /* There is an object available, use it */ | ||
264 | |||
265 | object = cache->list_head; | ||
266 | cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char, | ||
267 | &(((char *) | ||
268 | object)[cache-> | ||
269 | link_offset]))); | ||
270 | |||
271 | cache->current_depth--; | ||
272 | |||
273 | ACPI_MEM_TRACKING(cache->hits++); | ||
274 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
275 | "Object %p from %s cache\n", object, | ||
276 | cache->list_name)); | ||
277 | |||
278 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
279 | if (ACPI_FAILURE(status)) { | ||
280 | return (NULL); | ||
281 | } | ||
282 | |||
283 | /* Clear (zero) the previously used Object */ | ||
284 | |||
285 | ACPI_MEMSET(object, 0, cache->object_size); | ||
286 | } else { | ||
287 | /* The cache is empty, create a new object */ | ||
288 | |||
289 | ACPI_MEM_TRACKING(cache->total_allocated++); | ||
290 | |||
291 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
292 | if ((cache->total_allocated - cache->total_freed) > | ||
293 | cache->max_occupied) { | ||
294 | cache->max_occupied = | ||
295 | cache->total_allocated - cache->total_freed; | ||
296 | } | ||
297 | #endif | ||
298 | |||
299 | /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ | ||
300 | |||
301 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return (NULL); | ||
304 | } | ||
305 | |||
306 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); | ||
307 | if (!object) { | ||
308 | return (NULL); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | return (object); | ||
313 | } | ||
314 | #endif /* ACPI_USE_LOCAL_CACHE */ | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index baa441929720..f261737636da 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/backlight.h> | 36 | #include <linux/backlight.h> |
37 | #include <linux/thermal.h> | 37 | #include <linux/thermal.h> |
38 | #include <linux/video_output.h> | 38 | #include <linux/video_output.h> |
39 | #include <linux/sort.h> | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | 41 | ||
41 | #include <acpi/acpi_bus.h> | 42 | #include <acpi/acpi_bus.h> |
@@ -481,6 +482,7 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
481 | int status = AE_OK; | 482 | int status = AE_OK; |
482 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 483 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
483 | struct acpi_object_list args = { 1, &arg0 }; | 484 | struct acpi_object_list args = { 1, &arg0 }; |
485 | int state; | ||
484 | 486 | ||
485 | 487 | ||
486 | arg0.integer.value = level; | 488 | arg0.integer.value = level; |
@@ -489,6 +491,10 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) | |||
489 | status = acpi_evaluate_object(device->dev->handle, "_BCM", | 491 | status = acpi_evaluate_object(device->dev->handle, "_BCM", |
490 | &args, NULL); | 492 | &args, NULL); |
491 | device->brightness->curr = level; | 493 | device->brightness->curr = level; |
494 | for (state = 2; state < device->brightness->count; state++) | ||
495 | if (level == device->brightness->levels[state]) | ||
496 | device->backlight->props.brightness = state - 2; | ||
497 | |||
492 | return status; | 498 | return status; |
493 | } | 499 | } |
494 | 500 | ||
@@ -626,6 +632,16 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
626 | } | 632 | } |
627 | 633 | ||
628 | /* | 634 | /* |
635 | * Simple comparison function used to sort backlight levels. | ||
636 | */ | ||
637 | |||
638 | static int | ||
639 | acpi_video_cmp_level(const void *a, const void *b) | ||
640 | { | ||
641 | return *(int *)a - *(int *)b; | ||
642 | } | ||
643 | |||
644 | /* | ||
629 | * Arg: | 645 | * Arg: |
630 | * device : video output device (LCD, CRT, ..) | 646 | * device : video output device (LCD, CRT, ..) |
631 | * | 647 | * |
@@ -676,6 +692,10 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
676 | count++; | 692 | count++; |
677 | } | 693 | } |
678 | 694 | ||
695 | /* don't sort the first two brightness levels */ | ||
696 | sort(&br->levels[2], count - 2, sizeof(br->levels[2]), | ||
697 | acpi_video_cmp_level, NULL); | ||
698 | |||
679 | if (count < 2) | 699 | if (count < 2) |
680 | goto out_free_levels; | 700 | goto out_free_levels; |
681 | 701 | ||
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index f022eb6f5637..50e3d2dbf3af 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -234,7 +234,7 @@ EXPORT_SYMBOL(acpi_video_display_switch_support); | |||
234 | * To force that backlight or display output switching is processed by vendor | 234 | * To force that backlight or display output switching is processed by vendor |
235 | * specific acpi drivers or video.ko driver. | 235 | * specific acpi drivers or video.ko driver. |
236 | */ | 236 | */ |
237 | int __init acpi_backlight(char *str) | 237 | static int __init acpi_backlight(char *str) |
238 | { | 238 | { |
239 | if (str == NULL || *str == '\0') | 239 | if (str == NULL || *str == '\0') |
240 | return 1; | 240 | return 1; |
@@ -250,7 +250,7 @@ int __init acpi_backlight(char *str) | |||
250 | } | 250 | } |
251 | __setup("acpi_backlight=", acpi_backlight); | 251 | __setup("acpi_backlight=", acpi_backlight); |
252 | 252 | ||
253 | int __init acpi_display_output(char *str) | 253 | static int __init acpi_display_output(char *str) |
254 | { | 254 | { |
255 | if (str == NULL || *str == '\0') | 255 | if (str == NULL || *str == '\0') |
256 | return 1; | 256 | return 1; |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/wakeup.c index dea4c23df764..2d34806d45dd 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <acpi/acpi_drivers.h> | 8 | #include <acpi/acpi_drivers.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <acpi/acevents.h> | ||
12 | #include "sleep.h" | 11 | #include "sleep.h" |
13 | 12 | ||
14 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 13 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
@@ -28,8 +27,6 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state) | |||
28 | { | 27 | { |
29 | struct list_head *node, *next; | 28 | struct list_head *node, *next; |
30 | 29 | ||
31 | ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_prep"); | ||
32 | |||
33 | spin_lock(&acpi_device_lock); | 30 | spin_lock(&acpi_device_lock); |
34 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 31 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
35 | struct acpi_device *dev = container_of(node, | 32 | struct acpi_device *dev = container_of(node, |
@@ -61,7 +58,6 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
61 | * Caution: this routine must be invoked when interrupt is disabled | 58 | * Caution: this routine must be invoked when interrupt is disabled |
62 | * Refer ACPI2.0: P212 | 59 | * Refer ACPI2.0: P212 |
63 | */ | 60 | */ |
64 | ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device"); | ||
65 | spin_lock(&acpi_device_lock); | 61 | spin_lock(&acpi_device_lock); |
66 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 62 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
67 | struct acpi_device *dev = | 63 | struct acpi_device *dev = |
@@ -103,8 +99,6 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
103 | { | 99 | { |
104 | struct list_head *node, *next; | 100 | struct list_head *node, *next; |
105 | 101 | ||
106 | ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device"); | ||
107 | |||
108 | spin_lock(&acpi_device_lock); | 102 | spin_lock(&acpi_device_lock); |
109 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 103 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
110 | struct acpi_device *dev = | 104 | struct acpi_device *dev = |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index ef02e488d468..6273d98d00eb 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -19,12 +19,6 @@ | |||
19 | #include "libata.h" | 19 | #include "libata.h" |
20 | 20 | ||
21 | #include <acpi/acpi_bus.h> | 21 | #include <acpi/acpi_bus.h> |
22 | #include <acpi/acnames.h> | ||
23 | #include <acpi/acnamesp.h> | ||
24 | #include <acpi/acparser.h> | ||
25 | #include <acpi/acexcep.h> | ||
26 | #include <acpi/acmacros.h> | ||
27 | #include <acpi/actypes.h> | ||
28 | 22 | ||
29 | enum { | 23 | enum { |
30 | ATA_ACPI_FILTER_SETXFER = 1 << 0, | 24 | ATA_ACPI_FILTER_SETXFER = 1 << 0, |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index e2e332d8ff95..8b77a9802df1 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -13,12 +13,6 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <scsi/scsi_host.h> | 14 | #include <scsi/scsi_host.h> |
15 | #include <acpi/acpi_bus.h> | 15 | #include <acpi/acpi_bus.h> |
16 | #include <acpi/acnames.h> | ||
17 | #include <acpi/acnamesp.h> | ||
18 | #include <acpi/acparser.h> | ||
19 | #include <acpi/acexcep.h> | ||
20 | #include <acpi/acmacros.h> | ||
21 | #include <acpi/actypes.h> | ||
22 | 16 | ||
23 | #include <linux/libata.h> | 17 | #include <linux/libata.h> |
24 | #include <linux/ata.h> | 18 | #include <linux/ata.h> |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index 68f052b42ed7..ed306eb1057f 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/security.h> | 23 | #include <linux/security.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <acpi/acpi.h> | 25 | #include <acpi/acpi.h> |
26 | #include <acpi/actypes.h> | ||
27 | #include <acpi/actbl.h> | ||
28 | #include "tpm.h" | 26 | #include "tpm.h" |
29 | 27 | ||
30 | #define TCG_EVENT_NAME_LEN_MAX 255 | 28 | #define TCG_EVENT_NAME_LEN_MAX 255 |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 8d7cf3f31450..f1df59f59a37 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -15,12 +15,14 @@ | |||
15 | #include <linux/tick.h> | 15 | #include <linux/tick.h> |
16 | 16 | ||
17 | #define BREAK_FUZZ 4 /* 4 us */ | 17 | #define BREAK_FUZZ 4 /* 4 us */ |
18 | #define PRED_HISTORY_PCT 50 | ||
18 | 19 | ||
19 | struct menu_device { | 20 | struct menu_device { |
20 | int last_state_idx; | 21 | int last_state_idx; |
21 | 22 | ||
22 | unsigned int expected_us; | 23 | unsigned int expected_us; |
23 | unsigned int predicted_us; | 24 | unsigned int predicted_us; |
25 | unsigned int current_predicted_us; | ||
24 | unsigned int last_measured_us; | 26 | unsigned int last_measured_us; |
25 | unsigned int elapsed_us; | 27 | unsigned int elapsed_us; |
26 | }; | 28 | }; |
@@ -47,6 +49,12 @@ static int menu_select(struct cpuidle_device *dev) | |||
47 | data->expected_us = | 49 | data->expected_us = |
48 | (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; | 50 | (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; |
49 | 51 | ||
52 | /* Recalculate predicted_us based on prediction_history_pct */ | ||
53 | data->predicted_us *= PRED_HISTORY_PCT; | ||
54 | data->predicted_us += (100 - PRED_HISTORY_PCT) * | ||
55 | data->current_predicted_us; | ||
56 | data->predicted_us /= 100; | ||
57 | |||
50 | /* find the deepest idle state that satisfies our constraints */ | 58 | /* find the deepest idle state that satisfies our constraints */ |
51 | for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { | 59 | for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { |
52 | struct cpuidle_state *s = &dev->states[i]; | 60 | struct cpuidle_state *s = &dev->states[i]; |
@@ -97,7 +105,7 @@ static void menu_reflect(struct cpuidle_device *dev) | |||
97 | measured_us = -1; | 105 | measured_us = -1; |
98 | 106 | ||
99 | /* Predict time until next break event */ | 107 | /* Predict time until next break event */ |
100 | data->predicted_us = max(measured_us, data->last_measured_us); | 108 | data->current_predicted_us = max(measured_us, data->last_measured_us); |
101 | 109 | ||
102 | if (last_idle_us + BREAK_FUZZ < | 110 | if (last_idle_us + BREAK_FUZZ < |
103 | data->expected_us - target->exit_latency) { | 111 | data->expected_us - target->exit_latency) { |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 2f9e941968d6..d8f295bdad76 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -18,12 +18,6 @@ | |||
18 | #include <linux/dmi.h> | 18 | #include <linux/dmi.h> |
19 | 19 | ||
20 | #include <acpi/acpi_bus.h> | 20 | #include <acpi/acpi_bus.h> |
21 | #include <acpi/acnames.h> | ||
22 | #include <acpi/acnamesp.h> | ||
23 | #include <acpi/acparser.h> | ||
24 | #include <acpi/acexcep.h> | ||
25 | #include <acpi/acmacros.h> | ||
26 | #include <acpi/actypes.h> | ||
27 | 21 | ||
28 | #define REGS_PER_GTF 7 | 22 | #define REGS_PER_GTF 7 |
29 | struct taskfile_array { | 23 | struct taskfile_array { |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 3949a1c73451..419c378bd24b 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -120,7 +120,7 @@ config TIFM_CORE | |||
120 | cards are supported via 'MMC/SD Card support: TI Flash Media MMC/SD | 120 | cards are supported via 'MMC/SD Card support: TI Flash Media MMC/SD |
121 | Interface support (MMC_TIFM_SD)'. | 121 | Interface support (MMC_TIFM_SD)'. |
122 | 122 | ||
123 | To compile this driver as a module, choose M here: the module will | 123 | To compile this driver as a module, choose M here: the module will |
124 | be called tifm_core. | 124 | be called tifm_core. |
125 | 125 | ||
126 | config TIFM_7XX1 | 126 | config TIFM_7XX1 |
@@ -133,100 +133,9 @@ config TIFM_7XX1 | |||
133 | To make actual use of the device, you will have to select some | 133 | To make actual use of the device, you will have to select some |
134 | flash card format drivers, as outlined in the TIFM_CORE Help. | 134 | flash card format drivers, as outlined in the TIFM_CORE Help. |
135 | 135 | ||
136 | To compile this driver as a module, choose M here: the module will | 136 | To compile this driver as a module, choose M here: the module will |
137 | be called tifm_7xx1. | 137 | be called tifm_7xx1. |
138 | 138 | ||
139 | config ACER_WMI | ||
140 | tristate "Acer WMI Laptop Extras (EXPERIMENTAL)" | ||
141 | depends on X86 | ||
142 | depends on EXPERIMENTAL | ||
143 | depends on ACPI | ||
144 | depends on LEDS_CLASS | ||
145 | depends on NEW_LEDS | ||
146 | depends on BACKLIGHT_CLASS_DEVICE | ||
147 | depends on SERIO_I8042 | ||
148 | depends on RFKILL | ||
149 | select ACPI_WMI | ||
150 | ---help--- | ||
151 | This is a driver for newer Acer (and Wistron) laptops. It adds | ||
152 | wireless radio and bluetooth control, and on some laptops, | ||
153 | exposes the mail LED and LCD backlight. | ||
154 | |||
155 | For more information about this driver see | ||
156 | <file:Documentation/laptops/acer-wmi.txt> | ||
157 | |||
158 | If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M | ||
159 | here. | ||
160 | |||
161 | config ASUS_LAPTOP | ||
162 | tristate "Asus Laptop Extras (EXPERIMENTAL)" | ||
163 | depends on X86 | ||
164 | depends on ACPI | ||
165 | depends on EXPERIMENTAL && !ACPI_ASUS | ||
166 | depends on LEDS_CLASS | ||
167 | depends on NEW_LEDS | ||
168 | depends on BACKLIGHT_CLASS_DEVICE | ||
169 | ---help--- | ||
170 | This is the new Linux driver for Asus laptops. It may also support some | ||
171 | MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate | ||
172 | standard ACPI events that go through /proc/acpi/events. It also adds | ||
173 | support for video output switching, LCD backlight control, Bluetooth and | ||
174 | Wlan control, and most importantly, allows you to blink those fancy LEDs. | ||
175 | |||
176 | For more information and a userspace daemon for handling the extra | ||
177 | buttons see <http://acpi4asus.sf.net/>. | ||
178 | |||
179 | If you have an ACPI-compatible ASUS laptop, say Y or M here. | ||
180 | |||
181 | config FUJITSU_LAPTOP | ||
182 | tristate "Fujitsu Laptop Extras" | ||
183 | depends on X86 | ||
184 | depends on ACPI | ||
185 | depends on INPUT | ||
186 | depends on BACKLIGHT_CLASS_DEVICE | ||
187 | ---help--- | ||
188 | This is a driver for laptops built by Fujitsu: | ||
189 | |||
190 | * P2xxx/P5xxx/S6xxx/S7xxx series Lifebooks | ||
191 | * Possibly other Fujitsu laptop models | ||
192 | * Tested with S6410 and S7020 | ||
193 | |||
194 | It adds support for LCD brightness control and some hotkeys. | ||
195 | |||
196 | If you have a Fujitsu laptop, say Y or M here. | ||
197 | |||
198 | config FUJITSU_LAPTOP_DEBUG | ||
199 | bool "Verbose debug mode for Fujitsu Laptop Extras" | ||
200 | depends on FUJITSU_LAPTOP | ||
201 | default n | ||
202 | ---help--- | ||
203 | Enables extra debug output from the fujitsu extras driver, at the | ||
204 | expense of a slight increase in driver size. | ||
205 | |||
206 | If you are not sure, say N here. | ||
207 | |||
208 | config TC1100_WMI | ||
209 | tristate "HP Compaq TC1100 Tablet WMI Extras (EXPERIMENTAL)" | ||
210 | depends on X86 && !X86_64 | ||
211 | depends on EXPERIMENTAL | ||
212 | depends on ACPI | ||
213 | select ACPI_WMI | ||
214 | ---help--- | ||
215 | This is a driver for the WMI extensions (wireless and bluetooth power | ||
216 | control) of the HP Compaq TC1100 tablet. | ||
217 | |||
218 | config HP_WMI | ||
219 | tristate "HP WMI extras" | ||
220 | depends on ACPI_WMI | ||
221 | depends on INPUT | ||
222 | depends on RFKILL | ||
223 | help | ||
224 | Say Y here if you want to support WMI-based hotkeys on HP laptops and | ||
225 | to read data from WMI such as docking or ambient light sensor state. | ||
226 | |||
227 | To compile this driver as a module, choose M here: the module will | ||
228 | be called hp-wmi. | ||
229 | |||
230 | config ICS932S401 | 139 | config ICS932S401 |
231 | tristate "Integrated Circuits ICS932S401" | 140 | tristate "Integrated Circuits ICS932S401" |
232 | depends on I2C && EXPERIMENTAL | 141 | depends on I2C && EXPERIMENTAL |
@@ -237,170 +146,6 @@ config ICS932S401 | |||
237 | This driver can also be built as a module. If so, the module | 146 | This driver can also be built as a module. If so, the module |
238 | will be called ics932s401. | 147 | will be called ics932s401. |
239 | 148 | ||
240 | config MSI_LAPTOP | ||
241 | tristate "MSI Laptop Extras" | ||
242 | depends on X86 | ||
243 | depends on ACPI | ||
244 | depends on BACKLIGHT_CLASS_DEVICE | ||
245 | ---help--- | ||
246 | This is a driver for laptops built by MSI (MICRO-STAR | ||
247 | INTERNATIONAL): | ||
248 | |||
249 | MSI MegaBook S270 (MS-1013) | ||
250 | Cytron/TCM/Medion/Tchibo MD96100/SAM2000 | ||
251 | |||
252 | It adds support for Bluetooth, WLAN and LCD brightness control. | ||
253 | |||
254 | More information about this driver is available at | ||
255 | <http://0pointer.de/lennart/tchibo.html>. | ||
256 | |||
257 | If you have an MSI S270 laptop, say Y or M here. | ||
258 | |||
259 | config PANASONIC_LAPTOP | ||
260 | tristate "Panasonic Laptop Extras" | ||
261 | depends on X86 && INPUT && ACPI | ||
262 | depends on BACKLIGHT_CLASS_DEVICE | ||
263 | ---help--- | ||
264 | This driver adds support for access to backlight control and hotkeys | ||
265 | on Panasonic Let's Note laptops. | ||
266 | |||
267 | If you have a Panasonic Let's note laptop (such as the R1(N variant), | ||
268 | R2, R3, R5, T2, W2 and Y2 series), say Y. | ||
269 | |||
270 | config COMPAL_LAPTOP | ||
271 | tristate "Compal Laptop Extras" | ||
272 | depends on X86 | ||
273 | depends on ACPI | ||
274 | depends on BACKLIGHT_CLASS_DEVICE | ||
275 | ---help--- | ||
276 | This is a driver for laptops built by Compal: | ||
277 | |||
278 | Compal FL90/IFL90 | ||
279 | Compal FL91/IFL91 | ||
280 | Compal FL92/JFL92 | ||
281 | Compal FT00/IFT00 | ||
282 | |||
283 | It adds support for Bluetooth, WLAN and LCD brightness control. | ||
284 | |||
285 | If you have an Compal FL9x/IFL9x/FT00 laptop, say Y or M here. | ||
286 | |||
287 | config SONY_LAPTOP | ||
288 | tristate "Sony Laptop Extras" | ||
289 | depends on X86 && ACPI | ||
290 | select BACKLIGHT_CLASS_DEVICE | ||
291 | depends on INPUT | ||
292 | ---help--- | ||
293 | This mini-driver drives the SNC and SPIC devices present in the ACPI | ||
294 | BIOS of the Sony Vaio laptops. | ||
295 | |||
296 | It gives access to some extra laptop functionalities like Bluetooth, | ||
297 | screen brightness control, Fn keys and allows powering on/off some | ||
298 | devices. | ||
299 | |||
300 | Read <file:Documentation/laptops/sony-laptop.txt> for more information. | ||
301 | |||
302 | config SONYPI_COMPAT | ||
303 | bool "Sonypi compatibility" | ||
304 | depends on SONY_LAPTOP | ||
305 | ---help--- | ||
306 | Build the sonypi driver compatibility code into the sony-laptop driver. | ||
307 | |||
308 | config THINKPAD_ACPI | ||
309 | tristate "ThinkPad ACPI Laptop Extras" | ||
310 | depends on X86 && ACPI | ||
311 | select BACKLIGHT_LCD_SUPPORT | ||
312 | select BACKLIGHT_CLASS_DEVICE | ||
313 | select HWMON | ||
314 | select NVRAM | ||
315 | select INPUT | ||
316 | select NEW_LEDS | ||
317 | select LEDS_CLASS | ||
318 | select NET | ||
319 | select RFKILL | ||
320 | ---help--- | ||
321 | This is a driver for the IBM and Lenovo ThinkPad laptops. It adds | ||
322 | support for Fn-Fx key combinations, Bluetooth control, video | ||
323 | output switching, ThinkLight control, UltraBay eject and more. | ||
324 | For more information about this driver see | ||
325 | <file:Documentation/laptops/thinkpad-acpi.txt> and | ||
326 | <http://ibm-acpi.sf.net/> . | ||
327 | |||
328 | This driver was formerly known as ibm-acpi. | ||
329 | |||
330 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. | ||
331 | |||
332 | config THINKPAD_ACPI_DEBUG | ||
333 | bool "Verbose debug mode" | ||
334 | depends on THINKPAD_ACPI | ||
335 | default n | ||
336 | ---help--- | ||
337 | Enables extra debugging information, at the expense of a slightly | ||
338 | increase in driver size. | ||
339 | |||
340 | If you are not sure, say N here. | ||
341 | |||
342 | config THINKPAD_ACPI_DOCK | ||
343 | bool "Legacy Docking Station Support" | ||
344 | depends on THINKPAD_ACPI | ||
345 | depends on ACPI_DOCK=n | ||
346 | default n | ||
347 | ---help--- | ||
348 | Allows the thinkpad_acpi driver to handle docking station events. | ||
349 | This support was made obsolete by the generic ACPI docking station | ||
350 | support (CONFIG_ACPI_DOCK). It will allow locking and removing the | ||
351 | laptop from the docking station, but will not properly connect PCI | ||
352 | devices. | ||
353 | |||
354 | If you are not sure, say N here. | ||
355 | |||
356 | config THINKPAD_ACPI_BAY | ||
357 | bool "Legacy Removable Bay Support" | ||
358 | depends on THINKPAD_ACPI | ||
359 | default y | ||
360 | ---help--- | ||
361 | Allows the thinkpad_acpi driver to handle removable bays. It will | ||
362 | electrically disable the device in the bay, and also generate | ||
363 | notifications when the bay lever is ejected or inserted. | ||
364 | |||
365 | If you are not sure, say Y here. | ||
366 | |||
367 | config THINKPAD_ACPI_VIDEO | ||
368 | bool "Video output control support" | ||
369 | depends on THINKPAD_ACPI | ||
370 | default y | ||
371 | ---help--- | ||
372 | Allows the thinkpad_acpi driver to provide an interface to control | ||
373 | the various video output ports. | ||
374 | |||
375 | This feature often won't work well, depending on ThinkPad model, | ||
376 | display state, video output devices in use, whether there is a X | ||
377 | server running, phase of the moon, and the current mood of | ||
378 | Schroedinger's cat. If you can use X.org's RandR to control | ||
379 | your ThinkPad's video output ports instead of this feature, | ||
380 | don't think twice: do it and say N here to save some memory. | ||
381 | |||
382 | If you are not sure, say Y here. | ||
383 | |||
384 | config THINKPAD_ACPI_HOTKEY_POLL | ||
385 | bool "Support NVRAM polling for hot keys" | ||
386 | depends on THINKPAD_ACPI | ||
387 | default y | ||
388 | ---help--- | ||
389 | Some thinkpad models benefit from NVRAM polling to detect a few of | ||
390 | the hot key press events. If you know your ThinkPad model does not | ||
391 | need to do NVRAM polling to support any of the hot keys you use, | ||
392 | unselecting this option will save about 1kB of memory. | ||
393 | |||
394 | ThinkPads T40 and newer, R52 and newer, and X31 and newer are | ||
395 | unlikely to need NVRAM polling in their latest BIOS versions. | ||
396 | |||
397 | NVRAM polling can detect at most the following keys: ThinkPad/Access | ||
398 | IBM, Zoom, Switch Display (fn+F7), ThinkLight, Volume up/down/mute, | ||
399 | Brightness up/down, Display Expand (fn+F8), Hibernate (fn+F12). | ||
400 | |||
401 | If you are not sure, say Y here. The driver enables polling only if | ||
402 | it is strictly necessary to do so. | ||
403 | |||
404 | config ATMEL_SSC | 149 | config ATMEL_SSC |
405 | tristate "Device driver for Atmel SSC peripheral" | 150 | tristate "Device driver for Atmel SSC peripheral" |
406 | depends on AVR32 || ARCH_AT91 | 151 | depends on AVR32 || ARCH_AT91 |
@@ -413,31 +158,6 @@ config ATMEL_SSC | |||
413 | 158 | ||
414 | If unsure, say N. | 159 | If unsure, say N. |
415 | 160 | ||
416 | config INTEL_MENLOW | ||
417 | tristate "Thermal Management driver for Intel menlow platform" | ||
418 | depends on ACPI_THERMAL | ||
419 | select THERMAL | ||
420 | depends on X86 | ||
421 | ---help--- | ||
422 | ACPI thermal management enhancement driver on | ||
423 | Intel Menlow platform. | ||
424 | |||
425 | If unsure, say N. | ||
426 | |||
427 | config EEEPC_LAPTOP | ||
428 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" | ||
429 | depends on X86 | ||
430 | depends on ACPI | ||
431 | depends on BACKLIGHT_CLASS_DEVICE | ||
432 | depends on HWMON | ||
433 | depends on EXPERIMENTAL | ||
434 | depends on RFKILL | ||
435 | ---help--- | ||
436 | This driver supports the Fn-Fx keys on Eee PC laptops. | ||
437 | It also adds the ability to switch camera/wlan on/off. | ||
438 | |||
439 | If you have an Eee PC laptop, say Y or M here. | ||
440 | |||
441 | config ENCLOSURE_SERVICES | 161 | config ENCLOSURE_SERVICES |
442 | tristate "Enclosure Services" | 162 | tristate "Enclosure Services" |
443 | default n | 163 | default n |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 5de863a0e395..9cf8ae6e4b39 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
@@ -1,33 +1,20 @@ | |||
1 | # | 1 | # |
2 | # Makefile for misc devices that really don't fit anywhere else. | 2 | # Makefile for misc devices that really don't fit anywhere else. |
3 | # | 3 | # |
4 | obj- := misc.o # Dummy rule to force built-in.o to be made | ||
5 | 4 | ||
6 | obj-$(CONFIG_IBM_ASM) += ibmasm/ | 5 | obj-$(CONFIG_IBM_ASM) += ibmasm/ |
7 | obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ | 6 | obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ |
8 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o | ||
9 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o | ||
10 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o | ||
11 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o | ||
12 | obj-$(CONFIG_ACER_WMI) += acer-wmi.o | ||
13 | obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o | 7 | obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o |
14 | obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o | 8 | obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o |
15 | obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o | 9 | obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o |
16 | obj-$(CONFIG_HP_WMI) += hp-wmi.o | ||
17 | obj-$(CONFIG_ICS932S401) += ics932s401.o | 10 | obj-$(CONFIG_ICS932S401) += ics932s401.o |
18 | obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o | ||
19 | obj-$(CONFIG_LKDTM) += lkdtm.o | 11 | obj-$(CONFIG_LKDTM) += lkdtm.o |
20 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o | 12 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o |
21 | obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o | 13 | obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o |
22 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o | 14 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o |
23 | obj-$(CONFIG_PHANTOM) += phantom.o | 15 | obj-$(CONFIG_PHANTOM) += phantom.o |
24 | obj-$(CONFIG_SGI_IOC4) += ioc4.o | 16 | obj-$(CONFIG_SGI_IOC4) += ioc4.o |
25 | obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o | ||
26 | obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o | ||
27 | obj-$(CONFIG_FUJITSU_LAPTOP) += fujitsu-laptop.o | ||
28 | obj-$(CONFIG_PANASONIC_LAPTOP) += panasonic-laptop.o | ||
29 | obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o | 17 | obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o |
30 | obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o | ||
31 | obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o | 18 | obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o |
32 | obj-$(CONFIG_KGDB_TESTS) += kgdbts.o | 19 | obj-$(CONFIG_KGDB_TESTS) += kgdbts.o |
33 | obj-$(CONFIG_SGI_XP) += sgi-xp/ | 20 | obj-$(CONFIG_SGI_XP) += sgi-xp/ |
diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index c62ab8d240aa..1c1141801060 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/pci-acpi.h> | 33 | #include <linux/pci-acpi.h> |
34 | #include <acpi/acpi.h> | 34 | #include <acpi/acpi.h> |
35 | #include <acpi/acpi_bus.h> | 35 | #include <acpi/acpi_bus.h> |
36 | #include <acpi/actypes.h> | ||
37 | 36 | ||
38 | #define MY_NAME "acpi_pcihp" | 37 | #define MY_NAME "acpi_pcihp" |
39 | 38 | ||
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 27fd18f019f8..db85284ffb62 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -217,7 +217,6 @@ struct hpc_ops { | |||
217 | #ifdef CONFIG_ACPI | 217 | #ifdef CONFIG_ACPI |
218 | #include <acpi/acpi.h> | 218 | #include <acpi/acpi.h> |
219 | #include <acpi/acpi_bus.h> | 219 | #include <acpi/acpi_bus.h> |
220 | #include <acpi/actypes.h> | ||
221 | #include <linux/pci-acpi.h> | 220 | #include <linux/pci-acpi.h> |
222 | 221 | ||
223 | extern void __init pciehp_acpi_slot_detection_init(void); | 222 | extern void __init pciehp_acpi_slot_detection_init(void); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 3582512e7226..deea8a187eb8 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pci-aspm.h> | 14 | #include <linux/pci-aspm.h> |
15 | #include <acpi/acpi.h> | 15 | #include <acpi/acpi.h> |
16 | #include <acpi/acnamesp.h> | ||
17 | #include <acpi/acresrc.h> | ||
18 | #include <acpi/acpi_bus.h> | 16 | #include <acpi/acpi_bus.h> |
19 | 17 | ||
20 | #include <linux/pci-acpi.h> | 18 | #include <linux/pci-acpi.h> |
diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig new file mode 100644 index 000000000000..9652c3fe7f5e --- /dev/null +++ b/drivers/platform/Kconfig | |||
@@ -0,0 +1,5 @@ | |||
1 | # drivers/platform/Kconfig | ||
2 | |||
3 | if X86 | ||
4 | source "drivers/platform/x86/Kconfig" | ||
5 | endif | ||
diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile new file mode 100644 index 000000000000..782953ae4c03 --- /dev/null +++ b/drivers/platform/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for linux/drivers/platform | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_X86) += x86/ | ||
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig new file mode 100644 index 000000000000..e65448e99b48 --- /dev/null +++ b/drivers/platform/x86/Kconfig | |||
@@ -0,0 +1,375 @@ | |||
1 | # | ||
2 | # X86 Platform Specific Drivers | ||
3 | # | ||
4 | |||
5 | menuconfig X86_PLATFORM_DEVICES | ||
6 | bool "X86 Platform Specific Device Drivers" | ||
7 | default y | ||
8 | ---help--- | ||
9 | Say Y here to get to see options for device drivers for various | ||
10 | x86 platforms, including vendor-specific laptop extension drivers. | ||
11 | This option alone does not add any kernel code. | ||
12 | |||
13 | If you say N, all options in this submenu will be skipped and disabled. | ||
14 | |||
15 | if X86_PLATFORM_DEVICES | ||
16 | |||
17 | config ACER_WMI | ||
18 | tristate "Acer WMI Laptop Extras (EXPERIMENTAL)" | ||
19 | depends on EXPERIMENTAL | ||
20 | depends on ACPI | ||
21 | depends on LEDS_CLASS | ||
22 | depends on NEW_LEDS | ||
23 | depends on BACKLIGHT_CLASS_DEVICE | ||
24 | depends on SERIO_I8042 | ||
25 | depends on RFKILL | ||
26 | select ACPI_WMI | ||
27 | ---help--- | ||
28 | This is a driver for newer Acer (and Wistron) laptops. It adds | ||
29 | wireless radio and bluetooth control, and on some laptops, | ||
30 | exposes the mail LED and LCD backlight. | ||
31 | |||
32 | For more information about this driver see | ||
33 | <file:Documentation/laptops/acer-wmi.txt> | ||
34 | |||
35 | If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M | ||
36 | here. | ||
37 | |||
38 | config ASUS_LAPTOP | ||
39 | tristate "Asus Laptop Extras (EXPERIMENTAL)" | ||
40 | depends on ACPI | ||
41 | depends on EXPERIMENTAL && !ACPI_ASUS | ||
42 | depends on LEDS_CLASS | ||
43 | depends on NEW_LEDS | ||
44 | depends on BACKLIGHT_CLASS_DEVICE | ||
45 | ---help--- | ||
46 | This is the new Linux driver for Asus laptops. It may also support some | ||
47 | MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate | ||
48 | standard ACPI events that go through /proc/acpi/events. It also adds | ||
49 | support for video output switching, LCD backlight control, Bluetooth and | ||
50 | Wlan control, and most importantly, allows you to blink those fancy LEDs. | ||
51 | |||
52 | For more information and a userspace daemon for handling the extra | ||
53 | buttons see <http://acpi4asus.sf.net/>. | ||
54 | |||
55 | If you have an ACPI-compatible ASUS laptop, say Y or M here. | ||
56 | |||
57 | config FUJITSU_LAPTOP | ||
58 | tristate "Fujitsu Laptop Extras" | ||
59 | depends on ACPI | ||
60 | depends on INPUT | ||
61 | depends on BACKLIGHT_CLASS_DEVICE | ||
62 | ---help--- | ||
63 | This is a driver for laptops built by Fujitsu: | ||
64 | |||
65 | * P2xxx/P5xxx/S6xxx/S7xxx series Lifebooks | ||
66 | * Possibly other Fujitsu laptop models | ||
67 | * Tested with S6410 and S7020 | ||
68 | |||
69 | It adds support for LCD brightness control and some hotkeys. | ||
70 | |||
71 | If you have a Fujitsu laptop, say Y or M here. | ||
72 | |||
73 | config FUJITSU_LAPTOP_DEBUG | ||
74 | bool "Verbose debug mode for Fujitsu Laptop Extras" | ||
75 | depends on FUJITSU_LAPTOP | ||
76 | default n | ||
77 | ---help--- | ||
78 | Enables extra debug output from the fujitsu extras driver, at the | ||
79 | expense of a slight increase in driver size. | ||
80 | |||
81 | If you are not sure, say N here. | ||
82 | |||
83 | config TC1100_WMI | ||
84 | tristate "HP Compaq TC1100 Tablet WMI Extras (EXPERIMENTAL)" | ||
85 | depends on !X86_64 | ||
86 | depends on EXPERIMENTAL | ||
87 | depends on ACPI | ||
88 | select ACPI_WMI | ||
89 | ---help--- | ||
90 | This is a driver for the WMI extensions (wireless and bluetooth power | ||
91 | control) of the HP Compaq TC1100 tablet. | ||
92 | |||
93 | config HP_WMI | ||
94 | tristate "HP WMI extras" | ||
95 | depends on ACPI_WMI | ||
96 | depends on INPUT | ||
97 | depends on RFKILL | ||
98 | help | ||
99 | Say Y here if you want to support WMI-based hotkeys on HP laptops and | ||
100 | to read data from WMI such as docking or ambient light sensor state. | ||
101 | |||
102 | To compile this driver as a module, choose M here: the module will | ||
103 | be called hp-wmi. | ||
104 | |||
105 | config MSI_LAPTOP | ||
106 | tristate "MSI Laptop Extras" | ||
107 | depends on ACPI | ||
108 | depends on BACKLIGHT_CLASS_DEVICE | ||
109 | ---help--- | ||
110 | This is a driver for laptops built by MSI (MICRO-STAR | ||
111 | INTERNATIONAL): | ||
112 | |||
113 | MSI MegaBook S270 (MS-1013) | ||
114 | Cytron/TCM/Medion/Tchibo MD96100/SAM2000 | ||
115 | |||
116 | It adds support for Bluetooth, WLAN and LCD brightness control. | ||
117 | |||
118 | More information about this driver is available at | ||
119 | <http://0pointer.de/lennart/tchibo.html>. | ||
120 | |||
121 | If you have an MSI S270 laptop, say Y or M here. | ||
122 | |||
123 | config PANASONIC_LAPTOP | ||
124 | tristate "Panasonic Laptop Extras" | ||
125 | depends on INPUT && ACPI | ||
126 | depends on BACKLIGHT_CLASS_DEVICE | ||
127 | ---help--- | ||
128 | This driver adds support for access to backlight control and hotkeys | ||
129 | on Panasonic Let's Note laptops. | ||
130 | |||
131 | If you have a Panasonic Let's note laptop (such as the R1(N variant), | ||
132 | R2, R3, R5, T2, W2 and Y2 series), say Y. | ||
133 | |||
134 | config COMPAL_LAPTOP | ||
135 | tristate "Compal Laptop Extras" | ||
136 | depends on ACPI | ||
137 | depends on BACKLIGHT_CLASS_DEVICE | ||
138 | ---help--- | ||
139 | This is a driver for laptops built by Compal: | ||
140 | |||
141 | Compal FL90/IFL90 | ||
142 | Compal FL91/IFL91 | ||
143 | Compal FL92/JFL92 | ||
144 | Compal FT00/IFT00 | ||
145 | |||
146 | It adds support for Bluetooth, WLAN and LCD brightness control. | ||
147 | |||
148 | If you have an Compal FL9x/IFL9x/FT00 laptop, say Y or M here. | ||
149 | |||
150 | config SONY_LAPTOP | ||
151 | tristate "Sony Laptop Extras" | ||
152 | depends on ACPI | ||
153 | select BACKLIGHT_CLASS_DEVICE | ||
154 | depends on INPUT | ||
155 | ---help--- | ||
156 | This mini-driver drives the SNC and SPIC devices present in the ACPI | ||
157 | BIOS of the Sony Vaio laptops. | ||
158 | |||
159 | It gives access to some extra laptop functionalities like Bluetooth, | ||
160 | screen brightness control, Fn keys and allows powering on/off some | ||
161 | devices. | ||
162 | |||
163 | Read <file:Documentation/laptops/sony-laptop.txt> for more information. | ||
164 | |||
165 | config SONYPI_COMPAT | ||
166 | bool "Sonypi compatibility" | ||
167 | depends on SONY_LAPTOP | ||
168 | ---help--- | ||
169 | Build the sonypi driver compatibility code into the sony-laptop driver. | ||
170 | |||
171 | config THINKPAD_ACPI | ||
172 | tristate "ThinkPad ACPI Laptop Extras" | ||
173 | depends on ACPI | ||
174 | select BACKLIGHT_LCD_SUPPORT | ||
175 | select BACKLIGHT_CLASS_DEVICE | ||
176 | select HWMON | ||
177 | select NVRAM | ||
178 | select INPUT | ||
179 | select NEW_LEDS | ||
180 | select LEDS_CLASS | ||
181 | select NET | ||
182 | select RFKILL | ||
183 | ---help--- | ||
184 | This is a driver for the IBM and Lenovo ThinkPad laptops. It adds | ||
185 | support for Fn-Fx key combinations, Bluetooth control, video | ||
186 | output switching, ThinkLight control, UltraBay eject and more. | ||
187 | For more information about this driver see | ||
188 | <file:Documentation/laptops/thinkpad-acpi.txt> and | ||
189 | <http://ibm-acpi.sf.net/> . | ||
190 | |||
191 | This driver was formerly known as ibm-acpi. | ||
192 | |||
193 | If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. | ||
194 | |||
195 | config THINKPAD_ACPI_DEBUG | ||
196 | bool "Verbose debug mode" | ||
197 | depends on THINKPAD_ACPI | ||
198 | default n | ||
199 | ---help--- | ||
200 | Enables extra debugging information, at the expense of a slightly | ||
201 | increase in driver size. | ||
202 | |||
203 | If you are not sure, say N here. | ||
204 | |||
205 | config THINKPAD_ACPI_DOCK | ||
206 | bool "Legacy Docking Station Support" | ||
207 | depends on THINKPAD_ACPI | ||
208 | depends on ACPI_DOCK=n | ||
209 | default n | ||
210 | ---help--- | ||
211 | Allows the thinkpad_acpi driver to handle docking station events. | ||
212 | This support was made obsolete by the generic ACPI docking station | ||
213 | support (CONFIG_ACPI_DOCK). It will allow locking and removing the | ||
214 | laptop from the docking station, but will not properly connect PCI | ||
215 | devices. | ||
216 | |||
217 | If you are not sure, say N here. | ||
218 | |||
219 | config THINKPAD_ACPI_BAY | ||
220 | bool "Legacy Removable Bay Support" | ||
221 | depends on THINKPAD_ACPI | ||
222 | default y | ||
223 | ---help--- | ||
224 | Allows the thinkpad_acpi driver to handle removable bays. It will | ||
225 | electrically disable the device in the bay, and also generate | ||
226 | notifications when the bay lever is ejected or inserted. | ||
227 | |||
228 | If you are not sure, say Y here. | ||
229 | |||
230 | config THINKPAD_ACPI_VIDEO | ||
231 | bool "Video output control support" | ||
232 | depends on THINKPAD_ACPI | ||
233 | default y | ||
234 | ---help--- | ||
235 | Allows the thinkpad_acpi driver to provide an interface to control | ||
236 | the various video output ports. | ||
237 | |||
238 | This feature often won't work well, depending on ThinkPad model, | ||
239 | display state, video output devices in use, whether there is a X | ||
240 | server running, phase of the moon, and the current mood of | ||
241 | Schroedinger's cat. If you can use X.org's RandR to control | ||
242 | your ThinkPad's video output ports instead of this feature, | ||
243 | don't think twice: do it and say N here to save some memory. | ||
244 | |||
245 | If you are not sure, say Y here. | ||
246 | |||
247 | config THINKPAD_ACPI_HOTKEY_POLL | ||
248 | bool "Support NVRAM polling for hot keys" | ||
249 | depends on THINKPAD_ACPI | ||
250 | default y | ||
251 | ---help--- | ||
252 | Some thinkpad models benefit from NVRAM polling to detect a few of | ||
253 | the hot key press events. If you know your ThinkPad model does not | ||
254 | need to do NVRAM polling to support any of the hot keys you use, | ||
255 | unselecting this option will save about 1kB of memory. | ||
256 | |||
257 | ThinkPads T40 and newer, R52 and newer, and X31 and newer are | ||
258 | unlikely to need NVRAM polling in their latest BIOS versions. | ||
259 | |||
260 | NVRAM polling can detect at most the following keys: ThinkPad/Access | ||
261 | IBM, Zoom, Switch Display (fn+F7), ThinkLight, Volume up/down/mute, | ||
262 | Brightness up/down, Display Expand (fn+F8), Hibernate (fn+F12). | ||
263 | |||
264 | If you are not sure, say Y here. The driver enables polling only if | ||
265 | it is strictly necessary to do so. | ||
266 | |||
267 | config INTEL_MENLOW | ||
268 | tristate "Thermal Management driver for Intel menlow platform" | ||
269 | depends on ACPI_THERMAL | ||
270 | select THERMAL | ||
271 | ---help--- | ||
272 | ACPI thermal management enhancement driver on | ||
273 | Intel Menlow platform. | ||
274 | |||
275 | If unsure, say N. | ||
276 | |||
277 | config EEEPC_LAPTOP | ||
278 | tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" | ||
279 | depends on ACPI | ||
280 | depends on EXPERIMENTAL | ||
281 | select BACKLIGHT_CLASS_DEVICE | ||
282 | select HWMON | ||
283 | select RFKILL | ||
284 | ---help--- | ||
285 | This driver supports the Fn-Fx keys on Eee PC laptops. | ||
286 | It also adds the ability to switch camera/wlan on/off. | ||
287 | |||
288 | If you have an Eee PC laptop, say Y or M here. | ||
289 | |||
290 | |||
291 | config ACPI_WMI | ||
292 | tristate "WMI (EXPERIMENTAL)" | ||
293 | depends on ACPI | ||
294 | depends on EXPERIMENTAL | ||
295 | help | ||
296 | This driver adds support for the ACPI-WMI (Windows Management | ||
297 | Instrumentation) mapper device (PNP0C14) found on some systems. | ||
298 | |||
299 | ACPI-WMI is a proprietary extension to ACPI to expose parts of the | ||
300 | ACPI firmware to userspace - this is done through various vendor | ||
301 | defined methods and data blocks in a PNP0C14 device, which are then | ||
302 | made available for userspace to call. | ||
303 | |||
304 | The implementation of this in Linux currently only exposes this to | ||
305 | other kernel space drivers. | ||
306 | |||
307 | This driver is a required dependency to build the firmware specific | ||
308 | drivers needed on many machines, including Acer and HP laptops. | ||
309 | |||
310 | It is safe to enable this driver even if your DSDT doesn't define | ||
311 | any ACPI-WMI devices. | ||
312 | |||
313 | config ACPI_ASUS | ||
314 | tristate "ASUS/Medion Laptop Extras" | ||
315 | depends on ACPI | ||
316 | select BACKLIGHT_CLASS_DEVICE | ||
317 | ---help--- | ||
318 | This driver provides support for extra features of ACPI-compatible | ||
319 | ASUS laptops. As some of Medion laptops are made by ASUS, it may also | ||
320 | support some Medion laptops (such as 9675 for example). It makes all | ||
321 | the extra buttons generate standard ACPI events that go through | ||
322 | /proc/acpi/events, and (on some models) adds support for changing the | ||
323 | display brightness and output, switching the LCD backlight on and off, | ||
324 | and most importantly, allows you to blink those fancy LEDs intended | ||
325 | for reporting mail and wireless status. | ||
326 | |||
327 | Note: display switching code is currently considered EXPERIMENTAL, | ||
328 | toying with these values may even lock your machine. | ||
329 | |||
330 | All settings are changed via /proc/acpi/asus directory entries. Owner | ||
331 | and group for these entries can be set with asus_uid and asus_gid | ||
332 | parameters. | ||
333 | |||
334 | More information and a userspace daemon for handling the extra buttons | ||
335 | at <http://sourceforge.net/projects/acpi4asus/>. | ||
336 | |||
337 | If you have an ACPI-compatible ASUS laptop, say Y or M here. This | ||
338 | driver is still under development, so if your laptop is unsupported or | ||
339 | something works not quite as expected, please use the mailing list | ||
340 | available on the above page (acpi4asus-user@lists.sourceforge.net). | ||
341 | |||
342 | NOTE: This driver is deprecated and will probably be removed soon, | ||
343 | use asus-laptop instead. | ||
344 | |||
345 | config ACPI_TOSHIBA | ||
346 | tristate "Toshiba Laptop Extras" | ||
347 | depends on ACPI | ||
348 | depends on INPUT | ||
349 | select INPUT_POLLDEV | ||
350 | select NET | ||
351 | select RFKILL | ||
352 | select BACKLIGHT_CLASS_DEVICE | ||
353 | ---help--- | ||
354 | This driver adds support for access to certain system settings | ||
355 | on "legacy free" Toshiba laptops. These laptops can be recognized by | ||
356 | their lack of a BIOS setup menu and APM support. | ||
357 | |||
358 | On these machines, all system configuration is handled through the | ||
359 | ACPI. This driver is required for access to controls not covered | ||
360 | by the general ACPI drivers, such as LCD brightness, video output, | ||
361 | etc. | ||
362 | |||
363 | This driver differs from the non-ACPI Toshiba laptop driver (located | ||
364 | under "Processor type and features") in several aspects. | ||
365 | Configuration is accessed by reading and writing text files in the | ||
366 | /proc tree instead of by program interface to /dev. Furthermore, no | ||
367 | power management functions are exposed, as those are handled by the | ||
368 | general ACPI drivers. | ||
369 | |||
370 | More information about this driver is available at | ||
371 | <http://memebeam.org/toys/ToshibaAcpiDriver>. | ||
372 | |||
373 | If you have a legacy free Toshiba laptop (such as the Libretto L1 | ||
374 | series), say Y. | ||
375 | endif # X86_PLATFORM_DEVICES | ||
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile new file mode 100644 index 000000000000..1e9de2ae0de5 --- /dev/null +++ b/drivers/platform/x86/Makefile | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # Makefile for linux/drivers/platform/x86 | ||
3 | # x86 Platform-Specific Drivers | ||
4 | # | ||
5 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o | ||
6 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o | ||
7 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o | ||
8 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o | ||
9 | obj-$(CONFIG_ACER_WMI) += acer-wmi.o | ||
10 | obj-$(CONFIG_HP_WMI) += hp-wmi.o | ||
11 | obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o | ||
12 | obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o | ||
13 | obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o | ||
14 | obj-$(CONFIG_FUJITSU_LAPTOP) += fujitsu-laptop.o | ||
15 | obj-$(CONFIG_PANASONIC_LAPTOP) += panasonic-laptop.o | ||
16 | obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o | ||
17 | obj-$(CONFIG_ACPI_WMI) += wmi.o | ||
18 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | ||
19 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | ||
diff --git a/drivers/misc/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 94c9f911824e..94c9f911824e 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
diff --git a/drivers/misc/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 8fb8b3591048..8fb8b3591048 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
diff --git a/drivers/acpi/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index 1e74988c7b2d..1e74988c7b2d 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
diff --git a/drivers/misc/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 11003bba10d3..11003bba10d3 100644 --- a/drivers/misc/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 02fe2b8b8939..02fe2b8b8939 100644 --- a/drivers/misc/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index a7dd3e9fb79d..65dc41540c62 100644 --- a/drivers/misc/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -3,6 +3,7 @@ | |||
3 | /* | 3 | /* |
4 | Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | 4 | Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
5 | Copyright (C) 2008 Peter Gruber <nokos@gmx.net> | 5 | Copyright (C) 2008 Peter Gruber <nokos@gmx.net> |
6 | Copyright (C) 2008 Tony Vroon <tony@linx.net> | ||
6 | Based on earlier work: | 7 | Based on earlier work: |
7 | Copyright (C) 2003 Shane Spencer <shane@bogomip.com> | 8 | Copyright (C) 2003 Shane Spencer <shane@bogomip.com> |
8 | Adrian Yee <brewt-fujitsu@brewt.org> | 9 | Adrian Yee <brewt-fujitsu@brewt.org> |
@@ -65,8 +66,11 @@ | |||
65 | #include <linux/kfifo.h> | 66 | #include <linux/kfifo.h> |
66 | #include <linux/video_output.h> | 67 | #include <linux/video_output.h> |
67 | #include <linux/platform_device.h> | 68 | #include <linux/platform_device.h> |
69 | #ifdef CONFIG_LEDS_CLASS | ||
70 | #include <linux/leds.h> | ||
71 | #endif | ||
68 | 72 | ||
69 | #define FUJITSU_DRIVER_VERSION "0.4.3" | 73 | #define FUJITSU_DRIVER_VERSION "0.5.0" |
70 | 74 | ||
71 | #define FUJITSU_LCD_N_LEVELS 8 | 75 | #define FUJITSU_LCD_N_LEVELS 8 |
72 | 76 | ||
@@ -83,6 +87,24 @@ | |||
83 | #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 | 87 | #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86 |
84 | #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 | 88 | #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87 |
85 | 89 | ||
90 | /* FUNC interface - command values */ | ||
91 | #define FUNC_RFKILL 0x1000 | ||
92 | #define FUNC_LEDS 0x1001 | ||
93 | #define FUNC_BUTTONS 0x1002 | ||
94 | #define FUNC_BACKLIGHT 0x1004 | ||
95 | |||
96 | /* FUNC interface - responses */ | ||
97 | #define UNSUPPORTED_CMD 0x80000000 | ||
98 | |||
99 | #ifdef CONFIG_LEDS_CLASS | ||
100 | /* FUNC interface - LED control */ | ||
101 | #define FUNC_LED_OFF 0x1 | ||
102 | #define FUNC_LED_ON 0x30001 | ||
103 | #define KEYBOARD_LAMPS 0x100 | ||
104 | #define LOGOLAMP_POWERON 0x2000 | ||
105 | #define LOGOLAMP_ALWAYS 0x4000 | ||
106 | #endif | ||
107 | |||
86 | /* Hotkey details */ | 108 | /* Hotkey details */ |
87 | #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ | 109 | #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ |
88 | #define KEY2_CODE 0x411 | 110 | #define KEY2_CODE 0x411 |
@@ -133,7 +155,6 @@ struct fujitsu_t { | |||
133 | 155 | ||
134 | static struct fujitsu_t *fujitsu; | 156 | static struct fujitsu_t *fujitsu; |
135 | static int use_alt_lcd_levels = -1; | 157 | static int use_alt_lcd_levels = -1; |
136 | static int disable_brightness_keys = -1; | ||
137 | static int disable_brightness_adjust = -1; | 158 | static int disable_brightness_adjust = -1; |
138 | 159 | ||
139 | /* Device used to access other hotkeys on the laptop */ | 160 | /* Device used to access other hotkeys on the laptop */ |
@@ -145,8 +166,9 @@ struct fujitsu_hotkey_t { | |||
145 | struct platform_device *pf_device; | 166 | struct platform_device *pf_device; |
146 | struct kfifo *fifo; | 167 | struct kfifo *fifo; |
147 | spinlock_t fifo_lock; | 168 | spinlock_t fifo_lock; |
148 | 169 | int rfkill_state; | |
149 | unsigned int irb; /* info about the pressed buttons */ | 170 | int logolamp_registered; |
171 | int kblamps_registered; | ||
150 | }; | 172 | }; |
151 | 173 | ||
152 | static struct fujitsu_hotkey_t *fujitsu_hotkey; | 174 | static struct fujitsu_hotkey_t *fujitsu_hotkey; |
@@ -154,12 +176,139 @@ static struct fujitsu_hotkey_t *fujitsu_hotkey; | |||
154 | static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | 176 | static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, |
155 | void *data); | 177 | void *data); |
156 | 178 | ||
179 | #ifdef CONFIG_LEDS_CLASS | ||
180 | static enum led_brightness logolamp_get(struct led_classdev *cdev); | ||
181 | static void logolamp_set(struct led_classdev *cdev, | ||
182 | enum led_brightness brightness); | ||
183 | |||
184 | struct led_classdev logolamp_led = { | ||
185 | .name = "fujitsu::logolamp", | ||
186 | .brightness_get = logolamp_get, | ||
187 | .brightness_set = logolamp_set | ||
188 | }; | ||
189 | |||
190 | static enum led_brightness kblamps_get(struct led_classdev *cdev); | ||
191 | static void kblamps_set(struct led_classdev *cdev, | ||
192 | enum led_brightness brightness); | ||
193 | |||
194 | struct led_classdev kblamps_led = { | ||
195 | .name = "fujitsu::kblamps", | ||
196 | .brightness_get = kblamps_get, | ||
197 | .brightness_set = kblamps_set | ||
198 | }; | ||
199 | #endif | ||
200 | |||
157 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG | 201 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG |
158 | static u32 dbg_level = 0x03; | 202 | static u32 dbg_level = 0x03; |
159 | #endif | 203 | #endif |
160 | 204 | ||
161 | static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); | 205 | static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); |
162 | 206 | ||
207 | /* Fujitsu ACPI interface function */ | ||
208 | |||
209 | static int call_fext_func(int cmd, int arg0, int arg1, int arg2) | ||
210 | { | ||
211 | acpi_status status = AE_OK; | ||
212 | union acpi_object params[4] = { | ||
213 | { .type = ACPI_TYPE_INTEGER }, | ||
214 | { .type = ACPI_TYPE_INTEGER }, | ||
215 | { .type = ACPI_TYPE_INTEGER }, | ||
216 | { .type = ACPI_TYPE_INTEGER } | ||
217 | }; | ||
218 | struct acpi_object_list arg_list = { 4, ¶ms[0] }; | ||
219 | struct acpi_buffer output; | ||
220 | union acpi_object out_obj; | ||
221 | acpi_handle handle = NULL; | ||
222 | |||
223 | status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle); | ||
224 | if (ACPI_FAILURE(status)) { | ||
225 | vdbg_printk(FUJLAPTOP_DBG_ERROR, | ||
226 | "FUNC interface is not present\n"); | ||
227 | return -ENODEV; | ||
228 | } | ||
229 | |||
230 | params[0].integer.value = cmd; | ||
231 | params[1].integer.value = arg0; | ||
232 | params[2].integer.value = arg1; | ||
233 | params[3].integer.value = arg2; | ||
234 | |||
235 | output.length = sizeof(out_obj); | ||
236 | output.pointer = &out_obj; | ||
237 | |||
238 | status = acpi_evaluate_object(handle, NULL, &arg_list, &output); | ||
239 | if (ACPI_FAILURE(status)) { | ||
240 | vdbg_printk(FUJLAPTOP_DBG_WARN, | ||
241 | "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n", | ||
242 | cmd, arg0, arg1, arg2); | ||
243 | return -ENODEV; | ||
244 | } | ||
245 | |||
246 | if (out_obj.type != ACPI_TYPE_INTEGER) { | ||
247 | vdbg_printk(FUJLAPTOP_DBG_WARN, | ||
248 | "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) did not " | ||
249 | "return an integer\n", | ||
250 | cmd, arg0, arg1, arg2); | ||
251 | return -ENODEV; | ||
252 | } | ||
253 | |||
254 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | ||
255 | "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n", | ||
256 | cmd, arg0, arg1, arg2, (int)out_obj.integer.value); | ||
257 | return out_obj.integer.value; | ||
258 | } | ||
259 | |||
260 | #ifdef CONFIG_LEDS_CLASS | ||
261 | /* LED class callbacks */ | ||
262 | |||
263 | static void logolamp_set(struct led_classdev *cdev, | ||
264 | enum led_brightness brightness) | ||
265 | { | ||
266 | if (brightness >= LED_FULL) { | ||
267 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); | ||
268 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON); | ||
269 | } else if (brightness >= LED_HALF) { | ||
270 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON); | ||
271 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF); | ||
272 | } else { | ||
273 | call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | static void kblamps_set(struct led_classdev *cdev, | ||
278 | enum led_brightness brightness) | ||
279 | { | ||
280 | if (brightness >= LED_FULL) | ||
281 | call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON); | ||
282 | else | ||
283 | call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF); | ||
284 | } | ||
285 | |||
286 | static enum led_brightness logolamp_get(struct led_classdev *cdev) | ||
287 | { | ||
288 | enum led_brightness brightness = LED_OFF; | ||
289 | int poweron, always; | ||
290 | |||
291 | poweron = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0); | ||
292 | if (poweron == FUNC_LED_ON) { | ||
293 | brightness = LED_HALF; | ||
294 | always = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0); | ||
295 | if (always == FUNC_LED_ON) | ||
296 | brightness = LED_FULL; | ||
297 | } | ||
298 | return brightness; | ||
299 | } | ||
300 | |||
301 | static enum led_brightness kblamps_get(struct led_classdev *cdev) | ||
302 | { | ||
303 | enum led_brightness brightness = LED_OFF; | ||
304 | |||
305 | if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON) | ||
306 | brightness = LED_FULL; | ||
307 | |||
308 | return brightness; | ||
309 | } | ||
310 | #endif | ||
311 | |||
163 | /* Hardware access for LCD brightness control */ | 312 | /* Hardware access for LCD brightness control */ |
164 | 313 | ||
165 | static int set_lcd_level(int level) | 314 | static int set_lcd_level(int level) |
@@ -263,44 +412,34 @@ static int get_max_brightness(void) | |||
263 | return fujitsu->max_brightness; | 412 | return fujitsu->max_brightness; |
264 | } | 413 | } |
265 | 414 | ||
266 | static int get_lcd_level_alt(void) | ||
267 | { | ||
268 | unsigned long long state = 0; | ||
269 | acpi_status status = AE_OK; | ||
270 | |||
271 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLS\n"); | ||
272 | |||
273 | status = | ||
274 | acpi_evaluate_integer(fujitsu->acpi_handle, "GBLS", NULL, &state); | ||
275 | if (status < 0) | ||
276 | return status; | ||
277 | |||
278 | fujitsu->brightness_level = state & 0x0fffffff; | ||
279 | |||
280 | if (state & 0x80000000) | ||
281 | fujitsu->brightness_changed = 1; | ||
282 | else | ||
283 | fujitsu->brightness_changed = 0; | ||
284 | |||
285 | return fujitsu->brightness_level; | ||
286 | } | ||
287 | |||
288 | /* Backlight device stuff */ | 415 | /* Backlight device stuff */ |
289 | 416 | ||
290 | static int bl_get_brightness(struct backlight_device *b) | 417 | static int bl_get_brightness(struct backlight_device *b) |
291 | { | 418 | { |
292 | if (use_alt_lcd_levels) | 419 | return get_lcd_level(); |
293 | return get_lcd_level_alt(); | ||
294 | else | ||
295 | return get_lcd_level(); | ||
296 | } | 420 | } |
297 | 421 | ||
298 | static int bl_update_status(struct backlight_device *b) | 422 | static int bl_update_status(struct backlight_device *b) |
299 | { | 423 | { |
424 | int ret; | ||
425 | if (b->props.power == 4) | ||
426 | ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3); | ||
427 | else | ||
428 | ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0); | ||
429 | if (ret != 0) | ||
430 | vdbg_printk(FUJLAPTOP_DBG_ERROR, | ||
431 | "Unable to adjust backlight power, error code %i\n", | ||
432 | ret); | ||
433 | |||
300 | if (use_alt_lcd_levels) | 434 | if (use_alt_lcd_levels) |
301 | return set_lcd_level_alt(b->props.brightness); | 435 | ret = set_lcd_level_alt(b->props.brightness); |
302 | else | 436 | else |
303 | return set_lcd_level(b->props.brightness); | 437 | ret = set_lcd_level(b->props.brightness); |
438 | if (ret != 0) | ||
439 | vdbg_printk(FUJLAPTOP_DBG_ERROR, | ||
440 | "Unable to adjust LCD brightness, error code %i\n", | ||
441 | ret); | ||
442 | return ret; | ||
304 | } | 443 | } |
305 | 444 | ||
306 | static struct backlight_ops fujitsubl_ops = { | 445 | static struct backlight_ops fujitsubl_ops = { |
@@ -344,10 +483,7 @@ static ssize_t show_lcd_level(struct device *dev, | |||
344 | 483 | ||
345 | int ret; | 484 | int ret; |
346 | 485 | ||
347 | if (use_alt_lcd_levels) | 486 | ret = get_lcd_level(); |
348 | ret = get_lcd_level_alt(); | ||
349 | else | ||
350 | ret = get_lcd_level(); | ||
351 | if (ret < 0) | 487 | if (ret < 0) |
352 | return ret; | 488 | return ret; |
353 | 489 | ||
@@ -372,52 +508,71 @@ static ssize_t store_lcd_level(struct device *dev, | |||
372 | if (ret < 0) | 508 | if (ret < 0) |
373 | return ret; | 509 | return ret; |
374 | 510 | ||
375 | if (use_alt_lcd_levels) | 511 | ret = get_lcd_level(); |
376 | ret = get_lcd_level_alt(); | ||
377 | else | ||
378 | ret = get_lcd_level(); | ||
379 | if (ret < 0) | 512 | if (ret < 0) |
380 | return ret; | 513 | return ret; |
381 | 514 | ||
382 | return count; | 515 | return count; |
383 | } | 516 | } |
384 | 517 | ||
385 | /* Hardware access for hotkey device */ | 518 | static ssize_t |
386 | 519 | ignore_store(struct device *dev, | |
387 | static int get_irb(void) | 520 | struct device_attribute *attr, const char *buf, size_t count) |
388 | { | 521 | { |
389 | unsigned long long state = 0; | 522 | return count; |
390 | acpi_status status = AE_OK; | 523 | } |
391 | |||
392 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "Get irb\n"); | ||
393 | |||
394 | status = | ||
395 | acpi_evaluate_integer(fujitsu_hotkey->acpi_handle, "GIRB", NULL, | ||
396 | &state); | ||
397 | if (status < 0) | ||
398 | return status; | ||
399 | 524 | ||
400 | fujitsu_hotkey->irb = state; | 525 | static ssize_t |
526 | show_lid_state(struct device *dev, | ||
527 | struct device_attribute *attr, char *buf) | ||
528 | { | ||
529 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) | ||
530 | return sprintf(buf, "unknown\n"); | ||
531 | if (fujitsu_hotkey->rfkill_state & 0x100) | ||
532 | return sprintf(buf, "open\n"); | ||
533 | else | ||
534 | return sprintf(buf, "closed\n"); | ||
535 | } | ||
401 | 536 | ||
402 | return fujitsu_hotkey->irb; | 537 | static ssize_t |
538 | show_dock_state(struct device *dev, | ||
539 | struct device_attribute *attr, char *buf) | ||
540 | { | ||
541 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) | ||
542 | return sprintf(buf, "unknown\n"); | ||
543 | if (fujitsu_hotkey->rfkill_state & 0x200) | ||
544 | return sprintf(buf, "docked\n"); | ||
545 | else | ||
546 | return sprintf(buf, "undocked\n"); | ||
403 | } | 547 | } |
404 | 548 | ||
405 | static ssize_t | 549 | static ssize_t |
406 | ignore_store(struct device *dev, | 550 | show_radios_state(struct device *dev, |
407 | struct device_attribute *attr, const char *buf, size_t count) | 551 | struct device_attribute *attr, char *buf) |
408 | { | 552 | { |
409 | return count; | 553 | if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD) |
554 | return sprintf(buf, "unknown\n"); | ||
555 | if (fujitsu_hotkey->rfkill_state & 0x20) | ||
556 | return sprintf(buf, "on\n"); | ||
557 | else | ||
558 | return sprintf(buf, "killed\n"); | ||
410 | } | 559 | } |
411 | 560 | ||
412 | static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store); | 561 | static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store); |
413 | static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed, | 562 | static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed, |
414 | ignore_store); | 563 | ignore_store); |
415 | static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); | 564 | static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); |
565 | static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store); | ||
566 | static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store); | ||
567 | static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store); | ||
416 | 568 | ||
417 | static struct attribute *fujitsupf_attributes[] = { | 569 | static struct attribute *fujitsupf_attributes[] = { |
418 | &dev_attr_brightness_changed.attr, | 570 | &dev_attr_brightness_changed.attr, |
419 | &dev_attr_max_brightness.attr, | 571 | &dev_attr_max_brightness.attr, |
420 | &dev_attr_lcd_level.attr, | 572 | &dev_attr_lcd_level.attr, |
573 | &dev_attr_lid.attr, | ||
574 | &dev_attr_dock.attr, | ||
575 | &dev_attr_radios.attr, | ||
421 | NULL | 576 | NULL |
422 | }; | 577 | }; |
423 | 578 | ||
@@ -435,24 +590,16 @@ static struct platform_driver fujitsupf_driver = { | |||
435 | static void dmi_check_cb_common(const struct dmi_system_id *id) | 590 | static void dmi_check_cb_common(const struct dmi_system_id *id) |
436 | { | 591 | { |
437 | acpi_handle handle; | 592 | acpi_handle handle; |
438 | int have_blnf; | ||
439 | printk(KERN_INFO "fujitsu-laptop: Identified laptop model '%s'.\n", | 593 | printk(KERN_INFO "fujitsu-laptop: Identified laptop model '%s'.\n", |
440 | id->ident); | 594 | id->ident); |
441 | have_blnf = ACPI_SUCCESS | ||
442 | (acpi_get_handle(NULL, "\\_SB.PCI0.GFX0.LCD.BLNF", &handle)); | ||
443 | if (use_alt_lcd_levels == -1) { | 595 | if (use_alt_lcd_levels == -1) { |
444 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detecting usealt\n"); | 596 | if (ACPI_SUCCESS(acpi_get_handle(NULL, |
445 | use_alt_lcd_levels = 1; | 597 | "\\_SB.PCI0.LPCB.FJEX.SBL2", &handle))) |
446 | } | 598 | use_alt_lcd_levels = 1; |
447 | if (disable_brightness_keys == -1) { | 599 | else |
448 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 600 | use_alt_lcd_levels = 0; |
449 | "auto-detecting disable_keys\n"); | 601 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as " |
450 | disable_brightness_keys = have_blnf ? 1 : 0; | 602 | "%i\n", use_alt_lcd_levels); |
451 | } | ||
452 | if (disable_brightness_adjust == -1) { | ||
453 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | ||
454 | "auto-detecting disable_adjust\n"); | ||
455 | disable_brightness_adjust = have_blnf ? 0 : 1; | ||
456 | } | 603 | } |
457 | } | 604 | } |
458 | 605 | ||
@@ -581,19 +728,14 @@ static int acpi_fujitsu_add(struct acpi_device *device) | |||
581 | 728 | ||
582 | /* do config (detect defaults) */ | 729 | /* do config (detect defaults) */ |
583 | use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0; | 730 | use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0; |
584 | disable_brightness_keys = disable_brightness_keys == 1 ? 1 : 0; | ||
585 | disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; | 731 | disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; |
586 | vdbg_printk(FUJLAPTOP_DBG_INFO, | 732 | vdbg_printk(FUJLAPTOP_DBG_INFO, |
587 | "config: [alt interface: %d], [key disable: %d], [adjust disable: %d]\n", | 733 | "config: [alt interface: %d], [adjust disable: %d]\n", |
588 | use_alt_lcd_levels, disable_brightness_keys, | 734 | use_alt_lcd_levels, disable_brightness_adjust); |
589 | disable_brightness_adjust); | ||
590 | 735 | ||
591 | if (get_max_brightness() <= 0) | 736 | if (get_max_brightness() <= 0) |
592 | fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS; | 737 | fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS; |
593 | if (use_alt_lcd_levels) | 738 | get_lcd_level(); |
594 | get_lcd_level_alt(); | ||
595 | else | ||
596 | get_lcd_level(); | ||
597 | 739 | ||
598 | return result; | 740 | return result; |
599 | 741 | ||
@@ -644,43 +786,23 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) | |||
644 | case ACPI_FUJITSU_NOTIFY_CODE1: | 786 | case ACPI_FUJITSU_NOTIFY_CODE1: |
645 | keycode = 0; | 787 | keycode = 0; |
646 | oldb = fujitsu->brightness_level; | 788 | oldb = fujitsu->brightness_level; |
647 | get_lcd_level(); /* the alt version always yields changed */ | 789 | get_lcd_level(); |
648 | newb = fujitsu->brightness_level; | 790 | newb = fujitsu->brightness_level; |
649 | 791 | ||
650 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 792 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
651 | "brightness button event [%i -> %i (%i)]\n", | 793 | "brightness button event [%i -> %i (%i)]\n", |
652 | oldb, newb, fujitsu->brightness_changed); | 794 | oldb, newb, fujitsu->brightness_changed); |
653 | 795 | ||
654 | if (oldb == newb && fujitsu->brightness_changed) { | 796 | if (oldb < newb) { |
655 | keycode = 0; | ||
656 | if (disable_brightness_keys != 1) { | ||
657 | if (oldb == 0) { | ||
658 | acpi_bus_generate_proc_event | ||
659 | (fujitsu->dev, | ||
660 | ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, | ||
661 | 0); | ||
662 | keycode = KEY_BRIGHTNESSDOWN; | ||
663 | } else if (oldb == | ||
664 | (fujitsu->max_brightness) - 1) { | ||
665 | acpi_bus_generate_proc_event | ||
666 | (fujitsu->dev, | ||
667 | ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, | ||
668 | 0); | ||
669 | keycode = KEY_BRIGHTNESSUP; | ||
670 | } | ||
671 | } | ||
672 | } else if (oldb < newb) { | ||
673 | if (disable_brightness_adjust != 1) { | 797 | if (disable_brightness_adjust != 1) { |
674 | if (use_alt_lcd_levels) | 798 | if (use_alt_lcd_levels) |
675 | set_lcd_level_alt(newb); | 799 | set_lcd_level_alt(newb); |
676 | else | 800 | else |
677 | set_lcd_level(newb); | 801 | set_lcd_level(newb); |
678 | } | 802 | } |
679 | if (disable_brightness_keys != 1) { | 803 | acpi_bus_generate_proc_event(fujitsu->dev, |
680 | acpi_bus_generate_proc_event(fujitsu->dev, | 804 | ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, 0); |
681 | ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS, 0); | 805 | keycode = KEY_BRIGHTNESSUP; |
682 | keycode = KEY_BRIGHTNESSUP; | ||
683 | } | ||
684 | } else if (oldb > newb) { | 806 | } else if (oldb > newb) { |
685 | if (disable_brightness_adjust != 1) { | 807 | if (disable_brightness_adjust != 1) { |
686 | if (use_alt_lcd_levels) | 808 | if (use_alt_lcd_levels) |
@@ -688,13 +810,9 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) | |||
688 | else | 810 | else |
689 | set_lcd_level(newb); | 811 | set_lcd_level(newb); |
690 | } | 812 | } |
691 | if (disable_brightness_keys != 1) { | 813 | acpi_bus_generate_proc_event(fujitsu->dev, |
692 | acpi_bus_generate_proc_event(fujitsu->dev, | 814 | ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, 0); |
693 | ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS, 0); | 815 | keycode = KEY_BRIGHTNESSDOWN; |
694 | keycode = KEY_BRIGHTNESSDOWN; | ||
695 | } | ||
696 | } else { | ||
697 | keycode = KEY_UNKNOWN; | ||
698 | } | 816 | } |
699 | break; | 817 | break; |
700 | default: | 818 | default: |
@@ -771,7 +889,8 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
771 | input->id.bustype = BUS_HOST; | 889 | input->id.bustype = BUS_HOST; |
772 | input->id.product = 0x06; | 890 | input->id.product = 0x06; |
773 | input->dev.parent = &device->dev; | 891 | input->dev.parent = &device->dev; |
774 | input->evbit[0] = BIT(EV_KEY); | 892 | |
893 | set_bit(EV_KEY, input->evbit); | ||
775 | set_bit(fujitsu->keycode1, input->keybit); | 894 | set_bit(fujitsu->keycode1, input->keybit); |
776 | set_bit(fujitsu->keycode2, input->keybit); | 895 | set_bit(fujitsu->keycode2, input->keybit); |
777 | set_bit(fujitsu->keycode3, input->keybit); | 896 | set_bit(fujitsu->keycode3, input->keybit); |
@@ -803,10 +922,44 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
803 | printk(KERN_ERR "_INI Method failed\n"); | 922 | printk(KERN_ERR "_INI Method failed\n"); |
804 | } | 923 | } |
805 | 924 | ||
806 | i = 0; /* Discard hotkey ringbuffer */ | 925 | i = 0; |
807 | while (get_irb() != 0 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) ; | 926 | while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 |
927 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) | ||
928 | ; /* No action, result is discarded */ | ||
808 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); | 929 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); |
809 | 930 | ||
931 | fujitsu_hotkey->rfkill_state = | ||
932 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | ||
933 | |||
934 | /* Suspect this is a keymap of the application panel, print it */ | ||
935 | printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", | ||
936 | call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0)); | ||
937 | |||
938 | #ifdef CONFIG_LEDS_CLASS | ||
939 | if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { | ||
940 | result = led_classdev_register(&fujitsu->pf_device->dev, | ||
941 | &logolamp_led); | ||
942 | if (result == 0) { | ||
943 | fujitsu_hotkey->logolamp_registered = 1; | ||
944 | } else { | ||
945 | printk(KERN_ERR "fujitsu-laptop: Could not register " | ||
946 | "LED handler for logo lamp, error %i\n", result); | ||
947 | } | ||
948 | } | ||
949 | |||
950 | if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) && | ||
951 | (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) { | ||
952 | result = led_classdev_register(&fujitsu->pf_device->dev, | ||
953 | &kblamps_led); | ||
954 | if (result == 0) { | ||
955 | fujitsu_hotkey->kblamps_registered = 1; | ||
956 | } else { | ||
957 | printk(KERN_ERR "fujitsu-laptop: Could not register " | ||
958 | "LED handler for keyboard lamps, error %i\n", result); | ||
959 | } | ||
960 | } | ||
961 | #endif | ||
962 | |||
810 | return result; | 963 | return result; |
811 | 964 | ||
812 | end: | 965 | end: |
@@ -852,16 +1005,15 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, | |||
852 | 1005 | ||
853 | input = fujitsu_hotkey->input; | 1006 | input = fujitsu_hotkey->input; |
854 | 1007 | ||
855 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "Hotkey event\n"); | 1008 | fujitsu_hotkey->rfkill_state = |
1009 | call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0); | ||
856 | 1010 | ||
857 | switch (event) { | 1011 | switch (event) { |
858 | case ACPI_FUJITSU_NOTIFY_CODE1: | 1012 | case ACPI_FUJITSU_NOTIFY_CODE1: |
859 | i = 0; | 1013 | i = 0; |
860 | while ((irb = get_irb()) != 0 | 1014 | while ((irb = |
861 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) { | 1015 | call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0 |
862 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "GIRB result [%x]\n", | 1016 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) { |
863 | irb); | ||
864 | |||
865 | switch (irb & 0x4ff) { | 1017 | switch (irb & 0x4ff) { |
866 | case KEY1_CODE: | 1018 | case KEY1_CODE: |
867 | keycode = fujitsu->keycode1; | 1019 | keycode = fujitsu->keycode1; |
@@ -1035,6 +1187,15 @@ static int __init fujitsu_init(void) | |||
1035 | goto fail_hotkey1; | 1187 | goto fail_hotkey1; |
1036 | } | 1188 | } |
1037 | 1189 | ||
1190 | /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */ | ||
1191 | |||
1192 | if (!acpi_video_backlight_support()) { | ||
1193 | if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3) | ||
1194 | fujitsu->bl_device->props.power = 4; | ||
1195 | else | ||
1196 | fujitsu->bl_device->props.power = 0; | ||
1197 | } | ||
1198 | |||
1038 | printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION | 1199 | printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION |
1039 | " successfully loaded.\n"); | 1200 | " successfully loaded.\n"); |
1040 | 1201 | ||
@@ -1074,6 +1235,14 @@ fail_acpi: | |||
1074 | 1235 | ||
1075 | static void __exit fujitsu_cleanup(void) | 1236 | static void __exit fujitsu_cleanup(void) |
1076 | { | 1237 | { |
1238 | #ifdef CONFIG_LEDS_CLASS | ||
1239 | if (fujitsu_hotkey->logolamp_registered != 0) | ||
1240 | led_classdev_unregister(&logolamp_led); | ||
1241 | |||
1242 | if (fujitsu_hotkey->kblamps_registered != 0) | ||
1243 | led_classdev_unregister(&kblamps_led); | ||
1244 | #endif | ||
1245 | |||
1077 | sysfs_remove_group(&fujitsu->pf_device->dev.kobj, | 1246 | sysfs_remove_group(&fujitsu->pf_device->dev.kobj, |
1078 | &fujitsupf_attribute_group); | 1247 | &fujitsupf_attribute_group); |
1079 | platform_device_unregister(fujitsu->pf_device); | 1248 | platform_device_unregister(fujitsu->pf_device); |
@@ -1098,9 +1267,6 @@ module_exit(fujitsu_cleanup); | |||
1098 | module_param(use_alt_lcd_levels, uint, 0644); | 1267 | module_param(use_alt_lcd_levels, uint, 0644); |
1099 | MODULE_PARM_DESC(use_alt_lcd_levels, | 1268 | MODULE_PARM_DESC(use_alt_lcd_levels, |
1100 | "Use alternative interface for lcd_levels (needed for Lifebook s6410)."); | 1269 | "Use alternative interface for lcd_levels (needed for Lifebook s6410)."); |
1101 | module_param(disable_brightness_keys, uint, 0644); | ||
1102 | MODULE_PARM_DESC(disable_brightness_keys, | ||
1103 | "Disable brightness keys (eg. if they are already handled by the generic ACPI_VIDEO device)."); | ||
1104 | module_param(disable_brightness_adjust, uint, 0644); | 1270 | module_param(disable_brightness_adjust, uint, 0644); |
1105 | MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); | 1271 | MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); |
1106 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG | 1272 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG |
@@ -1108,12 +1274,13 @@ module_param_named(debug, dbg_level, uint, 0644); | |||
1108 | MODULE_PARM_DESC(debug, "Sets debug level bit-mask"); | 1274 | MODULE_PARM_DESC(debug, "Sets debug level bit-mask"); |
1109 | #endif | 1275 | #endif |
1110 | 1276 | ||
1111 | MODULE_AUTHOR("Jonathan Woithe, Peter Gruber"); | 1277 | MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon"); |
1112 | MODULE_DESCRIPTION("Fujitsu laptop extras support"); | 1278 | MODULE_DESCRIPTION("Fujitsu laptop extras support"); |
1113 | MODULE_VERSION(FUJITSU_DRIVER_VERSION); | 1279 | MODULE_VERSION(FUJITSU_DRIVER_VERSION); |
1114 | MODULE_LICENSE("GPL"); | 1280 | MODULE_LICENSE("GPL"); |
1115 | 1281 | ||
1116 | MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*"); | 1282 | MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*"); |
1283 | MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*"); | ||
1117 | MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*"); | 1284 | MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*"); |
1118 | 1285 | ||
1119 | static struct pnp_device_id pnp_ids[] = { | 1286 | static struct pnp_device_id pnp_ids[] = { |
diff --git a/drivers/misc/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 4b7c24c519c3..4b7c24c519c3 100644 --- a/drivers/misc/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
diff --git a/drivers/misc/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index 27b7662955bb..27b7662955bb 100644 --- a/drivers/misc/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c | |||
diff --git a/drivers/misc/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 759763d18e4c..759763d18e4c 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
diff --git a/drivers/misc/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index 4a1bc64485d5..f30db367c82e 100644 --- a/drivers/misc/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -241,8 +241,6 @@ static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val) | |||
241 | }; | 241 | }; |
242 | acpi_status status = AE_OK; | 242 | acpi_status status = AE_OK; |
243 | 243 | ||
244 | ACPI_FUNCTION_TRACE("acpi_pcc_write_sset"); | ||
245 | |||
246 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, | 244 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, |
247 | ¶ms, NULL); | 245 | ¶ms, NULL); |
248 | 246 | ||
@@ -254,8 +252,6 @@ static inline int acpi_pcc_get_sqty(struct acpi_device *device) | |||
254 | unsigned long long s; | 252 | unsigned long long s; |
255 | acpi_status status; | 253 | acpi_status status; |
256 | 254 | ||
257 | ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty"); | ||
258 | |||
259 | status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, | 255 | status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, |
260 | NULL, &s); | 256 | NULL, &s); |
261 | if (ACPI_SUCCESS(status)) | 257 | if (ACPI_SUCCESS(status)) |
@@ -274,8 +270,6 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc, u32 *sinf) | |||
274 | union acpi_object *hkey = NULL; | 270 | union acpi_object *hkey = NULL; |
275 | int i; | 271 | int i; |
276 | 272 | ||
277 | ACPI_FUNCTION_TRACE("acpi_pcc_retrieve_biosdata"); | ||
278 | |||
279 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0, | 273 | status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, 0, |
280 | &buffer); | 274 | &buffer); |
281 | if (ACPI_FAILURE(status)) { | 275 | if (ACPI_FAILURE(status)) { |
@@ -501,8 +495,6 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) | |||
501 | int key_code, hkey_num; | 495 | int key_code, hkey_num; |
502 | unsigned long long result; | 496 | unsigned long long result; |
503 | 497 | ||
504 | ACPI_FUNCTION_TRACE("acpi_pcc_generate_keyinput"); | ||
505 | |||
506 | rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY, | 498 | rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY, |
507 | NULL, &result); | 499 | NULL, &result); |
508 | if (!ACPI_SUCCESS(rc)) { | 500 | if (!ACPI_SUCCESS(rc)) { |
@@ -538,8 +530,6 @@ static void acpi_pcc_hotkey_notify(acpi_handle handle, u32 event, void *data) | |||
538 | { | 530 | { |
539 | struct pcc_acpi *pcc = (struct pcc_acpi *) data; | 531 | struct pcc_acpi *pcc = (struct pcc_acpi *) data; |
540 | 532 | ||
541 | ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_notify"); | ||
542 | |||
543 | switch (event) { | 533 | switch (event) { |
544 | case HKEY_NOTIFY: | 534 | case HKEY_NOTIFY: |
545 | acpi_pcc_generate_keyinput(pcc); | 535 | acpi_pcc_generate_keyinput(pcc); |
@@ -554,8 +544,6 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc) | |||
554 | { | 544 | { |
555 | int i, rc; | 545 | int i, rc; |
556 | 546 | ||
557 | ACPI_FUNCTION_TRACE("acpi_pcc_init_input"); | ||
558 | |||
559 | pcc->input_dev = input_allocate_device(); | 547 | pcc->input_dev = input_allocate_device(); |
560 | if (!pcc->input_dev) { | 548 | if (!pcc->input_dev) { |
561 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 549 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -597,8 +585,6 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
597 | struct pcc_acpi *pcc = acpi_driver_data(device); | 585 | struct pcc_acpi *pcc = acpi_driver_data(device); |
598 | acpi_status status = AE_OK; | 586 | acpi_status status = AE_OK; |
599 | 587 | ||
600 | ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_resume"); | ||
601 | |||
602 | if (device == NULL || pcc == NULL) | 588 | if (device == NULL || pcc == NULL) |
603 | return -EINVAL; | 589 | return -EINVAL; |
604 | 590 | ||
@@ -616,8 +602,6 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
616 | struct pcc_acpi *pcc; | 602 | struct pcc_acpi *pcc; |
617 | int num_sifr, result; | 603 | int num_sifr, result; |
618 | 604 | ||
619 | ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_add"); | ||
620 | |||
621 | if (!device) | 605 | if (!device) |
622 | return -EINVAL; | 606 | return -EINVAL; |
623 | 607 | ||
@@ -714,8 +698,6 @@ static int __init acpi_pcc_init(void) | |||
714 | { | 698 | { |
715 | int result = 0; | 699 | int result = 0; |
716 | 700 | ||
717 | ACPI_FUNCTION_TRACE("acpi_pcc_init"); | ||
718 | |||
719 | if (acpi_disabled) | 701 | if (acpi_disabled) |
720 | return -ENODEV; | 702 | return -ENODEV; |
721 | 703 | ||
@@ -733,8 +715,6 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) | |||
733 | { | 715 | { |
734 | struct pcc_acpi *pcc = acpi_driver_data(device); | 716 | struct pcc_acpi *pcc = acpi_driver_data(device); |
735 | 717 | ||
736 | ACPI_FUNCTION_TRACE("acpi_pcc_hotkey_remove"); | ||
737 | |||
738 | if (!device || !pcc) | 718 | if (!device || !pcc) |
739 | return -EINVAL; | 719 | return -EINVAL; |
740 | 720 | ||
@@ -757,8 +737,6 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type) | |||
757 | 737 | ||
758 | static void __exit acpi_pcc_exit(void) | 738 | static void __exit acpi_pcc_exit(void) |
759 | { | 739 | { |
760 | ACPI_FUNCTION_TRACE("acpi_pcc_exit"); | ||
761 | |||
762 | acpi_bus_unregister_driver(&acpi_pcc_driver); | 740 | acpi_bus_unregister_driver(&acpi_pcc_driver); |
763 | } | 741 | } |
764 | 742 | ||
diff --git a/drivers/misc/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 571b211608d1..537959d07148 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -935,14 +935,17 @@ static void sony_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
935 | static acpi_status sony_walk_callback(acpi_handle handle, u32 level, | 935 | static acpi_status sony_walk_callback(acpi_handle handle, u32 level, |
936 | void *context, void **return_value) | 936 | void *context, void **return_value) |
937 | { | 937 | { |
938 | struct acpi_namespace_node *node; | 938 | struct acpi_device_info *info; |
939 | union acpi_operand_object *operand; | 939 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
940 | 940 | ||
941 | node = (struct acpi_namespace_node *)handle; | 941 | if (ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) { |
942 | operand = (union acpi_operand_object *)node->object; | 942 | info = buffer.pointer; |
943 | 943 | ||
944 | printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", node->name.ascii, | 944 | printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", |
945 | (u32) operand->method.param_count); | 945 | (char *)&info->name, info->param_count); |
946 | |||
947 | kfree(buffer.pointer); | ||
948 | } | ||
946 | 949 | ||
947 | return AE_OK; | 950 | return AE_OK; |
948 | } | 951 | } |
diff --git a/drivers/misc/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c index f25e4c974dcf..b4a4aa9ee482 100644 --- a/drivers/misc/tc1100-wmi.c +++ b/drivers/platform/x86/tc1100-wmi.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <acpi/acpi.h> | 32 | #include <acpi/acpi.h> |
33 | #include <acpi/actypes.h> | ||
34 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
35 | #include <acpi/acpi_drivers.h> | 34 | #include <acpi/acpi_drivers.h> |
36 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 899766e16fa8..3478453eba7a 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -76,7 +76,6 @@ | |||
76 | #include <linux/workqueue.h> | 76 | #include <linux/workqueue.h> |
77 | 77 | ||
78 | #include <acpi/acpi_drivers.h> | 78 | #include <acpi/acpi_drivers.h> |
79 | #include <acpi/acnamesp.h> | ||
80 | 79 | ||
81 | #include <linux/pci_ids.h> | 80 | #include <linux/pci_ids.h> |
82 | 81 | ||
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 40e60fc2e596..40e60fc2e596 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
diff --git a/drivers/acpi/wmi.c b/drivers/platform/x86/wmi.c index 8a8b377712c9..8a8b377712c9 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 383e47c392a4..2834846a185d 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/pnp.h> | 23 | #include <linux/pnp.h> |
24 | #include <linux/mod_devicetable.h> | 24 | #include <linux/mod_devicetable.h> |
25 | #include <acpi/acpi_bus.h> | 25 | #include <acpi/acpi_bus.h> |
26 | #include <acpi/actypes.h> | ||
27 | 26 | ||
28 | #include "../base.h" | 27 | #include "../base.h" |
29 | #include "pnpacpi.h" | 28 | #include "pnpacpi.h" |