Merge master.kernel.org:/home/rmk/linux-2.6-mmc
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 8 Sep 2005 22:28:16 +0000 (15:28 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 8 Sep 2005 22:28:16 +0000 (15:28 -0700)
292 files changed:
Documentation/acpi-hotkey.txt
Documentation/ibm-acpi.txt
arch/arm/common/locomo.c
arch/arm/configs/s3c2410_defconfig
arch/arm/mach-omap1/Kconfig
arch/arm/mach-omap1/Makefile
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-netstar.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/devices.c [new file with mode: 0644]
arch/arm/mach-omap1/fpga.c
arch/arm/mach-omap1/io.c
arch/arm/mach-omap1/irq.c
arch/arm/mach-omap1/leds-h2p2-debug.c
arch/arm/mach-omap1/leds-innovator.c
arch/arm/mach-omap1/leds-osk.c
arch/arm/mach-omap1/leds.c
arch/arm/mach-omap1/serial.c
arch/arm/mach-omap1/time.c
arch/arm/mm/flush.c
arch/i386/Kconfig
arch/i386/defconfig
arch/i386/kernel/Makefile
arch/i386/kernel/acpi/Makefile
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/acpi/earlyquirk.c
arch/i386/kernel/acpi/sleep.c
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/io_apic.c
arch/i386/kernel/mpparse.c
arch/i386/kernel/setup.c
arch/i386/mach-es7000/es7000plat.c
arch/i386/pci/Makefile
arch/i386/pci/irq.c
arch/ia64/Kconfig
arch/ia64/configs/bigsur_defconfig
arch/ia64/configs/sn2_defconfig
arch/ia64/configs/tiger_defconfig
arch/ia64/configs/zx1_defconfig
arch/ia64/defconfig
arch/ia64/kernel/acpi-ext.c
arch/ia64/kernel/acpi.c
arch/ia64/kernel/iosapic.c
arch/ia64/kernel/setup.c
arch/ia64/kernel/topology.c
arch/ia64/sn/kernel/irq.c
arch/ia64/sn/kernel/sn2/sn_proc_fs.c
arch/ppc/kernel/head_4xx.S
arch/x86_64/Kconfig
arch/x86_64/defconfig
arch/x86_64/kernel/Makefile
arch/x86_64/kernel/acpi/Makefile
arch/x86_64/kernel/acpi/sleep.c
arch/x86_64/kernel/genapic.c
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/mpparse.c
arch/x86_64/kernel/setup.c
arch/x86_64/pci/Makefile
arch/x86_64/pci/Makefile-BUS
drivers/Makefile
drivers/acpi/Kconfig
drivers/acpi/Makefile
drivers/acpi/ac.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/asus_acpi.c
drivers/acpi/battery.c
drivers/acpi/blacklist.c
drivers/acpi/bus.c
drivers/acpi/button.c
drivers/acpi/container.c
drivers/acpi/debug.c
drivers/acpi/dispatcher/dsfield.c
drivers/acpi/dispatcher/dsinit.c
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/dispatcher/dsmthdat.c
drivers/acpi/dispatcher/dsobject.c
drivers/acpi/dispatcher/dsopcode.c
drivers/acpi/dispatcher/dsutils.c
drivers/acpi/dispatcher/dswexec.c
drivers/acpi/dispatcher/dswload.c
drivers/acpi/dispatcher/dswscope.c
drivers/acpi/dispatcher/dswstate.c
drivers/acpi/ec.c
drivers/acpi/event.c
drivers/acpi/events/evevent.c
drivers/acpi/events/evgpe.c
drivers/acpi/events/evgpeblk.c
drivers/acpi/events/evmisc.c
drivers/acpi/events/evregion.c
drivers/acpi/events/evrgnini.c
drivers/acpi/events/evsci.c
drivers/acpi/events/evxface.c
drivers/acpi/events/evxfevnt.c
drivers/acpi/events/evxfregn.c
drivers/acpi/executer/exconfig.c
drivers/acpi/executer/exconvrt.c
drivers/acpi/executer/excreate.c
drivers/acpi/executer/exdump.c
drivers/acpi/executer/exfield.c
drivers/acpi/executer/exfldio.c
drivers/acpi/executer/exmisc.c
drivers/acpi/executer/exmutex.c
drivers/acpi/executer/exnames.c
drivers/acpi/executer/exoparg1.c
drivers/acpi/executer/exoparg2.c
drivers/acpi/executer/exoparg3.c
drivers/acpi/executer/exoparg6.c
drivers/acpi/executer/exprep.c
drivers/acpi/executer/exregion.c
drivers/acpi/executer/exresnte.c
drivers/acpi/executer/exresolv.c
drivers/acpi/executer/exresop.c
drivers/acpi/executer/exstore.c
drivers/acpi/executer/exstoren.c
drivers/acpi/executer/exstorob.c
drivers/acpi/executer/exsystem.c
drivers/acpi/executer/exutils.c
drivers/acpi/fan.c
drivers/acpi/glue.c
drivers/acpi/hardware/hwacpi.c
drivers/acpi/hardware/hwgpe.c
drivers/acpi/hardware/hwregs.c
drivers/acpi/hardware/hwsleep.c
drivers/acpi/hardware/hwtimer.c
drivers/acpi/hotkey.c
drivers/acpi/ibm_acpi.c
drivers/acpi/motherboard.c
drivers/acpi/namespace/nsaccess.c
drivers/acpi/namespace/nsalloc.c
drivers/acpi/namespace/nsdump.c
drivers/acpi/namespace/nsdumpdv.c
drivers/acpi/namespace/nseval.c
drivers/acpi/namespace/nsinit.c
drivers/acpi/namespace/nsload.c
drivers/acpi/namespace/nsnames.c
drivers/acpi/namespace/nsobject.c
drivers/acpi/namespace/nsparse.c
drivers/acpi/namespace/nssearch.c
drivers/acpi/namespace/nsutils.c
drivers/acpi/namespace/nswalk.c
drivers/acpi/namespace/nsxfeval.c
drivers/acpi/namespace/nsxfname.c
drivers/acpi/namespace/nsxfobj.c
drivers/acpi/numa.c
drivers/acpi/osl.c
drivers/acpi/parser/Makefile
drivers/acpi/parser/psargs.c
drivers/acpi/parser/psloop.c [new file with mode: 0644]
drivers/acpi/parser/psopcode.c
drivers/acpi/parser/psparse.c
drivers/acpi/parser/psscope.c
drivers/acpi/parser/pstree.c
drivers/acpi/parser/psutils.c
drivers/acpi/parser/pswalk.c
drivers/acpi/parser/psxface.c
drivers/acpi/pci_bind.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/power.c
drivers/acpi/processor_core.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/processor_throttling.c
drivers/acpi/resources/rsaddr.c
drivers/acpi/resources/rscalc.c
drivers/acpi/resources/rscreate.c
drivers/acpi/resources/rsdump.c
drivers/acpi/resources/rsio.c
drivers/acpi/resources/rsirq.c
drivers/acpi/resources/rslist.c
drivers/acpi/resources/rsmemory.c
drivers/acpi/resources/rsmisc.c
drivers/acpi/resources/rsutils.c
drivers/acpi/resources/rsxface.c
drivers/acpi/scan.c
drivers/acpi/sleep/poweroff.c
drivers/acpi/sleep/proc.c
drivers/acpi/sleep/wakeup.c
drivers/acpi/system.c
drivers/acpi/tables.c
drivers/acpi/tables/tbconvrt.c
drivers/acpi/tables/tbget.c
drivers/acpi/tables/tbgetall.c
drivers/acpi/tables/tbinstal.c
drivers/acpi/tables/tbrsdt.c
drivers/acpi/tables/tbutils.c
drivers/acpi/tables/tbxface.c
drivers/acpi/tables/tbxfroot.c
drivers/acpi/thermal.c
drivers/acpi/toshiba_acpi.c
drivers/acpi/utilities/Makefile
drivers/acpi/utilities/utalloc.c
drivers/acpi/utilities/utcache.c [new file with mode: 0644]
drivers/acpi/utilities/utcopy.c
drivers/acpi/utilities/utdebug.c
drivers/acpi/utilities/utdelete.c
drivers/acpi/utilities/uteval.c
drivers/acpi/utilities/utglobal.c
drivers/acpi/utilities/utinit.c
drivers/acpi/utilities/utmath.c
drivers/acpi/utilities/utmisc.c
drivers/acpi/utilities/utmutex.c [new file with mode: 0644]
drivers/acpi/utilities/utobject.c
drivers/acpi/utilities/utstate.c [new file with mode: 0644]
drivers/acpi/utilities/utxface.c
drivers/acpi/utils.c
drivers/acpi/video.c
drivers/char/hpet.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/tpm/Kconfig
drivers/pci/hotplug/Kconfig
drivers/pci/hotplug/Makefile
drivers/pnp/Kconfig
drivers/pnp/pnpacpi/Kconfig
drivers/pnp/pnpacpi/rsparser.c
drivers/scsi/ata_piix.c
drivers/scsi/sata_sis.c
drivers/serial/8250_acpi.c
drivers/serial/Kconfig
fs/xfs/Kconfig
fs/xfs/Makefile-linux-2.6
fs/xfs/quota/Makefile-linux-2.6
fs/xfs/xfs_arch.h
fs/xfs/xfs_bmap_btree.c
fs/xfs/xfs_bmap_btree.h
fs/xfs/xfs_dir_leaf.h
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_log_priv.h
include/acpi/acconfig.h
include/acpi/acdebug.h
include/acpi/acdisasm.h
include/acpi/acdispat.h
include/acpi/acevents.h
include/acpi/acexcep.h
include/acpi/acglobal.h
include/acpi/achware.h
include/acpi/acinterp.h
include/acpi/aclocal.h
include/acpi/acmacros.h
include/acpi/acnames.h
include/acpi/acnamesp.h
include/acpi/acobject.h
include/acpi/acopcode.h
include/acpi/acoutput.h
include/acpi/acparser.h
include/acpi/acpi.h
include/acpi/acpi_bus.h
include/acpi/acpi_drivers.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acresrc.h
include/acpi/acstruct.h
include/acpi/actables.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actbl71.h
include/acpi/actypes.h
include/acpi/acutils.h
include/acpi/amlcode.h
include/acpi/amlresrc.h
include/acpi/container.h
include/acpi/pdc_intel.h
include/acpi/platform/acenv.h
include/acpi/platform/acgcc.h
include/acpi/platform/aclinux.h
include/acpi/processor.h
include/asm-arm/arch-pxa/hardware.h
include/asm-arm/arch-sa1100/hardware.h
include/asm-arm/cacheflush.h
include/asm-i386/acpi.h
include/asm-i386/fixmap.h
include/asm-i386/io_apic.h
include/asm-i386/mpspec.h
include/asm-ia64/acpi-ext.h
include/asm-x86_64/acpi.h
include/asm-x86_64/io_apic.h
include/asm-x86_64/mpspec.h
include/linux/acpi.h
include/linux/serial_core.h
include/net/compat.h
kernel/power/Kconfig
net/compat.c
net/ieee80211/Kconfig
net/socket.c

index 0acdc80c30c2fab156a02238e6146afd6496425f..744f1aec65535f7d3bbadeedcc4f3e8c508709fb 100644 (file)
@@ -35,4 +35,4 @@ created.  Please use command "cat /proc/acpi/hotkey/polling_method"
 to retrieve it.
 
 Note: Use cmdline "acpi_generic_hotkey" to over-ride
-loading any platform specific drivers.
+platform-specific with generic driver.
index c437b1aeff55052e14f07d2e382259d3f9642bbf..8b3fd82b2ce712ead5c94b41f82972e58959200e 100644 (file)
@@ -1,16 +1,16 @@
                    IBM ThinkPad ACPI Extras Driver
 
-                            Version 0.8
-                          8 November 2004
+                            Version 0.12
+                           17 August 2005
 
                Borislav Deianov <borislav@users.sf.net>
                      http://ibm-acpi.sf.net/
 
 
-This is a Linux ACPI driver for the IBM ThinkPad laptops. It aims to
-support various features of these laptops which are accessible through
-the ACPI framework but not otherwise supported by the generic Linux
-ACPI drivers.
+This is a Linux ACPI driver for the IBM ThinkPad laptops. It supports
+various features of these laptops which are accessible through the
+ACPI framework but not otherwise supported by the generic Linux ACPI
+drivers.
 
 
 Status
@@ -25,9 +25,14 @@ detailed description):
        - ThinkLight on and off
        - limited docking and undocking
        - UltraBay eject
-       - Experimental: CMOS control
-       - Experimental: LED control
-       - Experimental: ACPI sounds
+       - CMOS control
+       - LED control
+       - ACPI sounds
+       - temperature sensors
+       - Experimental: embedded controller register dump
+       - Experimental: LCD brightness control
+       - Experimental: volume control
+       - Experimental: fan speed, fan enable/disable
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -91,12 +96,12 @@ driver is still in the alpha stage, the exact proc file format and
 commands supported by the various features is guaranteed to change
 frequently.
 
-Driver Version -- /proc/acpi/ibm/driver
---------------------------------------
+Driver version -- /proc/acpi/ibm/driver
+---------------------------------------
 
 The driver name and version. No commands can be written to this file.
 
-Hot Keys -- /proc/acpi/ibm/hotkey
+Hot keys -- /proc/acpi/ibm/hotkey
 ---------------------------------
 
 Without this driver, only the Fn-F4 key (sleep button) generates an
@@ -188,7 +193,7 @@ and, on the X40, video corruption. By disabling automatic switching,
 the flickering or video corruption can be avoided.
 
 The video_switch command cycles through the available video outputs
-(it sumulates the behavior of Fn-F7).
+(it simulates the behavior of Fn-F7).
 
 Video expansion can be toggled through this feature. This controls
 whether the display is expanded to fill the entire LCD screen when a
@@ -201,6 +206,12 @@ Fn-F7 from working. This also disables the video output switching
 features of this driver, as it uses the same ACPI methods as
 Fn-F7. Video switching on the console should still work.
 
+UPDATE: There's now a patch for the X.org Radeon driver which
+addresses this issue. Some people are reporting success with the patch
+while others are still having problems. For more information:
+
+https://bugs.freedesktop.org/show_bug.cgi?id=2000
+
 ThinkLight control -- /proc/acpi/ibm/light
 ------------------------------------------
 
@@ -211,7 +222,7 @@ models which do not make the status available will show it as
        echo on  > /proc/acpi/ibm/light
        echo off > /proc/acpi/ibm/light
 
-Docking / Undocking -- /proc/acpi/ibm/dock
+Docking / undocking -- /proc/acpi/ibm/dock
 ------------------------------------------
 
 Docking and undocking (e.g. with the X4 UltraBase) requires some
@@ -228,11 +239,15 @@ NOTE: These events will only be generated if the laptop was docked
 when originally booted. This is due to the current lack of support for
 hot plugging of devices in the Linux ACPI framework. If the laptop was
 booted while not in the dock, the following message is shown in the
-logs: "ibm_acpi: dock device not present". No dock-related events are
-generated but the dock and undock commands described below still
-work. They can be executed manually or triggered by Fn key
-combinations (see the example acpid configuration files included in
-the driver tarball package available on the web site).
+logs:
+
+       Mar 17 01:42:34 aero kernel: ibm_acpi: dock device not present
+
+In this case, no dock-related events are generated but the dock and
+undock commands described below still work. They can be executed
+manually or triggered by Fn key combinations (see the example acpid
+configuration files included in the driver tarball package available
+on the web site).
 
 When the eject request button on the dock is pressed, the first event
 above is generated. The handler for this event should issue the
@@ -267,7 +282,7 @@ the only docking stations currently supported are the X-series
 UltraBase docks and "dumb" port replicators like the Mini Dock (the
 latter don't need any ACPI support, actually).
 
-UltraBay Eject -- /proc/acpi/ibm/bay
+UltraBay eject -- /proc/acpi/ibm/bay
 ------------------------------------
 
 Inserting or ejecting an UltraBay device requires some actions to be
@@ -284,8 +299,11 @@ when the laptop was originally booted (on the X series, the UltraBay
 is in the dock, so it may not be present if the laptop was undocked).
 This is due to the current lack of support for hot plugging of devices
 in the Linux ACPI framework. If the laptop was booted without the
-UltraBay, the following message is shown in the logs: "ibm_acpi: bay
-device not present". No bay-related events are generated but the eject
+UltraBay, the following message is shown in the logs:
+
+       Mar 17 01:42:34 aero kernel: ibm_acpi: bay device not present
+
+In this case, no bay-related events are generated but the eject
 command described below still works. It can be executed manually or
 triggered by a hot key combination.
 
@@ -306,22 +324,33 @@ necessary to enable the UltraBay device (e.g. call idectl).
 The contents of the /proc/acpi/ibm/bay file shows the current status
 of the UltraBay, as provided by the ACPI framework.
 
-Experimental Features
----------------------
+EXPERIMENTAL warm eject support on the 600e/x, A22p and A3x (To use
+this feature, you need to supply the experimental=1 parameter when
+loading the module):
+
+These models do not have a button near the UltraBay device to request
+a hot eject but rather require the laptop to be put to sleep
+(suspend-to-ram) before the bay device is ejected or inserted).
+The sequence of steps to eject the device is as follows:
+
+       echo eject > /proc/acpi/ibm/bay
+       put the ThinkPad to sleep
+       remove the drive
+       resume from sleep
+       cat /proc/acpi/ibm/bay should show that the drive was removed
+
+On the A3x, both the UltraBay 2000 and UltraBay Plus devices are
+supported. Use "eject2" instead of "eject" for the second bay.
 
-The following features are marked experimental because using them
-involves guessing the correct values of some parameters. Guessing
-incorrectly may have undesirable effects like crashing your
-ThinkPad. USE THESE WITH CAUTION! To activate them, you'll need to
-supply the experimental=1 parameter when loading the module.
+Note: the UltraBay eject support on the 600e/x, A22p and A3x is
+EXPERIMENTAL and may not work as expected. USE WITH CAUTION!
 
-Experimental: CMOS control - /proc/acpi/ibm/cmos
-------------------------------------------------
+CMOS control -- /proc/acpi/ibm/cmos
+-----------------------------------
 
 This feature is used internally by the ACPI firmware to control the
-ThinkLight on most newer ThinkPad models. It appears that it can also
-control LCD brightness, sounds volume and more, but only on some
-models.
+ThinkLight on most newer ThinkPad models. It may also control LCD
+brightness, sounds volume and more, but only on some models.
 
 The commands are non-negative integer numbers:
 
@@ -330,10 +359,9 @@ The commands are non-negative integer numbers:
        echo 2 >/proc/acpi/ibm/cmos
        ...
 
-The range of numbers which are used internally by various models is 0
-to 21, but it's possible that numbers outside this range have
-interesting behavior. Here is the behavior on the X40 (tpb is the
-ThinkPad Buttons utility):
+The range of valid numbers is 0 to 21, but not all have an effect and
+the behavior varies from model to model. Here is the behavior on the
+X40 (tpb is the ThinkPad Buttons utility):
 
        0 - no effect but tpb reports "Volume down"
        1 - no effect but tpb reports "Volume up"
@@ -346,26 +374,18 @@ ThinkPad Buttons utility):
        13 - ThinkLight off
        14 - no effect but tpb reports ThinkLight status change
 
-If you try this feature, please send me a report similar to the
-above. On models which allow control of LCD brightness or sound
-volume, I'd like to provide this functionality in an user-friendly
-way, but first I need a way to identify the models which this is
-possible.
-
-Experimental: LED control - /proc/acpi/ibm/LED
-----------------------------------------------
+LED control -- /proc/acpi/ibm/led
+---------------------------------
 
 Some of the LED indicators can be controlled through this feature. The
 available commands are:
 
-       echo <led number> on >/proc/acpi/ibm/led
-       echo <led number> off >/proc/acpi/ibm/led
-       echo <led number> blink >/proc/acpi/ibm/led
+       echo '<led number> on' >/proc/acpi/ibm/led
+       echo '<led number> off' >/proc/acpi/ibm/led
+       echo '<led number> blink' >/proc/acpi/ibm/led
 
-The <led number> parameter is a non-negative integer. The range of LED
-numbers used internally by various models is 0 to 7 but it's possible
-that numbers outside this range are also valid. Here is the mapping on
-the X40:
+The <led number> range is 0 to 7. The set of LEDs that can be
+controlled varies from model to model. Here is the mapping on the X40:
 
        0 - power
        1 - battery (orange)
@@ -376,49 +396,224 @@ the X40:
 
 All of the above can be turned on and off and can be made to blink.
 
-If you try this feature, please send me a report similar to the
-above. I'd like to provide this functionality in an user-friendly way,
-but first I need to identify the which numbers correspond to which
-LEDs on various models.
-
-Experimental: ACPI sounds - /proc/acpi/ibm/beep
------------------------------------------------
+ACPI sounds -- /proc/acpi/ibm/beep
+----------------------------------
 
 The BEEP method is used internally by the ACPI firmware to provide
-audible alerts in various situtation. This feature allows the same
+audible alerts in various situations. This feature allows the same
 sounds to be triggered manually.
 
 The commands are non-negative integer numbers:
 
-       echo 0 >/proc/acpi/ibm/beep
-       echo 1 >/proc/acpi/ibm/beep
-       echo 2 >/proc/acpi/ibm/beep
-       ...
+       echo <number> >/proc/acpi/ibm/beep
 
-The range of numbers which are used internally by various models is 0
-to 17, but it's possible that numbers outside this range are also
-valid. Here is the behavior on the X40:
+The valid <number> range is 0 to 17. Not all numbers trigger sounds
+and the sounds vary from model to model. Here is the behavior on the
+X40:
 
-       2 - two beeps, pause, third beep
+       0 - stop a sound in progress (but use 17 to stop 16)
+       2 - two beeps, pause, third beep ("low battery")
        3 - single beep
-       4 - "unable"    
+       4 - high, followed by low-pitched beep ("unable")
        5 - single beep
-       6 - "AC/DC"
+       6 - very high, followed by high-pitched beep ("AC/DC")
        7 - high-pitched beep
        9 - three short beeps
        10 - very long beep
        12 - low-pitched beep
+       15 - three high-pitched beeps repeating constantly, stop with 0
+       16 - one medium-pitched beep repeating constantly, stop with 17
+       17 - stop 16
+
+Temperature sensors -- /proc/acpi/ibm/thermal
+---------------------------------------------
+
+Most ThinkPads include six or more separate temperature sensors but
+only expose the CPU temperature through the standard ACPI methods.
+This feature shows readings from up to eight different sensors. Some
+readings may not be valid, e.g. may show large negative values. For
+example, on the X40, a typical output may be:
+
+temperatures:   42 42 45 41 36 -128 33 -128
+
+Thomas Gruber took his R51 apart and traced all six active sensors in
+his laptop (the location of sensors may vary on other models):
+
+1:  CPU
+2:  Mini PCI Module
+3:  HDD
+4:  GPU
+5:  Battery
+6:  N/A
+7:  Battery
+8:  N/A
+
+No commands can be written to this file.
+
+EXPERIMENTAL: Embedded controller reigster dump -- /proc/acpi/ibm/ecdump
+------------------------------------------------------------------------
+
+This feature is marked EXPERIMENTAL because the implementation
+directly accesses hardware registers and may not work as expected. USE
+WITH CAUTION! To use this feature, you need to supply the
+experimental=1 parameter when loading the module.
+
+This feature dumps the values of 256 embedded controller
+registers. Values which have changed since the last time the registers
+were dumped are marked with a star:
+
+[root@x40 ibm-acpi]# cat /proc/acpi/ibm/ecdump 
+EC       +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
+EC 0x00:  a7  47  87  01  fe  96  00  08  01  00  cb  00  00  00  40  00
+EC 0x10:  00  00  ff  ff  f4  3c  87  09  01  ff  42  01  ff  ff  0d  00
+EC 0x20:  00  00  00  00  00  00  00  00  00  00  00  03  43  00  00  80
+EC 0x30:  01  07  1a  00  30  04  00  00 *85  00  00  10  00  50  00  00
+EC 0x40:  00  00  00  00  00  00  14  01  00  04  00  00  00  00  00  00
+EC 0x50:  00  c0  02  0d  00  01  01  02  02  03  03  03  03 *bc *02 *bc
+EC 0x60: *02 *bc *02  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0x70:  00  00  00  00  00  12  30  40 *24 *26 *2c *27 *20  80 *1f  80
+EC 0x80:  00  00  00  06 *37 *0e  03  00  00  00  0e  07  00  00  00  00
+EC 0x90:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xa0: *ff  09  ff  09  ff  ff *64  00 *00 *00 *a2  41 *ff *ff *e0  00
+EC 0xb0:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xc0:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xd0:  03  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xe0:  00  00  00  00  00  00  00  00  11  20  49  04  24  06  55  03
+EC 0xf0:  31  55  48  54  35  38  57  57  08  2f  45  73  07  65  6c  1a
+
+This feature can be used to determine the register holding the fan
+speed on some models. To do that, do the following:
+
+       - make sure the battery is fully charged
+       - make sure the fan is running
+       - run 'cat /proc/acpi/ibm/ecdump' several times, once per second or so
+
+The first step makes sure various charging-related values don't
+vary. The second ensures that the fan-related values do vary, since
+the fan speed fluctuates a bit. The third will (hopefully) mark the
+fan register with a star:
+
+[root@x40 ibm-acpi]# cat /proc/acpi/ibm/ecdump 
+EC       +00 +01 +02 +03 +04 +05 +06 +07 +08 +09 +0a +0b +0c +0d +0e +0f
+EC 0x00:  a7  47  87  01  fe  96  00  08  01  00  cb  00  00  00  40  00
+EC 0x10:  00  00  ff  ff  f4  3c  87  09  01  ff  42  01  ff  ff  0d  00
+EC 0x20:  00  00  00  00  00  00  00  00  00  00  00  03  43  00  00  80
+EC 0x30:  01  07  1a  00  30  04  00  00  85  00  00  10  00  50  00  00
+EC 0x40:  00  00  00  00  00  00  14  01  00  04  00  00  00  00  00  00
+EC 0x50:  00  c0  02  0d  00  01  01  02  02  03  03  03  03  bc  02  bc
+EC 0x60:  02  bc  02  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0x70:  00  00  00  00  00  12  30  40  24  27  2c  27  21  80  1f  80
+EC 0x80:  00  00  00  06 *be  0d  03  00  00  00  0e  07  00  00  00  00
+EC 0x90:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xa0:  ff  09  ff  09  ff  ff  64  00  00  00  a2  41  ff  ff  e0  00
+EC 0xb0:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xc0:  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xd0:  03  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
+EC 0xe0:  00  00  00  00  00  00  00  00  11  20  49  04  24  06  55  03
+EC 0xf0:  31  55  48  54  35  38  57  57  08  2f  45  73  07  65  6c  1a
+
+Another set of values that varies often is the temperature
+readings. Since temperatures don't change vary fast, you can take
+several quick dumps to eliminate them.
+
+You can use a similar method to figure out the meaning of other
+embedded controller registers - e.g. make sure nothing else changes
+except the charging or discharging battery to determine which
+registers contain the current battery capacity, etc. If you experiment
+with this, do send me your results (including some complete dumps with
+a description of the conditions when they were taken.)
+
+EXPERIMENTAL: LCD brightness control -- /proc/acpi/ibm/brightness
+-----------------------------------------------------------------
+
+This feature is marked EXPERIMENTAL because the implementation
+directly accesses hardware registers and may not work as expected. USE
+WITH CAUTION! To use this feature, you need to supply the
+experimental=1 parameter when loading the module.
+
+This feature allows software control of the LCD brightness on ThinkPad
+models which don't have a hardware brightness slider. The available
+commands are:
+
+       echo up   >/proc/acpi/ibm/brightness
+       echo down >/proc/acpi/ibm/brightness
+       echo 'level <level>' >/proc/acpi/ibm/brightness
+
+The <level> number range is 0 to 7, although not all of them may be
+distinct. The current brightness level is shown in the file.
+
+EXPERIMENTAL: Volume control -- /proc/acpi/ibm/volume
+-----------------------------------------------------
+
+This feature is marked EXPERIMENTAL because the implementation
+directly accesses hardware registers and may not work as expected. USE
+WITH CAUTION! To use this feature, you need to supply the
+experimental=1 parameter when loading the module.
+
+This feature allows volume control on ThinkPad models which don't have
+a hardware volume knob. The available commands are:
+
+       echo up   >/proc/acpi/ibm/volume
+       echo down >/proc/acpi/ibm/volume
+       echo mute >/proc/acpi/ibm/volume
+       echo 'level <level>' >/proc/acpi/ibm/volume
+
+The <level> number range is 0 to 15 although not all of them may be
+distinct. The unmute the volume after the mute command, use either the
+up or down command (the level command will not unmute the volume).
+The current volume level and mute state is shown in the file.
+
+EXPERIMENTAL: fan speed, fan enable/disable -- /proc/acpi/ibm/fan
+-----------------------------------------------------------------
+
+This feature is marked EXPERIMENTAL because the implementation
+directly accesses hardware registers and may not work as expected. USE
+WITH CAUTION! To use this feature, you need to supply the
+experimental=1 parameter when loading the module.
+
+This feature attempts to show the current fan speed. The speed is read
+directly from the hardware registers of the embedded controller. This
+is known to work on later R, T and X series ThinkPads but may show a
+bogus value on other models.
+
+The fan may be enabled or disabled with the following commands:
+
+       echo enable  >/proc/acpi/ibm/fan
+       echo disable >/proc/acpi/ibm/fan
+
+WARNING WARNING WARNING: do not leave the fan disabled unless you are
+monitoring the temperature sensor readings and you are ready to enable
+it if necessary to avoid overheating.
+
+The fan only runs if it's enabled *and* the various temperature
+sensors which control it read high enough. On the X40, this seems to
+depend on the CPU and HDD temperatures. Specifically, the fan is
+turned on when either the CPU temperature climbs to 56 degrees or the
+HDD temperature climbs to 46 degrees. The fan is turned off when the
+CPU temperature drops to 49 degrees and the HDD temperature drops to
+41 degrees. These thresholds cannot currently be controlled.
+
+On the X31 and X40 (and ONLY on those models), the fan speed can be
+controlled to a certain degree. Once the fan is running, it can be
+forced to run faster or slower with the following command:
+
+       echo 'speed <speed>' > /proc/acpi/ibm/thermal
+
+The sustainable range of fan speeds on the X40 appears to be from
+about 3700 to about 7350. Values outside this range either do not have
+any effect or the fan speed eventually settles somewhere in that
+range. The fan cannot be stopped or started with this command.
+
+On the 570, temperature readings are not available through this
+feature and the fan control works a little differently. The fan speed
+is reported in levels from 0 (off) to 7 (max) and can be controlled
+with the following command:
 
-(I've only been able to identify a couple of them).
-
-If you try this feature, please send me a report similar to the
-above. I'd like to provide this functionality in an user-friendly way,
-but first I need to identify the which numbers correspond to which
-sounds on various models.
+       echo 'level <level>' > /proc/acpi/ibm/thermal
 
 
-Multiple Command, Module Parameters
------------------------------------
+Multiple Commands, Module Parameters
+------------------------------------
 
 Multiple commands can be written to the proc files in one shot by
 separating them with commas, for example:
@@ -451,24 +646,19 @@ scripts (included with ibm-acpi for completeness):
        /usr/local/sbin/laptop_mode -- from the Linux kernel source
                distribution, see Documentation/laptop-mode.txt
        /sbin/service -- comes with Redhat/Fedora distributions
+       /usr/sbin/hibernate -- from the Software Suspend 2 distribution,
+               see http://softwaresuspend.berlios.de/
 
-Toan T Nguyen <ntt@control.uchicago.edu> has written a SuSE powersave
-script for the X20, included in config/usr/sbin/ibm_hotkeys_X20
+Toan T Nguyen <ntt@physics.ucla.edu> notes that Suse uses the
+powersave program to suspend ('powersave --suspend-to-ram') or
+hibernate ('powersave --suspend-to-disk'). This means that the
+hibernate script is not needed on that distribution.
 
 Henrik Brix Andersen <brix@gentoo.org> has written a Gentoo ACPI event
 handler script for the X31. You can get the latest version from
 http://dev.gentoo.org/~brix/files/x31.sh
 
 David Schweikert <dws@ee.eth.ch> has written an alternative blank.sh
-script which works on Debian systems, included in
-configs/etc/acpi/actions/blank-debian.sh
-
-
-TODO
-----
-
-I'd like to implement the following features but haven't yet found the
-time and/or I don't yet know how to implement them:
-
-- UltraBay floppy drive support
-
+script which works on Debian systems. This scripts has now been
+extended to also work on Fedora systems and included as the default
+blank.sh in the distribution.
index 51f430cc2fbf5b7a08bcfed5bc6dee1e97fb1435..2786f7c34b3fc9e7627d613a00e63e9aaf40681d 100644 (file)
@@ -541,6 +541,103 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
        return ret;
 }
 
+#ifdef CONFIG_PM
+
+struct locomo_save_data {
+       u16     LCM_GPO;
+       u16     LCM_SPICT;
+       u16     LCM_GPE;
+       u16     LCM_ASD;
+       u16     LCM_SPIMD;
+};
+
+static int locomo_suspend(struct device *dev, u32 pm_message_t, u32 level)
+{
+       struct locomo *lchip = dev_get_drvdata(dev);
+       struct locomo_save_data *save;
+       unsigned long flags;
+
+       if (level != SUSPEND_DISABLE)
+               return 0;
+
+       save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
+       if (!save)
+               return -ENOMEM;
+
+       dev->power.saved_state = (void *) save;
+
+       spin_lock_irqsave(&lchip->lock, flags);
+
+       save->LCM_GPO     = locomo_readl(lchip->base + LOCOMO_GPO);     /* GPIO */
+       locomo_writel(0x00, lchip->base + LOCOMO_GPO);
+       save->LCM_SPICT   = locomo_readl(lchip->base + LOCOMO_SPICT);   /* SPI */
+       locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
+       save->LCM_GPE     = locomo_readl(lchip->base + LOCOMO_GPE);     /* GPIO */
+       locomo_writel(0x00, lchip->base + LOCOMO_GPE);
+       save->LCM_ASD     = locomo_readl(lchip->base + LOCOMO_ASD);     /* ADSTART */
+       locomo_writel(0x00, lchip->base + LOCOMO_ASD);
+       save->LCM_SPIMD   = locomo_readl(lchip->base + LOCOMO_SPIMD);   /* SPI */
+       locomo_writel(0x3C14, lchip->base + LOCOMO_SPIMD);
+
+       locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
+       locomo_writel(0x00, lchip->base + LOCOMO_DAC);
+       locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC);
+
+       if ( (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88) )
+               locomo_writel(0x00, lchip->base + LOCOMO_C32K);         /* CLK32 off */
+       else
+               /* 18MHz already enabled, so no wait */
+               locomo_writel(0xc1, lchip->base + LOCOMO_C32K);         /* CLK32 on */
+
+       locomo_writel(0x00, lchip->base + LOCOMO_TADC);         /* 18MHz clock off*/
+       locomo_writel(0x00, lchip->base + LOCOMO_AUDIO + LOCOMO_ACC);                   /* 22MHz/24MHz clock off */
+       locomo_writel(0x00, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);                      /* FL */
+
+       spin_unlock_irqrestore(&lchip->lock, flags);
+
+       return 0;
+}
+
+static int locomo_resume(struct device *dev, u32 level)
+{
+       struct locomo *lchip = dev_get_drvdata(dev);
+       struct locomo_save_data *save;
+       unsigned long r;
+       unsigned long flags;
+       
+       if (level != RESUME_ENABLE)
+               return 0;
+
+       save = (struct locomo_save_data *) dev->power.saved_state;
+       if (!save)
+               return 0;
+
+       spin_lock_irqsave(&lchip->lock, flags);
+
+       locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
+       locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPICT);
+       locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
+       locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
+       locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPIMD);
+
+       locomo_writel(0x00, lchip->base + LOCOMO_C32K);
+       locomo_writel(0x90, lchip->base + LOCOMO_TADC);
+
+       locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KSC);
+       r = locomo_readl(lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+       r &= 0xFEFF;
+       locomo_writel(r, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+       locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
+
+       spin_unlock_irqrestore(&lchip->lock, flags);
+
+       dev->power.saved_state = NULL;
+       kfree(save);
+
+       return 0;
+}
+#endif
+
 /**
  *     locomo_probe - probe for a single LoCoMo chip.
  *     @phys_addr: physical address of device.
@@ -707,6 +804,10 @@ static struct device_driver locomo_device_driver = {
        .bus            = &platform_bus_type,
        .probe          = locomo_probe,
        .remove         = locomo_remove,
+#ifdef CONFIG_PM
+       .suspend        = locomo_suspend,
+       .resume         = locomo_resume,
+#endif
 };
 
 /*
index 96a794d8de842d2476a6776ce0bc46c0afd5369e..756348bf51702c982b17521ecfd66719842b845f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.12-git4
-# Wed Jun 22 15:56:42 2005
+# Linux kernel version: 2.6.13-git8
+# Thu Sep  8 19:24:02 2005
 #
 CONFIG_ARM=y
 CONFIG_MMU=y
@@ -22,6 +22,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
 # General setup
 #
 CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 # CONFIG_POSIX_MQUEUE is not set
@@ -31,6 +32,7 @@ CONFIG_SYSCTL=y
 # CONFIG_HOTPLUG is not set
 CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
@@ -88,7 +90,9 @@ CONFIG_ARCH_S3C2410=y
 #
 # S3C24XX Implementations
 #
+CONFIG_MACH_ANUBIS=y
 CONFIG_ARCH_BAST=y
+CONFIG_BAST_PC104_IRQ=y
 CONFIG_ARCH_H1940=y
 CONFIG_MACH_N30=y
 CONFIG_ARCH_SMDK2410=y
@@ -112,6 +116,7 @@ CONFIG_S3C2410_DMA=y
 # CONFIG_S3C2410_DMA_DEBUG is not set
 # CONFIG_S3C2410_PM_DEBUG is not set
 # CONFIG_S3C2410_PM_CHECK is not set
+CONFIG_PM_SIMTEC=y
 CONFIG_S3C2410_LOWLEVEL_UART_PORT=0
 
 #
@@ -149,7 +154,15 @@ CONFIG_ISA_DMA_API=y
 #
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
-# CONFIG_DISCONTIGMEM is not set
+# CONFIG_NO_IDLE_HZ is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_ALIGNMENT_TRAP=y
 
 #
@@ -185,6 +198,74 @@ CONFIG_BINFMT_AOUT=y
 CONFIG_PM=y
 CONFIG_APM=y
 
+#
+# Networking
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+# CONFIG_PACKET is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_BIC=y
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# DCCP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_DCCP is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETFILTER_NETLINK is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_IEEE80211 is not set
+
 #
 # Device Drivers
 #
@@ -258,6 +339,7 @@ CONFIG_MTD_ROM=y
 # CONFIG_MTD_IMPA7 is not set
 CONFIG_MTD_BAST=y
 CONFIG_MTD_BAST_MAXSIZE=4
+# CONFIG_MTD_PLATRAM is not set
 
 #
 # Self-contained MTD device drivers
@@ -312,7 +394,6 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CDROM_PKTCDVD is not set
 
 #
@@ -354,6 +435,7 @@ CONFIG_BLK_DEV_IDE_BAST=y
 #
 # SCSI device support
 #
+# CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
 
 #
@@ -376,76 +458,19 @@ CONFIG_BLK_DEV_IDE_BAST=y
 #
 
 #
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
+# Network device support
 #
-# CONFIG_PACKET is not set
-CONFIG_UNIX=y
-# CONFIG_NET_KEY is not set
-CONFIG_INET=y
-CONFIG_IP_FIB_HASH=y
-# CONFIG_IP_FIB_TRIE is not set
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_IP_TCPDIAG=y
-# CONFIG_IP_TCPDIAG_IPV6 is not set
-# CONFIG_IPV6 is not set
-# CONFIG_NETFILTER is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_NET_DIVERT is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-# CONFIG_NET_CLS_ROUTE is not set
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
 
+#
+# PHY device support
+#
+# CONFIG_PHYLIB is not set
+
 #
 # Ethernet (10 or 100Mbit)
 #
@@ -480,6 +505,8 @@ CONFIG_DM9000=m
 # CONFIG_SLIP is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -562,7 +589,6 @@ CONFIG_SERIAL_8250_EXTENDED=y
 CONFIG_SERIAL_8250_MANY_PORTS=y
 CONFIG_SERIAL_8250_SHARE_IRQ=y
 # CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_MULTIPORT is not set
 # CONFIG_SERIAL_8250_RSA is not set
 
 #
@@ -605,7 +631,6 @@ CONFIG_S3C2410_RTC=y
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
 #
@@ -628,7 +653,7 @@ CONFIG_I2C_ALGOBIT=m
 #
 # I2C Hardware Bus support
 #
-# CONFIG_I2C_ISA is not set
+CONFIG_I2C_ISA=m
 # CONFIG_I2C_PARPORT is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 CONFIG_I2C_S3C2410=y
@@ -636,14 +661,33 @@ CONFIG_I2C_S3C2410=y
 # CONFIG_I2C_PCA_ISA is not set
 
 #
-# Hardware Sensors Chip support
+# Miscellaneous I2C Chip support
 #
-CONFIG_I2C_SENSOR=m
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+CONFIG_SENSORS_EEPROM=m
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# Hardware Monitoring support
+#
+CONFIG_HWMON=y
+CONFIG_HWMON_VID=m
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_FSCPOS is not set
@@ -662,27 +706,21 @@ CONFIG_SENSORS_LM85=m
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_PC87360 is not set
-# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83792D is not set
 # CONFIG_SENSORS_W83L785TS is not set
 # CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
 
 #
-# Other I2C Chip support
+# Misc devices
 #
-# CONFIG_SENSORS_DS1337 is not set
-CONFIG_SENSORS_EEPROM=m
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_RTC8564 is not set
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
 
 #
-# Misc devices
+# Multimedia Capabilities Port drivers
 #
 
 #
@@ -731,7 +769,7 @@ CONFIG_DUMMY_CONSOLE=y
 # USB support
 #
 CONFIG_USB_ARCH_HAS_HCD=y
-# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_OHCI=y
 # CONFIG_USB is not set
 
 #
@@ -749,6 +787,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
 #
 CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -758,6 +797,7 @@ CONFIG_JBD=y
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
 
 #
 # XFS support
@@ -765,6 +805,7 @@ CONFIG_FS_MBCACHE=y
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 CONFIG_ROMFS_FS=y
+CONFIG_INOTIFY=y
 # CONFIG_QUOTA is not set
 CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
@@ -791,11 +832,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 #
 CONFIG_PROC_FS=y
 CONFIG_SYSFS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
+# CONFIG_RELAYFS_FS is not set
 
 #
 # Miscellaneous filesystems
@@ -812,8 +853,7 @@ CONFIG_JFFS_FS_VERBOSE=0
 # CONFIG_JFFS_PROC_FS is not set
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
-# CONFIG_JFFS2_FS_NAND is not set
-# CONFIG_JFFS2_FS_NOR_ECC is not set
+CONFIG_JFFS2_FS_WRITEBUFFER=y
 # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
@@ -835,6 +875,7 @@ CONFIG_NFS_FS=y
 # CONFIG_NFSD is not set
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
+CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -920,6 +961,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_MAGIC_SYSRQ is not set
 CONFIG_LOG_BUF_SHIFT=16
+CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK is not set
index 7408ac94f771663005b2a52c609aea5c5d7afede..27fc2e8e5fca6d07cfa6659bc9562279de7084ac 100644 (file)
@@ -47,6 +47,14 @@ config MACH_OMAP_OSK
          TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
           if you have such a board.
 
+config OMAP_OSK_MISTRAL
+       bool "Mistral QVGA board Support"
+       depends on MACH_OMAP_OSK
+       help
+         The OSK supports an optional add-on board with a Quarter-VGA
+         touchscreen, PDA-ish buttons, a resume button, bicolor LED,
+         and camera connector.  Say Y here if you have this board.
+
 config MACH_OMAP_PERSEUS2
        bool "TI Perseus2"
        depends on ARCH_OMAP1 && ARCH_OMAP730
index d386fd913f0c617a890cf88838b739f9c1f53430..181a93deaaee4fa9cca5cbd5fbbca498e0930f3f 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := io.o id.o irq.o time.o serial.o
+obj-y := io.o id.o irq.o time.o serial.o devices.o
 led-y := leds.o
 
 # Specific board support
@@ -23,6 +23,7 @@ endif
 
 # LEDs support
 led-$(CONFIG_MACH_OMAP_H2)             += leds-h2p2-debug.o
+led-$(CONFIG_MACH_OMAP_H3)             += leds-h2p2-debug.o
 led-$(CONFIG_MACH_OMAP_INNOVATOR)      += leds-innovator.o
 led-$(CONFIG_MACH_OMAP_PERSEUS2)       += leds-h2p2-debug.o
 led-$(CONFIG_MACH_OMAP_OSK)            += leds-osk.o
index 122796ebe8f5a0b8425748464b756cc83813ef71..c209c7172a9aedf295c725e5ecf79bbb0b8ea02f 100644 (file)
@@ -48,19 +48,43 @@ static struct omap_usb_config generic1510_usb_config __initdata = {
 
 #if defined(CONFIG_ARCH_OMAP16XX)
 static struct omap_usb_config generic1610_usb_config __initdata = {
+#ifdef CONFIG_USB_OTG
+       .otg            = 1,
+#endif
        .register_host  = 1,
        .register_dev   = 1,
        .hmc_mode       = 16,
        .pins[0]        = 6,
 };
+
+static struct omap_mmc_config generic_mmc_config __initdata = {
+       .mmc [0] = {
+               .enabled        = 0,
+               .wire4          = 0,
+               .wp_pin         = -1,
+               .power_pin      = -1,
+               .switch_pin     = -1,
+       },
+       .mmc [1] = {
+               .enabled        = 0,
+               .wire4          = 0,
+               .wp_pin         = -1,
+               .power_pin      = -1,
+               .switch_pin     = -1,
+       },
+};
+
 #endif
 
 static struct omap_board_config_kernel generic_config[] = {
        { OMAP_TAG_USB,           NULL },
+       { OMAP_TAG_MMC,           &generic_mmc_config },
 };
 
 static void __init omap_generic_init(void)
 {
+       const struct omap_uart_config *uart_conf;
+
        /*
         * Make sure the serial ports are muxed on at this point.
         * You have to mux them off in device drivers later on
@@ -76,6 +100,18 @@ static void __init omap_generic_init(void)
                generic_config[0].data = &generic1610_usb_config;
        }
 #endif
+
+       uart_conf = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
+       if (uart_conf != NULL) {
+               unsigned int enabled_ports, i;
+
+               enabled_ports = uart_conf->enabled_uarts;
+               for (i = 0; i < 3; i++) {
+                       if (!(enabled_ports & (1 << i)))
+                               generic_serial_ports[i] = 0;
+               }
+       }
+
        omap_board_config = generic_config;
        omap_board_config_size = ARRAY_SIZE(generic_config);
        omap_serial_init(generic_serial_ports);
@@ -83,7 +119,7 @@ static void __init omap_generic_init(void)
 
 static void __init omap_generic_map_io(void)
 {
-       omap_map_common_io()
+       omap_map_common_io();
 }
 
 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
index f4983ee95ab4e29dbc112c97f7414b76b5e39293..d46a70063b0c61821088ae2c8f483c6a9356454f 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/mach/map.h>
 
 #include <asm/arch/gpio.h>
+#include <asm/arch/mux.h>
 #include <asm/arch/tc.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/common.h>
@@ -80,8 +81,7 @@ static struct flash_platform_data h2_flash_data = {
 };
 
 static struct resource h2_flash_resource = {
-       .start          = OMAP_CS2B_PHYS,
-       .end            = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
+       /* This is on CS3, wherever it's mapped */
        .flags          = IORESOURCE_MEM,
 };
 
@@ -126,10 +126,9 @@ static void __init h2_init_smc91x(void)
                printk("Error requesting gpio 0 for smc91x irq\n");
                return;
        }
-       omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
 }
 
-void h2_init_irq(void)
+static void __init h2_init_irq(void)
 {
        omap_init_irq();
        omap_gpio_init();
@@ -152,9 +151,13 @@ static struct omap_usb_config h2_usb_config __initdata = {
 };
 
 static struct omap_mmc_config h2_mmc_config __initdata = {
-       .mmc_blocks             = 1,
-       .mmc1_power_pin         = -1,   /* tps65010 gpio3 */
-       .mmc1_switch_pin        = OMAP_MPUIO(1),
+       .mmc [0] = {
+               .enabled        = 1,
+               .wire4          = 1,
+               .wp_pin         = OMAP_MPUIO(3),
+               .power_pin      = -1,   /* tps65010 gpio3 */
+               .switch_pin     = OMAP_MPUIO(1),
+       },
 };
 
 static struct omap_board_config_kernel h2_config[] = {
@@ -164,6 +167,16 @@ static struct omap_board_config_kernel h2_config[] = {
 
 static void __init h2_init(void)
 {
+       /* NOTE: revC boards support NAND-boot, which can put NOR on CS2B
+        * and NAND (either 16bit or 8bit) on CS3.
+        */
+       h2_flash_resource.end = h2_flash_resource.start = omap_cs3_phys();
+       h2_flash_resource.end += SZ_32M - 1;
+
+       /* MMC:  card detect and WP */
+       // omap_cfg_reg(U19_ARMIO1);            /* CD */
+       omap_cfg_reg(BALLOUT_V8_ARMIO3);        /* WP */
+
        platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
        omap_board_config = h2_config;
        omap_board_config_size = ARRAY_SIZE(h2_config);
index 7cd419d61b400889c56e39feb64572f888205b6b..2798613696fa7e0781609bb61132858d25089e27 100644 (file)
@@ -82,8 +82,7 @@ static struct flash_platform_data h3_flash_data = {
 };
 
 static struct resource h3_flash_resource = {
-       .start          = OMAP_CS2B_PHYS,
-       .end            = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
+       /* This is on CS3, wherever it's mapped */
        .flags          = IORESOURCE_MEM,
 };
 
@@ -161,13 +160,26 @@ static struct omap_usb_config h3_usb_config __initdata = {
        .pins[1]        = 3,
 };
 
+static struct omap_mmc_config h3_mmc_config __initdata = {
+       .mmc[0] = {
+               .enabled        = 1,
+               .power_pin      = -1,   /* tps65010 GPIO4 */
+               .switch_pin     = OMAP_MPUIO(1),
+       },
+};
+
 static struct omap_board_config_kernel h3_config[] = {
        { OMAP_TAG_USB,  &h3_usb_config },
+       { OMAP_TAG_MMC,  &h3_mmc_config },
 };
 
 static void __init h3_init(void)
 {
+       h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys();
+       h3_flash_resource.end += OMAP_CS3_SIZE - 1;
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
+       omap_board_config = h3_config;
+       omap_board_config_size = ARRAY_SIZE(h3_config);
 }
 
 static void __init h3_init_smc91x(void)
@@ -177,7 +189,6 @@ static void __init h3_init_smc91x(void)
                printk("Error requesting gpio 40 for smc91x irq\n");
                return;
        }
-       omap_set_gpio_edge_ctrl(40, OMAP_GPIO_FALLING_EDGE);
 }
 
 void h3_init_irq(void)
index 91de60a91ef86a04ae32e3d47a675c32752f33be..df0312b596e484a6e79cf5356c767020e8d55c54 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
+#include <asm/arch/mux.h>
 #include <asm/arch/fpga.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/tc.h>
@@ -173,7 +174,6 @@ static void __init innovator_init_smc91x(void)
                        printk("Error requesting gpio 0 for smc91x irq\n");
                        return;
                }
-               omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
        }
 }
 
@@ -220,8 +220,19 @@ static struct omap_usb_config h2_usb_config __initdata = {
 };
 #endif
 
+static struct omap_mmc_config innovator_mmc_config __initdata = {
+       .mmc [0] = {
+               .enabled        = 1,
+               .wire4          = 1,
+               .wp_pin         = OMAP_MPUIO(3),
+               .power_pin      = -1,   /* FPGA F3 UIO42 */
+               .switch_pin     = -1,   /* FPGA F4 UIO43 */
+       },
+};
+
 static struct omap_board_config_kernel innovator_config[] = {
        { OMAP_TAG_USB,         NULL },
+       { OMAP_TAG_MMC,         &innovator_mmc_config },
 };
 
 static void __init innovator_init(void)
index 6750b2014092d8ced13f0f28356d2e2ad31a49a8..d904e643f5ec2c30fabf5d8438f5e40cdec82ad1 100644 (file)
@@ -75,16 +75,15 @@ static void __init netstar_init(void)
        mdelay(50);     /* 50ms until PHY ready */
        /* smc91x interrupt pin */
        omap_request_gpio(8);
-       omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
 
        omap_request_gpio(12);
        omap_request_gpio(13);
        omap_request_gpio(14);
        omap_request_gpio(15);
-       omap_set_gpio_edge_ctrl(12, OMAP_GPIO_FALLING_EDGE);
-       omap_set_gpio_edge_ctrl(13, OMAP_GPIO_FALLING_EDGE);
-       omap_set_gpio_edge_ctrl(14, OMAP_GPIO_FALLING_EDGE);
-       omap_set_gpio_edge_ctrl(15, OMAP_GPIO_FALLING_EDGE);
+       set_irq_type(OMAP_GPIO_IRQ(12), IRQT_FALLING);
+       set_irq_type(OMAP_GPIO_IRQ(13), IRQT_FALLING);
+       set_irq_type(OMAP_GPIO_IRQ(14), IRQT_FALLING);
+       set_irq_type(OMAP_GPIO_IRQ(15), IRQT_FALLING);
 
        platform_add_devices(netstar_devices, ARRAY_SIZE(netstar_devices));
 
index 6844e536c698da5820a3b5f05d8ae5e085f67402..21103df50415a7007428f04224b54c8c2127b023 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/interrupt.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/mach/flash.h>
 
 #include <asm/arch/gpio.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/tc.h>
 #include <asm/arch/common.h>
 
-static struct map_desc osk5912_io_desc[] __initdata = {
-{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
-       MT_DEVICE },
+static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
+
+static struct mtd_partition osk_partitions[] = {
+       /* bootloader (U-Boot, etc) in first sector */
+       {
+             .name             = "bootloader",
+             .offset           = 0,
+             .size             = SZ_128K,
+             .mask_flags       = MTD_WRITEABLE, /* force read-only */
+       },
+       /* bootloader params in the next sector */
+       {
+             .name             = "params",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_128K,
+             .mask_flags       = 0,
+       }, {
+             .name             = "kernel",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_2M,
+             .mask_flags       = 0
+       }, {
+             .name             = "filesystem",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = MTDPART_SIZ_FULL,
+             .mask_flags       = 0
+       }
 };
 
-static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
+static struct flash_platform_data osk_flash_data = {
+       .map_name       = "cfi_probe",
+       .width          = 2,
+       .parts          = osk_partitions,
+       .nr_parts       = ARRAY_SIZE(osk_partitions),
+};
+
+static struct resource osk_flash_resource = {
+       /* this is on CS3, wherever it's mapped */
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device osk5912_flash_device = {
+       .name           = "omapflash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &osk_flash_data,
+       },
+       .num_resources  = 1,
+       .resource       = &osk_flash_resource,
+};
 
 static struct resource osk5912_smc91x_resources[] = {
        [0] = {
@@ -86,9 +135,16 @@ static struct platform_device osk5912_cf_device = {
        .resource       = osk5912_cf_resources,
 };
 
+static struct platform_device osk5912_mcbsp1_device = {
+       .name           = "omap_mcbsp",
+       .id             = 1,
+};
+
 static struct platform_device *osk5912_devices[] __initdata = {
+       &osk5912_flash_device,
        &osk5912_smc91x_device,
        &osk5912_cf_device,
+       &osk5912_mcbsp1_device,
 };
 
 static void __init osk_init_smc91x(void)
@@ -97,7 +153,6 @@ static void __init osk_init_smc91x(void)
                printk("Error requesting gpio 0 for smc91x irq\n");
                return;
        }
-       omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
 
        /* Check EMIFS wait states to fix errors with SMC_GET_PKT_HDR */
        EMIFS_CCS(1) |= 0x2;
@@ -110,11 +165,11 @@ static void __init osk_init_cf(void)
                printk("Error requesting gpio 62 for CF irq\n");
                return;
        }
-       /* it's really active-low */
-       omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE);
+       /* the CF I/O IRQ is really active-low */
+       set_irq_type(OMAP_GPIO_IRQ(62), IRQT_FALLING);
 }
 
-void osk_init_irq(void)
+static void __init osk_init_irq(void)
 {
        omap_init_irq();
        omap_gpio_init();
@@ -142,18 +197,69 @@ static struct omap_board_config_kernel osk_config[] = {
        { OMAP_TAG_USB,           &osk_usb_config },
 };
 
+#ifdef CONFIG_OMAP_OSK_MISTRAL
+
+#ifdef CONFIG_PM
+static irqreturn_t
+osk_mistral_wake_interrupt(int irq, void *ignored, struct pt_regs *regs)
+{
+       return IRQ_HANDLED;
+}
+#endif
+
+static void __init osk_mistral_init(void)
+{
+       /* FIXME here's where to feed in framebuffer, touchpad, and
+        * keyboard setup ...  not in the drivers for those devices!
+        *
+        * NOTE:  we could actually tell if there's a Mistral board
+        * attached, e.g. by trying to read something from the ads7846.
+        * But this is too early for that...
+        */
+
+       /* the sideways button (SW1) is for use as a "wakeup" button */
+       omap_cfg_reg(N15_1610_MPUIO2);
+       if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
+               int ret = 0;
+               omap_set_gpio_direction(OMAP_MPUIO(2), 1);
+               set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
+#ifdef CONFIG_PM
+               /* share the IRQ in case someone wants to use the
+                * button for more than wakeup from system sleep.
+                */
+               ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)),
+                               &osk_mistral_wake_interrupt,
+                               SA_SHIRQ, "mistral_wakeup",
+                               &osk_mistral_wake_interrupt);
+               if (ret != 0) {
+                       omap_free_gpio(OMAP_MPUIO(2));
+                       printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
+                               ret);
+               } else
+                       enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2)));
+#endif
+       } else
+               printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
+}
+#else
+static void __init osk_mistral_init(void) { }
+#endif
+
 static void __init osk_init(void)
 {
+       osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
+       osk_flash_resource.end += SZ_32M - 1;
        platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
        omap_board_config = osk_config;
        omap_board_config_size = ARRAY_SIZE(osk_config);
        USB_TRANSCEIVER_CTRL_REG |= (3 << 1);
+
+       osk_mistral_init();
 }
 
 static void __init osk_map_io(void)
 {
        omap_map_common_io();
-       iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
        omap_serial_init(osk_serial_ports);
 }
 
index 213317392d9b1c4066fca07e8cb7bfd1714d9ea9..107c68c8ab54b796fe7f5271adb11a40c52de760 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
+#include <asm/arch/tc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/fpga.h>
@@ -83,8 +84,8 @@ static struct flash_platform_data p2_flash_data = {
 };
 
 static struct resource p2_flash_resource = {
-       .start          = OMAP_FLASH_0_START,
-       .end            = OMAP_FLASH_0_START + OMAP_FLASH_0_SIZE - 1,
+       .start          = OMAP_CS0_PHYS,
+       .end            = OMAP_CS0_PHYS + SZ_32M - 1,
        .flags          = IORESOURCE_MEM,
 };
 
index e422819889904124bf56e84fd577a90ba5c9bca9..209d79ef1d5f0c89fee06e368a4e157a3ded3548 100644 (file)
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
+#include <asm/arch/common.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/tc.h>
 #include <asm/arch/mux.h>
+#include <asm/arch/tc.h>
 #include <asm/arch/usb.h>
-#include <asm/arch/common.h>
 
 extern void omap_init_time(void);
 extern int omap_gpio_init(void);
@@ -86,6 +87,27 @@ static int __init ext_uart_init(void)
 }
 arch_initcall(ext_uart_init);
 
+static struct flash_platform_data voiceblue_flash_data = {
+       .map_name       = "cfi_probe",
+       .width          = 2,
+};
+
+static struct resource voiceblue_flash_resource = {
+       .start  = OMAP_CS0_PHYS,
+       .end    = OMAP_CS0_PHYS + SZ_32M - 1,
+       .flags  = IORESOURCE_MEM,
+};
+
+static struct platform_device voiceblue_flash_device = {
+       .name           = "omapflash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &voiceblue_flash_data,
+       },
+       .num_resources  = 1,
+       .resource       = &voiceblue_flash_resource,
+};
+
 static struct resource voiceblue_smc91x_resources[] = {
        [0] = {
                .start  = OMAP_CS2_PHYS + 0x300,
@@ -107,6 +129,7 @@ static struct platform_device voiceblue_smc91x_device = {
 };
 
 static struct platform_device *voiceblue_devices[] __initdata = {
+       &voiceblue_flash_device,
        &voiceblue_smc91x_device,
 };
 
@@ -119,8 +142,17 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
        .pins[2]        = 6,
 };
 
+static struct omap_mmc_config voiceblue_mmc_config __initdata = {
+       .mmc[0] = {
+               .enabled        = 1,
+               .power_pin      = 2,
+               .switch_pin     = -1,
+       },
+};
+
 static struct omap_board_config_kernel voiceblue_config[] = {
        { OMAP_TAG_USB, &voiceblue_usb_config },
+       { OMAP_TAG_MMC, &voiceblue_mmc_config },
 };
 
 static void __init voiceblue_init_irq(void)
@@ -131,9 +163,6 @@ static void __init voiceblue_init_irq(void)
 
 static void __init voiceblue_init(void)
 {
-       /* There is a good chance board is going up, so enable Power LED
-        * (it is connected through invertor) */
-       omap_writeb(0x00, OMAP_LPG1_LCR);
        /* Watchdog */
        omap_request_gpio(0);
        /* smc91x reset */
@@ -145,7 +174,6 @@ static void __init voiceblue_init(void)
        mdelay(50);     /* 50ms until PHY ready */
        /* smc91x interrupt pin */
        omap_request_gpio(8);
-       omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
        /* 16C554 reset*/
        omap_request_gpio(6);
        omap_set_gpio_direction(6, 0);
@@ -155,14 +183,19 @@ static void __init voiceblue_init(void)
        omap_request_gpio(13);
        omap_request_gpio(14);
        omap_request_gpio(15);
-       omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE);
-       omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE);
-       omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE);
-       omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE);
+       set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING);
+       set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
+       set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING);
+       set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING);
 
        platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
        omap_board_config = voiceblue_config;
        omap_board_config_size = ARRAY_SIZE(voiceblue_config);
+
+       /* There is a good chance board is going up, so enable power LED
+        * (it is connected through invertor) */
+       omap_writeb(0x00, OMAP_LPG1_LCR);
+       omap_writeb(0x00, OMAP_LPG1_PMR);       /* Disable clock */
 }
 
 static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
@@ -184,9 +217,9 @@ static int panic_event(struct notifier_block *this, unsigned long event,
        if (test_and_set_bit(MACHINE_PANICED, &machine_state))
                return NOTIFY_DONE;
 
-       /* Flash Power LED
-        * (TODO: Enable clock right way (enabled in bootloader already)) */
+       /* Flash power LED */
        omap_writeb(0x78, OMAP_LPG1_LCR);
+       omap_writeb(0x01, OMAP_LPG1_PMR);       /* Enable clock */
 
        return NOTIFY_DONE;
 }
@@ -195,15 +228,14 @@ static struct notifier_block panic_block = {
        .notifier_call  = panic_event,
 };
 
-static int __init setup_notifier(void)
+static int __init voiceblue_setup(void)
 {
        /* Setup panic notifier */
        notifier_chain_register(&panic_notifier_list, &panic_block);
 
        return 0;
 }
-
-postcore_initcall(setup_notifier);
+postcore_initcall(voiceblue_setup);
 
 static int wdt_gpio_state;
 
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
new file mode 100644 (file)
index 0000000..e8b3981
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * linux/arch/arm/mach-omap1/devices.c
+ *
+ * OMAP1 platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+#include <asm/mach/map.h>
+
+#include <asm/arch/tc.h>
+#include <asm/arch/board.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/gpio.h>
+
+
+static void omap_nop_release(struct device *dev)
+{
+        /* Nothing */
+}
+
+/*-------------------------------------------------------------------------*/
+
+#if    defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+
+#define        OMAP_I2C_BASE           0xfffb3800
+
+static struct resource i2c_resources[] = {
+       {
+               .start          = OMAP_I2C_BASE,
+               .end            = OMAP_I2C_BASE + 0x3f,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_I2C,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+/* DMA not used; works around erratum writing to non-empty i2c fifo */
+
+static struct platform_device omap_i2c_device = {
+        .name           = "i2c_omap",
+        .id             = -1,
+        .dev = {
+                .release        = omap_nop_release,
+        },
+       .num_resources  = ARRAY_SIZE(i2c_resources),
+       .resource       = i2c_resources,
+};
+
+static void omap_init_i2c(void)
+{
+       /* FIXME define and use a boot tag, in case of boards that
+        * either don't wire up I2C, or chips that mux it differently...
+        * it can include clocking and address info, maybe more.
+        */
+       omap_cfg_reg(I2C_SCL);
+       omap_cfg_reg(I2C_SDA);
+
+       (void) platform_device_register(&omap_i2c_device);
+}
+#else
+static inline void omap_init_i2c(void) {}
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+#if    defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE)
+
+static u64 irda_dmamask = 0xffffffff;
+
+static struct platform_device omap1610ir_device = {
+       .name = "omap1610-ir",
+       .id = -1,
+       .dev = {
+               .release        = omap_nop_release,
+               .dma_mask       = &irda_dmamask,
+       },
+};
+
+static void omap_init_irda(void)
+{
+       /* FIXME define and use a boot tag, members something like:
+        *  u8          uart;           // uart1, or uart3
+        * ... but driver only handles uart3 for now
+        *  s16         fir_sel;        // gpio for SIR vs FIR
+        * ... may prefer a callback for SIR/MIR/FIR mode select;
+        * while h2 uses a GPIO, H3 uses a gpio expander
+        */
+       if (machine_is_omap_h2()
+                       || machine_is_omap_h3())
+               (void) platform_device_register(&omap1610ir_device);
+}
+#else
+static inline void omap_init_irda(void) {}
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+#if    defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
+
+#define        OMAP_MMC1_BASE          0xfffb7800
+#define        OMAP_MMC2_BASE          0xfffb7c00      /* omap16xx only */
+
+static struct omap_mmc_conf mmc1_conf;
+
+static u64 mmc1_dmamask = 0xffffffff;
+
+static struct resource mmc1_resources[] = {
+       {
+               .start          = IO_ADDRESS(OMAP_MMC1_BASE),
+               .end            = IO_ADDRESS(OMAP_MMC1_BASE) + 0x7f,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_MMC,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device mmc_omap_device1 = {
+       .name           = "mmci-omap",
+       .id             = 1,
+       .dev = {
+               .release        = omap_nop_release,
+               .dma_mask       = &mmc1_dmamask,
+               .platform_data  = &mmc1_conf,
+       },
+       .num_resources  = ARRAY_SIZE(mmc1_resources),
+       .resource       = mmc1_resources,
+};
+
+#ifdef CONFIG_ARCH_OMAP16XX
+
+static struct omap_mmc_conf mmc2_conf;
+
+static u64 mmc2_dmamask = 0xffffffff;
+
+static struct resource mmc2_resources[] = {
+       {
+               .start          = IO_ADDRESS(OMAP_MMC2_BASE),
+               .end            = IO_ADDRESS(OMAP_MMC2_BASE) + 0x7f,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_1610_MMC2,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device mmc_omap_device2 = {
+       .name           = "mmci-omap",
+       .id             = 2,
+       .dev = {
+               .release        = omap_nop_release,
+               .dma_mask       = &mmc2_dmamask,
+               .platform_data  = &mmc2_conf,
+       },
+       .num_resources  = ARRAY_SIZE(mmc2_resources),
+       .resource       = mmc2_resources,
+};
+#endif
+
+static void __init omap_init_mmc(void)
+{
+       const struct omap_mmc_config    *mmc_conf;
+       const struct omap_mmc_conf      *mmc;
+
+       /* NOTE:  assumes MMC was never (wrongly) enabled */
+       mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
+       if (!mmc_conf)
+               return;
+
+       /* block 1 is always available and has just one pinout option */
+       mmc = &mmc_conf->mmc[0];
+       if (mmc->enabled) {
+               omap_cfg_reg(MMC_CMD);
+               omap_cfg_reg(MMC_CLK);
+               omap_cfg_reg(MMC_DAT0);
+               if (cpu_is_omap1710()) {
+                     omap_cfg_reg(M15_1710_MMC_CLKI);
+                     omap_cfg_reg(P19_1710_MMC_CMDDIR);
+                     omap_cfg_reg(P20_1710_MMC_DATDIR0);
+               }
+               if (mmc->wire4) {
+                       omap_cfg_reg(MMC_DAT1);
+                       /* NOTE:  DAT2 can be on W10 (here) or M15 */
+                       if (!mmc->nomux)
+                               omap_cfg_reg(MMC_DAT2);
+                       omap_cfg_reg(MMC_DAT3);
+               }
+               mmc1_conf = *mmc;
+               (void) platform_device_register(&mmc_omap_device1);
+       }
+
+#ifdef CONFIG_ARCH_OMAP16XX
+       /* block 2 is on newer chips, and has many pinout options */
+       mmc = &mmc_conf->mmc[1];
+       if (mmc->enabled) {
+               if (!mmc->nomux) {
+                       omap_cfg_reg(Y8_1610_MMC2_CMD);
+                       omap_cfg_reg(Y10_1610_MMC2_CLK);
+                       omap_cfg_reg(R18_1610_MMC2_CLKIN);
+                       omap_cfg_reg(W8_1610_MMC2_DAT0);
+                       if (mmc->wire4) {
+                               omap_cfg_reg(V8_1610_MMC2_DAT1);
+                               omap_cfg_reg(W15_1610_MMC2_DAT2);
+                               omap_cfg_reg(R10_1610_MMC2_DAT3);
+                       }
+
+                       /* These are needed for the level shifter */
+                       omap_cfg_reg(V9_1610_MMC2_CMDDIR);
+                       omap_cfg_reg(V5_1610_MMC2_DATDIR0);
+                       omap_cfg_reg(W19_1610_MMC2_DATDIR1);
+               }
+
+               /* Feedback clock must be set on OMAP-1710 MMC2 */
+               if (cpu_is_omap1710())
+                       omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
+                                    MOD_CONF_CTRL_1);
+               mmc2_conf = *mmc;
+               (void) platform_device_register(&mmc_omap_device2);
+       }
+#endif
+       return;
+}
+#else
+static inline void omap_init_mmc(void) {}
+#endif
+
+#if    defined(CONFIG_OMAP_RTC) || defined(CONFIG_OMAP_RTC)
+
+#define        OMAP_RTC_BASE           0xfffb4800
+
+static struct resource rtc_resources[] = {
+       {
+               .start          = OMAP_RTC_BASE,
+               .end            = OMAP_RTC_BASE + 0x5f,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = INT_RTC_TIMER,
+               .flags          = IORESOURCE_IRQ,
+       },
+       {
+               .start          = INT_RTC_ALARM,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device omap_rtc_device = {
+       .name           = "omap_rtc",
+       .id             = -1,
+       .dev = {
+               .release        = omap_nop_release,
+       },
+       .num_resources  = ARRAY_SIZE(rtc_resources),
+       .resource       = rtc_resources,
+};
+
+static void omap_init_rtc(void)
+{
+       (void) platform_device_register(&omap_rtc_device);
+}
+#else
+static inline void omap_init_rtc(void) {}
+#endif
+
+/*-------------------------------------------------------------------------*/
+
+#if    defined(CONFIG_OMAP16XX_WATCHDOG) || defined(CONFIG_OMAP16XX_WATCHDOG_MODULE)
+
+#define        OMAP_WDT_BASE           0xfffeb000
+
+static struct resource wdt_resources[] = {
+       {
+               .start          = OMAP_WDT_BASE,
+               .end            = OMAP_WDT_BASE + 0x4f,
+               .flags          = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device omap_wdt_device = {
+       .name      = "omap1610_wdt",
+       .id          = -1,
+       .dev = {
+               .release        = omap_nop_release,
+       },
+       .num_resources  = ARRAY_SIZE(wdt_resources),
+       .resource       = wdt_resources,
+};
+
+static void omap_init_wdt(void)
+{
+       (void) platform_device_register(&omap_wdt_device);
+}
+#else
+static inline void omap_init_wdt(void) {}
+#endif
+
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * This gets called after board-specific INIT_MACHINE, and initializes most
+ * on-chip peripherals accessible on this board (except for few like USB):
+ *
+ *  (a) Does any "standard config" pin muxing needed.  Board-specific
+ *     code will have muxed GPIO pins and done "nonstandard" setup;
+ *     that code could live in the boot loader.
+ *  (b) Populating board-specific platform_data with the data drivers
+ *     rely on to handle wiring variations.
+ *  (c) Creating platform devices as meaningful on this board and
+ *     with this kernel configuration.
+ *
+ * Claiming GPIOs, and setting their direction and initial values, is the
+ * responsibility of the device drivers.  So is responding to probe().
+ *
+ * Board-specific knowlege like creating devices or pin setup is to be
+ * kept out of drivers as much as possible.  In particular, pin setup
+ * may be handled by the boot loader, and drivers should expect it will
+ * normally have been done by the time they're probed.
+ */
+static int __init omap_init_devices(void)
+{
+       /* please keep these calls, and their implementations above,
+        * in alphabetical order so they're easier to sort through.
+        */
+       omap_init_i2c();
+       omap_init_irda();
+       omap_init_mmc();
+       omap_init_rtc();
+       omap_init_wdt();
+
+       return 0;
+}
+arch_initcall(omap_init_devices);
+
index c12a7833562570a4e88497c85b5381f3dd0ad080..aca2a120813ae9f95456749a36939d447019a292 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/fpga.c
+ * linux/arch/arm/mach-omap1/fpga.c
  *
  * Interrupt handler for OMAP-1510 Innovator FPGA
  *
@@ -181,7 +181,7 @@ void omap1510_fpga_init_irq(void)
         */
        omap_request_gpio(13);
        omap_set_gpio_direction(13, 1);
-       omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE);
+       set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
        set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
 }
 
index 207df0fe934dacbc3c65a9d6fe8e8a3932837c54..eb8261d7dead9b0eb99ae98887f6a540c79450f8 100644 (file)
@@ -19,6 +19,7 @@
 
 extern int clk_init(void);
 extern void omap_check_revision(void);
+extern void omap_sram_init(void);
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -32,7 +33,6 @@ static struct map_desc omap_io_desc[] __initdata = {
 static struct map_desc omap730_io_desc[] __initdata = {
  { OMAP730_DSP_BASE,    OMAP730_DSP_START,    OMAP730_DSP_SIZE,    MT_DEVICE },
  { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
- { OMAP730_SRAM_BASE,   OMAP730_SRAM_START,   OMAP730_SRAM_SIZE,   MT_DEVICE }
 };
 #endif
 
@@ -40,27 +40,13 @@ static struct map_desc omap730_io_desc[] __initdata = {
 static struct map_desc omap1510_io_desc[] __initdata = {
  { OMAP1510_DSP_BASE,    OMAP1510_DSP_START,    OMAP1510_DSP_SIZE,    MT_DEVICE },
  { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
- { OMAP1510_SRAM_BASE,   OMAP1510_SRAM_START,   OMAP1510_SRAM_SIZE,   MT_DEVICE }
 };
 #endif
 
 #if defined(CONFIG_ARCH_OMAP16XX)
-static struct map_desc omap1610_io_desc[] __initdata = {
+static struct map_desc omap16xx_io_desc[] __initdata = {
  { OMAP16XX_DSP_BASE,    OMAP16XX_DSP_START,    OMAP16XX_DSP_SIZE,    MT_DEVICE },
  { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
- { OMAP16XX_SRAM_BASE,   OMAP16XX_SRAM_START,   OMAP1610_SRAM_SIZE,   MT_DEVICE }
-};
-
-static struct map_desc omap5912_io_desc[] __initdata = {
- { OMAP16XX_DSP_BASE,    OMAP16XX_DSP_START,    OMAP16XX_DSP_SIZE,    MT_DEVICE },
- { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
-/*
- * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
- * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
- * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
- * can be used.
- */
- { OMAP16XX_SRAM_BASE,   OMAP16XX_SRAM_START,   OMAP5912_SRAM_SIZE + 0x800,   MT_DEVICE }
 };
 #endif
 
@@ -86,14 +72,13 @@ static void __init _omap_map_io(void)
        }
 #endif
 #if defined(CONFIG_ARCH_OMAP16XX)
-       if (cpu_is_omap1610() || cpu_is_omap1710()) {
-               iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
-       }
-       if (cpu_is_omap5912()) {
-               iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
+       if (cpu_is_omap16xx()) {
+               iotable_init(omap16xx_io_desc, ARRAY_SIZE(omap16xx_io_desc));
        }
 #endif
 
+       omap_sram_init();
+
        /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
         * on a Posted Write in the TIPB Bridge".
         */
@@ -108,8 +93,9 @@ static void __init _omap_map_io(void)
 /*
  * This should only get called from board specific init
  */
-void omap_map_common_io(void)
+void __init omap_map_common_io(void)
 {
        if (!initialized)
                _omap_map_io();
 }
+
index afd5d67e4ae73625e25a88bcf93ef79b34323602..192ce6055faabb13f31c6e49c6c4b3b05b3dda9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/irq.c
+ * linux/arch/arm/mach-omap1/irq.c
  *
  * Interrupt handler for all OMAP boards
  *
index ec0d8285f243dcaf5885130c10cac1108b2ac448..be283cda63dda9f5817c0e9befce16d7e135974c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/leds-h2p2-debug.c
+ * linux/arch/arm/mach-omap1/leds-h2p2-debug.c
  *
  * Copyright 2003 by Texas Instruments Incorporated
  *
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/kernel_stat.h>
 #include <linux/sched.h>
+#include <linux/version.h>
 
 #include <asm/io.h>
 #include <asm/hardware.h>
index 8043b7d0f66e7008afc755051a959cc80275744d..c8ffd1ddcdedff180bfc682560419236a16568bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/leds-innovator.c
+ * linux/arch/arm/mach-omap1/leds-innovator.c
  */
 #include <linux/config.h>
 #include <linux/init.h>
index 4a0e8b9d4fc37d5748e067c01ff0b84a59d1e1d2..2c8bda847c186e3a47ecf8518000bc1d8406dd91 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/leds-osk.c
+ * linux/arch/arm/mach-omap1/leds-osk.c
  *
  * LED driver for OSK, and optionally Mistral QVGA, boards
  */
@@ -64,7 +64,7 @@ static void tps_work(void *unused)
 
 static DECLARE_WORK(work, tps_work, NULL);
 
-#ifdef CONFIG_FB_OMAP
+#ifdef CONFIG_OMAP_OSK_MISTRAL
 
 /* For now, all system indicators require the Mistral board, since that
  * LED can be manipulated without a task context.  This LED is either red,
@@ -127,7 +127,7 @@ void osk_leds_event(led_event_t evt)
                hw_led_state = 0;
                break;
 
-#ifdef CONFIG_FB_OMAP
+#ifdef CONFIG_OMAP_OSK_MISTRAL
 
        case led_timer:
                hw_led_state ^= TIMER_LED;
@@ -144,7 +144,7 @@ void osk_leds_event(led_event_t evt)
                mistral_setled();
                break;
 
-#endif /* CONFIG_FB_OMAP */
+#endif /* CONFIG_OMAP_OSK_MISTRAL */
 
        /* "green" == tps LED1 (leftmost, normally power-good)
         * works only with DC adapter, not on battery power!
index 8ab21fe98e1bc388c0e3a40a4b83bb919a88c622..5c6b1bb6e722deda5bf715e5435498b2846c7228 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/leds.c
+ * linux/arch/arm/mach-omap1/leds.c
  *
  * OMAP LEDs dispatcher
  */
@@ -20,7 +20,9 @@ omap_leds_init(void)
        if (machine_is_omap_innovator())
                leds_event = innovator_leds_event;
 
-       else if (machine_is_omap_h2() || machine_is_omap_perseus2())
+       else if (machine_is_omap_h2()
+                       || machine_is_omap_h3()
+                       || machine_is_omap_perseus2())
                leds_event = h2p2_dbg_leds_event;
 
        else if (machine_is_omap_osk())
@@ -30,8 +32,12 @@ omap_leds_init(void)
                return -1;
 
        if (machine_is_omap_h2()
+                       || machine_is_omap_h3()
                        || machine_is_omap_perseus2()
-                       || machine_is_omap_osk()) {
+#ifdef CONFIG_OMAP_OSK_MISTRAL
+                       || machine_is_omap_osk()
+#endif
+                       ) {
 
                /* LED1/LED2 pins can be used as GPIO (as done here), or by
                 * the LPG (works even in deep sleep!), to drive a bicolor
index 214e5d17c8b56eed98458405885ccaf573c7c318..e702e0cb899e251c40f77de2eeef64f1de1d6ced 100644 (file)
 
 #include <asm/arch/board.h>
 #include <asm/arch/mux.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/fpga.h>
+#ifdef CONFIG_PM
+#include <asm/arch/pm.h>
+#endif
 
 static struct clk * uart1_ck = NULL;
 static struct clk * uart2_ck = NULL;
@@ -193,6 +197,86 @@ void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
        }
 }
 
+#ifdef CONFIG_OMAP_SERIAL_WAKE
+
+static irqreturn_t omap_serial_wake_interrupt(int irq, void *dev_id,
+                                             struct pt_regs *regs)
+{
+       /* Need to do something with serial port right after wake-up? */
+       return IRQ_HANDLED;
+}
+
+/*
+ * Reroutes serial RX lines to GPIO lines for the duration of
+ * sleep to allow waking up the device from serial port even
+ * in deep sleep.
+ */
+void omap_serial_wake_trigger(int enable)
+{
+       if (!cpu_is_omap16xx())
+               return;
+
+       if (uart1_ck != NULL) {
+               if (enable)
+                       omap_cfg_reg(V14_16XX_GPIO37);
+               else
+                       omap_cfg_reg(V14_16XX_UART1_RX);
+       }
+       if (uart2_ck != NULL) {
+               if (enable)
+                       omap_cfg_reg(R9_16XX_GPIO18);
+               else
+                       omap_cfg_reg(R9_16XX_UART2_RX);
+       }
+       if (uart3_ck != NULL) {
+               if (enable)
+                       omap_cfg_reg(L14_16XX_GPIO49);
+               else
+                       omap_cfg_reg(L14_16XX_UART3_RX);
+       }
+}
+
+static void __init omap_serial_set_port_wakeup(int gpio_nr)
+{
+       int ret;
+
+       ret = omap_request_gpio(gpio_nr);
+       if (ret < 0) {
+               printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
+                      gpio_nr);
+               return;
+       }
+       omap_set_gpio_direction(gpio_nr, 1);
+       set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
+       ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
+                         0, "serial wakeup", NULL);
+       if (ret) {
+               omap_free_gpio(gpio_nr);
+               printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
+                      gpio_nr);
+               return;
+       }
+       enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr));
+}
+
+static int __init omap_serial_wakeup_init(void)
+{
+       if (!cpu_is_omap16xx())
+               return 0;
+
+       if (uart1_ck != NULL)
+               omap_serial_set_port_wakeup(37);
+       if (uart2_ck != NULL)
+               omap_serial_set_port_wakeup(18);
+       if (uart3_ck != NULL)
+               omap_serial_set_port_wakeup(49);
+
+       return 0;
+}
+late_initcall(omap_serial_wakeup_init);
+
+#endif /* CONFIG_OMAP_SERIAL_WAKE */
+
 static int __init omap_init(void)
 {
        return platform_device_register(&serial_device);
index d540539c9bbb7e23fd27e3d4272a481ce21f136a..191a9b1ee9b7168f1ef3b561b08f732e55b4c2bf 100644 (file)
@@ -247,13 +247,6 @@ unsigned long long sched_clock(void)
 #define OMAP_32K_TIMER_TCR             0x04
 
 #define OMAP_32K_TICKS_PER_HZ          (32768 / HZ)
-#if (32768 % HZ) != 0
-/* We cannot ignore modulo.
- * Potential error can be as high as several percent.
- */
-#define OMAP_32K_TICK_MODULO           (32768 % HZ)
-static unsigned modulo_count = 0; /* Counts 1/HZ units */
-#endif
 
 /*
  * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
@@ -296,13 +289,22 @@ static inline void omap_32k_timer_stop(void)
 }
 
 /*
- * Rounds down to nearest usec
+ * Rounds down to nearest usec. Note that this will overflow for larger values.
  */
 static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
 {
        return (ticks_32k * 5*5*5*5*5*5) >> 9;
 }
 
+/*
+ * Rounds down to nearest nsec.
+ */
+static inline unsigned long long
+omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
+{
+       return (unsigned long long) ticks_32k * 1000 * 5*5*5*5*5*5 >> 9;
+}
+
 static unsigned long omap_32k_last_tick = 0;
 
 /*
@@ -314,6 +316,15 @@ static unsigned long omap_32k_timer_gettimeoffset(void)
        return omap_32k_ticks_to_usecs(now - omap_32k_last_tick);
 }
 
+/*
+ * Returns current time from boot in nsecs. It's OK for this to wrap
+ * around for now, as it's just a relative time stamp.
+ */
+unsigned long long sched_clock(void)
+{
+       return omap_32k_ticks_to_nsecs(omap_32k_sync_timer_read());
+}
+
 /*
  * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
  * function is also called from other interrupts to remove latency
@@ -330,19 +341,6 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
        now = omap_32k_sync_timer_read();
 
        while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
-#ifdef OMAP_32K_TICK_MODULO
-               /* Modulo addition may put omap_32k_last_tick ahead of now
-                * and cause unwanted repetition of the while loop.
-                */
-               if (unlikely(now - omap_32k_last_tick == ~0))
-                       break;
-
-               modulo_count += OMAP_32K_TICK_MODULO;
-               if (modulo_count > HZ) {
-                       ++omap_32k_last_tick;
-                       modulo_count -= HZ;
-               }
-#endif
                omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
                timer_tick(regs);
        }
index 191788fb18d13a4f3adad73afd92a649c0c7ff21..b0208c9925764940db06976ec69665b66d7275e0 100644 (file)
 #include <asm/tlbflush.h>
 
 #ifdef CONFIG_CPU_CACHE_VIPT
+
+void flush_cache_mm(struct mm_struct *mm)
+{
+       if (cache_is_vivt()) {
+               if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
+                       __cpuc_flush_user_all();
+               return;
+       }
+
+       if (cache_is_vipt_aliasing()) {
+               asm(    "mcr    p15, 0, %0, c7, c14, 0\n"
+               "       mcr     p15, 0, %0, c7, c5, 0\n"
+               "       mcr     p15, 0, %0, c7, c10, 4"
+                   :
+                   : "r" (0)
+                   : "cc");
+       }
+}
+
+void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
+{
+       if (cache_is_vivt()) {
+               if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask))
+                       __cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
+                                               vma->vm_flags);
+               return;
+       }
+
+       if (cache_is_vipt_aliasing()) {
+               asm(    "mcr    p15, 0, %0, c7, c14, 0\n"
+               "       mcr     p15, 0, %0, c7, c5, 0\n"
+               "       mcr     p15, 0, %0, c7, c10, 4"
+                   :
+                   : "r" (0)
+                   : "cc");
+       }
+}
+
+void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
+{
+       if (cache_is_vivt()) {
+               if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
+                       unsigned long addr = user_addr & PAGE_MASK;
+                       __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
+               }
+               return;
+       }
+
+       if (cache_is_vipt_aliasing())
+               flush_pfn_alias(pfn, user_addr);
+}
+
 #define ALIAS_FLUSH_START      0xffff4000
 
 #define TOP_PTE(x)     pte_offset_kernel(top_pmd, x)
index 5d51b38bd70d2d0bdc86ed14ee613e3f4786c993..b22f003eaa6d782c02523685501a22753c28a50e 100644 (file)
@@ -1212,7 +1212,6 @@ config PCI_DIRECT
 config PCI_MMCONFIG
        bool
        depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
-       select ACPI_BOOT
        default y
 
 source "drivers/pci/pcie/Kconfig"
index ca07b95c06b82e6eeffd79fd3649b4c3ca22b8b5..6a431b9260190f52f45b5c463189b104f7e108b8 100644 (file)
@@ -131,8 +131,6 @@ CONFIG_SOFTWARE_SUSPEND=y
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_SLEEP=y
 CONFIG_ACPI_SLEEP_PROC_FS=y
 CONFIG_ACPI_AC=y
@@ -144,10 +142,8 @@ CONFIG_ACPI_THERMAL=y
 # CONFIG_ACPI_ASUS is not set
 # CONFIG_ACPI_TOSHIBA is not set
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_EC=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 # CONFIG_X86_PM_TIMER is not set
 
index 64682a0edacf5c54490fe5928c1ce716f82be522..f10de0f2c5e622258517b978afac886378a04333 100644 (file)
@@ -11,7 +11,7 @@ obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
 
 obj-y                          += cpu/
 obj-y                          += timers/
-obj-$(CONFIG_ACPI_BOOT)                += acpi/
+obj-$(CONFIG_ACPI)             += acpi/
 obj-$(CONFIG_X86_BIOS_REBOOT)  += reboot.o
 obj-$(CONFIG_MCA)              += mca.o
 obj-$(CONFIG_X86_MSR)          += msr.o
index 5e291a20c03d1c583bdfa0e20852e7a242280a97..267ca48e1b6c740cc63e86669ee0b992c627cd00 100644 (file)
@@ -1,4 +1,4 @@
-obj-$(CONFIG_ACPI_BOOT)                := boot.o
+obj-y                          := boot.o
 obj-$(CONFIG_X86_IO_APIC)      += earlyquirk.o
 obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
 
index 34ee500c26e59a4a992dd6c89dbb5cd68ae3bd92..a63351c085c66dceeafb990ba75214963fad1cea 100644 (file)
 
 #ifdef CONFIG_X86_64
 
-static inline void  acpi_madt_oem_check(char *oem_id, char *oem_table_id) { }
+static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+}
 extern void __init clustered_apic_check(void);
-static inline int ioapic_setup_disabled(void) { return 0; }
+static inline int ioapic_setup_disabled(void)
+{
+       return 0;
+}
+
 #include <asm/proto.h>
 
-#else  /* X86 */
+#else                          /* X86 */
 
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <mach_apic.h>
 #include <mach_mpparse.h>
-#endif /* CONFIG_X86_LOCAL_APIC */
+#endif                         /* CONFIG_X86_LOCAL_APIC */
 
-#endif /* X86 */
+#endif                         /* X86 */
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
                (!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
@@ -60,13 +66,8 @@ static inline int ioapic_setup_disabled(void) { return 0; }
 
 #define PREFIX                 "ACPI: "
 
-#ifdef CONFIG_ACPI_PCI
 int acpi_noirq __initdata;     /* skip ACPI IRQ initialization */
-int acpi_pci_disabled __initdata; /* skip ACPI PCI scan and IRQ initialization */
-#else
-int acpi_noirq __initdata = 1;
-int acpi_pci_disabled __initdata = 1;
-#endif
+int acpi_pci_disabled __initdata;      /* skip ACPI PCI scan and IRQ initialization */
 int acpi_ht __initdata = 1;    /* enable HT */
 
 int acpi_lapic;
@@ -88,7 +89,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
 
 #define MAX_MADT_ENTRIES       256
 u8 x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
-                       { [0 ... MAX_MADT_ENTRIES-1] = 0xff };
+    {[0 ... MAX_MADT_ENTRIES - 1] = 0xff };
 EXPORT_SYMBOL(x86_acpiid_to_apicid);
 
 /* --------------------------------------------------------------------------
@@ -99,7 +100,7 @@ EXPORT_SYMBOL(x86_acpiid_to_apicid);
  * The default interrupt routing model is PIC (8259).  This gets
  * overriden if IOAPICs are enumerated (below).
  */
-enum acpi_irq_model_id         acpi_irq_model = ACPI_IRQ_MODEL_PIC;
+enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 
 #ifdef CONFIG_X86_64
 
@@ -107,7 +108,7 @@ enum acpi_irq_model_id              acpi_irq_model = ACPI_IRQ_MODEL_PIC;
 char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
 {
        if (!phys_addr || !size)
-       return NULL;
+               return NULL;
 
        if (phys_addr < (end_pfn_map << PAGE_SHIFT))
                return __va(phys_addr);
@@ -134,8 +135,8 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
        unsigned long base, offset, mapped_size;
        int idx;
 
-       if (phys + size < 8*1024*1024) 
-               return __va(phys); 
+       if (phys + size < 8 * 1024 * 1024)
+               return __va(phys);
 
        offset = phys & (PAGE_SIZE - 1);
        mapped_size = PAGE_SIZE - offset;
@@ -154,7 +155,7 @@ char *__acpi_map_table(unsigned long phys, unsigned long size)
                mapped_size += PAGE_SIZE;
        }
 
-       return ((unsigned char *) base + offset);
+       return ((unsigned char *)base + offset);
 }
 #endif
 
@@ -172,7 +173,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
        if (!phys_addr || !size)
                return -EINVAL;
 
-       mcfg = (struct acpi_table_mcfg *) __acpi_map_table(phys_addr, size);
+       mcfg = (struct acpi_table_mcfg *)__acpi_map_table(phys_addr, size);
        if (!mcfg) {
                printk(KERN_WARNING PREFIX "Unable to map MCFG\n");
                return -ENODEV;
@@ -209,20 +210,17 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
 
        return 0;
 }
-#endif /* CONFIG_PCI_MMCONFIG */
+#endif                         /* CONFIG_PCI_MMCONFIG */
 
 #ifdef CONFIG_X86_LOCAL_APIC
-static int __init
-acpi_parse_madt (
-       unsigned long           phys_addr,
-       unsigned long           size)
+static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
-       struct acpi_table_madt  *madt = NULL;
+       struct acpi_table_madt *madt = NULL;
 
        if (!phys_addr || !size)
                return -EINVAL;
 
-       madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size);
+       madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
        if (!madt) {
                printk(KERN_WARNING PREFIX "Unable to map MADT\n");
                return -ENODEV;
@@ -232,22 +230,20 @@ acpi_parse_madt (
                acpi_lapic_addr = (u64) madt->lapic_address;
 
                printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
-                       madt->lapic_address);
+                      madt->lapic_address);
        }
 
        acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
-       
+
        return 0;
 }
 
-
 static int __init
-acpi_parse_lapic (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
 {
-       struct acpi_table_lapic *processor = NULL;
+       struct acpi_table_lapic *processor = NULL;
 
-       processor = (struct acpi_table_lapic*) header;
+       processor = (struct acpi_table_lapic *)header;
 
        if (BAD_MADT_ENTRY(processor, end))
                return -EINVAL;
@@ -260,20 +256,19 @@ acpi_parse_lapic (
 
        x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
 
-       mp_register_lapic (
-               processor->id,                                     /* APIC ID */
-               processor->flags.enabled);                        /* Enabled? */
+       mp_register_lapic(processor->id,        /* APIC ID */
+                         processor->flags.enabled);    /* Enabled? */
 
        return 0;
 }
 
 static int __init
-acpi_parse_lapic_addr_ovr (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
+                         const unsigned long end)
 {
        struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
 
-       lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header;
+       lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header;
 
        if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
                return -EINVAL;
@@ -284,12 +279,11 @@ acpi_parse_lapic_addr_ovr (
 }
 
 static int __init
-acpi_parse_lapic_nmi (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_lapic_nmi *lapic_nmi = NULL;
 
-       lapic_nmi = (struct acpi_table_lapic_nmi*) header;
+       lapic_nmi = (struct acpi_table_lapic_nmi *)header;
 
        if (BAD_MADT_ENTRY(lapic_nmi, end))
                return -EINVAL;
@@ -302,37 +296,32 @@ acpi_parse_lapic_nmi (
        return 0;
 }
 
+#endif                         /*CONFIG_X86_LOCAL_APIC */
 
-#endif /*CONFIG_X86_LOCAL_APIC*/
-
-#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
+#ifdef CONFIG_X86_IO_APIC
 
 static int __init
-acpi_parse_ioapic (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_ioapic *ioapic = NULL;
 
-       ioapic = (struct acpi_table_ioapic*) header;
+       ioapic = (struct acpi_table_ioapic *)header;
 
        if (BAD_MADT_ENTRY(ioapic, end))
                return -EINVAL;
+
        acpi_table_print_madt_entry(header);
 
-       mp_register_ioapic (
-               ioapic->id,
-               ioapic->address,
-               ioapic->global_irq_base);
+       mp_register_ioapic(ioapic->id,
+                          ioapic->address, ioapic->global_irq_base);
+
        return 0;
 }
 
 /*
  * Parse Interrupt Source Override for the ACPI SCI
  */
-static void
-acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
+static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
 {
        if (trigger == 0)       /* compatible SCI trigger is level */
                trigger = 3;
@@ -348,7 +337,7 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
                polarity = acpi_sci_flags.polarity;
 
        /*
-        * mp_config_acpi_legacy_irqs() already setup IRQs < 16
+        * mp_config_acpi_legacy_irqs() already setup IRQs < 16
         * If GSI is < 16, this will update its flags,
         * else it will create a new mp_irqs[] entry.
         */
@@ -363,12 +352,12 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
 }
 
 static int __init
-acpi_parse_int_src_ovr (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_int_src_ovr(acpi_table_entry_header * header,
+                      const unsigned long end)
 {
        struct acpi_table_int_src_ovr *intsrc = NULL;
 
-       intsrc = (struct acpi_table_int_src_ovr*) header;
+       intsrc = (struct acpi_table_int_src_ovr *)header;
 
        if (BAD_MADT_ENTRY(intsrc, end))
                return -EINVAL;
@@ -377,33 +366,30 @@ acpi_parse_int_src_ovr (
 
        if (intsrc->bus_irq == acpi_fadt.sci_int) {
                acpi_sci_ioapic_setup(intsrc->global_irq,
-                       intsrc->flags.polarity, intsrc->flags.trigger);
+                                     intsrc->flags.polarity,
+                                     intsrc->flags.trigger);
                return 0;
        }
 
        if (acpi_skip_timer_override &&
-               intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
-                       printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
-                       return 0;
+           intsrc->bus_irq == 0 && intsrc->global_irq == 2) {
+               printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
+               return 0;
        }
 
-       mp_override_legacy_irq (
-               intsrc->bus_irq,
-               intsrc->flags.polarity,
-               intsrc->flags.trigger,
-               intsrc->global_irq);
+       mp_override_legacy_irq(intsrc->bus_irq,
+                              intsrc->flags.polarity,
+                              intsrc->flags.trigger, intsrc->global_irq);
 
        return 0;
 }
 
-
 static int __init
-acpi_parse_nmi_src (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_nmi_src *nmi_src = NULL;
 
-       nmi_src = (struct acpi_table_nmi_src*) header;
+       nmi_src = (struct acpi_table_nmi_src *)header;
 
        if (BAD_MADT_ENTRY(nmi_src, end))
                return -EINVAL;
@@ -415,9 +401,7 @@ acpi_parse_nmi_src (
        return 0;
 }
 
-#endif /* CONFIG_X86_IO_APIC */
-
-#ifdef CONFIG_ACPI_BUS
+#endif                         /* CONFIG_X86_IO_APIC */
 
 /*
  * acpi_pic_sci_set_trigger()
@@ -433,8 +417,7 @@ acpi_parse_nmi_src (
  * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
  */
 
-void __init
-acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
+void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
 {
        unsigned int mask = 1 << irq;
        unsigned int old, new;
@@ -454,10 +437,10 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
         * routing tables..
         */
        switch (trigger) {
-       case 1: /* Edge - clear */
+       case 1:         /* Edge - clear */
                new &= ~mask;
                break;
-       case 3: /* Level - set */
+       case 3:         /* Level - set */
                new |= mask;
                break;
        }
@@ -470,21 +453,22 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
        outb(new >> 8, 0x4d1);
 }
 
-
-#endif /* CONFIG_ACPI_BUS */
-
 int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 {
 #ifdef CONFIG_X86_IO_APIC
        if (use_pci_vector() && !platform_legacy_irq(gsi))
-               *irq = IO_APIC_VECTOR(gsi);
+               *irq = IO_APIC_VECTOR(gsi);
        else
 #endif
                *irq = gsi;
        return 0;
 }
 
-unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
+/*
+ * success: return IRQ number (>=0)
+ * failure: return < 0
+ */
+int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
 {
        unsigned int irq;
        unsigned int plat_gsi = gsi;
@@ -497,7 +481,7 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
                extern void eisa_set_level_irq(unsigned int irq);
 
                if (edge_level == ACPI_LEVEL_SENSITIVE)
-                               eisa_set_level_irq(gsi);
+                       eisa_set_level_irq(gsi);
        }
 #endif
 
@@ -509,60 +493,58 @@ unsigned int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
        acpi_gsi_to_irq(plat_gsi, &irq);
        return irq;
 }
+
 EXPORT_SYMBOL(acpi_register_gsi);
 
 /*
  *  ACPI based hotplug support for CPU
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-int
-acpi_map_lsapic(acpi_handle handle, int *pcpu)
+int acpi_map_lsapic(acpi_handle handle, int *pcpu)
 {
        /* TBD */
        return -EINVAL;
 }
-EXPORT_SYMBOL(acpi_map_lsapic);
 
+EXPORT_SYMBOL(acpi_map_lsapic);
 
-int
-acpi_unmap_lsapic(int cpu)
+int acpi_unmap_lsapic(int cpu)
 {
        /* TBD */
        return -EINVAL;
 }
+
 EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+#endif                         /* CONFIG_ACPI_HOTPLUG_CPU */
 
-int
-acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
+int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
 {
        /* TBD */
        return -EINVAL;
 }
+
 EXPORT_SYMBOL(acpi_register_ioapic);
 
-int
-acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
+int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
 {
        /* TBD */
        return -EINVAL;
 }
+
 EXPORT_SYMBOL(acpi_unregister_ioapic);
 
 static unsigned long __init
-acpi_scan_rsdp (
-       unsigned long           start,
-       unsigned long           length)
+acpi_scan_rsdp(unsigned long start, unsigned long length)
 {
-       unsigned long           offset = 0;
-       unsigned long           sig_len = sizeof("RSD PTR ") - 1;
+       unsigned long offset = 0;
+       unsigned long sig_len = sizeof("RSD PTR ") - 1;
 
        /*
         * Scan all 16-byte boundaries of the physical memory region for the
         * RSDP signature.
         */
        for (offset = 0; offset < length; offset += 16) {
-               if (strncmp((char *) (start + offset), "RSD PTR ", sig_len))
+               if (strncmp((char *)(start + offset), "RSD PTR ", sig_len))
                        continue;
                return (start + offset);
        }
@@ -575,20 +557,19 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
        struct acpi_table_sbf *sb;
 
        if (!phys_addr || !size)
-       return -EINVAL;
+               return -EINVAL;
 
-       sb = (struct acpi_table_sbf *) __acpi_map_table(phys_addr, size);
+       sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
        if (!sb) {
                printk(KERN_WARNING PREFIX "Unable to map SBF\n");
                return -ENODEV;
        }
 
-       sbf_port = sb->sbf_cmos; /* Save CMOS port */
+       sbf_port = sb->sbf_cmos;        /* Save CMOS port */
 
        return 0;
 }
 
-
 #ifdef CONFIG_HPET_TIMER
 
 static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
@@ -598,7 +579,7 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
        if (!phys || !size)
                return -EINVAL;
 
-       hpet_tbl = (struct acpi_table_hpet *) __acpi_map_table(phys, size);
+       hpet_tbl = (struct acpi_table_hpet *)__acpi_map_table(phys, size);
        if (!hpet_tbl) {
                printk(KERN_WARNING PREFIX "Unable to map HPET\n");
                return -ENODEV;
@@ -609,22 +590,21 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
                       "memory.\n");
                return -1;
        }
-
 #ifdef CONFIG_X86_64
-        vxtime.hpet_address = hpet_tbl->addr.addrl |
-                ((long) hpet_tbl->addr.addrh << 32);
+       vxtime.hpet_address = hpet_tbl->addr.addrl |
+           ((long)hpet_tbl->addr.addrh << 32);
 
-        printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
-               hpet_tbl->id, vxtime.hpet_address);
-#else  /* X86 */
+       printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
+              hpet_tbl->id, vxtime.hpet_address);
+#else                          /* X86 */
        {
                extern unsigned long hpet_address;
 
                hpet_address = hpet_tbl->addr.addrl;
                printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
-                       hpet_tbl->id, hpet_address);
+                      hpet_tbl->id, hpet_address);
        }
-#endif /* X86 */
+#endif                         /* X86 */
 
        return 0;
 }
@@ -640,28 +620,25 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
 {
        struct fadt_descriptor_rev2 *fadt = NULL;
 
-       fadt = (struct fadt_descriptor_rev2*) __acpi_map_table(phys,size);
-       if(!fadt) {
+       fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
+       if (!fadt) {
                printk(KERN_WARNING PREFIX "Unable to map FADT\n");
                return 0;
        }
-
-#ifdef CONFIG_ACPI_INTERPRETER
        /* initialize sci_int early for INT_SRC_OVR MADT parsing */
        acpi_fadt.sci_int = fadt->sci_int;
-#endif
 
-#ifdef CONFIG_ACPI_BUS
        /* initialize rev and apic_phys_dest_mode for x86_64 genapic */
        acpi_fadt.revision = fadt->revision;
-       acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode;
-#endif
+       acpi_fadt.force_apic_physical_destination_mode =
+           fadt->force_apic_physical_destination_mode;
 
 #ifdef CONFIG_X86_PM_TIMER
        /* detect the location of the ACPI PM Timer */
        if (fadt->revision >= FADT2_REVISION_ID) {
                /* FADT rev. 2 */
-               if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO)
+               if (fadt->xpm_tmr_blk.address_space_id !=
+                   ACPI_ADR_SPACE_SYSTEM_IO)
                        return 0;
 
                pmtmr_ioport = fadt->xpm_tmr_blk.address;
@@ -670,16 +647,15 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
                pmtmr_ioport = fadt->V1_pm_tmr_blk;
        }
        if (pmtmr_ioport)
-               printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport);
+               printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
+                      pmtmr_ioport);
 #endif
        return 0;
 }
 
-
-unsigned long __init
-acpi_find_rsdp (void)
+unsigned long __init acpi_find_rsdp(void)
 {
-       unsigned long           rsdp_phys = 0;
+       unsigned long rsdp_phys = 0;
 
        if (efi_enabled) {
                if (efi.acpi20)
@@ -691,9 +667,9 @@ acpi_find_rsdp (void)
         * Scan memory looking for the RSDP signature. First search EBDA (low
         * memory) paragraphs and then search upper memory (E0000-FFFFF).
         */
-       rsdp_phys = acpi_scan_rsdp (0, 0x400);
+       rsdp_phys = acpi_scan_rsdp(0, 0x400);
        if (!rsdp_phys)
-               rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000);
+               rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
 
        return rsdp_phys;
 }
@@ -703,8 +679,7 @@ acpi_find_rsdp (void)
  * Parse LAPIC entries in MADT
  * returns 0 on success, < 0 on error
  */
-static int __init
-acpi_parse_madt_lapic_entries(void)
+static int __init acpi_parse_madt_lapic_entries(void)
 {
        int count;
 
@@ -713,28 +688,31 @@ acpi_parse_madt_lapic_entries(void)
         * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
         */
 
-       count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
+       count =
+           acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
+                                 acpi_parse_lapic_addr_ovr, 0);
        if (count < 0) {
-               printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
+               printk(KERN_ERR PREFIX
+                      "Error parsing LAPIC address override entry\n");
                return count;
        }
 
        mp_register_lapic_address(acpi_lapic_addr);
 
        count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
-                                      MAX_APICS);
-       if (!count) { 
+                                     MAX_APICS);
+       if (!count) {
                printk(KERN_ERR PREFIX "No LAPIC entries present\n");
                /* TBD: Cleanup to allow fallback to MPS */
                return -ENODEV;
-       }
-       else if (count < 0) {
+       } else if (count < 0) {
                printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
                /* TBD: Cleanup to allow fallback to MPS */
                return count;
        }
 
-       count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
+       count =
+           acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
        if (count < 0) {
                printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
                /* TBD: Cleanup to allow fallback to MPS */
@@ -742,15 +720,14 @@ acpi_parse_madt_lapic_entries(void)
        }
        return 0;
 }
-#endif /* CONFIG_X86_LOCAL_APIC */
+#endif                         /* CONFIG_X86_LOCAL_APIC */
 
-#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
+#ifdef CONFIG_X86_IO_APIC
 /*
  * Parse IOAPIC related entries in MADT
  * returns 0 on success, < 0 on error
  */
-static int __init
-acpi_parse_madt_ioapic_entries(void)
+static int __init acpi_parse_madt_ioapic_entries(void)
 {
        int count;
 
@@ -762,30 +739,34 @@ acpi_parse_madt_ioapic_entries(void)
         */
        if (acpi_disabled || acpi_noirq) {
                return -ENODEV;
-        }
+       }
 
        /*
-        * if "noapic" boot option, don't look for IO-APICs
+        * if "noapic" boot option, don't look for IO-APICs
         */
        if (skip_ioapic_setup) {
                printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
-                       "due to 'noapic' option.\n");
+                      "due to 'noapic' option.\n");
                return -ENODEV;
        }
 
-       count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
+       count =
+           acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
+                                 MAX_IO_APICS);
        if (!count) {
                printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
                return -ENODEV;
-       }
-       else if (count < 0) {
+       } else if (count < 0) {
                printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
                return count;
        }
 
-       count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
+       count =
+           acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
+                                 NR_IRQ_VECTORS);
        if (count < 0) {
-               printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
+               printk(KERN_ERR PREFIX
+                      "Error parsing interrupt source overrides entry\n");
                /* TBD: Cleanup to allow fallback to MPS */
                return count;
        }
@@ -800,7 +781,9 @@ acpi_parse_madt_ioapic_entries(void)
        /* Fill in identity legacy mapings where no override */
        mp_config_acpi_legacy_irqs();
 
-       count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
+       count =
+           acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
+                                 NR_IRQ_VECTORS);
        if (count < 0) {
                printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
                /* TBD: Cleanup to allow fallback to MPS */
@@ -814,11 +797,9 @@ static inline int acpi_parse_madt_ioapic_entries(void)
 {
        return -1;
 }
-#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
+#endif /* !CONFIG_X86_IO_APIC */
 
-
-static void __init
-acpi_process_madt(void)
+static void __init acpi_process_madt(void)
 {
 #ifdef CONFIG_X86_LOCAL_APIC
        int count, error;
@@ -853,7 +834,8 @@ acpi_process_madt(void)
                        /*
                         * Dell Precision Workstation 410, 610 come here.
                         */
-                       printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n");
+                       printk(KERN_ERR PREFIX
+                              "Invalid BIOS MADT, disabling ACPI\n");
                        disable_acpi();
                }
        }
@@ -865,7 +847,6 @@ extern int acpi_force;
 
 #ifdef __i386__
 
-#ifdef CONFIG_ACPI_PCI
 static int __init disable_acpi_irq(struct dmi_system_id *d)
 {
        if (!acpi_force) {
@@ -885,12 +866,11 @@ static int __init disable_acpi_pci(struct dmi_system_id *d)
        }
        return 0;
 }
-#endif
 
 static int __init dmi_disable_acpi(struct dmi_system_id *d)
 {
        if (!acpi_force) {
-               printk(KERN_NOTICE "%s detected: acpi off\n",d->ident);
+               printk(KERN_NOTICE "%s detected: acpi off\n", d->ident);
                disable_acpi();
        } else {
                printk(KERN_NOTICE
@@ -905,7 +885,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
 static int __init force_acpi_ht(struct dmi_system_id *d)
 {
        if (!acpi_force) {
-               printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident);
+               printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
+                      d->ident);
                disable_acpi();
                acpi_ht = 1;
        } else {
@@ -924,155 +905,155 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
         * Boxes that need ACPI disabled
         */
        {
-               .callback = dmi_disable_acpi,
-               .ident = "IBM Thinkpad",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
-                       DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
-               },
-       },
+        .callback = dmi_disable_acpi,
+        .ident = "IBM Thinkpad",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "2629H1G"),
+                    },
+        },
 
        /*
         * Boxes that need acpi=ht
         */
        {
-               .callback = force_acpi_ht,
-               .ident = "FSC Primergy T850",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "FSC Primergy T850",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "DELL GX240",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
-                       DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "DELL GX240",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
+                    DMI_MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "HP VISUALIZE NT Workstation",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "HP VISUALIZE NT Workstation",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "Compaq Workstation W8000",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "Compaq Workstation W8000",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "ASUS P4B266",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
-                       DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "ASUS P4B266",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                    DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "ASUS P2B-DS",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
-                       DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "ASUS P2B-DS",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                    DMI_MATCH(DMI_BOARD_NAME, "P2B-DS"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "ASUS CUR-DLS",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
-                       DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "ASUS CUR-DLS",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                    DMI_MATCH(DMI_BOARD_NAME, "CUR-DLS"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "ABIT i440BX-W83977",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
-                       DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "ABIT i440BX-W83977",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
+                    DMI_MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "IBM Bladecenter",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
-                       DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "IBM Bladecenter",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "IBM eServer xSeries 360",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
-                       DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "IBM eServer xSeries 360",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "IBM eserver xSeries 330",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
-                       DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
-               },
-       },
+        .callback = force_acpi_ht,
+        .ident = "IBM eserver xSeries 330",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
+                    },
+        },
        {
-               .callback = force_acpi_ht,
-               .ident = "IBM eserver xSeries 440",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
-               },
-       },
-
-#ifdef CONFIG_ACPI_PCI
+        .callback = force_acpi_ht,
+        .ident = "IBM eserver xSeries 440",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
+                    },
+        },
+
        /*
         * Boxes that need ACPI PCI IRQ routing disabled
         */
        {
-               .callback = disable_acpi_irq,
-               .ident = "ASUS A7V",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
-                       DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
-                       /* newer BIOS, Revision 1011, does work */
-                       DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"),
-               },
-       },
+        .callback = disable_acpi_irq,
+        .ident = "ASUS A7V",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
+                    DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
+                    /* newer BIOS, Revision 1011, does work */
+                    DMI_MATCH(DMI_BIOS_VERSION,
+                              "ASUS A7V ACPI BIOS Revision 1007"),
+                    },
+        },
 
        /*
         * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
         */
-       {       /* _BBN 0 bug */
-               .callback = disable_acpi_pci,
-               .ident = "ASUS PR-DLS",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
-                       DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
-                       DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"),
-                       DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
-               },
-       },
+       {                       /* _BBN 0 bug */
+        .callback = disable_acpi_pci,
+        .ident = "ASUS PR-DLS",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
+                    DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
+                    DMI_MATCH(DMI_BIOS_VERSION,
+                              "ASUS PR-DLS ACPI BIOS Revision 1010"),
+                    DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
+                    },
+        },
        {
-               .callback = disable_acpi_pci,
-               .ident = "Acer TravelMate 36x Laptop",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
-               },
-       },
-#endif
-       { }
+        .callback = disable_acpi_pci,
+        .ident = "Acer TravelMate 36x Laptop",
+        .matches = {
+                    DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
+                    },
+        },
+       {}
 };
 
-#endif /* __i386__ */
+#endif                         /* __i386__ */
 
 /*
  * acpi_boot_table_init() and acpi_boot_init()
@@ -1097,8 +1078,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
  *     !0: failure
  */
 
-int __init
-acpi_boot_table_init(void)
+int __init acpi_boot_table_init(void)
 {
        int error;
 
@@ -1111,7 +1091,7 @@ acpi_boot_table_init(void)
         * One exception: acpi=ht continues far enough to enumerate LAPICs
         */
        if (acpi_disabled && !acpi_ht)
-                return 1;
+               return 1;
 
        /* 
         * Initialize the ACPI boot-time table parser.
@@ -1121,7 +1101,6 @@ acpi_boot_table_init(void)
                disable_acpi();
                return error;
        }
-
 #ifdef __i386__
        check_acpi_pci();
 #endif
@@ -1145,7 +1124,6 @@ acpi_boot_table_init(void)
        return 0;
 }
 
-
 int __init acpi_boot_init(void)
 {
        /*
@@ -1153,7 +1131,7 @@ int __init acpi_boot_init(void)
         * One exception: acpi=ht continues far enough to enumerate LAPICs
         */
        if (acpi_disabled && !acpi_ht)
-                return 1;
+               return 1;
 
        acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
 
@@ -1171,4 +1149,3 @@ int __init acpi_boot_init(void)
 
        return 0;
 }
-
index 726a5ca4b1655c6449f8c56377e7cc6ca8f604ce..f1b9d2a46dab860c0cbf100e1bf6b9b0b220c024 100644 (file)
@@ -8,44 +8,44 @@
 #include <asm/pci-direct.h>
 #include <asm/acpi.h>
 
-static int __init check_bridge(int vendor, int device) 
+static int __init check_bridge(int vendor, int device)
 {
        /* According to Nvidia all timer overrides are bogus. Just ignore
           them all. */
-       if (vendor == PCI_VENDOR_ID_NVIDIA) { 
-               acpi_skip_timer_override = 1;           
+       if (vendor == PCI_VENDOR_ID_NVIDIA) {
+               acpi_skip_timer_override = 1;
        }
        return 0;
 }
-   
-void __init check_acpi_pci(void) 
-{ 
-       int num,slot,func; 
+
+void __init check_acpi_pci(void)
+{
+       int num, slot, func;
 
        /* Assume the machine supports type 1. If not it will 
           always read ffffffff and should not have any side effect. */
 
        /* Poor man's PCI discovery */
-       for (num = 0; num < 32; num++) { 
-               for (slot = 0; slot < 32; slot++) { 
-                       for (func = 0; func < 8; func++) { 
+       for (num = 0; num < 32; num++) {
+               for (slot = 0; slot < 32; slot++) {
+                       for (func = 0; func < 8; func++) {
                                u32 class;
                                u32 vendor;
-                               class = read_pci_config(num,slot,func,
+                               class = read_pci_config(num, slot, func,
                                                        PCI_CLASS_REVISION);
                                if (class == 0xffffffff)
-                                       break; 
+                                       break;
 
                                if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
-                                       continue; 
-                               
-                               vendor = read_pci_config(num, slot, func, 
+                                       continue;
+
+                               vendor = read_pci_config(num, slot, func,
                                                         PCI_VENDOR_ID);
-                               
-                               if (check_bridge(vendor&0xffff, vendor >> 16))
-                                       return; 
-                       } 
-                       
+
+                               if (check_bridge(vendor & 0xffff, vendor >> 16))
+                                       return;
+                       }
+
                }
        }
 }
index c1af93032ff32bc02df16891819159e473efb78e..1cb2b186a3aff9ac0cbdc8f4540154a4f5e78e26 100644 (file)
@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
 
 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
 
-static void init_low_mapping(pgd_t *pgd, int pgd_limit)
+static void init_low_mapping(pgd_t * pgd, int pgd_limit)
 {
        int pgd_ofs = 0;
 
-       while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
-               set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD));
+       while ((pgd_ofs < pgd_limit)
+              && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
+               set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
                pgd_ofs++, pgd++;
        }
        flush_tlb_all();
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
  * Create an identity mapped page table and copy the wakeup routine to
  * low memory.
  */
-int acpi_save_state_mem (void)
+int acpi_save_state_mem(void)
 {
        if (!acpi_wakeup_address)
                return 1;
        init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
-       memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+       memcpy((void *)acpi_wakeup_address, &wakeup_start,
+              &wakeup_end - &wakeup_start);
        acpi_copy_wakeup_routine(acpi_wakeup_address);
 
        return 0;
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
 /*
  * acpi_restore_state - undo effects of acpi_save_state_mem
  */
-void acpi_restore_state_mem (void)
+void acpi_restore_state_mem(void)
 {
        zap_low_mappings();
 }
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
 void __init acpi_reserve_bootmem(void)
 {
        if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
-               printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n");
+               printk(KERN_ERR
+                      "ACPI: Wakeup code way too big, S3 disabled.\n");
                return;
        }
 
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
        return 1;
 }
 
-
 __setup("acpi_sleep=", acpi_sleep_setup);
 
-
 static __init int reset_videomode_after_s3(struct dmi_system_id *d)
 {
        acpi_video_flags |= 2;
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
 }
 
 static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
-       {       /* Reset video mode after returning from ACPI S3 sleep */
-               .callback = reset_videomode_after_s3,
-               .ident = "Toshiba Satellite 4030cdt",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
-               },
-       },
-       { }
+       {                       /* Reset video mode after returning from ACPI S3 sleep */
+        .callback = reset_videomode_after_s3,
+        .ident = "Toshiba Satellite 4030cdt",
+        .matches = {
+                    DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
+                    },
+        },
+       {}
 };
 
 static int __init acpisleep_dmi_init(void)
index 60a9e54dd20ee25d223385d2fcc47c7858a5893b..822c8ce9d1f19374618ffa9c633d560dc1833f21 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/cpufreq.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/compiler.h>
 #include <asm/io.h>
 #include <asm/delay.h>
 #include <asm/uaccess.h>
@@ -57,6 +58,8 @@ static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
 
 static struct cpufreq_driver acpi_cpufreq_driver;
 
+static unsigned int acpi_pstate_strict;
+
 static int
 acpi_processor_write_port(
        u16     port,
@@ -163,34 +166,44 @@ acpi_processor_set_performance (
        }
 
        /*
-        * Then we read the 'status_register' and compare the value with the
-        * target state's 'status' to make sure the transition was successful.
-        * Note that we'll poll for up to 1ms (100 cycles of 10us) before
-        * giving up.
+        * Assume the write went through when acpi_pstate_strict is not used.
+        * As read status_register is an expensive operation and there 
+        * are no specific error cases where an IO port write will fail.
         */
-
-       port = data->acpi_data.status_register.address;
-       bit_width = data->acpi_data.status_register.bit_width;
-
-       dprintk("Looking for 0x%08x from port 0x%04x\n",
-               (u32) data->acpi_data.states[state].status, port);
-
-       for (i=0; i<100; i++) {
-               ret = acpi_processor_read_port(port, bit_width, &value);
-               if (ret) {      
-                       dprintk("Invalid port width 0x%04x\n", bit_width);
-                       retval = ret;
-                       goto migrate_end;
+       if (acpi_pstate_strict) {
+               /* Then we read the 'status_register' and compare the value 
+                * with the target state's 'status' to make sure the 
+                * transition was successful.
+                * Note that we'll poll for up to 1ms (100 cycles of 10us) 
+                * before giving up.
+                */
+
+               port = data->acpi_data.status_register.address;
+               bit_width = data->acpi_data.status_register.bit_width;
+
+               dprintk("Looking for 0x%08x from port 0x%04x\n",
+                       (u32) data->acpi_data.states[state].status, port);
+
+               for (i=0; i<100; i++) {
+                       ret = acpi_processor_read_port(port, bit_width, &value);
+                       if (ret) {      
+                               dprintk("Invalid port width 0x%04x\n", bit_width);
+                               retval = ret;
+                               goto migrate_end;
+                       }
+                       if (value == (u32) data->acpi_data.states[state].status)
+                               break;
+                       udelay(10);
                }
-               if (value == (u32) data->acpi_data.states[state].status)
-                       break;
-               udelay(10);
+       } else {
+               i = 0;
+               value = (u32) data->acpi_data.states[state].status;
        }
 
        /* notify cpufreq */
        cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE);
 
-       if (value != (u32) data->acpi_data.states[state].status) {
+       if (unlikely(value != (u32) data->acpi_data.states[state].status)) {
                unsigned int tmp = cpufreq_freqs.new;
                cpufreq_freqs.new = cpufreq_freqs.old;
                cpufreq_freqs.old = tmp;
@@ -537,6 +550,8 @@ acpi_cpufreq_exit (void)
        return;
 }
 
+module_param(acpi_pstate_strict, uint, 0644);
+MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes.");
 
 late_initcall(acpi_cpufreq_init);
 module_exit(acpi_cpufreq_exit);
index 0e727e6da5c981743f66bf4fdf74a925f0482b7f..889eda2d7b17db55bcaee783424622b6c38079b1 100644 (file)
@@ -2423,7 +2423,7 @@ device_initcall(ioapic_init_sysfs);
                           ACPI-based IOAPIC Configuration
    -------------------------------------------------------------------------- */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 int __init io_apic_get_unique_id (int ioapic, int apic_id)
 {
@@ -2577,4 +2577,4 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
        return 0;
 }
 
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /* CONFIG_ACPI */
index 5d0b9a8fc43dc1e1b1f1da28b560b24c5552abca..cafaeffe381857bd19de265957f9782496063f48 100644 (file)
@@ -668,8 +668,6 @@ void __init get_smp_config (void)
        struct intel_mp_floating *mpf = mpf_found;
 
        /*
-        * ACPI may be used to obtain the entire SMP configuration or just to 
-        * enumerate/configure processors (CONFIG_ACPI_BOOT).  Note that 
         * ACPI supports both logical (e.g. Hyper-Threading) and physical 
         * processors, where MPS only supports physical.
         */
@@ -825,7 +823,7 @@ void __init find_smp_config (void)
                             ACPI-based MP Configuration
    -------------------------------------------------------------------------- */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 void __init mp_register_lapic_address (
        u64                     address)
@@ -871,7 +869,7 @@ void __init mp_register_lapic (
        MP_processor_info(&processor);
 }
 
-#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT))
+#ifdef CONFIG_X86_IO_APIC
 
 #define MP_ISA_BUS             0
 #define MP_MAX_IOAPIC_PIN      127
@@ -1086,11 +1084,9 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
         */
        static int              gsi_to_irq[MAX_GSI_NUM];
 
-#ifdef CONFIG_ACPI_BUS
        /* Don't set up the ACPI SCI because it's already set up */
        if (acpi_fadt.sci_int == gsi)
                return gsi;
-#endif
 
        ioapic = mp_find_ioapic(gsi);
        if (ioapic < 0) {
@@ -1133,13 +1129,11 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
                if (gsi < MAX_GSI_NUM) {
                        if (gsi > 15)
                                gsi = pci_irq++;
-#ifdef CONFIG_ACPI_BUS
                        /*
                         * Don't assign IRQ used by ACPI SCI
                         */
                        if (gsi == acpi_fadt.sci_int)
                                gsi = pci_irq++;
-#endif
                        gsi_to_irq[irq] = gsi;
                } else {
                        printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -1153,5 +1147,5 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
        return gsi;
 }
 
-#endif /*CONFIG_X86_IO_APIC && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)*/
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /* CONFIG_X86_IO_APIC */
+#endif /* CONFIG_ACPI */
index e29fd5aeaf8e4fa9dfa5f73281e17b7079c153f9..a659d274914cf26ccbc7431900d6423a391f66b1 100644 (file)
@@ -87,14 +87,14 @@ EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned long mmu_cr4_features;
 
-#ifdef CONFIG_ACPI_INTERPRETER
+#ifdef CONFIG_ACPI
        int acpi_disabled = 0;
 #else
        int acpi_disabled = 1;
 #endif
 EXPORT_SYMBOL(acpi_disabled);
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 int __initdata acpi_force = 0;
 extern acpi_interrupt_flags    acpi_sci_flags;
 #endif
@@ -798,7 +798,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
                }
 #endif
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
                /* "acpi=off" disables both ACPI table parsing and interpreter */
                else if (!memcmp(from, "acpi=off", 8)) {
                        disable_acpi();
@@ -854,7 +854,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
                else if (!memcmp(from, "noapic", 6))
                        disable_ioapic_setup();
 #endif /* CONFIG_X86_LOCAL_APIC */
-#endif /* CONFIG_ACPI_BOOT */
+#endif /* CONFIG_ACPI */
 
 #ifdef CONFIG_X86_LOCAL_APIC
                /* enable local APIC */
@@ -1579,7 +1579,7 @@ void __init setup_arch(char **cmdline_p)
        if (efi_enabled)
                efi_map_memmap();
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        /*
         * Parse the ACPI tables for possible boot-time SMP configuration.
         */
index 2000bdca2fc2cc3a93a9c9393012bd5db707d91d..dc6660511b075e2b10292c5343a0a2b65a3eddbc 100644 (file)
@@ -51,7 +51,7 @@ struct mip_reg                *host_reg;
 int                    mip_port;
 unsigned long          mip_addr, host_addr;
 
-#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT))
+#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI)
 
 /*
  * GSI override for ES7000 platforms.
@@ -73,7 +73,7 @@ es7000_rename_gsi(int ioapic, int gsi)
        return gsi;
 }
 
-#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)
+#endif /* (CONFIG_X86_IO_APIC) && (CONFIG_ACPI) */
 
 void __init
 setup_unisys ()
index 1bff03f36965aee0ae2dcebc134da9648a752566..ead6122dd06da24b956e689f61f620535689b5e1 100644 (file)
@@ -5,7 +5,7 @@ obj-$(CONFIG_PCI_MMCONFIG)      += mmconfig.o
 obj-$(CONFIG_PCI_DIRECT)       += direct.o
 
 pci-y                          := fixup.o
-pci-$(CONFIG_ACPI_PCI)         += acpi.o
+pci-$(CONFIG_ACPI)             += acpi.o
 pci-y                          += legacy.o irq.o
 
 pci-$(CONFIG_X86_VISWS)                := visws.o fixup.o
index 86348b68fda1a0e5621e48c1b3edb15f173f5cc0..326a2edc38349ca19f278521ab7068563a8c2c13 100644 (file)
@@ -1075,7 +1075,7 @@ static void pirq_penalize_isa_irq(int irq, int active)
 
 void pcibios_penalize_isa_irq(int irq, int active)
 {
-#ifdef CONFIG_ACPI_PCI
+#ifdef CONFIG_ACPI
        if (!acpi_noirq)
                acpi_penalize_isa_irq(irq, active);
        else
index 17b5dbf8c311909faa9a1871da94868e89bbb547..00151a8320d8f1732e147d64698e28e747c45833 100644 (file)
@@ -60,6 +60,7 @@ choice
 
 config IA64_GENERIC
        bool "generic"
+       select ACPI
        select NUMA
        select ACPI_NUMA
        select VIRTUAL_MEM_MAP
@@ -340,6 +341,7 @@ config IA64_PALINFO
 
 config ACPI_DEALLOCATE_IRQ
        bool
+       depends on ACPI
        depends on IOSAPIC && EXPERIMENTAL
        default y
 
@@ -351,38 +353,10 @@ endmenu
 
 menu "Power management and ACPI"
 
-config PM
-       bool "Power Management support"
-       depends on !IA64_HP_SIM
-       default y
-       help
-         "Power Management" means that parts of your computer are shut
-         off or put into a power conserving "sleep" mode if they are not
-         being used.  There are two competing standards for doing this: APM
-         and ACPI.  If you want to use either one, say Y here and then also
-         to the requisite support below.
-
-         Power Management is most important for battery powered laptop
-         computers; if you have a laptop, check out the Linux Laptop home
-         page on the WWW at <http://www.linux-on-laptops.com/> and the
-         Battery Powered Linux mini-HOWTO, available from
-         <http://www.tldp.org/docs.html#howto>.
-
-         Note that, even if you say N here, Linux on the x86 architecture
-         will issue the hlt instruction if nothing is to be done, thereby
-         sending the processor to sleep and saving power.
-
-config ACPI
-       bool
-       depends on !IA64_HP_SIM
-       default y
-
-if !IA64_HP_SIM
+source "kernel/power/Kconfig"
 
 source "drivers/acpi/Kconfig"
 
-endif
-
 if PM
 
 source "arch/ia64/kernel/cpufreq/Kconfig"
index b95fcf86ea00cf78f79a06847608f99fef54afbb..3b65cbb31b1dd491c0b24c4ca173c23722931e6d 100644 (file)
@@ -107,18 +107,12 @@ CONFIG_ACPI=y
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_VIDEO=m
 CONFIG_ACPI_FAN=m
 CONFIG_ACPI_PROCESSOR=m
 CONFIG_ACPI_THERMAL=m
-CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 
 #
index dccf35c60b941845351262e42e87361993760de3..1ca6e6e11b42f51c488bbf448f49df4eaf7e03dd 100644 (file)
@@ -130,19 +130,12 @@ CONFIG_ACPI=y
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 # CONFIG_ACPI_BUTTON is not set
-CONFIG_ACPI_VIDEO=m
-CONFIG_ACPI_HOTKEY=m
 # CONFIG_ACPI_FAN is not set
 # CONFIG_ACPI_PROCESSOR is not set
 CONFIG_ACPI_NUMA=y
-CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 # CONFIG_ACPI_CONTAINER is not set
 
index c853cfcd2d1123d6ef94271c0d8fab153e3c7c7a..3ec94a12eac0f9a70b3c9fa55f355ef5333aaf70 100644 (file)
@@ -128,20 +128,13 @@ CONFIG_ACPI=y
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_BUTTON=m
-# CONFIG_ACPI_VIDEO is not set
-# CONFIG_ACPI_HOTKEY is not set
 CONFIG_ACPI_FAN=m
 CONFIG_ACPI_PROCESSOR=m
 # CONFIG_ACPI_HOTPLUG_CPU is not set
 CONFIG_ACPI_THERMAL=m
-CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 # CONFIG_ACPI_CONTAINER is not set
 
index 88e8867fa8e82f65092a9e5e99e0f437a3f43191..d4cf73d124bce959ebb5e346a038de342bf56efa 100644 (file)
@@ -128,19 +128,12 @@ CONFIG_ACPI=y
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_BUTTON=y
-CONFIG_ACPI_VIDEO=m
-CONFIG_ACPI_HOTKEY=m
 CONFIG_ACPI_FAN=y
 CONFIG_ACPI_PROCESSOR=y
 CONFIG_ACPI_THERMAL=y
-CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 # CONFIG_ACPI_CONTAINER is not set
 
index 8444add763800905e441cd8feb7c2fea1b79770d..b6ec8d32c346ab8310574084a335ced4044f601f 100644 (file)
@@ -118,20 +118,14 @@ CONFIG_ACPI=y
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_VIDEO=m
 CONFIG_ACPI_FAN=m
 CONFIG_ACPI_PROCESSOR=m
 CONFIG_ACPI_HOTPLUG_CPU=y
 CONFIG_ACPI_THERMAL=m
 CONFIG_ACPI_NUMA=y
-CONFIG_ACPI_BLACKLIST_YEAR=0
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 CONFIG_ACPI_CONTAINER=m
 
index 2623df5e26330917da670c402280a463ed0bbb75..13a5b3b49bf869f0fac90186151f00a5296c34d2 100644 (file)
 #include <asm/acpi-ext.h>
 
 struct acpi_vendor_descriptor {
-       u8                              guid_id;
-       efi_guid_t                      guid;
+       u8 guid_id;
+       efi_guid_t guid;
 };
 
 struct acpi_vendor_info {
-       struct acpi_vendor_descriptor   *descriptor;
-       u8                              *data;
-       u32                             length;
+       struct acpi_vendor_descriptor *descriptor;
+       u8 *data;
+       u32 length;
 };
 
 acpi_status
 acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
 {
-       struct acpi_vendor_info *info = (struct acpi_vendor_info *) context;
+       struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
        struct acpi_resource_vendor *vendor;
        struct acpi_vendor_descriptor *descriptor;
        u32 length;
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
        if (resource->id != ACPI_RSTYPE_VENDOR)
                return AE_OK;
 
-       vendor = (struct acpi_resource_vendor *) &resource->data;
-       descriptor = (struct acpi_vendor_descriptor *) vendor->reserved;
+       vendor = (struct acpi_resource_vendor *)&resource->data;
+       descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
        if (vendor->length <= sizeof(*info->descriptor) ||
            descriptor->guid_id != info->descriptor->guid_id ||
            efi_guidcmp(descriptor->guid, info->descriptor->guid))
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
        if (!info->data)
                return AE_NO_MEMORY;
 
-       memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length);
+       memcpy(info->data,
+              vendor->reserved + sizeof(struct acpi_vendor_descriptor),
+              length);
        info->length = length;
        return AE_CTRL_TERMINATE;
 }
 
 acpi_status
-acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
-               u8 **data, u32 *length)
+acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
+                         u8 ** data, u32 * length)
 {
        struct acpi_vendor_info info;
 
        info.descriptor = id;
        info.data = NULL;
 
-       acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
+       acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
+                           &info);
        if (!info.data)
                return AE_NOT_FOUND;
 
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
 
 struct acpi_vendor_descriptor hp_ccsr_descriptor = {
        .guid_id = 2,
-       .guid    = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
+       .guid =
+           EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
+                    0x37, 0x0e, 0xad)
 };
 
-acpi_status
-hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
+acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
 {
        acpi_status status;
        u8 *data;
        u32 length;
 
-       status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
+       status =
+           acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
 
        if (ACPI_FAILURE(status) || length != 16)
                return AE_NOT_FOUND;
index 9609f243e5d05d2591393a66e1a542cb6058ecbc..318787c84ac0eda2ec0ae05a7dd2115c5d080f12 100644 (file)
@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
 #define MAX_SAPICS 256
-u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
-       { [0 ... MAX_SAPICS - 1] = -1 };
+u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0 ... MAX_SAPICS - 1] = -1 };
+
 EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
 
-const char *
-acpi_get_sysname (void)
+const char *acpi_get_sysname(void)
 {
 #ifdef CONFIG_IA64_GENERIC
        unsigned long rsdp_phys;
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
 
        rsdp_phys = acpi_find_rsdp();
        if (!rsdp_phys) {
-               printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n");
+               printk(KERN_ERR
+                      "ACPI 2.0 RSDP not found, default to \"dig\"\n");
                return "dig";
        }
 
-       rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
+       rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
        if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
-               printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
+               printk(KERN_ERR
+                      "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
                return "dig";
        }
 
-       xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
+       xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
        hdr = &xsdt->header;
        if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
-               printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
+               printk(KERN_ERR
+                      "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
                return "dig";
        }
 
        if (!strcmp(hdr->oem_id, "HP")) {
                return "hpzx1";
-       }
-       else if (!strcmp(hdr->oem_id, "SGI")) {
+       } else if (!strcmp(hdr->oem_id, "SGI")) {
                return "sn2";
        }
 
@@ -131,7 +132,7 @@ acpi_get_sysname (void)
 #endif
 }
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 #define ACPI_MAX_PLATFORM_INTERRUPTS   256
 
@@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
  * Interrupt routing API for device drivers.  Provides interrupt vector for
  * a generic platform event.  Currently only CPEI is implemented.
  */
-int
-acpi_request_vector (u32 int_type)
+int acpi_request_vector(u32 int_type)
 {
        int vector = -1;
 
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
                /* corrected platform error interrupt */
                vector = platform_intr_list[int_type];
        } else
-               printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
+               printk(KERN_ERR
+                      "acpi_request_vector(): invalid interrupt type\n");
        return vector;
 }
 
-char *
-__acpi_map_table (unsigned long phys_addr, unsigned long size)
+char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
 {
        return __va(phys_addr);
 }
@@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
                             Boot-time Table Parsing
    -------------------------------------------------------------------------- */
 
-static int                     total_cpus __initdata;
-static int                     available_cpus __initdata;
-struct acpi_table_madt *       acpi_madt __initdata;
-static u8                      has_8259;
-
+static int total_cpus __initdata;
+static int available_cpus __initdata;
+struct acpi_table_madt *acpi_madt __initdata;
+static u8 has_8259;
 
 static int __init
-acpi_parse_lapic_addr_ovr (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
+                         const unsigned long end)
 {
        struct acpi_table_lapic_addr_ovr *lapic;
 
-       lapic = (struct acpi_table_lapic_addr_ovr *) header;
+       lapic = (struct acpi_table_lapic_addr_ovr *)header;
 
        if (BAD_MADT_ENTRY(lapic, end))
                return -EINVAL;
@@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr (
        return 0;
 }
 
-
 static int __init
-acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_lsapic *lsapic;
 
-       lsapic = (struct acpi_table_lsapic *) header;
+       lsapic = (struct acpi_table_lsapic *)header;
 
        if (BAD_MADT_ENTRY(lsapic, end))
                return -EINVAL;
 
        if (lsapic->flags.enabled) {
 #ifdef CONFIG_SMP
-               smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
+               smp_boot_data.cpu_phys_id[available_cpus] =
+                   (lsapic->id << 8) | lsapic->eid;
 #endif
-               ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid;
+               ia64_acpiid_to_sapicid[lsapic->acpi_id] =
+                   (lsapic->id << 8) | lsapic->eid;
                ++available_cpus;
        }
 
@@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
        return 0;
 }
 
-
 static int __init
-acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_lapic_nmi *lacpi_nmi;
 
-       lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
+       lacpi_nmi = (struct acpi_table_lapic_nmi *)header;
 
        if (BAD_MADT_ENTRY(lacpi_nmi, end))
                return -EINVAL;
@@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
        return 0;
 }
 
-
 static int __init
-acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_iosapic *iosapic;
 
-       iosapic = (struct acpi_table_iosapic *) header;
+       iosapic = (struct acpi_table_iosapic *)header;
 
        if (BAD_MADT_ENTRY(iosapic, end))
                return -EINVAL;
@@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
        return iosapic_init(iosapic->address, iosapic->global_irq_base);
 }
 
-
 static int __init
-acpi_parse_plat_int_src (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_plat_int_src(acpi_table_entry_header * header,
+                       const unsigned long end)
 {
        struct acpi_table_plat_int_src *plintsrc;
        int vector;
 
-       plintsrc = (struct acpi_table_plat_int_src *) header;
+       plintsrc = (struct acpi_table_plat_int_src *)header;
 
        if (BAD_MADT_ENTRY(plintsrc, end))
                return -EINVAL;
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
                                                plintsrc->iosapic_vector,
                                                plintsrc->eid,
                                                plintsrc->id,
-                                               (plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-                                               (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+                                               (plintsrc->flags.polarity ==
+                                                1) ? IOSAPIC_POL_HIGH :
+                                               IOSAPIC_POL_LOW,
+                                               (plintsrc->flags.trigger ==
+                                                1) ? IOSAPIC_EDGE :
+                                               IOSAPIC_LEVEL);
 
        platform_intr_list[plintsrc->type] = vector;
        if (acpi_madt_rev > 1) {
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
        return 0;
 }
 
-
 unsigned int can_cpei_retarget(void)
 {
        extern int cpe_vector;
@@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void)
 }
 
 static int __init
-acpi_parse_int_src_ovr (
-       acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_int_src_ovr(acpi_table_entry_header * header,
+                      const unsigned long end)
 {
        struct acpi_table_int_src_ovr *p;
 
-       p = (struct acpi_table_int_src_ovr *) header;
+       p = (struct acpi_table_int_src_ovr *)header;
 
        if (BAD_MADT_ENTRY(p, end))
                return -EINVAL;
 
        iosapic_override_isa_irq(p->bus_irq, p->global_irq,
-                                (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-                                (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+                                (p->flags.polarity ==
+                                 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+                                (p->flags.trigger ==
+                                 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
        return 0;
 }
 
-
 static int __init
-acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
+acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
 {
        struct acpi_table_nmi_src *nmi_src;
 
-       nmi_src = (struct acpi_table_nmi_src*) header;
+       nmi_src = (struct acpi_table_nmi_src *)header;
 
        if (BAD_MADT_ENTRY(nmi_src, end))
                return -EINVAL;
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
        return 0;
 }
 
-static void __init
-acpi_madt_oem_check (char *oem_id, char *oem_table_id)
+static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
-       if (!strncmp(oem_id, "IBM", 3) &&
-           (!strncmp(oem_table_id, "SERMOW", 6))) {
+       if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
 
                /*
                 * Unfortunately ITC_DRIFT is not yet part of the
@@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
        }
 }
 
-static int __init
-acpi_parse_madt (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
        if (!phys_addr || !size)
                return -EINVAL;
 
-       acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
+       acpi_madt = (struct acpi_table_madt *)__va(phys_addr);
 
        acpi_madt_rev = acpi_madt->header.revision;
 
        /* remember the value for reference after free_initmem() */
 #ifdef CONFIG_ITANIUM
-       has_8259 = 1; /* Firmware on old Itanium systems is broken */
+       has_8259 = 1;           /* Firmware on old Itanium systems is broken */
 #else
        has_8259 = acpi_madt->flags.pcat_compat;
 #endif
@@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
        printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
 
        acpi_madt_oem_check(acpi_madt->header.oem_id,
-               acpi_madt->header.oem_table_id);
+                           acpi_madt->header.oem_table_id);
 
        return 0;
 }
 
-
 #ifdef CONFIG_ACPI_NUMA
 
 #undef SLIT_DEBUG
 
 #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
 
-static int __initdata srat_num_cpus;                   /* number of cpus */
+static int __initdata srat_num_cpus;   /* number of cpus */
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)       (set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)      (test_bit(bit,(void *)pxm_flag))
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
  * ACPI 2.0 SLIT (System Locality Information Table)
  * http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
  */
-void __init
-acpi_numa_slit_init (struct acpi_table_slit *slit)
+void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 {
        u32 len;
 
        len = sizeof(struct acpi_table_header) + 8
-               + slit->localities * slit->localities;
+           + slit->localities * slit->localities;
        if (slit->header.length != len) {
-               printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
+               printk(KERN_ERR
+                      "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
                       len, slit->header.length);
                memset(numa_slit, 10, sizeof(numa_slit));
                return;
@@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit)
 }
 
 void __init
-acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
+acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
 {
        /* record this node in proximity bitmap */
        pxm_bit_set(pa->proximity_domain);
 
-       node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid);
+       node_cpuid[srat_num_cpus].phys_id =
+           (pa->apic_id << 8) | (pa->lsapic_eid);
        /* nid should be overridden as logical node id later */
        node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
        srat_num_cpus++;
 }
 
 void __init
-acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
+acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
 {
        unsigned long paddr, size;
        u8 pxm;
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
        num_node_memblks++;
 }
 
-void __init
-acpi_numa_arch_fixup (void)
+void __init acpi_numa_arch_fixup(void)
 {
        int i, j, node_from, node_to;
 
@@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void)
        for (i = 0; i < srat_num_cpus; i++)
                node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
 
-       printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes());
-       printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
+       printk(KERN_INFO "Number of logical nodes in system = %d\n",
+              num_online_nodes());
+       printk(KERN_INFO "Number of memory chunks in system = %d\n",
+              num_node_memblks);
 
-       if (!slit_table) return;
+       if (!slit_table)
+               return;
        memset(numa_slit, -1, sizeof(numa_slit));
-       for (i=0; i<slit_table->localities; i++) {
+       for (i = 0; i < slit_table->localities; i++) {
                if (!pxm_bit_test(i))
                        continue;
                node_from = pxm_to_nid_map[i];
-               for (j=0; j<slit_table->localities; j++) {
+               for (j = 0; j < slit_table->localities; j++) {
                        if (!pxm_bit_test(j))
                                continue;
                        node_to = pxm_to_nid_map[j];
                        node_distance(node_from, node_to) =
-                               slit_table->entry[i*slit_table->localities + j];
+                           slit_table->entry[i * slit_table->localities + j];
                }
        }
 
@@ -556,36 +556,43 @@ acpi_numa_arch_fixup (void)
        printk("ACPI 2.0 SLIT locality table:\n");
        for_each_online_node(i) {
                for_each_online_node(j)
-                       printk("%03d ", node_distance(i,j));
+                   printk("%03d ", node_distance(i, j));
                printk("\n");
        }
 #endif
 }
-#endif /* CONFIG_ACPI_NUMA */
+#endif                         /* CONFIG_ACPI_NUMA */
 
-unsigned int
-acpi_register_gsi (u32 gsi, int edge_level, int active_high_low)
+/*
+ * success: return IRQ number (>=0)
+ * failure: return < 0
+ */
+int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
 {
        if (has_8259 && gsi < 16)
                return isa_irq_to_vector(gsi);
 
        return iosapic_register_intr(gsi,
-                       (active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-                       (edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+                                    (active_high_low ==
+                                     ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
+                                    IOSAPIC_POL_LOW,
+                                    (edge_level ==
+                                     ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
+                                    IOSAPIC_LEVEL);
 }
+
 EXPORT_SYMBOL(acpi_register_gsi);
 
 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
-void
-acpi_unregister_gsi (u32 gsi)
+void acpi_unregister_gsi(u32 gsi)
 {
        iosapic_unregister_intr(gsi);
 }
+
 EXPORT_SYMBOL(acpi_unregister_gsi);
-#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
+#endif                         /* CONFIG_ACPI_DEALLOCATE_IRQ */
 
-static int __init
-acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
 {
        struct acpi_table_header *fadt_header;
        struct fadt_descriptor_rev2 *fadt;
@@ -593,11 +600,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
        if (!phys_addr || !size)
                return -EINVAL;
 
-       fadt_header = (struct acpi_table_header *) __va(phys_addr);
+       fadt_header = (struct acpi_table_header *)__va(phys_addr);
        if (fadt_header->revision != 3)
-               return -ENODEV;         /* Only deal with ACPI 2.0 FADT */
+               return -ENODEV; /* Only deal with ACPI 2.0 FADT */
 
-       fadt = (struct fadt_descriptor_rev2 *) fadt_header;
+       fadt = (struct fadt_descriptor_rev2 *)fadt_header;
 
        if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
                acpi_kbd_controller_present = 0;
@@ -609,22 +616,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
        return 0;
 }
 
-
-unsigned long __init
-acpi_find_rsdp (void)
+unsigned long __init acpi_find_rsdp(void)
 {
        unsigned long rsdp_phys = 0;
 
        if (efi.acpi20)
                rsdp_phys = __pa(efi.acpi20);
        else if (efi.acpi)
-               printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n");
+               printk(KERN_WARNING PREFIX
+                      "v1.0/r0.71 tables no longer supported\n");
        return rsdp_phys;
 }
 
-
-int __init
-acpi_boot_init (void)
+int __init acpi_boot_init(void)
 {
 
        /*
@@ -642,31 +646,43 @@ acpi_boot_init (void)
 
        /* Local APIC */
 
-       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
-               printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
+       if (acpi_table_parse_madt
+           (ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
+               printk(KERN_ERR PREFIX
+                      "Error parsing LAPIC address override entry\n");
 
-       if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
-               printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
+       if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
+           < 1)
+               printk(KERN_ERR PREFIX
+                      "Error parsing MADT - no LAPIC entries\n");
 
-       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
+       if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0)
+           < 0)
                printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
 
        /* I/O APIC */
 
-       if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
-               printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
+       if (acpi_table_parse_madt
+           (ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
+               printk(KERN_ERR PREFIX
+                      "Error parsing MADT - no IOSAPIC entries\n");
 
        /* System-Level Interrupt Routing */
 
-       if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
-               printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
+       if (acpi_table_parse_madt
+           (ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src,
+            ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
+               printk(KERN_ERR PREFIX
+                      "Error parsing platform interrupt source entry\n");
 
-       if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
-               printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
+       if (acpi_table_parse_madt
+           (ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
+               printk(KERN_ERR PREFIX
+                      "Error parsing interrupt source overrides entry\n");
 
        if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
                printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
-  skip_madt:
+      skip_madt:
 
        /*
         * FADT says whether a legacy keyboard controller is present.
@@ -681,8 +697,9 @@ acpi_boot_init (void)
        if (available_cpus == 0) {
                printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
                printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
-               smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
-               available_cpus = 1; /* We've got at least one of these, no? */
+               smp_boot_data.cpu_phys_id[available_cpus] =
+                   hard_smp_processor_id();
+               available_cpus = 1;     /* We've got at least one of these, no? */
        }
        smp_boot_data.cpu_count = available_cpus;
 
@@ -691,8 +708,10 @@ acpi_boot_init (void)
        if (srat_num_cpus == 0) {
                int cpu, i = 1;
                for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
-                       if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
-                               node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
+                       if (smp_boot_data.cpu_phys_id[cpu] !=
+                           hard_smp_processor_id())
+                               node_cpuid[i++].phys_id =
+                                   smp_boot_data.cpu_phys_id[cpu];
        }
 # endif
 #endif
@@ -700,12 +719,12 @@ acpi_boot_init (void)
        build_cpu_to_node_map();
 #endif
        /* Make boot-up look pretty */
-       printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
+       printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
+              total_cpus);
        return 0;
 }
 
-int
-acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
+int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 {
        int vector;
 
@@ -726,11 +745,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
  */
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 static
-int
-acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
+int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
 {
 #ifdef CONFIG_ACPI_NUMA
-       int                     pxm_id;
+       int pxm_id;
 
        pxm_id = acpi_get_pxm(handle);
 
@@ -738,31 +756,28 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
         * Assuming that the container driver would have set the proximity
         * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
         */
-       node_cpuid[cpu].nid = (pxm_id < 0) ? 0:
-                       pxm_to_nid_map[pxm_id];
+       node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
 
-       node_cpuid[cpu].phys_id =  physid;
+       node_cpuid[cpu].phys_id = physid;
 #endif
-       return(0);
+       return (0);
 }
 
-
-int
-acpi_map_lsapic(acpi_handle handle, int *pcpu)
+int acpi_map_lsapic(acpi_handle handle, int *pcpu)
 {
-       struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        union acpi_object *obj;
        struct acpi_table_lsapic *lsapic;
        cpumask_t tmp_map;
        long physid;
        int cpu;
+
        if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
                return -EINVAL;
 
-       if (!buffer.length ||  !buffer.pointer)
+       if (!buffer.length || !buffer.pointer)
                return -EINVAL;
+
        obj = buffer.pointer;
        if (obj->type != ACPI_TYPE_BUFFER ||
            obj->buffer.length < sizeof(*lsapic)) {
@@ -778,7 +793,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
                return -EINVAL;
        }
 
-       physid = ((lsapic->id <<8) | (lsapic->eid));
+       physid = ((lsapic->id << 8) | (lsapic->eid));
 
        acpi_os_free(buffer.pointer);
        buffer.length = ACPI_ALLOCATE_BUFFER;
@@ -786,50 +801,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
 
        cpus_complement(tmp_map, cpu_present_map);
        cpu = first_cpu(tmp_map);
-       if(cpu >= NR_CPUS)
+       if (cpu >= NR_CPUS)
                return -EINVAL;
 
        acpi_map_cpu2node(handle, cpu, physid);
 
-       cpu_set(cpu, cpu_present_map);
+       cpu_set(cpu, cpu_present_map);
        ia64_cpu_to_sapicid[cpu] = physid;
        ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
 
        *pcpu = cpu;
-       return(0);
+       return (0);
 }
-EXPORT_SYMBOL(acpi_map_lsapic);
 
+EXPORT_SYMBOL(acpi_map_lsapic);
 
-int
-acpi_unmap_lsapic(int cpu)
+int acpi_unmap_lsapic(int cpu)
 {
        int i;
 
-       for (i=0; i<MAX_SAPICS; i++) {
-               if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
-                       ia64_acpiid_to_sapicid[i] = -1;
-                       break;
-               }
-       }
+       for (i = 0; i < MAX_SAPICS; i++) {
+               if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
+                       ia64_acpiid_to_sapicid[i] = -1;
+                       break;
+               }
+       }
        ia64_cpu_to_sapicid[cpu] = -1;
-       cpu_clear(cpu,cpu_present_map);
+       cpu_clear(cpu, cpu_present_map);
 
 #ifdef CONFIG_ACPI_NUMA
        /* NUMA specific cleanup's */
 #endif
 
-       return(0);
+       return (0);
 }
+
 EXPORT_SYMBOL(acpi_unmap_lsapic);
-#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+#endif                         /* CONFIG_ACPI_HOTPLUG_CPU */
 
 #ifdef CONFIG_ACPI_NUMA
 acpi_status __devinit
-acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
+acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
 {
-       struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        union acpi_object *obj;
        struct acpi_table_iosapic *iosapic;
        unsigned int gsi_base;
@@ -878,10 +892,9 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
        map_iosapic_to_node(gsi_base, node);
        return AE_OK;
 }
-#endif /* CONFIG_NUMA */
+#endif                         /* CONFIG_NUMA */
 
-int
-acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
+int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
 {
        int err;
 
@@ -890,17 +903,18 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
 
 #if CONFIG_ACPI_NUMA
        acpi_map_iosapic(handle, 0, NULL, NULL);
-#endif /* CONFIG_ACPI_NUMA */
+#endif                         /* CONFIG_ACPI_NUMA */
 
        return 0;
 }
+
 EXPORT_SYMBOL(acpi_register_ioapic);
 
-int
-acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
+int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
 {
        return iosapic_remove(gsi_base);
 }
+
 EXPORT_SYMBOL(acpi_unregister_ioapic);
 
-#endif /* CONFIG_ACPI_BOOT */
+#endif                         /* CONFIG_ACPI */
index 7936b62f7a2e323a0f1d5d4ee4c46a2894bf5682..a13df592ebf7adba9e9f98dba3e53d840c2dcfe1 100644 (file)
@@ -561,7 +561,7 @@ static inline int vector_is_shared (int vector)
        return (iosapic_intr_info[vector].count > 1);
 }
 
-static void
+static int
 register_intr (unsigned int gsi, int vector, unsigned char delivery,
               unsigned long polarity, unsigned long trigger)
 {
@@ -576,7 +576,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
        index = find_iosapic(gsi);
        if (index < 0) {
                printk(KERN_WARNING "%s: No IOSAPIC for GSI %u\n", __FUNCTION__, gsi);
-               return;
+               return -ENODEV;
        }
 
        iosapic_address = iosapic_lists[index].addr;
@@ -587,7 +587,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                rte = iosapic_alloc_rte();
                if (!rte) {
                        printk(KERN_WARNING "%s: cannot allocate memory\n", __FUNCTION__);
-                       return;
+                       return -ENOMEM;
                }
 
                rte_index = gsi - gsi_base;
@@ -603,7 +603,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                struct iosapic_intr_info *info = &iosapic_intr_info[vector];
                if (info->trigger != trigger || info->polarity != polarity) {
                        printk (KERN_WARNING "%s: cannot override the interrupt\n", __FUNCTION__);
-                       return;
+                       return -EINVAL;
                }
        }
 
@@ -623,6 +623,7 @@ register_intr (unsigned int gsi, int vector, unsigned char delivery,
                               __FUNCTION__, vector, idesc->handler->typename, irq_type->typename);
                idesc->handler = irq_type;
        }
+       return 0;
 }
 
 static unsigned int
@@ -710,7 +711,7 @@ int
 iosapic_register_intr (unsigned int gsi,
                       unsigned long polarity, unsigned long trigger)
 {
-       int vector, mask = 1;
+       int vector, mask = 1, err;
        unsigned int dest;
        unsigned long flags;
        struct iosapic_rte_info *rte;
@@ -737,8 +738,8 @@ again:
        vector = assign_irq_vector(AUTO_ASSIGN);
        if (vector < 0) {
                vector = iosapic_find_sharable_vector(trigger, polarity);
-               if (vector < 0)
-                       panic("%s: out of interrupt vectors!\n", __FUNCTION__);
+               if (vector < 0)
+                       return -ENOSPC;
        }
 
        spin_lock_irqsave(&irq_descp(vector)->lock, flags);
@@ -753,8 +754,13 @@ again:
                }
 
                dest = get_target_cpu(gsi, vector);
-               register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
+               err = register_intr(gsi, vector, IOSAPIC_LOWEST_PRIORITY,
                              polarity, trigger);
+               if (err < 0) {
+                       spin_unlock(&iosapic_lock);
+                       spin_unlock_irqrestore(&irq_descp(vector)->lock, flags);
+                       return err;
+               }
 
                /*
                 * If the vector is shared and already unmasked for
index 84f89da7c6408b079666d47fd91beea38575a25b..1f5c26dbe705500b58c79568c4293eb2e45bc46a 100644 (file)
@@ -384,7 +384,7 @@ setup_arch (char **cmdline_p)
        if (early_console_setup(*cmdline_p) == 0)
                mark_bsp_online();
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        /* Initialize the ACPI boot-time table parser */
        acpi_table_init();
 # ifdef CONFIG_ACPI_NUMA
@@ -420,7 +420,7 @@ setup_arch (char **cmdline_p)
 
        cpu_init();     /* initialize the bootstrap CPU */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        acpi_boot_init();
 #endif
 
index 92ff46ad21e2b0f43f2990bcdf05bf1b4c72d6f8..706b7734e191efbc51112ae4adea0bbeb4d93e19 100644 (file)
@@ -36,7 +36,7 @@ int arch_register_cpu(int num)
        parent = &sysfs_nodes[cpu_to_node(num)];
 #endif /* CONFIG_NUMA */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        /*
         * If CPEI cannot be re-targetted, and this is
         * CPEI target, then dont create the control file
index 9fc74631ba8aa92568a8fed1e27c0a202e00f92f..01d18b7b5bb3bc785f08b535b903a26b808688ea 100644 (file)
@@ -23,7 +23,7 @@ static void force_interrupt(int irq);
 static void register_intr_pda(struct sn_irq_info *sn_irq_info);
 static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
 
-extern int sn_force_interrupt_flag;
+int sn_force_interrupt_flag = 1;
 extern int sn_ioif_inited;
 static struct list_head **sn_irq_lh;
 static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
index 51bf82720d994188faf55a74b68888908f78c3e1..a06719d752a03112e697b0a060864ec99267e012 100644 (file)
@@ -52,7 +52,7 @@ static int licenseID_open(struct inode *inode, struct file *file)
  * the bridge chip.  The hardware will then send an interrupt message if the
  * interrupt line is active.  This mimics a level sensitive interrupt.
  */
-int sn_force_interrupt_flag = 1;
+extern int sn_force_interrupt_flag;
 
 static int sn_force_interrupt_show(struct seq_file *s, void *p)
 {
index 0a5e723d3be6c820fb116489824e1b963e5b2dcc..ca9518b96c6ebe54ec0df5823b900336203ef8c6 100644 (file)
@@ -453,6 +453,7 @@ label:
 #else
        CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
 #endif
+#endif
 
 /* 0x1100 - Data TLB Miss Exception
  * As the name implies, translation is not in the MMU, so search the
index 8f868b67ef0f1fe0060d3688cd2a37573a830c4f..e63323e03ea9f17f8bec6c0d6aa9d2c94cad0be9 100644 (file)
@@ -152,7 +152,6 @@ config X86_CPUID
          with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
          /dev/cpu/31/cpuid.
 
-# disable it for opteron optimized builds because it pulls in ACPI_BOOT
 config X86_HT
        bool
        depends on SMP && !MK8
@@ -474,7 +473,6 @@ config PCI_DIRECT
 config PCI_MMCONFIG
        bool "Support mmconfig PCI config space access"
        depends on PCI && ACPI
-       select ACPI_BOOT
 
 config UNORDERED_IO
        bool "Unordered IO mapping access"
index b97a61e1c71ccd0f73a964d3db5cecb647c58a49..bf57e2362bf4cbd79bc9f5e02d7f11b8b18abc0b 100644 (file)
@@ -135,8 +135,6 @@ CONFIG_PM_STD_PARTITION=""
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_AC=y
 CONFIG_ACPI_BATTERY=y
 CONFIG_ACPI_BUTTON=y
@@ -151,10 +149,8 @@ CONFIG_ACPI_NUMA=y
 CONFIG_ACPI_TOSHIBA=y
 CONFIG_ACPI_BLACKLIST_YEAR=2001
 # CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
 CONFIG_ACPI_EC=y
 CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
 CONFIG_ACPI_SYSTEM=y
 # CONFIG_ACPI_CONTAINER is not set
 
index c32e198d7b2bfa8c734cad85c249da3b230585c7..1579bdd0adcde450ad0a4991e1b6986895800822 100644 (file)
@@ -12,7 +12,7 @@ obj-y := process.o signal.o entry.o traps.o irq.o \
 obj-$(CONFIG_X86_MCE)         += mce.o
 obj-$(CONFIG_X86_MCE_INTEL)    += mce_intel.o
 obj-$(CONFIG_MTRR)             += ../../i386/kernel/cpu/mtrr/
-obj-$(CONFIG_ACPI_BOOT)                += acpi/
+obj-$(CONFIG_ACPI)             += acpi/
 obj-$(CONFIG_X86_MSR)          += msr.o
 obj-$(CONFIG_MICROCODE)                += microcode.o
 obj-$(CONFIG_X86_CPUID)                += cpuid.o
index d2c2ee5f9a88fdcb42a5b00f1bbda0b5da7b82a5..7da9ace890bd1337b8fba3d0da149d6a43378fed 100644 (file)
@@ -1,3 +1,3 @@
-obj-$(CONFIG_ACPI_BOOT)                := boot.o
-boot-$(CONFIG_ACPI_BOOT)       := ../../../i386/kernel/acpi/boot.o
+obj-y                  := boot.o
+boot-y                 := ../../../i386/kernel/acpi/boot.o
 obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
index 7a275de6df22347e01ffb3b7f3926baba350e545..148f6f7ea315889f1bf0d0d64d92b6b44db7bad2 100644 (file)
@@ -47,7 +47,6 @@
 #include <asm/proto.h>
 #include <asm/tlbflush.h>
 
-
 /* --------------------------------------------------------------------------
                               Low-Level Sleep Support
    -------------------------------------------------------------------------- */
@@ -77,11 +76,12 @@ static void init_low_mapping(void)
  * Create an identity mapped page table and copy the wakeup routine to
  * low memory.
  */
-int acpi_save_state_mem (void)
+int acpi_save_state_mem(void)
 {
        init_low_mapping();
 
-       memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+       memcpy((void *)acpi_wakeup_address, &wakeup_start,
+              &wakeup_end - &wakeup_start);
        acpi_copy_wakeup_routine(acpi_wakeup_address);
 
        return 0;
@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
 /*
  * acpi_restore_state
  */
-void acpi_restore_state_mem (void)
+void acpi_restore_state_mem(void)
 {
        set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
        flush_tlb_all();
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
 {
        acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
        if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
-               printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
+               printk(KERN_CRIT
+                      "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
 }
 
 static int __init acpi_sleep_setup(char *str)
@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
 
 __setup("acpi_sleep=", acpi_sleep_setup);
 
-#endif /*CONFIG_ACPI_SLEEP*/
+#endif                         /*CONFIG_ACPI_SLEEP */
 
-void acpi_pci_link_exit(void) {}
+void acpi_pci_link_exit(void)
+{
+}
index f062aa03bab7e282d149091b852c3718e5dbb537..b1c144f73149854da5e9bb277e4309e281b60ba3 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/smp.h>
 #include <asm/ipi.h>
 
-#if defined(CONFIG_ACPI_BUS)
+#if defined(CONFIG_ACPI)
 #include <acpi/acpi_bus.h>
 #endif
 
@@ -47,7 +47,7 @@ void __init clustered_apic_check(void)
        u8 cluster_cnt[NUM_APIC_CLUSTERS];
        int num_cpus = 0;
 
-#if defined(CONFIG_ACPI_BUS)
+#if defined(CONFIG_ACPI)
        /*
         * Some x86_64 machines use physical APIC mode regardless of how many
         * procs/clusters are present (x86_64 ES7000 is an example).
index ba1a744e9bf0d72e0d8a49eaed6b287243a80415..40e0aca088fbce3d1ba03e3139c552d23ad3b241 100644 (file)
@@ -1864,7 +1864,7 @@ device_initcall(ioapic_init_sysfs);
                           ACPI-based IOAPIC Configuration
    -------------------------------------------------------------------------- */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 #define IO_APIC_MAX_ID         0xFE
 
@@ -1947,7 +1947,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
        return 0;
 }
 
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /* CONFIG_ACPI */
 
 
 /*
index 79c362d03e2e8badd0602a2fbb7fba7fd1c5a6bf..8d8ed6ae1d0c8d880f96558b7a8f865a80ea2ac5 100644 (file)
@@ -74,7 +74,7 @@ static unsigned int num_processors = 0;
 physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
 
 /* ACPI MADT entry parsing functions */
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern struct acpi_boot_flags acpi_boot;
 #ifdef CONFIG_X86_LOCAL_APIC
 extern int acpi_parse_lapic (acpi_table_entry_header *header);
@@ -84,7 +84,7 @@ extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header);
 #ifdef CONFIG_X86_IO_APIC
 extern int acpi_parse_ioapic (acpi_table_entry_header *header);
 #endif /*CONFIG_X86_IO_APIC*/
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /*CONFIG_ACPI*/
 
 u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 
@@ -519,8 +519,6 @@ void __init get_smp_config (void)
        struct intel_mp_floating *mpf = mpf_found;
 
        /*
-        * ACPI may be used to obtain the entire SMP configuration or just to 
-        * enumerate/configure processors (CONFIG_ACPI_BOOT).  Note that 
         * ACPI supports both logical (e.g. Hyper-Threading) and physical 
         * processors, where MPS only supports physical.
         */
@@ -673,7 +671,7 @@ void __init find_smp_config (void)
                             ACPI-based MP Configuration
    -------------------------------------------------------------------------- */
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 void __init mp_register_lapic_address (
        u64                     address)
@@ -929,11 +927,9 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
        if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
                return gsi;
 
-#ifdef CONFIG_ACPI_BUS
        /* Don't set up the ACPI SCI because it's already set up */
        if (acpi_fadt.sci_int == gsi)
                return gsi;
-#endif
 
        ioapic = mp_find_ioapic(gsi);
        if (ioapic < 0) {
@@ -973,13 +969,11 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
                if (gsi < MAX_GSI_NUM) {
                        if (gsi > 15)
                                gsi = pci_irq++;
-#ifdef CONFIG_ACPI_BUS
                        /*
                         * Don't assign IRQ used by ACPI SCI
                         */
                        if (gsi == acpi_fadt.sci_int)
                                gsi = pci_irq++;
-#endif
                        gsi_to_irq[irq] = gsi;
                } else {
                        printk(KERN_ERR "GSI %u is too high\n", gsi);
@@ -994,4 +988,4 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
 }
 
 #endif /*CONFIG_X86_IO_APIC*/
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /*CONFIG_ACPI*/
index b356f8e6adfe974f94cd890cd1ddd1d9cc17dd08..0511d8087910d077741a93ce811a4241ee67e0e2 100644 (file)
@@ -71,7 +71,7 @@ unsigned long mmu_cr4_features;
 
 int acpi_disabled;
 EXPORT_SYMBOL(acpi_disabled);
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern int __initdata acpi_ht;
 extern acpi_interrupt_flags    acpi_sci_flags;
 int __initdata acpi_force = 0;
@@ -294,7 +294,7 @@ static __init void parse_cmdline_early (char ** cmdline_p)
                        maxcpus = simple_strtoul(from + 8, NULL, 0);
                }
 #endif
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
                /* "acpi=off" disables both ACPI table parsing and interpreter init */
                if (!memcmp(from, "acpi=off", 8))
                        disable_acpi();
@@ -566,7 +566,7 @@ void __init setup_arch(char **cmdline_p)
 
        init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        /*
         * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
         * Call this early for SRAT node setup.
@@ -658,7 +658,7 @@ void __init setup_arch(char **cmdline_p)
 
        check_ioapic();
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        /*
         * Read APIC and some other early information from ACPI tables.
         */
index 37c92e841deca791f5d44df955babcb8d0361bf5..bb34e5ef916c610da0b989cc57fd1b241160b7b6 100644 (file)
@@ -8,7 +8,7 @@ CFLAGS += -Iarch/i386/pci
 obj-y          := i386.o
 obj-$(CONFIG_PCI_DIRECT)+= direct.o
 obj-y          += fixup.o
-obj-$(CONFIG_ACPI_PCI) += acpi.o
+obj-$(CONFIG_ACPI)     += acpi.o
 obj-y                  += legacy.o irq.o common.o
 # mmconfig has a 64bit special
 obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
index 291985f0d2e4bb37d806b4d9bafb872e2d6602f6..4f0c05abd4089d161f7e32e4a93b3ccdcd9b4446 100644 (file)
@@ -8,7 +8,7 @@ CFLAGS += -I arch/i386/pci
 obj-y          := i386.o
 obj-$(CONFIG_PCI_DIRECT)+= direct.o
 obj-y          += fixup.o
-obj-$(CONFIG_ACPI_PCI) += acpi.o
+obj-$(CONFIG_ACPI)     += acpi.o
 obj-y                  += legacy.o irq.o common.o
 # mmconfig has a 64bit special
 obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
index 9663132ed82547d3584a280b19c14a26c0895a0a..86c8654a0ca940d183adb4f945fa757b358e0d48 100644 (file)
@@ -8,7 +8,7 @@
 obj-$(CONFIG_PCI)              += pci/
 obj-$(CONFIG_PARISC)           += parisc/
 obj-y                          += video/
-obj-$(CONFIG_ACPI_BOOT)                += acpi/
+obj-$(CONFIG_ACPI)             += acpi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)              += pnp/
index ba13896cae407732b29342116790613fe9a5d083..3998c9d35fe19ee59014ae24b17e394f1d4f4581 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 menu "ACPI (Advanced Configuration and Power Interface) Support"
-       depends on PM
        depends on !X86_VISWS
        depends on !IA64_HP_SIM
        depends on IA64 || X86
@@ -11,6 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support"
 config ACPI
        bool "ACPI Support"
        depends on IA64 || X86
+       select PM
+       select PCI
 
        default y
        ---help---
@@ -43,20 +44,10 @@ config ACPI
 
 if ACPI
 
-config ACPI_BOOT
-       bool
-       default y
-
-config ACPI_INTERPRETER
-       bool
-       default y
-
-if ACPI_INTERPRETER
-
 config ACPI_SLEEP
-       bool "Sleep States (EXPERIMENTAL)"
+       bool "Sleep States"
        depends on X86 && (!SMP || SUSPEND_SMP)
-       depends on EXPERIMENTAL && PM
+       depends on PM
        default y
        ---help---
          This option adds support for ACPI suspend states. 
@@ -90,16 +81,16 @@ config ACPI_SLEEP_PROC_SLEEP
 config ACPI_AC
        tristate "AC Adapter"
        depends on X86
-       default m
+       default y
        help
          This driver adds support for the AC Adapter object, which indicates
-         whether a system is on AC, or not.  Typically, only mobile systems 
-         have this object, since desktops are always on AC.
+         whether a system is on AC, or not. If you have a system that can
+         switch between A/C and battery, say Y.
 
 config ACPI_BATTERY
        tristate "Battery"
        depends on X86
-       default m
+       default y
        help
          This driver adds support for battery information through
          /proc/acpi/battery. If you have a mobile system with a battery, 
@@ -107,18 +98,17 @@ config ACPI_BATTERY
 
 config ACPI_BUTTON
        tristate "Button"
-       default m
+       default y
        help
-         This driver registers for events based on buttons, such as the
-         power, sleep, and lid switch.  In the future, a daemon will read
-         /proc/acpi/event and perform user-defined actions such as shutting
-         down the system.  Until then, you can cat it, and see output when
-         a button is pressed.
+         This driver handles events on the power, sleep and lid buttons.
+         A daemon reads /proc/acpi/event and perform user-defined actions
+         such as shutting down the system.  This is necessary for
+         software controlled poweroff.
 
 config ACPI_VIDEO
        tristate "Video"
-       depends on EXPERIMENTAL
-       default m
+       depends on X86
+       default y
        help
          This driver implement the ACPI Extensions For Display Adapters
          for integrated graphics devices on motherboard, as specified in
@@ -129,10 +119,9 @@ config ACPI_VIDEO
          for your integrated video device.
 
 config ACPI_HOTKEY
-       tristate "Generic Hotkey"
-       depends on ACPI_INTERPRETER
+       tristate "Generic Hotkey (EXPERIMENTAL)"
        depends on EXPERIMENTAL
-       depends on !IA64_SGI_SN
+       depends on X86
        default n
        help
          Experimental consolidated hotkey driver.
@@ -140,31 +129,30 @@ config ACPI_HOTKEY
 
 config ACPI_FAN
        tristate "Fan"
-       default m
+       default y
        help
          This driver adds support for ACPI fan devices, allowing user-mode 
          applications to perform basic fan control (on, off, status).
 
 config ACPI_PROCESSOR
        tristate "Processor"
-       default m
+       default y
        help
          This driver installs ACPI as the idle handler for Linux, and uses
          ACPI C2 and C3 processor states to save power, on systems that
-         support it.
+         support it.  It is required by several flavors of cpufreq
+         Performance-state drivers.
 
 config ACPI_HOTPLUG_CPU
-       bool "Processor Hotplug (EXPERIMENTAL)"
-       depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL
+       bool
+       depends on ACPI_PROCESSOR && HOTPLUG_CPU
        select ACPI_CONTAINER
-       default n
-        ---help---
-        Select this option if your platform support physical CPU hotplug.
+       default y
 
 config ACPI_THERMAL
        tristate "Thermal Zone"
        depends on ACPI_PROCESSOR
-       default m
+       default y
        help
          This driver adds support for ACPI thermal zones.  Most mobile and
          some desktop systems support ACPI thermal zones.  It is HIGHLY
@@ -180,7 +168,7 @@ config ACPI_NUMA
 config ACPI_ASUS
         tristate "ASUS/Medion Laptop Extras"
        depends on X86
-       default m
+       default y
         ---help---
           This driver provides support for extra features of ACPI-compatible
           ASUS laptops. As some of Medion laptops are made by ASUS, it may also
@@ -209,7 +197,7 @@ config ACPI_ASUS
 config ACPI_IBM
        tristate "IBM ThinkPad Laptop Extras"
        depends on X86
-       default m
+       default y
        ---help---
          This is a Linux ACPI driver for the IBM ThinkPad laptops. It adds
          support for Fn-Fx key combinations, Bluetooth control, video
@@ -222,7 +210,7 @@ config ACPI_IBM
 config ACPI_TOSHIBA
        tristate "Toshiba Laptop Extras"
        depends on X86
-       default m
+       default y
        ---help---
          This driver adds support for access to certain system settings
          on "legacy free" Toshiba laptops.  These laptops can be recognized by
@@ -263,7 +251,7 @@ config ACPI_CUSTOM_DSDT_FILE
 
 config ACPI_BLACKLIST_YEAR
        int "Disable ACPI for systems before Jan 1st this year"
-       depends on ACPI_INTERPRETER
+       depends on X86
        default 0
        help
          enter a 4-digit year, eg. 2001 to disable ACPI by default
@@ -281,10 +269,6 @@ config ACPI_DEBUG
          of verbosity. Saying Y enables these statements. This will increase
          your kernel size by around 50K.
 
-config ACPI_BUS
-       bool
-       default y
-
 config ACPI_EC
        bool
        depends on X86
@@ -298,10 +282,6 @@ config ACPI_POWER
        bool
        default y
 
-config ACPI_PCI
-       bool
-       default PCI
-
 config ACPI_SYSTEM
        bool
        default y
@@ -309,14 +289,11 @@ config ACPI_SYSTEM
          This driver will enable your system to shut down using ACPI, and
          dump your ACPI DSDT table using /proc/acpi/dsdt.
 
-endif  # ACPI_INTERPRETER
-
 config X86_PM_TIMER
        bool "Power Management Timer Support"
        depends on X86
-       depends on ACPI_BOOT && EXPERIMENTAL
        depends on !X86_64
-       default n
+       default y
        help
          The Power Management Timer is available on all ACPI-capable,
          in most cases even if ACPI is unusable or blacklisted.
index ad67e8f61e6c5ba5db2976155e29ba64d7b35646..a18243488c666cad223183fbe54726f9ba26fbed 100644 (file)
@@ -15,13 +15,13 @@ EXTRA_CFLAGS        += $(ACPI_CFLAGS)
 #
 # ACPI Boot-Time Table Parsing
 #
-obj-$(CONFIG_ACPI_BOOT)                += tables.o
-obj-$(CONFIG_ACPI_INTERPRETER) += blacklist.o
+obj-y                          += tables.o
+obj-y                          += blacklist.o
 
 #
 # ACPI Core Subsystem (Interpreter)
 #
-obj-$(CONFIG_ACPI_INTERPRETER) += osl.o utils.o \
+obj-y                          += osl.o utils.o \
                                   dispatcher/ events/ executer/ hardware/ \
                                   namespace/ parser/ resources/ tables/ \
                                   utilities/
@@ -35,8 +35,8 @@ ifdef CONFIG_CPU_FREQ
 processor-objs += processor_perflib.o                  
 endif
 
-obj-$(CONFIG_ACPI_BUS)         += sleep/
-obj-$(CONFIG_ACPI_BUS)         += bus.o glue.o
+obj-y                          += sleep/
+obj-y                          += bus.o glue.o
 obj-$(CONFIG_ACPI_AC)          += ac.o
 obj-$(CONFIG_ACPI_BATTERY)     += battery.o
 obj-$(CONFIG_ACPI_BUTTON)      += button.o
@@ -44,7 +44,7 @@ obj-$(CONFIG_ACPI_EC)         += ec.o
 obj-$(CONFIG_ACPI_FAN)         += fan.o
 obj-$(CONFIG_ACPI_VIDEO)       += video.o 
 obj-$(CONFIG_ACPI_HOTKEY)      += hotkey.o
-obj-$(CONFIG_ACPI_PCI)         += pci_root.o pci_link.o pci_irq.o pci_bind.o
+obj-y                          += pci_root.o pci_link.o pci_irq.o pci_bind.o
 obj-$(CONFIG_ACPI_POWER)       += power.o
 obj-$(CONFIG_ACPI_PROCESSOR)   += processor.o
 obj-$(CONFIG_ACPI_CONTAINER)   += container.o
@@ -55,5 +55,5 @@ obj-$(CONFIG_ACPI_NUMA)               += numa.o
 obj-$(CONFIG_ACPI_ASUS)                += asus_acpi.o
 obj-$(CONFIG_ACPI_IBM)         += ibm_acpi.o
 obj-$(CONFIG_ACPI_TOSHIBA)     += toshiba_acpi.o
-obj-$(CONFIG_ACPI_BUS)         += scan.o motherboard.o
+obj-y                          += scan.o motherboard.o
 obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)      += acpi_memhotplug.o
index 23ab761dd72176b1b705610433b1536046b877d6..7839b831df94eea57c14a25fc17a310be29982b3 100644 (file)
@@ -32,7 +32,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_AC_COMPONENT              0x00020000
 #define ACPI_AC_CLASS                  "ac_adapter"
 #define ACPI_AC_HID                    "ACPI0003"
 #define ACPI_AC_STATUS_UNKNOWN         0xFF
 
 #define _COMPONENT             ACPI_AC_COMPONENT
-ACPI_MODULE_NAME               ("acpi_ac")
+ACPI_MODULE_NAME("acpi_ac")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_ac_add (struct acpi_device *device);
-static int acpi_ac_remove (struct acpi_device *device, int type);
+static int acpi_ac_add(struct acpi_device *device);
+static int acpi_ac_remove(struct acpi_device *device, int type);
 static int acpi_ac_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_ac_driver = {
-       .name =         ACPI_AC_DRIVER_NAME,
-       .class =        ACPI_AC_CLASS,
-       .ids =          ACPI_AC_HID,
-       .ops =          {
-                               .add =          acpi_ac_add,
-                               .remove =       acpi_ac_remove,
-                       },
+       .name = ACPI_AC_DRIVER_NAME,
+       .class = ACPI_AC_CLASS,
+       .ids = ACPI_AC_HID,
+       .ops = {
+               .add = acpi_ac_add,
+               .remove = acpi_ac_remove,
+               },
 };
 
 struct acpi_ac {
-       acpi_handle             handle;
-       unsigned long           state;
+       acpi_handle handle;
+       unsigned long state;
 };
 
 static struct file_operations acpi_ac_fops = {
-       .open           = acpi_ac_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_ac_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 /* --------------------------------------------------------------------------
                                AC Adapter Management
    -------------------------------------------------------------------------- */
 
-static int
-acpi_ac_get_state (
-       struct acpi_ac          *ac)
+static int acpi_ac_get_state(struct acpi_ac *ac)
 {
-       acpi_status             status = AE_OK;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("acpi_ac_get_state");
 
@@ -95,24 +92,23 @@ acpi_ac_get_state (
        status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error reading AC Adapter state\n"));
+                                 "Error reading AC Adapter state\n"));
                ac->state = ACPI_AC_STATUS_UNKNOWN;
                return_VALUE(-ENODEV);
        }
-       
+
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_ac_dir;
+static struct proc_dir_entry *acpi_ac_dir;
 
 static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_ac          *ac = (struct acpi_ac *) seq->private;
+       struct acpi_ac *ac = (struct acpi_ac *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
 
@@ -139,23 +135,21 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
 
        return_VALUE(0);
 }
-       
+
 static int acpi_ac_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
 }
 
-static int
-acpi_ac_add_fs (
-       struct acpi_device      *device)
+static int acpi_ac_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_ac_dir);
+                                                    acpi_ac_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                acpi_device_dir(device)->owner = THIS_MODULE;
@@ -163,11 +157,11 @@ acpi_ac_add_fs (
 
        /* 'state' [R] */
        entry = create_proc_entry(ACPI_AC_FILE_STATE,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_AC_FILE_STATE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_AC_FILE_STATE));
        else {
                entry->proc_fops = &acpi_ac_fops;
                entry->data = acpi_driver_data(device);
@@ -177,16 +171,12 @@ acpi_ac_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_ac_remove_fs (
-       struct acpi_device      *device)
+static int acpi_ac_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
 
        if (acpi_device_dir(device)) {
-               remove_proc_entry(ACPI_AC_FILE_STATE,
-                                 acpi_device_dir(device));
+               remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
 
                remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
                acpi_device_dir(device) = NULL;
@@ -195,19 +185,14 @@ acpi_ac_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                    Driver Model
    -------------------------------------------------------------------------- */
 
-static void
-acpi_ac_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_ac          *ac = (struct acpi_ac *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_ac *ac = (struct acpi_ac *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ac_notify");
 
@@ -224,21 +209,18 @@ acpi_ac_notify (
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-
-static int
-acpi_ac_add (
-       struct acpi_device      *device)
+static int acpi_ac_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_ac          *ac = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_ac *ac = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ac_add");
 
@@ -264,19 +246,20 @@ acpi_ac_add (
                goto end;
 
        status = acpi_install_notify_handler(ac->handle,
-               ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
+                                            ACPI_DEVICE_NOTIFY, acpi_ac_notify,
+                                            ac);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                result = -ENODEV;
                goto end;
        }
 
-       printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 
-               acpi_device_name(device), acpi_device_bid(device), 
-               ac->state?"on-line":"off-line");
+       printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
+              acpi_device_name(device), acpi_device_bid(device),
+              ac->state ? "on-line" : "off-line");
 
-end:
+      end:
        if (result) {
                acpi_ac_remove_fs(device);
                kfree(ac);
@@ -285,27 +268,23 @@ end:
        return_VALUE(result);
 }
 
-
-static int
-acpi_ac_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_ac_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_ac          *ac = NULL;
+       acpi_status status = AE_OK;
+       struct acpi_ac *ac = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ac_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       ac = (struct acpi_ac *) acpi_driver_data(device);
+       ac = (struct acpi_ac *)acpi_driver_data(device);
 
        status = acpi_remove_notify_handler(ac->handle,
-               ACPI_DEVICE_NOTIFY, acpi_ac_notify);
+                                           ACPI_DEVICE_NOTIFY, acpi_ac_notify);
        if (ACPI_FAILURE(status))
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
 
        acpi_ac_remove_fs(device);
 
@@ -314,11 +293,9 @@ acpi_ac_remove (
        return_VALUE(0);
 }
 
-
-static int __init
-acpi_ac_init (void)
+static int __init acpi_ac_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ac_init");
 
@@ -336,9 +313,7 @@ acpi_ac_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_ac_exit (void)
+static void __exit acpi_ac_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_ac_exit");
 
@@ -349,6 +324,5 @@ acpi_ac_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_ac_init);
 module_exit(acpi_ac_exit);
index 77285ffe41c5cb0e25360fe23737da2d97fdc760..01a1bd239263bcaa416050ae8184482e1ebbc9e8 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/memory_hotplug.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_MEMORY_DEVICE_COMPONENT           0x08000000UL
 #define ACPI_MEMORY_DEVICE_CLASS               "memory"
 #define ACPI_MEMORY_DEVICE_HID                 "PNP0C80"
@@ -41,8 +40,8 @@
 
 #define _COMPONENT             ACPI_MEMORY_DEVICE_COMPONENT
 
-ACPI_MODULE_NAME               ("acpi_memory")
-MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
+ACPI_MODULE_NAME("acpi_memory")
+    MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
 MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
@@ -56,34 +55,33 @@ MODULE_LICENSE("GPL");
 #define MEMORY_POWER_ON_STATE  1
 #define MEMORY_POWER_OFF_STATE 2
 
-static int acpi_memory_device_add (struct acpi_device *device);
-static int acpi_memory_device_remove (struct acpi_device *device, int type);
+static int acpi_memory_device_add(struct acpi_device *device);
+static int acpi_memory_device_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_memory_device_driver = {
-       .name =         ACPI_MEMORY_DEVICE_DRIVER_NAME,
-       .class =        ACPI_MEMORY_DEVICE_CLASS,
-       .ids =          ACPI_MEMORY_DEVICE_HID,
-       .ops =          {
-                               .add =          acpi_memory_device_add,
-                               .remove =       acpi_memory_device_remove,
-                       },
+       .name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
+       .class = ACPI_MEMORY_DEVICE_CLASS,
+       .ids = ACPI_MEMORY_DEVICE_HID,
+       .ops = {
+               .add = acpi_memory_device_add,
+               .remove = acpi_memory_device_remove,
+               },
 };
 
 struct acpi_memory_device {
        acpi_handle handle;
-       unsigned int state;             /* State of the memory device */
+       unsigned int state;     /* State of the memory device */
        unsigned short cache_attribute; /* memory cache attribute */
-       unsigned short read_write_attribute;/* memory read/write attribute */
-       u64 start_addr; /* Memory Range start physical addr */
-       u64 end_addr;   /* Memory Range end physical addr */
+       unsigned short read_write_attribute;    /* memory read/write attribute */
+       u64 start_addr;         /* Memory Range start physical addr */
+       u64 end_addr;           /* Memory Range end physical addr */
 };
 
-
 static int
 acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 {
        acpi_status status;
-       struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct acpi_resource *resource = NULL;
        struct acpi_resource_address64 address64;
 
@@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
        if (ACPI_FAILURE(status))
                return_VALUE(-EINVAL);
 
-       resource = (struct acpi_resource *) buffer.pointer;
+       resource = (struct acpi_resource *)buffer.pointer;
        status = acpi_resource_to_address64(resource, &address64);
        if (ACPI_SUCCESS(status)) {
                if (address64.resource_type == ACPI_MEMORY_RANGE) {
                        /* Populate the structure */
                        mem_device->cache_attribute =
-                               address64.attribute.memory.cache_attribute;
+                           address64.attribute.memory.cache_attribute;
                        mem_device->read_write_attribute =
-                       address64.attribute.memory.read_write_attribute;
+                           address64.attribute.memory.read_write_attribute;
                        mem_device->start_addr = address64.min_address_range;
                        mem_device->end_addr = address64.max_address_range;
                }
@@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
 
 static int
 acpi_memory_get_device(acpi_handle handle,
-       struct acpi_memory_device **mem_device)
+                      struct acpi_memory_device **mem_device)
 {
        acpi_status status;
        acpi_handle phandle;
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
 
        status = acpi_get_parent(handle, &phandle);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error in acpi_get_parent\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
                return_VALUE(-EINVAL);
        }
 
@@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle,
        status = acpi_bus_get_device(phandle, &pdevice);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error in acpi_bus_get_device\n"));
+                                 "Error in acpi_bus_get_device\n"));
                return_VALUE(-EINVAL);
        }
 
@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
         */
        status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error in acpi_bus_add\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
                return_VALUE(-EINVAL);
        }
 
-end:
+      end:
        *mem_device = acpi_driver_data(device);
        if (!(*mem_device)) {
-               printk(KERN_ERR "\n driver data not found" );
+               printk(KERN_ERR "\n driver data not found");
                return_VALUE(-ENODEV);
        }
 
        return_VALUE(0);
 }
 
-static int
-acpi_memory_check_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
 {
        unsigned long current_status;
 
@@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
 
        /* Get device present/absent information from the _STA */
        if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
-               NULL, &current_status)))
+                                              NULL, &current_status)))
                return_VALUE(-ENODEV);
        /*
         * Check for device status. Device should be
         * present/enabled/functioning.
         */
        if (!((current_status & ACPI_MEMORY_STA_PRESENT)
-               && (current_status & ACPI_MEMORY_STA_ENABLED)
-               && (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
+             && (current_status & ACPI_MEMORY_STA_ENABLED)
+             && (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
                return_VALUE(-ENODEV);
 
        return_VALUE(0);
 }
 
-static int
-acpi_memory_enable_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 {
        int result;
 
@@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
        result = acpi_memory_get_device_resources(mem_device);
        if (result) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "\nget_device_resources failed\n"));
+                                 "\nget_device_resources failed\n"));
                mem_device->state = MEMORY_INVALID_STATE;
                return result;
        }
@@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
         * Note: Assume that this function returns zero on success
         */
        result = add_memory(mem_device->start_addr,
-                       (mem_device->end_addr - mem_device->start_addr) + 1,
-                       mem_device->read_write_attribute);
+                           (mem_device->end_addr - mem_device->start_addr) + 1,
+                           mem_device->read_write_attribute);
        if (result) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "\nadd_memory failed\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
                mem_device->state = MEMORY_INVALID_STATE;
                return result;
        }
@@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
        return result;
 }
 
-static int
-acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
 {
        acpi_status status;
-       struct acpi_object_list arg_list;
+       struct acpi_object_list arg_list;
        union acpi_object arg;
        unsigned long current_status;
 
@@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
        arg.type = ACPI_TYPE_INTEGER;
        arg.integer.value = 1;
        status = acpi_evaluate_object(mem_device->handle,
-                       "_EJ0", &arg_list, NULL);
+                                     "_EJ0", &arg_list, NULL);
        /* Return on _EJ0 failure */
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
                return_VALUE(-ENODEV);
        }
 
        /* Evalute _STA to check if the device is disabled */
        status = acpi_evaluate_integer(mem_device->handle, "_STA",
-               NULL, &current_status);
+                                      NULL, &current_status);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
        return_VALUE(0);
 }
 
-static int
-acpi_memory_disable_device(struct acpi_memory_device *mem_device)
+static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
 {
        int result;
        u64 start = mem_device->start_addr;
@@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
        result = acpi_memory_powerdown_device(mem_device);
        if (result) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                       "Device Power Down failed.\n"));
+                                 "Device Power Down failed.\n"));
                /* Set the status of the device to invalid */
                mem_device->state = MEMORY_INVALID_STATE;
                return result;
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
        return result;
 }
 
-static void
-acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
+static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
 {
        struct acpi_memory_device *mem_device;
        struct acpi_device *device;
@@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
        switch (event) {
        case ACPI_NOTIFY_BUS_CHECK:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "\nReceived BUS CHECK notification for device\n"));
+                                 "\nReceived BUS CHECK notification for device\n"));
                /* Fall Through */
        case ACPI_NOTIFY_DEVICE_CHECK:
                if (event == ACPI_NOTIFY_DEVICE_CHECK)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "\nReceived DEVICE CHECK notification for device\n"));
+                                         "\nReceived DEVICE CHECK notification for device\n"));
                if (acpi_memory_get_device(handle, &mem_device)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error in finding driver data\n"));
+                                         "Error in finding driver data\n"));
                        return_VOID;
                }
 
                if (!acpi_memory_check_device(mem_device)) {
                        if (acpi_memory_enable_device(mem_device))
                                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error in acpi_memory_enable_device\n"));
+                                                 "Error in acpi_memory_enable_device\n"));
                }
                break;
        case ACPI_NOTIFY_EJECT_REQUEST:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "\nReceived EJECT REQUEST notification for device\n"));
+                                 "\nReceived EJECT REQUEST notification for device\n"));
 
                if (acpi_bus_get_device(handle, &device)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                       "Device doesn't exist\n"));
+                                         "Device doesn't exist\n"));
                        break;
                }
                mem_device = acpi_driver_data(device);
                if (!mem_device) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                       "Driver Data is NULL\n"));
+                                         "Driver Data is NULL\n"));
                        break;
                }
 
@@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
                 * Currently disabling memory device from kernel mode
                 * TBD: Can also be disabled from user mode scripts
                 * TBD: Can also be disabled by Callback registration
-                *      with generic sysfs driver
+                *      with generic sysfs driver
                 */
                if (acpi_memory_disable_device(mem_device))
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error in acpi_memory_disable_device\n"));
+                                         "Error in acpi_memory_disable_device\n"));
                /*
                 * TBD: Invoke acpi_bus_remove to cleanup data structures
                 */
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-static int
-acpi_memory_device_add(struct acpi_device *device)
+static int acpi_memory_device_add(struct acpi_device *device)
 {
        int result;
        struct acpi_memory_device *mem_device = NULL;
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
        return_VALUE(result);
 }
 
-static int
-acpi_memory_device_remove (struct acpi_device *device, int type)
+static int acpi_memory_device_remove(struct acpi_device *device, int type)
 {
        struct acpi_memory_device *mem_device = NULL;
 
@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
+       mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
        kfree(mem_device);
 
        return_VALUE(0);
@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
 /*
  * Helper function to check for memory device
  */
-static acpi_status
-is_memory_device(acpi_handle handle)
+static acpi_status is_memory_device(acpi_handle handle)
 {
        char *hardware_id;
        acpi_status status;
-       struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct acpi_device_info *info;
 
        ACPI_FUNCTION_TRACE("is_memory_device");
@@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle)
 
        hardware_id = info->hardware_id.value;
        if ((hardware_id == NULL) ||
-               (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
+           (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
                status = AE_ERROR;
 
        acpi_os_free(buffer.pointer);
@@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle)
 }
 
 static acpi_status
-acpi_memory_register_notify_handler (acpi_handle handle,
-       u32 level, void *ctxt, void **retv)
+acpi_memory_register_notify_handler(acpi_handle handle,
+                                   u32 level, void *ctxt, void **retv)
 {
        acpi_status status;
 
@@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle,
                return_ACPI_STATUS(AE_OK);      /* continue */
 
        status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
-                       acpi_memory_device_notify, NULL);
+                                            acpi_memory_device_notify, NULL);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                return_ACPI_STATUS(AE_OK);      /* continue */
        }
 
@@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle,
 }
 
 static acpi_status
-acpi_memory_deregister_notify_handler (acpi_handle handle,
-                              u32 level, void *ctxt, void **retv)
+acpi_memory_deregister_notify_handler(acpi_handle handle,
+                                     u32 level, void *ctxt, void **retv)
 {
        acpi_status status;
 
@@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
                return_ACPI_STATUS(AE_OK);      /* continue */
 
        status = acpi_remove_notify_handler(handle,
-                       ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
+                                           ACPI_SYSTEM_NOTIFY,
+                                           acpi_memory_device_notify);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
                return_ACPI_STATUS(AE_OK);      /* continue */
        }
 
        return_ACPI_STATUS(status);
 }
 
-static int __init
-acpi_memory_device_init (void)
+static int __init acpi_memory_device_init(void)
 {
        int result;
        acpi_status status;
@@ -499,21 +486,20 @@ acpi_memory_device_init (void)
                return_VALUE(-ENODEV);
 
        status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-                               ACPI_UINT32_MAX,
-                               acpi_memory_register_notify_handler,
-                               NULL, NULL);
+                                    ACPI_UINT32_MAX,
+                                    acpi_memory_register_notify_handler,
+                                    NULL, NULL);
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
                acpi_bus_unregister_driver(&acpi_memory_device_driver);
                return_VALUE(-ENODEV);
-        }
+       }
 
        return_VALUE(0);
 }
 
-static void __exit
-acpi_memory_device_exit (void)
+static void __exit acpi_memory_device_exit(void)
 {
        acpi_status status;
 
@@ -524,12 +510,12 @@ acpi_memory_device_exit (void)
         * handles.
         */
        status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-                       ACPI_UINT32_MAX,
-                       acpi_memory_deregister_notify_handler,
-                       NULL, NULL);
+                                    ACPI_UINT32_MAX,
+                                    acpi_memory_deregister_notify_handler,
+                                    NULL, NULL);
 
-       if (ACPI_FAILURE (status))
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
+       if (ACPI_FAILURE(status))
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
 
        acpi_bus_unregister_driver(&acpi_memory_device_driver);
 
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
 
 module_init(acpi_memory_device_init);
 module_exit(acpi_memory_device_exit);
-
-
index a560b1e2da7755319af1c875d3927ffab6fd88fa..fec895af6ae6ccb86587876dd597fa6d25bba4b3 100644 (file)
@@ -61,7 +61,7 @@
 /*
  * Some events we use, same for all Asus
  */
-#define BR_UP       0x10               
+#define BR_UP       0x10
 #define BR_DOWN     0x20
 
 /*
@@ -75,7 +75,6 @@ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
 MODULE_DESCRIPTION(ACPI_HOTK_NAME);
 MODULE_LICENSE("GPL");
 
-
 static uid_t asus_uid;
 static gid_t asus_gid;
 module_param(asus_uid, uint, 0);
@@ -83,26 +82,25 @@ MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
 module_param(asus_gid, uint, 0);
 MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n");
 
-
 /* For each model, all features implemented, 
  * those marked with R are relative to HOTK, A for absolute */
 struct model_data {
-       char *name;              //name of the laptop________________A
-       char *mt_mled;           //method to handle mled_____________R
-       char *mled_status;       //node to handle mled reading_______A
-       char *mt_wled;           //method to handle wled_____________R
-       char *wled_status;       //node to handle wled reading_______A
-       char *mt_tled;           //method to handle tled_____________R
-       char *tled_status;       //node to handle tled reading_______A
-       char *mt_lcd_switch;     //method to turn LCD ON/OFF_________A
-       char *lcd_status;        //node to read LCD panel state______A
-       char *brightness_up;     //method to set brightness up_______A
-       char *brightness_down;   //guess what ?______________________A
-       char *brightness_set;    //method to set absolute brightness_R
-       char *brightness_get;    //method to get absolute brightness_R
-       char *brightness_status; //node to get brightness____________A
-       char *display_set;       //method to set video output________R
-       char *display_get;       //method to get video output________R
+       char *name;             //name of the laptop________________A
+       char *mt_mled;          //method to handle mled_____________R
+       char *mled_status;      //node to handle mled reading_______A
+       char *mt_wled;          //method to handle wled_____________R
+       char *wled_status;      //node to handle wled reading_______A
+       char *mt_tled;          //method to handle tled_____________R
+       char *tled_status;      //node to handle tled reading_______A
+       char *mt_lcd_switch;    //method to turn LCD ON/OFF_________A
+       char *lcd_status;       //node to read LCD panel state______A
+       char *brightness_up;    //method to set brightness up_______A
+       char *brightness_down;  //guess what ?______________________A
+       char *brightness_set;   //method to set absolute brightness_R
+       char *brightness_get;   //method to get absolute brightness_R
+       char *brightness_status;        //node to get brightness____________A
+       char *display_set;      //method to set video output________R
+       char *display_get;      //method to get video output________R
 };
 
 /*
@@ -110,34 +108,34 @@ struct model_data {
  * about the hotk device
  */
 struct asus_hotk {
-       struct acpi_device *device; //the device we are in
-       acpi_handle handle;         //the handle of the hotk device
-       char status;                //status of the hotk, for LEDs, ...
-       struct model_data *methods; //methods available on the laptop
-       u8 brightness;              //brightness level
+       struct acpi_device *device;     //the device we are in
+       acpi_handle handle;     //the handle of the hotk device
+       char status;            //status of the hotk, for LEDs, ...
+       struct model_data *methods;     //methods available on the laptop
+       u8 brightness;          //brightness level
        enum {
-               A1x = 0,  //A1340D, A1300F
-               A2x,      //A2500H
-               D1x,      //D1
-               L2D,      //L2000D
-               L3C,      //L3800C
-               L3D,      //L3400D
-               L3H,      //L3H, but also L2000E
-               L4R,      //L4500R
-               L5x,      //L5800C 
-               L8L,      //L8400L
-               M1A,      //M1300A
-               M2E,      //M2400E, L4400L
-               M6N,      //M6800N
-               M6R,      //M6700R
-               P30,      //Samsung P30
-               S1x,      //S1300A, but also L1400B and M2400A (L84F)
-               S2x,      //S200 (J1 reported), Victor MP-XP7210
-               xxN,      //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON
-                         //(Centrino)
+               A1x = 0,        //A1340D, A1300F
+               A2x,            //A2500H
+               D1x,            //D1
+               L2D,            //L2000D
+               L3C,            //L3800C
+               L3D,            //L3400D
+               L3H,            //L3H, but also L2000E
+               L4R,            //L4500R
+               L5x,            //L5800C 
+               L8L,            //L8400L
+               M1A,            //M1300A
+               M2E,            //M2400E, L4400L
+               M6N,            //M6800N
+               M6R,            //M6700R
+               P30,            //Samsung P30
+               S1x,            //S1300A, but also L1400B and M2400A (L84F)
+               S2x,            //S200 (J1 reported), Victor MP-XP7210
+               xxN,            //M2400N, M3700N, M5200N, S1300N, S5200N, W1OOON
+               //(Centrino)
                END_MODEL
-       } model;              //Models currently supported
-       u16 event_count[128]; //count for each event TODO make this better
+       } model;                //Models currently supported
+       u16 event_count[128];   //count for each event TODO make this better
 };
 
 /* Here we go */
@@ -150,7 +148,7 @@ struct asus_hotk {
 #define xxN_PREFIX "\\_SB.PCI0.SBRG.EC0."
 
 static struct model_data model_conf[END_MODEL] = {
-        /*
+       /*
         * Those pathnames are relative to the HOTK / ATKD device :
         *       - mt_mled
         *       - mt_wled
@@ -165,215 +163,197 @@ static struct model_data model_conf[END_MODEL] = {
         */
 
        {
-               .name              = "A1x",
-               .mt_mled           = "MLED",
-               .mled_status       = "\\MAIL",
-               .mt_lcd_switch     = A1x_PREFIX "_Q10",
-               .lcd_status        = "\\BKLI",
-               .brightness_up     = A1x_PREFIX "_Q0E",
-               .brightness_down   = A1x_PREFIX "_Q0F"
-       },
+        .name = "A1x",
+        .mt_mled = "MLED",
+        .mled_status = "\\MAIL",
+        .mt_lcd_switch = A1x_PREFIX "_Q10",
+        .lcd_status = "\\BKLI",
+        .brightness_up = A1x_PREFIX "_Q0E",
+        .brightness_down = A1x_PREFIX "_Q0F"},
 
        {
-               .name              = "A2x",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .wled_status       = "\\SG66",
-               .mt_lcd_switch     = "\\Q10",
-               .lcd_status        = "\\BAOF",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "A2x",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .wled_status = "\\SG66",
+        .mt_lcd_switch = "\\Q10",
+        .lcd_status = "\\BAOF",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "D1x",
-               .mt_mled           = "MLED",
-               .mt_lcd_switch     = "\\Q0D",
-               .lcd_status        = "\\GP11",
-               .brightness_up     = "\\Q0C",
-               .brightness_down   = "\\Q0B",
-               .brightness_status = "\\BLVL",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "D1x",
+        .mt_mled = "MLED",
+        .mt_lcd_switch = "\\Q0D",
+        .lcd_status = "\\GP11",
+        .brightness_up = "\\Q0C",
+        .brightness_down = "\\Q0B",
+        .brightness_status = "\\BLVL",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "L2D",
-               .mt_mled           = "MLED",
-               .mled_status       = "\\SGP6",
-               .mt_wled           = "WLED",
-               .wled_status       = "\\RCP3",
-               .mt_lcd_switch     = "\\Q10",
-               .lcd_status        = "\\SGP0",
-               .brightness_up     = "\\Q0E",
-               .brightness_down   = "\\Q0F",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "L2D",
+        .mt_mled = "MLED",
+        .mled_status = "\\SGP6",
+        .mt_wled = "WLED",
+        .wled_status = "\\RCP3",
+        .mt_lcd_switch = "\\Q10",
+        .lcd_status = "\\SGP0",
+        .brightness_up = "\\Q0E",
+        .brightness_down = "\\Q0F",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "L3C",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = L3C_PREFIX "_Q10",
-               .lcd_status        = "\\GL32",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\_SB.PCI0.PCI1.VGAC.NMAP"
-       },
+        .name = "L3C",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = L3C_PREFIX "_Q10",
+        .lcd_status = "\\GL32",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"},
 
        {
-               .name              = "L3D",
-               .mt_mled           = "MLED",
-               .mled_status       = "\\MALD",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = "\\Q10",
-               .lcd_status        = "\\BKLG",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "L3D",
+        .mt_mled = "MLED",
+        .mled_status = "\\MALD",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = "\\Q10",
+        .lcd_status = "\\BKLG",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "L3H",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = "EHK",
-               .lcd_status        = "\\_SB.PCI0.PM.PBC",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "L3H",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = "EHK",
+        .lcd_status = "\\_SB.PCI0.PM.PBC",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "L4R",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .wled_status       = "\\_SB.PCI0.SBRG.SG13",
-               .mt_lcd_switch     = xxN_PREFIX "_Q10",
-               .lcd_status        = "\\_SB.PCI0.SBSM.SEO4",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV", 
-               .display_set       = "SDSP",
-               .display_get       = "\\_SB.PCI0.P0P1.VGA.GETD"
-       },
+        .name = "L4R",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .wled_status = "\\_SB.PCI0.SBRG.SG13",
+        .mt_lcd_switch = xxN_PREFIX "_Q10",
+        .lcd_status = "\\_SB.PCI0.SBSM.SEO4",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
 
        {
-               .name              = "L5x",
-               .mt_mled           = "MLED",
+        .name = "L5x",
+        .mt_mled = "MLED",
 /* WLED present, but not controlled by ACPI */
-               .mt_tled           = "TLED",
-               .mt_lcd_switch     = "\\Q0D",
-               .lcd_status        = "\\BAOF",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .mt_tled = "TLED",
+        .mt_lcd_switch = "\\Q0D",
+        .lcd_status = "\\BAOF",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "L8L"
+        .name = "L8L"
 /* No features, but at least support the hotkeys */
-       },
+        },
 
        {
-               .name              = "M1A",
-               .mt_mled           = "MLED",
-               .mt_lcd_switch     = M1A_PREFIX "Q10",
-               .lcd_status        = "\\PNOF",
-               .brightness_up     = M1A_PREFIX "Q0E",
-               .brightness_down   = M1A_PREFIX "Q0F",
-               .brightness_status = "\\BRIT",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "M1A",
+        .mt_mled = "MLED",
+        .mt_lcd_switch = M1A_PREFIX "Q10",
+        .lcd_status = "\\PNOF",
+        .brightness_up = M1A_PREFIX "Q0E",
+        .brightness_down = M1A_PREFIX "Q0F",
+        .brightness_status = "\\BRIT",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "M2E",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = "\\Q10",
-               .lcd_status        = "\\GP06",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\INFB"
-       },
+        .name = "M2E",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = "\\Q10",
+        .lcd_status = "\\GP06",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\INFB"},
 
        {
-               .name              = "M6N",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .wled_status       = "\\_SB.PCI0.SBRG.SG13",
-               .mt_lcd_switch     = xxN_PREFIX "_Q10",
-               .lcd_status        = "\\_SB.BKLT",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\SSTE"
-       },
+        .name = "M6N",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .wled_status = "\\_SB.PCI0.SBRG.SG13",
+        .mt_lcd_switch = xxN_PREFIX "_Q10",
+        .lcd_status = "\\_SB.BKLT",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\SSTE"},
        {
-               .name              = "M6R",
-               .mt_mled           = "MLED",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = xxN_PREFIX "_Q10",
-               .lcd_status        = "\\_SB.PCI0.SBSM.SEO4",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\SSTE"
-       },
-
+        .name = "M6R",
+        .mt_mled = "MLED",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = xxN_PREFIX "_Q10",
+        .lcd_status = "\\_SB.PCI0.SBSM.SEO4",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\SSTE"},
 
        {
-               .name              = "P30",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = P30_PREFIX "_Q0E",
-               .lcd_status        = "\\BKLT",
-               .brightness_up     = P30_PREFIX "_Q68",
-               .brightness_down   = P30_PREFIX "_Q69",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\DNXT"
-       },
+        .name = "P30",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = P30_PREFIX "_Q0E",
+        .lcd_status = "\\BKLT",
+        .brightness_up = P30_PREFIX "_Q68",
+        .brightness_down = P30_PREFIX "_Q69",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\DNXT"},
 
        {
-               .name              = "S1x",
-               .mt_mled           = "MLED",
-               .mled_status       = "\\EMLE",
-               .mt_wled           = "WLED",
-               .mt_lcd_switch     = S1x_PREFIX "Q10" ,
-               .lcd_status        = "\\PNOF",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV"
-       },
+        .name = "S1x",
+        .mt_mled = "MLED",
+        .mled_status = "\\EMLE",
+        .mt_wled = "WLED",
+        .mt_lcd_switch = S1x_PREFIX "Q10",
+        .lcd_status = "\\PNOF",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV"},
 
        {
-               .name              = "S2x",
-               .mt_mled           = "MLED",
-               .mled_status       = "\\MAIL",
-               .mt_lcd_switch     = S2x_PREFIX "_Q10",
-               .lcd_status        = "\\BKLI",
-               .brightness_up     = S2x_PREFIX "_Q0B",
-               .brightness_down   = S2x_PREFIX "_Q0A"
-       },
+        .name = "S2x",
+        .mt_mled = "MLED",
+        .mled_status = "\\MAIL",
+        .mt_lcd_switch = S2x_PREFIX "_Q10",
+        .lcd_status = "\\BKLI",
+        .brightness_up = S2x_PREFIX "_Q0B",
+        .brightness_down = S2x_PREFIX "_Q0A"},
 
        {
-               .name              = "xxN",
-               .mt_mled           = "MLED",
+        .name = "xxN",
+        .mt_mled = "MLED",
 /* WLED present, but not controlled by ACPI */
-               .mt_lcd_switch     = xxN_PREFIX "_Q10",
-               .lcd_status        = "\\BKLT",
-               .brightness_set    = "SPLV",
-               .brightness_get    = "GPLV",
-               .display_set       = "SDSP",
-               .display_get       = "\\ADVG"
-       }
+        .mt_lcd_switch = xxN_PREFIX "_Q10",
+        .lcd_status = "\\BKLT",
+        .brightness_set = "SPLV",
+        .brightness_get = "GPLV",
+        .display_set = "SDSP",
+        .display_get = "\\ADVG"}
 };
 
 /* procdir we use */
@@ -395,13 +375,13 @@ static struct asus_hotk *hotk;
 static int asus_hotk_add(struct acpi_device *device);
 static int asus_hotk_remove(struct acpi_device *device, int type);
 static struct acpi_driver asus_hotk_driver = {
-       .name =         ACPI_HOTK_NAME,
-       .class =        ACPI_HOTK_CLASS,
-       .ids =          ACPI_HOTK_HID,
-       .ops =          {
-                               .add =          asus_hotk_add,
-                               .remove =       asus_hotk_remove,
-                       },
+       .name = ACPI_HOTK_NAME,
+       .class = ACPI_HOTK_CLASS,
+       .ids = ACPI_HOTK_HID,
+       .ops = {
+               .add = asus_hotk_add,
+               .remove = asus_hotk_remove,
+               },
 };
 
 /* 
@@ -423,11 +403,10 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
        in_obj.type = ACPI_TYPE_INTEGER;
        in_obj.integer.value = val;
 
-       status = acpi_evaluate_object(handle, (char *) method, &params, output);
+       status = acpi_evaluate_object(handle, (char *)method, &params, output);
        return (status == AE_OK);
 }
 
-
 static int read_acpi_int(acpi_handle handle, const char *method, int *val)
 {
        struct acpi_buffer output;
@@ -437,7 +416,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
        output.length = sizeof(out_obj);
        output.pointer = &out_obj;
 
-       status = acpi_evaluate_object(handle, (char *) method, NULL, &output);
+       status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
        *val = out_obj.integer.value;
        return (status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER);
 }
@@ -449,7 +428,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val)
  */
 static int
 proc_read_info(char *page, char **start, off_t off, int count, int *eof,
-               void *data)
+              void *data)
 {
        int len = 0;
        int temp;
@@ -460,7 +439,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
         */
 
        len += sprintf(page, ACPI_HOTK_NAME " " ASUS_ACPI_VERSION "\n");
-       len += sprintf(page + len, "Model reference    : %s\n", 
+       len += sprintf(page + len, "Model reference    : %s\n",
                       hotk->methods->name);
        /* 
         * The SFUN method probably allows the original driver to get the list 
@@ -469,7 +448,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
         * The significance of others is yet to be found.
         */
        if (read_acpi_int(hotk->handle, "SFUN", &temp))
-               len += sprintf(page + len, "SFUN value         : 0x%04x\n", temp);
+               len +=
+                   sprintf(page + len, "SFUN value         : 0x%04x\n", temp);
        /*
         * Another value for userspace: the ASYM method returns 0x02 for
         * battery low and 0x04 for battery critical, its readings tend to be
@@ -478,7 +458,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
         * silently ignored.
         */
        if (read_acpi_int(hotk->handle, "ASYM", &temp))
-               len += sprintf(page + len, "ASYM value         : 0x%04x\n", temp);
+               len +=
+                   sprintf(page + len, "ASYM value         : 0x%04x\n", temp);
        if (asus_info) {
                snprintf(buf, 16, "%d", asus_info->length);
                len += sprintf(page + len, "DSDT length        : %s\n", buf);
@@ -501,7 +482,6 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
        return len;
 }
 
-
 /*
  * /proc handlers
  * We write our info in page, we begin at offset off and cannot write more
@@ -510,8 +490,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
  */
 
 /* Generic LED functions */
-static int
-read_led(const char *ledname, int ledmask)
+static int read_led(const char *ledname, int ledmask)
 {
        if (ledname) {
                int led_status;
@@ -525,7 +504,7 @@ read_led(const char *ledname, int ledmask)
        return (hotk->status & ledmask) ? 1 : 0;
 }
 
-static int parse_arg(const char __user *buf, unsigned long count, int *val)
+static int parse_arg(const char __user * buf, unsigned long count, int *val)
 {
        char s[32];
        if (!count)
@@ -542,8 +521,8 @@ static int parse_arg(const char __user *buf, unsigned long count, int *val)
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char __user *buffer, unsigned long count,
-          char *ledname, int ledmask, int invert)
+write_led(const char __user * buffer, unsigned long count,
+         char *ledname, int ledmask, int invert)
 {
        int value;
        int led_out = 0;
@@ -555,16 +534,16 @@ write_led(const char __user *buffer, unsigned long count,
        hotk->status =
            (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask);
 
-       if (invert) /* invert target value */
+       if (invert)             /* invert target value */
                led_out = !led_out & 0x1;
 
        if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
-               printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", ledname);
+               printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
+                      ledname);
 
        return count;
 }
 
-
 /*
  * Proc handlers for MLED
  */
@@ -572,12 +551,12 @@ static int
 proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
               void *data)
 {
-       return sprintf(page, "%d\n", read_led(hotk->methods->mled_status, MLED_ON));
+       return sprintf(page, "%d\n",
+                      read_led(hotk->methods->mled_status, MLED_ON));
 }
 
-
 static int
-proc_write_mled(struct file *file, const char __user *buffer,
+proc_write_mled(struct file *file, const char __user * buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_mled, MLED_ON, 1);
@@ -590,11 +569,12 @@ static int
 proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
               void *data)
 {
-       return sprintf(page, "%d\n", read_led(hotk->methods->wled_status, WLED_ON));
+       return sprintf(page, "%d\n",
+                      read_led(hotk->methods->wled_status, WLED_ON));
 }
 
 static int
-proc_write_wled(struct file *file, const char __user *buffer,
+proc_write_wled(struct file *file, const char __user * buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_wled, WLED_ON, 0);
@@ -607,35 +587,36 @@ static int
 proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
               void *data)
 {
-       return sprintf(page, "%d\n", read_led(hotk->methods->tled_status, TLED_ON));
+       return sprintf(page, "%d\n",
+                      read_led(hotk->methods->tled_status, TLED_ON));
 }
 
 static int
-proc_write_tled(struct file *file, const char __user *buffer,
+proc_write_tled(struct file *file, const char __user * buffer,
                unsigned long count, void *data)
 {
        return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
 }
 
-
 static int get_lcd_state(void)
 {
        int lcd = 0;
 
        if (hotk->model != L3H) {
-       /* We don't have to check anything if we are here */
+               /* We don't have to check anything if we are here */
                if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
-                       printk(KERN_WARNING "Asus ACPI: Error reading LCD status\n");
-       
+                       printk(KERN_WARNING
+                              "Asus ACPI: Error reading LCD status\n");
+
                if (hotk->model == L2D)
                        lcd = ~lcd;
-       } else { /* L3H and the like have to be handled differently */
+       } else {                /* L3H and the like have to be handled differently */
                acpi_status status = 0;
                struct acpi_object_list input;
                union acpi_object mt_params[2];
                struct acpi_buffer output;
                union acpi_object out_obj;
-               
+
                input.count = 2;
                input.pointer = mt_params;
                /* Note: the following values are partly guessed up, but 
@@ -647,15 +628,17 @@ static int get_lcd_state(void)
 
                output.length = sizeof(out_obj);
                output.pointer = &out_obj;
-               
-               status = acpi_evaluate_object(NULL, hotk->methods->lcd_status, &input, &output);
+
+               status =
+                   acpi_evaluate_object(NULL, hotk->methods->lcd_status,
+                                        &input, &output);
                if (status != AE_OK)
                        return -1;
                if (out_obj.type == ACPI_TYPE_INTEGER)
                        /* That's what the AML code does */
                        lcd = out_obj.integer.value >> 8;
        }
-       
+
        return (lcd & 1);
 }
 
@@ -669,10 +652,13 @@ static int set_lcd_state(int value)
                /* switch */
                if (hotk->model != L3H) {
                        status =
-                           acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch,
+                           acpi_evaluate_object(NULL,
+                                                hotk->methods->mt_lcd_switch,
                                                 NULL, NULL);
-               } else { /* L3H and the like have to be handled differently */
-                       if (!write_acpi_int(hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL))
+               } else {        /* L3H and the like have to be handled differently */
+                       if (!write_acpi_int
+                           (hotk->handle, hotk->methods->mt_lcd_switch, 0x07,
+                            NULL))
                                status = AE_ERROR;
                        /* L3H's AML executes EHK (0x07) upon Fn+F7 keypress, 
                           the exact behaviour is simulated here */
@@ -691,33 +677,33 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
        return sprintf(page, "%d\n", get_lcd_state());
 }
 
-
 static int
-proc_write_lcd(struct file *file, const char __user *buffer,
+proc_write_lcd(struct file *file, const char __user * buffer,
               unsigned long count, void *data)
 {
        int value;
-       
+
        count = parse_arg(buffer, count, &value);
        if (count > 0)
                set_lcd_state(value);
        return count;
 }
 
-
 static int read_brightness(void)
 {
        int value;
-       
-       if(hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
-               if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get, 
+
+       if (hotk->methods->brightness_get) {    /* SPLV/GPLV laptop */
+               if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
                                   &value))
-                       printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
-       } else if (hotk->methods->brightness_status) { /* For D1 for example */
-               if (!read_acpi_int(NULL, hotk->methods->brightness_status, 
+                       printk(KERN_WARNING
+                              "Asus ACPI: Error reading brightness\n");
+       } else if (hotk->methods->brightness_status) {  /* For D1 for example */
+               if (!read_acpi_int(NULL, hotk->methods->brightness_status,
                                   &value))
-                       printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
-       } else /* No GPLV method */
+                       printk(KERN_WARNING
+                              "Asus ACPI: Error reading brightness\n");
+       } else                  /* No GPLV method */
                value = hotk->brightness;
        return value;
 }
@@ -730,23 +716,25 @@ static void set_brightness(int value)
        acpi_status status = 0;
 
        /* SPLV laptop */
-       if(hotk->methods->brightness_set) {
-               if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set, 
+       if (hotk->methods->brightness_set) {
+               if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set,
                                    value, NULL))
-                       printk(KERN_WARNING "Asus ACPI: Error changing brightness\n");
+                       printk(KERN_WARNING
+                              "Asus ACPI: Error changing brightness\n");
                return;
        }
 
        /* No SPLV method if we are here, act as appropriate */
        value -= read_brightness();
        while (value != 0) {
-               status = acpi_evaluate_object(NULL, (value > 0) ? 
-                                             hotk->methods->brightness_up : 
+               status = acpi_evaluate_object(NULL, (value > 0) ?
+                                             hotk->methods->brightness_up :
                                              hotk->methods->brightness_down,
                                              NULL, NULL);
                (value > 0) ? value-- : value++;
                if (ACPI_FAILURE(status))
-                       printk(KERN_WARNING "Asus ACPI: Error changing brightness\n");
+                       printk(KERN_WARNING
+                              "Asus ACPI: Error changing brightness\n");
        }
        return;
 }
@@ -759,7 +747,7 @@ proc_read_brn(char *page, char **start, off_t off, int count, int *eof,
 }
 
 static int
-proc_write_brn(struct file *file, const char __user *buffer,
+proc_write_brn(struct file *file, const char __user * buffer,
               unsigned long count, void *data)
 {
        int value;
@@ -767,7 +755,7 @@ proc_write_brn(struct file *file, const char __user *buffer,
        count = parse_arg(buffer, count, &value);
        if (count > 0) {
                value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
-                       /* 0 <= value <= 15 */
+               /* 0 <= value <= 15 */
                set_brightness(value);
        } else if (count < 0) {
                printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
@@ -779,7 +767,7 @@ proc_write_brn(struct file *file, const char __user *buffer,
 static void set_display(int value)
 {
        /* no sanity check needed for now */
-       if (!write_acpi_int(hotk->handle, hotk->methods->display_set, 
+       if (!write_acpi_int(hotk->handle, hotk->methods->display_set,
                            value, NULL))
                printk(KERN_WARNING "Asus ACPI: Error setting display\n");
        return;
@@ -791,13 +779,14 @@ static void set_display(int value)
  */
 static int
 proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
-             void *data)
+              void *data)
 {
        int value = 0;
-       
+
        if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
-               printk(KERN_WARNING "Asus ACPI: Error reading display status\n");
-       value &= 0x07; /* needed for some models, shouldn't hurt others */
+               printk(KERN_WARNING
+                      "Asus ACPI: Error reading display status\n");
+       value &= 0x07;          /* needed for some models, shouldn't hurt others */
        return sprintf(page, "%d\n", value);
 }
 
@@ -808,8 +797,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
  * simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char __user *buffer,
-              unsigned long count, void *data)
+proc_write_disp(struct file *file, const char __user * buffer,
+               unsigned long count, void *data)
 {
        int value;
 
@@ -822,19 +811,19 @@ proc_write_disp(struct file *file, const char __user *buffer,
        return count;
 }
 
-
-typedef int (proc_readfunc)(char *page, char **start, off_t off, int count,
-                            int *eof, void *data);
-typedef int (proc_writefunc)(struct file *file, const char __user *buffer,
-                             unsigned long count, void *data);
+typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
+                            int *eof, void *data);
+typedef int (proc_writefunc) (struct file * file, const char __user * buffer,
+                             unsigned long count, void *data);
 
 static int
-__init asus_proc_add(char *name, proc_writefunc *writefunc,
-                    proc_readfunc *readfunc, mode_t mode,
-                    struct acpi_device *device)
+__init asus_proc_add(char *name, proc_writefunc * writefunc,
+                    proc_readfunc * readfunc, mode_t mode,
+                    struct acpi_device *device)
 {
-       struct proc_dir_entry *proc = create_proc_entry(name, mode, acpi_device_dir(device));
-       if(!proc) {
+       struct proc_dir_entry *proc =
+           create_proc_entry(name, mode, acpi_device_dir(device));
+       if (!proc) {
                printk(KERN_WARNING "  Unable to create %s fs entry\n", name);
                return -1;
        }
@@ -851,14 +840,14 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
 {
        struct proc_dir_entry *proc;
        mode_t mode;
-       
+
        /*
         * If parameter uid or gid is not changed, keep the default setting for
         * our proc entries (-rw-rw-rw-) else, it means we care about security,
         * and then set to -rw-rw----
         */
 
-       if ((asus_uid == 0) && (asus_gid == 0)){
+       if ((asus_uid == 0) && (asus_gid == 0)) {
                mode = S_IFREG | S_IRUGO | S_IWUGO;
        } else {
                mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
@@ -881,15 +870,18 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
        }
 
        if (hotk->methods->mt_wled) {
-               asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, mode, device);
+               asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled,
+                             mode, device);
        }
 
        if (hotk->methods->mt_mled) {
-               asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, mode, device);
+               asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled,
+                             mode, device);
        }
 
        if (hotk->methods->mt_tled) {
-               asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, mode, device);
+               asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled,
+                             mode, device);
        }
 
        /* 
@@ -897,35 +889,40 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
         * from keyboard 
         */
        if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
-               asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, device);
+               asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode,
+                             device);
        }
-       
+
        if ((hotk->methods->brightness_up && hotk->methods->brightness_down) ||
            (hotk->methods->brightness_get && hotk->methods->brightness_set)) {
-               asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, device);
+               asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode,
+                             device);
        }
 
        if (hotk->methods->display_set) {
-               asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, mode, device);
+               asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp,
+                             mode, device);
        }
 
        return 0;
 }
 
-static int asus_hotk_remove_fs(struct acpi_devicedevice)
+static int asus_hotk_remove_fs(struct acpi_device *device)
 {
-       if(acpi_device_dir(device)) {
-               remove_proc_entry(PROC_INFO,acpi_device_dir(device));
+       if (acpi_device_dir(device)) {
+               remove_proc_entry(PROC_INFO, acpi_device_dir(device));
                if (hotk->methods->mt_wled)
-                       remove_proc_entry(PROC_WLED,acpi_device_dir(device));
+                       remove_proc_entry(PROC_WLED, acpi_device_dir(device));
                if (hotk->methods->mt_mled)
-                       remove_proc_entry(PROC_MLED,acpi_device_dir(device));
+                       remove_proc_entry(PROC_MLED, acpi_device_dir(device));
                if (hotk->methods->mt_tled)
-                       remove_proc_entry(PROC_TLED,acpi_device_dir(device));
+                       remove_proc_entry(PROC_TLED, acpi_device_dir(device));
                if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
                        remove_proc_entry(PROC_LCD, acpi_device_dir(device));
-               if ((hotk->methods->brightness_up && hotk->methods->brightness_down) ||
-                   (hotk->methods->brightness_get && hotk->methods->brightness_set))
+               if ((hotk->methods->brightness_up
+                    && hotk->methods->brightness_down)
+                   || (hotk->methods->brightness_get
+                       && hotk->methods->brightness_set))
                        remove_proc_entry(PROC_BRN, acpi_device_dir(device));
                if (hotk->methods->display_set)
                        remove_proc_entry(PROC_DISP, acpi_device_dir(device));
@@ -933,16 +930,15 @@ static int asus_hotk_remove_fs(struct acpi_device* device)
        return 0;
 }
 
-
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
-       /* TODO Find a better way to handle events count.*/
+       /* TODO Find a better way to handle events count. */
        if (!hotk)
                return;
 
        if ((event & ~((u32) BR_UP)) < 16) {
                hotk->brightness = (event & ~((u32) BR_UP));
-       } else if ((event & ~((u32) BR_DOWN)) < 16 ) {
+       } else if ((event & ~((u32) BR_DOWN)) < 16) {
                hotk->brightness = (event & ~((u32) BR_DOWN));
        }
 
@@ -976,7 +972,7 @@ static int __init asus_hotk_get_info(void)
        if (ACPI_FAILURE(status))
                printk(KERN_WARNING "  Couldn't get the DSDT table header\n");
        else
-               asus_info = (struct acpi_table_header *) dsdt.pointer;
+               asus_info = (struct acpi_table_header *)dsdt.pointer;
 
        /* We have to write 0 on init this far for all ASUS models */
        if (!write_acpi_int(hotk->handle, "INIT", 0, &buffer)) {
@@ -988,15 +984,17 @@ static int __init asus_hotk_get_info(void)
        if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result))
                printk(KERN_WARNING "  Error calling BSTS\n");
        else if (bsts_result)
-               printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n", bsts_result);
+               printk(KERN_NOTICE "  BSTS called, 0x%02x returned\n",
+                      bsts_result);
 
        /* Samsung P30 has a device with a valid _HID whose INIT does not 
         * return anything. Catch this one and any similar here */
        if (buffer.pointer == NULL) {
-               if (asus_info && /* Samsung P30 */
+               if (asus_info &&        /* Samsung P30 */
                    strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
                        hotk->model = P30;
-                       printk(KERN_NOTICE "  Samsung P30 detected, supported\n");
+                       printk(KERN_NOTICE
+                              "  Samsung P30 detected, supported\n");
                } else {
                        hotk->model = M2E;
                        printk(KERN_WARNING "  no string returned by INIT\n");
@@ -1006,10 +1004,11 @@ static int __init asus_hotk_get_info(void)
                hotk->methods = &model_conf[hotk->model];
                return AE_OK;
        }
-       
-       model = (union acpi_object *) buffer.pointer;
+
+       model = (union acpi_object *)buffer.pointer;
        if (model->type == ACPI_TYPE_STRING) {
-               printk(KERN_NOTICE "  %s model detected, ", model->string.pointer);
+               printk(KERN_NOTICE "  %s model detected, ",
+                      model->string.pointer);
        }
 
        hotk->model = END_MODEL;
@@ -1035,7 +1034,7 @@ static int __init asus_hotk_get_info(void)
                 strncmp(model->string.pointer, "M6N", 3) == 0 ||
                 strncmp(model->string.pointer, "S1N", 3) == 0 ||
                 strncmp(model->string.pointer, "S5N", 3) == 0 ||
-                 strncmp(model->string.pointer, "W1N", 3) == 0)
+                strncmp(model->string.pointer, "W1N", 3) == 0)
                hotk->model = xxN;
        else if (strncmp(model->string.pointer, "M1", 2) == 0)
                hotk->model = M1A;
@@ -1069,21 +1068,21 @@ static int __init asus_hotk_get_info(void)
 
        /* Sort of per-model blacklist */
        if (strncmp(model->string.pointer, "L2B", 3) == 0)
-               hotk->methods->lcd_status = NULL; 
+               hotk->methods->lcd_status = NULL;
        /* L2B is similar enough to L3C to use its settings, with this only 
           exception */
        else if (strncmp(model->string.pointer, "S5N", 3) == 0 ||
                 strncmp(model->string.pointer, "M5N", 3) == 0)
-               hotk->methods->mt_mled = NULL; 
+               hotk->methods->mt_mled = NULL;
        /* S5N and M5N have no MLED */
        else if (strncmp(model->string.pointer, "M2N", 3) == 0 ||
                 strncmp(model->string.pointer, "W1N", 3) == 0)
-               hotk->methods->mt_wled = "WLED"; 
+               hotk->methods->mt_wled = "WLED";
        /* M2N and W1N have a usable WLED */
        else if (asus_info) {
                if (strncmp(asus_info->oem_table_id, "L1", 2) == 0)
                        hotk->methods->mled_status = NULL;
-       /* S1300A reports L84F, but L1400B too, account for that */
+               /* S1300A reports L84F, but L1400B too, account for that */
        }
 
        acpi_os_free(model);
@@ -1091,7 +1090,6 @@ static int __init asus_hotk_get_info(void)
        return AE_OK;
 }
 
-
 static int __init asus_hotk_check(void)
 {
        int result = 0;
@@ -1110,7 +1108,6 @@ static int __init asus_hotk_check(void)
        return result;
 }
 
-
 static int __init asus_hotk_add(struct acpi_device *device)
 {
        acpi_status status = AE_OK;
@@ -1123,7 +1120,7 @@ static int __init asus_hotk_add(struct acpi_device *device)
               ASUS_ACPI_VERSION);
 
        hotk =
-           (struct asus_hotk *) kmalloc(sizeof(struct asus_hotk), GFP_KERNEL);
+           (struct asus_hotk *)kmalloc(sizeof(struct asus_hotk), GFP_KERNEL);
        if (!hotk)
                return -ENOMEM;
        memset(hotk, 0, sizeof(struct asus_hotk));
@@ -1134,7 +1131,6 @@ static int __init asus_hotk_add(struct acpi_device *device)
        acpi_driver_data(device) = hotk;
        hotk->device = device;
 
-
        result = asus_hotk_check();
        if (result)
                goto end;
@@ -1153,17 +1149,22 @@ static int __init asus_hotk_add(struct acpi_device *device)
                printk(KERN_ERR "  Error installing notify handler\n");
 
        /* For laptops without GPLV: init the hotk->brightness value */
-       if ((!hotk->methods->brightness_get) && (!hotk->methods->brightness_status) &&
-           (hotk->methods->brightness_up && hotk->methods->brightness_down)) {
-               status = acpi_evaluate_object(NULL, hotk->methods->brightness_down,
-                                             NULL, NULL);
+       if ((!hotk->methods->brightness_get)
+           && (!hotk->methods->brightness_status)
+           && (hotk->methods->brightness_up
+               && hotk->methods->brightness_down)) {
+               status =
+                   acpi_evaluate_object(NULL, hotk->methods->brightness_down,
+                                        NULL, NULL);
                if (ACPI_FAILURE(status))
                        printk(KERN_WARNING "  Error changing brightness\n");
                else {
-                       status = acpi_evaluate_object(NULL, hotk->methods->brightness_up,
-                                                     NULL, NULL);
+                       status =
+                           acpi_evaluate_object(NULL,
+                                                hotk->methods->brightness_up,
+                                                NULL, NULL);
                        if (ACPI_FAILURE(status))
-                               printk(KERN_WARNING "  Strange, error changing" 
+                               printk(KERN_WARNING "  Strange, error changing"
                                       " brightness\n");
                }
        }
@@ -1176,7 +1177,6 @@ static int __init asus_hotk_add(struct acpi_device *device)
        return result;
 }
 
-
 static int asus_hotk_remove(struct acpi_device *device, int type)
 {
        acpi_status status = 0;
@@ -1196,7 +1196,6 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
        return 0;
 }
 
-
 static int __init asus_acpi_init(void)
 {
        int result;
@@ -1204,9 +1203,9 @@ static int __init asus_acpi_init(void)
        if (acpi_disabled)
                return -ENODEV;
 
-       if (!acpi_specific_hotkey_enabled){
+       if (!acpi_specific_hotkey_enabled) {
                printk(KERN_ERR "Using generic hotkey driver\n");
-               return -ENODEV; 
+               return -ENODEV;
        }
        asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
        if (!asus_proc_dir) {
@@ -1225,7 +1224,6 @@ static int __init asus_acpi_init(void)
        return 0;
 }
 
-
 static void __exit asus_acpi_exit(void)
 {
        acpi_bus_unregister_driver(&asus_hotk_driver);
index c55feca9b7d5e06c1099558e873595eaf944ba14..702e857e98c53f843fa31970d4b78f1c98eaf5bd 100644 (file)
@@ -34,7 +34,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
 
 #define ACPI_BATTERY_FORMAT_BIF        "NNNNNNNNNSSSS"
 #define ACPI_BATTERY_UNITS_WATTS       "mW"
 #define ACPI_BATTERY_UNITS_AMPS                "mA"
 
-
 #define _COMPONENT             ACPI_BATTERY_COMPONENT
-ACPI_MODULE_NAME               ("acpi_battery")
+ACPI_MODULE_NAME("acpi_battery")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_battery_add (struct acpi_device *device);
-static int acpi_battery_remove (struct acpi_device *device, int type);
+static int acpi_battery_add(struct acpi_device *device);
+static int acpi_battery_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_battery_driver = {
-       .name =         ACPI_BATTERY_DRIVER_NAME,
-       .class =        ACPI_BATTERY_CLASS,
-       .ids =          ACPI_BATTERY_HID,
-       .ops =          {
-                               .add =          acpi_battery_add,
-                               .remove =       acpi_battery_remove,
-                       },
+       .name = ACPI_BATTERY_DRIVER_NAME,
+       .class = ACPI_BATTERY_CLASS,
+       .ids = ACPI_BATTERY_HID,
+       .ops = {
+               .add = acpi_battery_add,
+               .remove = acpi_battery_remove,
+               },
 };
 
 struct acpi_battery_status {
-       acpi_integer            state;
-       acpi_integer            present_rate;
-       acpi_integer            remaining_capacity;
-       acpi_integer            present_voltage;
+       acpi_integer state;
+       acpi_integer present_rate;
+       acpi_integer remaining_capacity;
+       acpi_integer present_voltage;
 };
 
 struct acpi_battery_info {
-       acpi_integer            power_unit;
-       acpi_integer            design_capacity;
-       acpi_integer            last_full_capacity;
-       acpi_integer            battery_technology;
-       acpi_integer            design_voltage;
-       acpi_integer            design_capacity_warning;
-       acpi_integer            design_capacity_low;
-       acpi_integer            battery_capacity_granularity_1;
-       acpi_integer            battery_capacity_granularity_2;
-       acpi_string             model_number;
-       acpi_string             serial_number;
-       acpi_string             battery_type;
-       acpi_string             oem_info;
+       acpi_integer power_unit;
+       acpi_integer design_capacity;
+       acpi_integer last_full_capacity;
+       acpi_integer battery_technology;
+       acpi_integer design_voltage;
+       acpi_integer design_capacity_warning;
+       acpi_integer design_capacity_low;
+       acpi_integer battery_capacity_granularity_1;
+       acpi_integer battery_capacity_granularity_2;
+       acpi_string model_number;
+       acpi_string serial_number;
+       acpi_string battery_type;
+       acpi_string oem_info;
 };
 
 struct acpi_battery_flags {
-       u8                      present:1;      /* Bay occupied? */
-       u8                      power_unit:1;   /* 0=watts, 1=apms */
-       u8                      alarm:1;        /* _BTP present? */
-       u8                      reserved:5;
+       u8 present:1;           /* Bay occupied? */
+       u8 power_unit:1;        /* 0=watts, 1=apms */
+       u8 alarm:1;             /* _BTP present? */
+       u8 reserved:5;
 };
 
 struct acpi_battery_trips {
-       unsigned long           warning;
-       unsigned long           low;
+       unsigned long warning;
+       unsigned long low;
 };
 
 struct acpi_battery {
-       acpi_handle             handle;
+       acpi_handle handle;
        struct acpi_battery_flags flags;
        struct acpi_battery_trips trips;
-       unsigned long           alarm;
+       unsigned long alarm;
        struct acpi_battery_info *info;
 };
 
-
 /* --------------------------------------------------------------------------
                                Battery Management
    -------------------------------------------------------------------------- */
 
 static int
-acpi_battery_get_info (
-       struct acpi_battery     *battery,
-       struct acpi_battery_info **bif)
+acpi_battery_get_info(struct acpi_battery *battery,
+                     struct acpi_battery_info **bif)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       struct acpi_buffer      format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
-                                               ACPI_BATTERY_FORMAT_BIF};
-       struct acpi_buffer      data = {0, NULL};
-       union acpi_object       *package = NULL;
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF),
+               ACPI_BATTERY_FORMAT_BIF
+       };
+       struct acpi_buffer data = { 0, NULL };
+       union acpi_object *package = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_get_info");
 
@@ -148,7 +145,7 @@ acpi_battery_get_info (
                return_VALUE(-ENODEV);
        }
 
-       package = (union acpi_object *) buffer.pointer;
+       package = (union acpi_object *)buffer.pointer;
 
        /* Extract Package Data */
 
@@ -174,27 +171,27 @@ acpi_battery_get_info (
                goto end;
        }
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        if (!result)
-               (*bif) = (struct acpi_battery_info *) data.pointer;
+               (*bif) = (struct acpi_battery_info *)data.pointer;
 
        return_VALUE(result);
 }
 
 static int
-acpi_battery_get_status (
-       struct acpi_battery     *battery,
-       struct acpi_battery_status **bst)
+acpi_battery_get_status(struct acpi_battery *battery,
+                       struct acpi_battery_status **bst)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       struct acpi_buffer      format = {sizeof(ACPI_BATTERY_FORMAT_BST),
-                                               ACPI_BATTERY_FORMAT_BST};
-       struct acpi_buffer      data = {0, NULL};
-       union acpi_object       *package = NULL;
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST),
+               ACPI_BATTERY_FORMAT_BST
+       };
+       struct acpi_buffer data = { 0, NULL };
+       union acpi_object *package = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_get_status");
 
@@ -209,7 +206,7 @@ acpi_battery_get_status (
                return_VALUE(-ENODEV);
        }
 
-       package = (union acpi_object *) buffer.pointer;
+       package = (union acpi_object *)buffer.pointer;
 
        /* Extract Package Data */
 
@@ -235,24 +232,21 @@ acpi_battery_get_status (
                goto end;
        }
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        if (!result)
-               (*bst) = (struct acpi_battery_status *) data.pointer;
+               (*bst) = (struct acpi_battery_status *)data.pointer;
 
        return_VALUE(result);
 }
 
-
 static int
-acpi_battery_set_alarm (
-       struct acpi_battery     *battery,
-       unsigned long           alarm)
+acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
 {
-       acpi_status             status = 0;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list arg_list = {1, &arg0};
+       acpi_status status = 0;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &arg0 };
 
        ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
 
@@ -275,19 +269,16 @@ acpi_battery_set_alarm (
        return_VALUE(0);
 }
 
-
-static int
-acpi_battery_check (
-       struct acpi_battery     *battery)
+static int acpi_battery_check(struct acpi_battery *battery)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       acpi_handle             handle = NULL;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       acpi_handle handle = NULL;
+       struct acpi_device *device = NULL;
        struct acpi_battery_info *bif = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_check");
-       
+
        if (!battery)
                return_VALUE(-EINVAL);
 
@@ -336,18 +327,17 @@ acpi_battery_check (
        return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_battery_dir;
+static struct proc_dir_entry *acpi_battery_dir;
 static int acpi_battery_read_info(struct seq_file *seq, void *offset)
 {
-       int                     result = 0;
-       struct acpi_battery     *battery = (struct acpi_battery *) seq->private;
+       int result = 0;
+       struct acpi_battery *battery = (struct acpi_battery *)seq->private;
        struct acpi_battery_info *bif = NULL;
-       char                    *units = "?";
+       char *units = "?";
 
        ACPI_FUNCTION_TRACE("acpi_battery_read_info");
 
@@ -369,19 +359,21 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
                goto end;
        }
 
-       units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
-                                       
+       units =
+           bif->
+           power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+
        if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
                seq_printf(seq, "design capacity:         unknown\n");
        else
                seq_printf(seq, "design capacity:         %d %sh\n",
-                       (u32) bif->design_capacity, units);
+                          (u32) bif->design_capacity, units);
 
        if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
                seq_printf(seq, "last full capacity:      unknown\n");
        else
                seq_printf(seq, "last full capacity:      %d %sh\n",
-                       (u32) bif->last_full_capacity, units);
+                          (u32) bif->last_full_capacity, units);
 
        switch ((u32) bif->battery_technology) {
        case 0:
@@ -399,26 +391,22 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
                seq_printf(seq, "design voltage:          unknown\n");
        else
                seq_printf(seq, "design voltage:          %d mV\n",
-                       (u32) bif->design_voltage);
-       
+                          (u32) bif->design_voltage);
+
        seq_printf(seq, "design capacity warning: %d %sh\n",
-               (u32) bif->design_capacity_warning, units);
+                  (u32) bif->design_capacity_warning, units);
        seq_printf(seq, "design capacity low:     %d %sh\n",
-               (u32) bif->design_capacity_low, units);
+                  (u32) bif->design_capacity_low, units);
        seq_printf(seq, "capacity granularity 1:  %d %sh\n",
-               (u32) bif->battery_capacity_granularity_1, units);
+                  (u32) bif->battery_capacity_granularity_1, units);
        seq_printf(seq, "capacity granularity 2:  %d %sh\n",
-               (u32) bif->battery_capacity_granularity_2, units);
-       seq_printf(seq, "model number:            %s\n",
-               bif->model_number);
-       seq_printf(seq, "serial number:           %s\n",
-               bif->serial_number);
-       seq_printf(seq, "battery type:            %s\n",
-               bif->battery_type);
-       seq_printf(seq, "OEM info:                %s\n",
-               bif->oem_info);
-
-end:
+                  (u32) bif->battery_capacity_granularity_2, units);
+       seq_printf(seq, "model number:            %s\n", bif->model_number);
+       seq_printf(seq, "serial number:           %s\n", bif->serial_number);
+       seq_printf(seq, "battery type:            %s\n", bif->battery_type);
+       seq_printf(seq, "OEM info:                %s\n", bif->oem_info);
+
+      end:
        kfree(bif);
 
        return_VALUE(0);
@@ -429,14 +417,12 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_battery_read_info, PDE(inode)->data);
 }
 
-
-static int
-acpi_battery_read_state (struct seq_file *seq, void *offset)
+static int acpi_battery_read_state(struct seq_file *seq, void *offset)
 {
-       int                     result = 0;
-       struct acpi_battery     *battery = (struct acpi_battery *) seq->private;
+       int result = 0;
+       struct acpi_battery *battery = (struct acpi_battery *)seq->private;
        struct acpi_battery_status *bst = NULL;
-       char                    *units = "?";
+       char *units = "?";
 
        ACPI_FUNCTION_TRACE("acpi_battery_read_state");
 
@@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
 
        /* Battery Units */
 
-       units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+       units =
+           battery->flags.
+           power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
 
        /* Battery Status (_BST) */
 
@@ -467,12 +455,12 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
        else
                seq_printf(seq, "capacity state:          critical\n");
 
-       if ((bst->state & 0x01) && (bst->state & 0x02)){
-               seq_printf(seq, "charging state:          charging/discharging\n");
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Battery Charging and Discharging?\n"));
-       }
-       else if (bst->state & 0x01)
+       if ((bst->state & 0x01) && (bst->state & 0x02)) {
+               seq_printf(seq,
+                          "charging state:          charging/discharging\n");
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Battery Charging and Discharging?\n"));
+       else if (bst->state & 0x01)
                seq_printf(seq, "charging state:          discharging\n");
        else if (bst->state & 0x02)
                seq_printf(seq, "charging state:          charging\n");
@@ -484,21 +472,21 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
                seq_printf(seq, "present rate:            unknown\n");
        else
                seq_printf(seq, "present rate:            %d %s\n",
-                       (u32) bst->present_rate, units);
+                          (u32) bst->present_rate, units);
 
        if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
                seq_printf(seq, "remaining capacity:      unknown\n");
        else
                seq_printf(seq, "remaining capacity:      %d %sh\n",
-                       (u32) bst->remaining_capacity, units);
+                          (u32) bst->remaining_capacity, units);
 
        if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
                seq_printf(seq, "present voltage:         unknown\n");
        else
                seq_printf(seq, "present voltage:         %d mV\n",
-                       (u32) bst->present_voltage);
+                          (u32) bst->present_voltage);
 
-end:
+      end:
        kfree(bst);
 
        return_VALUE(0);
@@ -509,12 +497,10 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_battery_read_state, PDE(inode)->data);
 }
 
-
-static int
-acpi_battery_read_alarm (struct seq_file *seq, void *offset)
+static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
 {
-       struct acpi_battery     *battery = (struct acpi_battery *) seq->private;
-       char                    *units = "?";
+       struct acpi_battery *battery = (struct acpi_battery *)seq->private;
+       char *units = "?";
 
        ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
 
@@ -527,8 +513,10 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
        }
 
        /* Battery Units */
-       
-       units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
+
+       units =
+           battery->flags.
+           power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
 
        /* Battery Alarm */
 
@@ -538,22 +526,19 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
        else
                seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
 
-end:
+      end:
        return_VALUE(0);
 }
 
-
 static ssize_t
-acpi_battery_write_alarm (
-       struct file     *file,
-       const char      __user *buffer,
-       size_t          count,
-       loff_t          *ppos)
+acpi_battery_write_alarm(struct file *file,
+                        const char __user * buffer,
+                        size_t count, loff_t * ppos)
 {
-       int                     result = 0;
-       char                    alarm_string[12] = {'\0'};
-       struct seq_file         *m = (struct seq_file *)file->private_data;
-       struct acpi_battery     *battery = (struct acpi_battery *)m->private;
+       int result = 0;
+       char alarm_string[12] = { '\0' };
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_battery *battery = (struct acpi_battery *)m->private;
 
        ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
 
@@ -565,11 +550,11 @@ acpi_battery_write_alarm (
 
        if (copy_from_user(alarm_string, buffer, count))
                return_VALUE(-EFAULT);
-       
+
        alarm_string[count] = '\0';
 
-       result = acpi_battery_set_alarm(battery, 
-               simple_strtoul(alarm_string, NULL, 0));
+       result = acpi_battery_set_alarm(battery,
+                                       simple_strtoul(alarm_string, NULL, 0));
        if (result)
                return_VALUE(result);
 
@@ -582,41 +567,39 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
 }
 
 static struct file_operations acpi_battery_info_ops = {
-       .open           = acpi_battery_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_battery_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
        .owner = THIS_MODULE,
 };
 
 static struct file_operations acpi_battery_state_ops = {
-       .open           = acpi_battery_state_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_battery_state_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
        .owner = THIS_MODULE,
 };
 
 static struct file_operations acpi_battery_alarm_ops = {
-       .open           = acpi_battery_alarm_open_fs,
-       .read           = seq_read,
-       .write          = acpi_battery_write_alarm,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_battery_alarm_open_fs,
+       .read = seq_read,
+       .write = acpi_battery_write_alarm,
+       .llseek = seq_lseek,
+       .release = single_release,
        .owner = THIS_MODULE,
 };
 
-static int
-acpi_battery_add_fs (
-       struct acpi_device      *device)
+static int acpi_battery_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_battery_dir);
+                                                    acpi_battery_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                acpi_device_dir(device)->owner = THIS_MODULE;
@@ -624,24 +607,24 @@ acpi_battery_add_fs (
 
        /* 'info' [R] */
        entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_BATTERY_FILE_INFO));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_BATTERY_FILE_INFO));
        else {
-               entry->proc_fops = &acpi_battery_info_ops; 
+               entry->proc_fops = &acpi_battery_info_ops;
                entry->data = acpi_driver_data(device);
                entry->owner = THIS_MODULE;
        }
 
        /* 'status' [R] */
        entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_BATTERY_FILE_STATUS));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_BATTERY_FILE_STATUS));
        else {
                entry->proc_fops = &acpi_battery_state_ops;
                entry->data = acpi_driver_data(device);
@@ -650,11 +633,12 @@ acpi_battery_add_fs (
 
        /* 'alarm' [R/W] */
        entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_BATTERY_FILE_ALARM));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_BATTERY_FILE_ALARM));
        else {
                entry->proc_fops = &acpi_battery_alarm_ops;
                entry->data = acpi_driver_data(device);
@@ -664,10 +648,7 @@ acpi_battery_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_battery_remove_fs (
-       struct acpi_device      *device)
+static int acpi_battery_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
 
@@ -686,19 +667,14 @@ acpi_battery_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static void
-acpi_battery_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_battery     *battery = (struct acpi_battery *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_battery *battery = (struct acpi_battery *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_notify");
 
@@ -716,24 +692,21 @@ acpi_battery_notify (
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-
-static int
-acpi_battery_add (
-       struct acpi_device      *device)
+static int acpi_battery_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_battery     *battery = NULL;
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_battery *battery = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_add");
-       
+
        if (!device)
                return_VALUE(-EINVAL);
 
@@ -756,19 +729,20 @@ acpi_battery_add (
                goto end;
 
        status = acpi_install_notify_handler(battery->handle,
-               ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery);
+                                            ACPI_DEVICE_NOTIFY,
+                                            acpi_battery_notify, battery);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                result = -ENODEV;
                goto end;
        }
 
        printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
-               ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
-               device->status.battery_present?"present":"absent");
-               
-end:
+              ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
+              device->status.battery_present ? "present" : "absent");
+
+      end:
        if (result) {
                acpi_battery_remove_fs(device);
                kfree(battery);
@@ -777,27 +751,24 @@ end:
        return_VALUE(result);
 }
 
-
-static int
-acpi_battery_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_battery_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = 0;
-       struct acpi_battery     *battery = NULL;
+       acpi_status status = 0;
+       struct acpi_battery *battery = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_battery_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       battery = (struct acpi_battery *) acpi_driver_data(device);
+       battery = (struct acpi_battery *)acpi_driver_data(device);
 
        status = acpi_remove_notify_handler(battery->handle,
-               ACPI_DEVICE_NOTIFY, acpi_battery_notify);
+                                           ACPI_DEVICE_NOTIFY,
+                                           acpi_battery_notify);
        if (ACPI_FAILURE(status))
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
 
        acpi_battery_remove_fs(device);
 
@@ -806,11 +777,9 @@ acpi_battery_remove (
        return_VALUE(0);
 }
 
-
-static int __init
-acpi_battery_init (void)
+static int __init acpi_battery_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_battery_init");
 
@@ -828,9 +797,7 @@ acpi_battery_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_battery_exit (void)
+static void __exit acpi_battery_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_battery_exit");
 
@@ -841,6 +808,5 @@ acpi_battery_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_battery_init);
 module_exit(acpi_battery_exit);
index 4c010e7f11b8e58162721564a13c66971c6a87d1..9824f679a910aa83e96078a9bafc646addc3cdf3 100644 (file)
@@ -26,7 +26,6 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <acpi/acpi_bus.h>
 #include <linux/dmi.h>
 
-enum acpi_blacklist_predicates
-{
-        all_versions,
-        less_than_or_equal,
-        equal,
-        greater_than_or_equal,
+enum acpi_blacklist_predicates {
+       all_versions,
+       less_than_or_equal,
+       equal,
+       greater_than_or_equal,
 };
 
-struct acpi_blacklist_item
-{
-        char            oem_id[7];
-        char            oem_table_id[9];
-        u32             oem_revision;
-        acpi_table_type table;
-        enum acpi_blacklist_predicates oem_revision_predicate;
-        char            *reason;
-        u32             is_critical_error;
+struct acpi_blacklist_item {
+       char oem_id[7];
+       char oem_table_id[9];
+       u32 oem_revision;
+       acpi_table_type table;
+       enum acpi_blacklist_predicates oem_revision_predicate;
+       char *reason;
+       u32 is_critical_error;
 };
 
 /*
  * POLICY: If *anything* doesn't work, put it on the blacklist.
  *        If they are critical errors, mark it critical, and abort driver load.
  */
-static struct acpi_blacklist_item acpi_blacklist[] __initdata =
-{
+static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
        /* Compaq Presario 1700 */
-       {"PTLTD ", "  DSDT  ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
+       {"PTLTD ", "  DSDT  ", 0x06040000, ACPI_DSDT, less_than_or_equal,
+        "Multiple problems", 1},
        /* Sony FX120, FX140, FX150? */
-       {"SONY  ", "U0      ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
+       {"SONY  ", "U0      ", 0x20010313, ACPI_DSDT, less_than_or_equal,
+        "ACPI driver problem", 1},
        /* Compaq Presario 800, Insyde BIOS */
-       {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
+       {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
+        "Does not use _REG to protect EC OpRegions", 1},
        /* IBM 600E - _ADR should return 7, but it returns 1 */
-       {"IBM   ", "TP600E  ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
-       {"ASUS\0\0", "P2B-S   ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
+       {"IBM   ", "TP600E  ", 0x00000105, ACPI_DSDT, less_than_or_equal,
+        "Incorrect _ADR", 1},
+       {"ASUS\0\0", "P2B-S   ", 0, ACPI_DSDT, all_versions,
+        "Bogus PCI routing", 1},
 
        {""}
 };
 
-
 #if    CONFIG_ACPI_BLACKLIST_YEAR
 
-static int __init
-blacklist_by_year(void)
+static int __init blacklist_by_year(void)
 {
        int year;
        char *s = dmi_get_system_info(DMI_BIOS_DATE);
@@ -92,36 +91,38 @@ blacklist_by_year(void)
 
        s += 1;
 
-       year = simple_strtoul(s,NULL,0); 
+       year = simple_strtoul(s, NULL, 0);
 
-       if (year < 100) {               /* 2-digit year */
+       if (year < 100) {       /* 2-digit year */
                year += 1900;
                if (year < 1996)        /* no dates < spec 1.0 */
                        year += 100;
        }
 
        if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
-               printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), " 
-                       "acpi=force is required to enable ACPI\n",
-                       year, CONFIG_ACPI_BLACKLIST_YEAR);
+               printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
+                      "acpi=force is required to enable ACPI\n",
+                      year, CONFIG_ACPI_BLACKLIST_YEAR);
                return 1;
        }
        return 0;
 }
 #else
-static inline int blacklist_by_year(void) { return 0; }
+static inline int blacklist_by_year(void)
+{
+       return 0;
+}
 #endif
 
-int __init
-acpi_blacklisted(void)
+int __init acpi_blacklisted(void)
 {
        int i = 0;
        int blacklisted = 0;
        struct acpi_table_header *table_header;
 
-       while (acpi_blacklist[i].oem_id[0] != '\0')
-       {
-               if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) {
+       while (acpi_blacklist[i].oem_id[0] != '\0') {
+               if (acpi_get_table_header_early
+                   (acpi_blacklist[i].table, &table_header)) {
                        i++;
                        continue;
                }
@@ -131,33 +132,43 @@ acpi_blacklisted(void)
                        continue;
                }
 
-               if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
+               if (strncmp
+                   (acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
+                    8)) {
                        i++;
                        continue;
                }
 
                if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
-                   || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
-                       && table_header->oem_revision <= acpi_blacklist[i].oem_revision)
-                   || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
-                       && table_header->oem_revision >= acpi_blacklist[i].oem_revision)
+                   || (acpi_blacklist[i].oem_revision_predicate ==
+                       less_than_or_equal
+                       && table_header->oem_revision <=
+                       acpi_blacklist[i].oem_revision)
+                   || (acpi_blacklist[i].oem_revision_predicate ==
+                       greater_than_or_equal
+                       && table_header->oem_revision >=
+                       acpi_blacklist[i].oem_revision)
                    || (acpi_blacklist[i].oem_revision_predicate == equal
-                       && table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
-
-                       printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
-                               "Revision 0x%x has a known ACPI BIOS problem.\n",
-                               acpi_blacklist[i].oem_id,
-                               acpi_blacklist[i].oem_table_id,
-                               acpi_blacklist[i].oem_revision);
-
-                       printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
-                               acpi_blacklist[i].reason,
-                               (acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
+                       && table_header->oem_revision ==
+                       acpi_blacklist[i].oem_revision)) {
+
+                       printk(KERN_ERR PREFIX
+                              "Vendor \"%6.6s\" System \"%8.8s\" "
+                              "Revision 0x%x has a known ACPI BIOS problem.\n",
+                              acpi_blacklist[i].oem_id,
+                              acpi_blacklist[i].oem_table_id,
+                              acpi_blacklist[i].oem_revision);
+
+                       printk(KERN_ERR PREFIX
+                              "Reason: %s. This is a %s error\n",
+                              acpi_blacklist[i].reason,
+                              (acpi_blacklist[i].
+                               is_critical_error ? "non-recoverable" :
+                               "recoverable"));
 
                        blacklisted = acpi_blacklist[i].is_critical_error;
                        break;
-               }
-               else {
+               } else {
                        i++;
                }
        }
@@ -166,4 +177,3 @@ acpi_blacklisted(void)
 
        return blacklisted;
 }
-
index d77c2307883c65efbf57d34b4dec54799d0a2337..6a4da417c16b1f996435fd49b8418302ad430406 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME               ("acpi_bus")
-
+ACPI_MODULE_NAME("acpi_bus")
 #ifdef CONFIG_X86
 extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
 #endif
 
-FADT_DESCRIPTOR                        acpi_fadt;
+FADT_DESCRIPTOR acpi_fadt;
 EXPORT_SYMBOL(acpi_fadt);
 
-struct acpi_device             *acpi_root;
-struct proc_dir_entry          *acpi_root_dir;
+struct acpi_device *acpi_root;
+struct proc_dir_entry *acpi_root_dir;
 EXPORT_SYMBOL(acpi_root_dir);
 
 #define STRUCT_TO_INT(s)       (*((int*)&s))
@@ -57,12 +55,9 @@ EXPORT_SYMBOL(acpi_root_dir);
                                 Device Management
    -------------------------------------------------------------------------- */
 
-int
-acpi_bus_get_device (
-       acpi_handle             handle,
-       struct acpi_device      **device)
+int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
 {
-       acpi_status             status = AE_OK;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("acpi_bus_get_device");
 
@@ -71,24 +66,23 @@ acpi_bus_get_device (
 
        /* TBD: Support fixed-feature devices */
 
-       status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
+       status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
        if (ACPI_FAILURE(status) || !*device) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
-                       handle));
+                                 handle));
                return_VALUE(-ENODEV);
        }
 
        return_VALUE(0);
 }
+
 EXPORT_SYMBOL(acpi_bus_get_device);
 
-int
-acpi_bus_get_status (
-       struct acpi_device      *device)
+int acpi_bus_get_status(struct acpi_device *device)
 {
-       acpi_status             status = AE_OK;
-       unsigned long           sta = 0;
-       
+       acpi_status status = AE_OK;
+       unsigned long sta = 0;
+
        ACPI_FUNCTION_TRACE("acpi_bus_get_status");
 
        if (!device)
@@ -98,10 +92,11 @@ acpi_bus_get_status (
         * Evaluate _STA if present.
         */
        if (device->flags.dynamic_status) {
-               status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
+               status =
+                   acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
                if (ACPI_FAILURE(status))
                        return_VALUE(-ENODEV);
-               STRUCT_TO_INT(device->status) = (int) sta;
+               STRUCT_TO_INT(device->status) = (int)sta;
        }
 
        /*
@@ -115,33 +110,30 @@ acpi_bus_get_status (
 
        if (device->status.functional && !device->status.present) {
                printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
-                       "functional but not present; setting present\n",
-                       device->pnp.bus_id,
-                       (u32) STRUCT_TO_INT(device->status));
+                      "functional but not present; setting present\n",
+                      device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
                device->status.present = 1;
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
-               device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
+                         device->pnp.bus_id,
+                         (u32) STRUCT_TO_INT(device->status)));
 
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_get_status);
 
+EXPORT_SYMBOL(acpi_bus_get_status);
 
 /* --------------------------------------------------------------------------
                                  Power Management
    -------------------------------------------------------------------------- */
 
-int
-acpi_bus_get_power (
-       acpi_handle             handle,
-       int                     *state)
+int acpi_bus_get_power(acpi_handle handle, int *state)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_device      *device = NULL;
-       unsigned long           psc = 0;
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_device *device = NULL;
+       unsigned long psc = 0;
 
        ACPI_FUNCTION_TRACE("acpi_bus_get_power");
 
@@ -157,20 +149,18 @@ acpi_bus_get_power (
                        *state = device->parent->power.state;
                else
                        *state = ACPI_STATE_D0;
-       }
-       else {
+       } else {
                /*
                 * Get the device's power state either directly (via _PSC) or 
                 * indirectly (via power resources).
                 */
                if (device->power.flags.explicit_get) {
-                       status = acpi_evaluate_integer(device->handle, "_PSC", 
-                               NULL, &psc);
+                       status = acpi_evaluate_integer(device->handle, "_PSC",
+                                                      NULL, &psc);
                        if (ACPI_FAILURE(status))
                                return_VALUE(-ENODEV);
-                       device->power.state = (int) psc;
-               }
-               else if (device->power.flags.power_resources) {
+                       device->power.state = (int)psc;
+               } else if (device->power.flags.power_resources) {
                        result = acpi_power_get_inferred_state(device);
                        if (result)
                                return_VALUE(result);
@@ -180,22 +170,19 @@ acpi_bus_get_power (
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
-               device->pnp.bus_id, device->power.state));
+                         device->pnp.bus_id, device->power.state));
 
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_get_power);
 
+EXPORT_SYMBOL(acpi_bus_get_power);
 
-int
-acpi_bus_set_power (
-       acpi_handle             handle,
-       int                     state)
+int acpi_bus_set_power(acpi_handle handle, int state)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_device      *device = NULL;
-       char                    object_name[5] = {'_','P','S','0'+state,'\0'};
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_device *device = NULL;
+       char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_bus_set_power");
 
@@ -209,7 +196,8 @@ acpi_bus_set_power (
        /* Make sure this is a valid target state */
 
        if (!device->flags.power_manageable) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Device is not power manageable\n"));
                return_VALUE(-ENODEV);
        }
        /*
@@ -219,15 +207,18 @@ acpi_bus_set_power (
        if (device->power.state == ACPI_STATE_UNKNOWN)
                acpi_bus_get_power(device->handle, &device->power.state);
        if (state == device->power.state) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
+                                 state));
                return_VALUE(0);
        }
        if (!device->power.states[state].flags.valid) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n",
+                                 state));
                return_VALUE(-ENODEV);
        }
        if (device->parent && (state < device->parent->power.state)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Cannot set device to a higher-powered state than parent\n"));
                return_VALUE(-ENODEV);
        }
 
@@ -245,18 +236,17 @@ acpi_bus_set_power (
                                goto end;
                }
                if (device->power.states[state].flags.explicit_set) {
-                       status = acpi_evaluate_object(device->handle, 
-                               object_name, NULL, NULL);
+                       status = acpi_evaluate_object(device->handle,
+                                                     object_name, NULL, NULL);
                        if (ACPI_FAILURE(status)) {
                                result = -ENODEV;
                                goto end;
                        }
                }
-       }
-       else {
+       } else {
                if (device->power.states[state].flags.explicit_set) {
-                       status = acpi_evaluate_object(device->handle, 
-                               object_name, NULL, NULL);
+                       status = acpi_evaluate_object(device->handle,
+                                                     object_name, NULL, NULL);
                        if (ACPI_FAILURE(status)) {
                                result = -ENODEV;
                                goto end;
@@ -269,19 +259,20 @@ acpi_bus_set_power (
                }
        }
 
-end:
+      end:
        if (result)
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
-                       device->pnp.bus_id, state));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Error transitioning device [%s] to D%d\n",
+                                 device->pnp.bus_id, state));
        else
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
-                       device->pnp.bus_id, state));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Device [%s] transitioned to D%d\n",
+                                 device->pnp.bus_id, state));
 
        return_VALUE(result);
 }
-EXPORT_SYMBOL(acpi_bus_set_power);
-
 
+EXPORT_SYMBOL(acpi_bus_set_power);
 
 /* --------------------------------------------------------------------------
                                 Event Management
@@ -292,16 +283,12 @@ static DEFINE_SPINLOCK(acpi_bus_event_lock);
 LIST_HEAD(acpi_bus_event_list);
 DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
 
-extern int                     event_is_open;
+extern int event_is_open;
 
-int
-acpi_bus_generate_event (
-       struct acpi_device      *device,
-       u8                      type,
-       int                     data)
+int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
 {
-       struct acpi_bus_event   *event = NULL;
-       unsigned long           flags = 0;
+       struct acpi_bus_event *event = NULL;
+       unsigned long flags = 0;
 
        ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
 
@@ -329,14 +316,13 @@ acpi_bus_generate_event (
 
        return_VALUE(0);
 }
+
 EXPORT_SYMBOL(acpi_bus_generate_event);
 
-int
-acpi_bus_receive_event (
-       struct acpi_bus_event   *event)
+int acpi_bus_receive_event(struct acpi_bus_event *event)
 {
-       unsigned long           flags = 0;
-       struct acpi_bus_event   *entry = NULL;
+       unsigned long flags = 0;
+       struct acpi_bus_event *entry = NULL;
 
        DECLARE_WAITQUEUE(wait, current);
 
@@ -361,7 +347,8 @@ acpi_bus_receive_event (
        }
 
        spin_lock_irqsave(&acpi_bus_event_lock, flags);
-       entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
+       entry =
+           list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
        if (entry)
                list_del(&entry->node);
        spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
@@ -375,19 +362,17 @@ acpi_bus_receive_event (
 
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_bus_receive_event);
 
+EXPORT_SYMBOL(acpi_bus_receive_event);
 
 /* --------------------------------------------------------------------------
                              Notification Handling
    -------------------------------------------------------------------------- */
 
 static int
-acpi_bus_check_device (
-       struct acpi_device      *device,
-       int                     *status_changed)
+acpi_bus_check_device(struct acpi_device *device, int *status_changed)
 {
-       acpi_status             status = 0;
+       acpi_status status = 0;
        struct acpi_device_status old_status;
 
        ACPI_FUNCTION_TRACE("acpi_bus_check_device");
@@ -422,15 +407,14 @@ acpi_bus_check_device (
 
        if (status_changed)
                *status_changed = 1;
-       
+
        /*
         * Device Insertion/Removal
         */
        if ((device->status.present) && !(old_status.present)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
                /* TBD: Handle device insertion */
-       }
-       else if (!(device->status.present) && (old_status.present)) {
+       } else if (!(device->status.present) && (old_status.present)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
                /* TBD: Handle device removal */
        }
@@ -438,13 +422,10 @@ acpi_bus_check_device (
        return_VALUE(0);
 }
 
-
-static int
-acpi_bus_check_scope (
-       struct acpi_device      *device)
+static int acpi_bus_check_scope(struct acpi_device *device)
 {
-       int                     result = 0;
-       int                     status_changed = 0;
+       int result = 0;
+       int status_changed = 0;
 
        ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
 
@@ -467,20 +448,15 @@ acpi_bus_check_scope (
        return_VALUE(0);
 }
 
-
 /**
  * acpi_bus_notify
  * ---------------
  * Callback for all 'system-level' device notifications (values 0x00-0x7F).
  */
-static void 
-acpi_bus_notify (
-       acpi_handle             handle,
-       u32                     type,
-       void                    *data)
+static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_bus_notify");
 
@@ -490,64 +466,73 @@ acpi_bus_notify (
        switch (type) {
 
        case ACPI_NOTIFY_BUS_CHECK:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received BUS CHECK notification for device [%s]\n",
+                                 device->pnp.bus_id));
                result = acpi_bus_check_scope(device);
                /* 
                 * TBD: We'll need to outsource certain events to non-ACPI
-                *      drivers via the device manager (device.c).
+                *      drivers via the device manager (device.c).
                 */
                break;
 
        case ACPI_NOTIFY_DEVICE_CHECK:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received DEVICE CHECK notification for device [%s]\n",
+                                 device->pnp.bus_id));
                result = acpi_bus_check_device(device, NULL);
                /* 
                 * TBD: We'll need to outsource certain events to non-ACPI
-                *      drivers via the device manager (device.c).
+                *      drivers via the device manager (device.c).
                 */
                break;
 
        case ACPI_NOTIFY_DEVICE_WAKE:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received DEVICE WAKE notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD */
                break;
 
        case ACPI_NOTIFY_EJECT_REQUEST:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received EJECT REQUEST notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD */
                break;
 
        case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received DEVICE CHECK LIGHT notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD: Exactly what does 'light' mean? */
                break;
 
        case ACPI_NOTIFY_FREQUENCY_MISMATCH:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received FREQUENCY MISMATCH notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD */
                break;
 
        case ACPI_NOTIFY_BUS_MODE_MISMATCH:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received BUS MODE MISMATCH notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD */
                break;
 
        case ACPI_NOTIFY_POWER_FAULT:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n", 
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received POWER FAULT notification for device [%s]\n",
+                                 device->pnp.bus_id));
                /* TBD */
                break;
 
        default:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n", 
-                       type));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Received unknown/unsupported notification [%08x]\n",
+                                 type));
                break;
        }
 
@@ -558,13 +543,12 @@ acpi_bus_notify (
                              Initialization/Cleanup
    -------------------------------------------------------------------------- */
 
-static int __init
-acpi_bus_init_irq (void)
+static int __init acpi_bus_init_irq(void)
 {
-       acpi_status             status = AE_OK;
-       union acpi_object       arg = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list arg_list = {1, &arg};
-       char                    *message = NULL;
+       acpi_status status = AE_OK;
+       union acpi_object arg = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &arg };
+       char *message = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
 
@@ -601,12 +585,10 @@ acpi_bus_init_irq (void)
        return_VALUE(0);
 }
 
-
-void __init
-acpi_early_init (void)
+void __init acpi_early_init(void)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_buffer      buffer = {sizeof(acpi_fadt), &acpi_fadt};
+       acpi_status status = AE_OK;
+       struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
 
        ACPI_FUNCTION_TRACE("acpi_early_init");
 
@@ -619,13 +601,15 @@ acpi_early_init (void)
 
        status = acpi_initialize_subsystem();
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
+               printk(KERN_ERR PREFIX
+                      "Unable to initialize the ACPI Interpreter\n");
                goto error0;
        }
 
        status = acpi_load_tables();
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
+               printk(KERN_ERR PREFIX
+                      "Unable to load the System Description Tables\n");
                goto error0;
        }
 
@@ -637,7 +621,6 @@ acpi_early_init (void)
                printk(KERN_ERR PREFIX "Unable to get the FADT\n");
                goto error0;
        }
-
 #ifdef CONFIG_X86
        if (!acpi_ioapic) {
                extern acpi_interrupt_flags acpi_sci_flags;
@@ -647,7 +630,8 @@ acpi_early_init (void)
                        acpi_sci_flags.trigger = 3;
 
                /* Set PIC-mode SCI trigger type */
-               acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger);
+               acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
+                                        acpi_sci_flags.trigger);
        } else {
                extern int acpi_sci_override_gsi;
                /*
@@ -658,7 +642,10 @@ acpi_early_init (void)
        }
 #endif
 
-       status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE));
+       status =
+           acpi_enable_subsystem(~
+                                 (ACPI_NO_HARDWARE_INIT |
+                                  ACPI_NO_ACPI_ENABLE));
        if (ACPI_FAILURE(status)) {
                printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
                goto error0;
@@ -666,30 +653,32 @@ acpi_early_init (void)
 
        return_VOID;
 
-error0:
+      error0:
        disable_acpi();
        return_VOID;
 }
 
-static int __init
-acpi_bus_init (void)
+static int __init acpi_bus_init(void)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       extern acpi_status      acpi_os_initialize1(void);
+       int result = 0;
+       acpi_status status = AE_OK;
+       extern acpi_status acpi_os_initialize1(void);
 
        ACPI_FUNCTION_TRACE("acpi_bus_init");
 
        status = acpi_os_initialize1();
 
-       status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
+       status =
+           acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
+               printk(KERN_ERR PREFIX
+                      "Unable to start the ACPI Interpreter\n");
                goto error1;
        }
 
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n");
+               printk(KERN_ERR PREFIX
+                      "Unable to initialize ACPI OS objects\n");
                goto error1;
        }
 #ifdef CONFIG_ACPI_EC
@@ -723,9 +712,12 @@ acpi_bus_init (void)
        /*
         * Register the for all standard device notifications.
         */
-       status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
+       status =
+           acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
+                                       &acpi_bus_notify, NULL);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
+               printk(KERN_ERR PREFIX
+                      "Unable to register for device notifications\n");
                goto error1;
        }
 
@@ -737,21 +729,20 @@ acpi_bus_init (void)
        return_VALUE(0);
 
        /* Mimic structured exception handling */
-error1:
+      error1:
        acpi_terminate();
        return_VALUE(-ENODEV);
 }
 
-decl_subsys(acpi,NULL,NULL);
+decl_subsys(acpi, NULL, NULL);
 
-static int __init acpi_init (void)
+static int __init acpi_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_init");
 
-       printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
-               ACPI_CA_VERSION);
+       printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
 
        if (acpi_disabled) {
                printk(KERN_INFO PREFIX "Interpreter disabled.\n");
@@ -767,7 +758,8 @@ static int __init acpi_init (void)
                if (!PM_IS_ACTIVE())
                        pm_active = 1;
                else {
-                       printk(KERN_INFO PREFIX "APM is already active, exiting\n");
+                       printk(KERN_INFO PREFIX
+                              "APM is already active, exiting\n");
                        disable_acpi();
                        result = -ENODEV;
                }
index 8162fd0c21a79fed1c11da240d63025556595c63..4b6d9f0096a10cb8cdf1409f8558cff7674b1e9b 100644 (file)
@@ -32,7 +32,6 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_BUTTON_COMPONENT          0x00080000
 #define ACPI_BUTTON_DRIVER_NAME                "ACPI Button Driver"
 #define ACPI_BUTTON_CLASS              "button"
@@ -42,7 +41,7 @@
 #define ACPI_BUTTON_NOTIFY_STATUS      0x80
 
 #define ACPI_BUTTON_SUBCLASS_POWER     "power"
-#define ACPI_BUTTON_HID_POWER          "PNP0C0C"       
+#define ACPI_BUTTON_HID_POWER          "PNP0C0C"
 #define ACPI_BUTTON_DEVICE_NAME_POWER  "Power Button (CM)"
 #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)"
 #define ACPI_BUTTON_TYPE_POWER         0x01
 #define ACPI_BUTTON_TYPE_LID           0x05
 
 #define _COMPONENT             ACPI_BUTTON_COMPONENT
-ACPI_MODULE_NAME               ("acpi_button")
+ACPI_MODULE_NAME("acpi_button")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-
-static int acpi_button_add (struct acpi_device *device);
-static int acpi_button_remove (struct acpi_device *device, int type);
+static int acpi_button_add(struct acpi_device *device);
+static int acpi_button_remove(struct acpi_device *device, int type);
 static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
 static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_button_driver = {
-       .name =         ACPI_BUTTON_DRIVER_NAME,
-       .class =        ACPI_BUTTON_CLASS,
-       .ids =          "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
-       .ops =          {
-                               .add =          acpi_button_add,
-                               .remove =       acpi_button_remove,
-                       },
+       .name = ACPI_BUTTON_DRIVER_NAME,
+       .class = ACPI_BUTTON_CLASS,
+       .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
+       .ops = {
+               .add = acpi_button_add,
+               .remove = acpi_button_remove,
+               },
 };
 
 struct acpi_button {
-       acpi_handle             handle;
-       struct acpi_device      *device;        /* Fixed button kludge */
-       u8                      type;
-       unsigned long           pushed;
+       acpi_handle handle;
+       struct acpi_device *device;     /* Fixed button kludge */
+       u8 type;
+       unsigned long pushed;
 };
 
 static struct file_operations acpi_button_info_fops = {
-       .open           = acpi_button_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_button_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static struct file_operations acpi_button_state_fops = {
-       .open           = acpi_button_state_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_button_state_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
+
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_button_dir;
+static struct proc_dir_entry *acpi_button_dir;
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_button      *button = (struct acpi_button *) seq->private;
+       struct acpi_button *button = (struct acpi_button *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
 
        if (!button || !button->device)
                return_VALUE(0);
 
-       seq_printf(seq, "type:                    %s\n", 
-               acpi_device_name(button->device));
+       seq_printf(seq, "type:                    %s\n",
+                  acpi_device_name(button->device));
 
        return_VALUE(0);
 }
@@ -128,24 +127,24 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
 }
-       
+
 static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_button      *button = (struct acpi_button *) seq->private;
-       acpi_status             status;
-       unsigned long           state;
+       struct acpi_button *button = (struct acpi_button *)seq->private;
+       acpi_status status;
+       unsigned long state;
 
        ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
 
        if (!button || !button->device)
                return_VALUE(0);
 
-       status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
+       status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
        if (ACPI_FAILURE(status)) {
                seq_printf(seq, "state:      unsupported\n");
-       }
-       else{
-               seq_printf(seq, "state:      %s\n", (state ? "open" : "closed")); 
+       } else {
+               seq_printf(seq, "state:      %s\n",
+                          (state ? "open" : "closed"));
        }
 
        return_VALUE(0);
@@ -160,12 +159,10 @@ static struct proc_dir_entry *acpi_power_dir;
 static struct proc_dir_entry *acpi_sleep_dir;
 static struct proc_dir_entry *acpi_lid_dir;
 
-static int
-acpi_button_add_fs (
-       struct acpi_device      *device)
+static int acpi_button_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
-       struct acpi_button      *button = NULL;
+       struct proc_dir_entry *entry = NULL;
+       struct acpi_button *button = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_button_add_fs");
 
@@ -178,21 +175,21 @@ acpi_button_add_fs (
        case ACPI_BUTTON_TYPE_POWER:
        case ACPI_BUTTON_TYPE_POWERF:
                if (!acpi_power_dir)
-                       acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, 
-                               acpi_button_dir);
+                       acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
+                                                   acpi_button_dir);
                entry = acpi_power_dir;
                break;
        case ACPI_BUTTON_TYPE_SLEEP:
        case ACPI_BUTTON_TYPE_SLEEPF:
                if (!acpi_sleep_dir)
-                       acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, 
-                               acpi_button_dir);
+                       acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
+                                                   acpi_button_dir);
                entry = acpi_sleep_dir;
                break;
        case ACPI_BUTTON_TYPE_LID:
                if (!acpi_lid_dir)
-                       acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, 
-                               acpi_button_dir);
+                       acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
+                                                 acpi_button_dir);
                entry = acpi_lid_dir;
                break;
        }
@@ -208,11 +205,11 @@ acpi_button_add_fs (
 
        /* 'info' [R] */
        entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_BUTTON_FILE_INFO));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_BUTTON_FILE_INFO));
        else {
                entry->proc_fops = &acpi_button_info_fops;
                entry->data = acpi_driver_data(device);
@@ -222,11 +219,11 @@ acpi_button_add_fs (
        /* show lid state [R] */
        if (button->type == ACPI_BUTTON_TYPE_LID) {
                entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
-                       S_IRUGO, acpi_device_dir(device));
+                                         S_IRUGO, acpi_device_dir(device));
                if (!entry)
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Unable to create '%s' fs entry\n",
-                               ACPI_BUTTON_FILE_INFO));
+                                         "Unable to create '%s' fs entry\n",
+                                         ACPI_BUTTON_FILE_INFO));
                else {
                        entry->proc_fops = &acpi_button_state_fops;
                        entry->data = acpi_driver_data(device);
@@ -237,12 +234,9 @@ acpi_button_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_button_remove_fs (
-       struct acpi_device      *device)
+static int acpi_button_remove_fs(struct acpi_device *device)
 {
-       struct acpi_button      *button = NULL;
+       struct acpi_button *button = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
 
@@ -250,30 +244,25 @@ acpi_button_remove_fs (
        if (acpi_device_dir(device)) {
                if (button->type == ACPI_BUTTON_TYPE_LID)
                        remove_proc_entry(ACPI_BUTTON_FILE_STATE,
-                                            acpi_device_dir(device));
+                                         acpi_device_dir(device));
                remove_proc_entry(ACPI_BUTTON_FILE_INFO,
-                                    acpi_device_dir(device));
+                                 acpi_device_dir(device));
 
                remove_proc_entry(acpi_device_bid(device),
-                                    acpi_device_dir(device)->parent);
+                                 acpi_device_dir(device)->parent);
                acpi_device_dir(device) = NULL;
        }
 
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                 Driver Interface
    -------------------------------------------------------------------------- */
 
-static void
-acpi_button_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_button      *button = (struct acpi_button *) data;
+       struct acpi_button *button = (struct acpi_button *)data;
 
        ACPI_FUNCTION_TRACE("acpi_button_notify");
 
@@ -282,24 +271,22 @@ acpi_button_notify (
 
        switch (event) {
        case ACPI_BUTTON_NOTIFY_STATUS:
-               acpi_bus_generate_event(button->device, event, ++button->pushed);
+               acpi_bus_generate_event(button->device, event,
+                                       ++button->pushed);
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-
-static acpi_status
-acpi_button_notify_fixed (
-       void                    *data)
+static acpi_status acpi_button_notify_fixed(void *data)
 {
-       struct acpi_button      *button = (struct acpi_button *) data;
-       
+       struct acpi_button *button = (struct acpi_button *)data;
+
        ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
 
        if (!button)
@@ -310,14 +297,11 @@ acpi_button_notify_fixed (
        return_ACPI_STATUS(AE_OK);
 }
 
-
-static int
-acpi_button_add (
-       struct acpi_device      *device)
+static int acpi_button_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_button      *button = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_button *button = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_button_add");
 
@@ -339,42 +323,34 @@ acpi_button_add (
         */
        if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
                button->type = ACPI_BUTTON_TYPE_POWER;
-               strcpy(acpi_device_name(device),
-                       ACPI_BUTTON_DEVICE_NAME_POWER);
-               sprintf(acpi_device_class(device), "%s/%s", 
+               strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
+               sprintf(acpi_device_class(device), "%s/%s",
                        ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
-       }
-       else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
+       } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
                button->type = ACPI_BUTTON_TYPE_POWERF;
                strcpy(acpi_device_name(device),
-                       ACPI_BUTTON_DEVICE_NAME_POWERF);
-               sprintf(acpi_device_class(device), "%s/%s", 
+                      ACPI_BUTTON_DEVICE_NAME_POWERF);
+               sprintf(acpi_device_class(device), "%s/%s",
                        ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
-       }
-       else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
+       } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
                button->type = ACPI_BUTTON_TYPE_SLEEP;
-               strcpy(acpi_device_name(device),
-                       ACPI_BUTTON_DEVICE_NAME_SLEEP);
-               sprintf(acpi_device_class(device), "%s/%s", 
+               strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
+               sprintf(acpi_device_class(device), "%s/%s",
                        ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
-       }
-       else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
+       } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
                button->type = ACPI_BUTTON_TYPE_SLEEPF;
                strcpy(acpi_device_name(device),
-                       ACPI_BUTTON_DEVICE_NAME_SLEEPF);
-               sprintf(acpi_device_class(device), "%s/%s", 
+                      ACPI_BUTTON_DEVICE_NAME_SLEEPF);
+               sprintf(acpi_device_class(device), "%s/%s",
                        ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
-       }
-       else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
+       } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
                button->type = ACPI_BUTTON_TYPE_LID;
-               strcpy(acpi_device_name(device),
-                       ACPI_BUTTON_DEVICE_NAME_LID);
-               sprintf(acpi_device_class(device), "%s/%s", 
+               strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
+               sprintf(acpi_device_class(device), "%s/%s",
                        ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
-       }
-       else {
+       } else {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
-                       acpi_device_hid(device)));
+                                 acpi_device_hid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -385,46 +361,46 @@ acpi_button_add (
 
        switch (button->type) {
        case ACPI_BUTTON_TYPE_POWERF:
-               status = acpi_install_fixed_event_handler (
-                       ACPI_EVENT_POWER_BUTTON,
-                       acpi_button_notify_fixed,
-                       button);
+               status =
+                   acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+                                                    acpi_button_notify_fixed,
+                                                    button);
                break;
        case ACPI_BUTTON_TYPE_SLEEPF:
-               status = acpi_install_fixed_event_handler (
-                       ACPI_EVENT_SLEEP_BUTTON,
-                       acpi_button_notify_fixed,
-                       button);
+               status =
+                   acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+                                                    acpi_button_notify_fixed,
+                                                    button);
                break;
        default:
-               status = acpi_install_notify_handler (
-                       button->handle,
-                       ACPI_DEVICE_NOTIFY,
-                       acpi_button_notify,
-                       button);
+               status = acpi_install_notify_handler(button->handle,
+                                                    ACPI_DEVICE_NOTIFY,
+                                                    acpi_button_notify,
+                                                    button);
                break;
        }
 
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                result = -ENODEV;
                goto end;
        }
 
        if (device->wakeup.flags.valid) {
                /* Button's GPE is run-wake GPE */
-               acpi_set_gpe_type(device->wakeup.gpe_device, 
-                       device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
-               acpi_enable_gpe(device->wakeup.gpe_device, 
-                       device->wakeup.gpe_number, ACPI_NOT_ISR);
+               acpi_set_gpe_type(device->wakeup.gpe_device,
+                                 device->wakeup.gpe_number,
+                                 ACPI_GPE_TYPE_WAKE_RUN);
+               acpi_enable_gpe(device->wakeup.gpe_device,
+                               device->wakeup.gpe_number, ACPI_NOT_ISR);
                device->wakeup.state.enabled = 1;
        }
 
-       printk(KERN_INFO PREFIX "%s [%s]\n", 
-               acpi_device_name(device), acpi_device_bid(device));
+       printk(KERN_INFO PREFIX "%s [%s]\n",
+              acpi_device_name(device), acpi_device_bid(device));
 
-end:
+      end:
        if (result) {
                acpi_button_remove_fs(device);
                kfree(button);
@@ -433,12 +409,10 @@ end:
        return_VALUE(result);
 }
 
-
-static int
-acpi_button_remove (struct acpi_device *device, int type)
+static int acpi_button_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = 0;
-       struct acpi_button      *button = NULL;
+       acpi_status status = 0;
+       struct acpi_button *button = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_button_remove");
 
@@ -450,35 +424,36 @@ acpi_button_remove (struct acpi_device *device, int type)
        /* Unregister for device notifications. */
        switch (button->type) {
        case ACPI_BUTTON_TYPE_POWERF:
-               status = acpi_remove_fixed_event_handler(
-                       ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
+               status =
+                   acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
+                                                   acpi_button_notify_fixed);
                break;
        case ACPI_BUTTON_TYPE_SLEEPF:
-               status = acpi_remove_fixed_event_handler(
-                       ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
+               status =
+                   acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
+                                                   acpi_button_notify_fixed);
                break;
        default:
                status = acpi_remove_notify_handler(button->handle,
-                       ACPI_DEVICE_NOTIFY, acpi_button_notify);
+                                                   ACPI_DEVICE_NOTIFY,
+                                                   acpi_button_notify);
                break;
        }
 
        if (ACPI_FAILURE(status))
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
 
-       acpi_button_remove_fs(device);  
+       acpi_button_remove_fs(device);
 
        kfree(button);
 
        return_VALUE(0);
 }
 
-
-static int __init
-acpi_button_init (void)
+static int __init acpi_button_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_button_init");
 
@@ -495,15 +470,13 @@ acpi_button_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_button_exit (void)
+static void __exit acpi_button_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_button_exit");
 
        acpi_bus_unregister_driver(&acpi_button_driver);
 
-       if (acpi_power_dir) 
+       if (acpi_power_dir)
                remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
        if (acpi_sleep_dir)
                remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
@@ -514,6 +487,5 @@ acpi_button_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_button_init);
 module_exit(acpi_button_exit);
index 97013ddfa202b5d01678778d8443b0eba6cbfe64..10dd695a1dd93e06d43497b5b4c49ce8680a7cac 100644 (file)
@@ -44,9 +44,9 @@
 
 #define ACPI_CONTAINER_COMPONENT       0x01000000
 #define _COMPONENT                     ACPI_CONTAINER_COMPONENT
-ACPI_MODULE_NAME                       ("acpi_container")
+ACPI_MODULE_NAME("acpi_container")
 
-MODULE_AUTHOR("Anil S Keshavamurthy");
+    MODULE_AUTHOR("Anil S Keshavamurthy");
 MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
@@ -56,41 +56,38 @@ static int acpi_container_add(struct acpi_device *device);
 static int acpi_container_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_container_driver = {
-       .name =         ACPI_CONTAINER_DRIVER_NAME,
-       .class =        ACPI_CONTAINER_CLASS,
-       .ids =          "ACPI0004,PNP0A05,PNP0A06",
-       .ops =          {
-                               .add =          acpi_container_add,
-                               .remove =       acpi_container_remove,
-                       },
+       .name = ACPI_CONTAINER_DRIVER_NAME,
+       .class = ACPI_CONTAINER_CLASS,
+       .ids = "ACPI0004,PNP0A05,PNP0A06",
+       .ops = {
+               .add = acpi_container_add,
+               .remove = acpi_container_remove,
+               },
 };
 
-
 /*******************************************************************/
 
-static int
-is_device_present(acpi_handle handle)
+static int is_device_present(acpi_handle handle)
 {
-       acpi_handle             temp;
-       acpi_status             status;
-       unsigned long   sta;
+       acpi_handle temp;
+       acpi_status status;
+       unsigned long sta;
 
        ACPI_FUNCTION_TRACE("is_device_present");
 
        status = acpi_get_handle(handle, "_STA", &temp);
        if (ACPI_FAILURE(status))
-               return_VALUE(1); /* _STA not found, assmue device present */
+               return_VALUE(1);        /* _STA not found, assmue device present */
 
        status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
        if (ACPI_FAILURE(status))
-               return_VALUE(0); /* Firmware error */
+               return_VALUE(0);        /* Firmware error */
 
        return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
 }
 
 /*******************************************************************/
-static int
-acpi_container_add(struct acpi_device *device)
+static int acpi_container_add(struct acpi_device *device)
 {
        struct acpi_container *container;
 
@@ -102,28 +99,26 @@ acpi_container_add(struct acpi_device *device)
        }
 
        container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
-       if(!container)
+       if (!container)
                return_VALUE(-ENOMEM);
-       
+
        memset(container, 0, sizeof(struct acpi_container));
        container->handle = device->handle;
        strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
        acpi_driver_data(device) = container;
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",       \
-               acpi_device_name(device), acpi_device_bid(device)));
-
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
+                         acpi_device_name(device), acpi_device_bid(device)));
 
        return_VALUE(0);
 }
 
-static int
-acpi_container_remove(struct acpi_device *device, int type)
+static int acpi_container_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_container   *pc = NULL;
-       pc = (struct acpi_container*) acpi_driver_data(device);
+       acpi_status status = AE_OK;
+       struct acpi_container *pc = NULL;
+       pc = (struct acpi_container *)acpi_driver_data(device);
 
        if (pc)
                kfree(pc);
@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
        return status;
 }
 
-
-static int
-container_device_add(struct acpi_device **device, acpi_handle handle)
+static int container_device_add(struct acpi_device **device, acpi_handle handle)
 {
        acpi_handle phandle;
        struct acpi_device *pdev;
@@ -158,10 +151,9 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
        return_VALUE(result);
 }
 
-static void
-container_notify_cb(acpi_handle handle, u32 type, void *context)
+static void container_notify_cb(acpi_handle handle, u32 type, void *context)
 {
-       struct acpi_device              *device = NULL;
+       struct acpi_device *device = NULL;
        int result;
        int present;
        acpi_status status;
@@ -169,14 +161,14 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
        ACPI_FUNCTION_TRACE("container_notify_cb");
 
        present = is_device_present(handle);
-       
+
        switch (type) {
        case ACPI_NOTIFY_BUS_CHECK:
                /* Fall through */
        case ACPI_NOTIFY_DEVICE_CHECK:
                printk("Container driver received %s event\n",
-                       (type == ACPI_NOTIFY_BUS_CHECK)?
-                       "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
+                      (type == ACPI_NOTIFY_BUS_CHECK) ?
+                      "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
                status = acpi_bus_get_device(handle, &device);
                if (present) {
                        if (ACPI_FAILURE(status) || !device) {
@@ -207,15 +199,13 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
 
 static acpi_status
 container_walk_namespace_cb(acpi_handle handle,
-       u32 lvl,
-       void *context,
-       void **rv)
+                           u32 lvl, void *context, void **rv)
 {
-       char                            *hid = NULL;
-       struct acpi_buffer              buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       struct acpi_device_info         *info;
-       acpi_status                     status;
-       int                             *action = context;
+       char *hid = NULL;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_device_info *info;
+       acpi_status status;
+       int *action = context;
 
        ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
 
@@ -233,66 +223,60 @@ container_walk_namespace_cb(acpi_handle handle,
        }
 
        if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
-                       strcmp(hid, "PNP0A06")) {
+           strcmp(hid, "PNP0A06")) {
                goto end;
        }
 
-       switch(*action) {
+       switch (*action) {
        case INSTALL_NOTIFY_HANDLER:
                acpi_install_notify_handler(handle,
-                       ACPI_SYSTEM_NOTIFY,
-                       container_notify_cb,
-                       NULL);
+                                           ACPI_SYSTEM_NOTIFY,
+                                           container_notify_cb, NULL);
                break;
        case UNINSTALL_NOTIFY_HANDLER:
                acpi_remove_notify_handler(handle,
-                       ACPI_SYSTEM_NOTIFY,
-                       container_notify_cb);
+                                          ACPI_SYSTEM_NOTIFY,
+                                          container_notify_cb);
                break;
        default:
                break;
        }
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        return_ACPI_STATUS(AE_OK);
 }
 
-
-static int __init
-acpi_container_init(void)
+static int __init acpi_container_init(void)
 {
-       int     result = 0;
-       int     action = INSTALL_NOTIFY_HANDLER;
+       int result = 0;
+       int action = INSTALL_NOTIFY_HANDLER;
 
        result = acpi_bus_register_driver(&acpi_container_driver);
        if (result < 0) {
-               return(result);
+               return (result);
        }
 
        /* register notify handler to every container device */
        acpi_walk_namespace(ACPI_TYPE_DEVICE,
-                                    ACPI_ROOT_OBJECT,
-                                    ACPI_UINT32_MAX,
-                                    container_walk_namespace_cb,
-                                    &action, NULL);
+                           ACPI_ROOT_OBJECT,
+                           ACPI_UINT32_MAX,
+                           container_walk_namespace_cb, &action, NULL);
 
-       return(0);
+       return (0);
 }
 
-static void __exit
-acpi_container_exit(void)
+static void __exit acpi_container_exit(void)
 {
-       int                     action = UNINSTALL_NOTIFY_HANDLER;
+       int action = UNINSTALL_NOTIFY_HANDLER;
 
        ACPI_FUNCTION_TRACE("acpi_container_exit");
 
        acpi_walk_namespace(ACPI_TYPE_DEVICE,
-                                    ACPI_ROOT_OBJECT,
-                                    ACPI_UINT32_MAX,
-                                    container_walk_namespace_cb,
-                                    &action, NULL);
+                           ACPI_ROOT_OBJECT,
+                           ACPI_UINT32_MAX,
+                           container_walk_namespace_cb, &action, NULL);
 
        acpi_bus_unregister_driver(&acpi_container_driver);
 
index 2c0dac559f1636487d108a9cae7a4f6367873110..263322b7d113d743caa9200ce7b9b8c592cd284b 100644 (file)
 #include <acpi/acglobal.h>
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("debug")
-
+ACPI_MODULE_NAME("debug")
 #define ACPI_SYSTEM_FILE_DEBUG_LAYER   "debug_layer"
 #define ACPI_SYSTEM_FILE_DEBUG_LEVEL   "debug_level"
-
 #ifdef MODULE_PARAM_PREFIX
 #undef MODULE_PARAM_PREFIX
 #endif
-
 #define MODULE_PARAM_PREFIX
-module_param(acpi_dbg_layer, uint, 0400);
+    module_param(acpi_dbg_layer, uint, 0400);
 module_param(acpi_dbg_level, uint, 0400);
 
 struct acpi_dlayer {
@@ -35,8 +32,7 @@ struct acpi_dlevel {
 };
 #define ACPI_DEBUG_INIT(v)     { .name = #v, .value = v }
 
-static const struct acpi_dlayer acpi_debug_layers[] =
-{
+static const struct acpi_dlayer acpi_debug_layers[] = {
        ACPI_DEBUG_INIT(ACPI_UTILITIES),
        ACPI_DEBUG_INIT(ACPI_HARDWARE),
        ACPI_DEBUG_INIT(ACPI_EVENTS),
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
        ACPI_DEBUG_INIT(ACPI_TOOLS),
 };
 
-static const struct acpi_dlevel acpi_debug_levels[] =
-{
+static const struct acpi_dlevel acpi_debug_levels[] = {
        ACPI_DEBUG_INIT(ACPI_LV_ERROR),
        ACPI_DEBUG_INIT(ACPI_LV_WARN),
        ACPI_DEBUG_INIT(ACPI_LV_INIT),
@@ -88,81 +83,77 @@ static const struct acpi_dlevel acpi_debug_levels[] =
        ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
        ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
        ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
-       ACPI_DEBUG_INIT(ACPI_LV_EVENTS),             
+       ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
 };
 
 static int
-acpi_system_read_debug (
-       char                    *page,
-       char                    **start,
-       off_t                   off,
-       int                     count,
-       int                     *eof,
-       void                    *data)
+acpi_system_read_debug(char *page,
+                      char **start, off_t off, int count, int *eof, void *data)
 {
-       char                    *p = page;
-       int                     size = 0;
-       unsigned int            i;
+       char *p = page;
+       int size = 0;
+       unsigned int i;
 
        if (off != 0)
                goto end;
 
        p += sprintf(p, "%-25s\tHex        SET\n", "Description");
 
-       switch ((unsigned long) data) {
+       switch ((unsigned long)data) {
        case 0:
                for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
                        p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-                               acpi_debug_layers[i].name,
-                               acpi_debug_layers[i].value,
-                               (acpi_dbg_layer & acpi_debug_layers[i].value) ?
-                               '*' : ' ');
+                                    acpi_debug_layers[i].name,
+                                    acpi_debug_layers[i].value,
+                                    (acpi_dbg_layer & acpi_debug_layers[i].
+                                     value) ? '*' : ' ');
                }
                p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
-                       ACPI_ALL_DRIVERS,
-                       (acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
-                       '*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
-                       ' ' : '-');
+                            ACPI_ALL_DRIVERS,
+                            (acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
+                            ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
+                                                      ACPI_ALL_DRIVERS) ==
+                            0 ? ' ' : '-');
                p += sprintf(p,
-                       "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
-                       acpi_dbg_layer);
+                            "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
+                            acpi_dbg_layer);
                break;
        case 1:
                for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
                        p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
-                               acpi_debug_levels[i].name,
-                               acpi_debug_levels[i].value,
-                               (acpi_dbg_level & acpi_debug_levels[i].value) ?
-                               '*' : ' ');
+                                    acpi_debug_levels[i].name,
+                                    acpi_debug_levels[i].value,
+                                    (acpi_dbg_level & acpi_debug_levels[i].
+                                     value) ? '*' : ' ');
                }
                p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
-                               acpi_dbg_level);
+                            acpi_dbg_level);
                break;
        default:
                p += sprintf(p, "Invalid debug option\n");
                break;
        }
-       
-end:
+
+      end:
        size = (p - page);
-       if (size <= off+count) *eof = 1;
+       if (size <= off + count)
+               *eof = 1;
        *start = page + off;
        size -= off;
-       if (size>count) size = count;
-       if (size<0) size = 0;
+       if (size > count)
+               size = count;
+       if (size < 0)
+               size = 0;
 
        return size;
 }
 
-
 static int
-acpi_system_write_debug (
-       struct file             *file,
-        const char              __user *buffer,
-       unsigned long           count,
-        void                    *data)
+acpi_system_write_debug(struct file *file,
+                       const char __user * buffer,
+                       unsigned long count, void *data)
 {
-       char                    debug_string[12] = {'\0'};
+       char debug_string[12] = { '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_system_write_debug");
 
@@ -174,7 +165,7 @@ acpi_system_write_debug (
 
        debug_string[count] = '\0';
 
-       switch ((unsigned long) data) {
+       switch ((unsigned long)data) {
        case 0:
                acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
                break;
@@ -190,9 +181,9 @@ acpi_system_write_debug (
 
 static int __init acpi_debug_init(void)
 {
-       struct proc_dir_entry   *entry;
+       struct proc_dir_entry *entry;
        int error = 0;
-       char * name;
+       char *name;
 
        ACPI_FUNCTION_TRACE("acpi_debug_init");
 
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
 
        /* 'debug_layer' [R/W] */
        name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
-       entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-                                      acpi_system_read_debug,(void *)0);
+       entry =
+           create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+                                  acpi_root_dir, acpi_system_read_debug,
+                                  (void *)0);
        if (entry)
                entry->write_proc = acpi_system_write_debug;
        else
@@ -210,19 +203,21 @@ static int __init acpi_debug_init(void)
 
        /* 'debug_level' [R/W] */
        name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
-       entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
-                                      acpi_system_read_debug, (void *)1);
-       if (entry) 
+       entry =
+           create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
+                                  acpi_root_dir, acpi_system_read_debug,
+                                  (void *)1);
+       if (entry)
                entry->write_proc = acpi_system_write_debug;
        else
                goto Error;
 
- Done:
     Done:
        return_VALUE(error);
 
- Error:
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                        "Unable to create '%s' proc fs entry\n", name));
     Error:
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "Unable to create '%s' proc fs entry\n", name));
 
        remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
        remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
index 84193983d6ba37bdab69f391fb8ed80cbe8b4ff2..2022aeaecfbbeb357a23500039c809a7bfe6e4c0 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acdispat.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsfield")
+ACPI_MODULE_NAME("dsfield")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ds_get_field_names (
-       struct acpi_create_field_info   *info,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *arg);
-
+acpi_ds_get_field_names(struct acpi_create_field_info *info,
+                       struct acpi_walk_state *walk_state,
+                       union acpi_parse_object *arg);
 
 /*******************************************************************************
  *
@@ -82,41 +77,36 @@ acpi_ds_get_field_names (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_buffer_field (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_create_buffer_field(union acpi_parse_object *op,
+                           struct acpi_walk_state *walk_state)
 {
-       union acpi_parse_object         *arg;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *second_desc = NULL;
-       u32                             flags;
-
-
-       ACPI_FUNCTION_TRACE ("ds_create_buffer_field");
+       union acpi_parse_object *arg;
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *second_desc = NULL;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("ds_create_buffer_field");
 
        /* Get the name_string argument */
 
        if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
-               arg = acpi_ps_get_arg (op, 3);
-       }
-       else {
+               arg = acpi_ps_get_arg(op, 3);
+       } else {
                /* Create Bit/Byte/Word/Dword field */
 
-               arg = acpi_ps_get_arg (op, 2);
+               arg = acpi_ps_get_arg(op, 2);
        }
 
        if (!arg) {
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
        if (walk_state->deferred_node) {
                node = walk_state->deferred_node;
                status = AE_OK;
-       }
-       else {
+       } else {
                /*
                 * During the load phase, we want to enter the name of the field into
                 * the namespace.  During the execute phase (when we evaluate the size
@@ -124,21 +114,22 @@ acpi_ds_create_buffer_field (
                 */
                if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
                        flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
-               }
-               else {
+               } else {
                        flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
-                                       ACPI_NS_ERROR_IF_FOUND;
+                           ACPI_NS_ERROR_IF_FOUND;
                }
 
                /*
                 * Enter the name_string into the namespace
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-                                ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
-                                flags, walk_state, &(node));
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_NSERROR (arg->common.value.string, status);
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_lookup(walk_state->scope_info,
+                                  arg->common.value.string, ACPI_TYPE_ANY,
+                                  ACPI_IMODE_LOAD_PASS1, flags, walk_state,
+                                  &(node));
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_NSERROR(arg->common.value.string, status);
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -153,9 +144,9 @@ acpi_ds_create_buffer_field (
         * and we need to create the field object.  Otherwise, this was a lookup
         * of an existing node and we don't want to create the field object again.
         */
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (obj_desc) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -165,7 +156,7 @@ acpi_ds_create_buffer_field (
 
        /* Create the buffer field object */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
        if (!obj_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -176,28 +167,26 @@ acpi_ds_create_buffer_field (
         * opcode and operands -- since the buffer and index
         * operands must be evaluated.
         */
-       second_desc                 = obj_desc->common.next_object;
+       second_desc = obj_desc->common.next_object;
        second_desc->extra.aml_start = op->named.data;
        second_desc->extra.aml_length = op->named.length;
        obj_desc->buffer_field.node = node;
 
        /* Attach constructed field descriptors to parent node */
 
-       status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-
-cleanup:
+      cleanup:
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_field_names
@@ -214,17 +203,14 @@ cleanup:
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_get_field_names (
-       struct acpi_create_field_info   *info,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *arg)
+acpi_ds_get_field_names(struct acpi_create_field_info *info,
+                       struct acpi_walk_state *walk_state,
+                       union acpi_parse_object *arg)
 {
-       acpi_status                     status;
-       acpi_integer                    position;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info);
+       acpi_status status;
+       acpi_integer position;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
 
        /* First field starts at bit zero */
 
@@ -243,18 +229,16 @@ acpi_ds_get_field_names (
                case AML_INT_RESERVEDFIELD_OP:
 
                        position = (acpi_integer) info->field_bit_position
-                                        + (acpi_integer) arg->common.value.size;
+                           + (acpi_integer) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
-                               ACPI_REPORT_ERROR ((
-                                       "Bit offset within field too large (> 0xFFFFFFFF)\n"));
-                               return_ACPI_STATUS (AE_SUPPORT);
+                               ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+                               return_ACPI_STATUS(AE_SUPPORT);
                        }
 
                        info->field_bit_position = (u32) position;
                        break;
 
-
                case AML_INT_ACCESSFIELD_OP:
 
                        /*
@@ -266,73 +250,70 @@ acpi_ds_get_field_names (
                         * ACCESS_TYPE bits
                         */
                        info->field_flags = (u8)
-                               ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
-                               ((u8) ((u32) arg->common.value.integer >> 8)));
+                           ((info->
+                             field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
+                            ((u8) ((u32) arg->common.value.integer >> 8)));
 
                        info->attribute = (u8) (arg->common.value.integer);
                        break;
 
-
                case AML_INT_NAMEDFIELD_OP:
 
                        /* Lookup the name */
 
-                       status = acpi_ns_lookup (walk_state->scope_info,
-                                         (char *) &arg->named.name,
-                                         info->field_type, ACPI_IMODE_EXECUTE,
-                                         ACPI_NS_DONT_OPEN_SCOPE,
-                                         walk_state, &info->field_node);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
+                       status = acpi_ns_lookup(walk_state->scope_info,
+                                               (char *)&arg->named.name,
+                                               info->field_type,
+                                               ACPI_IMODE_EXECUTE,
+                                               ACPI_NS_DONT_OPEN_SCOPE,
+                                               walk_state, &info->field_node);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_NSERROR((char *)&arg->named.name,
+                                                   status);
                                if (status != AE_ALREADY_EXISTS) {
-                                       return_ACPI_STATUS (status);
+                                       return_ACPI_STATUS(status);
                                }
 
                                /* Already exists, ignore error */
-                       }
-                       else {
+                       } else {
                                arg->common.node = info->field_node;
                                info->field_bit_length = arg->common.value.size;
 
                                /* Create and initialize an object for the new Field Node */
 
-                               status = acpi_ex_prep_field_value (info);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                               status = acpi_ex_prep_field_value(info);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
                                }
                        }
 
                        /* Keep track of bit position for the next field */
 
                        position = (acpi_integer) info->field_bit_position
-                                        + (acpi_integer) arg->common.value.size;
+                           + (acpi_integer) arg->common.value.size;
 
                        if (position > ACPI_UINT32_MAX) {
-                               ACPI_REPORT_ERROR ((
-                                       "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
-                                       (char *) &info->field_node->name));
-                               return_ACPI_STATUS (AE_SUPPORT);
+                               ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
+                               return_ACPI_STATUS(AE_SUPPORT);
                        }
 
                        info->field_bit_position += info->field_bit_length;
                        break;
 
-
                default:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Invalid opcode in field list: %X\n",
-                               arg->common.aml_opcode));
-                       return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid opcode in field list: %X\n",
+                                         arg->common.aml_opcode));
+                       return_ACPI_STATUS(AE_AML_BAD_OPCODE);
                }
 
                arg = arg->common.next;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_field
@@ -348,29 +329,28 @@ acpi_ds_get_field_names (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_create_field(union acpi_parse_object *op,
+                    struct acpi_namespace_node *region_node,
+                    struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_parse_object         *arg;
-       struct acpi_create_field_info   info;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op);
+       acpi_status status;
+       union acpi_parse_object *arg;
+       struct acpi_create_field_info info;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
 
        /* First arg is the name of the parent op_region (must already exist) */
 
        arg = op->common.value.arg;
        if (!region_node) {
-               status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
-                                 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
-                                 ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_NSERROR (arg->common.value.name, status);
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_lookup(walk_state->scope_info,
+                                  arg->common.value.name, ACPI_TYPE_REGION,
+                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+                                  walk_state, &region_node);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_NSERROR(arg->common.value.name, status);
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -385,12 +365,11 @@ acpi_ds_create_field (
        info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
        info.region_node = region_node;
 
-       status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+       status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_init_field_objects
@@ -407,37 +386,34 @@ acpi_ds_create_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_init_field_objects (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_init_field_objects(union acpi_parse_object *op,
+                          struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_parse_object         *arg = NULL;
-       struct acpi_namespace_node      *node;
-       u8                              type = 0;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op);
+       acpi_status status;
+       union acpi_parse_object *arg = NULL;
+       struct acpi_namespace_node *node;
+       u8 type = 0;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
 
        switch (walk_state->opcode) {
        case AML_FIELD_OP:
-               arg = acpi_ps_get_arg (op, 2);
+               arg = acpi_ps_get_arg(op, 2);
                type = ACPI_TYPE_LOCAL_REGION_FIELD;
                break;
 
        case AML_BANK_FIELD_OP:
-               arg = acpi_ps_get_arg (op, 4);
+               arg = acpi_ps_get_arg(op, 4);
                type = ACPI_TYPE_LOCAL_BANK_FIELD;
                break;
 
        case AML_INDEX_FIELD_OP:
-               arg = acpi_ps_get_arg (op, 3);
+               arg = acpi_ps_get_arg(op, 3);
                type = ACPI_TYPE_LOCAL_INDEX_FIELD;
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -447,16 +423,18 @@ acpi_ds_init_field_objects (
                /* Ignore OFFSET and ACCESSAS terms here */
 
                if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
-                       status = acpi_ns_lookup (walk_state->scope_info,
-                                         (char *) &arg->named.name,
-                                         type, ACPI_IMODE_LOAD_PASS1,
-                                         ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
-                                         ACPI_NS_ERROR_IF_FOUND,
-                                         walk_state, &node);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
+                       status = acpi_ns_lookup(walk_state->scope_info,
+                                               (char *)&arg->named.name,
+                                               type, ACPI_IMODE_LOAD_PASS1,
+                                               ACPI_NS_NO_UPSEARCH |
+                                               ACPI_NS_DONT_OPEN_SCOPE |
+                                               ACPI_NS_ERROR_IF_FOUND,
+                                               walk_state, &node);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_NSERROR((char *)&arg->named.name,
+                                                   status);
                                if (status != AE_ALREADY_EXISTS) {
-                                       return_ACPI_STATUS (status);
+                                       return_ACPI_STATUS(status);
                                }
 
                                /* Name already exists, just ignore this error */
@@ -472,10 +450,9 @@ acpi_ds_init_field_objects (
                arg = arg->common.next;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_bank_field
@@ -491,41 +468,42 @@ acpi_ds_init_field_objects (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_bank_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_create_bank_field(union acpi_parse_object *op,
+                         struct acpi_namespace_node *region_node,
+                         struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_parse_object         *arg;
-       struct acpi_create_field_info   info;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op);
+       acpi_status status;
+       union acpi_parse_object *arg;
+       struct acpi_create_field_info info;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
 
        /* First arg is the name of the parent op_region (must already exist) */
 
        arg = op->common.value.arg;
        if (!region_node) {
-               status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
-                                 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
-                                 ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_NSERROR (arg->common.value.name, status);
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_lookup(walk_state->scope_info,
+                                  arg->common.value.name, ACPI_TYPE_REGION,
+                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+                                  walk_state, &region_node);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_NSERROR(arg->common.value.name, status);
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Second arg is the Bank Register (Field) (must already exist) */
 
        arg = arg->common.next;
-       status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-                         ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                         ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_NSERROR (arg->common.value.string, status);
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+                          ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+                          ACPI_NS_SEARCH_PARENT, walk_state,
+                          &info.register_node);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               return_ACPI_STATUS(status);
        }
 
        /* Third arg is the bank_value */
@@ -543,12 +521,11 @@ acpi_ds_create_bank_field (
        info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
        info.region_node = region_node;
 
-       status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+       status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_index_field
@@ -564,39 +541,40 @@ acpi_ds_create_bank_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_index_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_create_index_field(union acpi_parse_object *op,
+                          struct acpi_namespace_node *region_node,
+                          struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_parse_object         *arg;
-       struct acpi_create_field_info   info;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op);
+       acpi_status status;
+       union acpi_parse_object *arg;
+       struct acpi_create_field_info info;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
 
        /* First arg is the name of the Index register (must already exist) */
 
        arg = op->common.value.arg;
-       status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-                         ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                         ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_NSERROR (arg->common.value.string, status);
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+                          ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+                          ACPI_NS_SEARCH_PARENT, walk_state,
+                          &info.register_node);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               return_ACPI_STATUS(status);
        }
 
        /* Second arg is the data register (must already exist) */
 
        arg = arg->common.next;
-       status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-                         ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                         ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_NSERROR (arg->common.value.string, status);
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
+                          ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+                          ACPI_NS_SEARCH_PARENT, walk_state,
+                          &info.data_register_node);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_NSERROR(arg->common.value.string, status);
+               return_ACPI_STATUS(status);
        }
 
        /* Next arg is the field flags */
@@ -609,9 +587,7 @@ acpi_ds_create_index_field (
        info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
        info.region_node = region_node;
 
-       status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
+       status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index d7790db50178a2a8c29b31b7da2fcef0a65abe56..8693c704aea611a6e9495fb3b7ee8ce7fe5ca017 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsinit")
+ACPI_MODULE_NAME("dsinit")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ds_init_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
-
+acpi_ds_init_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value);
 
 /*******************************************************************************
  *
@@ -80,26 +74,23 @@ acpi_ds_init_one_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_init_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ds_init_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value)
 {
-       acpi_object_type                type;
-       acpi_status                     status;
-       struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
-
-
-       ACPI_FUNCTION_NAME ("ds_init_one_object");
+       struct acpi_init_walk_info *info =
+           (struct acpi_init_walk_info *)context;
+       struct acpi_namespace_node *node =
+           (struct acpi_namespace_node *)obj_handle;
+       acpi_object_type type;
+       acpi_status status;
 
+       ACPI_FUNCTION_NAME("ds_init_one_object");
 
        /*
-        * We are only interested in objects owned by the table that
+        * We are only interested in NS nodes owned by the table that
         * was just loaded
         */
-       if (((struct acpi_namespace_node *) obj_handle)->owner_id !=
-                       info->table_desc->table_id) {
+       if (node->owner_id != info->table_desc->owner_id) {
                return (AE_OK);
        }
 
@@ -107,33 +98,31 @@ acpi_ds_init_one_object (
 
        /* And even then, we are only interested in a few object types */
 
-       type = acpi_ns_get_type (obj_handle);
+       type = acpi_ns_get_type(obj_handle);
 
        switch (type) {
        case ACPI_TYPE_REGION:
 
-               status = acpi_ds_initialize_region (obj_handle);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Region %p [%4.4s] - Init failure, %s\n",
-                               obj_handle, acpi_ut_get_node_name (obj_handle),
-                               acpi_format_exception (status)));
+               status = acpi_ds_initialize_region(obj_handle);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Region %p [%4.4s] - Init failure, %s\n",
+                                         obj_handle,
+                                         acpi_ut_get_node_name(obj_handle),
+                                         acpi_format_exception(status)));
                }
 
                info->op_region_count++;
                break;
 
-
        case ACPI_TYPE_METHOD:
 
-               info->method_count++;
-
                /*
                 * Print a dot for each method unless we are going to print
                 * the entire pathname
                 */
                if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
                }
 
                /*
@@ -143,41 +132,32 @@ acpi_ds_init_one_object (
                 * on a per-table basis. Currently, we just use a global for the width.
                 */
                if (info->table_desc->pointer->revision == 1) {
-                       ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32;
+                       node->flags |= ANOBJ_DATA_WIDTH_32;
                }
 
                /*
                 * Always parse methods to detect errors, we will delete
                 * the parse tree below
                 */
-               status = acpi_ds_parse_method (obj_handle);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Method %p [%4.4s] - parse failure, %s\n",
-                               obj_handle, acpi_ut_get_node_name (obj_handle),
-                               acpi_format_exception (status)));
+               status = acpi_ds_parse_method(obj_handle);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "\n+Method %p [%4.4s] - parse failure, %s\n",
+                                         obj_handle,
+                                         acpi_ut_get_node_name(obj_handle),
+                                         acpi_format_exception(status)));
 
                        /* This parse failed, but we will continue parsing more methods */
-
-                       break;
                }
 
-               /*
-                * Delete the parse tree.  We simply re-parse the method
-                * for every execution since there isn't much overhead
-                */
-               acpi_ns_delete_namespace_subtree (obj_handle);
-               acpi_ns_delete_namespace_by_owner (
-                       ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
+               info->method_count++;
                break;
 
-
        case ACPI_TYPE_DEVICE:
 
                info->device_count++;
                break;
 
-
        default:
                break;
        }
@@ -189,7 +169,6 @@ acpi_ds_init_one_object (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_initialize_objects
@@ -205,45 +184,43 @@ acpi_ds_init_one_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_initialize_objects (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *start_node)
+acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
+                          struct acpi_namespace_node * start_node)
 {
-       acpi_status                     status;
-       struct acpi_init_walk_info      info;
+       acpi_status status;
+       struct acpi_init_walk_info info;
 
+       ACPI_FUNCTION_TRACE("ds_initialize_objects");
 
-       ACPI_FUNCTION_TRACE ("ds_initialize_objects");
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "**** Starting initialization of namespace objects ****\n"));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "**** Starting initialization of namespace objects ****\n"));
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
-
-       info.method_count   = 0;
+       info.method_count = 0;
        info.op_region_count = 0;
-       info.object_count   = 0;
-       info.device_count   = 0;
-       info.table_desc     = table_desc;
+       info.object_count = 0;
+       info.device_count = 0;
+       info.table_desc = table_desc;
 
        /* Walk entire namespace from the supplied root */
 
-       status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
-                         acpi_ds_init_one_object, &info, NULL);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
+                                    acpi_ds_init_one_object, &info, NULL);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
+                                 acpi_format_exception(status)));
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
-               table_desc->pointer->signature, table_desc->table_id, info.object_count,
-               info.device_count, info.method_count, info.op_region_count));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
+                             table_desc->pointer->signature,
+                             table_desc->owner_id, info.object_count,
+                             info.device_count, info.method_count,
+                             info.op_region_count));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "%hd Methods, %hd Regions\n", info.method_count,
+                         info.op_region_count));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 9fc3f4c033eb6a5796a1e65ca2e18c2afe0cff5c..36c1ca0b9adb71a9b2d19fddd711a4b545a45312 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsmethod")
-
+ACPI_MODULE_NAME("dsmethod")
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_parse_method
  *
- * PARAMETERS:  obj_handle      - Method node
+ * PARAMETERS:  Node        - Method node
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Call the parser and parse the AML that is associated with the
- *              method.
+ * DESCRIPTION: Parse the AML that is associated with the method.
  *
  * MUTEX:       Assumes parser is locked
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ds_parse_method (
-       acpi_handle                     obj_handle)
+acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       union acpi_parse_object         *op;
-       struct acpi_namespace_node      *node;
-       acpi_owner_id                   owner_id;
-       struct acpi_walk_state          *walk_state;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle);
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       union acpi_parse_object *op;
+       struct acpi_walk_state *walk_state;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
 
        /* Parameter Validation */
 
-       if (!obj_handle) {
-               return_ACPI_STATUS (AE_NULL_ENTRY);
+       if (!node) {
+               return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
-               acpi_ut_get_node_name (obj_handle), obj_handle));
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "**** Parsing [%4.4s] **** named_obj=%p\n",
+                         acpi_ut_get_node_name(node), node));
 
        /* Extract the method object from the method Node */
 
-       node = (struct acpi_namespace_node *) obj_handle;
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+               return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
        /* Create a mutex for the method if there is a concurrency limit */
 
        if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
-               (!obj_desc->method.semaphore)) {
-               status = acpi_os_create_semaphore (obj_desc->method.concurrency,
-                                  obj_desc->method.concurrency,
-                                  &obj_desc->method.semaphore);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+           (!obj_desc->method.semaphore)) {
+               status = acpi_os_create_semaphore(obj_desc->method.concurrency,
+                                                 obj_desc->method.concurrency,
+                                                 &obj_desc->method.semaphore);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -117,14 +106,14 @@ acpi_ds_parse_method (
         * Allocate a new parser op to be the root of the parsed
         * method tree
         */
-       op = acpi_ps_alloc_op (AML_METHOD_OP);
+       op = acpi_ps_alloc_op(AML_METHOD_OP);
        if (!op) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Init new op with the method name and pointer back to the Node */
 
-       acpi_ps_set_name (op, node->name.integer);
+       acpi_ps_set_name(op, node->name.integer);
        op->common.node = node;
 
        /*
@@ -132,22 +121,27 @@ acpi_ds_parse_method (
         * objects (such as Operation Regions) can be created during the
         * first pass parse.
         */
-       owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
-       obj_desc->method.owning_id = owner_id;
+       status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
+       }
 
        /* Create and initialize a new walk state */
 
-       walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL);
+       walk_state =
+           acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
+                                     NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup2;
        }
 
-       status = acpi_ds_init_aml_walk (walk_state, op, node,
-                         obj_desc->method.aml_start,
-                         obj_desc->method.aml_length, NULL, 1);
-       if (ACPI_FAILURE (status)) {
-               acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+       status = acpi_ds_init_aml_walk(walk_state, op, node,
+                                      obj_desc->method.aml_start,
+                                      obj_desc->method.aml_length, NULL, 1);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               goto cleanup2;
        }
 
        /*
@@ -159,19 +153,30 @@ acpi_ds_parse_method (
         * method so that operands to the named objects can take on dynamic
         * run-time values.
         */
-       status = acpi_ps_parse_aml (walk_state);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ps_parse_aml(walk_state);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup2;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
-               acpi_ut_get_node_name (obj_handle), obj_handle, op));
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
+                         acpi_ut_get_node_name(node), node, op));
 
-       acpi_ps_delete_parse_tree (op);
-       return_ACPI_STATUS (status);
-}
+       /*
+        * Delete the parse tree. We simply re-parse the method for every
+        * execution since there isn't much overhead (compared to keeping lots
+        * of parse trees around)
+        */
+       acpi_ns_delete_namespace_subtree(node);
+       acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
+
+      cleanup2:
+       acpi_ut_release_owner_id(&obj_desc->method.owner_id);
 
+      cleanup:
+       acpi_ps_delete_parse_tree(op);
+       return_ACPI_STATUS(status);
+}
 
 /*******************************************************************************
  *
@@ -190,19 +195,23 @@ acpi_ds_parse_method (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_begin_method_execution (
-       struct acpi_namespace_node      *method_node,
-       union acpi_operand_object       *obj_desc,
-       struct acpi_namespace_node      *calling_method_node)
+acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
+                              union acpi_operand_object *obj_desc,
+                              struct acpi_namespace_node *calling_method_node)
 {
-       acpi_status                     status = AE_OK;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_begin_method_execution", method_node);
+       if (!method_node) {
+               return_ACPI_STATUS(AE_NULL_ENTRY);
+       }
 
+       /* Prevent wraparound of thread count */
 
-       if (!method_node) {
-               return_ACPI_STATUS (AE_NULL_ENTRY);
+       if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
+               ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n"));
+               return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
        }
 
        /*
@@ -219,8 +228,9 @@ acpi_ds_begin_method_execution (
                 * thread that is making recursive method calls.
                 */
                if (method_node == calling_method_node) {
-                       if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
-                               return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+                       if (obj_desc->method.thread_count >=
+                           obj_desc->method.concurrency) {
+                               return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
                        }
                }
 
@@ -228,8 +238,21 @@ acpi_ds_begin_method_execution (
                 * Get a unit from the method semaphore. This releases the
                 * interpreter if we block
                 */
-               status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
-                                ACPI_WAIT_FOREVER);
+               status =
+                   acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
+                                                 ACPI_WAIT_FOREVER);
+       }
+
+       /*
+        * Allocate an Owner ID for this method, only if this is the first thread
+        * to begin concurrent execution. We only need one owner_id, even if the
+        * method is invoked recursively.
+        */
+       if (!obj_desc->method.owner_id) {
+               status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
        }
 
        /*
@@ -237,10 +260,9 @@ acpi_ds_begin_method_execution (
         * reentered one more time (even if it is the same thread)
         */
        obj_desc->method.thread_count++;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_call_control_method
@@ -256,101 +278,99 @@ acpi_ds_begin_method_execution (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_call_control_method (
-       struct acpi_thread_state        *thread,
-       struct acpi_walk_state          *this_walk_state,
-       union acpi_parse_object         *op)
+acpi_ds_call_control_method(struct acpi_thread_state *thread,
+                           struct acpi_walk_state *this_walk_state,
+                           union acpi_parse_object *op)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *method_node;
-       struct acpi_walk_state          *next_walk_state;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_parameter_info      info;
-       u32                             i;
-
+       acpi_status status;
+       struct acpi_namespace_node *method_node;
+       struct acpi_walk_state *next_walk_state = NULL;
+       union acpi_operand_object *obj_desc;
+       struct acpi_parameter_info info;
+       u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_call_control_method", this_walk_state);
+       ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
-               this_walk_state->prev_op, this_walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Execute method %p, currentstate=%p\n",
+                         this_walk_state->prev_op, this_walk_state));
 
        /*
         * Get the namespace entry for the control method we are about to call
         */
        method_node = this_walk_state->method_call_node;
        if (!method_node) {
-               return_ACPI_STATUS (AE_NULL_ENTRY);
+               return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
-       obj_desc = acpi_ns_get_attached_object (method_node);
+       obj_desc = acpi_ns_get_attached_object(method_node);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+               return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
-       obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
-
        /* Init for new method, wait on concurrency semaphore */
 
-       status = acpi_ds_begin_method_execution (method_node, obj_desc,
-                         this_walk_state->method_node);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_begin_method_execution(method_node, obj_desc,
+                                               this_walk_state->method_node);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
        }
 
        if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
                /* 1) Parse: Create a new walk state for the preempting walk */
 
-               next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
-                                 op, obj_desc, NULL);
+               next_walk_state =
+                   acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
+                                             obj_desc, NULL);
                if (!next_walk_state) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Create and init a Root Node */
 
-               op = acpi_ps_create_scope_op ();
+               op = acpi_ps_create_scope_op();
                if (!op) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               status = acpi_ds_init_aml_walk (next_walk_state, op, method_node,
-                                 obj_desc->method.aml_start, obj_desc->method.aml_length,
-                                 NULL, 1);
-               if (ACPI_FAILURE (status)) {
-                       acpi_ds_delete_walk_state (next_walk_state);
+               status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
+                                              obj_desc->method.aml_start,
+                                              obj_desc->method.aml_length,
+                                              NULL, 1);
+               if (ACPI_FAILURE(status)) {
+                       acpi_ds_delete_walk_state(next_walk_state);
                        goto cleanup;
                }
 
                /* Begin AML parse */
 
-               status = acpi_ps_parse_aml (next_walk_state);
-               acpi_ps_delete_parse_tree (op);
+               status = acpi_ps_parse_aml(next_walk_state);
+               acpi_ps_delete_parse_tree(op);
        }
 
        /* 2) Execute: Create a new state for the preempting walk */
 
-       next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
-                         NULL, obj_desc, thread);
+       next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
+                                                   NULL, obj_desc, thread);
        if (!next_walk_state) {
                status = AE_NO_MEMORY;
                goto cleanup;
        }
        /*
         * The resolved arguments were put on the previous walk state's operand
-        * stack.  Operands on the previous walk state stack always
-        * start at index 0.
-        * Null terminate the list of arguments
+        * stack. Operands on the previous walk state stack always
+        * start at index 0. Also, null terminate the list of arguments
         */
-       this_walk_state->operands [this_walk_state->num_operands] = NULL;
+       this_walk_state->operands[this_walk_state->num_operands] = NULL;
 
        info.parameters = &this_walk_state->operands[0];
        info.parameter_type = ACPI_PARAM_ARGS;
 
-       status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node,
-                         obj_desc->method.aml_start, obj_desc->method.aml_length,
-                         &info, 3);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
+                                      obj_desc->method.aml_start,
+                                      obj_desc->method.aml_length, &info, 3);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -359,38 +379,37 @@ acpi_ds_call_control_method (
         * (they were copied to new objects)
         */
        for (i = 0; i < obj_desc->method.param_count; i++) {
-               acpi_ut_remove_reference (this_walk_state->operands [i]);
-               this_walk_state->operands [i] = NULL;
+               acpi_ut_remove_reference(this_walk_state->operands[i]);
+               this_walk_state->operands[i] = NULL;
        }
 
        /* Clear the operand stack */
 
        this_walk_state->num_operands = 0;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "Starting nested execution, newstate=%p\n", next_walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Starting nested execution, newstate=%p\n",
+                         next_walk_state));
 
        if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
-               status = obj_desc->method.implementation (next_walk_state);
-               return_ACPI_STATUS (status);
+               status = obj_desc->method.implementation(next_walk_state);
        }
 
-       return_ACPI_STATUS (AE_OK);
-
+       return_ACPI_STATUS(status);
 
-       /* On error, we must delete the new walk state */
+      cleanup:
+       /* Decrement the thread count on the method parse tree */
 
-cleanup:
        if (next_walk_state && (next_walk_state->method_desc)) {
-               /* Decrement the thread count on the method parse tree */
-
-          next_walk_state->method_desc->method.thread_count--;
+               next_walk_state->method_desc->method.thread_count--;
        }
-       (void) acpi_ds_terminate_control_method (next_walk_state);
-       acpi_ds_delete_walk_state (next_walk_state);
-       return_ACPI_STATUS (status);
-}
 
+       /* On error, we must delete the new walk state */
+
+       acpi_ds_terminate_control_method(next_walk_state);
+       acpi_ds_delete_walk_state(next_walk_state);
+       return_ACPI_STATUS(status);
+}
 
 /*******************************************************************************
  *
@@ -407,25 +426,22 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ds_restart_control_method (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *return_desc)
+acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
+                              union acpi_operand_object *return_desc)
 {
-       acpi_status                     status;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state);
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_restart_control_method", walk_state);
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "****Restart [%4.4s] Op %p return_value_from_callee %p\n",
+                         (char *)&walk_state->method_node->name,
+                         walk_state->method_call_op, return_desc));
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "****Restart [%4.4s] Op %p return_value_from_callee %p\n",
-               (char *) &walk_state->method_node->name, walk_state->method_call_op,
-               return_desc));
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "    return_from_this_method_used?=%X res_stack %p Walk %p\n",
-               walk_state->return_used,
-               walk_state->results, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "    return_from_this_method_used?=%X res_stack %p Walk %p\n",
+                         walk_state->return_used,
+                         walk_state->results, walk_state));
 
        /* Did the called method return a value? */
 
@@ -435,10 +451,10 @@ acpi_ds_restart_control_method (
                if (walk_state->return_used) {
                        /* Save the return value from the previous method */
 
-                       status = acpi_ds_result_push (return_desc, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               acpi_ut_remove_reference (return_desc);
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_result_push(return_desc, walk_state);
+                       if (ACPI_FAILURE(status)) {
+                               acpi_ut_remove_reference(return_desc);
+                               return_ACPI_STATUS(status);
                        }
 
                        /*
@@ -456,26 +472,26 @@ acpi_ds_restart_control_method (
                 * NOTE: this is optional because the ASL language does not actually
                 * support this behavior.
                 */
-               else if (!acpi_ds_do_implicit_return (return_desc, walk_state, FALSE)) {
+               else if (!acpi_ds_do_implicit_return
+                        (return_desc, walk_state, FALSE)) {
                        /*
                         * Delete the return value if it will not be used by the
                         * calling method
                         */
-                       acpi_ut_remove_reference (return_desc);
+                       acpi_ut_remove_reference(return_desc);
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_terminate_control_method
  *
  * PARAMETERS:  walk_state          - State of the method
  *
- * RETURN:      Status
+ * RETURN:      None
  *
  * DESCRIPTION: Terminate a control method.  Delete everything that the method
  *              created, delete all locals and arguments, and delete the parse
@@ -483,63 +499,59 @@ acpi_ds_restart_control_method (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_terminate_control_method (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *method_node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state);
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *method_node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
 
        if (!walk_state) {
-               return (AE_BAD_PARAMETER);
+               return_VOID;
        }
 
        /* The current method object was saved in the walk state */
 
        obj_desc = walk_state->method_desc;
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_OK);
+               return_VOID;
        }
 
        /* Delete all arguments and locals */
 
-       acpi_ds_method_data_delete_all (walk_state);
+       acpi_ds_method_data_delete_all(walk_state);
 
        /*
         * Lock the parser while we terminate this method.
         * If this is the last thread executing the method,
         * we have additional cleanup to perform
         */
-       status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
+       if (ACPI_FAILURE(status)) {
+               return_VOID;
        }
 
        /* Signal completion of the execution of this method if necessary */
 
        if (walk_state->method_desc->method.semaphore) {
-               status = acpi_os_signal_semaphore (
-                                 walk_state->method_desc->method.semaphore, 1);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
-                       status = AE_OK;
+               status =
+                   acpi_os_signal_semaphore(walk_state->method_desc->method.
+                                            semaphore, 1);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
 
                        /* Ignore error and continue cleanup */
                }
        }
 
        if (walk_state->method_desc->method.thread_count) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "*** Not deleting method namespace, there are still %d threads\n",
-                       walk_state->method_desc->method.thread_count));
-       }
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "*** Not deleting method namespace, there are still %d threads\n",
+                                 walk_state->method_desc->method.
+                                 thread_count));
+       } else {                /* This is the last executing thread */
 
-       if (!walk_state->method_desc->method.thread_count) {
                /*
                 * Support to dynamically change a method from not_serialized to
                 * Serialized if it appears that the method is written foolishly and
@@ -551,10 +563,11 @@ acpi_ds_terminate_control_method (
                 * before creating the synchronization semaphore.
                 */
                if ((walk_state->method_desc->method.concurrency == 1) &&
-                       (!walk_state->method_desc->method.semaphore)) {
-                       status = acpi_os_create_semaphore (1,
-                                        1,
-                                        &walk_state->method_desc->method.semaphore);
+                   (!walk_state->method_desc->method.semaphore)) {
+                       status = acpi_os_create_semaphore(1, 1,
+                                                         &walk_state->
+                                                         method_desc->method.
+                                                         semaphore);
                }
 
                /*
@@ -569,28 +582,27 @@ acpi_ds_terminate_control_method (
                 * Delete any namespace entries created immediately underneath
                 * the method
                 */
-               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE(status)) {
+                       goto exit;
                }
 
                if (method_node->child) {
-                       acpi_ns_delete_namespace_subtree (method_node);
+                       acpi_ns_delete_namespace_subtree(method_node);
                }
 
                /*
                 * Delete any namespace entries created anywhere else within
                 * the namespace
                 */
-               acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
-               status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
+               acpi_ns_delete_namespace_by_owner(walk_state->method_desc->
+                                                 method.owner_id);
+               status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+               acpi_ut_release_owner_id(&walk_state->method_desc->method.
+                                        owner_id);
        }
 
-       status = acpi_ut_release_mutex (ACPI_MTX_PARSER);
-       return_ACPI_STATUS (status);
+      exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_PARSER);
+       return_VOID;
 }
-
-
index f7998306f756492b396fe5fbb57c6685af72d781..4095ce70982bf3fcb1d852523ca25e4c99794b6d 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsmthdat")
+ACPI_MODULE_NAME("dsmthdat")
 
 /* Local prototypes */
-
 static void
-acpi_ds_method_data_delete_value (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_delete_value(u16 opcode,
+                                u32 index, struct acpi_walk_state *walk_state);
 
 static acpi_status
-acpi_ds_method_data_set_value (
-       u16                             opcode,
-       u32                             index,
-       union acpi_operand_object       *object,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_set_value(u16 opcode,
+                             u32 index,
+                             union acpi_operand_object *object,
+                             struct acpi_walk_state *walk_state);
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 acpi_object_type
-acpi_ds_method_data_get_type (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_get_type(u16 opcode,
+                            u32 index, struct acpi_walk_state *walk_state);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_init
@@ -97,45 +88,41 @@ acpi_ds_method_data_get_type (
  *
  ******************************************************************************/
 
-void
-acpi_ds_method_data_init (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
 {
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ds_method_data_init");
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ds_method_data_init");
 
        /* Init the method arguments */
 
        for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
-               ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name,
+               ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
                                   NAMEOF_ARG_NTE);
                walk_state->arguments[i].name.integer |= (i << 24);
-               walk_state->arguments[i].descriptor   = ACPI_DESC_TYPE_NAMED;
-               walk_state->arguments[i].type         = ACPI_TYPE_ANY;
-               walk_state->arguments[i].flags        = ANOBJ_END_OF_PEER_LIST |
-                                 ANOBJ_METHOD_ARG;
+               walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
+               walk_state->arguments[i].type = ACPI_TYPE_ANY;
+               walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
+                   ANOBJ_METHOD_ARG;
        }
 
        /* Init the method locals */
 
        for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
-               ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name,
+               ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name,
                                   NAMEOF_LOCAL_NTE);
 
                walk_state->local_variables[i].name.integer |= (i << 24);
-               walk_state->local_variables[i].descriptor  = ACPI_DESC_TYPE_NAMED;
-               walk_state->local_variables[i].type        = ACPI_TYPE_ANY;
-               walk_state->local_variables[i].flags       = ANOBJ_END_OF_PEER_LIST |
-                                ANOBJ_METHOD_LOCAL;
+               walk_state->local_variables[i].descriptor =
+                   ACPI_DESC_TYPE_NAMED;
+               walk_state->local_variables[i].type = ACPI_TYPE_ANY;
+               walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
+                   ANOBJ_METHOD_LOCAL;
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_delete_all
@@ -149,26 +136,25 @@ acpi_ds_method_data_init (
  *
  ******************************************************************************/
 
-void
-acpi_ds_method_data_delete_all (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
 {
-       u32                             index;
-
-
-       ACPI_FUNCTION_TRACE ("ds_method_data_delete_all");
+       u32 index;
 
+       ACPI_FUNCTION_TRACE("ds_method_data_delete_all");
 
        /* Detach the locals */
 
        for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
                if (walk_state->local_variables[index].object) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
-                                       index, walk_state->local_variables[index].object));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
+                                         index,
+                                         walk_state->local_variables[index].
+                                         object));
 
                        /* Detach object (if present) and remove a reference */
 
-                       acpi_ns_detach_object (&walk_state->local_variables[index]);
+                       acpi_ns_detach_object(&walk_state->
+                                             local_variables[index]);
                }
        }
 
@@ -176,19 +162,19 @@ acpi_ds_method_data_delete_all (
 
        for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
                if (walk_state->arguments[index].object) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
-                                       index, walk_state->arguments[index].object));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
+                                         index,
+                                         walk_state->arguments[index].object));
 
                        /* Detach object (if present) and remove a reference */
 
-                       acpi_ns_detach_object (&walk_state->arguments[index]);
+                       acpi_ns_detach_object(&walk_state->arguments[index]);
                }
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_init_args
@@ -206,47 +192,44 @@ acpi_ds_method_data_delete_all (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_init_args (
-       union acpi_operand_object       **params,
-       u32                             max_param_count,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_init_args(union acpi_operand_object **params,
+                             u32 max_param_count,
+                             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       u32                             index = 0;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params);
+       acpi_status status;
+       u32 index = 0;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params);
 
        if (!params) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
-               return_ACPI_STATUS (AE_OK);
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "No param list passed to method\n"));
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Copy passed parameters into the new method stack frame */
 
        while ((index < ACPI_METHOD_NUM_ARGS) &&
-                  (index < max_param_count)      &&
-                       params[index]) {
+              (index < max_param_count) && params[index]) {
                /*
                 * A valid parameter.
                 * Store the argument in the method/walk descriptor.
                 * Do not copy the arg in order to implement call by reference
                 */
-               status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
-                                params[index], walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
+                                                      params[index],
+                                                      walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                index++;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index));
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_get_node
@@ -263,14 +246,12 @@ acpi_ds_method_data_init_args (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_node (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      **node)
+acpi_ds_method_data_get_node(u16 opcode,
+                            u32 index,
+                            struct acpi_walk_state *walk_state,
+                            struct acpi_namespace_node **node)
 {
-       ACPI_FUNCTION_TRACE ("ds_method_data_get_node");
-
+       ACPI_FUNCTION_TRACE("ds_method_data_get_node");
 
        /*
         * Method Locals and Arguments are supported
@@ -279,10 +260,10 @@ acpi_ds_method_data_get_node (
        case AML_LOCAL_OP:
 
                if (index > ACPI_METHOD_MAX_LOCAL) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Local index %d is invalid (max %d)\n",
-                               index, ACPI_METHOD_MAX_LOCAL));
-                       return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Local index %d is invalid (max %d)\n",
+                                         index, ACPI_METHOD_MAX_LOCAL));
+                       return_ACPI_STATUS(AE_AML_INVALID_INDEX);
                }
 
                /* Return a pointer to the pseudo-node */
@@ -293,10 +274,10 @@ acpi_ds_method_data_get_node (
        case AML_ARG_OP:
 
                if (index > ACPI_METHOD_MAX_ARG) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Arg index %d is invalid (max %d)\n",
-                               index, ACPI_METHOD_MAX_ARG));
-                       return_ACPI_STATUS (AE_AML_INVALID_INDEX);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Arg index %d is invalid (max %d)\n",
+                                         index, ACPI_METHOD_MAX_ARG));
+                       return_ACPI_STATUS(AE_AML_INVALID_INDEX);
                }
 
                /* Return a pointer to the pseudo-node */
@@ -305,14 +286,14 @@ acpi_ds_method_data_get_node (
                break;
 
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
-               return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n",
+                                 opcode));
+               return_ACPI_STATUS(AE_AML_BAD_OPCODE);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_set_value
@@ -330,29 +311,26 @@ acpi_ds_method_data_get_node (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_method_data_set_value (
-       u16                             opcode,
-       u32                             index,
-       union acpi_operand_object       *object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_set_value(u16 opcode,
+                             u32 index,
+                             union acpi_operand_object *object,
+                             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-
+       acpi_status status;
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE ("ds_method_data_set_value");
+       ACPI_FUNCTION_TRACE("ds_method_data_set_value");
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
-               opcode, object->common.reference_count,
-               acpi_ut_get_type_name (object->common.type)));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "new_obj %p Opcode %X, Refs=%d [%s]\n", object,
+                         opcode, object->common.reference_count,
+                         acpi_ut_get_type_name(object->common.type)));
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -361,15 +339,14 @@ acpi_ds_method_data_set_value (
         * reference semantics of ACPI Control Method invocation.
         * (See ACPI specification 2.0_c)
         */
-       acpi_ut_add_reference (object);
+       acpi_ut_add_reference(object);
 
        /* Install the object */
 
        node->object = object;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_get_value
@@ -387,32 +364,30 @@ acpi_ds_method_data_set_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_value (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       **dest_desc)
+acpi_ds_method_data_get_value(u16 opcode,
+                             u32 index,
+                             struct acpi_walk_state *walk_state,
+                             union acpi_operand_object **dest_desc)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       *object;
-
-
-       ACPI_FUNCTION_TRACE ("ds_method_data_get_value");
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *object;
 
+       ACPI_FUNCTION_TRACE("ds_method_data_get_value");
 
        /* Validate the object descriptor */
 
        if (!dest_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null object descriptor pointer\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the object from the node */
@@ -433,9 +408,10 @@ acpi_ds_method_data_get_value (
                /* If slack enabled, init the local_x/arg_x to an Integer of value zero */
 
                if (acpi_gbl_enable_interpreter_slack) {
-                       object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+                       object =
+                           acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                        if (!object) {
-                               return_ACPI_STATUS (AE_NO_MEMORY);
+                               return_ACPI_STATUS(AE_NO_MEMORY);
                        }
 
                        object->integer.value = 0;
@@ -444,27 +420,29 @@ acpi_ds_method_data_get_value (
 
                /* Otherwise, return the error */
 
-               else switch (opcode) {
-               case AML_ARG_OP:
+               else
+                       switch (opcode) {
+                       case AML_ARG_OP:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Uninitialized Arg[%d] at node %p\n",
-                               index, node));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Uninitialized Arg[%d] at node %p\n",
+                                                 index, node));
 
-                       return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
+                               return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
-               case AML_LOCAL_OP:
+                       case AML_LOCAL_OP:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Uninitialized Local[%d] at node %p\n",
-                               index, node));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Uninitialized Local[%d] at node %p\n",
+                                                 index, node));
 
-                       return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
+                               return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
-               default:
-                       ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
-               }
+                       default:
+                               ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
+                                                  opcode));
+                               return_ACPI_STATUS(AE_AML_INTERNAL);
+                       }
        }
 
        /*
@@ -472,12 +450,11 @@ acpi_ds_method_data_get_value (
         * Return an additional reference to the object
         */
        *dest_desc = object;
-       acpi_ut_add_reference (object);
+       acpi_ut_add_reference(object);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_method_data_delete_value
@@ -494,29 +471,25 @@ acpi_ds_method_data_get_value (
  ******************************************************************************/
 
 static void
-acpi_ds_method_data_delete_value (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_delete_value(u16 opcode,
+                                u32 index, struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       *object;
-
-
-       ACPI_FUNCTION_TRACE ("ds_method_data_delete_value");
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *object;
 
+       ACPI_FUNCTION_TRACE("ds_method_data_delete_value");
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       if (ACPI_FAILURE(status)) {
                return_VOID;
        }
 
        /* Get the associated object */
 
-       object = acpi_ns_get_attached_object (node);
+       object = acpi_ns_get_attached_object(node);
 
        /*
         * Undefine the Arg or Local by setting its descriptor
@@ -526,19 +499,18 @@ acpi_ds_method_data_delete_value (
        node->object = NULL;
 
        if ((object) &&
-               (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
+           (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) {
                /*
                 * There is a valid object.
                 * Decrement the reference count by one to balance the
                 * increment when the object was stored.
                 */
-               acpi_ut_remove_reference (object);
+               acpi_ut_remove_reference(object);
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_store_object_to_local
@@ -557,40 +529,38 @@ acpi_ds_method_data_delete_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_store_object_to_local (
-       u16                             opcode,
-       u32                             index,
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_store_object_to_local(u16 opcode,
+                             u32 index,
+                             union acpi_operand_object *obj_desc,
+                             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       *current_obj_desc;
-       union acpi_operand_object       *new_obj_desc;
-
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *current_obj_desc;
+       union acpi_operand_object *new_obj_desc;
 
-       ACPI_FUNCTION_TRACE ("ds_store_object_to_local");
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
-               opcode, index, obj_desc));
+       ACPI_FUNCTION_TRACE("ds_store_object_to_local");
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
+                         opcode, index, obj_desc));
 
        /* Parameter validation */
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       current_obj_desc = acpi_ns_get_attached_object (node);
+       current_obj_desc = acpi_ns_get_attached_object(node);
        if (current_obj_desc == obj_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
-                       obj_desc));
-               return_ACPI_STATUS (status);
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n",
+                                 obj_desc));
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -602,9 +572,11 @@ acpi_ds_store_object_to_local (
         */
        new_obj_desc = obj_desc;
        if (obj_desc->common.reference_count > 1) {
-               status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
+                                                   walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -632,43 +604,40 @@ acpi_ds_store_object_to_local (
                 * Weird, but true.
                 */
                if (opcode == AML_ARG_OP) {
-                       /*
-                        * Make sure that the object is the correct type.  This may be
-                        * overkill, butit is here because references were NS nodes in
-                        *  the past.  Now they are operand objects of type Reference.
-                        */
-                       if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
-                               ACPI_REPORT_ERROR ((
-                                       "Invalid descriptor type while storing to method arg: [%s]\n",
-                                       acpi_ut_get_descriptor_name (current_obj_desc)));
-                               return_ACPI_STATUS (AE_AML_INTERNAL);
-                       }
-
                        /*
                         * If we have a valid reference object that came from ref_of(),
                         * do the indirect store
                         */
-                       if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-                               (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                                               "Arg (%p) is an obj_ref(Node), storing in node %p\n",
-                                               new_obj_desc, current_obj_desc));
+                       if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) ==
+                            ACPI_DESC_TYPE_OPERAND)
+                           && (current_obj_desc->common.type ==
+                               ACPI_TYPE_LOCAL_REFERENCE)
+                           && (current_obj_desc->reference.opcode ==
+                               AML_REF_OF_OP)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                 "Arg (%p) is an obj_ref(Node), storing in node %p\n",
+                                                 new_obj_desc,
+                                                 current_obj_desc));
 
                                /*
                                 * Store this object to the Node (perform the indirect store)
                                 * NOTE: No implicit conversion is performed, as per the ACPI
                                 * specification rules on storing to Locals/Args.
                                 */
-                               status = acpi_ex_store_object_to_node (new_obj_desc,
-                                                current_obj_desc->reference.object, walk_state,
-                                                ACPI_NO_IMPLICIT_CONVERSION);
+                               status =
+                                   acpi_ex_store_object_to_node(new_obj_desc,
+                                                                current_obj_desc->
+                                                                reference.
+                                                                object,
+                                                                walk_state,
+                                                                ACPI_NO_IMPLICIT_CONVERSION);
 
                                /* Remove local reference if we copied the object above */
 
                                if (new_obj_desc != obj_desc) {
-                                       acpi_ut_remove_reference (new_obj_desc);
+                                       acpi_ut_remove_reference(new_obj_desc);
                                }
-                               return_ACPI_STATUS (status);
+                               return_ACPI_STATUS(status);
                        }
                }
 
@@ -676,7 +645,7 @@ acpi_ds_store_object_to_local (
                 * Delete the existing object
                 * before storing the new one
                 */
-               acpi_ds_method_data_delete_value (opcode, index, walk_state);
+               acpi_ds_method_data_delete_value(opcode, index, walk_state);
        }
 
        /*
@@ -684,18 +653,19 @@ acpi_ds_store_object_to_local (
         * the descriptor for the Arg or Local.
         * (increments the object reference count by one)
         */
-       status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state);
+       status =
+           acpi_ds_method_data_set_value(opcode, index, new_obj_desc,
+                                         walk_state);
 
        /* Remove local reference if we copied the object above */
 
        if (new_obj_desc != obj_desc) {
-               acpi_ut_remove_reference (new_obj_desc);
+               acpi_ut_remove_reference(new_obj_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -712,39 +682,33 @@ acpi_ds_store_object_to_local (
  ******************************************************************************/
 
 acpi_object_type
-acpi_ds_method_data_get_type (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_method_data_get_type(u16 opcode,
+                            u32 index, struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       *object;
-
-
-       ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *object;
 
+       ACPI_FUNCTION_TRACE("ds_method_data_get_type");
 
        /* Get the namespace node for the arg/local */
 
-       status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
-       if (ACPI_FAILURE (status)) {
-               return_VALUE ((ACPI_TYPE_NOT_FOUND));
+       status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+       if (ACPI_FAILURE(status)) {
+               return_VALUE((ACPI_TYPE_NOT_FOUND));
        }
 
        /* Get the object */
 
-       object = acpi_ns_get_attached_object (node);
+       object = acpi_ns_get_attached_object(node);
        if (!object) {
                /* Uninitialized local/arg, return TYPE_ANY */
 
-               return_VALUE (ACPI_TYPE_ANY);
+               return_VALUE(ACPI_TYPE_ANY);
        }
 
        /* Get the object type */
 
-       return_VALUE (ACPI_GET_OBJECT_TYPE (object));
+       return_VALUE(ACPI_GET_OBJECT_TYPE(object));
 }
 #endif
-
-
index bfbae4e4c667d76159ba480a8799be0b6c5f4480..8ac0cd93adb580b3e70c285bb0c99bf3452dd2d6 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsobject")
+ACPI_MODULE_NAME("dsobject")
 
 static acpi_status
-acpi_ds_build_internal_object (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       union acpi_operand_object       **obj_desc_ptr);
-
+acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
+                             union acpi_parse_object *op,
+                             union acpi_operand_object **obj_desc_ptr);
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -76,17 +73,14 @@ acpi_ds_build_internal_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_build_internal_object (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
+                             union acpi_parse_object *op,
+                             union acpi_operand_object **obj_desc_ptr)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ds_build_internal_object");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ds_build_internal_object");
 
        *obj_desc_ptr = NULL;
        if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -96,40 +90,44 @@ acpi_ds_build_internal_object (
                 * Otherwise, go ahead and look it up now
                 */
                if (!op->common.node) {
-                       status = acpi_ns_lookup (walk_state->scope_info,
-                                         op->common.value.string,
-                                         ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                                         ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                                         NULL,
-                                         (struct acpi_namespace_node **) &(op->common.node));
-
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_NSERROR (op->common.value.string, status);
-                               return_ACPI_STATUS (status);
+                       status = acpi_ns_lookup(walk_state->scope_info,
+                                               op->common.value.string,
+                                               ACPI_TYPE_ANY,
+                                               ACPI_IMODE_EXECUTE,
+                                               ACPI_NS_SEARCH_PARENT |
+                                               ACPI_NS_DONT_OPEN_SCOPE, NULL,
+                                               (struct acpi_namespace_node **)
+                                               &(op->common.node));
+
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_NSERROR(op->common.value.string,
+                                                   status);
+                               return_ACPI_STATUS(status);
                        }
                }
        }
 
        /* Create and init the internal ACPI object */
 
-       obj_desc = acpi_ut_create_internal_object (
-                        (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
+       obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
+                                                  (op->common.aml_opcode))->
+                                                 object_type);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
-                        &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (obj_desc);
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
+                                       &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(obj_desc);
+               return_ACPI_STATUS(status);
        }
 
        *obj_desc_ptr = obj_desc;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_build_internal_buffer_obj
@@ -147,20 +145,17 @@ acpi_ds_build_internal_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_build_internal_buffer_obj (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u32                             buffer_length,
-       union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
+                                 union acpi_parse_object *op,
+                                 u32 buffer_length,
+                                 union acpi_operand_object **obj_desc_ptr)
 {
-       union acpi_parse_object         *arg;
-       union acpi_operand_object       *obj_desc;
-       union acpi_parse_object         *byte_list;
-       u32                             byte_list_length = 0;
-
-
-       ACPI_FUNCTION_TRACE ("ds_build_internal_buffer_obj");
+       union acpi_parse_object *arg;
+       union acpi_operand_object *obj_desc;
+       union acpi_parse_object *byte_list;
+       u32 byte_list_length = 0;
 
+       ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
 
        obj_desc = *obj_desc_ptr;
        if (obj_desc) {
@@ -168,14 +163,13 @@ acpi_ds_build_internal_buffer_obj (
                 * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
                 * The buffer object already exists (from the NS node)
                 */
-       }
-       else {
+       } else {
                /* Create a new buffer object */
 
-               obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+               obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
                *obj_desc_ptr = obj_desc;
                if (!obj_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
        }
 
@@ -184,16 +178,17 @@ acpi_ds_build_internal_buffer_obj (
         * individual bytes or a string initializer.  In either case, a
         * byte_list appears in the AML.
         */
-       arg = op->common.value.arg;         /* skip first arg */
+       arg = op->common.value.arg;     /* skip first arg */
 
        byte_list = arg->named.next;
        if (byte_list) {
                if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Expecting bytelist, got AML opcode %X in op %p\n",
-                               byte_list->common.aml_opcode, byte_list));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Expecting bytelist, got AML opcode %X in op %p\n",
+                                         byte_list->common.aml_opcode,
+                                         byte_list));
 
-                       acpi_ut_remove_reference (obj_desc);
+                       acpi_ut_remove_reference(obj_desc);
                        return (AE_TYPE);
                }
 
@@ -214,31 +209,29 @@ acpi_ds_build_internal_buffer_obj (
 
        if (obj_desc->buffer.length == 0) {
                obj_desc->buffer.pointer = NULL;
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Buffer defined with zero length in AML, creating\n"));
-       }
-       else {
-               obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
-                                  obj_desc->buffer.length);
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Buffer defined with zero length in AML, creating\n"));
+       } else {
+               obj_desc->buffer.pointer =
+                   ACPI_MEM_CALLOCATE(obj_desc->buffer.length);
                if (!obj_desc->buffer.pointer) {
-                       acpi_ut_delete_object_desc (obj_desc);
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       acpi_ut_delete_object_desc(obj_desc);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Initialize buffer from the byte_list (if present) */
 
                if (byte_list) {
-                       ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data,
-                                         byte_list_length);
+                       ACPI_MEMCPY(obj_desc->buffer.pointer,
+                                   byte_list->named.data, byte_list_length);
                }
        }
 
        obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
-       op->common.node = (struct acpi_namespace_node *) obj_desc;
-       return_ACPI_STATUS (AE_OK);
+       op->common.node = (struct acpi_namespace_node *)obj_desc;
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_build_internal_package_obj
@@ -256,28 +249,25 @@ acpi_ds_build_internal_buffer_obj (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_build_internal_package_obj (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u32                             package_length,
-       union acpi_operand_object       **obj_desc_ptr)
+acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
+                                  union acpi_parse_object *op,
+                                  u32 package_length,
+                                  union acpi_operand_object **obj_desc_ptr)
 {
-       union acpi_parse_object         *arg;
-       union acpi_parse_object         *parent;
-       union acpi_operand_object       *obj_desc = NULL;
-       u32                             package_list_length;
-       acpi_status                     status = AE_OK;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ds_build_internal_package_obj");
+       union acpi_parse_object *arg;
+       union acpi_parse_object *parent;
+       union acpi_operand_object *obj_desc = NULL;
+       u32 package_list_length;
+       acpi_status status = AE_OK;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
 
        /* Find the parent of a possibly nested package */
 
        parent = op->common.parent;
-       while ((parent->common.aml_opcode == AML_PACKAGE_OP)    ||
-                  (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
+       while ((parent->common.aml_opcode == AML_PACKAGE_OP) ||
+              (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
                parent = parent->common.parent;
        }
 
@@ -287,12 +277,11 @@ acpi_ds_build_internal_package_obj (
                 * We are evaluating a Named package object "Name (xxxx, Package)".
                 * Get the existing package object from the NS node
                 */
-       }
-       else {
-               obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
+       } else {
+               obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
                *obj_desc_ptr = obj_desc;
                if (!obj_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                obj_desc->package.node = parent->common.node;
@@ -323,12 +312,13 @@ acpi_ds_build_internal_package_obj (
         * individual objects). Add an extra pointer slot so
         * that the list is always null terminated.
         */
-       obj_desc->package.elements = ACPI_MEM_CALLOCATE (
-                        ((acpi_size) obj_desc->package.count + 1) * sizeof (void *));
+       obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc->
+                                                        package.count +
+                                                        1) * sizeof(void *));
 
        if (!obj_desc->package.elements) {
-               acpi_ut_delete_object_desc (obj_desc);
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               acpi_ut_delete_object_desc(obj_desc);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
@@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj (
                        /* Object (package or buffer) is already built */
 
                        obj_desc->package.elements[i] =
-                               ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
-               }
-               else {
-                       status = acpi_ds_build_internal_object (walk_state, arg,
-                                        &obj_desc->package.elements[i]);
+                           ACPI_CAST_PTR(union acpi_operand_object,
+                                         arg->common.node);
+               } else {
+                       status = acpi_ds_build_internal_object(walk_state, arg,
+                                                              &obj_desc->
+                                                              package.
+                                                              elements[i]);
                }
 
                i++;
@@ -354,11 +346,10 @@ acpi_ds_build_internal_package_obj (
        }
 
        obj_desc->package.flags |= AOPOBJ_DATA_VALID;
-       op->common.node = (struct acpi_namespace_node *) obj_desc;
-       return_ACPI_STATUS (status);
+       op->common.node = (struct acpi_namespace_node *)obj_desc;
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_node
@@ -374,57 +365,53 @@ acpi_ds_build_internal_package_obj (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_node (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *node,
-       union acpi_parse_object         *op)
+acpi_ds_create_node(struct acpi_walk_state *walk_state,
+                   struct acpi_namespace_node *node,
+                   union acpi_parse_object *op)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_node", op);
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_node", op);
 
        /*
         * Because of the execution pass through the non-control-method
         * parts of the table, we can arrive here twice.  Only init
         * the named object node the first time through
         */
-       if (acpi_ns_get_attached_object (node)) {
-               return_ACPI_STATUS (AE_OK);
+       if (acpi_ns_get_attached_object(node)) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        if (!op->common.value.arg) {
                /* No arguments, there is nothing to do */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Build an internal object for the argument(s) */
 
-       status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
-                        &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_build_internal_object(walk_state, op->common.value.arg,
+                                              &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Re-type the object according to its argument */
 
-       node->type = ACPI_GET_OBJECT_TYPE (obj_desc);
+       node->type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
        /* Attach obj to node */
 
-       status = acpi_ns_attach_object (node, obj_desc, node->type);
+       status = acpi_ns_attach_object(node, obj_desc, node->type);
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-#endif /* ACPI_NO_METHOD_EXECUTION */
-
+#endif                         /* ACPI_NO_METHOD_EXECUTION */
 
 /*******************************************************************************
  *
@@ -444,55 +431,50 @@ acpi_ds_create_node (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_init_object_from_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u16                             opcode,
-       union acpi_operand_object       **ret_obj_desc)
+acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
+                           union acpi_parse_object *op,
+                           u16 opcode,
+                           union acpi_operand_object **ret_obj_desc)
 {
-       const struct acpi_opcode_info   *op_info;
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ds_init_object_from_op");
+       const struct acpi_opcode_info *op_info;
+       union acpi_operand_object *obj_desc;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ds_init_object_from_op");
 
        obj_desc = *ret_obj_desc;
-       op_info = acpi_ps_get_opcode_info (opcode);
+       op_info = acpi_ps_get_opcode_info(opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
                /* Unknown opcode */
 
-               return_ACPI_STATUS (AE_TYPE);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        /* Perform per-object initialization */
 
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_BUFFER:
 
                /*
                 * Defer evaluation of Buffer term_arg operand
                 */
-               obj_desc->buffer.node     = (struct acpi_namespace_node *)
-                                  walk_state->operands[0];
+               obj_desc->buffer.node = (struct acpi_namespace_node *)
+                   walk_state->operands[0];
                obj_desc->buffer.aml_start = op->named.data;
                obj_desc->buffer.aml_length = op->named.length;
                break;
 
-
        case ACPI_TYPE_PACKAGE:
 
                /*
                 * Defer evaluation of Package term_arg operand
                 */
-               obj_desc->package.node     = (struct acpi_namespace_node *)
-                                  walk_state->operands[0];
+               obj_desc->package.node = (struct acpi_namespace_node *)
+                   walk_state->operands[0];
                obj_desc->package.aml_start = op->named.data;
                obj_desc->package.aml_length = op->named.length;
                break;
 
-
        case ACPI_TYPE_INTEGER:
 
                switch (op_info->type) {
@@ -525,7 +507,7 @@ acpi_ds_init_object_from_op (
                                /* Truncate value if we are executing from a 32-bit ACPI table */
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-                               acpi_ex_truncate_for32bit_table (obj_desc);
+                               acpi_ex_truncate_for32bit_table(obj_desc);
 #endif
                                break;
 
@@ -536,33 +518,36 @@ acpi_ds_init_object_from_op (
 
                        default:
 
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Unknown constant opcode %X\n", opcode));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Unknown constant opcode %X\n",
+                                                 opcode));
                                status = AE_AML_OPERAND_TYPE;
                                break;
                        }
                        break;
 
-
                case AML_TYPE_LITERAL:
 
                        obj_desc->integer.value = op->common.value.integer;
+#ifndef ACPI_NO_METHOD_EXECUTION
+                       acpi_ex_truncate_for32bit_table(obj_desc);
+#endif
                        break;
 
-
                default:
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
-                               op_info->type));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unknown Integer type %X\n",
+                                         op_info->type));
                        status = AE_AML_OPERAND_TYPE;
                        break;
                }
                break;
 
-
        case ACPI_TYPE_STRING:
 
                obj_desc->string.pointer = op->common.value.string;
-               obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string);
+               obj_desc->string.length =
+                   (u32) ACPI_STRLEN(op->common.value.string);
 
                /*
                 * The string is contained in the ACPI table, don't ever try
@@ -571,11 +556,9 @@ acpi_ds_init_object_from_op (
                obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
                break;
 
-
        case ACPI_TYPE_METHOD:
                break;
 
-
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                switch (op_info->type) {
@@ -587,14 +570,17 @@ acpi_ds_init_object_from_op (
                        obj_desc->reference.offset = opcode - AML_LOCAL_OP;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-                       status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
-                                        obj_desc->reference.offset,
-                                        walk_state,
-                                        (struct acpi_namespace_node **) &obj_desc->reference.object);
+                       status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
+                                                             obj_desc->
+                                                             reference.offset,
+                                                             walk_state,
+                                                             (struct
+                                                              acpi_namespace_node
+                                                              **)&obj_desc->
+                                                             reference.object);
 #endif
                        break;
 
-
                case AML_TYPE_METHOD_ARGUMENT:
 
                        /* Split the opcode into a base opcode + offset */
@@ -603,14 +589,18 @@ acpi_ds_init_object_from_op (
                        obj_desc->reference.offset = opcode - AML_ARG_OP;
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-                       status = acpi_ds_method_data_get_node (AML_ARG_OP,
-                                        obj_desc->reference.offset,
-                                        walk_state,
-                                        (struct acpi_namespace_node **) &obj_desc->reference.object);
+                       status = acpi_ds_method_data_get_node(AML_ARG_OP,
+                                                             obj_desc->
+                                                             reference.offset,
+                                                             walk_state,
+                                                             (struct
+                                                              acpi_namespace_node
+                                                              **)&obj_desc->
+                                                             reference.object);
 #endif
                        break;
 
-               default: /* Other literals, etc.. */
+               default:        /* Other literals, etc.. */
 
                        if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
                                /* Node was saved in Op */
@@ -623,17 +613,15 @@ acpi_ds_init_object_from_op (
                }
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
-                       ACPI_GET_OBJECT_TYPE (obj_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unimplemented data type: %X\n",
+                                 ACPI_GET_OBJECT_TYPE(obj_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index ba13bca28bee94a27d4e26377c2abbf0b676dd7e..939d167bf87b81eda9041c995950ae5674c11352 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsopcode")
+ACPI_MODULE_NAME("dsopcode")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ds_execute_arguments (
-       struct acpi_namespace_node      *node,
-       struct acpi_namespace_node      *scope_node,
-       u32                             aml_length,
-       u8                              *aml_start);
+acpi_ds_execute_arguments(struct acpi_namespace_node *node,
+                         struct acpi_namespace_node *scope_node,
+                         u32 aml_length, u8 * aml_start);
 
 static acpi_status
-acpi_ds_init_buffer_field (
-       u16                             aml_opcode,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *buffer_desc,
-       union acpi_operand_object       *offset_desc,
-       union acpi_operand_object       *length_desc,
-       union acpi_operand_object       *result_desc);
-
+acpi_ds_init_buffer_field(u16 aml_opcode,
+                         union acpi_operand_object *obj_desc,
+                         union acpi_operand_object *buffer_desc,
+                         union acpi_operand_object *offset_desc,
+                         union acpi_operand_object *length_desc,
+                         union acpi_operand_object *result_desc);
 
 /*******************************************************************************
  *
@@ -89,26 +83,22 @@ acpi_ds_init_buffer_field (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_execute_arguments (
-       struct acpi_namespace_node      *node,
-       struct acpi_namespace_node      *scope_node,
-       u32                             aml_length,
-       u8                              *aml_start)
+acpi_ds_execute_arguments(struct acpi_namespace_node *node,
+                         struct acpi_namespace_node *scope_node,
+                         u32 aml_length, u8 * aml_start)
 {
-       acpi_status                     status;
-       union acpi_parse_object         *op;
-       struct acpi_walk_state          *walk_state;
-
-
-       ACPI_FUNCTION_TRACE ("ds_execute_arguments");
+       acpi_status status;
+       union acpi_parse_object *op;
+       struct acpi_walk_state *walk_state;
 
+       ACPI_FUNCTION_TRACE("ds_execute_arguments");
 
        /*
         * Allocate a new parser op to be the root of the parsed tree
         */
-       op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
+       op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP);
        if (!op) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Save the Node for use in acpi_ps_parse_aml */
@@ -117,16 +107,17 @@ acpi_ds_execute_arguments (
 
        /* Create and initialize a new parser state */
 
-       walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
+       walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
-       status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
-                         aml_length, NULL, 1);
-       if (ACPI_FAILURE (status)) {
-               acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+       status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
+                                      aml_length, NULL, 1);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               goto cleanup;
        }
 
        /* Mark this parse as a deferred opcode */
@@ -136,50 +127,51 @@ acpi_ds_execute_arguments (
 
        /* Pass1: Parse the entire declaration */
 
-       status = acpi_ps_parse_aml (walk_state);
-       if (ACPI_FAILURE (status)) {
-               acpi_ps_delete_parse_tree (op);
-               return_ACPI_STATUS (status);
+       status = acpi_ps_parse_aml(walk_state);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
        }
 
        /* Get and init the Op created above */
 
        op->common.node = node;
-       acpi_ps_delete_parse_tree (op);
+       acpi_ps_delete_parse_tree(op);
 
        /* Evaluate the deferred arguments */
 
-       op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP);
+       op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP);
        if (!op) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        op->common.node = scope_node;
 
        /* Create and initialize a new parser state */
 
-       walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
+       walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL);
        if (!walk_state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
        /* Execute the opcode and arguments */
 
-       status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
-                         aml_length, NULL, 3);
-       if (ACPI_FAILURE (status)) {
-               acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+       status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start,
+                                      aml_length, NULL, 3);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               goto cleanup;
        }
 
        /* Mark this execution as a deferred opcode */
 
        walk_state->deferred_node = node;
-       status = acpi_ps_parse_aml (walk_state);
-       acpi_ps_delete_parse_tree (op);
-       return_ACPI_STATUS (status);
-}
+       status = acpi_ps_parse_aml(walk_state);
 
+      cleanup:
+       acpi_ps_delete_parse_tree(op);
+       return_ACPI_STATUS(status);
+}
 
 /*******************************************************************************
  *
@@ -195,38 +187,36 @@ acpi_ds_execute_arguments (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_get_buffer_field_arguments (
-       union acpi_operand_object       *obj_desc)
+acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
 {
-       union acpi_operand_object       *extra_desc;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_field_arguments", obj_desc);
+       union acpi_operand_object *extra_desc;
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Get the AML pointer (method object) and buffer_field node */
 
-       extra_desc = acpi_ns_get_secondary_object (obj_desc);
+       extra_desc = acpi_ns_get_secondary_object(obj_desc);
        node = obj_desc->buffer_field.node;
 
-       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL));
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
-               acpi_ut_get_node_name (node)));
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                       (ACPI_TYPE_BUFFER_FIELD, node, NULL));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
+                         acpi_ut_get_node_name(node)));
 
        /* Execute the AML code for the term_arg arguments */
 
-       status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
-                        extra_desc->extra.aml_length, extra_desc->extra.aml_start);
-       return_ACPI_STATUS (status);
+       status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
+                                          extra_desc->extra.aml_length,
+                                          extra_desc->extra.aml_start);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_buffer_arguments
@@ -240,40 +230,35 @@ acpi_ds_get_buffer_field_arguments (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_get_buffer_arguments (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_arguments", obj_desc);
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Get the Buffer node */
 
        node = obj_desc->buffer.node;
        if (!node) {
-               ACPI_REPORT_ERROR ((
-                               "No pointer back to NS node in buffer obj %p\n", obj_desc));
-               return_ACPI_STATUS (AE_AML_INTERNAL);
+               ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc));
+               return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n"));
 
        /* Execute the AML code for the term_arg arguments */
 
-       status = acpi_ds_execute_arguments (node, node,
-                        obj_desc->buffer.aml_length, obj_desc->buffer.aml_start);
-       return_ACPI_STATUS (status);
+       status = acpi_ds_execute_arguments(node, node,
+                                          obj_desc->buffer.aml_length,
+                                          obj_desc->buffer.aml_start);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_package_arguments
@@ -287,40 +272,36 @@ acpi_ds_get_buffer_arguments (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_get_package_arguments (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_package_arguments", obj_desc);
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc);
 
        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Get the Package node */
 
        node = obj_desc->package.node;
        if (!node) {
-               ACPI_REPORT_ERROR ((
-                               "No pointer back to NS node in package %p\n", obj_desc));
-               return_ACPI_STATUS (AE_AML_INTERNAL);
+               ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n",
+                                  obj_desc));
+               return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Arg Init\n"));
 
        /* Execute the AML code for the term_arg arguments */
 
-       status = acpi_ds_execute_arguments (node, node,
-                        obj_desc->package.aml_length, obj_desc->package.aml_start);
-       return_ACPI_STATUS (status);
+       status = acpi_ds_execute_arguments(node, node,
+                                          obj_desc->package.aml_length,
+                                          obj_desc->package.aml_start);
+       return_ACPI_STATUS(status);
 }
 
-
 /*****************************************************************************
  *
  * FUNCTION:    acpi_ds_get_region_arguments
@@ -334,44 +315,43 @@ acpi_ds_get_package_arguments (
  *
  ****************************************************************************/
 
-acpi_status
-acpi_ds_get_region_arguments (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       union acpi_operand_object       *extra_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_region_arguments", obj_desc);
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       union acpi_operand_object *extra_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc);
 
        if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
-       extra_desc = acpi_ns_get_secondary_object (obj_desc);
+       extra_desc = acpi_ns_get_secondary_object(obj_desc);
        if (!extra_desc) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Get the Region node */
 
        node = obj_desc->region.node;
 
-       ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL));
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                       (ACPI_TYPE_REGION, node, NULL));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n",
-               acpi_ut_get_node_name (node), extra_desc->extra.aml_start));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "[%4.4s] op_region Arg Init at AML %p\n",
+                         acpi_ut_get_node_name(node),
+                         extra_desc->extra.aml_start));
 
        /* Execute the argument AML */
 
-       status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node),
-                        extra_desc->extra.aml_length, extra_desc->extra.aml_start);
-       return_ACPI_STATUS (status);
+       status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
+                                          extra_desc->extra.aml_length,
+                                          extra_desc->extra.aml_start);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_initialize_region
@@ -384,23 +364,19 @@ acpi_ds_get_region_arguments (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_initialize_region (
-       acpi_handle                     obj_handle)
+acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
-
-       obj_desc = acpi_ns_get_attached_object (obj_handle);
+       obj_desc = acpi_ns_get_attached_object(obj_handle);
 
        /* Namespace is NOT locked */
 
-       status = acpi_ev_initialize_region (obj_desc, FALSE);
+       status = acpi_ev_initialize_region(obj_desc, FALSE);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_init_buffer_field
@@ -419,30 +395,27 @@ acpi_ds_initialize_region (
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_init_buffer_field (
-       u16                             aml_opcode,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *buffer_desc,
-       union acpi_operand_object       *offset_desc,
-       union acpi_operand_object       *length_desc,
-       union acpi_operand_object       *result_desc)
+acpi_ds_init_buffer_field(u16 aml_opcode,
+                         union acpi_operand_object *obj_desc,
+                         union acpi_operand_object *buffer_desc,
+                         union acpi_operand_object *offset_desc,
+                         union acpi_operand_object *length_desc,
+                         union acpi_operand_object *result_desc)
 {
-       u32                             offset;
-       u32                             bit_offset;
-       u32                             bit_count;
-       u8                              field_flags;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_init_buffer_field", obj_desc);
+       u32 offset;
+       u32 bit_offset;
+       u32 bit_count;
+       u8 field_flags;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc);
 
        /* Host object must be a Buffer */
 
-       if (ACPI_GET_OBJECT_TYPE (buffer_desc) != ACPI_TYPE_BUFFER) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Target of Create Field is not a Buffer object - %s\n",
-                       acpi_ut_get_object_type_name (buffer_desc)));
+       if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Target of Create Field is not a Buffer object - %s\n",
+                                 acpi_ut_get_object_type_name(buffer_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -453,11 +426,11 @@ acpi_ds_init_buffer_field (
         * out as a name_string, and should therefore now be a NS node
         * after resolution in acpi_ex_resolve_operands().
         */
-       if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(%s) destination not a NS Node [%s]\n",
-                               acpi_ps_get_opcode_name (aml_opcode),
-                               acpi_ut_get_descriptor_name (result_desc)));
+       if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "(%s) destination not a NS Node [%s]\n",
+                                 acpi_ps_get_opcode_name(aml_opcode),
+                                 acpi_ut_get_descriptor_name(result_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -475,13 +448,13 @@ acpi_ds_init_buffer_field (
 
                field_flags = AML_FIELD_ACCESS_BYTE;
                bit_offset = offset;
-               bit_count  = (u32) length_desc->integer.value;
+               bit_count = (u32) length_desc->integer.value;
 
                /* Must have a valid (>0) bit count */
 
                if (bit_count == 0) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Attempt to create_field of length 0\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Attempt to create_field of length 0\n"));
                        status = AE_AML_OPERAND_VALUE;
                        goto cleanup;
                }
@@ -492,7 +465,7 @@ acpi_ds_init_buffer_field (
                /* Offset is in bits, Field is one bit */
 
                bit_offset = offset;
-               bit_count  = 1;
+               bit_count = 1;
                field_flags = AML_FIELD_ACCESS_BYTE;
                break;
 
@@ -501,7 +474,7 @@ acpi_ds_init_buffer_field (
                /* Offset is in bytes, field is one byte */
 
                bit_offset = 8 * offset;
-               bit_count  = 8;
+               bit_count = 8;
                field_flags = AML_FIELD_ACCESS_BYTE;
                break;
 
@@ -510,7 +483,7 @@ acpi_ds_init_buffer_field (
                /* Offset is in bytes, field is one word */
 
                bit_offset = 8 * offset;
-               bit_count  = 16;
+               bit_count = 16;
                field_flags = AML_FIELD_ACCESS_WORD;
                break;
 
@@ -519,7 +492,7 @@ acpi_ds_init_buffer_field (
                /* Offset is in bytes, field is one dword */
 
                bit_offset = 8 * offset;
-               bit_count  = 32;
+               bit_count = 32;
                field_flags = AML_FIELD_ACCESS_DWORD;
                break;
 
@@ -528,29 +501,29 @@ acpi_ds_init_buffer_field (
                /* Offset is in bytes, field is one qword */
 
                bit_offset = 8 * offset;
-               bit_count  = 64;
+               bit_count = 64;
                field_flags = AML_FIELD_ACCESS_QWORD;
                break;
 
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown field creation opcode %02x\n",
-                       aml_opcode));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown field creation opcode %02x\n",
+                                 aml_opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
        /* Entire field must fit within the current length of the buffer */
 
-       if ((bit_offset + bit_count) >
-               (8 * (u32) buffer_desc->buffer.length)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
-                        acpi_ut_get_node_name (result_desc),
-                        bit_offset + bit_count,
-                        acpi_ut_get_node_name (buffer_desc->buffer.node),
-                        8 * (u32) buffer_desc->buffer.length));
+       if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
+                                 acpi_ut_get_node_name(result_desc),
+                                 bit_offset + bit_count,
+                                 acpi_ut_get_node_name(buffer_desc->buffer.
+                                                       node),
+                                 8 * (u32) buffer_desc->buffer.length));
                status = AE_AML_BUFFER_LIMIT;
                goto cleanup;
        }
@@ -560,9 +533,9 @@ acpi_ds_init_buffer_field (
         * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
         * UPDATE_RULE = 0 (UPDATE_PRESERVE)
         */
-       status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
-                         bit_offset, bit_count);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_prep_common_field_object(obj_desc, field_flags, 0,
+                                                 bit_offset, bit_count);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -571,35 +544,33 @@ acpi_ds_init_buffer_field (
        /* Reference count for buffer_desc inherits obj_desc count */
 
        buffer_desc->common.reference_count = (u16)
-               (buffer_desc->common.reference_count + obj_desc->common.reference_count);
+           (buffer_desc->common.reference_count +
+            obj_desc->common.reference_count);
 
-
-cleanup:
+      cleanup:
 
        /* Always delete the operands */
 
-       acpi_ut_remove_reference (offset_desc);
-       acpi_ut_remove_reference (buffer_desc);
+       acpi_ut_remove_reference(offset_desc);
+       acpi_ut_remove_reference(buffer_desc);
 
        if (aml_opcode == AML_CREATE_FIELD_OP) {
-               acpi_ut_remove_reference (length_desc);
+               acpi_ut_remove_reference(length_desc);
        }
 
        /* On failure, delete the result descriptor */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (result_desc); /* Result descriptor */
-       }
-       else {
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(result_desc);  /* Result descriptor */
+       } else {
                /* Now the address and length are valid for this buffer_field */
 
                obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_buffer_field_operands
@@ -615,24 +586,21 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ds_eval_buffer_field_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op)
+acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
+                                  union acpi_parse_object *op)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       union acpi_parse_object         *next_op;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_eval_buffer_field_operands", op);
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       union acpi_parse_object *next_op;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op);
 
        /*
         * This is where we evaluate the address and length fields of the
         * create_xxx_field declaration
         */
-       node =  op->common.node;
+       node = op->common.node;
 
        /* next_op points to the op that holds the Buffer */
 
@@ -640,30 +608,32 @@ acpi_ds_eval_buffer_field_operands (
 
        /* Evaluate/create the address and length operands */
 
-       status = acpi_ds_create_operands (walk_state, next_op);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_create_operands(walk_state, next_op);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Resolve the operands */
 
-       status = acpi_ex_resolve_operands (op->common.aml_opcode,
-                         ACPI_WALK_OPERANDS, walk_state);
+       status = acpi_ex_resolve_operands(op->common.aml_opcode,
+                                         ACPI_WALK_OPERANDS, walk_state);
 
-       ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
-                         acpi_ps_get_opcode_name (op->common.aml_opcode),
-                         walk_state->num_operands, "after acpi_ex_resolve_operands");
+       ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+                          acpi_ps_get_opcode_name(op->common.aml_opcode),
+                          walk_state->num_operands,
+                          "after acpi_ex_resolve_operands");
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
-                       acpi_ps_get_opcode_name (op->common.aml_opcode), status));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+                                 acpi_ps_get_opcode_name(op->common.
+                                                         aml_opcode), status));
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Initialize the Buffer Field */
@@ -671,22 +641,25 @@ acpi_ds_eval_buffer_field_operands (
        if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
                /* NOTE: Slightly different operands for this opcode */
 
-               status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
-                                walk_state->operands[0], walk_state->operands[1],
-                                walk_state->operands[2], walk_state->operands[3]);
-       }
-       else {
+               status =
+                   acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
+                                             walk_state->operands[0],
+                                             walk_state->operands[1],
+                                             walk_state->operands[2],
+                                             walk_state->operands[3]);
+       } else {
                /* All other, create_xxx_field opcodes */
 
-               status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
-                                walk_state->operands[0], walk_state->operands[1],
-                                                 NULL, walk_state->operands[2]);
+               status =
+                   acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
+                                             walk_state->operands[0],
+                                             walk_state->operands[1], NULL,
+                                             walk_state->operands[2]);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_region_operands
@@ -702,25 +675,22 @@ acpi_ds_eval_buffer_field_operands (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_eval_region_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op)
+acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
+                            union acpi_parse_object *op)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *operand_desc;
-       struct acpi_namespace_node      *node;
-       union acpi_parse_object         *next_op;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_eval_region_operands", op);
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *operand_desc;
+       struct acpi_namespace_node *node;
+       union acpi_parse_object *next_op;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op);
 
        /*
         * This is where we evaluate the address and length fields of the
         * op_region declaration
         */
-       node =  op->common.node;
+       node = op->common.node;
 
        /* next_op points to the op that holds the space_iD */
 
@@ -732,26 +702,26 @@ acpi_ds_eval_region_operands (
 
        /* Evaluate/create the address and length operands */
 
-       status = acpi_ds_create_operands (walk_state, next_op);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_create_operands(walk_state, next_op);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Resolve the length and address operands to numbers */
 
-       status = acpi_ex_resolve_operands (op->common.aml_opcode,
-                        ACPI_WALK_OPERANDS, walk_state);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_resolve_operands(op->common.aml_opcode,
+                                         ACPI_WALK_OPERANDS, walk_state);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
-                         acpi_ps_get_opcode_name (op->common.aml_opcode),
-                         1, "after acpi_ex_resolve_operands");
+       ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+                          acpi_ps_get_opcode_name(op->common.aml_opcode),
+                          1, "after acpi_ex_resolve_operands");
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /*
@@ -761,7 +731,7 @@ acpi_ds_eval_region_operands (
        operand_desc = walk_state->operands[walk_state->num_operands - 1];
 
        obj_desc->region.length = (u32) operand_desc->integer.value;
-       acpi_ut_remove_reference (operand_desc);
+       acpi_ut_remove_reference(operand_desc);
 
        /*
         * Get the address and save it
@@ -770,22 +740,21 @@ acpi_ds_eval_region_operands (
        operand_desc = walk_state->operands[walk_state->num_operands - 2];
 
        obj_desc->region.address = (acpi_physical_address)
-                         operand_desc->integer.value;
-       acpi_ut_remove_reference (operand_desc);
+           operand_desc->integer.value;
+       acpi_ut_remove_reference(operand_desc);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
-               obj_desc,
-               ACPI_FORMAT_UINT64 (obj_desc->region.address),
-               obj_desc->region.length));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
+                         obj_desc,
+                         ACPI_FORMAT_UINT64(obj_desc->region.address),
+                         obj_desc->region.length));
 
        /* Now the address and length are valid for this opregion */
 
        obj_desc->region.flags |= AOPOBJ_DATA_VALID;
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_eval_data_object_operands
@@ -802,46 +771,44 @@ acpi_ds_eval_region_operands (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_eval_data_object_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       union acpi_operand_object       *obj_desc)
+acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
+                                 union acpi_parse_object *op,
+                                 union acpi_operand_object *obj_desc)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *arg_desc;
-       u32                             length;
-
-
-       ACPI_FUNCTION_TRACE ("ds_eval_data_object_operands");
+       acpi_status status;
+       union acpi_operand_object *arg_desc;
+       u32 length;
 
+       ACPI_FUNCTION_TRACE("ds_eval_data_object_operands");
 
        /* The first operand (for all of these data objects) is the length */
 
-       status = acpi_ds_create_operand (walk_state, op->common.value.arg, 1);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ex_resolve_operands (walk_state->opcode,
-                         &(walk_state->operands [walk_state->num_operands -1]),
-                         walk_state);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_resolve_operands(walk_state->opcode,
+                                         &(walk_state->
+                                           operands[walk_state->num_operands -
+                                                    1]), walk_state);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Extract length operand */
 
-       arg_desc = walk_state->operands [walk_state->num_operands - 1];
+       arg_desc = walk_state->operands[walk_state->num_operands - 1];
        length = (u32) arg_desc->integer.value;
 
        /* Cleanup for length operand */
 
-       status = acpi_ds_obj_stack_pop (1, walk_state);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_obj_stack_pop(1, walk_state);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       acpi_ut_remove_reference (arg_desc);
+       acpi_ut_remove_reference(arg_desc);
 
        /*
         * Create the actual data object
@@ -849,37 +816,42 @@ acpi_ds_eval_data_object_operands (
        switch (op->common.aml_opcode) {
        case AML_BUFFER_OP:
 
-               status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
+               status =
+                   acpi_ds_build_internal_buffer_obj(walk_state, op, length,
+                                                     &obj_desc);
                break;
 
        case AML_PACKAGE_OP:
        case AML_VAR_PACKAGE_OP:
 
-               status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc);
+               status =
+                   acpi_ds_build_internal_package_obj(walk_state, op, length,
+                                                      &obj_desc);
                break;
 
        default:
-               return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+               return_ACPI_STATUS(AE_AML_BAD_OPCODE);
        }
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                /*
                 * Return the object in the walk_state, unless the parent is a package -
                 * in this case, the return object will be stored in the parse tree
                 * for the package.
                 */
                if ((!op->common.parent) ||
-                       ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
-                        (op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) &&
-                        (op->common.parent->common.aml_opcode != AML_NAME_OP))) {
+                   ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
+                    (op->common.parent->common.aml_opcode !=
+                     AML_VAR_PACKAGE_OP)
+                    && (op->common.parent->common.aml_opcode !=
+                        AML_NAME_OP))) {
                        walk_state->result_obj = obj_desc;
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_begin_control_op
@@ -895,19 +867,16 @@ acpi_ds_eval_data_object_operands (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_exec_begin_control_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op)
+acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
+                             union acpi_parse_object *op)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_generic_state        *control_state;
-
+       acpi_status status = AE_OK;
+       union acpi_generic_state *control_state;
 
-       ACPI_FUNCTION_NAME ("ds_exec_begin_control_op");
+       ACPI_FUNCTION_NAME("ds_exec_begin_control_op");
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
-               op->common.aml_opcode, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
+                         op->common.aml_opcode, walk_state));
 
        switch (op->common.aml_opcode) {
        case AML_IF_OP:
@@ -918,7 +887,7 @@ acpi_ds_exec_begin_control_op (
                 * constructs. We need to manage these as a stack, in order
                 * to handle nesting.
                 */
-               control_state = acpi_ut_create_control_state ();
+               control_state = acpi_ut_create_control_state();
                if (!control_state) {
                        status = AE_NO_MEMORY;
                        break;
@@ -927,14 +896,16 @@ acpi_ds_exec_begin_control_op (
                 * Save a pointer to the predicate for multiple executions
                 * of a loop
                 */
-               control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1;
-               control_state->control.package_end = walk_state->parser_state.pkg_end;
+               control_state->control.aml_predicate_start =
+                   walk_state->parser_state.aml - 1;
+               control_state->control.package_end =
+                   walk_state->parser_state.pkg_end;
                control_state->control.opcode = op->common.aml_opcode;
 
-
                /* Push the control state on this walk's control stack */
 
-               acpi_ut_push_generic_state (&walk_state->control_state, control_state);
+               acpi_ut_push_generic_state(&walk_state->control_state,
+                                          control_state);
                break;
 
        case AML_ELSE_OP:
@@ -959,7 +930,6 @@ acpi_ds_exec_begin_control_op (
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_end_control_op
@@ -975,46 +945,42 @@ acpi_ds_exec_begin_control_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_exec_end_control_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op)
+acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
+                           union acpi_parse_object * op)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_generic_state        *control_state;
-
-
-       ACPI_FUNCTION_NAME ("ds_exec_end_control_op");
+       acpi_status status = AE_OK;
+       union acpi_generic_state *control_state;
 
+       ACPI_FUNCTION_NAME("ds_exec_end_control_op");
 
        switch (op->common.aml_opcode) {
        case AML_IF_OP:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op));
 
                /*
                 * Save the result of the predicate in case there is an
                 * ELSE to come
                 */
                walk_state->last_predicate =
-                       (u8) walk_state->control_state->common.value;
+                   (u8) walk_state->control_state->common.value;
 
                /*
                 * Pop the control state that was created at the start
                 * of the IF and free it
                 */
-               control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
-               acpi_ut_delete_generic_state (control_state);
+               control_state =
+                   acpi_ut_pop_generic_state(&walk_state->control_state);
+               acpi_ut_delete_generic_state(control_state);
                break;
 
-
        case AML_ELSE_OP:
 
                break;
 
-
        case AML_WHILE_OP:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
 
                if (walk_state->control_state->common.value) {
                        /* Predicate was true, go back and evaluate it again! */
@@ -1022,22 +988,24 @@ acpi_ds_exec_end_control_op (
                        status = AE_CTRL_PENDING;
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "[WHILE_OP] termination! Op=%p\n",op));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "[WHILE_OP] termination! Op=%p\n", op));
 
                /* Pop this control state and free it */
 
-               control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
+               control_state =
+                   acpi_ut_pop_generic_state(&walk_state->control_state);
 
-               walk_state->aml_last_while = control_state->control.aml_predicate_start;
-               acpi_ut_delete_generic_state (control_state);
+               walk_state->aml_last_while =
+                   control_state->control.aml_predicate_start;
+               acpi_ut_delete_generic_state(control_state);
                break;
 
-
        case AML_RETURN_OP:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "[RETURN_OP] Op=%p Arg=%p\n", op,
+                                 op->common.value.arg));
 
                /*
                 * One optional operand -- the return value
@@ -1047,12 +1015,14 @@ acpi_ds_exec_end_control_op (
                if (op->common.value.arg) {
                        /* Since we have a real Return(), delete any implicit return */
 
-                       acpi_ds_clear_implicit_return (walk_state);
+                       acpi_ds_clear_implicit_return(walk_state);
 
                        /* Return statement has an immediate operand */
 
-                       status = acpi_ds_create_operands (walk_state, op->common.value.arg);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ds_create_operands(walk_state,
+                                                   op->common.value.arg);
+                       if (ACPI_FAILURE(status)) {
                                return (status);
                        }
 
@@ -1061,8 +1031,10 @@ acpi_ds_exec_end_control_op (
                         * an arg or local), resolve it now because it may
                         * cease to exist at the end of the method.
                         */
-                       status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ex_resolve_to_value(&walk_state->operands[0],
+                                                    walk_state);
+                       if (ACPI_FAILURE(status)) {
                                return (status);
                        }
 
@@ -1072,12 +1044,11 @@ acpi_ds_exec_end_control_op (
                         * is set to anything other than zero!
                         */
                        walk_state->return_desc = walk_state->operands[0];
-               }
-               else if ((walk_state->results) &&
-                                (walk_state->results->results.num_results > 0)) {
+               } else if ((walk_state->results) &&
+                          (walk_state->results->results.num_results > 0)) {
                        /* Since we have a real Return(), delete any implicit return */
 
-                       acpi_ds_clear_implicit_return (walk_state);
+                       acpi_ds_clear_implicit_return(walk_state);
 
                        /*
                         * The return value has come from a previous calculation.
@@ -1088,67 +1059,78 @@ acpi_ds_exec_end_control_op (
                         *
                         * Allow references created by the Index operator to return unchanged.
                         */
-                       if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) &&
-                               (ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
-                               ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
-                               status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
-                               if (ACPI_FAILURE (status)) {
+                       if ((ACPI_GET_DESCRIPTOR_TYPE
+                            (walk_state->results->results.obj_desc[0]) ==
+                            ACPI_DESC_TYPE_OPERAND)
+                           &&
+                           (ACPI_GET_OBJECT_TYPE
+                            (walk_state->results->results.obj_desc[0]) ==
+                            ACPI_TYPE_LOCAL_REFERENCE)
+                           && ((walk_state->results->results.obj_desc[0])->
+                               reference.opcode != AML_INDEX_OP)) {
+                               status =
+                                   acpi_ex_resolve_to_value(&walk_state->
+                                                            results->results.
+                                                            obj_desc[0],
+                                                            walk_state);
+                               if (ACPI_FAILURE(status)) {
                                        return (status);
                                }
                        }
 
-                       walk_state->return_desc = walk_state->results->results.obj_desc [0];
-               }
-               else {
+                       walk_state->return_desc =
+                           walk_state->results->results.obj_desc[0];
+               else {
                        /* No return operand */
 
                        if (walk_state->num_operands) {
-                               acpi_ut_remove_reference (walk_state->operands [0]);
+                               acpi_ut_remove_reference(walk_state->
+                                                        operands[0]);
                        }
 
-                       walk_state->operands [0]    = NULL;
-                       walk_state->num_operands    = 0;
-                       walk_state->return_desc     = NULL;
+                       walk_state->operands[0] = NULL;
+                       walk_state->num_operands = 0;
+                       walk_state->return_desc = NULL;
                }
 
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "Completed RETURN_OP State=%p, ret_val=%p\n",
-                       walk_state, walk_state->return_desc));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "Completed RETURN_OP State=%p, ret_val=%p\n",
+                                 walk_state, walk_state->return_desc));
 
                /* End the control method execution right now */
 
                status = AE_CTRL_TERMINATE;
                break;
 
-
        case AML_NOOP_OP:
 
                /* Just do nothing! */
                break;
 
-
        case AML_BREAK_POINT_OP:
 
                /* Call up to the OS service layer to handle this */
 
-               status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
+               status =
+                   acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,
+                                  "Executed AML Breakpoint opcode");
 
                /* If and when it returns, all done. */
 
                break;
 
-
        case AML_BREAK_OP:
-       case AML_CONTINUE_OP: /* ACPI 2.0 */
-
+       case AML_CONTINUE_OP:   /* ACPI 2.0 */
 
                /* Pop and delete control states until we find a while */
 
                while (walk_state->control_state &&
-                               (walk_state->control_state->control.opcode != AML_WHILE_OP)) {
-                       control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
-                       acpi_ut_delete_generic_state (control_state);
+                      (walk_state->control_state->control.opcode !=
+                       AML_WHILE_OP)) {
+                       control_state =
+                           acpi_ut_pop_generic_state(&walk_state->
+                                                     control_state);
+                       acpi_ut_delete_generic_state(control_state);
                }
 
                /* No while found? */
@@ -1159,23 +1141,23 @@ acpi_ds_exec_end_control_op (
 
                /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */
 
-               walk_state->aml_last_while = walk_state->control_state->control.package_end;
+               walk_state->aml_last_while =
+                   walk_state->control_state->control.package_end;
 
                /* Return status depending on opcode */
 
                if (op->common.aml_opcode == AML_BREAK_OP) {
                        status = AE_CTRL_BREAK;
-               }
-               else {
+               } else {
                        status = AE_CTRL_CONTINUE;
                }
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
-                       op->common.aml_opcode, op));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown control opcode=%X Op=%p\n",
+                                 op->common.aml_opcode, op));
 
                status = AE_AML_BAD_OPCODE;
                break;
@@ -1183,4 +1165,3 @@ acpi_ds_exec_end_control_op (
 
        return (status);
 }
-
index 9613349ac31d1cdec063a1f1e1b120c354dc610d..83ae1c1aa28668ff8b931ac4e0837233b9a7901e 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
@@ -51,8 +50,7 @@
 #include <acpi/acdebug.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dsutils")
-
+ACPI_MODULE_NAME("dsutils")
 
 /*******************************************************************************
  *
  *              parent method exits.)
  *
  ******************************************************************************/
-
-void
-acpi_ds_clear_implicit_return (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
 {
-       ACPI_FUNCTION_NAME ("ds_clear_implicit_return");
-
+       ACPI_FUNCTION_NAME("ds_clear_implicit_return");
 
        /*
         * Slack must be enabled for this feature
@@ -89,16 +83,15 @@ acpi_ds_clear_implicit_return (
                 * complex statements, the implicit return value can be
                 * bubbled up several levels.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "Removing reference on stale implicit return obj %p\n",
-                       walk_state->implicit_return_obj));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "Removing reference on stale implicit return obj %p\n",
+                                 walk_state->implicit_return_obj));
 
-               acpi_ut_remove_reference (walk_state->implicit_return_obj);
+               acpi_ut_remove_reference(walk_state->implicit_return_obj);
                walk_state->implicit_return_obj = NULL;
        }
 }
 
-
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
  *
@@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return (
  ******************************************************************************/
 
 u8
-acpi_ds_do_implicit_return (
-       union acpi_operand_object       *return_desc,
-       struct acpi_walk_state          *walk_state,
-       u8                              add_reference)
+acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
+                          struct acpi_walk_state *walk_state, u8 add_reference)
 {
-       ACPI_FUNCTION_NAME ("ds_do_implicit_return");
-
+       ACPI_FUNCTION_NAME("ds_do_implicit_return");
 
        /*
         * Slack must be enabled for this feature, and we must
         * have a valid return object
         */
-       if ((!acpi_gbl_enable_interpreter_slack) ||
-               (!return_desc)) {
+       if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) {
                return (FALSE);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "Result %p will be implicitly returned; Prev=%p\n",
-                       return_desc,
-                       walk_state->implicit_return_obj));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Result %p will be implicitly returned; Prev=%p\n",
+                         return_desc, walk_state->implicit_return_obj));
 
        /*
         * Delete any "stale" implicit return value first. However, in
@@ -151,20 +139,19 @@ acpi_ds_do_implicit_return (
                if (walk_state->implicit_return_obj == return_desc) {
                        return (TRUE);
                }
-               acpi_ds_clear_implicit_return (walk_state);
+               acpi_ds_clear_implicit_return(walk_state);
        }
 
        /* Save the implicit return value, add a reference if requested */
 
        walk_state->implicit_return_obj = return_desc;
        if (add_reference) {
-               acpi_ut_add_reference (return_desc);
+               acpi_ut_add_reference(return_desc);
        }
 
        return (TRUE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_is_result_used
@@ -179,20 +166,18 @@ acpi_ds_do_implicit_return (
  ******************************************************************************/
 
 u8
-acpi_ds_is_result_used (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_is_result_used(union acpi_parse_object * op,
+                      struct acpi_walk_state * walk_state)
 {
-       const struct acpi_opcode_info   *parent_info;
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op);
+       const struct acpi_opcode_info *parent_info;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
 
        /* Must have both an Op and a Result Object */
 
        if (!op) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
-               return_VALUE (TRUE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
+               return_VALUE(TRUE);
        }
 
        /*
@@ -204,7 +189,8 @@ acpi_ds_is_result_used (
         * NOTE: this is optional because the ASL language does not actually
         * support this behavior.
         */
-       (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
+       (void)acpi_ds_do_implicit_return(walk_state->result_obj, walk_state,
+                                        TRUE);
 
        /*
         * Now determine if the parent will use the result
@@ -215,22 +201,24 @@ acpi_ds_is_result_used (
         * via execute_control_method has a scope_op as the parent.
         */
        if ((!op->common.parent) ||
-               (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
+           (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
                /* No parent, the return value cannot possibly be used */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "At Method level, result of [%s] not used\n",
-                       acpi_ps_get_opcode_name (op->common.aml_opcode)));
-               return_VALUE (FALSE);
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "At Method level, result of [%s] not used\n",
+                                 acpi_ps_get_opcode_name(op->common.
+                                                         aml_opcode)));
+               return_VALUE(FALSE);
        }
 
        /* Get info on the parent. The root_op is AML_SCOPE */
 
-       parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
+       parent_info =
+           acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
        if (parent_info->class == AML_CLASS_UNKNOWN) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown parent opcode. Op=%p\n", op));
-               return_VALUE (FALSE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown parent opcode. Op=%p\n", op));
+               return_VALUE(FALSE);
        }
 
        /*
@@ -256,8 +244,10 @@ acpi_ds_is_result_used (
                         * If we are executing the predicate AND this is the predicate op,
                         * we will use the return value
                         */
-                       if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
-                               (walk_state->control_state->control.predicate_op == op)) {
+                       if ((walk_state->control_state->common.state ==
+                            ACPI_CONTROL_PREDICATE_EXECUTING)
+                           && (walk_state->control_state->control.
+                               predicate_op == op)) {
                                goto result_used;
                        }
                        break;
@@ -271,7 +261,6 @@ acpi_ds_is_result_used (
 
                goto result_not_used;
 
-
        case AML_CLASS_CREATE:
 
                /*
@@ -280,15 +269,16 @@ acpi_ds_is_result_used (
                 */
                goto result_used;
 
-
        case AML_CLASS_NAMED_OBJECT:
 
-               if ((op->common.parent->common.aml_opcode == AML_REGION_OP)      ||
-                       (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
-                       (op->common.parent->common.aml_opcode == AML_PACKAGE_OP)     ||
-                       (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
-                       (op->common.parent->common.aml_opcode == AML_BUFFER_OP)      ||
-                       (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
+               if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
+                   (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP)
+                   || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP)
+                   || (op->common.parent->common.aml_opcode ==
+                       AML_VAR_PACKAGE_OP)
+                   || (op->common.parent->common.aml_opcode == AML_BUFFER_OP)
+                   || (op->common.parent->common.aml_opcode ==
+                       AML_INT_EVAL_SUBTREE_OP)) {
                        /*
                         * These opcodes allow term_arg(s) as operands and therefore
                         * the operands can be method calls.  The result is used.
@@ -298,7 +288,6 @@ acpi_ds_is_result_used (
 
                goto result_not_used;
 
-
        default:
 
                /*
@@ -308,26 +297,25 @@ acpi_ds_is_result_used (
                goto result_used;
        }
 
+      result_used:
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Result of [%s] used by Parent [%s] Op=%p\n",
+                         acpi_ps_get_opcode_name(op->common.aml_opcode),
+                         acpi_ps_get_opcode_name(op->common.parent->common.
+                                                 aml_opcode), op));
 
-result_used:
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "Result of [%s] used by Parent [%s] Op=%p\n",
-               acpi_ps_get_opcode_name (op->common.aml_opcode),
-               acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
-
-       return_VALUE (TRUE);
-
+       return_VALUE(TRUE);
 
-result_not_used:
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "Result of [%s] not used by Parent [%s] Op=%p\n",
-               acpi_ps_get_opcode_name (op->common.aml_opcode),
-               acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
+      result_not_used:
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Result of [%s] not used by Parent [%s] Op=%p\n",
+                         acpi_ps_get_opcode_name(op->common.aml_opcode),
+                         acpi_ps_get_opcode_name(op->common.parent->common.
+                                                 aml_opcode), op));
 
-       return_VALUE (FALSE);
+       return_VALUE(FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_delete_result_if_not_used
@@ -346,20 +334,17 @@ result_not_used:
  ******************************************************************************/
 
 void
-acpi_ds_delete_result_if_not_used (
-       union acpi_parse_object         *op,
-       union acpi_operand_object       *result_obj,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
+                                 union acpi_operand_object *result_obj,
+                                 struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj);
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
 
        if (!op) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
                return_VOID;
        }
 
@@ -367,19 +352,18 @@ acpi_ds_delete_result_if_not_used (
                return_VOID;
        }
 
-       if (!acpi_ds_is_result_used (op, walk_state)) {
+       if (!acpi_ds_is_result_used(op, walk_state)) {
                /* Must pop the result stack (obj_desc should be equal to result_obj) */
 
-               status = acpi_ds_result_pop (&obj_desc, walk_state);
-               if (ACPI_SUCCESS (status)) {
-                       acpi_ut_remove_reference (result_obj);
+               status = acpi_ds_result_pop(&obj_desc, walk_state);
+               if (ACPI_SUCCESS(status)) {
+                       acpi_ut_remove_reference(result_obj);
                }
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_resolve_operands
@@ -394,16 +378,12 @@ acpi_ds_delete_result_if_not_used (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_resolve_operands (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
 {
-       u32                             i;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state);
+       u32 i;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
 
        /*
         * Attempt to resolve each of the valid operands
@@ -411,16 +391,17 @@ acpi_ds_resolve_operands (
         * that the actual objects are passed, not copies of the objects.
         */
        for (i = 0; i < walk_state->num_operands; i++) {
-               status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_resolve_to_value(&walk_state->operands[i],
+                                            walk_state);
+               if (ACPI_FAILURE(status)) {
                        break;
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_clear_operands
@@ -433,15 +414,11 @@ acpi_ds_resolve_operands (
  *
  ******************************************************************************/
 
-void
-acpi_ds_clear_operands (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
 {
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state);
+       u32 i;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
 
        /* Remove a reference on each operand on the stack */
 
@@ -450,7 +427,7 @@ acpi_ds_clear_operands (
                 * Remove a reference to all operands, including both
                 * "Arguments" and "Targets".
                 */
-               acpi_ut_remove_reference (walk_state->operands[i]);
+               acpi_ut_remove_reference(walk_state->operands[i]);
                walk_state->operands[i] = NULL;
        }
 
@@ -459,7 +436,6 @@ acpi_ds_clear_operands (
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_operand
@@ -478,37 +454,36 @@ acpi_ds_clear_operands (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_operand (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *arg,
-       u32                             arg_index)
+acpi_ds_create_operand(struct acpi_walk_state *walk_state,
+                      union acpi_parse_object *arg, u32 arg_index)
 {
-       acpi_status                     status = AE_OK;
-       char                            *name_string;
-       u32                             name_length;
-       union acpi_operand_object       *obj_desc;
-       union acpi_parse_object         *parent_op;
-       u16                             opcode;
-       acpi_interpreter_mode           interpreter_mode;
-       const struct acpi_opcode_info   *op_info;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg);
+       acpi_status status = AE_OK;
+       char *name_string;
+       u32 name_length;
+       union acpi_operand_object *obj_desc;
+       union acpi_parse_object *parent_op;
+       u16 opcode;
+       acpi_interpreter_mode interpreter_mode;
+       const struct acpi_opcode_info *op_info;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
 
        /* A valid name must be looked up in the namespace */
 
        if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
-               (arg->common.value.string)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
+           (arg->common.value.string)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n",
+                                 arg));
 
                /* Get the entire name string from the AML stream */
 
-               status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
-                                 &name_string, &name_length);
+               status =
+                   acpi_ex_get_name_string(ACPI_TYPE_ANY,
+                                           arg->common.value.buffer,
+                                           &name_string, &name_length);
 
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* All prefixes have been handled, and the name is in name_string */
@@ -523,13 +498,14 @@ acpi_ds_create_operand (
                 * actual opcode exists.
                 */
                if ((walk_state->deferred_node) &&
-                       (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
-                       (arg_index != 0)) {
-                       obj_desc = ACPI_CAST_PTR (
-                                        union acpi_operand_object, walk_state->deferred_node);
+                   (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
+                   && (arg_index != 0)) {
+                       obj_desc =
+                           ACPI_CAST_PTR(union acpi_operand_object,
+                                         walk_state->deferred_node);
                        status = AE_OK;
-               }
-               else    /* All other opcodes */ {
+               } else {        /* All other opcodes */
+
                        /*
                         * Differentiate between a namespace "create" operation
                         * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
@@ -537,43 +513,51 @@ acpi_ds_create_operand (
                         * namespace objects during the execution of control methods.
                         */
                        parent_op = arg->common.parent;
-                       op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
-                       if ((op_info->flags & AML_NSNODE) &&
-                               (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
-                               (parent_op->common.aml_opcode != AML_REGION_OP) &&
-                               (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
+                       op_info =
+                           acpi_ps_get_opcode_info(parent_op->common.
+                                                   aml_opcode);
+                       if ((op_info->flags & AML_NSNODE)
+                           && (parent_op->common.aml_opcode !=
+                               AML_INT_METHODCALL_OP)
+                           && (parent_op->common.aml_opcode != AML_REGION_OP)
+                           && (parent_op->common.aml_opcode !=
+                               AML_INT_NAMEPATH_OP)) {
                                /* Enter name into namespace if not found */
 
                                interpreter_mode = ACPI_IMODE_LOAD_PASS2;
-                       }
-                       else {
+                       } else {
                                /* Return a failure if name not found */
 
                                interpreter_mode = ACPI_IMODE_EXECUTE;
                        }
 
-                       status = acpi_ns_lookup (walk_state->scope_info, name_string,
-                                        ACPI_TYPE_ANY, interpreter_mode,
-                                        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                                        walk_state,
-                                        ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc));
+                       status =
+                           acpi_ns_lookup(walk_state->scope_info, name_string,
+                                          ACPI_TYPE_ANY, interpreter_mode,
+                                          ACPI_NS_SEARCH_PARENT |
+                                          ACPI_NS_DONT_OPEN_SCOPE, walk_state,
+                                          ACPI_CAST_INDIRECT_PTR(struct
+                                                                 acpi_namespace_node,
+                                                                 &obj_desc));
                        /*
                         * The only case where we pass through (ignore) a NOT_FOUND
                         * error is for the cond_ref_of opcode.
                         */
                        if (status == AE_NOT_FOUND) {
-                               if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
+                               if (parent_op->common.aml_opcode ==
+                                   AML_COND_REF_OF_OP) {
                                        /*
                                         * For the Conditional Reference op, it's OK if
                                         * the name is not found;  We just need a way to
                                         * indicate this to the interpreter, set the
                                         * object to the root
                                         */
-                                       obj_desc = ACPI_CAST_PTR (
-                                                        union acpi_operand_object, acpi_gbl_root_node);
+                                       obj_desc =
+                                           ACPI_CAST_PTR(union
+                                                         acpi_operand_object,
+                                                         acpi_gbl_root_node);
                                        status = AE_OK;
-                               }
-                               else {
+                               } else {
                                        /*
                                         * We just plain didn't find it -- which is a
                                         * very serious error at this point
@@ -582,30 +566,30 @@ acpi_ds_create_operand (
                                }
                        }
 
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_NSERROR (name_string, status);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_NSERROR(name_string, status);
                        }
                }
 
                /* Free the namestring created above */
 
-               ACPI_MEM_FREE (name_string);
+               ACPI_MEM_FREE(name_string);
 
                /* Check status from the lookup */
 
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Put the resulting object onto the current object stack */
 
-               status = acpi_ds_obj_stack_push (obj_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_obj_stack_push(obj_desc, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
-               ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
-       }
-       else {
+               ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+                                  (obj_desc, walk_state));
+       else {
                /* Check for null name case */
 
                if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -615,77 +599,83 @@ acpi_ds_create_operand (
                         * in the original ASL.  Create a Zero Constant for a
                         * placeholder.  (Store to a constant is a Noop.)
                         */
-                       opcode = AML_ZERO_OP;       /* Has no arguments! */
+                       opcode = AML_ZERO_OP;   /* Has no arguments! */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                               "Null namepath: Arg=%p\n", arg));
-               }
-               else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "Null namepath: Arg=%p\n", arg));
+               } else {
                        opcode = arg->common.aml_opcode;
                }
 
                /* Get the object type of the argument */
 
-               op_info = acpi_ps_get_opcode_info (opcode);
+               op_info = acpi_ps_get_opcode_info(opcode);
                if (op_info->object_type == ACPI_TYPE_INVALID) {
-                       return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+                       return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
                }
 
                if (op_info->flags & AML_HAS_RETVAL) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                               "Argument previously created, already stacked \n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "Argument previously created, already stacked \n"));
 
-                       ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
-                               walk_state->operands [walk_state->num_operands - 1], walk_state));
+                       ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+                                          (walk_state->
+                                           operands[walk_state->num_operands -
+                                                    1], walk_state));
 
                        /*
                         * Use value that was already previously returned
                         * by the evaluation of this argument
                         */
-                       status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ds_result_pop_from_bottom(&obj_desc,
+                                                          walk_state);
+                       if (ACPI_FAILURE(status)) {
                                /*
                                 * Only error is underflow, and this indicates
                                 * a missing or null operand!
                                 */
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Missing or null operand, %s\n",
-                                       acpi_format_exception (status)));
-                               return_ACPI_STATUS (status);
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Missing or null operand, %s\n",
+                                                 acpi_format_exception
+                                                 (status)));
+                               return_ACPI_STATUS(status);
                        }
-               }
-               else {
+               } else {
                        /* Create an ACPI_INTERNAL_OBJECT for the argument */
 
-                       obj_desc = acpi_ut_create_internal_object (op_info->object_type);
+                       obj_desc =
+                           acpi_ut_create_internal_object(op_info->
+                                                          object_type);
                        if (!obj_desc) {
-                               return_ACPI_STATUS (AE_NO_MEMORY);
+                               return_ACPI_STATUS(AE_NO_MEMORY);
                        }
 
                        /* Initialize the new object */
 
-                       status = acpi_ds_init_object_from_op (
-                                        walk_state, arg, opcode, &obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               acpi_ut_delete_object_desc (obj_desc);
-                               return_ACPI_STATUS (status);
+                       status =
+                           acpi_ds_init_object_from_op(walk_state, arg, opcode,
+                                                       &obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               acpi_ut_delete_object_desc(obj_desc);
+                               return_ACPI_STATUS(status);
                        }
                }
 
                /* Put the operand object on the object stack */
 
-               status = acpi_ds_obj_stack_push (obj_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_obj_stack_push(obj_desc, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
+               ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
+                                  (obj_desc, walk_state));
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_operands
@@ -702,29 +692,27 @@ acpi_ds_create_operand (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_create_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *first_arg)
+acpi_ds_create_operands(struct acpi_walk_state *walk_state,
+                       union acpi_parse_object *first_arg)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_parse_object         *arg;
-       u32                             arg_count = 0;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg);
+       acpi_status status = AE_OK;
+       union acpi_parse_object *arg;
+       u32 arg_count = 0;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
 
        /* For all arguments in the list... */
 
        arg = first_arg;
        while (arg) {
-               status = acpi_ds_create_operand (walk_state, arg, arg_count);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ds_create_operand(walk_state, arg, arg_count);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
-                       arg_count, arg, first_arg));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "Arg #%d (%p) done, Arg1=%p\n", arg_count,
+                                 arg, first_arg));
 
                /* Move on to next argument, if any */
 
@@ -732,20 +720,17 @@ acpi_ds_create_operands (
                arg_count++;
        }
 
-       return_ACPI_STATUS (status);
-
+       return_ACPI_STATUS(status);
 
-cleanup:
+      cleanup:
        /*
         * We must undo everything done above; meaning that we must
         * pop everything off of the operand stack and delete those
         * objects
         */
-       (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
+       (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
-               (arg_count + 1), acpi_format_exception (status)));
-       return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
+                         (arg_count + 1), acpi_format_exception(status)));
+       return_ACPI_STATUS(status);
 }
-
-
index 10f71318e23b81f9b40b428dc109dff0f2f0428d..e522763bb692aeacdb568a51a3e1a2fe7b73a213 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acdebug.h>
 #include <acpi/acdisasm.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dswexec")
+ACPI_MODULE_NAME("dswexec")
 
 /*
  * Dispatch table for opcode classes
  */
-static ACPI_EXECUTE_OP      acpi_gbl_op_type_dispatch [] = {
-                         acpi_ex_opcode_0A_0T_1R,
-                         acpi_ex_opcode_1A_0T_0R,
-                         acpi_ex_opcode_1A_0T_1R,
-                         acpi_ex_opcode_1A_1T_0R,
-                         acpi_ex_opcode_1A_1T_1R,
-                         acpi_ex_opcode_2A_0T_0R,
-                         acpi_ex_opcode_2A_0T_1R,
-                         acpi_ex_opcode_2A_1T_1R,
-                         acpi_ex_opcode_2A_2T_1R,
-                         acpi_ex_opcode_3A_0T_0R,
-                         acpi_ex_opcode_3A_1T_1R,
-                         acpi_ex_opcode_6A_0T_1R};
-
+static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = {
+       acpi_ex_opcode_0A_0T_1R,
+       acpi_ex_opcode_1A_0T_0R,
+       acpi_ex_opcode_1A_0T_1R,
+       acpi_ex_opcode_1A_1T_0R,
+       acpi_ex_opcode_1A_1T_1R,
+       acpi_ex_opcode_2A_0T_0R,
+       acpi_ex_opcode_2A_0T_1R,
+       acpi_ex_opcode_2A_1T_1R,
+       acpi_ex_opcode_2A_2T_1R,
+       acpi_ex_opcode_3A_0T_0R,
+       acpi_ex_opcode_3A_1T_1R,
+       acpi_ex_opcode_6A_0T_1R
+};
 
 /*****************************************************************************
  *
@@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP      acpi_gbl_op_type_dispatch [] = {
  ****************************************************************************/
 
 acpi_status
-acpi_ds_get_predicate_value (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *result_obj) {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *local_obj_desc = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state);
+acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
+                           union acpi_operand_object *result_obj)
+{
+       acpi_status status = AE_OK;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *local_obj_desc = NULL;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
 
        walk_state->control_state->common.state = 0;
 
        if (result_obj) {
-               status = acpi_ds_result_pop (&obj_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not get result from predicate evaluation, %s\n",
-                               acpi_format_exception (status)));
+               status = acpi_ds_result_pop(&obj_desc, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not get result from predicate evaluation, %s\n",
+                                         acpi_format_exception(status)));
 
-                       return_ACPI_STATUS (status);
+                       return_ACPI_STATUS(status);
                }
-       }
-       else {
-               status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+       } else {
+               status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_resolve_to_value(&walk_state->operands[0],
+                                            walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               obj_desc = walk_state->operands [0];
+               obj_desc = walk_state->operands[0];
        }
 
        if (!obj_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "No predicate obj_desc=%p State=%p\n",
-                       obj_desc, walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No predicate obj_desc=%p State=%p\n",
+                                 obj_desc, walk_state));
 
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
        /*
         * Result of predicate evaluation must be an Integer
         * object. Implicitly convert the argument if necessary.
         */
-       status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
-                       obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc)));
+       if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
+                                 obj_desc, walk_state,
+                                 ACPI_GET_OBJECT_TYPE(obj_desc)));
 
                status = AE_AML_OPERAND_TYPE;
                goto cleanup;
@@ -153,7 +151,7 @@ acpi_ds_get_predicate_value (
 
        /* Truncate the predicate to 32-bits if necessary */
 
-       acpi_ex_truncate_for32bit_table (local_obj_desc);
+       acpi_ex_truncate_for32bit_table(local_obj_desc);
 
        /*
         * Save the result of the predicate evaluation on
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value (
         */
        if (local_obj_desc->integer.value) {
                walk_state->control_state->common.value = TRUE;
-       }
-       else {
+       } else {
                /*
                 * Predicate is FALSE, we will just toss the
                 * rest of the package
@@ -171,30 +168,30 @@ acpi_ds_get_predicate_value (
                status = AE_CTRL_FALSE;
        }
 
+      cleanup:
 
-cleanup:
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
+                         walk_state->control_state->common.value,
+                         walk_state->op));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
-               walk_state->control_state->common.value, walk_state->op));
+       /* Break to debugger to display result */
 
-        /* Break to debugger to display result */
-
-       ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state));
+       ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
+                          (local_obj_desc, walk_state));
 
        /*
         * Delete the predicate result object (we know that
         * we don't need it anymore)
         */
        if (local_obj_desc != obj_desc) {
-               acpi_ut_remove_reference (local_obj_desc);
+               acpi_ut_remove_reference(local_obj_desc);
        }
-       acpi_ut_remove_reference (obj_desc);
+       acpi_ut_remove_reference(obj_desc);
 
        walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*****************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_begin_op
@@ -211,38 +208,39 @@ cleanup:
  ****************************************************************************/
 
 acpi_status
-acpi_ds_exec_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op)
+acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
+                     union acpi_parse_object **out_op)
 {
-       union acpi_parse_object         *op;
-       acpi_status                     status = AE_OK;
-       u32                             opcode_class;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state);
+       union acpi_parse_object *op;
+       acpi_status status = AE_OK;
+       u32 opcode_class;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
 
        op = walk_state->op;
        if (!op) {
-               status = acpi_ds_load2_begin_op (walk_state, out_op);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_load2_begin_op(walk_state, out_op);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                op = *out_op;
                walk_state->op = op;
                walk_state->opcode = op->common.aml_opcode;
-               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-
-               if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                               "(%s) Popping scope for Op %p\n",
-                               acpi_ut_get_type_name (walk_state->op_info->object_type), op));
-
-                       status = acpi_ds_scope_stack_pop (walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+               walk_state->op_info =
+                   acpi_ps_get_opcode_info(op->common.aml_opcode);
+
+               if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "(%s) Popping scope for Op %p\n",
+                                         acpi_ut_get_type_name(walk_state->
+                                                               op_info->
+                                                               object_type),
+                                         op));
+
+                       status = acpi_ds_scope_stack_pop(walk_state);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
        }
@@ -252,7 +250,7 @@ acpi_ds_exec_begin_op (
                        *out_op = op;
                }
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -261,19 +259,20 @@ acpi_ds_exec_begin_op (
         * Save this knowledge in the current scope descriptor
         */
        if ((walk_state->control_state) &&
-               (walk_state->control_state->common.state ==
-                       ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
-                                 op, walk_state));
+           (walk_state->control_state->common.state ==
+            ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Exec predicate Op=%p State=%p\n", op,
+                                 walk_state));
 
-               walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING;
+               walk_state->control_state->common.state =
+                   ACPI_CONTROL_PREDICATE_EXECUTING;
 
                /* Save start of predicate */
 
                walk_state->control_state->control.predicate_op = op;
        }
 
-
        opcode_class = walk_state->op_info->class;
 
        /* We want to send namepaths to the load code */
@@ -288,15 +287,14 @@ acpi_ds_exec_begin_op (
        switch (opcode_class) {
        case AML_CLASS_CONTROL:
 
-               status = acpi_ds_result_stack_push (walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_result_stack_push(walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               status = acpi_ds_exec_begin_control_op (walk_state, op);
+               status = acpi_ds_exec_begin_control_op(walk_state, op);
                break;
 
-
        case AML_CLASS_NAMED_OBJECT:
 
                if (walk_state->walk_type == ACPI_WALK_METHOD) {
@@ -306,15 +304,14 @@ acpi_ds_exec_begin_op (
                         * object is temporary and will be deleted upon completion of
                         * the execution of this method.
                         */
-                       status = acpi_ds_load2_begin_op (walk_state, NULL);
+                       status = acpi_ds_load2_begin_op(walk_state, NULL);
                }
 
                if (op->common.aml_opcode == AML_REGION_OP) {
-                       status = acpi_ds_result_stack_push (walk_state);
+                       status = acpi_ds_result_stack_push(walk_state);
                }
                break;
 
-
        case AML_CLASS_EXECUTE:
        case AML_CLASS_CREATE:
 
@@ -322,20 +319,18 @@ acpi_ds_exec_begin_op (
                 * Most operators with arguments.
                 * Start a new result/operand state
                 */
-               status = acpi_ds_result_stack_push (walk_state);
+               status = acpi_ds_result_stack_push(walk_state);
                break;
 
-
        default:
                break;
        }
 
        /* Nothing to do here during method execution */
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*****************************************************************************
  *
  * FUNCTION:    acpi_ds_exec_end_op
@@ -350,28 +345,25 @@ acpi_ds_exec_begin_op (
  *
  ****************************************************************************/
 
-acpi_status
-acpi_ds_exec_end_op (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 {
-       union acpi_parse_object         *op;
-       acpi_status                     status = AE_OK;
-       u32                             op_type;
-       u32                             op_class;
-       union acpi_parse_object         *next_op;
-       union acpi_parse_object         *first_arg;
+       union acpi_parse_object *op;
+       acpi_status status = AE_OK;
+       u32 op_type;
+       u32 op_class;
+       union acpi_parse_object *next_op;
+       union acpi_parse_object *first_arg;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state);
-
-
-       op      = walk_state->op;
+       op = walk_state->op;
        op_type = walk_state->op_info->type;
        op_class = walk_state->op_info->class;
 
        if (op_class == AML_CLASS_UNKNOWN) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
-               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
+                                 op->common.aml_opcode));
+               return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
        }
 
        first_arg = op->common.value.arg;
@@ -384,29 +376,31 @@ acpi_ds_exec_end_op (
 
        /* Call debugger for single step support (DEBUG build only) */
 
-       ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
-       ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
+       ACPI_DEBUGGER_EXEC(status =
+                          acpi_db_single_step(walk_state, op, op_class));
+       ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) {
+                          return_ACPI_STATUS(status);}
+       ) ;
 
        /* Decode the Opcode Class */
 
        switch (op_class) {
-       case AML_CLASS_ARGUMENT:    /* constants, literals, etc. - do nothing */
+       case AML_CLASS_ARGUMENT:        /* constants, literals, etc. - do nothing */
                break;
 
-
-       case AML_CLASS_EXECUTE:     /* most operators with arguments */
+       case AML_CLASS_EXECUTE: /* most operators with arguments */
 
                /* Build resolved operand stack */
 
-               status = acpi_ds_create_operands (walk_state, first_arg);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ds_create_operands(walk_state, first_arg);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
                /* Done with this result state (Now that operand stack is built) */
 
-               status = acpi_ds_result_stack_pop (walk_state);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ds_result_stack_pop(walk_state);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
@@ -417,86 +411,93 @@ acpi_ds_exec_end_op (
                if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
                        /* Resolve all operands */
 
-                       status = acpi_ex_resolve_operands (walk_state->opcode,
-                                        &(walk_state->operands [walk_state->num_operands -1]),
-                                        walk_state);
-                       if (ACPI_SUCCESS (status)) {
-                               ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
-                                       acpi_ps_get_opcode_name (walk_state->opcode),
-                                       walk_state->num_operands, "after ex_resolve_operands");
+                       status = acpi_ex_resolve_operands(walk_state->opcode,
+                                                         &(walk_state->
+                                                           operands
+                                                           [walk_state->
+                                                            num_operands - 1]),
+                                                         walk_state);
+                       if (ACPI_SUCCESS(status)) {
+                               ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
+                                                  ACPI_IMODE_EXECUTE,
+                                                  acpi_ps_get_opcode_name
+                                                  (walk_state->opcode),
+                                                  walk_state->num_operands,
+                                                  "after ex_resolve_operands");
                        }
                }
 
-               if (ACPI_SUCCESS (status)) {
+               if (ACPI_SUCCESS(status)) {
                        /*
                         * Dispatch the request to the appropriate interpreter handler
                         * routine.  There is one routine per opcode "type" based upon the
                         * number of opcode arguments and return type.
                         */
-                       status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
-               }
-               else {
+                       status =
+                           acpi_gbl_op_type_dispatch[op_type] (walk_state);
+               else {
                        /*
                         * Treat constructs of the form "Store(local_x,local_x)" as noops when the
                         * Local is uninitialized.
                         */
-                       if  ((status == AE_AML_UNINITIALIZED_LOCAL) &&
-                               (walk_state->opcode == AML_STORE_OP) &&
-                               (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-                               (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
-                               (walk_state->operands[0]->reference.opcode ==
-                                walk_state->operands[1]->reference.opcode) &&
-                               (walk_state->operands[0]->reference.offset ==
-                                walk_state->operands[1]->reference.offset)) {
+                       if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
+                           (walk_state->opcode == AML_STORE_OP) &&
+                           (walk_state->operands[0]->common.type ==
+                            ACPI_TYPE_LOCAL_REFERENCE)
+                           && (walk_state->operands[1]->common.type ==
+                               ACPI_TYPE_LOCAL_REFERENCE)
+                           && (walk_state->operands[0]->reference.opcode ==
+                               walk_state->operands[1]->reference.opcode)
+                           && (walk_state->operands[0]->reference.offset ==
+                               walk_state->operands[1]->reference.offset)) {
                                status = AE_OK;
-                       }
-                       else {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "[%s]: Could not resolve operands, %s\n",
-                                       acpi_ps_get_opcode_name (walk_state->opcode),
-                                       acpi_format_exception (status)));
+                       } else {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "[%s]: Could not resolve operands, %s\n",
+                                                 acpi_ps_get_opcode_name
+                                                 (walk_state->opcode),
+                                                 acpi_format_exception
+                                                 (status)));
                        }
                }
 
                /* Always delete the argument objects and clear the operand stack */
 
-               acpi_ds_clear_operands (walk_state);
+               acpi_ds_clear_operands(walk_state);
 
                /*
                 * If a result object was returned from above, push it on the
                 * current result stack
                 */
-               if (ACPI_SUCCESS (status) &&
-                       walk_state->result_obj) {
-                       status = acpi_ds_result_push (walk_state->result_obj, walk_state);
+               if (ACPI_SUCCESS(status) && walk_state->result_obj) {
+                       status =
+                           acpi_ds_result_push(walk_state->result_obj,
+                                               walk_state);
                }
 
                break;
 
-
        default:
 
                switch (op_type) {
-               case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
+               case AML_TYPE_CONTROL:  /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
 
                        /* 1 Operand, 0 external_result, 0 internal_result */
 
-                       status = acpi_ds_exec_end_control_op (walk_state, op);
+                       status = acpi_ds_exec_end_control_op(walk_state, op);
 
                        /* Make sure to properly pop the result stack */
 
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ds_result_stack_pop (walk_state);
-                       }
-                       else if (status == AE_CTRL_PENDING) {
-                               status = acpi_ds_result_stack_pop (walk_state);
-                               if (ACPI_SUCCESS (status)) {
+                       if (ACPI_SUCCESS(status)) {
+                               status = acpi_ds_result_stack_pop(walk_state);
+                       } else if (status == AE_CTRL_PENDING) {
+                               status = acpi_ds_result_stack_pop(walk_state);
+                               if (ACPI_SUCCESS(status)) {
                                        status = AE_CTRL_PENDING;
                                }
                        }
                        break;
 
-
                case AML_TYPE_METHOD_CALL:
 
                        /*
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op (
                         * a reference to it.
                         */
                        if ((op->asl.parent) &&
-                          ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
-                               (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                                       "Method Reference in a Package, Op=%p\n", op));
-                               op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
-                               acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
-                               return_ACPI_STATUS (AE_OK);
+                           ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
+                            || (op->asl.parent->asl.aml_opcode ==
+                                AML_VAR_PACKAGE_OP))) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                                 "Method Reference in a Package, Op=%p\n",
+                                                 op));
+                               op->common.node =
+                                   (struct acpi_namespace_node *)op->asl.value.
+                                   arg->asl.node->object;
+                               acpi_ut_add_reference(op->asl.value.arg->asl.
+                                                     node->object);
+                               return_ACPI_STATUS(AE_OK);
                        }
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op));
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "Method invocation, Op=%p\n", op));
 
                        /*
                         * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
@@ -531,8 +538,8 @@ acpi_ds_exec_end_op (
                        /*
                         * Get the method's arguments and put them on the operand stack
                         */
-                       status = acpi_ds_create_operands (walk_state, next_op);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ds_create_operands(walk_state, next_op);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
 
@@ -541,11 +548,11 @@ acpi_ds_exec_end_op (
                         * we must resolve all local references here (Local variables,
                         * arguments to *this* method, etc.)
                         */
-                       status = acpi_ds_resolve_operands (walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ds_resolve_operands(walk_state);
+                       if (ACPI_FAILURE(status)) {
                                /* On error, clear all resolved operands */
 
-                               acpi_ds_clear_operands (walk_state);
+                               acpi_ds_clear_operands(walk_state);
                                break;
                        }
 
@@ -559,27 +566,28 @@ acpi_ds_exec_end_op (
                         * Return now; we don't want to disturb anything,
                         * especially the operand count!
                         */
-                       return_ACPI_STATUS (status);
-
+                       return_ACPI_STATUS(status);
 
                case AML_TYPE_CREATE_FIELD:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "Executing create_field Buffer/Index Op=%p\n", op));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "Executing create_field Buffer/Index Op=%p\n",
+                                         op));
 
-                       status = acpi_ds_load2_end_op (walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ds_load2_end_op(walk_state);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
 
-                       status = acpi_ds_eval_buffer_field_operands (walk_state, op);
+                       status =
+                           acpi_ds_eval_buffer_field_operands(walk_state, op);
                        break;
 
-
                case AML_TYPE_CREATE_OBJECT:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "Executing create_object (Buffer/Package) Op=%p\n", op));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "Executing create_object (Buffer/Package) Op=%p\n",
+                                         op));
 
                        switch (op->common.parent->common.aml_opcode) {
                        case AML_NAME_OP:
@@ -588,13 +596,15 @@ acpi_ds_exec_end_op (
                                 * Put the Node on the object stack (Contains the ACPI Name
                                 * of this object)
                                 */
-                               walk_state->operands[0] = (void *) op->common.parent->common.node;
+                               walk_state->operands[0] =
+                                   (void *)op->common.parent->common.node;
                                walk_state->num_operands = 1;
 
-                               status = acpi_ds_create_node (walk_state,
-                                                op->common.parent->common.node,
-                                                op->common.parent);
-                               if (ACPI_FAILURE (status)) {
+                               status = acpi_ds_create_node(walk_state,
+                                                            op->common.parent->
+                                                            common.node,
+                                                            op->common.parent);
+                               if (ACPI_FAILURE(status)) {
                                        break;
                                }
 
@@ -603,20 +613,26 @@ acpi_ds_exec_end_op (
 
                        case AML_INT_EVAL_SUBTREE_OP:
 
-                               status = acpi_ds_eval_data_object_operands (walk_state, op,
-                                                acpi_ns_get_attached_object (op->common.parent->common.node));
+                               status =
+                                   acpi_ds_eval_data_object_operands
+                                   (walk_state, op,
+                                    acpi_ns_get_attached_object(op->common.
+                                                                parent->common.
+                                                                node));
                                break;
 
                        default:
 
-                               status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
+                               status =
+                                   acpi_ds_eval_data_object_operands
+                                   (walk_state, op, NULL);
                                break;
                        }
 
                        /* Done with result state (Now that operand stack is built) */
 
-                       status = acpi_ds_result_stack_pop (walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ds_result_stack_pop(walk_state);
+                       if (ACPI_FAILURE(status)) {
                                goto cleanup;
                        }
 
@@ -625,56 +641,58 @@ acpi_ds_exec_end_op (
                         * current result stack
                         */
                        if (walk_state->result_obj) {
-                               status = acpi_ds_result_push (walk_state->result_obj, walk_state);
+                               status =
+                                   acpi_ds_result_push(walk_state->result_obj,
+                                                       walk_state);
                        }
                        break;
 
-
                case AML_TYPE_NAMED_FIELD:
                case AML_TYPE_NAMED_COMPLEX:
                case AML_TYPE_NAMED_SIMPLE:
                case AML_TYPE_NAMED_NO_OBJ:
 
-                       status = acpi_ds_load2_end_op (walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ds_load2_end_op(walk_state);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
 
                        if (op->common.aml_opcode == AML_REGION_OP) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                                       "Executing op_region Address/Length Op=%p\n", op));
-
-                               status = acpi_ds_eval_region_operands (walk_state, op);
-                               if (ACPI_FAILURE (status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                 "Executing op_region Address/Length Op=%p\n",
+                                                 op));
+
+                               status =
+                                   acpi_ds_eval_region_operands(walk_state,
+                                                                op);
+                               if (ACPI_FAILURE(status)) {
                                        break;
                                }
 
-                               status = acpi_ds_result_stack_pop (walk_state);
+                               status = acpi_ds_result_stack_pop(walk_state);
                        }
 
                        break;
 
-
                case AML_TYPE_UNDEFINED:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Undefined opcode type Op=%p\n", op));
-                       return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
-
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Undefined opcode type Op=%p\n", op));
+                       return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
 
                case AML_TYPE_BOGUS:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                               "Internal opcode=%X type Op=%p\n",
-                               walk_state->opcode, op));
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "Internal opcode=%X type Op=%p\n",
+                                         walk_state->opcode, op));
                        break;
 
-
                default:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
-                               op_class, op_type, op->common.aml_opcode, op));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+                                         op_class, op_type,
+                                         op->common.aml_opcode, op));
 
                        status = AE_NOT_IMPLEMENTED;
                        break;
@@ -685,55 +703,58 @@ acpi_ds_exec_end_op (
         * ACPI 2.0 support for 64-bit integers: Truncate numeric
         * result value if we are executing from a 32-bit ACPI table
         */
-       acpi_ex_truncate_for32bit_table (walk_state->result_obj);
+       acpi_ex_truncate_for32bit_table(walk_state->result_obj);
 
        /*
         * Check if we just completed the evaluation of a
         * conditional predicate
         */
 
-       if ((ACPI_SUCCESS (status)) &&
-               (walk_state->control_state) &&
-               (walk_state->control_state->common.state ==
-                       ACPI_CONTROL_PREDICATE_EXECUTING) &&
-               (walk_state->control_state->control.predicate_op == op)) {
-               status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj);
+       if ((ACPI_SUCCESS(status)) &&
+           (walk_state->control_state) &&
+           (walk_state->control_state->common.state ==
+            ACPI_CONTROL_PREDICATE_EXECUTING) &&
+           (walk_state->control_state->control.predicate_op == op)) {
+               status =
+                   acpi_ds_get_predicate_value(walk_state,
+                                               walk_state->result_obj);
                walk_state->result_obj = NULL;
        }
 
-
-cleanup:
+      cleanup:
 
        /* Invoke exception handler on error */
 
-       if (ACPI_FAILURE (status) &&
-               acpi_gbl_exception_handler &&
-               !(status & AE_CODE_CONTROL)) {
-               acpi_ex_exit_interpreter ();
-               status = acpi_gbl_exception_handler (status,
-                                walk_state->method_node->name.integer, walk_state->opcode,
-                                walk_state->aml_offset, NULL);
-               (void) acpi_ex_enter_interpreter ();
+       if (ACPI_FAILURE(status) &&
+           acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
+               acpi_ex_exit_interpreter();
+               status = acpi_gbl_exception_handler(status,
+                                                   walk_state->method_node->
+                                                   name.integer,
+                                                   walk_state->opcode,
+                                                   walk_state->aml_offset,
+                                                   NULL);
+               (void)acpi_ex_enter_interpreter();
        }
 
        if (walk_state->result_obj) {
                /* Break to debugger to display result */
 
-               ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
-                                walk_state));
+               ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
+                                  (walk_state->result_obj, walk_state));
 
                /*
                 * Delete the result op if and only if:
                 * Parent will not use the result -- such as any
                 * non-nested type2 op in a method (parent will be method)
                 */
-               acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state);
+               acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
+                                                 walk_state);
        }
-
 #ifdef _UNDER_DEVELOPMENT
 
        if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
-               acpi_db_method_end (walk_state);
+               acpi_db_method_end(walk_state);
        }
 #endif
 
@@ -745,12 +766,10 @@ cleanup:
 
        /* On error, display method locals/args */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_dm_dump_method_info (status, walk_state, op);
+       if (ACPI_FAILURE(status)) {
+               acpi_dm_dump_method_info(status, walk_state, op);
        }
 #endif
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index d11620018421486f1559c3fc4be1afbd7578a8ef..411731261c2986b2c19e01104bd0e48e89be6131 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 #include <acpi/acdisasm.h>
 #endif
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dswload")
-
+ACPI_MODULE_NAME("dswload")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Init walk state callbacks
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ds_init_callbacks (
-       struct acpi_walk_state          *walk_state,
-       u32                             pass_number)
+acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
 {
 
        switch (pass_number) {
        case 1:
-               walk_state->parse_flags       = ACPI_PARSE_LOAD_PASS1 |
-                                  ACPI_PARSE_DELETE_TREE;
+               walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
+                   ACPI_PARSE_DELETE_TREE;
                walk_state->descending_callback = acpi_ds_load1_begin_op;
                walk_state->ascending_callback = acpi_ds_load1_end_op;
                break;
 
        case 2:
-               walk_state->parse_flags       = ACPI_PARSE_LOAD_PASS1 |
-                                  ACPI_PARSE_DELETE_TREE;
+               walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
+                   ACPI_PARSE_DELETE_TREE;
                walk_state->descending_callback = acpi_ds_load2_begin_op;
                walk_state->ascending_callback = acpi_ds_load2_end_op;
                break;
 
        case 3:
 #ifndef ACPI_NO_METHOD_EXECUTION
-               walk_state->parse_flags      |= ACPI_PARSE_EXECUTE  |
-                                  ACPI_PARSE_DELETE_TREE;
+               walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
+                   ACPI_PARSE_DELETE_TREE;
                walk_state->descending_callback = acpi_ds_exec_begin_op;
                walk_state->ascending_callback = acpi_ds_exec_end_op;
 #endif
@@ -108,7 +103,6 @@ acpi_ds_init_callbacks (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load1_begin_op
@@ -123,37 +117,26 @@ acpi_ds_init_callbacks (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_load1_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op)
+acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
+                      union acpi_parse_object ** out_op)
 {
-       union acpi_parse_object         *op;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       acpi_object_type                object_type;
-       char                            *path;
-       u32                             flags;
-
-
-       ACPI_FUNCTION_NAME ("ds_load1_begin_op");
+       union acpi_parse_object *op;
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       acpi_object_type object_type;
+       char *path;
+       u32 flags;
 
+       ACPI_FUNCTION_NAME("ds_load1_begin_op");
 
        op = walk_state->op;
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+                         walk_state));
 
        /* We are only interested in opcodes that have an associated name */
 
        if (op) {
                if (!(walk_state->op_info->flags & AML_NAMED)) {
-#if 0
-                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-                               (walk_state->op_info->class == AML_CLASS_CONTROL)) {
-                               acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
-                                       walk_state->op_info->name);
-                               *out_op = op;
-                               return (AE_CTRL_SKIP);
-                       }
-#endif
                        *out_op = op;
                        return (AE_OK);
                }
@@ -166,14 +149,15 @@ acpi_ds_load1_begin_op (
                }
        }
 
-       path = acpi_ps_get_next_namestring (&walk_state->parser_state);
+       path = acpi_ps_get_next_namestring(&walk_state->parser_state);
 
        /* Map the raw opcode into an internal object type */
 
        object_type = walk_state->op_info->object_type;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "State=%p Op=%p [%s]\n", walk_state, op, acpi_ut_get_type_name (object_type)));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "State=%p Op=%p [%s]\n", walk_state, op,
+                         acpi_ut_get_type_name(object_type)));
 
        switch (walk_state->opcode) {
        case AML_SCOPE_OP:
@@ -183,23 +167,27 @@ acpi_ds_load1_begin_op (
                 * that we can actually open the scope to enter new names underneath it.
                 * Allow search-to-root for single namesegs.
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
-#ifdef _ACPI_ASL_COMPILER
+               status =
+                   acpi_ns_lookup(walk_state->scope_info, path, object_type,
+                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+                                  walk_state, &(node));
+#ifdef ACPI_ASL_COMPILER
                if (status == AE_NOT_FOUND) {
                        /*
                         * Table disassembly:
                         * Target of Scope() not found.  Generate an External for it, and
                         * insert the name into the namespace.
                         */
-                       acpi_dm_add_to_external_list (path);
-                       status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-                                          ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
-                                          walk_state, &(node));
+                       acpi_dm_add_to_external_list(path);
+                       status =
+                           acpi_ns_lookup(walk_state->scope_info, path,
+                                          object_type, ACPI_IMODE_LOAD_PASS1,
+                                          ACPI_NS_SEARCH_PARENT, walk_state,
+                                          &(node));
                }
 #endif
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_NSERROR (path, status);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_NSERROR(path, status);
                        return (status);
                }
 
@@ -208,7 +196,7 @@ acpi_ds_load1_begin_op (
                 * one of the opcodes that actually opens a scope
                 */
                switch (node->type) {
-               case ACPI_TYPE_LOCAL_SCOPE:         /* Scope  */
+               case ACPI_TYPE_LOCAL_SCOPE:     /* Scope  */
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_POWER:
                case ACPI_TYPE_PROCESSOR:
@@ -232,9 +220,10 @@ acpi_ds_load1_begin_op (
                         * a warning
                         */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                               "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
-                               path, acpi_ut_get_type_name (node->type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+                                         path,
+                                         acpi_ut_get_type_name(node->type)));
 
                        node->type = ACPI_TYPE_ANY;
                        walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -244,15 +233,12 @@ acpi_ds_load1_begin_op (
 
                        /* All other types are an error */
 
-                       ACPI_REPORT_ERROR ((
-                               "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
-                               acpi_ut_get_type_name (node->type), path));
+                       ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path));
 
                        return (AE_AML_OPERAND_TYPE);
                }
                break;
 
-
        default:
 
                /*
@@ -281,15 +267,15 @@ acpi_ds_load1_begin_op (
 
                flags = ACPI_NS_NO_UPSEARCH;
                if ((walk_state->opcode != AML_SCOPE_OP) &&
-                       (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
+                   (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
                        flags |= ACPI_NS_ERROR_IF_FOUND;
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
-                                       acpi_ut_get_type_name (object_type)));
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                               "[%s] Both Find or Create allowed\n",
-                                       acpi_ut_get_type_name (object_type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "[%s] Cannot already exist\n",
+                                         acpi_ut_get_type_name(object_type)));
+               else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "[%s] Both Find or Create allowed\n",
+                                         acpi_ut_get_type_name(object_type)));
                }
 
                /*
@@ -298,22 +284,23 @@ acpi_ds_load1_begin_op (
                 * involve arguments to the opcode must be created as we go back up the
                 * parse tree later.
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
-                                 ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_NSERROR (path, status);
+               status =
+                   acpi_ns_lookup(walk_state->scope_info, path, object_type,
+                                  ACPI_IMODE_LOAD_PASS1, flags, walk_state,
+                                  &(node));
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_NSERROR(path, status);
                        return (status);
                }
                break;
        }
 
-
        /* Common exit */
 
        if (!op) {
                /* Create a new op */
 
-               op = acpi_ps_alloc_op (walk_state->opcode);
+               op = acpi_ps_alloc_op(walk_state->opcode);
                if (!op) {
                        return (AE_NO_MEMORY);
                }
@@ -327,19 +314,18 @@ acpi_ds_load1_begin_op (
        op->named.path = (u8 *) path;
 #endif
 
-
        /*
         * Put the Node in the "op" object that the parser uses, so we
         * can get it again quickly when this scope is closed
         */
        op->common.node = node;
-       acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
+       acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
+                          op);
 
        *out_op = op;
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load1_end_op
@@ -353,20 +339,17 @@ acpi_ds_load1_begin_op (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_load1_end_op (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
 {
-       union acpi_parse_object         *op;
-       acpi_object_type                object_type;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_NAME ("ds_load1_end_op");
+       union acpi_parse_object *op;
+       acpi_object_type object_type;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_NAME("ds_load1_end_op");
 
        op = walk_state->op;
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+                         walk_state));
 
        /* We are only interested in opcodes that have an associated name */
 
@@ -380,21 +363,20 @@ acpi_ds_load1_end_op (
 
 #ifndef ACPI_NO_METHOD_EXECUTION
        if (walk_state->op_info->flags & AML_FIELD) {
-               if (walk_state->opcode == AML_FIELD_OP         ||
-                       walk_state->opcode == AML_BANK_FIELD_OP    ||
-                       walk_state->opcode == AML_INDEX_FIELD_OP) {
-                       status = acpi_ds_init_field_objects (op, walk_state);
+               if (walk_state->opcode == AML_FIELD_OP ||
+                   walk_state->opcode == AML_BANK_FIELD_OP ||
+                   walk_state->opcode == AML_INDEX_FIELD_OP) {
+                       status = acpi_ds_init_field_objects(op, walk_state);
                }
                return (status);
        }
 
-
        if (op->common.aml_opcode == AML_REGION_OP) {
-               status = acpi_ex_create_region (op->named.data, op->named.length,
-                                  (acpi_adr_space_type)
-                                                ((op->common.value.arg)->common.value.integer),
-                                                walk_state);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ex_create_region(op->named.data, op->named.length,
+                                              (acpi_adr_space_type)
+                                              ((op->common.value.arg)->common.
+                                               value.integer), walk_state);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
@@ -404,8 +386,11 @@ acpi_ds_load1_end_op (
                /* For Name opcode, get the object type from the argument */
 
                if (op->common.value.arg) {
-                       object_type = (acpi_ps_get_opcode_info (
-                               (op->common.value.arg)->common.aml_opcode))->object_type;
+                       object_type = (acpi_ps_get_opcode_info((op->common.
+                                                               value.arg)->
+                                                              common.
+                                                              aml_opcode))->
+                           object_type;
                        op->common.node->type = (u8) object_type;
                }
        }
@@ -419,23 +404,26 @@ acpi_ds_load1_end_op (
                 * of invocations of the method (need to know the number of
                 * arguments.)
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "LOADING-Method: State=%p Op=%p named_obj=%p\n",
-                       walk_state, op, op->named.node));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "LOADING-Method: State=%p Op=%p named_obj=%p\n",
+                                 walk_state, op, op->named.node));
 
-               if (!acpi_ns_get_attached_object (op->named.node)) {
-                       walk_state->operands[0] = (void *) op->named.node;
+               if (!acpi_ns_get_attached_object(op->named.node)) {
+                       walk_state->operands[0] = (void *)op->named.node;
                        walk_state->num_operands = 1;
 
-                       status = acpi_ds_create_operands (walk_state, op->common.value.arg);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ex_create_method (op->named.data,
-                                                  op->named.length, walk_state);
+                       status =
+                           acpi_ds_create_operands(walk_state,
+                                                   op->common.value.arg);
+                       if (ACPI_SUCCESS(status)) {
+                               status = acpi_ex_create_method(op->named.data,
+                                                              op->named.length,
+                                                              walk_state);
                        }
                        walk_state->operands[0] = NULL;
                        walk_state->num_operands = 0;
 
-                       if (ACPI_FAILURE (status)) {
+                       if (ACPI_FAILURE(status)) {
                                return (status);
                        }
                }
@@ -443,17 +431,17 @@ acpi_ds_load1_end_op (
 
        /* Pop the scope stack */
 
-       if (acpi_ns_opens_scope (object_type)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
-                       acpi_ut_get_type_name (object_type), op));
+       if (acpi_ns_opens_scope(object_type)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "(%s): Popping scope for Op %p\n",
+                                 acpi_ut_get_type_name(object_type), op));
 
-               status = acpi_ds_scope_stack_pop (walk_state);
+               status = acpi_ds_scope_stack_pop(walk_state);
        }
 
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load2_begin_op
@@ -468,30 +456,53 @@ acpi_ds_load1_end_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_load2_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op)
+acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
+                      union acpi_parse_object ** out_op)
 {
-       union acpi_parse_object         *op;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       acpi_object_type                object_type;
-       char                            *buffer_ptr;
-
-
-       ACPI_FUNCTION_TRACE ("ds_load2_begin_op");
+       union acpi_parse_object *op;
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       acpi_object_type object_type;
+       char *buffer_ptr;
 
+       ACPI_FUNCTION_TRACE("ds_load2_begin_op");
 
        op = walk_state->op;
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
+                         walk_state));
 
        if (op) {
+               if ((walk_state->control_state) &&
+                   (walk_state->control_state->common.state ==
+                    ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+                       /* We are executing a while loop outside of a method */
+
+                       status = acpi_ds_exec_begin_op(walk_state, out_op);
+                       return_ACPI_STATUS(status);
+               }
+
                /* We only care about Namespace opcodes here */
 
                if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
-                         (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
-                       (!(walk_state->op_info->flags & AML_NAMED))) {
-                       return_ACPI_STATUS (AE_OK);
+                    (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
+                   (!(walk_state->op_info->flags & AML_NAMED))) {
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                           (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+
+                               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                                 "Begin/EXEC: %s (fl %8.8X)\n",
+                                                 walk_state->op_info->name,
+                                                 walk_state->op_info->flags));
+
+                               /* Executing a type1 or type2 opcode outside of a method */
+
+                               status =
+                                   acpi_ds_exec_begin_op(walk_state, out_op);
+                               return_ACPI_STATUS(status);
+                       }
+#endif
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /* Get the name we are going to enter or lookup in the namespace */
@@ -503,28 +514,27 @@ acpi_ds_load2_begin_op (
                        if (!buffer_ptr) {
                                /* No name, just exit */
 
-                               return_ACPI_STATUS (AE_OK);
+                               return_ACPI_STATUS(AE_OK);
                        }
-               }
-               else {
+               } else {
                        /* Get name from the op */
 
-                       buffer_ptr = (char *) &op->named.name;
+                       buffer_ptr = (char *)&op->named.name;
                }
-       }
-       else {
+       } else {
                /* Get the namestring from the raw AML */
 
-               buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state);
+               buffer_ptr =
+                   acpi_ps_get_next_namestring(&walk_state->parser_state);
        }
 
        /* Map the opcode into an internal object type */
 
        object_type = walk_state->op_info->object_type;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "State=%p Op=%p Type=%X\n", walk_state, op, object_type));
-
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "State=%p Op=%p Type=%X\n", walk_state, op,
+                         object_type));
 
        switch (walk_state->opcode) {
        case AML_FIELD_OP:
@@ -542,9 +552,10 @@ acpi_ds_load2_begin_op (
                 * Don't enter the name into the namespace, but look it up
                 * for use later.
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-                                 walk_state, &(node));
+               status =
+                   acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+                                  object_type, ACPI_IMODE_EXECUTE,
+                                  ACPI_NS_SEARCH_PARENT, walk_state, &(node));
                break;
 
        case AML_SCOPE_OP:
@@ -554,28 +565,28 @@ acpi_ds_load2_begin_op (
                 * Don't enter the name into the namespace, but look it up
                 * for use later.
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-                                 walk_state, &(node));
-               if (ACPI_FAILURE (status)) {
-#ifdef _ACPI_ASL_COMPILER
+               status =
+                   acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+                                  object_type, ACPI_IMODE_EXECUTE,
+                                  ACPI_NS_SEARCH_PARENT, walk_state, &(node));
+               if (ACPI_FAILURE(status)) {
+#ifdef ACPI_ASL_COMPILER
                        if (status == AE_NOT_FOUND) {
                                status = AE_OK;
-                       }
-                       else {
-                               ACPI_REPORT_NSERROR (buffer_ptr, status);
+                       } else {
+                               ACPI_REPORT_NSERROR(buffer_ptr, status);
                        }
 #else
-                       ACPI_REPORT_NSERROR (buffer_ptr, status);
+                       ACPI_REPORT_NSERROR(buffer_ptr, status);
 #endif
-                       return_ACPI_STATUS (status);
+                       return_ACPI_STATUS(status);
                }
                /*
                 * We must check to make sure that the target is
                 * one of the opcodes that actually opens a scope
                 */
                switch (node->type) {
-               case ACPI_TYPE_LOCAL_SCOPE:         /* Scope */
+               case ACPI_TYPE_LOCAL_SCOPE:     /* Scope */
                case ACPI_TYPE_DEVICE:
                case ACPI_TYPE_POWER:
                case ACPI_TYPE_PROCESSOR:
@@ -596,9 +607,7 @@ acpi_ds_load2_begin_op (
                         *  Scope (DEB) { ... }
                         */
 
-                       ACPI_REPORT_WARNING ((
-                               "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
-                               buffer_ptr, acpi_ut_get_type_name (node->type)));
+                       ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type)));
 
                        node->type = ACPI_TYPE_ANY;
                        walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -608,9 +617,7 @@ acpi_ds_load2_begin_op (
 
                        /* All other types are an error */
 
-                       ACPI_REPORT_ERROR ((
-                               "Invalid type (%s) for target of Scope operator [%4.4s]\n",
-                               acpi_ut_get_type_name (node->type), buffer_ptr));
+                       ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr));
 
                        return (AE_AML_OPERAND_TYPE);
                }
@@ -625,14 +632,16 @@ acpi_ds_load2_begin_op (
 
                        node = op->common.node;
 
-                       if (acpi_ns_opens_scope (object_type)) {
-                               status = acpi_ds_scope_stack_push (node, object_type, walk_state);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                       if (acpi_ns_opens_scope(object_type)) {
+                               status =
+                                   acpi_ds_scope_stack_push(node, object_type,
+                                                            walk_state);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
                                }
 
                        }
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /*
@@ -651,24 +660,26 @@ acpi_ds_load2_begin_op (
                        break;
                }
 
-               status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
-                                 walk_state, &(node));
+               /* Add new entry into namespace */
+
+               status =
+                   acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
+                                  object_type, ACPI_IMODE_LOAD_PASS2,
+                                  ACPI_NS_NO_UPSEARCH, walk_state, &(node));
                break;
        }
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_NSERROR (buffer_ptr, status);
-               return_ACPI_STATUS (status);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_NSERROR(buffer_ptr, status);
+               return_ACPI_STATUS(status);
        }
 
-
        if (!op) {
                /* Create a new op */
 
-               op = acpi_ps_alloc_op (walk_state->opcode);
+               op = acpi_ps_alloc_op(walk_state->opcode);
                if (!op) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Initialize the new op */
@@ -676,9 +687,7 @@ acpi_ds_load2_begin_op (
                if (node) {
                        op->named.name = node->name.integer;
                }
-               if (out_op) {
-                       *out_op = op;
-               }
+               *out_op = op;
        }
 
        /*
@@ -687,10 +696,9 @@ acpi_ds_load2_begin_op (
         */
        op->common.node = node;
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_load2_end_op
@@ -704,39 +712,54 @@ acpi_ds_load2_begin_op (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_load2_end_op (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
 {
-       union acpi_parse_object         *op;
-       acpi_status                     status = AE_OK;
-       acpi_object_type                object_type;
-       struct acpi_namespace_node      *node;
-       union acpi_parse_object         *arg;
-       struct acpi_namespace_node      *new_node;
+       union acpi_parse_object *op;
+       acpi_status status = AE_OK;
+       acpi_object_type object_type;
+       struct acpi_namespace_node *node;
+       union acpi_parse_object *arg;
+       struct acpi_namespace_node *new_node;
 #ifndef ACPI_NO_METHOD_EXECUTION
-       u32                             i;
+       u32 i;
 #endif
 
-
-       ACPI_FUNCTION_TRACE ("ds_load2_end_op");
+       ACPI_FUNCTION_TRACE("ds_load2_end_op");
 
        op = walk_state->op;
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
-                       walk_state->op_info->name, op, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
+                         walk_state->op_info->name, op, walk_state));
 
-       /* Only interested in opcodes that have namespace objects */
+       /* Check if opcode had an associated namespace object */
 
        if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
-               return_ACPI_STATUS (AE_OK);
+#ifndef ACPI_NO_METHOD_EXECUTION
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+               /* No namespace object. Executable opcode? */
+
+               if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                   (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                         "End/EXEC:   %s (fl %8.8X)\n",
+                                         walk_state->op_info->name,
+                                         walk_state->op_info->flags));
+
+                       /* Executing a type1 or type2 opcode outside of a method */
+
+                       status = acpi_ds_exec_end_op(walk_state);
+                       return_ACPI_STATUS(status);
+               }
+#endif
+#endif
+               return_ACPI_STATUS(AE_OK);
        }
 
        if (op->common.aml_opcode == AML_SCOPE_OP) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "Ending scope Op=%p State=%p\n", op, walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "Ending scope Op=%p State=%p\n", op,
+                                 walk_state));
        }
 
-
        object_type = walk_state->op_info->object_type;
 
        /*
@@ -749,18 +772,19 @@ acpi_ds_load2_end_op (
         * Put the Node on the object stack (Contains the ACPI Name of
         * this object)
         */
-       walk_state->operands[0] = (void *) node;
+       walk_state->operands[0] = (void *)node;
        walk_state->num_operands = 1;
 
        /* Pop the scope stack */
 
-       if (acpi_ns_opens_scope (object_type) &&
-          (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
-                       acpi_ut_get_type_name (object_type), op));
+       if (acpi_ns_opens_scope(object_type) &&
+           (op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "(%s) Popping scope for Op %p\n",
+                                 acpi_ut_get_type_name(object_type), op));
 
-               status = acpi_ds_scope_stack_pop (walk_state);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ds_scope_stack_pop(walk_state);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
        }
@@ -793,9 +817,10 @@ acpi_ds_load2_end_op (
         * AML_THERMALZONE
         */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "Create-Load [%s] State=%p Op=%p named_obj=%p\n",
-               acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "Create-Load [%s] State=%p Op=%p named_obj=%p\n",
+                         acpi_ps_get_opcode_name(op->common.aml_opcode),
+                         walk_state, op, node));
 
        /* Decode the opcode */
 
@@ -810,27 +835,32 @@ acpi_ds_load2_end_op (
                 * Create the field object, but the field buffer and index must
                 * be evaluated later during the execution phase
                 */
-               status = acpi_ds_create_buffer_field (op, walk_state);
+               status = acpi_ds_create_buffer_field(op, walk_state);
                break;
 
-
-        case AML_TYPE_NAMED_FIELD:
+       case AML_TYPE_NAMED_FIELD:
 
                switch (op->common.aml_opcode) {
                case AML_INDEX_FIELD_OP:
 
-                       status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
-                                        walk_state);
+                       status =
+                           acpi_ds_create_index_field(op,
+                                                      (acpi_handle) arg->
+                                                      common.node, walk_state);
                        break;
 
                case AML_BANK_FIELD_OP:
 
-                       status = acpi_ds_create_bank_field (op, arg->common.node, walk_state);
+                       status =
+                           acpi_ds_create_bank_field(op, arg->common.node,
+                                                     walk_state);
                        break;
 
                case AML_FIELD_OP:
 
-                       status = acpi_ds_create_field (op, arg->common.node, walk_state);
+                       status =
+                           acpi_ds_create_field(op, arg->common.node,
+                                                walk_state);
                        break;
 
                default:
@@ -839,43 +869,42 @@ acpi_ds_load2_end_op (
                }
                break;
 
+       case AML_TYPE_NAMED_SIMPLE:
 
-        case AML_TYPE_NAMED_SIMPLE:
-
-               status = acpi_ds_create_operands (walk_state, arg);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ds_create_operands(walk_state, arg);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
                switch (op->common.aml_opcode) {
                case AML_PROCESSOR_OP:
 
-                       status = acpi_ex_create_processor (walk_state);
+                       status = acpi_ex_create_processor(walk_state);
                        break;
 
                case AML_POWER_RES_OP:
 
-                       status = acpi_ex_create_power_resource (walk_state);
+                       status = acpi_ex_create_power_resource(walk_state);
                        break;
 
                case AML_MUTEX_OP:
 
-                       status = acpi_ex_create_mutex (walk_state);
+                       status = acpi_ex_create_mutex(walk_state);
                        break;
 
                case AML_EVENT_OP:
 
-                       status = acpi_ex_create_event (walk_state);
+                       status = acpi_ex_create_event(walk_state);
                        break;
 
                case AML_DATA_REGION_OP:
 
-                       status = acpi_ex_create_table_region (walk_state);
+                       status = acpi_ex_create_table_region(walk_state);
                        break;
 
                case AML_ALIAS_OP:
 
-                       status = acpi_ex_create_alias (walk_state);
+                       status = acpi_ex_create_alias(walk_state);
                        break;
 
                default:
@@ -888,12 +917,12 @@ acpi_ds_load2_end_op (
                /* Delete operands */
 
                for (i = 1; i < walk_state->num_operands; i++) {
-                       acpi_ut_remove_reference (walk_state->operands[i]);
+                       acpi_ut_remove_reference(walk_state->operands[i]);
                        walk_state->operands[i] = NULL;
                }
 
                break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
+#endif                         /* ACPI_NO_METHOD_EXECUTION */
 
        case AML_TYPE_NAMED_COMPLEX:
 
@@ -909,9 +938,10 @@ acpi_ds_load2_end_op (
                         * If we have a valid region, initialize it
                         * Namespace is NOT locked at this point.
                         */
-                       status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
-                                        FALSE);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ev_initialize_region
+                           (acpi_ns_get_attached_object(node), FALSE);
+                       if (ACPI_FAILURE(status)) {
                                /*
                                 *  If AE_NOT_EXIST is returned, it is not fatal
                                 *  because many regions get created before a handler
@@ -923,13 +953,11 @@ acpi_ds_load2_end_op (
                        }
                        break;
 
-
                case AML_NAME_OP:
 
-                       status = acpi_ds_create_node (walk_state, node, op);
+                       status = acpi_ds_create_node(walk_state, node, op);
                        break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
-
+#endif                         /* ACPI_NO_METHOD_EXECUTION */
 
                default:
                        /* All NAMED_COMPLEX opcodes must be handled above */
@@ -938,27 +966,29 @@ acpi_ds_load2_end_op (
                }
                break;
 
-
        case AML_CLASS_INTERNAL:
 
                /* case AML_INT_NAMEPATH_OP: */
                break;
 
-
        case AML_CLASS_METHOD_CALL:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-                       "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
-                       walk_state, op, node));
+               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                                 "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
+                                 walk_state, op, node));
 
                /*
                 * Lookup the method name and save the Node
                 */
-               status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
-                                 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
-                                 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                                 walk_state, &(new_node));
-               if (ACPI_SUCCESS (status)) {
+               status =
+                   acpi_ns_lookup(walk_state->scope_info,
+                                  arg->common.value.string, ACPI_TYPE_ANY,
+                                  ACPI_IMODE_LOAD_PASS2,
+                                  ACPI_NS_SEARCH_PARENT |
+                                  ACPI_NS_DONT_OPEN_SCOPE, walk_state,
+                                  &(new_node));
+               if (ACPI_SUCCESS(status)) {
+
                        /*
                         * Make sure that what we found is indeed a method
                         * We didn't search for a method on purpose, to see if the name
@@ -973,24 +1003,20 @@ acpi_ds_load2_end_op (
                         * parser uses, so we can get it again at the end of this scope
                         */
                        op->common.node = new_node;
-               }
-               else {
-                       ACPI_REPORT_NSERROR (arg->common.value.string, status);
+               } else {
+                       ACPI_REPORT_NSERROR(arg->common.value.string, status);
                }
                break;
 
-
        default:
                break;
        }
 
-cleanup:
+      cleanup:
 
        /* Remove the Node pushed at the very beginning */
 
        walk_state->operands[0] = NULL;
        walk_state->num_operands = 0;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 21f4548ff323f9c19af28d8973a845c558cbf5bf..defe956ef7517ebc46a968dfe8d770bf9fa0f6ef 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dswscope")
-
+ACPI_MODULE_NAME("dswscope")
 
 /****************************************************************************
  *
  *              root scope object (which remains at the stack top.)
  *
  ***************************************************************************/
-
-void
-acpi_ds_scope_stack_clear (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *scope_info;
-
-       ACPI_FUNCTION_NAME ("ds_scope_stack_clear");
+       union acpi_generic_state *scope_info;
 
+       ACPI_FUNCTION_NAME("ds_scope_stack_clear");
 
        while (walk_state->scope_info) {
                /* Pop a scope off the stack */
@@ -78,14 +71,14 @@ acpi_ds_scope_stack_clear (
                scope_info = walk_state->scope_info;
                walk_state->scope_info = scope_info->scope.next;
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Popped object type (%s)\n",
-                       acpi_ut_get_type_name (scope_info->common.value)));
-               acpi_ut_delete_generic_state (scope_info);
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Popped object type (%s)\n",
+                                 acpi_ut_get_type_name(scope_info->common.
+                                                       value)));
+               acpi_ut_delete_generic_state(scope_info);
        }
 }
 
-
 /****************************************************************************
  *
  * FUNCTION:    acpi_ds_scope_stack_push
@@ -102,74 +95,70 @@ acpi_ds_scope_stack_clear (
  ***************************************************************************/
 
 acpi_status
-acpi_ds_scope_stack_push (
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
+                        acpi_object_type type,
+                        struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *scope_info;
-       union acpi_generic_state        *old_scope_info;
-
-
-       ACPI_FUNCTION_TRACE ("ds_scope_stack_push");
+       union acpi_generic_state *scope_info;
+       union acpi_generic_state *old_scope_info;
 
+       ACPI_FUNCTION_TRACE("ds_scope_stack_push");
 
        if (!node) {
                /* Invalid scope   */
 
-               ACPI_REPORT_ERROR (("ds_scope_stack_push: null scope passed\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Make sure object type is valid */
 
-       if (!acpi_ut_valid_object_type (type)) {
-               ACPI_REPORT_WARNING ((
-                       "ds_scope_stack_push: Invalid object type: 0x%X\n", type));
+       if (!acpi_ut_valid_object_type(type)) {
+               ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
        }
 
        /* Allocate a new scope object */
 
-       scope_info = acpi_ut_create_generic_state ();
+       scope_info = acpi_ut_create_generic_state();
        if (!scope_info) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Init new scope object */
 
        scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
-       scope_info->scope.node      = node;
-       scope_info->common.value    = (u16) type;
+       scope_info->scope.node = node;
+       scope_info->common.value = (u16) type;
 
        walk_state->scope_depth++;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "[%.2d] Pushed scope ", (u32) walk_state->scope_depth));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "[%.2d] Pushed scope ",
+                         (u32) walk_state->scope_depth));
 
        old_scope_info = walk_state->scope_info;
        if (old_scope_info) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-                       "[%4.4s] (%s)",
-                       acpi_ut_get_node_name (old_scope_info->scope.node),
-                       acpi_ut_get_type_name (old_scope_info->common.value)));
-       }
-       else {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-                       "[\\___] (%s)", "ROOT"));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+                                     "[%4.4s] (%s)",
+                                     acpi_ut_get_node_name(old_scope_info->
+                                                           scope.node),
+                                     acpi_ut_get_type_name(old_scope_info->
+                                                           common.value)));
+       } else {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT"));
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-               ", New scope -> [%4.4s] (%s)\n",
-               acpi_ut_get_node_name (scope_info->scope.node),
-               acpi_ut_get_type_name (scope_info->common.value)));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+                             ", New scope -> [%4.4s] (%s)\n",
+                             acpi_ut_get_node_name(scope_info->scope.node),
+                             acpi_ut_get_type_name(scope_info->common.value)));
 
        /* Push new scope object onto stack */
 
-       acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
-       return_ACPI_STATUS (AE_OK);
+       acpi_ut_push_generic_state(&walk_state->scope_info, scope_info);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /****************************************************************************
  *
  * FUNCTION:    acpi_ds_scope_stack_pop
@@ -182,47 +171,41 @@ acpi_ds_scope_stack_push (
  *
  ***************************************************************************/
 
-acpi_status
-acpi_ds_scope_stack_pop (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *scope_info;
-       union acpi_generic_state        *new_scope_info;
-
-
-       ACPI_FUNCTION_TRACE ("ds_scope_stack_pop");
+       union acpi_generic_state *scope_info;
+       union acpi_generic_state *new_scope_info;
 
+       ACPI_FUNCTION_TRACE("ds_scope_stack_pop");
 
        /*
         * Pop scope info object off the stack.
         */
-       scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info);
+       scope_info = acpi_ut_pop_generic_state(&walk_state->scope_info);
        if (!scope_info) {
-               return_ACPI_STATUS (AE_STACK_UNDERFLOW);
+               return_ACPI_STATUS(AE_STACK_UNDERFLOW);
        }
 
        walk_state->scope_depth--;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
-               (u32) walk_state->scope_depth,
-               acpi_ut_get_node_name (scope_info->scope.node),
-               acpi_ut_get_type_name (scope_info->common.value)));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
+                         (u32) walk_state->scope_depth,
+                         acpi_ut_get_node_name(scope_info->scope.node),
+                         acpi_ut_get_type_name(scope_info->common.value)));
 
        new_scope_info = walk_state->scope_info;
        if (new_scope_info) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-                       "[%4.4s] (%s)\n",
-                       acpi_ut_get_node_name (new_scope_info->scope.node),
-                       acpi_ut_get_type_name (new_scope_info->common.value)));
-       }
-       else {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
-                       "[\\___] (ROOT)\n"));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
+                                     "[%4.4s] (%s)\n",
+                                     acpi_ut_get_node_name(new_scope_info->
+                                                           scope.node),
+                                     acpi_ut_get_type_name(new_scope_info->
+                                                           common.value)));
+       } else {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n"));
        }
 
-       acpi_ut_delete_generic_state (scope_info);
-       return_ACPI_STATUS (AE_OK);
+       acpi_ut_delete_generic_state(scope_info);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 9cd3db652b31cf622fb029522a4bebedc44c37d7..7d68a5aaf3c43bb6423b1d8a33dfdb54bc625840 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_DISPATCHER
-        ACPI_MODULE_NAME    ("dswstate")
+ACPI_MODULE_NAME("dswstate")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 acpi_status
-acpi_ds_result_insert (
-       void                            *object,
-       u32                             index,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_result_insert(void *object,
+                     u32 index, struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ds_obj_stack_delete_all (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_obj_stack_pop_object (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state);
-
-void *
-acpi_ds_obj_stack_get_value (
-       u32                             index,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
+                            struct acpi_walk_state *walk_state);
+
+void *acpi_ds_obj_stack_get_value(u32 index,
+                                 struct acpi_walk_state *walk_state);
 #endif
 
 #ifdef ACPI_FUTURE_USAGE
@@ -92,36 +83,35 @@ acpi_ds_obj_stack_get_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_remove (
-       union acpi_operand_object       **object,
-       u32                             index,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_result_remove(union acpi_operand_object **object,
+                     u32 index, struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_NAME ("ds_result_remove");
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_remove");
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No result object pushed! State=%p\n",
+                                 walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (index >= ACPI_OBJ_MAX_OPERAND) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Index out of range: %X State=%p Num=%X\n",
-                       index, walk_state, state->results.num_results));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Index out of range: %X State=%p Num=%X\n",
+                                 index, walk_state,
+                                 state->results.num_results));
        }
 
        /* Check for a valid result object */
 
-       if (!state->results.obj_desc [index]) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null operand! State=%p #Ops=%X, Index=%X\n",
-                       walk_state, state->results.num_results, index));
+       if (!state->results.obj_desc[index]) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null operand! State=%p #Ops=%X, Index=%X\n",
+                                 walk_state, state->results.num_results,
+                                 index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -129,18 +119,20 @@ acpi_ds_result_remove (
 
        state->results.num_results--;
 
-       *object = state->results.obj_desc [index];
-       state->results.obj_desc [index] = NULL;
+       *object = state->results.obj_desc[index];
+       state->results.obj_desc[index] = NULL;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "Obj=%p [%s] Index=%X State=%p Num=%X\n",
-               *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
-               index, walk_state, state->results.num_results));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+                         *object,
+                         (*object) ? acpi_ut_get_object_type_name(*object) :
+                         "NULL", index, walk_state,
+                         state->results.num_results));
 
        return (AE_OK);
 }
 
-#endif  /*  ACPI_FUTURE_USAGE  */
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -157,16 +149,13 @@ acpi_ds_result_remove (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_pop (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_result_pop(union acpi_operand_object ** object,
+                  struct acpi_walk_state * walk_state)
 {
-       acpi_native_uint                index;
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_NAME ("ds_result_pop");
+       acpi_native_uint index;
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_pop");
 
        state = walk_state->results;
        if (!state) {
@@ -174,8 +163,9 @@ acpi_ds_result_pop (
        }
 
        if (!state->results.num_results) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Result stack is empty! State=%p\n",
+                                 walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
@@ -186,26 +176,27 @@ acpi_ds_result_pop (
        for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) {
                /* Check for a valid result object */
 
-               if (state->results.obj_desc [index -1]) {
-                       *object = state->results.obj_desc [index -1];
-                       state->results.obj_desc [index -1] = NULL;
+               if (state->results.obj_desc[index - 1]) {
+                       *object = state->results.obj_desc[index - 1];
+                       state->results.obj_desc[index - 1] = NULL;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "Obj=%p [%s] Index=%X State=%p Num=%X\n",
-                               *object,
-                               (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
-                               (u32) index -1, walk_state, state->results.num_results));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "Obj=%p [%s] Index=%X State=%p Num=%X\n",
+                                         *object,
+                                         (*object) ?
+                                         acpi_ut_get_object_type_name(*object)
+                                         : "NULL", (u32) index - 1, walk_state,
+                                         state->results.num_results));
 
                        return (AE_OK);
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-               "No result objects! State=%p\n", walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "No result objects! State=%p\n", walk_state));
        return (AE_AML_NO_RETURN_VALUE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_result_pop_from_bottom
@@ -221,38 +212,37 @@ acpi_ds_result_pop (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_pop_from_bottom (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
+                              struct acpi_walk_state * walk_state)
 {
-       acpi_native_uint                index;
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_NAME ("ds_result_pop_from_bottom");
+       acpi_native_uint index;
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_pop_from_bottom");
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Warning: No result object pushed! State=%p\n", walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Warning: No result object pushed! State=%p\n",
+                                 walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (!state->results.num_results) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No result objects! State=%p\n", walk_state));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
        /* Remove Bottom element */
 
-       *object = state->results.obj_desc [0];
+       *object = state->results.obj_desc[0];
 
        /* Push entire stack down one element */
 
        for (index = 0; index < state->results.num_results; index++) {
-               state->results.obj_desc [index] = state->results.obj_desc [index + 1];
+               state->results.obj_desc[index] =
+                   state->results.obj_desc[index + 1];
        }
 
        state->results.num_results--;
@@ -260,20 +250,21 @@ acpi_ds_result_pop_from_bottom (
        /* Check for a valid result object */
 
        if (!*object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null operand! State=%p #Ops=%X, Index=%X\n",
-                       walk_state, state->results.num_results, (u32) index));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null operand! State=%p #Ops=%X Index=%X\n",
+                                 walk_state, state->results.num_results,
+                                 (u32) index));
                return (AE_AML_NO_RETURN_VALUE);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
-               *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
-               state, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
+                         *object,
+                         (*object) ? acpi_ut_get_object_type_name(*object) :
+                         "NULL", state, walk_state));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_result_push
@@ -288,47 +279,50 @@ acpi_ds_result_pop_from_bottom (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_push (
-       union acpi_operand_object       *object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_result_push(union acpi_operand_object * object,
+                   struct acpi_walk_state * walk_state)
 {
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_NAME ("ds_result_push");
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_push");
 
        state = walk_state->results;
        if (!state) {
-               ACPI_REPORT_ERROR (("No result stack frame during push\n"));
+               ACPI_REPORT_ERROR(("No result stack frame during push\n"));
                return (AE_AML_INTERNAL);
        }
 
        if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Result stack overflow: Obj=%p State=%p Num=%X\n",
-                       object, walk_state, state->results.num_results));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Result stack overflow: Obj=%p State=%p Num=%X\n",
+                                 object, walk_state,
+                                 state->results.num_results));
                return (AE_STACK_OVERFLOW);
        }
 
        if (!object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null Object! Obj=%p State=%p Num=%X\n",
-                       object, walk_state, state->results.num_results));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null Object! Obj=%p State=%p Num=%X\n",
+                                 object, walk_state,
+                                 state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
-       state->results.obj_desc [state->results.num_results] = object;
+       state->results.obj_desc[state->results.num_results] = object;
        state->results.num_results++;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
-               object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
-               walk_state, state->results.num_results, walk_state->current_result));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+                         object,
+                         object ?
+                         acpi_ut_get_object_type_name((union
+                                                       acpi_operand_object *)
+                                                      object) : "NULL",
+                         walk_state, state->results.num_results,
+                         walk_state->current_result));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_result_stack_push
@@ -341,30 +335,26 @@ acpi_ds_result_push (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_result_stack_push (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state)
 {
-       union acpi_generic_state        *state;
-
-       ACPI_FUNCTION_NAME ("ds_result_stack_push");
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_stack_push");
 
-       state = acpi_ut_create_generic_state ();
+       state = acpi_ut_create_generic_state();
        if (!state) {
                return (AE_NO_MEMORY);
        }
 
        state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT;
-       acpi_ut_push_generic_state (&walk_state->results, state);
+       acpi_ut_push_generic_state(&walk_state->results, state);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
-               state, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n",
+                         state, walk_state));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_result_stack_pop
@@ -377,35 +367,31 @@ acpi_ds_result_stack_push (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_result_stack_pop (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state)
 {
-       union acpi_generic_state        *state;
-
-       ACPI_FUNCTION_NAME ("ds_result_stack_pop");
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_stack_pop");
 
        /* Check for stack underflow */
 
        if (walk_state->results == NULL) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Underflow - State=%p\n",
+                                 walk_state));
                return (AE_AML_NO_OPERAND);
        }
 
-       state = acpi_ut_pop_generic_state (&walk_state->results);
+       state = acpi_ut_pop_generic_state(&walk_state->results);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "Result=%p remaining_results=%X State=%p\n",
-               state, state->results.num_results, walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Result=%p remaining_results=%X State=%p\n",
+                         state, state->results.num_results, walk_state));
 
-       acpi_ut_delete_generic_state (state);
+       acpi_ut_delete_generic_state(state);
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_push
@@ -420,35 +406,35 @@ acpi_ds_result_stack_pop (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_push (
-       void                            *object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
 {
-       ACPI_FUNCTION_NAME ("ds_obj_stack_push");
-
+       ACPI_FUNCTION_NAME("ds_obj_stack_push");
 
        /* Check for stack overflow */
 
        if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "overflow! Obj=%p State=%p #Ops=%X\n",
-                       object, walk_state, walk_state->num_operands));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "overflow! Obj=%p State=%p #Ops=%X\n",
+                                 object, walk_state,
+                                 walk_state->num_operands));
                return (AE_STACK_OVERFLOW);
        }
 
        /* Put the object onto the stack */
 
-       walk_state->operands [walk_state->num_operands] = object;
+       walk_state->operands[walk_state->num_operands] = object;
        walk_state->num_operands++;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
-                         object, acpi_ut_get_object_type_name ((union acpi_operand_object *) object),
-                         walk_state, walk_state->num_operands));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+                         object,
+                         acpi_ut_get_object_type_name((union
+                                                       acpi_operand_object *)
+                                                      object), walk_state,
+                         walk_state->num_operands));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_pop
@@ -464,38 +450,35 @@ acpi_ds_obj_stack_push (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_pop (
-       u32                             pop_count,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
 {
-       u32                             i;
-
-       ACPI_FUNCTION_NAME ("ds_obj_stack_pop");
+       u32 i;
 
+       ACPI_FUNCTION_NAME("ds_obj_stack_pop");
 
        for (i = 0; i < pop_count; i++) {
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Underflow! Count=%X State=%p #Ops=%X\n",
-                               pop_count, walk_state, walk_state->num_operands));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Underflow! Count=%X State=%p #Ops=%X\n",
+                                         pop_count, walk_state,
+                                         walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
                /* Just set the stack entry to null */
 
                walk_state->num_operands--;
-               walk_state->operands [walk_state->num_operands] = NULL;
+               walk_state->operands[walk_state->num_operands] = NULL;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
                          pop_count, walk_state, walk_state->num_operands));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_pop_and_delete
@@ -511,44 +494,43 @@ acpi_ds_obj_stack_pop (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_pop_and_delete (
-       u32                             pop_count,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
+                                struct acpi_walk_state * walk_state)
 {
-       u32                             i;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_NAME ("ds_obj_stack_pop_and_delete");
+       u32 i;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete");
 
        for (i = 0; i < pop_count; i++) {
                /* Check for stack underflow */
 
                if (walk_state->num_operands == 0) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Underflow! Count=%X State=%p #Ops=%X\n",
-                               pop_count, walk_state, walk_state->num_operands));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Underflow! Count=%X State=%p #Ops=%X\n",
+                                         pop_count, walk_state,
+                                         walk_state->num_operands));
                        return (AE_STACK_UNDERFLOW);
                }
 
                /* Pop the stack and delete an object if present in this stack entry */
 
                walk_state->num_operands--;
-               obj_desc = walk_state->operands [walk_state->num_operands];
+               obj_desc = walk_state->operands[walk_state->num_operands];
                if (obj_desc) {
-                       acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]);
-                       walk_state->operands [walk_state->num_operands] = NULL;
+                       acpi_ut_remove_reference(walk_state->
+                                                operands[walk_state->
+                                                         num_operands]);
+                       walk_state->operands[walk_state->num_operands] = NULL;
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
                          pop_count, walk_state, walk_state->num_operands));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_get_current_walk_state
@@ -562,25 +544,21 @@ acpi_ds_obj_stack_pop_and_delete (
  *
  ******************************************************************************/
 
-struct acpi_walk_state *
-acpi_ds_get_current_walk_state (
-       struct acpi_thread_state        *thread)
-
+struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
+                                                      *thread)
 {
-       ACPI_FUNCTION_NAME ("ds_get_current_walk_state");
-
+       ACPI_FUNCTION_NAME("ds_get_current_walk_state");
 
        if (!thread) {
                return (NULL);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current walk_state %p\n",
-               thread->walk_state_list));
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n",
+                         thread->walk_state_list));
 
        return (thread->walk_state_list);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_push_walk_state
@@ -595,20 +573,17 @@ acpi_ds_get_current_walk_state (
  ******************************************************************************/
 
 void
-acpi_ds_push_walk_state (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_thread_state        *thread)
+acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
+                       struct acpi_thread_state *thread)
 {
-       ACPI_FUNCTION_TRACE ("ds_push_walk_state");
-
+       ACPI_FUNCTION_TRACE("ds_push_walk_state");
 
-       walk_state->next      = thread->walk_state_list;
+       walk_state->next = thread->walk_state_list;
        thread->walk_state_list = walk_state;
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_pop_walk_state
@@ -623,15 +598,11 @@ acpi_ds_push_walk_state (
  *
  ******************************************************************************/
 
-struct acpi_walk_state *
-acpi_ds_pop_walk_state (
-       struct acpi_thread_state        *thread)
+struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
 {
-       struct acpi_walk_state          *walk_state;
-
-
-       ACPI_FUNCTION_TRACE ("ds_pop_walk_state");
+       struct acpi_walk_state *walk_state;
 
+       ACPI_FUNCTION_TRACE("ds_pop_walk_state");
 
        walk_state = thread->walk_state_list;
 
@@ -647,10 +618,9 @@ acpi_ds_pop_walk_state (
                 */
        }
 
-       return_PTR (walk_state);
+       return_PTR(walk_state);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_create_walk_state
@@ -667,57 +637,55 @@ acpi_ds_pop_walk_state (
  *
  ******************************************************************************/
 
-struct acpi_walk_state *
-acpi_ds_create_walk_state (
-       acpi_owner_id                   owner_id,
-       union acpi_parse_object         *origin,
-       union acpi_operand_object       *mth_desc,
-       struct acpi_thread_state        *thread)
+struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
+                                                 union acpi_parse_object
+                                                 *origin,
+                                                 union acpi_operand_object
+                                                 *mth_desc,
+                                                 struct acpi_thread_state
+                                                 *thread)
 {
-       struct acpi_walk_state          *walk_state;
-       acpi_status                     status;
-
+       struct acpi_walk_state *walk_state;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ds_create_walk_state");
+       ACPI_FUNCTION_TRACE("ds_create_walk_state");
 
-
-       walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);
+       walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state));
        if (!walk_state) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
-       walk_state->data_type       = ACPI_DESC_TYPE_WALK;
-       walk_state->owner_id        = owner_id;
-       walk_state->origin          = origin;
-       walk_state->method_desc     = mth_desc;
-       walk_state->thread          = thread;
+       walk_state->data_type = ACPI_DESC_TYPE_WALK;
+       walk_state->owner_id = owner_id;
+       walk_state->origin = origin;
+       walk_state->method_desc = mth_desc;
+       walk_state->thread = thread;
 
        walk_state->parser_state.start_op = origin;
 
        /* Init the method args/local */
 
 #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
-       acpi_ds_method_data_init (walk_state);
+       acpi_ds_method_data_init(walk_state);
 #endif
 
        /* Create an initial result stack entry */
 
-       status = acpi_ds_result_stack_push (walk_state);
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
-               return_PTR (NULL);
+       status = acpi_ds_result_stack_push(walk_state);
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(walk_state);
+               return_PTR(NULL);
        }
 
        /* Put the new state at the head of the walk list */
 
        if (thread) {
-               acpi_ds_push_walk_state (walk_state, thread);
+               acpi_ds_push_walk_state(walk_state, thread);
        }
 
-       return_PTR (walk_state);
+       return_PTR(walk_state);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_init_aml_walk
@@ -737,70 +705,70 @@ acpi_ds_create_walk_state (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_init_aml_walk (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *method_node,
-       u8                              *aml_start,
-       u32                             aml_length,
-       struct acpi_parameter_info      *info,
-       u32                             pass_number)
+acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
+                     union acpi_parse_object *op,
+                     struct acpi_namespace_node *method_node,
+                     u8 * aml_start,
+                     u32 aml_length,
+                     struct acpi_parameter_info *info, u8 pass_number)
 {
-       acpi_status                     status;
-       struct acpi_parse_state         *parser_state = &walk_state->parser_state;
-       union acpi_parse_object         *extra_op;
+       acpi_status status;
+       struct acpi_parse_state *parser_state = &walk_state->parser_state;
+       union acpi_parse_object *extra_op;
 
+       ACPI_FUNCTION_TRACE("ds_init_aml_walk");
 
-       ACPI_FUNCTION_TRACE ("ds_init_aml_walk");
-
-
-       walk_state->parser_state.aml    =
-       walk_state->parser_state.aml_start = aml_start;
+       walk_state->parser_state.aml =
+           walk_state->parser_state.aml_start = aml_start;
        walk_state->parser_state.aml_end =
-       walk_state->parser_state.pkg_end = aml_start + aml_length;
+           walk_state->parser_state.pkg_end = aml_start + aml_length;
 
        /* The next_op of the next_walk will be the beginning of the method */
 
        walk_state->next_op = NULL;
+       walk_state->pass_number = pass_number;
 
        if (info) {
                if (info->parameter_type == ACPI_PARAM_GPE) {
-                       walk_state->gpe_event_info = ACPI_CAST_PTR (struct acpi_gpe_event_info,
-                                          info->parameters);
-               }
-               else {
-                       walk_state->params          = info->parameters;
+                       walk_state->gpe_event_info =
+                           ACPI_CAST_PTR(struct acpi_gpe_event_info,
+                                         info->parameters);
+               else {
+                       walk_state->params = info->parameters;
                        walk_state->caller_return_desc = &info->return_object;
                }
        }
 
-       status = acpi_ps_init_scope (&walk_state->parser_state, op);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ps_init_scope(&walk_state->parser_state, op);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        if (method_node) {
                walk_state->parser_state.start_node = method_node;
-               walk_state->walk_type            = ACPI_WALK_METHOD;
-               walk_state->method_node          = method_node;
-               walk_state->method_desc          = acpi_ns_get_attached_object (method_node);
+               walk_state->walk_type = ACPI_WALK_METHOD;
+               walk_state->method_node = method_node;
+               walk_state->method_desc =
+                   acpi_ns_get_attached_object(method_node);
 
                /* Push start scope on scope stack and make it current  */
 
-               status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD,
+                                            walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Init the method arguments */
 
-               status = acpi_ds_method_data_init_args (walk_state->params,
-                                ACPI_METHOD_NUM_ARGS, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_method_data_init_args(walk_state->params,
+                                                      ACPI_METHOD_NUM_ARGS,
+                                                      walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
-       }
-       else {
+       } else {
                /*
                 * Setup the current scope.
                 * Find a Named Op that has a namespace node associated with it.
@@ -814,27 +782,27 @@ acpi_ds_init_aml_walk (
 
                if (!extra_op) {
                        parser_state->start_node = NULL;
-               }
-               else {
+               } else {
                        parser_state->start_node = extra_op->common.node;
                }
 
                if (parser_state->start_node) {
                        /* Push start scope on scope stack and make it current  */
 
-                       status = acpi_ds_scope_stack_push (parser_state->start_node,
-                                         parser_state->start_node->type, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status =
+                           acpi_ds_scope_stack_push(parser_state->start_node,
+                                                    parser_state->start_node->
+                                                    type, walk_state);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
        }
 
-       status = acpi_ds_init_callbacks (walk_state, pass_number);
-       return_ACPI_STATUS (status);
+       status = acpi_ds_init_callbacks(walk_state, pass_number);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_delete_walk_state
@@ -847,29 +815,27 @@ acpi_ds_init_aml_walk (
  *
  ******************************************************************************/
 
-void
-acpi_ds_delete_walk_state (
-       struct acpi_walk_state          *walk_state)
+void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_delete_walk_state", walk_state);
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state);
 
        if (!walk_state) {
                return;
        }
 
        if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%p is not a valid walk state\n",
+                                 walk_state));
                return;
        }
 
        if (walk_state->parser_state.scope) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%p walk still has a scope list\n",
+                                 walk_state));
        }
 
        /* Always must free any linked control states */
@@ -878,7 +844,7 @@ acpi_ds_delete_walk_state (
                state = walk_state->control_state;
                walk_state->control_state = state->common.next;
 
-               acpi_ut_delete_generic_state (state);
+               acpi_ut_delete_generic_state(state);
        }
 
        /* Always must free any linked parse states */
@@ -887,7 +853,7 @@ acpi_ds_delete_walk_state (
                state = walk_state->scope_info;
                walk_state->scope_info = state->common.next;
 
-               acpi_ut_delete_generic_state (state);
+               acpi_ut_delete_generic_state(state);
        }
 
        /* Always must free any stacked result states */
@@ -896,40 +862,12 @@ acpi_ds_delete_walk_state (
                state = walk_state->results;
                walk_state->results = state->common.next;
 
-               acpi_ut_delete_generic_state (state);
+               acpi_ut_delete_generic_state(state);
        }
 
-       acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
-       return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/******************************************************************************
- *
- * FUNCTION:    acpi_ds_delete_walk_state_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_ds_delete_walk_state_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
+       ACPI_MEM_FREE(walk_state);
        return_VOID;
 }
-#endif
-
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
@@ -947,50 +885,53 @@ acpi_ds_delete_walk_state_cache (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_result_insert (
-       void                            *object,
-       u32                             index,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_result_insert(void *object,
+                     u32 index, struct acpi_walk_state *walk_state)
 {
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_NAME ("ds_result_insert");
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_NAME("ds_result_insert");
 
        state = walk_state->results;
        if (!state) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
-                       walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No result object pushed! State=%p\n",
+                                 walk_state));
                return (AE_NOT_EXIST);
        }
 
        if (index >= ACPI_OBJ_NUM_OPERANDS) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Index out of range: %X Obj=%p State=%p Num=%X\n",
-                       index, object, walk_state, state->results.num_results));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Index out of range: %X Obj=%p State=%p Num=%X\n",
+                                 index, object, walk_state,
+                                 state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
        if (!object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
-                       index, object, walk_state, state->results.num_results));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
+                                 index, object, walk_state,
+                                 state->results.num_results));
                return (AE_BAD_PARAMETER);
        }
 
-       state->results.obj_desc [index] = object;
+       state->results.obj_desc[index] = object;
        state->results.num_results++;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
-               object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
-               walk_state, state->results.num_results, walk_state->current_result));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
+                         object,
+                         object ?
+                         acpi_ut_get_object_type_name((union
+                                                       acpi_operand_object *)
+                                                      object) : "NULL",
+                         walk_state, state->results.num_results,
+                         walk_state->current_result));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_delete_all
@@ -1004,29 +945,24 @@ acpi_ds_result_insert (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ds_obj_stack_delete_all (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state)
 {
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
+       u32 i;
 
+       ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state);
 
        /* The stack size is configurable, but fixed */
 
        for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
                if (walk_state->operands[i]) {
-                       acpi_ut_remove_reference (walk_state->operands[i]);
+                       acpi_ut_remove_reference(walk_state->operands[i]);
                        walk_state->operands[i] = NULL;
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_pop_object
@@ -1042,19 +978,17 @@ acpi_ds_obj_stack_delete_all (
  ******************************************************************************/
 
 acpi_status
-acpi_ds_obj_stack_pop_object (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state)
+acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
+                            struct acpi_walk_state *walk_state)
 {
-       ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
-
+       ACPI_FUNCTION_NAME("ds_obj_stack_pop_object");
 
        /* Check for stack underflow */
 
        if (walk_state->num_operands == 0) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Missing operand/stack empty! State=%p #Ops=%X\n",
-                       walk_state, walk_state->num_operands));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Missing operand/stack empty! State=%p #Ops=%X\n",
+                                 walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
@@ -1065,27 +999,26 @@ acpi_ds_obj_stack_pop_object (
 
        /* Check for a valid operand */
 
-       if (!walk_state->operands [walk_state->num_operands]) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null operand! State=%p #Ops=%X\n",
-                       walk_state, walk_state->num_operands));
+       if (!walk_state->operands[walk_state->num_operands]) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null operand! State=%p #Ops=%X\n",
+                                 walk_state, walk_state->num_operands));
                *object = NULL;
                return (AE_AML_NO_OPERAND);
        }
 
        /* Get operand and set stack entry to null */
 
-       *object = walk_state->operands [walk_state->num_operands];
-       walk_state->operands [walk_state->num_operands] = NULL;
+       *object = walk_state->operands[walk_state->num_operands];
+       walk_state->operands[walk_state->num_operands] = NULL;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
-                         *object, acpi_ut_get_object_type_name (*object),
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+                         *object, acpi_ut_get_object_type_name(*object),
                          walk_state, walk_state->num_operands));
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ds_obj_stack_get_value
@@ -1101,30 +1034,25 @@ acpi_ds_obj_stack_pop_object (
  *
  ******************************************************************************/
 
-void *
-acpi_ds_obj_stack_get_value (
-       u32                             index,
-       struct acpi_walk_state          *walk_state)
+void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state)
 {
 
-       ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
-
+       ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state);
 
        /* Can't do it if the stack is empty */
 
        if (walk_state->num_operands == 0) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        /* or if the index is past the top of the stack */
 
        if (index > (walk_state->num_operands - (u32) 1)) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
-       return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
-                         index]);
+       return_PTR(walk_state->
+                  operands[(acpi_native_uint) (walk_state->num_operands - 1) -
+                           index]);
 }
 #endif
-
-
index 1ac5731d45e5aece6a021e7bb548139a9034b9b5..7e1a445955bc1fd5a747038a4b2b1e867cf42b08 100644 (file)
 #include <acpi/actypes.h>
 
 #define _COMPONENT             ACPI_EC_COMPONENT
-ACPI_MODULE_NAME               ("acpi_ec")
-
+ACPI_MODULE_NAME("acpi_ec")
 #define ACPI_EC_COMPONENT              0x00100000
 #define ACPI_EC_CLASS                  "embedded_controller"
 #define ACPI_EC_HID                    "PNP0C09"
 #define ACPI_EC_DRIVER_NAME            "ACPI Embedded Controller Driver"
 #define ACPI_EC_DEVICE_NAME            "Embedded Controller"
 #define ACPI_EC_FILE_INFO              "info"
-
-
 #define ACPI_EC_FLAG_OBF       0x01    /* Output buffer full */
 #define ACPI_EC_FLAG_IBF       0x02    /* Input buffer full */
 #define ACPI_EC_FLAG_BURST     0x10    /* burst mode */
 #define ACPI_EC_FLAG_SCI       0x20    /* EC-SCI occurred */
-
 #define ACPI_EC_EVENT_OBF      0x01    /* Output buffer full */
 #define ACPI_EC_EVENT_IBE      0x02    /* Input buffer empty */
-
 #define ACPI_EC_DELAY          50      /* Wait 50ms max. during EC ops */
 #define ACPI_EC_UDELAY_GLK     1000    /* Wait 1ms max. to get global lock */
-
-#define ACPI_EC_UDELAY         100     /* Poll @ 100us increments */
-#define ACPI_EC_UDELAY_COUNT   1000    /* Wait 10ms max. during EC ops */
-
+#define ACPI_EC_UDELAY         100     /* Poll @ 100us increments */
+#define ACPI_EC_UDELAY_COUNT   1000    /* Wait 10ms max. during EC ops */
 #define ACPI_EC_COMMAND_READ   0x80
 #define ACPI_EC_COMMAND_WRITE  0x81
 #define ACPI_EC_BURST_ENABLE   0x82
 #define ACPI_EC_BURST_DISABLE  0x83
 #define ACPI_EC_COMMAND_QUERY  0x84
-
 #define EC_POLLING             0xFF
 #define EC_BURST               0x00
-
-
-static int acpi_ec_remove (struct acpi_device *device, int type);
-static int acpi_ec_start (struct acpi_device *device);
-static int acpi_ec_stop (struct acpi_device *device, int type);
-static int acpi_ec_burst_add ( struct acpi_device *device);
-static int acpi_ec_polling_add ( struct acpi_device    *device);
+static int acpi_ec_remove(struct acpi_device *device, int type);
+static int acpi_ec_start(struct acpi_device *device);
+static int acpi_ec_stop(struct acpi_device *device, int type);
+static int acpi_ec_burst_add(struct acpi_device *device);
+static int acpi_ec_polling_add(struct acpi_device *device);
 
 static struct acpi_driver acpi_ec_driver = {
-       .name =         ACPI_EC_DRIVER_NAME,
-       .class =        ACPI_EC_CLASS,
-       .ids =          ACPI_EC_HID,
-       .ops =          {
-                               .add =          acpi_ec_polling_add,
-                               .remove =       acpi_ec_remove,
-                               .start =        acpi_ec_start,
-                               .stop =         acpi_ec_stop,
-                       },
+       .name = ACPI_EC_DRIVER_NAME,
+       .class = ACPI_EC_CLASS,
+       .ids = ACPI_EC_HID,
+       .ops = {
+               .add = acpi_ec_polling_add,
+               .remove = acpi_ec_remove,
+               .start = acpi_ec_start,
+               .stop = acpi_ec_stop,
+               },
 };
 union acpi_ec {
        struct {
-               u32                             mode;
-               acpi_handle                     handle;
-               unsigned long                   uid;
-               unsigned long                   gpe_bit;
-               struct acpi_generic_address     status_addr;
-               struct acpi_generic_address     command_addr;
-               struct acpi_generic_address     data_addr;
-               unsigned long                   global_lock;
+               u32 mode;
+               acpi_handle handle;
+               unsigned long uid;
+               unsigned long gpe_bit;
+               struct acpi_generic_address status_addr;
+               struct acpi_generic_address command_addr;
+               struct acpi_generic_address data_addr;
+               unsigned long global_lock;
        } common;
 
        struct {
-               u32                             mode;
-               acpi_handle                     handle;
-               unsigned long                   uid;
-               unsigned long                   gpe_bit;
-               struct acpi_generic_address     status_addr;
-               struct acpi_generic_address     command_addr;
-               struct acpi_generic_address     data_addr;
-               unsigned long                   global_lock;
-               unsigned int                    expect_event;
-               atomic_t                        leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/
-               atomic_t                        pending_gpe;
-               struct semaphore                sem;
-               wait_queue_head_t               wait;
-       }burst;
+               u32 mode;
+               acpi_handle handle;
+               unsigned long uid;
+               unsigned long gpe_bit;
+               struct acpi_generic_address status_addr;
+               struct acpi_generic_address command_addr;
+               struct acpi_generic_address data_addr;
+               unsigned long global_lock;
+               unsigned int expect_event;
+               atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */
+               atomic_t pending_gpe;
+               struct semaphore sem;
+               wait_queue_head_t wait;
+       } burst;
 
        struct {
-               u32                             mode;
-               acpi_handle                     handle;
-               unsigned long                   uid;
-               unsigned long                   gpe_bit;
-               struct acpi_generic_address     status_addr;
-               struct acpi_generic_address     command_addr;
-               struct acpi_generic_address     data_addr;
-               unsigned long                   global_lock;
-                       spinlock_t                      lock;
-       }polling;
+               u32 mode;
+               acpi_handle handle;
+               unsigned long uid;
+               unsigned long gpe_bit;
+               struct acpi_generic_address status_addr;
+               struct acpi_generic_address command_addr;
+               struct acpi_generic_address data_addr;
+               unsigned long global_lock;
+               spinlock_t lock;
+       } polling;
 };
 
-static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); 
+static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event);
 static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event);
-static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data);
-static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data);
-static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data);
-static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data);
-static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data);
-static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data);
-static void acpi_ec_gpe_polling_query ( void *ec_cxt);
-static void acpi_ec_gpe_burst_query ( void *ec_cxt);
-static u32 acpi_ec_gpe_polling_handler ( void *data);
-static u32 acpi_ec_gpe_burst_handler ( void *data);
+static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data);
+static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data);
+static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data);
+static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data);
+static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data);
+static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data);
+static void acpi_ec_gpe_polling_query(void *ec_cxt);
+static void acpi_ec_gpe_burst_query(void *ec_cxt);
+static u32 acpi_ec_gpe_polling_handler(void *data);
+static u32 acpi_ec_gpe_burst_handler(void *data);
 static acpi_status __init
-acpi_fake_ecdt_polling_callback (
-       acpi_handle     handle,
-       u32             Level,
-       void            *context,
-       void            **retval);
+acpi_fake_ecdt_polling_callback(acpi_handle handle,
+                               u32 Level, void *context, void **retval);
 
 static acpi_status __init
-acpi_fake_ecdt_burst_callback (
-       acpi_handle     handle,
-       u32             Level,
-       void            *context,
-       void            **retval);
-
-static int __init
-acpi_ec_polling_get_real_ecdt(void);
-static int __init
-acpi_ec_burst_get_real_ecdt(void);
+acpi_fake_ecdt_burst_callback(acpi_handle handle,
+                             u32 Level, void *context, void **retval);
+
+static int __init acpi_ec_polling_get_real_ecdt(void);
+static int __init acpi_ec_burst_get_real_ecdt(void);
 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
-static union acpi_ec   *ec_ecdt;
+static union acpi_ec *ec_ecdt;
 
 /* External interfaces use first EC only, so remember */
 static struct acpi_device *first_ec;
@@ -173,30 +155,24 @@ static int acpi_ec_polling_mode = EC_POLLING;
 
 static inline u32 acpi_ec_read_status(union acpi_ec *ec)
 {
-       u32     status = 0;
+       u32 status = 0;
 
        acpi_hw_low_level_read(8, &status, &ec->common.status_addr);
        return status;
 }
 
-static int
-acpi_ec_wait (
-       union acpi_ec           *ec,
-       u8                      event)
+static int acpi_ec_wait(union acpi_ec *ec, u8 event)
 {
-       if (acpi_ec_polling_mode) 
-               return acpi_ec_polling_wait (ec, event);
+       if (acpi_ec_polling_mode)
+               return acpi_ec_polling_wait(ec, event);
        else
-               return acpi_ec_burst_wait (ec, event);
+               return acpi_ec_burst_wait(ec, event);
 }
 
-static int
-acpi_ec_polling_wait (
-       union acpi_ec           *ec,
-       u8                      event)
+static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
 {
-       u32                     acpi_ec_status = 0;
-       u32                     i = ACPI_EC_UDELAY_COUNT;
+       u32 acpi_ec_status = 0;
+       u32 i = ACPI_EC_UDELAY_COUNT;
 
        if (!ec)
                return -EINVAL;
@@ -205,19 +181,21 @@ acpi_ec_polling_wait (
        switch (event) {
        case ACPI_EC_EVENT_OBF:
                do {
-                       acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
+                       acpi_hw_low_level_read(8, &acpi_ec_status,
+                                              &ec->common.status_addr);
                        if (acpi_ec_status & ACPI_EC_FLAG_OBF)
                                return 0;
                        udelay(ACPI_EC_UDELAY);
-               } while (--i>0);
+               } while (--i > 0);
                break;
        case ACPI_EC_EVENT_IBE:
                do {
-                       acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
+                       acpi_hw_low_level_read(8, &acpi_ec_status,
+                                              &ec->common.status_addr);
                        if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
                                return 0;
                        udelay(ACPI_EC_UDELAY);
-               } while (--i>0);
+               } while (--i > 0);
                break;
        default:
                return -EINVAL;
@@ -227,25 +205,36 @@ acpi_ec_polling_wait (
 }
 static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
 {
-       int     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_wait");
 
        ec->burst.expect_event = event;
        smp_mb();
 
-       result = wait_event_interruptible_timeout(ec->burst.wait,
-                                       !ec->burst.expect_event,
-                                       msecs_to_jiffies(ACPI_EC_DELAY));
-       
-       ec->burst.expect_event = 0;
-       smp_mb();
+       switch (event) {
+       case ACPI_EC_EVENT_OBF:
+               if (acpi_ec_read_status(ec) & event) {
+                       ec->burst.expect_event = 0;
+                       return_VALUE(0);
+               }
+               break;
 
-       if (result < 0){
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result  = %d ", result));
-               return_VALUE(result);
+       case ACPI_EC_EVENT_IBE:
+               if (~acpi_ec_read_status(ec) & event) {
+                       ec->burst.expect_event = 0;
+                       return_VALUE(0);
+               }
+               break;
        }
 
+       result = wait_event_timeout(ec->burst.wait,
+                                   !ec->burst.expect_event,
+                                   msecs_to_jiffies(ACPI_EC_DELAY));
+
+       ec->burst.expect_event = 0;
+       smp_mb();
+
        /*
         * Verify that the event in question has actually happened by
         * querying EC status. Do the check even if operation timed-out
@@ -266,95 +255,65 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
        return_VALUE(-ETIME);
 }
 
-
-
-static int
-acpi_ec_enter_burst_mode (
-       union acpi_ec           *ec)
+static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
 {
-       u32                     tmp = 0;
-       int                     status = 0;
+       u32 tmp = 0;
+       int status = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
 
        status = acpi_ec_read_status(ec);
-       if (status != -EINVAL &&
-               !(status & ACPI_EC_FLAG_BURST)){
-               acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
+       if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
+               status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
+               if (status)
+                       goto end;
+               acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
+                                       &ec->common.command_addr);
                status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
-               if (status){
-                       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
+               if (status)
                        return_VALUE(-EINVAL);
-               }
                acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               if(tmp != 0x90 ) {/* Burst ACK byte*/
+               if (tmp != 0x90) {      /* Burst ACK byte */
                        return_VALUE(-EINVAL);
                }
        }
 
-       atomic_set(&ec->burst.leaving_burst , 0);
+       atomic_set(&ec->burst.leaving_burst, 0);
        return_VALUE(0);
+      end:
+       printk("Error in acpi_ec_wait\n");
+       return_VALUE(-1);
 }
 
-static int
-acpi_ec_leave_burst_mode (
-       union acpi_ec           *ec)
+static int acpi_ec_leave_burst_mode(union acpi_ec *ec)
 {
-       int                     status =0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
 
-       atomic_set(&ec->burst.leaving_burst , 1);
-       status = acpi_ec_read_status(ec);
-       if (status != -EINVAL &&
-               (status & ACPI_EC_FLAG_BURST)){
-               acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
-               status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
-               if (status){
-                       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n"));
-                       return_VALUE(-EINVAL);
-               }
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               status = acpi_ec_read_status(ec);
-       }
-
+       atomic_set(&ec->burst.leaving_burst, 1);
        return_VALUE(0);
 }
 
-static int
-acpi_ec_read (
-       union acpi_ec           *ec,
-       u8                      address,
-       u32                     *data)
+static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
 {
-       if (acpi_ec_polling_mode) 
+       if (acpi_ec_polling_mode)
                return acpi_ec_polling_read(ec, address, data);
        else
                return acpi_ec_burst_read(ec, address, data);
 }
-static int
-acpi_ec_write (
-       union acpi_ec           *ec,
-       u8                      address,
-       u8                      data)
+static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
 {
-       if (acpi_ec_polling_mode) 
+       if (acpi_ec_polling_mode)
                return acpi_ec_polling_write(ec, address, data);
        else
                return acpi_ec_burst_write(ec, address, data);
 }
-static int
-acpi_ec_polling_read (
-       union acpi_ec           *ec,
-       u8                      address,
-       u32                     *data)
+static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
 {
-       acpi_status             status = AE_OK;
-       int                     result = 0;
-       unsigned long           flags = 0;
-       u32                     glk = 0;
+       acpi_status status = AE_OK;
+       int result = 0;
+       unsigned long flags = 0;
+       u32 glk = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_read");
 
@@ -371,7 +330,8 @@ acpi_ec_polling_read (
 
        spin_lock_irqsave(&ec->polling.lock, flags);
 
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
+                               &ec->common.command_addr);
        result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (result)
                goto end;
@@ -384,9 +344,9 @@ acpi_ec_polling_read (
        acpi_hw_low_level_read(8, data, &ec->common.data_addr);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
-               *data, address));
-       
-end:
+                         *data, address));
+
+      end:
        spin_unlock_irqrestore(&ec->polling.lock, flags);
 
        if (ec->common.global_lock)
@@ -395,17 +355,12 @@ end:
        return_VALUE(result);
 }
 
-
-static int
-acpi_ec_polling_write (
-       union acpi_ec           *ec,
-       u8                      address,
-       u8                      data)
+static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       unsigned long           flags = 0;
-       u32                     glk = 0;
+       int result = 0;
+       acpi_status status = AE_OK;
+       unsigned long flags = 0;
+       u32 glk = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_write");
 
@@ -420,7 +375,8 @@ acpi_ec_polling_write (
 
        spin_lock_irqsave(&ec->polling.lock, flags);
 
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
+                               &ec->common.command_addr);
        result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
        if (result)
                goto end;
@@ -436,9 +392,9 @@ acpi_ec_polling_write (
                goto end;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
-               data, address));
+                         data, address));
 
-end:
+      end:
        spin_unlock_irqrestore(&ec->polling.lock, flags);
 
        if (ec->common.global_lock)
@@ -447,21 +403,16 @@ end:
        return_VALUE(result);
 }
 
-static int
-acpi_ec_burst_read (
-       union acpi_ec           *ec,
-       u8                      address,
-       u32                     *data)
+static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
 {
-       int                     status = 0;
-       u32                     glk;
+       int status = 0;
+       u32 glk;
 
        ACPI_FUNCTION_TRACE("acpi_ec_read");
 
        if (!ec || !data)
                return_VALUE(-EINVAL);
 
-retry:
        *data = 0;
 
        if (ec->common.global_lock) {
@@ -473,64 +424,49 @@ retry:
        WARN_ON(in_interrupt());
        down(&ec->burst.sem);
 
-       if(acpi_ec_enter_burst_mode(ec))
-               goto end;
-
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
+       acpi_ec_enter_burst_mode(ec);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
-       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
        if (status) {
+               printk("read EC, IB not empty\n");
                goto end;
        }
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
+                               &ec->common.command_addr);
+       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
+       if (status) {
+               printk("read EC, IB not empty\n");
+       }
 
        acpi_hw_low_level_write(8, address, &ec->common.data_addr);
-       status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
-       if (status){
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
+       status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
+       if (status) {
+               printk("read EC, OB not full\n");
                goto end;
        }
-
        acpi_hw_low_level_read(8, data, &ec->common.data_addr);
-       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
-               *data, address));
-       
-end:
+                         *data, address));
+
+      end:
        acpi_ec_leave_burst_mode(ec);
        up(&ec->burst.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
 
-       if(atomic_read(&ec->burst.leaving_burst) == 2){
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
-               while(atomic_read(&ec->burst.pending_gpe)){
-                       msleep(1);      
-               }
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               goto retry;
-       }
-
        return_VALUE(status);
 }
 
-
-static int
-acpi_ec_burst_write (
-       union acpi_ec           *ec,
-       u8                      address,
-       u8                      data)
+static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
 {
-       int                     status = 0;
-       u32                     glk;
-       u32                     tmp;
+       int status = 0;
+       u32 glk;
 
        ACPI_FUNCTION_TRACE("acpi_ec_write");
 
        if (!ec)
                return_VALUE(-EINVAL);
-retry:
+
        if (ec->common.global_lock) {
                status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
                if (ACPI_FAILURE(status))
@@ -540,69 +476,43 @@ retry:
        WARN_ON(in_interrupt());
        down(&ec->burst.sem);
 
-       if(acpi_ec_enter_burst_mode(ec))
-               goto end;
+       acpi_ec_enter_burst_mode(ec);
 
-       status = acpi_ec_read_status(ec);
-       if (status != -EINVAL &&
-               !(status & ACPI_EC_FLAG_BURST)){
-               acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
-               status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
-               if (status)
-                       goto end;
-               acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
-               if(tmp != 0x90 ) /* Burst ACK byte*/
-                       goto end;
+       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
+       if (status) {
+               printk("write EC, IB not empty\n");
        }
-       /*Now we are in burst mode*/
-
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
+                               &ec->common.command_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
-       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-       if (status){
-               goto end;
+       if (status) {
+               printk("write EC, IB not empty\n");
        }
 
        acpi_hw_low_level_write(8, address, &ec->common.data_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
-       if (status){
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               goto end;
+       if (status) {
+               printk("write EC, IB not empty\n");
        }
 
        acpi_hw_low_level_write(8, data, &ec->common.data_addr);
-       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
-       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-       if (status)
-               goto end;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
-               data, address));
+                         data, address));
 
-end:
        acpi_ec_leave_burst_mode(ec);
        up(&ec->burst.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
 
-       if(atomic_read(&ec->burst.leaving_burst) == 2){
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
-               while(atomic_read(&ec->burst.pending_gpe)){
-                       msleep(1);      
-               }
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               goto retry;
-       }
-
        return_VALUE(status);
 }
 
 /*
  * Externally callable EC access functions. For now, assume 1 EC only
  */
-int
-ec_read(u8 addr, u8 *val)
+int ec_read(u8 addr, u8 * val)
 {
        union acpi_ec *ec;
        int err;
@@ -618,14 +528,13 @@ ec_read(u8 addr, u8 *val)
        if (!err) {
                *val = temp_data;
                return 0;
-       }
-       else
+       } else
                return err;
 }
+
 EXPORT_SYMBOL(ec_read);
 
-int
-ec_write(u8 addr, u8 val)
+int ec_write(u8 addr, u8 val)
 {
        union acpi_ec *ec;
        int err;
@@ -639,27 +548,22 @@ ec_write(u8 addr, u8 val)
 
        return err;
 }
+
 EXPORT_SYMBOL(ec_write);
 
-static int
-acpi_ec_query (
-       union acpi_ec           *ec,
-       u32                     *data)
+static int acpi_ec_query(union acpi_ec *ec, u32 * data)
 {
-       if (acpi_ec_polling_mode) 
+       if (acpi_ec_polling_mode)
                return acpi_ec_polling_query(ec, data);
        else
                return acpi_ec_burst_query(ec, data);
 }
-static int
-acpi_ec_polling_query (
-       union acpi_ec           *ec,
-       u32                     *data)
+static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       unsigned long           flags = 0;
-       u32                     glk = 0;
+       int result = 0;
+       acpi_status status = AE_OK;
+       unsigned long flags = 0;
+       u32 glk = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_query");
 
@@ -681,7 +585,8 @@ acpi_ec_polling_query (
         */
        spin_lock_irqsave(&ec->polling.lock, flags);
 
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
+                               &ec->common.command_addr);
        result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
        if (result)
                goto end;
@@ -690,7 +595,7 @@ acpi_ec_polling_query (
        if (!*data)
                result = -ENODATA;
 
-end:
+      end:
        spin_unlock_irqrestore(&ec->polling.lock, flags);
 
        if (ec->common.global_lock)
@@ -698,13 +603,10 @@ end:
 
        return_VALUE(result);
 }
-static int
-acpi_ec_burst_query (
-       union acpi_ec           *ec,
-       u32                     *data)
+static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
 {
-       int                     status = 0;
-       u32                     glk;
+       int status = 0;
+       u32 glk;
 
        ACPI_FUNCTION_TRACE("acpi_ec_query");
 
@@ -719,70 +621,64 @@ acpi_ec_burst_query (
        }
 
        down(&ec->burst.sem);
-       if(acpi_ec_enter_burst_mode(ec))
+
+       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
+       if (status) {
+               printk("query EC, IB not empty\n");
                goto end;
+       }
        /*
         * Query the EC to find out which _Qxx method we need to evaluate.
         * Note that successful completion of the query causes the ACPI_EC_SCI
         * bit to be cleared (and thus clearing the interrupt source).
         */
-       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
+       acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
+                               &ec->common.command_addr);
        status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
-       if (status){
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
+       if (status) {
+               printk("query EC, OB not full\n");
                goto end;
        }
 
        acpi_hw_low_level_read(8, data, &ec->common.data_addr);
-       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
        if (!*data)
                status = -ENODATA;
 
-end:
-       acpi_ec_leave_burst_mode(ec);
+      end:
        up(&ec->burst.sem);
 
        if (ec->common.global_lock)
                acpi_release_global_lock(glk);
 
-       if(atomic_read(&ec->burst.leaving_burst) == 2){
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
-               acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
-               status = -ENODATA;
-       }
        return_VALUE(status);
 }
 
-
 /* --------------------------------------------------------------------------
                                 Event Management
    -------------------------------------------------------------------------- */
 
 union acpi_ec_query_data {
-       acpi_handle             handle;
-       u8                      data;
+       acpi_handle handle;
+       u8 data;
 };
 
-static void
-acpi_ec_gpe_query (
-       void                    *ec_cxt)
+static void acpi_ec_gpe_query(void *ec_cxt)
 {
-       if (acpi_ec_polling_mode) 
+       if (acpi_ec_polling_mode)
                acpi_ec_gpe_polling_query(ec_cxt);
        else
                acpi_ec_gpe_burst_query(ec_cxt);
 }
 
-static void
-acpi_ec_gpe_polling_query (
-       void                    *ec_cxt)
+static void acpi_ec_gpe_polling_query(void *ec_cxt)
 {
-       union acpi_ec           *ec = (union acpi_ec *) ec_cxt;
-       u32                     value = 0;
-       unsigned long           flags = 0;
-       static char             object_name[5] = {'_','Q','0','0','\0'};
-       const char              hex[] = {'0','1','2','3','4','5','6','7',
-                                        '8','9','A','B','C','D','E','F'};
+       union acpi_ec *ec = (union acpi_ec *)ec_cxt;
+       u32 value = 0;
+       unsigned long flags = 0;
+       static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
+       const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
+               '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+       };
 
        ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
 
@@ -812,19 +708,18 @@ acpi_ec_gpe_polling_query (
 
        acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
 
-end:   
+      end:
        acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
 }
-static void
-acpi_ec_gpe_burst_query (
-       void                    *ec_cxt)
+static void acpi_ec_gpe_burst_query(void *ec_cxt)
 {
-       union acpi_ec           *ec = (union acpi_ec *) ec_cxt;
-       u32                     value;
-       int                     result = -ENODATA;
-       static char             object_name[5] = {'_','Q','0','0','\0'};
-       const char              hex[] = {'0','1','2','3','4','5','6','7',
-                                        '8','9','A','B','C','D','E','F'};
+       union acpi_ec *ec = (union acpi_ec *)ec_cxt;
+       u32 value;
+       int result = -ENODATA;
+       static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
+       const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
+               '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+       };
 
        ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
 
@@ -840,26 +735,22 @@ acpi_ec_gpe_burst_query (
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
 
        acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
-end:   
+      end:
        atomic_dec(&ec->burst.pending_gpe);
        return;
 }
 
-static u32
-acpi_ec_gpe_handler (
-       void                    *data)
+static u32 acpi_ec_gpe_handler(void *data)
 {
-       if (acpi_ec_polling_mode) 
+       if (acpi_ec_polling_mode)
                return acpi_ec_gpe_polling_handler(data);
        else
-               return acpi_ec_gpe_burst_handler(data); 
+               return acpi_ec_gpe_burst_handler(data);
 }
-static u32
-acpi_ec_gpe_polling_handler (
-       void                    *data)
+static u32 acpi_ec_gpe_polling_handler(void *data)
 {
-       acpi_status             status = AE_OK;
-       union acpi_ec           *ec = (union acpi_ec *) data;
+       acpi_status status = AE_OK;
+       union acpi_ec *ec = (union acpi_ec *)data;
 
        if (!ec)
                return ACPI_INTERRUPT_NOT_HANDLED;
@@ -867,61 +758,49 @@ acpi_ec_gpe_polling_handler (
        acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
 
        status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
-               acpi_ec_gpe_query, ec);
+                                            acpi_ec_gpe_query, ec);
 
        if (status == AE_OK)
                return ACPI_INTERRUPT_HANDLED;
        else
                return ACPI_INTERRUPT_NOT_HANDLED;
 }
-static u32
-acpi_ec_gpe_burst_handler (
-       void                    *data)
+static u32 acpi_ec_gpe_burst_handler(void *data)
 {
-       acpi_status             status = AE_OK;
-       u32                     value;
-       union acpi_ec           *ec = (union acpi_ec *) data;
+       acpi_status status = AE_OK;
+       u32 value;
+       union acpi_ec *ec = (union acpi_ec *)data;
 
        if (!ec)
                return ACPI_INTERRUPT_NOT_HANDLED;
 
-       acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
-
+       acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
        value = acpi_ec_read_status(ec);
 
-       if((value & ACPI_EC_FLAG_IBF) &&
-               !(value & ACPI_EC_FLAG_BURST) &&
-                       (atomic_read(&ec->burst.leaving_burst) == 0)) { 
-       /*
-        * the embedded controller disables 
-        * burst mode for any reason other 
-        * than the burst disable command
-        * to process critical event.
-        */
-               atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction
-                                       and retry */
+       switch (ec->burst.expect_event) {
+       case ACPI_EC_EVENT_OBF:
+               if (!(value & ACPI_EC_FLAG_OBF))
+                       break;
+       case ACPI_EC_EVENT_IBE:
+               if ((value & ACPI_EC_FLAG_IBF))
+                       break;
+               ec->burst.expect_event = 0;
                wake_up(&ec->burst.wait);
-       }else {
-               if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF &&
-                               (value & ACPI_EC_FLAG_OBF)) ||
-                               (ec->burst.expect_event == ACPI_EC_EVENT_IBE &&
-                               !(value & ACPI_EC_FLAG_IBF))) {
-                       ec->burst.expect_event = 0;
-                       wake_up(&ec->burst.wait);
-                       return ACPI_INTERRUPT_HANDLED;
-               }
+               return ACPI_INTERRUPT_HANDLED;
+       default:
+               break;
        }
 
-       if (value & ACPI_EC_FLAG_SCI){
-               atomic_add(1, &ec->burst.pending_gpe) ;
+       if (value & ACPI_EC_FLAG_SCI) {
+               atomic_add(1, &ec->burst.pending_gpe);
                status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
-                                               acpi_ec_gpe_query, ec);
+                                                    acpi_ec_gpe_query, ec);
                return status == AE_OK ?
-               ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
-       } 
+                   ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
+       }
        acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
        return status == AE_OK ?
-               ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
+           ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
 }
 
 /* --------------------------------------------------------------------------
@@ -929,37 +808,31 @@ acpi_ec_gpe_burst_handler (
    -------------------------------------------------------------------------- */
 
 static acpi_status
-acpi_ec_space_setup (
-       acpi_handle             region_handle,
-       u32                     function,
-       void                    *handler_context,
-       void                    **return_context)
+acpi_ec_space_setup(acpi_handle region_handle,
+                   u32 function, void *handler_context, void **return_context)
 {
        /*
         * The EC object is in the handler context and is needed
         * when calling the acpi_ec_space_handler.
         */
-       *return_context  = (function != ACPI_REGION_DEACTIVATE) ?
-                                               handler_context : NULL;
+       *return_context = (function != ACPI_REGION_DEACTIVATE) ?
+           handler_context : NULL;
 
        return AE_OK;
 }
 
-
 static acpi_status
-acpi_ec_space_handler (
-       u32                     function,
-       acpi_physical_address   address,
-       u32                     bit_width,
-       acpi_integer            *value,
-       void                    *handler_context,
-       void                    *region_context)
+acpi_ec_space_handler(u32 function,
+                     acpi_physical_address address,
+                     u32 bit_width,
+                     acpi_integer * value,
+                     void *handler_context, void *region_context)
 {
-       int                     result = 0;
-       union acpi_ec           *ec = NULL;
-       u64                     temp = *value;
-       acpi_integer            f_v = 0;
-       int                     i = 0;
+       int result = 0;
+       union acpi_ec *ec = NULL;
+       u64 temp = *value;
+       acpi_integer f_v = 0;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_space_handler");
 
@@ -967,17 +840,18 @@ acpi_ec_space_handler (
                return_VALUE(AE_BAD_PARAMETER);
 
        if (bit_width != 8 && acpi_strict) {
-               printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n");
+               printk(KERN_WARNING PREFIX
+                      "acpi_ec_space_handler: bit_width should be 8\n");
                return_VALUE(AE_BAD_PARAMETER);
        }
 
-       ec = (union acpi_ec *) handler_context;
+       ec = (union acpi_ec *)handler_context;
 
-next_byte:
+      next_byte:
        switch (function) {
        case ACPI_READ:
                temp = 0;
-               result = acpi_ec_read(ec, (u8) address, (u32 *)&temp);
+               result = acpi_ec_read(ec, (u8) address, (u32 *) & temp);
                break;
        case ACPI_WRITE:
                result = acpi_ec_write(ec, (u8) address, (u8) temp);
@@ -1004,8 +878,7 @@ next_byte:
                *value = f_v;
        }
 
-               
-out:
+      out:
        switch (result) {
        case -EINVAL:
                return_VALUE(AE_BAD_PARAMETER);
@@ -1021,18 +894,15 @@ out:
        }
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_ec_dir;
-
+static struct proc_dir_entry *acpi_ec_dir;
 
-static int
-acpi_ec_read_info (struct seq_file *seq, void *offset)
+static int acpi_ec_read_info(struct seq_file *seq, void *offset)
 {
-       union acpi_ec           *ec = (union acpi_ec *) seq->private;
+       union acpi_ec *ec = (union acpi_ec *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_ec_read_info");
 
@@ -1040,14 +910,15 @@ acpi_ec_read_info (struct seq_file *seq, void *offset)
                goto end;
 
        seq_printf(seq, "gpe bit:                 0x%02x\n",
-               (u32) ec->common.gpe_bit);
+                  (u32) ec->common.gpe_bit);
        seq_printf(seq, "ports:                   0x%02x, 0x%02x\n",
-               (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address);
+                  (u32) ec->common.status_addr.address,
+                  (u32) ec->common.data_addr.address);
        seq_printf(seq, "use global lock:         %s\n",
-               ec->common.global_lock?"yes":"no");
+                  ec->common.global_lock ? "yes" : "no");
        acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
 
-end:
+      end:
        return_VALUE(0);
 }
 
@@ -1057,34 +928,32 @@ static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
 }
 
 static struct file_operations acpi_ec_info_ops = {
-       .open           = acpi_ec_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_ec_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
        .owner = THIS_MODULE,
 };
 
-static int
-acpi_ec_add_fs (
-       struct acpi_device      *device)
+static int acpi_ec_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_ec_dir);
+                                                    acpi_ec_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
        }
 
        entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
-               acpi_device_dir(device));
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_EC_FILE_INFO));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_EC_FILE_INFO));
        else {
                entry->proc_fops = &acpi_ec_info_ops;
                entry->data = acpi_driver_data(device);
@@ -1094,10 +963,7 @@ acpi_ec_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_ec_remove_fs (
-       struct acpi_device      *device)
+static int acpi_ec_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
 
@@ -1110,20 +976,16 @@ acpi_ec_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                Driver Interface
    -------------------------------------------------------------------------- */
 
-
-static int
-acpi_ec_polling_add (
-       struct acpi_device      *device)
+static int acpi_ec_polling_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       union acpi_ec           *ec = NULL;
-       unsigned long           uid;
+       int result = 0;
+       acpi_status status = AE_OK;
+       union acpi_ec *ec = NULL;
+       unsigned long uid;
 
        ACPI_FUNCTION_TRACE("acpi_ec_add");
 
@@ -1143,26 +1005,31 @@ acpi_ec_polling_add (
        acpi_driver_data(device) = ec;
 
        /* Use the global lock for all EC transactions? */
-       acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
+       acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
+                             &ec->common.global_lock);
 
        /* If our UID matches the UID for the ECDT-enumerated EC,
-          we now have the *real* EC info, so kill the makeshift one.*/
+          we now have the *real* EC info, so kill the makeshift one. */
        acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
        if (ec_ecdt && ec_ecdt->common.uid == uid) {
                acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
-                       ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
-       
-               acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
+                                                 ACPI_ADR_SPACE_EC,
+                                                 &acpi_ec_space_handler);
+
+               acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
+                                       &acpi_ec_gpe_handler);
 
                kfree(ec_ecdt);
        }
 
        /* Get GPE bit assignment (EC events). */
        /* TODO: Add support for _GPE returning a package */
-       status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
+       status =
+           acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
+                                 &ec->common.gpe_bit);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error obtaining GPE bit assignment\n"));
+                                 "Error obtaining GPE bit assignment\n"));
                result = -ENODEV;
                goto end;
        }
@@ -1172,26 +1039,24 @@ acpi_ec_polling_add (
                goto end;
 
        printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
-               acpi_device_name(device), acpi_device_bid(device),
-               (u32) ec->common.gpe_bit);
+              acpi_device_name(device), acpi_device_bid(device),
+              (u32) ec->common.gpe_bit);
 
        if (!first_ec)
                first_ec = device;
 
-end:
+      end:
        if (result)
                kfree(ec);
 
        return_VALUE(result);
 }
-static int
-acpi_ec_burst_add (
-       struct acpi_device      *device)
+static int acpi_ec_burst_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       union acpi_ec           *ec = NULL;
-       unsigned long           uid;
+       int result = 0;
+       acpi_status status = AE_OK;
+       union acpi_ec *ec = NULL;
+       unsigned long uid;
 
        ACPI_FUNCTION_TRACE("acpi_ec_add");
 
@@ -1205,35 +1070,40 @@ acpi_ec_burst_add (
 
        ec->common.handle = device->handle;
        ec->common.uid = -1;
-       atomic_set(&ec->burst.pending_gpe, 0);
-       atomic_set(&ec->burst.leaving_burst , 1);
-       init_MUTEX(&ec->burst.sem);
-       init_waitqueue_head(&ec->burst.wait);
+       atomic_set(&ec->burst.pending_gpe, 0);
+       atomic_set(&ec->burst.leaving_burst, 1);
+       init_MUTEX(&ec->burst.sem);
+       init_waitqueue_head(&ec->burst.wait);
        strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_EC_CLASS);
        acpi_driver_data(device) = ec;
 
        /* Use the global lock for all EC transactions? */
-       acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
+       acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
+                             &ec->common.global_lock);
 
        /* If our UID matches the UID for the ECDT-enumerated EC,
-          we now have the *real* EC info, so kill the makeshift one.*/
+          we now have the *real* EC info, so kill the makeshift one. */
        acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
        if (ec_ecdt && ec_ecdt->common.uid == uid) {
                acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
-                       ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
+                                                 ACPI_ADR_SPACE_EC,
+                                                 &acpi_ec_space_handler);
 
-               acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
+               acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
+                                       &acpi_ec_gpe_handler);
 
                kfree(ec_ecdt);
        }
 
        /* Get GPE bit assignment (EC events). */
        /* TODO: Add support for _GPE returning a package */
-       status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
+       status =
+           acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
+                                 &ec->common.gpe_bit);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error obtaining GPE bit assignment\n"));
+                                 "Error obtaining GPE bit assignment\n"));
                result = -ENODEV;
                goto end;
        }
@@ -1242,27 +1112,24 @@ acpi_ec_burst_add (
        if (result)
                goto end;
 
+       printk("burst-mode-ec-10-Aug\n");
        printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
-               acpi_device_name(device), acpi_device_bid(device),
-               (u32) ec->common.gpe_bit);
+              acpi_device_name(device), acpi_device_bid(device),
+              (u32) ec->common.gpe_bit);
 
        if (!first_ec)
                first_ec = device;
 
-end:
+      end:
        if (result)
                kfree(ec);
 
        return_VALUE(result);
 }
 
-
-static int
-acpi_ec_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_ec_remove(struct acpi_device *device, int type)
 {
-       union acpi_ec           *ec = NULL;
+       union acpi_ec *ec = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ec_remove");
 
@@ -1278,13 +1145,10 @@ acpi_ec_remove (
        return_VALUE(0);
 }
 
-
 static acpi_status
-acpi_ec_io_ports (
-       struct acpi_resource    *resource,
-       void                    *context)
+acpi_ec_io_ports(struct acpi_resource *resource, void *context)
 {
-       union acpi_ec           *ec = (union acpi_ec *) context;
+       union acpi_ec *ec = (union acpi_ec *)context;
        struct acpi_generic_address *addr;
 
        if (resource->id != ACPI_RSTYPE_IO) {
@@ -1312,13 +1176,10 @@ acpi_ec_io_ports (
        return AE_OK;
 }
 
-
-static int
-acpi_ec_start (
-       struct acpi_device      *device)
+static int acpi_ec_start(struct acpi_device *device)
 {
-       acpi_status             status = AE_OK;
-       union acpi_ec           *ec = NULL;
+       acpi_status status = AE_OK;
+       union acpi_ec *ec = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ec_start");
 
@@ -1334,49 +1195,50 @@ acpi_ec_start (
         * Get I/O port addresses. Convert to GAS format.
         */
        status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS,
-               acpi_ec_io_ports, ec);
-       if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses"));
+                                    acpi_ec_io_ports, ec);
+       if (ACPI_FAILURE(status)
+           || ec->common.command_addr.register_bit_width == 0) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Error getting I/O port addresses"));
                return_VALUE(-ENODEV);
        }
 
        ec->common.status_addr = ec->common.command_addr;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",
-               (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address,
-               (u32) ec->common.data_addr.address));
-
+                         (u32) ec->common.gpe_bit,
+                         (u32) ec->common.command_addr.address,
+                         (u32) ec->common.data_addr.address));
 
        /*
         * Install GPE handler
         */
        status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit,
-               ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec);
+                                         ACPI_GPE_EDGE_TRIGGERED,
+                                         &acpi_ec_gpe_handler, ec);
        if (ACPI_FAILURE(status)) {
                return_VALUE(-ENODEV);
        }
-       acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
-       acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
+       acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
+       acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
 
-       status = acpi_install_address_space_handler (ec->common.handle,
-                       ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
-                       &acpi_ec_space_setup, ec);
+       status = acpi_install_address_space_handler(ec->common.handle,
+                                                   ACPI_ADR_SPACE_EC,
+                                                   &acpi_ec_space_handler,
+                                                   &acpi_ec_space_setup, ec);
        if (ACPI_FAILURE(status)) {
-               acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
+               acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
+                                       &acpi_ec_gpe_handler);
                return_VALUE(-ENODEV);
        }
 
        return_VALUE(AE_OK);
 }
 
-
-static int
-acpi_ec_stop (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_ec_stop(struct acpi_device *device, int type)
 {
-       acpi_status             status = AE_OK;
-       union acpi_ec           *ec = NULL;
+       acpi_status status = AE_OK;
+       union acpi_ec *ec = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_ec_stop");
 
@@ -1386,11 +1248,14 @@ acpi_ec_stop (
        ec = acpi_driver_data(device);
 
        status = acpi_remove_address_space_handler(ec->common.handle,
-               ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
+                                                  ACPI_ADR_SPACE_EC,
+                                                  &acpi_ec_space_handler);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
+       status =
+           acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
+                                   &acpi_ec_gpe_handler);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
@@ -1398,32 +1263,26 @@ acpi_ec_stop (
 }
 
 static acpi_status __init
-acpi_fake_ecdt_callback (
-       acpi_handle     handle,
-       u32             Level,
-       void            *context,
-       void            **retval)
+acpi_fake_ecdt_callback(acpi_handle handle,
+                       u32 Level, void *context, void **retval)
 {
 
        if (acpi_ec_polling_mode)
                return acpi_fake_ecdt_polling_callback(handle,
-                       Level, context, retval);
+                                                      Level, context, retval);
        else
                return acpi_fake_ecdt_burst_callback(handle,
-                       Level, context, retval);
+                                                    Level, context, retval);
 }
 
 static acpi_status __init
-acpi_fake_ecdt_polling_callback (
-       acpi_handle     handle,
-       u32             Level,
-       void            *context,
-       void            **retval)
+acpi_fake_ecdt_polling_callback(acpi_handle handle,
+                               u32 Level, void *context, void **retval)
 {
-       acpi_status     status;
+       acpi_status status;
 
        status = acpi_walk_resources(handle, METHOD_NAME__CRS,
-               acpi_ec_io_ports, ec_ecdt);
+                                    acpi_ec_io_ports, ec_ecdt);
        if (ACPI_FAILURE(status))
                return status;
        ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
@@ -1431,33 +1290,33 @@ acpi_fake_ecdt_polling_callback (
        ec_ecdt->common.uid = -1;
        acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
 
-       status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
+       status =
+           acpi_evaluate_integer(handle, "_GPE", NULL,
+                                 &ec_ecdt->common.gpe_bit);
        if (ACPI_FAILURE(status))
                return status;
        spin_lock_init(&ec_ecdt->polling.lock);
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.handle = handle;
 
-       printk(KERN_INFO PREFIX  "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
-               (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
-               (u32) ec_ecdt->common.data_addr.address);
+       printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
+              (u32) ec_ecdt->common.gpe_bit,
+              (u32) ec_ecdt->common.command_addr.address,
+              (u32) ec_ecdt->common.data_addr.address);
 
        return AE_CTRL_TERMINATE;
 }
 
 static acpi_status __init
-acpi_fake_ecdt_burst_callback (
-       acpi_handle     handle,
-       u32             Level,
-       void            *context,
-       void            **retval)
+acpi_fake_ecdt_burst_callback(acpi_handle handle,
+                             u32 Level, void *context, void **retval)
 {
-       acpi_status     status;
+       acpi_status status;
 
        init_MUTEX(&ec_ecdt->burst.sem);
        init_waitqueue_head(&ec_ecdt->burst.wait);
        status = acpi_walk_resources(handle, METHOD_NAME__CRS,
-               acpi_ec_io_ports, ec_ecdt);
+                                    acpi_ec_io_ports, ec_ecdt);
        if (ACPI_FAILURE(status))
                return status;
        ec_ecdt->common.status_addr = ec_ecdt->common.command_addr;
@@ -1465,15 +1324,18 @@ acpi_fake_ecdt_burst_callback (
        ec_ecdt->common.uid = -1;
        acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
 
-       status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
+       status =
+           acpi_evaluate_integer(handle, "_GPE", NULL,
+                                 &ec_ecdt->common.gpe_bit);
        if (ACPI_FAILURE(status))
                return status;
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.handle = handle;
 
-       printk(KERN_INFO PREFIX  "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
-               (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
-               (u32) ec_ecdt->common.data_addr.address);
+       printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
+              (u32) ec_ecdt->common.gpe_bit,
+              (u32) ec_ecdt->common.command_addr.address,
+              (u32) ec_ecdt->common.data_addr.address);
 
        return AE_CTRL_TERMINATE;
 }
@@ -1488,11 +1350,10 @@ acpi_fake_ecdt_burst_callback (
  * op region (since _REG isn't invoked yet). The assumption is true for
  * all systems found.
  */
-static int __init
-acpi_ec_fake_ecdt(void)
+static int __init acpi_ec_fake_ecdt(void)
 {
-       acpi_status     status;
-       int             ret = 0;
+       acpi_status status;
+       int ret = 0;
 
        printk(KERN_INFO PREFIX "Try to make an fake ECDT\n");
 
@@ -1503,10 +1364,8 @@ acpi_ec_fake_ecdt(void)
        }
        memset(ec_ecdt, 0, sizeof(union acpi_ec));
 
-       status = acpi_get_devices (ACPI_EC_HID,
-                               acpi_fake_ecdt_callback,
-                               NULL,
-                               NULL);
+       status = acpi_get_devices(ACPI_EC_HID,
+                                 acpi_fake_ecdt_callback, NULL, NULL);
        if (ACPI_FAILURE(status)) {
                kfree(ec_ecdt);
                ec_ecdt = NULL;
@@ -1514,13 +1373,12 @@ acpi_ec_fake_ecdt(void)
                goto error;
        }
        return 0;
-error:
+      error:
        printk(KERN_ERR PREFIX "Can't make an fake ECDT\n");
        return ret;
 }
 
-static int __init
-acpi_ec_get_real_ecdt(void)
+static int __init acpi_ec_get_real_ecdt(void)
 {
        if (acpi_ec_polling_mode)
                return acpi_ec_polling_get_real_ecdt();
@@ -1528,14 +1386,14 @@ acpi_ec_get_real_ecdt(void)
                return acpi_ec_burst_get_real_ecdt();
 }
 
-static int __init
-acpi_ec_polling_get_real_ecdt(void)
+static int __init acpi_ec_polling_get_real_ecdt(void)
 {
-       acpi_status             status;
-       struct acpi_table_ecdt  *ecdt_ptr;
+       acpi_status status;
+       struct acpi_table_ecdt *ecdt_ptr;
 
-       status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, 
-               (struct acpi_table_header **) &ecdt_ptr);
+       status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
+                                        (struct acpi_table_header **)
+                                        &ecdt_ptr);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -1558,13 +1416,14 @@ acpi_ec_polling_get_real_ecdt(void)
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.uid = ecdt_ptr->uid;
 
-       status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
+       status =
+           acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
        if (ACPI_FAILURE(status)) {
                goto error;
        }
 
        return 0;
-error:
+      error:
        printk(KERN_ERR PREFIX "Could not use ECDT\n");
        kfree(ec_ecdt);
        ec_ecdt = NULL;
@@ -1572,15 +1431,14 @@ error:
        return -ENODEV;
 }
 
-
-static int __init
-acpi_ec_burst_get_real_ecdt(void)
+static int __init acpi_ec_burst_get_real_ecdt(void)
 {
-       acpi_status             status;
-       struct acpi_table_ecdt  *ecdt_ptr;
+       acpi_status status;
+       struct acpi_table_ecdt *ecdt_ptr;
 
        status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
-               (struct acpi_table_header **) &ecdt_ptr);
+                                        (struct acpi_table_header **)
+                                        &ecdt_ptr);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -1594,8 +1452,8 @@ acpi_ec_burst_get_real_ecdt(void)
                return -ENOMEM;
        memset(ec_ecdt, 0, sizeof(union acpi_ec));
 
-       init_MUTEX(&ec_ecdt->burst.sem);
-       init_waitqueue_head(&ec_ecdt->burst.wait);
+       init_MUTEX(&ec_ecdt->burst.sem);
+       init_waitqueue_head(&ec_ecdt->burst.wait);
        ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
        ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
        ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
@@ -1604,13 +1462,14 @@ acpi_ec_burst_get_real_ecdt(void)
        ec_ecdt->common.global_lock = TRUE;
        ec_ecdt->common.uid = ecdt_ptr->uid;
 
-       status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
+       status =
+           acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
        if (ACPI_FAILURE(status)) {
                goto error;
        }
 
        return 0;
-error:
+      error:
        printk(KERN_ERR PREFIX "Could not use ECDT\n");
        kfree(ec_ecdt);
        ec_ecdt = NULL;
@@ -1619,11 +1478,10 @@ error:
 }
 
 static int __initdata acpi_fake_ecdt_enabled;
-int __init
-acpi_ec_ecdt_probe (void)
+int __init acpi_ec_ecdt_probe(void)
 {
-       acpi_status             status;
-       int                     ret;
+       acpi_status status;
+       int ret;
 
        ret = acpi_ec_get_real_ecdt();
        /* Try to make a fake ECDT */
@@ -1638,26 +1496,28 @@ acpi_ec_ecdt_probe (void)
         * Install GPE handler
         */
        status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
-               ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler,
-               ec_ecdt);
+                                         ACPI_GPE_EDGE_TRIGGERED,
+                                         &acpi_ec_gpe_handler, ec_ecdt);
        if (ACPI_FAILURE(status)) {
                goto error;
        }
-       acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
-       acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);
-
-       status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT,
-                       ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
-                       &acpi_ec_space_setup, ec_ecdt);
+       acpi_set_gpe_type(NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME);
+       acpi_enable_gpe(NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);
+
+       status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
+                                                   ACPI_ADR_SPACE_EC,
+                                                   &acpi_ec_space_handler,
+                                                   &acpi_ec_space_setup,
+                                                   ec_ecdt);
        if (ACPI_FAILURE(status)) {
                acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
-                       &acpi_ec_gpe_handler);
+                                       &acpi_ec_gpe_handler);
                goto error;
        }
 
        return 0;
 
-error:
+      error:
        printk(KERN_ERR PREFIX "Could not use ECDT\n");
        kfree(ec_ecdt);
        ec_ecdt = NULL;
@@ -1665,10 +1525,9 @@ error:
        return -ENODEV;
 }
 
-
-static int __init acpi_ec_init (void)
+static int __init acpi_ec_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_ec_init");
 
@@ -1693,8 +1552,7 @@ subsys_initcall(acpi_ec_init);
 
 /* EC driver currently not unloadable */
 #if 0
-static void __exit
-acpi_ec_exit (void)
+static void __exit acpi_ec_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_ec_exit");
 
@@ -1704,7 +1562,7 @@ acpi_ec_exit (void)
 
        return_VOID;
 }
-#endif /* 0 */
+#endif                         /* 0 */
 
 static int __init acpi_fake_ecdt_setup(char *str)
 {
@@ -1727,8 +1585,8 @@ static int __init acpi_ec_set_polling_mode(char *str)
                acpi_ec_polling_mode = EC_POLLING;
                acpi_ec_driver.ops.add = acpi_ec_polling_add;
        }
-       printk(KERN_INFO PREFIX "EC %s mode.\n",
-               burst ? "burst": "polling");
+       printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling");
        return 0;
 }
+
 __setup("ec_burst=", acpi_ec_set_polling_mode);
index 43c49f66a3283b8fa20f7ea796eb9402ef6f4028..bfa8b76de403019c88a32009ab8863124f1a6364 100644 (file)
 #include <acpi/acpi_drivers.h>
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("event")
+ACPI_MODULE_NAME("event")
 
 /* Global vars for handling event proc entry */
 static DEFINE_SPINLOCK(acpi_system_event_lock);
-int                            event_is_open = 0;
-extern struct list_head                acpi_bus_event_list;
-extern wait_queue_head_t       acpi_bus_event_queue;
+int event_is_open = 0;
+extern struct list_head acpi_bus_event_list;
+extern wait_queue_head_t acpi_bus_event_queue;
 
-static int
-acpi_system_open_event(struct inode *inode, struct file *file)
+static int acpi_system_open_event(struct inode *inode, struct file *file)
 {
-       spin_lock_irq (&acpi_system_event_lock);
+       spin_lock_irq(&acpi_system_event_lock);
 
-       if(event_is_open)
+       if (event_is_open)
                goto out_busy;
 
        event_is_open = 1;
 
-       spin_unlock_irq (&acpi_system_event_lock);
+       spin_unlock_irq(&acpi_system_event_lock);
        return 0;
 
-out_busy:
-       spin_unlock_irq (&acpi_system_event_lock);
+      out_busy:
+       spin_unlock_irq(&acpi_system_event_lock);
        return -EBUSY;
 }
 
 static ssize_t
-acpi_system_read_event (
-       struct file             *file,
-       char                    __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
+                      loff_t * ppos)
 {
-       int                     result = 0;
-       struct acpi_bus_event   event;
-       static char             str[ACPI_MAX_STRING];
-       static int              chars_remaining = 0;
-       static char             *ptr;
-
+       int result = 0;
+       struct acpi_bus_event event;
+       static char str[ACPI_MAX_STRING];
+       static int chars_remaining = 0;
+       static char *ptr;
 
        ACPI_FUNCTION_TRACE("acpi_system_read_event");
 
@@ -67,10 +62,12 @@ acpi_system_read_event (
                        return_VALUE(-EIO);
                }
 
-               chars_remaining = sprintf(str, "%s %s %08x %08x\n", 
-                       event.device_class?event.device_class:"<unknown>",
-                       event.bus_id?event.bus_id:"<unknown>", 
-                       event.type, event.data);
+               chars_remaining = sprintf(str, "%s %s %08x %08x\n",
+                                         event.device_class ? event.
+                                         device_class : "<unknown>",
+                                         event.bus_id ? event.
+                                         bus_id : "<unknown>", event.type,
+                                         event.data);
                ptr = str;
        }
 
@@ -88,19 +85,15 @@ acpi_system_read_event (
        return_VALUE(count);
 }
 
-static int
-acpi_system_close_event(struct inode *inode, struct file *file)
+static int acpi_system_close_event(struct inode *inode, struct file *file)
 {
-       spin_lock_irq (&acpi_system_event_lock);
+       spin_lock_irq(&acpi_system_event_lock);
        event_is_open = 0;
-       spin_unlock_irq (&acpi_system_event_lock);
+       spin_unlock_irq(&acpi_system_event_lock);
        return 0;
 }
 
-static unsigned int
-acpi_system_poll_event(
-       struct file             *file,
-       poll_table              *wait)
+static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
 {
        poll_wait(file, &acpi_bus_event_queue, wait);
        if (!list_empty(&acpi_bus_event_list))
@@ -109,15 +102,15 @@ acpi_system_poll_event(
 }
 
 static struct file_operations acpi_system_event_ops = {
-       .open =         acpi_system_open_event,
-       .read =         acpi_system_read_event,
-       .release =      acpi_system_close_event,
-       .poll =         acpi_system_poll_event,
+       .open = acpi_system_open_event,
+       .read = acpi_system_read_event,
+       .release = acpi_system_close_event,
+       .poll = acpi_system_poll_event,
 };
 
 static int __init acpi_event_init(void)
 {
-       struct proc_dir_entry   *entry;
+       struct proc_dir_entry *entry;
        int error = 0;
 
        ACPI_FUNCTION_TRACE("acpi_event_init");
@@ -130,8 +123,9 @@ static int __init acpi_event_init(void)
        if (entry)
                entry->proc_fops = &acpi_system_event_ops;
        else {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                                 "Unable to create '%s' proc fs entry\n","event" ));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create '%s' proc fs entry\n",
+                                 "event"));
                error = -EFAULT;
        }
        return_VALUE(error);
index dd3a72a869f4adf0d410ee433d148df529cbec3c..842d1e3fb37b968c66ec45c8a6a5f9485d55df1a 100644 (file)
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evevent")
+ACPI_MODULE_NAME("evevent")
 
 /* Local prototypes */
+static acpi_status acpi_ev_fixed_event_initialize(void);
 
-static acpi_status
-acpi_ev_fixed_event_initialize (
-       void);
-
-static u32
-acpi_ev_fixed_event_dispatch (
-       u32                             event);
-
+static u32 acpi_ev_fixed_event_dispatch(u32 event);
 
 /*******************************************************************************
  *
@@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_initialize_events (
-       void)
+acpi_status acpi_ev_initialize_events(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_initialize_events");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_initialize_events");
 
        /* Make sure we have ACPI tables */
 
        if (!acpi_gbl_DSDT) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        /*
@@ -92,26 +82,22 @@ acpi_ev_initialize_events (
         * enabling SCIs to prevent interrupts from occurring before the handlers are
         * installed.
         */
-       status = acpi_ev_fixed_event_initialize ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                               "Unable to initialize fixed events, %s\n",
-                               acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ev_fixed_event_initialize();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ev_gpe_initialize ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                               "Unable to initialize general purpose events, %s\n",
-                               acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ev_gpe_initialize();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_xrupt_handlers
@@ -124,41 +110,32 @@ acpi_ev_initialize_events (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_install_xrupt_handlers (
-       void)
+acpi_status acpi_ev_install_xrupt_handlers(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
 
        /* Install the SCI handler */
 
-       status = acpi_ev_install_sci_handler ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                               "Unable to install System Control Interrupt Handler, %s\n",
-                               acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ev_install_sci_handler();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /* Install the handler for the Global Lock */
 
-       status = acpi_ev_init_global_lock_handler ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                               "Unable to initialize Global Lock handler, %s\n",
-                               acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ev_init_global_lock_handler();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        acpi_gbl_events_initialized = TRUE;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_initialize
@@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ev_fixed_event_initialize (
-       void)
+static acpi_status acpi_ev_fixed_event_initialize(void)
 {
-       acpi_native_uint                i;
-       acpi_status                     status;
-
+       acpi_native_uint i;
+       acpi_status status;
 
        /*
         * Initialize the structure that keeps track of fixed event handlers
@@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize (
                /* Enable the fixed event */
 
                if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
-                       status = acpi_set_register (
-                                        acpi_gbl_fixed_event_info[i].enable_register_id,
-                                        0, ACPI_MTX_LOCK);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_set_register(acpi_gbl_fixed_event_info[i].
+                                             enable_register_id, 0,
+                                             ACPI_MTX_LOCK);
+                       if (ACPI_FAILURE(status)) {
                                return (status);
                        }
                }
@@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_detect
@@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_fixed_event_detect (
-       void)
+u32 acpi_ev_fixed_event_detect(void)
 {
-       u32                             int_status = ACPI_INTERRUPT_NOT_HANDLED;
-       u32                             fixed_status;
-       u32                             fixed_enable;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_NAME ("ev_fixed_event_detect");
+       u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
+       u32 fixed_status;
+       u32 fixed_enable;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_NAME("ev_fixed_event_detect");
 
        /*
         * Read the fixed feature status and enable registers, as all the cases
         * depend on their values.  Ignore errors here.
         */
-       (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
-                        &fixed_status);
-       (void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
-                        &fixed_enable);
+       (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                   ACPI_REGISTER_PM1_STATUS, &fixed_status);
+       (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                   ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
-               "Fixed Event Block: Enable %08X Status %08X\n",
-               fixed_enable, fixed_status));
+       ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
+                         "Fixed Event Block: Enable %08X Status %08X\n",
+                         fixed_enable, fixed_status));
 
        /*
         * Check for all possible Fixed Events and dispatch those that are active
@@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect (
        for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
                /* Both the status and enable bits must be on for this event */
 
-               if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
-                       (fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
+               if ((fixed_status & acpi_gbl_fixed_event_info[i].
+                    status_bit_mask)
+                   && (fixed_enable & acpi_gbl_fixed_event_info[i].
+                       enable_bit_mask)) {
                        /* Found an active (signalled) event */
 
-                       int_status |= acpi_ev_fixed_event_dispatch ((u32) i);
+                       int_status |= acpi_ev_fixed_event_dispatch((u32) i);
                }
        }
 
        return (int_status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_fixed_event_dispatch
@@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
  *
  ******************************************************************************/
 
-static u32
-acpi_ev_fixed_event_dispatch (
-       u32                             event)
+static u32 acpi_ev_fixed_event_dispatch(u32 event)
 {
 
-
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        /* Clear the status bit */
 
-       (void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
-                        1, ACPI_MTX_DO_NOT_LOCK);
+       (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
+                               status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
 
        /*
         * Make sure we've got a handler.  If not, report an error.
         * The event is disabled to prevent further interrupts.
         */
        if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
-               (void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-                               0, ACPI_MTX_DO_NOT_LOCK);
+               (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
+                                       enable_register_id, 0,
+                                       ACPI_MTX_DO_NOT_LOCK);
 
-               ACPI_REPORT_ERROR (
-                       ("No installed handler for fixed event [%08X]\n",
-                       event));
+               ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
 
                return (ACPI_INTERRUPT_NOT_HANDLED);
        }
 
        /* Invoke the Fixed Event handler */
 
-       return ((acpi_gbl_fixed_event_handlers[event].handler)(
-                         acpi_gbl_fixed_event_handlers[event].context));
+       return ((acpi_gbl_fixed_event_handlers[event].
+                handler) (acpi_gbl_fixed_event_handlers[event].context));
 }
-
-
index 081120b109ba98953e7acc247c50c4580d6d56bd..b2f232df13d89e48eeab7df18f64aabdf24111dc 100644 (file)
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evgpe")
+ACPI_MODULE_NAME("evgpe")
 
 /* Local prototypes */
-
-static void ACPI_SYSTEM_XFACE
-acpi_ev_asynch_execute_gpe_method (
-       void                            *context);
-
+static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
 
 /*******************************************************************************
  *
@@ -69,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_set_gpe_type (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              type)
+acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_set_gpe_type");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_set_gpe_type");
 
        /* Validate type and update register enable masks */
 
@@ -88,21 +80,20 @@ acpi_ev_set_gpe_type (
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Disable the GPE if currently enabled */
 
-       status = acpi_ev_disable_gpe (gpe_event_info);
+       status = acpi_ev_disable_gpe(gpe_event_info);
 
        /* Type was validated above */
 
-       gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
-       gpe_event_info->flags |= type;              /* Insert type */
-       return_ACPI_STATUS (status);
+       gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK;   /* Clear type bits */
+       gpe_event_info->flags |= type;  /* Insert type */
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_update_gpe_enable_masks
@@ -118,57 +109,55 @@ acpi_ev_set_gpe_type (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_update_gpe_enable_masks (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              type)
+acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
+                               u8 type)
 {
-       struct acpi_gpe_register_info   *gpe_register_info;
-       u8                              register_bit;
-
-
-       ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks");
+       struct acpi_gpe_register_info *gpe_register_info;
+       u8 register_bit;
 
+       ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
 
        gpe_register_info = gpe_event_info->register_info;
        if (!gpe_register_info) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
        register_bit = gpe_event_info->register_bit;
 
        /* 1) Disable case.  Simply clear all enable bits */
 
        if (type == ACPI_GPE_DISABLE) {
-               ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
-               ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
-               return_ACPI_STATUS (AE_OK);
+               ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
+                              register_bit);
+               ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* 2) Enable case.  Set/Clear the appropriate enable bits */
 
        switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
        case ACPI_GPE_TYPE_WAKE:
-               ACPI_SET_BIT   (gpe_register_info->enable_for_wake, register_bit);
-               ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
+               ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
+               ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
                break;
 
        case ACPI_GPE_TYPE_RUNTIME:
-               ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
-               ACPI_SET_BIT   (gpe_register_info->enable_for_run, register_bit);
+               ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
+                              register_bit);
+               ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
                break;
 
        case ACPI_GPE_TYPE_WAKE_RUN:
-               ACPI_SET_BIT   (gpe_register_info->enable_for_wake, register_bit);
-               ACPI_SET_BIT   (gpe_register_info->enable_for_run, register_bit);
+               ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
+               ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_enable_gpe
@@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_enable_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              write_to_hardware)
+acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
+                  u8 write_to_hardware)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_enable_gpe");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_enable_gpe");
 
        /* Make sure HW enable masks are updated */
 
-       status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Mark wake-enabled or HW enable, or both */
@@ -206,41 +193,40 @@ acpi_ev_enable_gpe (
        switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
        case ACPI_GPE_TYPE_WAKE:
 
-               ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
                break;
 
        case ACPI_GPE_TYPE_WAKE_RUN:
 
-               ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 
                /*lint -fallthrough */
 
        case ACPI_GPE_TYPE_RUNTIME:
 
-               ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
+               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
 
                if (write_to_hardware) {
                        /* Clear the GPE (of stale events), then enable it */
 
-                       status = acpi_hw_clear_gpe (gpe_event_info);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_hw_clear_gpe(gpe_event_info);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
 
                        /* Enable the requested runtime GPE */
 
-                       status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
+                       status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
                }
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_disable_gpe
@@ -253,36 +239,33 @@ acpi_ev_enable_gpe (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_disable_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info)
+acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_disable_gpe");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_disable_gpe");
 
        if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Make sure HW enable masks are updated */
 
-       status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Mark wake-disabled or HW disable, or both */
 
        switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
        case ACPI_GPE_TYPE_WAKE:
-               ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
                break;
 
        case ACPI_GPE_TYPE_WAKE_RUN:
-               ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
+               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
 
                /*lint -fallthrough */
 
@@ -290,18 +273,17 @@ acpi_ev_disable_gpe (
 
                /* Disable the requested runtime GPE */
 
-               ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
-               status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
+               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
+               status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_get_gpe_event_info
@@ -319,18 +301,14 @@ acpi_ev_disable_gpe (
  *
  ******************************************************************************/
 
-struct acpi_gpe_event_info *
-acpi_ev_get_gpe_event_info (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number)
+struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
+                                                      u32 gpe_number)
 {
-       union acpi_operand_object       *obj_desc;
-       struct acpi_gpe_block_info      *gpe_block;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_operand_object *obj_desc;
+       struct acpi_gpe_block_info *gpe_block;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* A NULL gpe_block means use the FADT-defined GPE block(s) */
 
@@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info (
                for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
                        gpe_block = acpi_gbl_gpe_fadt_blocks[i];
                        if (gpe_block) {
-                               if ((gpe_number >= gpe_block->block_base_number) &&
-                                       (gpe_number < gpe_block->block_base_number +
-                                               (gpe_block->register_count * 8))) {
-                                       return (&gpe_block->event_info[gpe_number -
-                                               gpe_block->block_base_number]);
+                               if ((gpe_number >= gpe_block->block_base_number)
+                                   && (gpe_number <
+                                       gpe_block->block_base_number +
+                                       (gpe_block->register_count * 8))) {
+                                       return (&gpe_block->
+                                               event_info[gpe_number -
+                                                          gpe_block->
+                                                          block_base_number]);
                                }
                        }
                }
@@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info (
 
        /* A Non-NULL gpe_device means this is a GPE Block Device */
 
-       obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device);
-       if (!obj_desc ||
-               !obj_desc->device.gpe_block) {
+       obj_desc =
+           acpi_ns_get_attached_object((struct acpi_namespace_node *)
+                                       gpe_device);
+       if (!obj_desc || !obj_desc->device.gpe_block) {
                return (NULL);
        }
 
        gpe_block = obj_desc->device.gpe_block;
 
        if ((gpe_number >= gpe_block->block_base_number) &&
-               (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
-               return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]);
+           (gpe_number <
+            gpe_block->block_base_number + (gpe_block->register_count * 8))) {
+               return (&gpe_block->
+                       event_info[gpe_number - gpe_block->block_base_number]);
        }
 
        return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_detect
@@ -387,22 +370,20 @@ acpi_ev_get_gpe_event_info (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_gpe_detect (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_list)
+u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
 {
-       u32                             int_status = ACPI_INTERRUPT_NOT_HANDLED;
-       u8                              enabled_status_byte;
-       struct acpi_gpe_register_info   *gpe_register_info;
-       u32                             status_reg;
-       u32                             enable_reg;
-       acpi_status                     status;
-       struct acpi_gpe_block_info      *gpe_block;
-       acpi_native_uint                i;
-       acpi_native_uint                j;
-
-
-       ACPI_FUNCTION_NAME ("ev_gpe_detect");
+       u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
+       u8 enabled_status_byte;
+       struct acpi_gpe_register_info *gpe_register_info;
+       u32 status_reg;
+       u32 enable_reg;
+       u32 flags;
+       acpi_status status;
+       struct acpi_gpe_block_info *gpe_block;
+       acpi_native_uint i;
+       acpi_native_uint j;
+
+       ACPI_FUNCTION_NAME("ev_gpe_detect");
 
        /* Check for the case where there are no GPEs */
 
@@ -412,7 +393,7 @@ acpi_ev_gpe_detect (
 
        /* Examine all GPE blocks attached to this interrupt level */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        gpe_block = gpe_xrupt_list->gpe_block_list_head;
        while (gpe_block) {
                /*
@@ -427,23 +408,30 @@ acpi_ev_gpe_detect (
 
                        /* Read the Status Register */
 
-                       status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg,
-                                        &gpe_register_info->status_address);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
+                                                  &status_reg,
+                                                  &gpe_register_info->
+                                                  status_address);
+                       if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
 
                        /* Read the Enable Register */
 
-                       status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg,
-                                        &gpe_register_info->enable_address);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
+                                                  &enable_reg,
+                                                  &gpe_register_info->
+                                                  enable_address);
+                       if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
-                               "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
-                               gpe_register_info->base_gpe_number, status_reg, enable_reg));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
+                                         "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
+                                         gpe_register_info->base_gpe_number,
+                                         status_reg, enable_reg));
 
                        /* Check if there is anything active at all in this register */
 
@@ -459,14 +447,21 @@ acpi_ev_gpe_detect (
                        for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
                                /* Examine one GPE bit */
 
-                               if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) {
+                               if (enabled_status_byte &
+                                   acpi_gbl_decode_to8bit[j]) {
                                        /*
                                         * Found an active GPE. Dispatch the event to a handler
                                         * or method.
                                         */
-                                       int_status |= acpi_ev_gpe_dispatch (
-                                               &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
-                                               (u32) j + gpe_register_info->base_gpe_number);
+                                       int_status |=
+                                           acpi_ev_gpe_dispatch(&gpe_block->
+                                                                event_info[(i *
+                                                                            ACPI_GPE_REGISTER_WIDTH)
+                                                                           +
+                                                                           j],
+                                                                (u32) j +
+                                                                gpe_register_info->
+                                                                base_gpe_number);
                                }
                        }
                }
@@ -474,13 +469,12 @@ acpi_ev_gpe_detect (
                gpe_block = gpe_block->next;
        }
 
-unlock_and_exit:
+      unlock_and_exit:
 
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR);
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        return (int_status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_asynch_execute_gpe_method
@@ -497,45 +491,41 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_asynch_execute_gpe_method (
-       void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
 {
-       struct acpi_gpe_event_info      *gpe_event_info = (void *) context;
-       u32                             gpe_number = 0;
-       acpi_status                     status;
-       struct acpi_gpe_event_info      local_gpe_event_info;
-       struct acpi_parameter_info      info;
-
+       struct acpi_gpe_event_info *gpe_event_info = (void *)context;
+       u32 gpe_number = 0;
+       acpi_status status;
+       struct acpi_gpe_event_info local_gpe_event_info;
+       struct acpi_parameter_info info;
 
-       ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method");
+       ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
 
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
                return_VOID;
        }
 
        /* Must revalidate the gpe_number/gpe_block */
 
-       if (!acpi_ev_valid_gpe_event (gpe_event_info)) {
-               status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+       if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
+               status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
                return_VOID;
        }
 
        /* Set the GPE flags for return to enabled state */
 
-       (void) acpi_ev_enable_gpe (gpe_event_info, FALSE);
+       (void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
 
        /*
         * Take a snapshot of the GPE info for this level - we copy the
         * info to prevent a race condition with remove_handler/remove_block.
         */
-       ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
-               sizeof (struct acpi_gpe_event_info));
+       ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
+                   sizeof(struct acpi_gpe_event_info));
 
-       status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
                return_VOID;
        }
 
@@ -544,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method (
         * time to avoid race with ev_gpe_install_handler
         */
        if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
-                       ACPI_GPE_DISPATCH_METHOD) {
+           ACPI_GPE_DISPATCH_METHOD) {
                /*
                 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
                 * control method that corresponds to this GPE
                 */
                info.node = local_gpe_event_info.dispatch.method_node;
-               info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info);
+               info.parameters =
+                   ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
                info.parameter_type = ACPI_PARAM_GPE;
 
-               status = acpi_ns_evaluate_by_handle (&info);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "%s while evaluating method [%4.4s] for GPE[%2X]\n",
-                               acpi_format_exception (status),
-                               acpi_ut_get_node_name (local_gpe_event_info.dispatch.method_node),
-                               gpe_number));
+               status = acpi_ns_evaluate_by_handle(&info);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number));
                }
        }
 
        if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-                       ACPI_GPE_LEVEL_TRIGGERED) {
+           ACPI_GPE_LEVEL_TRIGGERED) {
                /*
                 * GPE is level-triggered, we clear the GPE status bit after
                 * handling the event.
                 */
-               status = acpi_hw_clear_gpe (&local_gpe_event_info);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_clear_gpe(&local_gpe_event_info);
+               if (ACPI_FAILURE(status)) {
                        return_VOID;
                }
        }
 
        /* Enable this GPE */
 
-       (void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info);
+       (void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_dispatch
@@ -599,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method (
  ******************************************************************************/
 
 u32
-acpi_ev_gpe_dispatch (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u32                             gpe_number)
+acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_gpe_dispatch");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
 
        /*
         * If edge-triggered, clear the GPE status bit now.  Note that
         * level-triggered events are cleared after the GPE is serviced.
         */
        if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-                       ACPI_GPE_EDGE_TRIGGERED) {
-               status = acpi_hw_clear_gpe (gpe_event_info);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
-                               acpi_format_exception (status), gpe_number));
-                       return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+           ACPI_GPE_EDGE_TRIGGERED) {
+               status = acpi_hw_clear_gpe(gpe_event_info);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
                }
        }
 
        /* Save current system state */
 
        if (acpi_gbl_system_awake_and_running) {
-               ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
-       }
-       else {
-               ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
+               ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
+       } else {
+               ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
        }
 
        /*
@@ -647,19 +626,19 @@ acpi_ev_gpe_dispatch (
                 * Invoke the installed handler (at interrupt level)
                 * Ignore return status for now.  TBD: leave GPE disabled on error?
                 */
-               (void) gpe_event_info->dispatch.handler->address (
-                                 gpe_event_info->dispatch.handler->context);
+               (void)gpe_event_info->dispatch.handler->address(gpe_event_info->
+                                                               dispatch.
+                                                               handler->
+                                                               context);
 
                /* It is now safe to clear level-triggered events. */
 
                if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
-                               ACPI_GPE_LEVEL_TRIGGERED) {
-                       status = acpi_hw_clear_gpe (gpe_event_info);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_ERROR ((
-                                       "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
-                                       acpi_format_exception (status), gpe_number));
-                               return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+                   ACPI_GPE_LEVEL_TRIGGERED) {
+                       status = acpi_hw_clear_gpe(gpe_event_info);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+                               return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
                        }
                }
                break;
@@ -670,24 +649,21 @@ acpi_ev_gpe_dispatch (
                 * Disable GPE, so it doesn't keep firing before the method has a
                 * chance to run.
                 */
-               status = acpi_ev_disable_gpe (gpe_event_info);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
-                               acpi_format_exception (status), gpe_number));
-                       return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+               status = acpi_ev_disable_gpe(gpe_event_info);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
                }
 
                /*
                 * Execute the method associated with the GPE
                 * NOTE: Level-triggered GPEs are cleared after the method completes.
                 */
-               status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
-                                acpi_ev_asynch_execute_gpe_method, gpe_event_info);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
-                               acpi_format_exception (status), gpe_number));
+               status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+                                                    acpi_ev_asynch_execute_gpe_method,
+                                                    gpe_event_info);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number));
                }
                break;
 
@@ -695,28 +671,23 @@ acpi_ev_gpe_dispatch (
 
                /* No handler or method to run! */
 
-               ACPI_REPORT_ERROR ((
-                       "acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n",
-                       gpe_number));
+               ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
 
                /*
                 * Disable the GPE.  The GPE will remain disabled until the ACPI
                 * Core Subsystem is restarted, or a handler is installed.
                 */
-               status = acpi_ev_disable_gpe (gpe_event_info);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
-                               acpi_format_exception (status), gpe_number));
-                       return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+               status = acpi_ev_disable_gpe(gpe_event_info);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
+                       return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
                }
                break;
        }
 
-       return_VALUE (ACPI_INTERRUPT_HANDLED);
+       return_VALUE(ACPI_INTERRUPT_HANDLED);
 }
 
-
 #ifdef ACPI_GPE_NOTIFY_CHECK
 /*******************************************************************************
  * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
@@ -735,35 +706,29 @@ acpi_ev_gpe_dispatch (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_check_for_wake_only_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info)
+acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
 {
-       acpi_status                     status;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
 
-       ACPI_FUNCTION_TRACE ("ev_check_for_wake_only_gpe");
-
-
-       if ((gpe_event_info) &&  /* Only >0 for _Lxx/_Exx */
-          ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */ {
+       if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */
+           ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) {      /* System state at GPE time */
                /* This must be a wake-only GPE, disable it */
 
-               status = acpi_ev_disable_gpe (gpe_event_info);
+               status = acpi_ev_disable_gpe(gpe_event_info);
 
                /* Set GPE to wake-only.  Do not change wake disabled/enabled status */
 
-               acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE);
+               acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
 
-               ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
-                               gpe_event_info));
+               ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
 
                /* This was a wake-only GPE */
 
-               return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
+               return_ACPI_STATUS(AE_WAKE_ONLY_GPE);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 #endif
-
-
index 84186a7d17b2cb414de0622f6c098fd8b44d344a..b312eb33c43ee6086123f2b50a23da722b124091 100644 (file)
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evgpeblk")
+ACPI_MODULE_NAME("evgpeblk")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ev_save_method_info (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *obj_desc,
-       void                            **return_value);
+acpi_ev_save_method_info(acpi_handle obj_handle,
+                        u32 level, void *obj_desc, void **return_value);
 
 static acpi_status
-acpi_ev_match_prw_and_gpe (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *info,
-       void                            **return_value);
+acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
+                         u32 level, void *info, void **return_value);
 
-static struct acpi_gpe_xrupt_info *
-acpi_ev_get_gpe_xrupt_block (
-       u32                             interrupt_level);
+static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
+                                                              interrupt_number);
 
 static acpi_status
-acpi_ev_delete_gpe_xrupt (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt);
+acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt);
 
 static acpi_status
-acpi_ev_install_gpe_block (
-       struct acpi_gpe_block_info      *gpe_block,
-       u32                             interrupt_level);
+acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
+                         u32 interrupt_number);
 
 static acpi_status
-acpi_ev_create_gpe_info_blocks (
-       struct acpi_gpe_block_info      *gpe_block);
-
+acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block);
 
 /*******************************************************************************
  *
@@ -96,16 +84,12 @@ acpi_ev_create_gpe_info_blocks (
  *
  ******************************************************************************/
 
-u8
-acpi_ev_valid_gpe_event (
-       struct acpi_gpe_event_info      *gpe_event_info)
+u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
 {
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_block;
-       struct acpi_gpe_block_info      *gpe_block;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_gpe_xrupt_info *gpe_xrupt_block;
+       struct acpi_gpe_block_info *gpe_block;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* No need for spin lock since we are not changing any list elements */
 
@@ -119,7 +103,10 @@ acpi_ev_valid_gpe_event (
 
                while (gpe_block) {
                        if ((&gpe_block->event_info[0] <= gpe_event_info) &&
-                               (&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) {
+                           (&gpe_block->
+                            event_info[((acpi_size) gpe_block->
+                                        register_count) * 8] >
+                            gpe_event_info)) {
                                return (TRUE);
                        }
 
@@ -132,13 +119,11 @@ acpi_ev_valid_gpe_event (
        return (FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_walk_gpe_list
  *
  * PARAMETERS:  gpe_walk_callback   - Routine called for each GPE block
- *              Flags               - ACPI_NOT_ISR or ACPI_ISR
  *
  * RETURN:      Status
  *
@@ -146,20 +131,16 @@ acpi_ev_valid_gpe_event (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_walk_gpe_list (
-       ACPI_GPE_CALLBACK       gpe_walk_callback,
-       u32                             flags)
+acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
 {
-       struct acpi_gpe_block_info      *gpe_block;
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info;
-       acpi_status                     status = AE_OK;
-
+       struct acpi_gpe_block_info *gpe_block;
+       struct acpi_gpe_xrupt_info *gpe_xrupt_info;
+       acpi_status status = AE_OK;
+       u32 flags;
 
-       ACPI_FUNCTION_TRACE ("ev_walk_gpe_list");
+       ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
 
-
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, flags);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
 
        /* Walk the interrupt level descriptor list */
 
@@ -171,8 +152,8 @@ acpi_ev_walk_gpe_list (
                while (gpe_block) {
                        /* One callback per GPE block */
 
-                       status = gpe_walk_callback (gpe_xrupt_info, gpe_block);
-                       if (ACPI_FAILURE (status)) {
+                       status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
+                       if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
 
@@ -182,12 +163,11 @@ acpi_ev_walk_gpe_list (
                gpe_xrupt_info = gpe_xrupt_info->next;
        }
 
-unlock_and_exit:
-       acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_delete_gpe_handlers
@@ -203,17 +183,14 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ev_delete_gpe_handlers (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                           struct acpi_gpe_block_info *gpe_block)
 {
-       struct acpi_gpe_event_info      *gpe_event_info;
-       acpi_native_uint                i;
-       acpi_native_uint                j;
-
-
-       ACPI_FUNCTION_TRACE ("ev_delete_gpe_handlers");
+       struct acpi_gpe_event_info *gpe_event_info;
+       acpi_native_uint i;
+       acpi_native_uint j;
 
+       ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers");
 
        /* Examine each GPE Register within the block */
 
@@ -221,21 +198,23 @@ acpi_ev_delete_gpe_handlers (
                /* Now look at the individual GPEs in this byte register */
 
                for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
-                       gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
+                       gpe_event_info =
+                           &gpe_block->
+                           event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
 
                        if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
-                                       ACPI_GPE_DISPATCH_HANDLER) {
-                               ACPI_MEM_FREE (gpe_event_info->dispatch.handler);
+                           ACPI_GPE_DISPATCH_HANDLER) {
+                               ACPI_MEM_FREE(gpe_event_info->dispatch.handler);
                                gpe_event_info->dispatch.handler = NULL;
-                               gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
+                               gpe_event_info->flags &=
+                                   ~ACPI_GPE_DISPATCH_MASK;
                        }
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_save_method_info
@@ -259,30 +238,26 @@ acpi_ev_delete_gpe_handlers (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_save_method_info (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *obj_desc,
-       void                            **return_value)
+acpi_ev_save_method_info(acpi_handle obj_handle,
+                        u32 level, void *obj_desc, void **return_value)
 {
-       struct acpi_gpe_block_info      *gpe_block = (void *) obj_desc;
-       struct acpi_gpe_event_info      *gpe_event_info;
-       u32                             gpe_number;
-       char                            name[ACPI_NAME_SIZE + 1];
-       u8                              type;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_save_method_info");
+       struct acpi_gpe_block_info *gpe_block = (void *)obj_desc;
+       struct acpi_gpe_event_info *gpe_event_info;
+       u32 gpe_number;
+       char name[ACPI_NAME_SIZE + 1];
+       u8 type;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_save_method_info");
 
        /*
         * _Lxx and _Exx GPE method support
         *
         * 1) Extract the name from the object and convert to a string
         */
-       ACPI_MOVE_32_TO_32 (name,
-                          &((struct acpi_namespace_node *) obj_handle)->name.integer);
+       ACPI_MOVE_32_TO_32(name,
+                          &((struct acpi_namespace_node *)obj_handle)->name.
+                          integer);
        name[ACPI_NAME_SIZE] = 0;
 
        /*
@@ -304,34 +279,36 @@ acpi_ev_save_method_info (
        default:
                /* Unknown method type, just ignore it! */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n",
-                       name));
-               return_ACPI_STATUS (AE_OK);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n",
+                                 name));
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Convert the last two characters of the name to the GPE Number */
 
-       gpe_number = ACPI_STRTOUL (&name[2], NULL, 16);
+       gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
        if (gpe_number == ACPI_UINT32_MAX) {
                /* Conversion failed; invalid method, just ignore it */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n",
-                       name));
-               return_ACPI_STATUS (AE_OK);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n",
+                                 name));
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Ensure that we have a valid GPE number for this GPE block */
 
        if ((gpe_number < gpe_block->block_base_number) ||
-               (gpe_number >= (gpe_block->block_base_number + (gpe_block->register_count * 8)))) {
+           (gpe_number >=
+            (gpe_block->block_base_number +
+             (gpe_block->register_count * 8)))) {
                /*
                 * Not valid for this GPE block, just ignore it
                 * However, it may be valid for a different GPE block, since GPE0 and GPE1
                 * methods both appear under \_GPE.
                 */
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -339,24 +316,25 @@ acpi_ev_save_method_info (
         * for use during dispatch of this GPE.  Default type is RUNTIME, although
         * this may change when the _PRW methods are executed later.
         */
-       gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
+       gpe_event_info =
+           &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
 
        gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD |
-                          ACPI_GPE_TYPE_RUNTIME);
+                                     ACPI_GPE_TYPE_RUNTIME);
 
-       gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *) obj_handle;
+       gpe_event_info->dispatch.method_node =
+           (struct acpi_namespace_node *)obj_handle;
 
        /* Update enable mask, but don't enable the HW GPE as of yet */
 
-       status = acpi_ev_enable_gpe (gpe_event_info, FALSE);
+       status = acpi_ev_enable_gpe(gpe_event_info, FALSE);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
-               "Registered GPE method %s as GPE number 0x%.2X\n",
-               name, gpe_number));
-       return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                         "Registered GPE method %s as GPE number 0x%.2X\n",
+                         name, gpe_number));
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_match_prw_and_gpe
@@ -373,34 +351,29 @@ acpi_ev_save_method_info (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_match_prw_and_gpe (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *info,
-       void                            **return_value)
+acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
+                         u32 level, void *info, void **return_value)
 {
-       struct acpi_gpe_walk_info       *gpe_info = (void *) info;
-       struct acpi_namespace_node      *gpe_device;
-       struct acpi_gpe_block_info      *gpe_block;
-       struct acpi_namespace_node      *target_gpe_device;
-       struct acpi_gpe_event_info      *gpe_event_info;
-       union acpi_operand_object       *pkg_desc;
-       union acpi_operand_object       *obj_desc;
-       u32                             gpe_number;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_match_prw_and_gpe");
-
+       struct acpi_gpe_walk_info *gpe_info = (void *)info;
+       struct acpi_namespace_node *gpe_device;
+       struct acpi_gpe_block_info *gpe_block;
+       struct acpi_namespace_node *target_gpe_device;
+       struct acpi_gpe_event_info *gpe_event_info;
+       union acpi_operand_object *pkg_desc;
+       union acpi_operand_object *obj_desc;
+       u32 gpe_number;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe");
 
        /* Check for a _PRW method under this device */
 
-       status = acpi_ut_evaluate_object (obj_handle, METHOD_NAME__PRW,
-                        ACPI_BTYPE_PACKAGE, &pkg_desc);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
+                                        ACPI_BTYPE_PACKAGE, &pkg_desc);
+       if (ACPI_FAILURE(status)) {
                /* Ignore all errors from _PRW, we don't want to abort the subsystem */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* The returned _PRW package must have at least two elements */
@@ -420,7 +393,7 @@ acpi_ev_match_prw_and_gpe (
         */
        obj_desc = pkg_desc->package.elements[0];
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                /* Use FADT-defined GPE device (from definition of _PRW) */
 
                target_gpe_device = acpi_gbl_fadt_gpe_device;
@@ -428,22 +401,23 @@ acpi_ev_match_prw_and_gpe (
                /* Integer is the GPE number in the FADT described GPE blocks */
 
                gpe_number = (u32) obj_desc->integer.value;
-       }
-       else if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) {
+       } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
                /* Package contains a GPE reference and GPE number within a GPE block */
 
                if ((obj_desc->package.count < 2) ||
-                       (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
-                       (ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1]) != ACPI_TYPE_INTEGER)) {
+                   (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) !=
+                    ACPI_TYPE_LOCAL_REFERENCE)
+                   || (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) !=
+                       ACPI_TYPE_INTEGER)) {
                        goto cleanup;
                }
 
                /* Get GPE block reference and decode */
 
-               target_gpe_device = obj_desc->package.elements[0]->reference.node;
+               target_gpe_device =
+                   obj_desc->package.elements[0]->reference.node;
                gpe_number = (u32) obj_desc->package.elements[1]->integer.value;
-       }
-       else {
+       } else {
                /* Unknown type, just ignore it */
 
                goto cleanup;
@@ -458,31 +432,37 @@ acpi_ev_match_prw_and_gpe (
         *          associated with the GPE device.
         */
        if ((gpe_device == target_gpe_device) &&
-               (gpe_number >= gpe_block->block_base_number) &&
-               (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
-               gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
+           (gpe_number >= gpe_block->block_base_number) &&
+           (gpe_number <
+            gpe_block->block_base_number + (gpe_block->register_count * 8))) {
+               gpe_event_info =
+                   &gpe_block->event_info[gpe_number -
+                                          gpe_block->block_base_number];
 
                /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
 
-               gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
-               status = acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE);
-               if (ACPI_FAILURE (status)) {
+               gpe_event_info->flags &=
+                   ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
+               status =
+                   acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
-               status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
+               status =
+                   acpi_ev_update_gpe_enable_masks(gpe_event_info,
+                                                   ACPI_GPE_DISABLE);
        }
 
-cleanup:
-       acpi_ut_remove_reference (pkg_desc);
-       return_ACPI_STATUS (AE_OK);
+      cleanup:
+       acpi_ut_remove_reference(pkg_desc);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_get_gpe_xrupt_block
  *
- * PARAMETERS:  interrupt_level     - Interrupt for a GPE block
+ * PARAMETERS:  interrupt_number     - Interrupt for a GPE block
  *
  * RETURN:      A GPE interrupt block
  *
@@ -493,24 +473,22 @@ cleanup:
  *
  ******************************************************************************/
 
-static struct acpi_gpe_xrupt_info *
-acpi_ev_get_gpe_xrupt_block (
-       u32                             interrupt_level)
+static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
+                                                              interrupt_number)
 {
-       struct acpi_gpe_xrupt_info      *next_gpe_xrupt;
-       struct acpi_gpe_xrupt_info      *gpe_xrupt;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
+       struct acpi_gpe_xrupt_info *next_gpe_xrupt;
+       struct acpi_gpe_xrupt_info *gpe_xrupt;
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
 
        /* No need for lock since we are not changing any list elements here */
 
        next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
        while (next_gpe_xrupt) {
-               if (next_gpe_xrupt->interrupt_level == interrupt_level) {
-                       return_PTR (next_gpe_xrupt);
+               if (next_gpe_xrupt->interrupt_number == interrupt_number) {
+                       return_PTR(next_gpe_xrupt);
                }
 
                next_gpe_xrupt = next_gpe_xrupt->next;
@@ -518,16 +496,16 @@ acpi_ev_get_gpe_xrupt_block (
 
        /* Not found, must allocate a new xrupt descriptor */
 
-       gpe_xrupt = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_xrupt_info));
+       gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info));
        if (!gpe_xrupt) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
-       gpe_xrupt->interrupt_level = interrupt_level;
+       gpe_xrupt->interrupt_number = interrupt_number;
 
        /* Install new interrupt descriptor with spin lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        if (acpi_gbl_gpe_xrupt_list_head) {
                next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
                while (next_gpe_xrupt->next) {
@@ -536,29 +514,28 @@ acpi_ev_get_gpe_xrupt_block (
 
                next_gpe_xrupt->next = gpe_xrupt;
                gpe_xrupt->previous = next_gpe_xrupt;
-       }
-       else {
+       } else {
                acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
        /* Install new interrupt handler if not SCI_INT */
 
-       if (interrupt_level != acpi_gbl_FADT->sci_int) {
-               status = acpi_os_install_interrupt_handler (interrupt_level,
-                                acpi_ev_gpe_xrupt_handler, gpe_xrupt);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not install GPE interrupt handler at level 0x%X\n",
-                               interrupt_level));
-                       return_PTR (NULL);
+       if (interrupt_number != acpi_gbl_FADT->sci_int) {
+               status = acpi_os_install_interrupt_handler(interrupt_number,
+                                                          acpi_ev_gpe_xrupt_handler,
+                                                          gpe_xrupt);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not install GPE interrupt handler at level 0x%X\n",
+                                         interrupt_number));
+                       return_PTR(NULL);
                }
        }
 
-       return_PTR (gpe_xrupt);
+       return_PTR(gpe_xrupt);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_delete_gpe_xrupt
@@ -573,33 +550,31 @@ acpi_ev_get_gpe_xrupt_block (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_delete_gpe_xrupt (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt)
+acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_delete_gpe_xrupt");
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
 
        /* We never want to remove the SCI interrupt handler */
 
-       if (gpe_xrupt->interrupt_level == acpi_gbl_FADT->sci_int) {
+       if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
                gpe_xrupt->gpe_block_list_head = NULL;
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Disable this interrupt */
 
-       status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level,
-                          acpi_ev_gpe_xrupt_handler);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number,
+                                                 acpi_ev_gpe_xrupt_handler);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Unlink the interrupt block with lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        if (gpe_xrupt->previous) {
                gpe_xrupt->previous->next = gpe_xrupt->next;
        }
@@ -607,21 +582,20 @@ acpi_ev_delete_gpe_xrupt (
        if (gpe_xrupt->next) {
                gpe_xrupt->next->previous = gpe_xrupt->previous;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
        /* Free the block */
 
-       ACPI_MEM_FREE (gpe_xrupt);
-       return_ACPI_STATUS (AE_OK);
+       ACPI_MEM_FREE(gpe_xrupt);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_gpe_block
  *
  * PARAMETERS:  gpe_block       - New GPE block
- *              interrupt_level - Level to be associated with this GPE block
+ *              interrupt_number - Xrupt to be associated with this GPE block
  *
  * RETURN:      Status
  *
@@ -630,24 +604,22 @@ acpi_ev_delete_gpe_xrupt (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_install_gpe_block (
-       struct acpi_gpe_block_info      *gpe_block,
-       u32                             interrupt_level)
+acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
+                         u32 interrupt_number)
 {
-       struct acpi_gpe_block_info      *next_gpe_block;
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_block;
-       acpi_status                     status;
+       struct acpi_gpe_block_info *next_gpe_block;
+       struct acpi_gpe_xrupt_info *gpe_xrupt_block;
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("ev_install_gpe_block");
 
-       ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
-
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block (interrupt_level);
+       gpe_xrupt_block = acpi_ev_get_gpe_xrupt_block(interrupt_number);
        if (!gpe_xrupt_block) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
@@ -655,7 +627,7 @@ acpi_ev_install_gpe_block (
 
        /* Install the new block at the end of the list with lock */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        if (gpe_xrupt_block->gpe_block_list_head) {
                next_gpe_block = gpe_xrupt_block->gpe_block_list_head;
                while (next_gpe_block->next) {
@@ -664,20 +636,18 @@ acpi_ev_install_gpe_block (
 
                next_gpe_block->next = gpe_block;
                gpe_block->previous = next_gpe_block;
-       }
-       else {
+       } else {
                gpe_xrupt_block->gpe_block_list_head = gpe_block;
        }
 
        gpe_block->xrupt_block = gpe_xrupt_block;
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
-unlock_and_exit:
-       status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_delete_gpe_block
@@ -690,62 +660,57 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_delete_gpe_block (
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_install_gpe_block");
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("ev_install_gpe_block");
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Disable all GPEs in this block */
 
-       status = acpi_hw_disable_gpe_block (gpe_block->xrupt_block, gpe_block);
+       status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
 
        if (!gpe_block->previous && !gpe_block->next) {
                /* This is the last gpe_block on this interrupt */
 
-               status = acpi_ev_delete_gpe_xrupt (gpe_block->xrupt_block);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
-       }
-       else {
+       } else {
                /* Remove the block on this interrupt with lock */
 
-               acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+               flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
                if (gpe_block->previous) {
                        gpe_block->previous->next = gpe_block->next;
-               }
-               else {
-                       gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next;
+               } else {
+                       gpe_block->xrupt_block->gpe_block_list_head =
+                           gpe_block->next;
                }
 
                if (gpe_block->next) {
                        gpe_block->next->previous = gpe_block->previous;
                }
-               acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+               acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
        }
 
        /* Free the gpe_block */
 
-       ACPI_MEM_FREE (gpe_block->register_info);
-       ACPI_MEM_FREE (gpe_block->event_info);
-       ACPI_MEM_FREE (gpe_block);
+       ACPI_MEM_FREE(gpe_block->register_info);
+       ACPI_MEM_FREE(gpe_block->event_info);
+       ACPI_MEM_FREE(gpe_block);
 
-unlock_and_exit:
-       status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_create_gpe_info_blocks
@@ -759,43 +724,41 @@ unlock_and_exit:
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_create_gpe_info_blocks (
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 {
-       struct acpi_gpe_register_info   *gpe_register_info = NULL;
-       struct acpi_gpe_event_info      *gpe_event_info = NULL;
-       struct acpi_gpe_event_info      *this_event;
-       struct acpi_gpe_register_info   *this_register;
-       acpi_native_uint                i;
-       acpi_native_uint                j;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_create_gpe_info_blocks");
+       struct acpi_gpe_register_info *gpe_register_info = NULL;
+       struct acpi_gpe_event_info *gpe_event_info = NULL;
+       struct acpi_gpe_event_info *this_event;
+       struct acpi_gpe_register_info *this_register;
+       acpi_native_uint i;
+       acpi_native_uint j;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks");
 
        /* Allocate the GPE register information block */
 
-       gpe_register_info = ACPI_MEM_CALLOCATE (
-                         (acpi_size) gpe_block->register_count *
-                         sizeof (struct acpi_gpe_register_info));
+       gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block->
+                                              register_count *
+                                              sizeof(struct
+                                                     acpi_gpe_register_info));
        if (!gpe_register_info) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not allocate the gpe_register_info table\n"));
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not allocate the gpe_register_info table\n"));
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
         * Allocate the GPE event_info block. There are eight distinct GPEs
         * per register.  Initialization to zeros is sufficient.
         */
-       gpe_event_info = ACPI_MEM_CALLOCATE (
-                          ((acpi_size) gpe_block->register_count *
-                          ACPI_GPE_REGISTER_WIDTH) *
-                          sizeof (struct acpi_gpe_event_info));
+       gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block->
+                                            register_count *
+                                            ACPI_GPE_REGISTER_WIDTH) *
+                                           sizeof(struct acpi_gpe_event_info));
        if (!gpe_event_info) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not allocate the gpe_event_info table\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not allocate the gpe_event_info table\n"));
                status = AE_NO_MEMORY;
                goto error_exit;
        }
@@ -803,7 +766,7 @@ acpi_ev_create_gpe_info_blocks (
        /* Save the new Info arrays in the GPE block */
 
        gpe_block->register_info = gpe_register_info;
-       gpe_block->event_info  = gpe_event_info;
+       gpe_block->event_info = gpe_event_info;
 
        /*
         * Initialize the GPE Register and Event structures.  A goal of these
@@ -812,29 +775,34 @@ acpi_ev_create_gpe_info_blocks (
         * and the enable registers occupy the second half.
         */
        this_register = gpe_register_info;
-       this_event   = gpe_event_info;
+       this_event = gpe_event_info;
 
        for (i = 0; i < gpe_block->register_count; i++) {
                /* Init the register_info for this GPE register (8 GPEs) */
 
-               this_register->base_gpe_number = (u8) (gpe_block->block_base_number +
-                                  (i * ACPI_GPE_REGISTER_WIDTH));
-
-               ACPI_STORE_ADDRESS (this_register->status_address.address,
-                                (gpe_block->block_address.address
-                                + i));
-
-               ACPI_STORE_ADDRESS (this_register->enable_address.address,
-                                (gpe_block->block_address.address
-                                + i
-                                + gpe_block->register_count));
-
-               this_register->status_address.address_space_id = gpe_block->block_address.address_space_id;
-               this_register->enable_address.address_space_id = gpe_block->block_address.address_space_id;
-               this_register->status_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
-               this_register->enable_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
-               this_register->status_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
-               this_register->enable_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
+               this_register->base_gpe_number =
+                   (u8) (gpe_block->block_base_number +
+                         (i * ACPI_GPE_REGISTER_WIDTH));
+
+               ACPI_STORE_ADDRESS(this_register->status_address.address,
+                                  (gpe_block->block_address.address + i));
+
+               ACPI_STORE_ADDRESS(this_register->enable_address.address,
+                                  (gpe_block->block_address.address
+                                   + i + gpe_block->register_count));
+
+               this_register->status_address.address_space_id =
+                   gpe_block->block_address.address_space_id;
+               this_register->enable_address.address_space_id =
+                   gpe_block->block_address.address_space_id;
+               this_register->status_address.register_bit_width =
+                   ACPI_GPE_REGISTER_WIDTH;
+               this_register->enable_address.register_bit_width =
+                   ACPI_GPE_REGISTER_WIDTH;
+               this_register->status_address.register_bit_offset =
+                   ACPI_GPE_REGISTER_WIDTH;
+               this_register->enable_address.register_bit_offset =
+                   ACPI_GPE_REGISTER_WIDTH;
 
                /* Init the event_info for each GPE within this register */
 
@@ -849,36 +817,36 @@ acpi_ev_create_gpe_info_blocks (
                 * are cleared by writing a '1', while enable registers are cleared
                 * by writing a '0'.
                 */
-               status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0x00,
-                                &this_register->enable_address);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
+                                                &this_register->
+                                                enable_address);
+               if (ACPI_FAILURE(status)) {
                        goto error_exit;
                }
 
-               status = acpi_hw_low_level_write (ACPI_GPE_REGISTER_WIDTH, 0xFF,
-                                &this_register->status_address);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF,
+                                                &this_register->
+                                                status_address);
+               if (ACPI_FAILURE(status)) {
                        goto error_exit;
                }
 
                this_register++;
        }
 
-       return_ACPI_STATUS (AE_OK);
-
+       return_ACPI_STATUS(AE_OK);
 
-error_exit:
+      error_exit:
        if (gpe_register_info) {
-               ACPI_MEM_FREE (gpe_register_info);
+               ACPI_MEM_FREE(gpe_register_info);
        }
        if (gpe_event_info) {
-               ACPI_MEM_FREE (gpe_event_info);
+               ACPI_MEM_FREE(gpe_event_info);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_create_gpe_block
@@ -887,7 +855,7 @@ error_exit:
  *              gpe_block_address   - Address and space_iD
  *              register_count      - Number of GPE register pairs in the block
  *              gpe_block_base_number - Starting GPE number for the block
- *              interrupt_level     - H/W interrupt for the block
+ *              interrupt_number    - H/W interrupt for the block
  *              return_gpe_block    - Where the new block descriptor is returned
  *
  * RETURN:      Status
@@ -897,68 +865,66 @@ error_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ev_create_gpe_block (
-       struct acpi_namespace_node      *gpe_device,
-       struct acpi_generic_address     *gpe_block_address,
-       u32                             register_count,
-       u8                              gpe_block_base_number,
-       u32                             interrupt_level,
-       struct acpi_gpe_block_info      **return_gpe_block)
+acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
+                        struct acpi_generic_address *gpe_block_address,
+                        u32 register_count,
+                        u8 gpe_block_base_number,
+                        u32 interrupt_number,
+                        struct acpi_gpe_block_info **return_gpe_block)
 {
-       struct acpi_gpe_block_info      *gpe_block;
-       struct acpi_gpe_event_info      *gpe_event_info;
-       acpi_native_uint                i;
-       acpi_native_uint                j;
-       u32                             wake_gpe_count;
-       u32                             gpe_enabled_count;
-       acpi_status                     status;
-       struct acpi_gpe_walk_info       gpe_info;
-
-
-       ACPI_FUNCTION_TRACE ("ev_create_gpe_block");
+       struct acpi_gpe_block_info *gpe_block;
+       struct acpi_gpe_event_info *gpe_event_info;
+       acpi_native_uint i;
+       acpi_native_uint j;
+       u32 wake_gpe_count;
+       u32 gpe_enabled_count;
+       acpi_status status;
+       struct acpi_gpe_walk_info gpe_info;
 
+       ACPI_FUNCTION_TRACE("ev_create_gpe_block");
 
        if (!register_count) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Allocate a new GPE block */
 
-       gpe_block = ACPI_MEM_CALLOCATE (sizeof (struct acpi_gpe_block_info));
+       gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info));
        if (!gpe_block) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Initialize the new GPE block */
 
        gpe_block->register_count = register_count;
        gpe_block->block_base_number = gpe_block_base_number;
-       gpe_block->node           = gpe_device;
+       gpe_block->node = gpe_device;
 
-       ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address,
-               sizeof (struct acpi_generic_address));
+       ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
+                   sizeof(struct acpi_generic_address));
 
        /* Create the register_info and event_info sub-structures */
 
-       status = acpi_ev_create_gpe_info_blocks (gpe_block);
-       if (ACPI_FAILURE (status)) {
-               ACPI_MEM_FREE (gpe_block);
-               return_ACPI_STATUS (status);
+       status = acpi_ev_create_gpe_info_blocks(gpe_block);
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(gpe_block);
+               return_ACPI_STATUS(status);
        }
 
        /* Install the new block in the global list(s) */
 
-       status = acpi_ev_install_gpe_block (gpe_block, interrupt_level);
-       if (ACPI_FAILURE (status)) {
-               ACPI_MEM_FREE (gpe_block);
-               return_ACPI_STATUS (status);
+       status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(gpe_block);
+               return_ACPI_STATUS(status);
        }
 
        /* Find all GPE methods (_Lxx, _Exx) for this block */
 
-       status = acpi_ns_walk_namespace (ACPI_TYPE_METHOD, gpe_device,
-                         ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_save_method_info,
-                         gpe_block, NULL);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
+                                       ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+                                       acpi_ev_save_method_info, gpe_block,
+                                       NULL);
 
        /*
         * Runtime option: Should Wake GPEs be enabled at runtime?  The default
@@ -974,9 +940,11 @@ acpi_ev_create_gpe_block (
                gpe_info.gpe_block = gpe_block;
                gpe_info.gpe_device = gpe_device;
 
-               status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-                                 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_match_prw_and_gpe,
-                                 &gpe_info, NULL);
+               status =
+                   acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+                                          ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
+                                          acpi_ev_match_prw_and_gpe, &gpe_info,
+                                          NULL);
        }
 
        /*
@@ -991,10 +959,14 @@ acpi_ev_create_gpe_block (
                for (j = 0; j < 8; j++) {
                        /* Get the info block for this particular GPE */
 
-                       gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
+                       gpe_event_info =
+                           &gpe_block->
+                           event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
 
-                       if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
-                                (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
+                       if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
+                            ACPI_GPE_DISPATCH_METHOD)
+                           && (gpe_event_info->
+                               flags & ACPI_GPE_TYPE_RUNTIME)) {
                                gpe_enabled_count++;
                        }
 
@@ -1006,22 +978,22 @@ acpi_ev_create_gpe_block (
 
        /* Dump info about this GPE block */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-               "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
-               (u32) gpe_block->block_base_number,
-               (u32) (gpe_block->block_base_number +
-                               ((gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) -1)),
-               gpe_device->name.ascii,
-               gpe_block->register_count,
-               interrupt_level));
+       ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                         "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
+                         (u32) gpe_block->block_base_number,
+                         (u32) (gpe_block->block_base_number +
+                                ((gpe_block->register_count *
+                                  ACPI_GPE_REGISTER_WIDTH) - 1)),
+                         gpe_device->name.ascii, gpe_block->register_count,
+                         interrupt_number));
 
        /* Enable all valid GPEs found above */
 
-       status = acpi_hw_enable_runtime_gpe_block (NULL, gpe_block);
+       status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-                       "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
-                       wake_gpe_count, gpe_enabled_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                         "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
+                         wake_gpe_count, gpe_enabled_count));
 
        /* Return the new block */
 
@@ -1029,10 +1001,9 @@ acpi_ev_create_gpe_block (
                (*return_gpe_block) = gpe_block;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_initialize
@@ -1045,22 +1016,18 @@ acpi_ev_create_gpe_block (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_gpe_initialize (
-       void)
+acpi_status acpi_ev_gpe_initialize(void)
 {
-       u32                             register_count0 = 0;
-       u32                             register_count1 = 0;
-       u32                             gpe_number_max = 0;
-       acpi_status                     status;
+       u32 register_count0 = 0;
+       u32 register_count1 = 0;
+       u32 gpe_number_max = 0;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_gpe_initialize");
 
-       ACPI_FUNCTION_TRACE ("ev_gpe_initialize");
-
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -1088,29 +1055,29 @@ acpi_ev_gpe_initialize (
         * If EITHER the register length OR the block address are zero, then that
         * particular block is not supported.
         */
-       if (acpi_gbl_FADT->gpe0_blk_len &&
-               acpi_gbl_FADT->xgpe0_blk.address) {
+       if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
                /* GPE block 0 exists (has both length and address > 0) */
 
                register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
 
-               gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1;
+               gpe_number_max =
+                   (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1;
 
                /* Install GPE Block 0 */
 
-               status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
-                                &acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
-                                acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
+               status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
+                                                 &acpi_gbl_FADT->xgpe0_blk,
+                                                 register_count0, 0,
+                                                 acpi_gbl_FADT->sci_int,
+                                                 &acpi_gbl_gpe_fadt_blocks[0]);
 
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "Could not create GPE Block 0, %s\n",
-                               acpi_format_exception (status)));
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n",
+                                          acpi_format_exception(status)));
                }
        }
 
-       if (acpi_gbl_FADT->gpe1_blk_len &&
-               acpi_gbl_FADT->xgpe1_blk.address) {
+       if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
                /* GPE block 1 exists (has both length and address > 0) */
 
                register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
@@ -1118,29 +1085,26 @@ acpi_ev_gpe_initialize (
                /* Check for GPE0/GPE1 overlap (if both banks exist) */
 
                if ((register_count0) &&
-                       (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
-                       ACPI_REPORT_ERROR ((
-                               "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
-                               gpe_number_max, acpi_gbl_FADT->gpe1_base,
-                               acpi_gbl_FADT->gpe1_base +
-                               ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
+                   (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
+                       ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
 
                        /* Ignore GPE1 block by setting the register count to zero */
 
                        register_count1 = 0;
-               }
-               else {
+               } else {
                        /* Install GPE Block 1 */
 
-                       status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
-                                        &acpi_gbl_FADT->xgpe1_blk, register_count1,
-                                        acpi_gbl_FADT->gpe1_base,
-                                        acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
-
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_REPORT_ERROR ((
-                                       "Could not create GPE Block 1, %s\n",
-                                       acpi_format_exception (status)));
+                       status =
+                           acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
+                                                    &acpi_gbl_FADT->xgpe1_blk,
+                                                    register_count1,
+                                                    acpi_gbl_FADT->gpe1_base,
+                                                    acpi_gbl_FADT->sci_int,
+                                                    &acpi_gbl_gpe_fadt_blocks
+                                                    [1]);
+
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status)));
                        }
 
                        /*
@@ -1148,7 +1112,7 @@ acpi_ev_gpe_initialize (
                         * space. However, GPE0 always starts at GPE number zero.
                         */
                        gpe_number_max = acpi_gbl_FADT->gpe1_base +
-                                         ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
+                           ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
                }
        }
 
@@ -1157,8 +1121,8 @@ acpi_ev_gpe_initialize (
        if ((register_count0 + register_count1) == 0) {
                /* GPEs are not required by ACPI, this is OK */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-                               "There are no GPE blocks defined in the FADT\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                                 "There are no GPE blocks defined in the FADT\n"));
                status = AE_OK;
                goto cleanup;
        }
@@ -1166,15 +1130,12 @@ acpi_ev_gpe_initialize (
        /* Check for Max GPE number out-of-range */
 
        if (gpe_number_max > ACPI_GPE_MAX) {
-               ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
-                       gpe_number_max));
+               ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max));
                status = AE_BAD_VALUE;
                goto cleanup;
        }
 
-cleanup:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (AE_OK);
+      cleanup:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 659e909561124cd89b28ddfaa182f7353e9792da..7e57b8470f55a7aa39af4c97c7d395d411a19499 100644 (file)
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evmisc")
-
+ACPI_MODULE_NAME("evmisc")
 
 #ifdef ACPI_DEBUG_OUTPUT
-static const char                *acpi_notify_value_names[] =
-{
+static const char *acpi_notify_value_names[] = {
        "Bus Check",
        "Device Check",
        "Device Wake",
@@ -66,18 +64,11 @@ static const char                *acpi_notify_value_names[] =
 
 /* Local prototypes */
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_notify_dispatch (
-       void                            *context);
-
-static void ACPI_SYSTEM_XFACE
-acpi_ev_global_lock_thread (
-       void                            *context);
+static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
 
-static u32
-acpi_ev_global_lock_handler (
-       void                            *context);
+static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
 
+static u32 acpi_ev_global_lock_handler(void *context);
 
 /*******************************************************************************
  *
@@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
  *
  ******************************************************************************/
 
-u8
-acpi_ev_is_notify_object (
-       struct acpi_namespace_node      *node)
+u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
 {
        switch (node->type) {
        case ACPI_TYPE_DEVICE:
@@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_queue_notify_request
@@ -128,18 +116,15 @@ acpi_ev_is_notify_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_queue_notify_request (
-       struct acpi_namespace_node      *node,
-       u32                             notify_value)
+acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
+                            u32 notify_value)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *handler_obj = NULL;
-       union acpi_generic_state        *notify_info;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_NAME ("ev_queue_notify_request");
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *handler_obj = NULL;
+       union acpi_generic_state *notify_info;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_NAME("ev_queue_notify_request");
 
        /*
         * For value 3 (Ejection Request), some device method may need to be run.
@@ -148,22 +133,22 @@ acpi_ev_queue_notify_request (
         * For value 0x80 (Status Change) on the power button or sleep button,
         *   initiate soft-off or sleep operation?
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Dispatching Notify(%X) on node %p\n", notify_value, node));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Dispatching Notify(%X) on node %p\n", notify_value,
+                         node));
 
        if (notify_value <= 7) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
-                               acpi_notify_value_names[notify_value]));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Notify value: 0x%2.2X **Device Specific**\n",
-                       notify_value));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
+                                 acpi_notify_value_names[notify_value]));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Notify value: 0x%2.2X **Device Specific**\n",
+                                 notify_value));
        }
 
        /* Get the notify object attached to the NS Node */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (obj_desc) {
                /* We have the notify object, Get the right handler */
 
@@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
                case ACPI_TYPE_POWER:
 
                        if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
-                               handler_obj = obj_desc->common_notify.system_notify;
-                       }
-                       else {
-                               handler_obj = obj_desc->common_notify.device_notify;
+                               handler_obj =
+                                   obj_desc->common_notify.system_notify;
+                       } else {
+                               handler_obj =
+                                   obj_desc->common_notify.device_notify;
                        }
                        break;
 
@@ -189,23 +175,25 @@ acpi_ev_queue_notify_request (
 
        /* If there is any handler to run, schedule the dispatcher */
 
-       if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
-               (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
-               handler_obj) {
-               notify_info = acpi_ut_create_generic_state ();
+       if ((acpi_gbl_system_notify.handler
+            && (notify_value <= ACPI_MAX_SYS_NOTIFY))
+           || (acpi_gbl_device_notify.handler
+               && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
+               notify_info = acpi_ut_create_generic_state();
                if (!notify_info) {
                        return (AE_NO_MEMORY);
                }
 
                notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
-               notify_info->notify.node      = node;
-               notify_info->notify.value     = (u16) notify_value;
+               notify_info->notify.node = node;
+               notify_info->notify.value = (u16) notify_value;
                notify_info->notify.handler_obj = handler_obj;
 
-               status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
-                                 acpi_ev_notify_dispatch, notify_info);
-               if (ACPI_FAILURE (status)) {
-                       acpi_ut_delete_generic_state (notify_info);
+               status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
+                                                    acpi_ev_notify_dispatch,
+                                                    notify_info);
+               if (ACPI_FAILURE(status)) {
+                       acpi_ut_delete_generic_state(notify_info);
                }
        }
 
@@ -214,15 +202,15 @@ acpi_ev_queue_notify_request (
                 * There is no per-device notify handler for this device.
                 * This may or may not be a problem.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "No notify handler for Notify(%4.4s, %X) node %p\n",
-                       acpi_ut_get_node_name (node), notify_value, node));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "No notify handler for Notify(%4.4s, %X) node %p\n",
+                                 acpi_ut_get_node_name(node), notify_value,
+                                 node));
        }
 
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_notify_dispatch
@@ -236,18 +224,15 @@ acpi_ev_queue_notify_request (
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_notify_dispatch (
-       void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
 {
-       union acpi_generic_state        *notify_info = (union acpi_generic_state *) context;
-       acpi_notify_handler             global_handler = NULL;
-       void                            *global_context = NULL;
-       union acpi_operand_object       *handler_obj;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_generic_state *notify_info =
+           (union acpi_generic_state *)context;
+       acpi_notify_handler global_handler = NULL;
+       void *global_context = NULL;
+       union acpi_operand_object *handler_obj;
 
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * We will invoke a global notify handler if installed.
@@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
                        global_handler = acpi_gbl_system_notify.handler;
                        global_context = acpi_gbl_system_notify.context;
                }
-       }
-       else {
+       } else {
                /* Global driver notification handler */
 
                if (acpi_gbl_device_notify.handler) {
@@ -274,25 +258,24 @@ acpi_ev_notify_dispatch (
        /* Invoke the system handler first, if present */
 
        if (global_handler) {
-               global_handler (notify_info->notify.node, notify_info->notify.value,
-                       global_context);
+               global_handler(notify_info->notify.node,
+                              notify_info->notify.value, global_context);
        }
 
        /* Now invoke the per-device handler, if present */
 
        handler_obj = notify_info->notify.handler_obj;
        if (handler_obj) {
-               handler_obj->notify.handler (notify_info->notify.node,
-                       notify_info->notify.value,
-                       handler_obj->notify.context);
+               handler_obj->notify.handler(notify_info->notify.node,
+                                           notify_info->notify.value,
+                                           handler_obj->notify.context);
        }
 
        /* All done with the info object */
 
-       acpi_ut_delete_generic_state (notify_info);
+       acpi_ut_delete_generic_state(notify_info);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_global_lock_thread
@@ -307,27 +290,24 @@ acpi_ev_notify_dispatch (
  *
  ******************************************************************************/
 
-static void ACPI_SYSTEM_XFACE
-acpi_ev_global_lock_thread (
-       void                            *context)
+static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
        /* Signal threads that are waiting for the lock */
 
        if (acpi_gbl_global_lock_thread_count) {
                /* Send sufficient units to the semaphore */
 
-               status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
-                                acpi_gbl_global_lock_thread_count);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
+               status =
+                   acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
+                                            acpi_gbl_global_lock_thread_count);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
                }
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_global_lock_handler
@@ -342,20 +322,17 @@ acpi_ev_global_lock_thread (
  *
  ******************************************************************************/
 
-static u32
-acpi_ev_global_lock_handler (
-       void                            *context)
+static u32 acpi_ev_global_lock_handler(void *context)
 {
-       u8                              acquired = FALSE;
-       acpi_status                     status;
-
+       u8 acquired = FALSE;
+       acpi_status status;
 
        /*
         * Attempt to get the lock
         * If we don't get it now, it will be marked pending and we will
         * take another interrupt when it becomes free.
         */
-       ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
        if (acquired) {
                /* Got the lock, now wake all threads waiting for it */
 
@@ -363,11 +340,11 @@ acpi_ev_global_lock_handler (
 
                /* Run the Global Lock thread which will signal all waiting threads */
 
-               status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
-                                 acpi_ev_global_lock_thread, context);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
-                               acpi_format_exception (status)));
+               status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
+                                                    acpi_ev_global_lock_thread,
+                                                    context);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
 
                        return (ACPI_INTERRUPT_NOT_HANDLED);
                }
@@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
        return (ACPI_INTERRUPT_HANDLED);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_init_global_lock_handler
@@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_init_global_lock_handler (
-       void)
+acpi_status acpi_ev_init_global_lock_handler(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
 
        acpi_gbl_global_lock_present = TRUE;
-       status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
-                        acpi_ev_global_lock_handler, NULL);
+       status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
+                                                 acpi_ev_global_lock_handler,
+                                                 NULL);
 
        /*
         * If the global lock does not exist on this platform, the attempt
@@ -411,14 +384,15 @@ acpi_ev_init_global_lock_handler (
         * with an error.
         */
        if (status == AE_NO_HARDWARE_RESPONSE) {
+               ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
+
                acpi_gbl_global_lock_present = FALSE;
                status = AE_OK;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_acquire_global_lock
@@ -431,22 +405,18 @@ acpi_ev_init_global_lock_handler (
  *
  *****************************************************************************/
 
-acpi_status
-acpi_ev_acquire_global_lock (
-       u16                             timeout)
+acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 {
-       acpi_status                     status = AE_OK;
-       u8                              acquired = FALSE;
-
-
-       ACPI_FUNCTION_TRACE ("ev_acquire_global_lock");
+       acpi_status status = AE_OK;
+       u8 acquired = FALSE;
 
+       ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
 
 #ifndef ACPI_APPLICATION
        /* Make sure that we actually have a global lock */
 
        if (!acpi_gbl_global_lock_present) {
-               return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
+               return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
        }
 #endif
 
@@ -459,37 +429,37 @@ acpi_ev_acquire_global_lock (
         * we are done
         */
        if (acpi_gbl_global_lock_acquired) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* We must acquire the actual hardware lock */
 
-       ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
+       ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
        if (acquired) {
-          /* We got the lock */
+               /* We got the lock */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Acquired the HW Global Lock\n"));
 
                acpi_gbl_global_lock_acquired = TRUE;
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
         * Did not get the lock.  The pending bit was set above, and we must now
         * wait until we get the global lock released interrupt.
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
 
        /*
         * Acquire the global lock semaphore first.
         * Since this wait will block, we must release the interpreter
         */
-       status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
-                         timeout);
-       return_ACPI_STATUS (status);
+       status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
+                                              timeout);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_release_global_lock
@@ -502,21 +472,16 @@ acpi_ev_acquire_global_lock (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_release_global_lock (
-       void)
+acpi_status acpi_ev_release_global_lock(void)
 {
-       u8                              pending = FALSE;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ev_release_global_lock");
+       u8 pending = FALSE;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ev_release_global_lock");
 
        if (!acpi_gbl_global_lock_thread_count) {
-               ACPI_REPORT_WARNING((
-                       "Cannot release HW Global Lock, it has not been acquired\n"));
-               return_ACPI_STATUS (AE_NOT_ACQUIRED);
+               ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
+               return_ACPI_STATUS(AE_NOT_ACQUIRED);
        }
 
        /* One fewer thread has the global lock */
@@ -525,14 +490,14 @@ acpi_ev_release_global_lock (
        if (acpi_gbl_global_lock_thread_count) {
                /* There are still some threads holding the lock, cannot release */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
         * No more threads holding lock, we can do the actual hardware
         * release
         */
-       ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending);
+       ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
        acpi_gbl_global_lock_acquired = FALSE;
 
        /*
@@ -540,14 +505,13 @@ acpi_ev_release_global_lock (
         * register
         */
        if (pending) {
-               status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
-                                1, ACPI_MTX_LOCK);
+               status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
+                                          1, ACPI_MTX_LOCK);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_terminate
@@ -560,16 +524,12 @@ acpi_ev_release_global_lock (
  *
  ******************************************************************************/
 
-void
-acpi_ev_terminate (
-       void)
+void acpi_ev_terminate(void)
 {
-       acpi_native_uint                i;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_terminate");
+       acpi_native_uint i;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_terminate");
 
        if (acpi_gbl_events_initialized) {
                /*
@@ -580,38 +540,39 @@ acpi_ev_terminate (
                /* Disable all fixed events */
 
                for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
-                       status = acpi_disable_event ((u32) i, 0);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Could not disable fixed event %d\n", (u32) i));
+                       status = acpi_disable_event((u32) i, 0);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Could not disable fixed event %d\n",
+                                                 (u32) i));
                        }
                }
 
                /* Disable all GPEs in all GPE blocks */
 
-               status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, ACPI_NOT_ISR);
+               status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
 
                /* Remove SCI handler */
 
-               status = acpi_ev_remove_sci_handler ();
+               status = acpi_ev_remove_sci_handler();
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not remove SCI handler\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not remove SCI handler\n"));
                }
        }
 
        /* Deallocate all handler objects installed within GPE info structs */
 
-       status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers, ACPI_NOT_ISR);
+       status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
 
        /* Return to original mode if necessary */
 
        if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
-               status = acpi_disable ();
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n"));
+               status = acpi_disable();
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                         "acpi_disable failed\n"));
                }
        }
        return_VOID;
 }
-
index a1d7276c5742ff31064c86cc4bb0ab900fb9c5cb..84fad082d80d22205b2c559313ddb6f02e690e00 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evregion")
-
+ACPI_MODULE_NAME("evregion")
 #define ACPI_NUM_DEFAULT_SPACES     4
-
-static u8                   acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
-                        ACPI_ADR_SPACE_SYSTEM_MEMORY,
-                        ACPI_ADR_SPACE_SYSTEM_IO,
-                        ACPI_ADR_SPACE_PCI_CONFIG,
-                        ACPI_ADR_SPACE_DATA_TABLE};
+static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
+       ACPI_ADR_SPACE_SYSTEM_MEMORY,
+       ACPI_ADR_SPACE_SYSTEM_IO,
+       ACPI_ADR_SPACE_PCI_CONFIG,
+       ACPI_ADR_SPACE_DATA_TABLE
+};
 
 /* Local prototypes */
 
 static acpi_status
-acpi_ev_reg_run (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
+acpi_ev_reg_run(acpi_handle obj_handle,
+               u32 level, void *context, void **return_value);
 
 static acpi_status
-acpi_ev_install_handler (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
-
+acpi_ev_install_handler(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value);
 
 /*******************************************************************************
  *
@@ -87,19 +78,16 @@ acpi_ev_install_handler (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_install_region_handlers (
-       void) {
-       acpi_status                     status;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_TRACE ("ev_install_region_handlers");
+acpi_status acpi_ev_install_region_handlers(void)
+{
+       acpi_status status;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE("ev_install_region_handlers");
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -121,9 +109,11 @@ acpi_ev_install_region_handlers (
         * Similar for AE_SAME_HANDLER.
         */
        for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
-               status = acpi_ev_install_space_handler (acpi_gbl_root_node,
-                                 acpi_gbl_default_address_spaces[i],
-                                 ACPI_DEFAULT_HANDLER, NULL, NULL);
+               status = acpi_ev_install_space_handler(acpi_gbl_root_node,
+                                                      acpi_gbl_default_address_spaces
+                                                      [i],
+                                                      ACPI_DEFAULT_HANDLER,
+                                                      NULL, NULL);
                switch (status) {
                case AE_OK:
                case AE_SAME_HANDLER:
@@ -140,12 +130,11 @@ acpi_ev_install_region_handlers (
                }
        }
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_initialize_op_regions
@@ -159,20 +148,16 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_initialize_op_regions (
-       void)
+acpi_status acpi_ev_initialize_op_regions(void)
 {
-       acpi_status                     status;
-       acpi_native_uint                i;
-
+       acpi_status status;
+       acpi_native_uint i;
 
-       ACPI_FUNCTION_TRACE ("ev_initialize_op_regions");
+       ACPI_FUNCTION_TRACE("ev_initialize_op_regions");
 
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -182,15 +167,15 @@ acpi_ev_initialize_op_regions (
                /* TBD: Make sure handler is the DEFAULT handler, otherwise
                 * _REG will have already been run.
                 */
-               status = acpi_ev_execute_reg_methods (acpi_gbl_root_node,
-                                 acpi_gbl_default_address_spaces[i]);
+               status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
+                                                    acpi_gbl_default_address_spaces
+                                                    [i]);
        }
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_execute_reg_method
@@ -205,26 +190,22 @@ acpi_ev_initialize_op_regions (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_execute_reg_method (
-       union acpi_operand_object       *region_obj,
-       u32                             function)
+acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
 {
-       struct acpi_parameter_info      info;
-       union acpi_operand_object       *params[3];
-       union acpi_operand_object       *region_obj2;
-       acpi_status                     status;
-
+       struct acpi_parameter_info info;
+       union acpi_operand_object *params[3];
+       union acpi_operand_object *region_obj2;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ev_execute_reg_method");
+       ACPI_FUNCTION_TRACE("ev_execute_reg_method");
 
-
-       region_obj2 = acpi_ns_get_secondary_object (region_obj);
+       region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        if (region_obj2->extra.method_REG == NULL) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -237,12 +218,12 @@ acpi_ev_execute_reg_method (
         *          0 for disconnecting the handler
         *          Passed as a parameter
         */
-       params[0] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!params[0]) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       params[1] = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!params[1]) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -260,19 +241,18 @@ acpi_ev_execute_reg_method (
 
        /* Execute the method, no return value */
 
-       ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (
-                          ACPI_TYPE_METHOD, info.node, NULL));
-       status = acpi_ns_evaluate_by_handle (&info);
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+                       (ACPI_TYPE_METHOD, info.node, NULL));
+       status = acpi_ns_evaluate_by_handle(&info);
 
-       acpi_ut_remove_reference (params[1]);
+       acpi_ut_remove_reference(params[1]);
 
-cleanup:
-       acpi_ut_remove_reference (params[0]);
+      cleanup:
+       acpi_ut_remove_reference(params[0]);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_address_space_dispatch
@@ -291,40 +271,38 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ev_address_space_dispatch (
-       union acpi_operand_object       *region_obj,
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       void                            *value)
+acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
+                              u32 function,
+                              acpi_physical_address address,
+                              u32 bit_width, void *value)
 {
-       acpi_status                     status;
-       acpi_status                     status2;
-       acpi_adr_space_handler          handler;
-       acpi_adr_space_setup            region_setup;
-       union acpi_operand_object       *handler_desc;
-       union acpi_operand_object       *region_obj2;
-       void                            *region_context = NULL;
+       acpi_status status;
+       acpi_status status2;
+       acpi_adr_space_handler handler;
+       acpi_adr_space_setup region_setup;
+       union acpi_operand_object *handler_desc;
+       union acpi_operand_object *region_obj2;
+       void *region_context = NULL;
 
+       ACPI_FUNCTION_TRACE("ev_address_space_dispatch");
 
-       ACPI_FUNCTION_TRACE ("ev_address_space_dispatch");
-
-
-       region_obj2 = acpi_ns_get_secondary_object (region_obj);
+       region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Ensure that there is a handler associated with this region */
 
        handler_desc = region_obj->region.handler;
        if (!handler_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "No handler for Region [%4.4s] (%p) [%s]\n",
-                       acpi_ut_get_node_name (region_obj->region.node),
-                       region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
-
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No handler for Region [%4.4s] (%p) [%s]\n",
+                                 acpi_ut_get_node_name(region_obj->region.
+                                                       node), region_obj,
+                                 acpi_ut_get_region_name(region_obj->region.
+                                                         space_id)));
+
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /*
@@ -339,10 +317,13 @@ acpi_ev_address_space_dispatch (
                if (!region_setup) {
                        /* No initialization routine, exit with error */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "No init routine for region(%p) [%s]\n",
-                               region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
-                       return_ACPI_STATUS (AE_NOT_EXIST);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "No init routine for region(%p) [%s]\n",
+                                         region_obj,
+                                         acpi_ut_get_region_name(region_obj->
+                                                                 region.
+                                                                 space_id)));
+                       return_ACPI_STATUS(AE_NOT_EXIST);
                }
 
                /*
@@ -350,25 +331,29 @@ acpi_ev_address_space_dispatch (
                 * setup will potentially execute control methods
                 * (e.g., _REG method for this region)
                 */
-               acpi_ex_exit_interpreter ();
+               acpi_ex_exit_interpreter();
 
-               status = region_setup (region_obj, ACPI_REGION_ACTIVATE,
-                                 handler_desc->address_space.context, &region_context);
+               status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
+                                     handler_desc->address_space.context,
+                                     &region_context);
 
                /* Re-enter the interpreter */
 
-               status2 = acpi_ex_enter_interpreter ();
-               if (ACPI_FAILURE (status2)) {
-                       return_ACPI_STATUS (status2);
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+                       return_ACPI_STATUS(status2);
                }
 
                /* Check for failure of the Region Setup */
 
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
-                               acpi_format_exception (status),
-                               acpi_ut_get_region_name (region_obj->region.space_id)));
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Region Init: %s [%s]\n",
+                                         acpi_format_exception(status),
+                                         acpi_ut_get_region_name(region_obj->
+                                                                 region.
+                                                                 space_id)));
+                       return_ACPI_STATUS(status);
                }
 
                /*
@@ -380,14 +365,14 @@ acpi_ev_address_space_dispatch (
                        if (region_obj2->extra.region_context) {
                                /* The handler for this region was already installed */
 
-                               ACPI_MEM_FREE (region_context);
-                       }
-                       else {
+                               ACPI_MEM_FREE(region_context);
+                       } else {
                                /*
                                 * Save the returned context for use in all accesses to
                                 * this particular region
                                 */
-                               region_obj2->extra.region_context = region_context;
+                               region_obj2->extra.region_context =
+                                   region_context;
                        }
                }
        }
@@ -396,13 +381,16 @@ acpi_ev_address_space_dispatch (
 
        handler = handler_desc->address_space.handler;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
-               &region_obj->region.handler->address_space, handler,
-               ACPI_FORMAT_UINT64 (address),
-               acpi_ut_get_region_name (region_obj->region.space_id)));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
+                         &region_obj->region.handler->address_space, handler,
+                         ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(region_obj->region.
+                                                 space_id)));
 
-       if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!
+           (handler_desc->address_space.
+            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * For handlers other than the default (supplied) handlers, we must
                 * exit the interpreter because the handler *might* block -- we don't
@@ -413,31 +401,33 @@ acpi_ev_address_space_dispatch (
 
        /* Call the handler */
 
-       status = handler (function, address, bit_width, value,
+       status = handler(function, address, bit_width, value,
                         handler_desc->address_space.context,
                         region_obj2->extra.region_context);
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
-                       acpi_ut_get_region_name (region_obj->region.space_id),
-                       acpi_format_exception (status)));
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n",
+                                  acpi_ut_get_region_name(region_obj->region.
+                                                          space_id),
+                                  acpi_format_exception(status)));
        }
 
-       if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
+       if (!
+           (handler_desc->address_space.
+            hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
                /*
                 * We just returned from a non-default handler, we must re-enter the
                 * interpreter
                 */
-               status2 = acpi_ex_enter_interpreter ();
-               if (ACPI_FAILURE (status2)) {
-                       return_ACPI_STATUS (status2);
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
+                       return_ACPI_STATUS(status2);
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_detach_region
@@ -453,23 +443,20 @@ acpi_ev_address_space_dispatch (
  ******************************************************************************/
 
 void
-acpi_ev_detach_region(
-       union acpi_operand_object       *region_obj,
-       u8                              acpi_ns_is_locked)
+acpi_ev_detach_region(union acpi_operand_object *region_obj,
+                     u8 acpi_ns_is_locked)
 {
-       union acpi_operand_object       *handler_obj;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       **last_obj_ptr;
-       acpi_adr_space_setup            region_setup;
-       void                            **region_context;
-       union acpi_operand_object       *region_obj2;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_detach_region");
+       union acpi_operand_object *handler_obj;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object **last_obj_ptr;
+       acpi_adr_space_setup region_setup;
+       void **region_context;
+       union acpi_operand_object *region_obj2;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_detach_region");
 
-       region_obj2 = acpi_ns_get_secondary_object (region_obj);
+       region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
                return_VOID;
        }
@@ -493,34 +480,39 @@ acpi_ev_detach_region(
                /* Is this the correct Region? */
 
                if (obj_desc == region_obj) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                               "Removing Region %p from address handler %p\n",
-                               region_obj, handler_obj));
+                       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                         "Removing Region %p from address handler %p\n",
+                                         region_obj, handler_obj));
 
                        /* This is it, remove it from the handler's list */
 
                        *last_obj_ptr = obj_desc->region.next;
-                       obj_desc->region.next = NULL;           /* Must clear field */
+                       obj_desc->region.next = NULL;   /* Must clear field */
 
                        if (acpi_ns_is_locked) {
-                               status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+                               if (ACPI_FAILURE(status)) {
                                        return_VOID;
                                }
                        }
 
                        /* Now stop region accesses by executing the _REG method */
 
-                       status = acpi_ev_execute_reg_method (region_obj, 0);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
-                                       acpi_format_exception (status),
-                                       acpi_ut_get_region_name (region_obj->region.space_id)));
+                       status = acpi_ev_execute_reg_method(region_obj, 0);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "%s from region _REG, [%s]\n",
+                                                 acpi_format_exception(status),
+                                                 acpi_ut_get_region_name
+                                                 (region_obj->region.
+                                                  space_id)));
                        }
 
                        if (acpi_ns_is_locked) {
-                               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+                               if (ACPI_FAILURE(status)) {
                                        return_VOID;
                                }
                        }
@@ -528,15 +520,20 @@ acpi_ev_detach_region(
                        /* Call the setup handler with the deactivate notification */
 
                        region_setup = handler_obj->address_space.setup;
-                       status = region_setup (region_obj, ACPI_REGION_DEACTIVATE,
-                                         handler_obj->address_space.context, region_context);
+                       status =
+                           region_setup(region_obj, ACPI_REGION_DEACTIVATE,
+                                        handler_obj->address_space.context,
+                                        region_context);
 
                        /* Init routine may fail, Just ignore errors */
 
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
-                                       acpi_format_exception (status),
-                                       acpi_ut_get_region_name (region_obj->region.space_id)));
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "%s from region init, [%s]\n",
+                                                 acpi_format_exception(status),
+                                                 acpi_ut_get_region_name
+                                                 (region_obj->region.
+                                                  space_id)));
                        }
 
                        region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
@@ -552,7 +549,7 @@ acpi_ev_detach_region(
                         * this better be the region's handler
                         */
                        region_obj->region.handler = NULL;
-                       acpi_ut_remove_reference (handler_obj);
+                       acpi_ut_remove_reference(handler_obj);
 
                        return_VOID;
                }
@@ -565,14 +562,13 @@ acpi_ev_detach_region(
 
        /* If we get here, the region was not in the handler's region list */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "Cannot remove region %p from address handler %p\n",
-               region_obj, handler_obj));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "Cannot remove region %p from address handler %p\n",
+                         region_obj, handler_obj));
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_attach_region
@@ -589,20 +585,19 @@ acpi_ev_detach_region(
  ******************************************************************************/
 
 acpi_status
-acpi_ev_attach_region (
-       union acpi_operand_object       *handler_obj,
-       union acpi_operand_object       *region_obj,
-       u8                              acpi_ns_is_locked)
+acpi_ev_attach_region(union acpi_operand_object *handler_obj,
+                     union acpi_operand_object *region_obj,
+                     u8 acpi_ns_is_locked)
 {
 
-       ACPI_FUNCTION_TRACE ("ev_attach_region");
-
+       ACPI_FUNCTION_TRACE("ev_attach_region");
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "Adding Region [%4.4s] %p to address handler %p [%s]\n",
-               acpi_ut_get_node_name (region_obj->region.node),
-               region_obj, handler_obj,
-               acpi_ut_get_region_name (region_obj->region.space_id)));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "Adding Region [%4.4s] %p to address handler %p [%s]\n",
+                         acpi_ut_get_node_name(region_obj->region.node),
+                         region_obj, handler_obj,
+                         acpi_ut_get_region_name(region_obj->region.
+                                                 space_id)));
 
        /* Link this region to the front of the handler's list */
 
@@ -612,16 +607,15 @@ acpi_ev_attach_region (
        /* Install the region's handler */
 
        if (region_obj->region.handler) {
-               return_ACPI_STATUS (AE_ALREADY_EXISTS);
+               return_ACPI_STATUS(AE_ALREADY_EXISTS);
        }
 
        region_obj->region.handler = handler_obj;
-       acpi_ut_add_reference (handler_obj);
+       acpi_ut_add_reference(handler_obj);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_handler
@@ -640,23 +634,18 @@ acpi_ev_attach_region (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_install_handler (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ev_install_handler(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value)
 {
-       union acpi_operand_object       *handler_obj;
-       union acpi_operand_object       *next_handler_obj;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
+       union acpi_operand_object *handler_obj;
+       union acpi_operand_object *next_handler_obj;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_NAME("ev_install_handler");
 
-       ACPI_FUNCTION_NAME ("ev_install_handler");
-
-
-       handler_obj = (union acpi_operand_object   *) context;
+       handler_obj = (union acpi_operand_object *)context;
 
        /* Parameter validation */
 
@@ -666,7 +655,7 @@ acpi_ev_install_handler (
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
+       node = acpi_ns_map_handle_to_node(obj_handle);
        if (!node) {
                return (AE_BAD_PARAMETER);
        }
@@ -676,14 +665,13 @@ acpi_ev_install_handler (
         * that are allowed to have address space handlers
         */
        if ((node->type != ACPI_TYPE_DEVICE) &&
-               (node->type != ACPI_TYPE_REGION) &&
-               (node != acpi_gbl_root_node)) {
+           (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
                return (AE_OK);
        }
 
        /* Check for an existing internal object */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
                /* No object, just exit */
 
@@ -692,18 +680,22 @@ acpi_ev_install_handler (
 
        /* Devices are handled different than regions */
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_DEVICE) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
                /* Check if this Device already has a handler for this address space */
 
                next_handler_obj = obj_desc->device.handler;
                while (next_handler_obj) {
                        /* Found a handler, is it for the same address space? */
 
-                       if (next_handler_obj->address_space.space_id == handler_obj->address_space.space_id) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                                       "Found handler for region [%s] in device %p(%p) handler %p\n",
-                                       acpi_ut_get_region_name (handler_obj->address_space.space_id),
-                                       obj_desc, next_handler_obj, handler_obj));
+                       if (next_handler_obj->address_space.space_id ==
+                           handler_obj->address_space.space_id) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                                 "Found handler for region [%s] in device %p(%p) handler %p\n",
+                                                 acpi_ut_get_region_name
+                                                 (handler_obj->address_space.
+                                                  space_id), obj_desc,
+                                                 next_handler_obj,
+                                                 handler_obj));
 
                                /*
                                 * Since the object we found it on was a device, then it
@@ -744,15 +736,14 @@ acpi_ev_install_handler (
         *
         * First disconnect region for any previous handler (if any)
         */
-       acpi_ev_detach_region (obj_desc, FALSE);
+       acpi_ev_detach_region(obj_desc, FALSE);
 
        /* Connect the region to the new handler */
 
-       status = acpi_ev_attach_region (handler_obj, obj_desc, FALSE);
+       status = acpi_ev_attach_region(handler_obj, obj_desc, FALSE);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_space_handler
@@ -771,32 +762,27 @@ acpi_ev_install_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_install_space_handler (
-       struct acpi_namespace_node      *node,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler,
-       acpi_adr_space_setup            setup,
-       void                            *context)
+acpi_ev_install_space_handler(struct acpi_namespace_node * node,
+                             acpi_adr_space_type space_id,
+                             acpi_adr_space_handler handler,
+                             acpi_adr_space_setup setup, void *context)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *handler_obj;
-       acpi_status                     status;
-       acpi_object_type                type;
-       u16                             flags = 0;
-
-
-       ACPI_FUNCTION_TRACE ("ev_install_space_handler");
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *handler_obj;
+       acpi_status status;
+       acpi_object_type type;
+       u16 flags = 0;
 
+       ACPI_FUNCTION_TRACE("ev_install_space_handler");
 
        /*
         * This registration is valid for only the types below
         * and the root.  This is where the default handlers
         * get placed.
         */
-       if ((node->type != ACPI_TYPE_DEVICE)     &&
-               (node->type != ACPI_TYPE_PROCESSOR)  &&
-               (node->type != ACPI_TYPE_THERMAL)    &&
-               (node != acpi_gbl_root_node)) {
+       if ((node->type != ACPI_TYPE_DEVICE) &&
+           (node->type != ACPI_TYPE_PROCESSOR) &&
+           (node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
@@ -807,32 +793,32 @@ acpi_ev_install_space_handler (
                switch (space_id) {
                case ACPI_ADR_SPACE_SYSTEM_MEMORY:
                        handler = acpi_ex_system_memory_space_handler;
-                       setup   = acpi_ev_system_memory_region_setup;
+                       setup = acpi_ev_system_memory_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_SYSTEM_IO:
                        handler = acpi_ex_system_io_space_handler;
-                       setup   = acpi_ev_io_space_region_setup;
+                       setup = acpi_ev_io_space_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_PCI_CONFIG:
                        handler = acpi_ex_pci_config_space_handler;
-                       setup   = acpi_ev_pci_config_region_setup;
+                       setup = acpi_ev_pci_config_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_CMOS:
                        handler = acpi_ex_cmos_space_handler;
-                       setup   = acpi_ev_cmos_region_setup;
+                       setup = acpi_ev_cmos_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_PCI_BAR_TARGET:
                        handler = acpi_ex_pci_bar_space_handler;
-                       setup   = acpi_ev_pci_bar_region_setup;
+                       setup = acpi_ev_pci_bar_region_setup;
                        break;
 
                case ACPI_ADR_SPACE_DATA_TABLE:
                        handler = acpi_ex_data_table_space_handler;
-                       setup   = NULL;
+                       setup = NULL;
                        break;
 
                default:
@@ -849,7 +835,7 @@ acpi_ev_install_space_handler (
 
        /* Check for an existing internal object */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (obj_desc) {
                /*
                 * The attached device object already exists.
@@ -863,7 +849,8 @@ acpi_ev_install_space_handler (
                        /* Same space_id indicates a handler already installed */
 
                        if (handler_obj->address_space.space_id == space_id) {
-                               if (handler_obj->address_space.handler == handler) {
+                               if (handler_obj->address_space.handler ==
+                                   handler) {
                                        /*
                                         * It is (relatively) OK to attempt to install the SAME
                                         * handler twice. This can easily happen
@@ -871,8 +858,7 @@ acpi_ev_install_space_handler (
                                         */
                                        status = AE_SAME_HANDLER;
                                        goto unlock_and_exit;
-                               }
-                               else {
+                               } else {
                                        /* A handler is already installed */
 
                                        status = AE_ALREADY_EXISTS;
@@ -884,21 +870,20 @@ acpi_ev_install_space_handler (
 
                        handler_obj = handler_obj->address_space.next;
                }
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                       "Creating object on Device %p while installing handler\n", node));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                 "Creating object on Device %p while installing handler\n",
+                                 node));
 
                /* obj_desc does not exist, create one */
 
                if (node->type == ACPI_TYPE_ANY) {
                        type = ACPI_TYPE_DEVICE;
-               }
-               else {
+               } else {
                        type = node->type;
                }
 
-               obj_desc = acpi_ut_create_internal_object (type);
+               obj_desc = acpi_ut_create_internal_object(type);
                if (!obj_desc) {
                        status = AE_NO_MEMORY;
                        goto unlock_and_exit;
@@ -910,21 +895,21 @@ acpi_ev_install_space_handler (
 
                /* Attach the new object to the Node */
 
-               status = acpi_ns_attach_object (node, obj_desc, type);
+               status = acpi_ns_attach_object(node, obj_desc, type);
 
                /* Remove local reference to the object */
 
-               acpi_ut_remove_reference (obj_desc);
+               acpi_ut_remove_reference(obj_desc);
 
-               if (ACPI_FAILURE (status)) {
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
-               acpi_ut_get_region_name (space_id), space_id,
-               acpi_ut_get_node_name (node), node, obj_desc));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
+                         acpi_ut_get_region_name(space_id), space_id,
+                         acpi_ut_get_node_name(node), node, obj_desc));
 
        /*
         * Install the handler
@@ -933,7 +918,8 @@ acpi_ev_install_space_handler (
         * Just allocate the object for the handler and link it
         * into the list.
         */
-       handler_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
+       handler_obj =
+           acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
        if (!handler_obj) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
@@ -941,17 +927,17 @@ acpi_ev_install_space_handler (
 
        /* Init handler obj */
 
-       handler_obj->address_space.space_id  = (u8) space_id;
-       handler_obj->address_space.hflags    = flags;
+       handler_obj->address_space.space_id = (u8) space_id;
+       handler_obj->address_space.hflags = flags;
        handler_obj->address_space.region_list = NULL;
-       handler_obj->address_space.node      = node;
-       handler_obj->address_space.handler   = handler;
-       handler_obj->address_space.context   = context;
-       handler_obj->address_space.setup     = setup;
+       handler_obj->address_space.node = node;
+       handler_obj->address_space.handler = handler;
+       handler_obj->address_space.context = context;
+       handler_obj->address_space.setup = setup;
 
        /* Install at head of Device.address_space list */
 
-       handler_obj->address_space.next      = obj_desc->device.handler;
+       handler_obj->address_space.next = obj_desc->device.handler;
 
        /*
         * The Device object is the first reference on the handler_obj.
@@ -971,15 +957,15 @@ acpi_ev_install_space_handler (
         * In either case, back up and search down the remainder
         * of the branch
         */
-       status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
-                         ACPI_NS_WALK_UNLOCK, acpi_ev_install_handler,
-                         handler_obj, NULL);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
+                                       ACPI_NS_WALK_UNLOCK,
+                                       acpi_ev_install_handler, handler_obj,
+                                       NULL);
 
-unlock_and_exit:
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_execute_reg_methods
@@ -995,15 +981,12 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ev_execute_reg_methods (
-       struct acpi_namespace_node      *node,
-       acpi_adr_space_type             space_id)
+acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
+                           acpi_adr_space_type space_id)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_execute_reg_methods");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_execute_reg_methods");
 
        /*
         * Run all _REG methods for all Operation Regions for this
@@ -1012,14 +995,13 @@ acpi_ev_execute_reg_methods (
         * must be installed for all regions of this Space ID before we
         * can run any _REG methods)
         */
-       status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
-                         ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
-                         &space_id, NULL);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
+                                       ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
+                                       &space_id, NULL);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_reg_run
@@ -1031,23 +1013,19 @@ acpi_ev_execute_reg_methods (
  ******************************************************************************/
 
 static acpi_status
-acpi_ev_reg_run (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ev_reg_run(acpi_handle obj_handle,
+               u32 level, void *context, void **return_value)
 {
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       acpi_adr_space_type             space_id;
-       acpi_status                     status;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       acpi_adr_space_type space_id;
+       acpi_status status;
 
-
-       space_id = *ACPI_CAST_PTR (acpi_adr_space_type, context);
+       space_id = *ACPI_CAST_PTR(acpi_adr_space_type, context);
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
+       node = acpi_ns_map_handle_to_node(obj_handle);
        if (!node) {
                return (AE_BAD_PARAMETER);
        }
@@ -1056,14 +1034,13 @@ acpi_ev_reg_run (
         * We only care about regions.and objects
         * that are allowed to have address space handlers
         */
-       if ((node->type != ACPI_TYPE_REGION) &&
-               (node != acpi_gbl_root_node)) {
+       if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
                return (AE_OK);
        }
 
        /* Check for an existing internal object */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
                /* No object, just exit */
 
@@ -1080,7 +1057,6 @@ acpi_ev_reg_run (
                return (AE_OK);
        }
 
-       status = acpi_ev_execute_reg_method (obj_desc, 1);
+       status = acpi_ev_execute_reg_method(obj_desc, 1);
        return (status);
 }
-
index 95bc09c73a6aa359d19f19c9b508251ac9761912..a1bd2da27c45e5517d533459b79debae3e262404 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evrgnini")
-
+ACPI_MODULE_NAME("evrgnini")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Setup a system_memory operation region
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ev_system_memory_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_system_memory_region_setup(acpi_handle handle,
+                                  u32 function,
+                                  void *handler_context, void **region_context)
 {
-       union acpi_operand_object       *region_desc = (union acpi_operand_object *) handle;
-       struct acpi_mem_space_context   *local_region_context;
-
-
-       ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup");
+       union acpi_operand_object *region_desc =
+           (union acpi_operand_object *)handle;
+       struct acpi_mem_space_context *local_region_context;
 
+       ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
 
        if (function == ACPI_REGION_DEACTIVATE) {
                if (*region_context) {
-                       ACPI_MEM_FREE (*region_context);
+                       ACPI_MEM_FREE(*region_context);
                        *region_context = NULL;
                }
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Create a new context */
 
-       local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context));
+       local_region_context =
+           ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context));
        if (!(local_region_context)) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Save the region length and address for use in the handler */
@@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup (
        local_region_context->address = region_desc->region.address;
 
        *region_context = local_region_context;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_io_space_region_setup
@@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_io_space_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_io_space_region_setup(acpi_handle handle,
+                             u32 function,
+                             void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE ("ev_io_space_region_setup");
-
+       ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
-       }
-       else {
+       } else {
                *region_context = handler_context;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_pci_config_region_setup
@@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_pci_config_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_pci_config_region_setup(acpi_handle handle,
+                               u32 function,
+                               void *handler_context, void **region_context)
 {
-       acpi_status                     status = AE_OK;
-       acpi_integer                    pci_value;
-       struct acpi_pci_id              *pci_id = *region_context;
-       union acpi_operand_object       *handler_obj;
-       struct acpi_namespace_node      *parent_node;
-       struct acpi_namespace_node      *pci_root_node;
-       union acpi_operand_object       *region_obj = (union acpi_operand_object   *) handle;
-       struct acpi_device_id           object_hID;
-
-
-       ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup");
-
+       acpi_status status = AE_OK;
+       acpi_integer pci_value;
+       struct acpi_pci_id *pci_id = *region_context;
+       union acpi_operand_object *handler_obj;
+       struct acpi_namespace_node *parent_node;
+       struct acpi_namespace_node *pci_root_node;
+       union acpi_operand_object *region_obj =
+           (union acpi_operand_object *)handle;
+       struct acpi_device_id object_hID;
+
+       ACPI_FUNCTION_TRACE("ev_pci_config_region_setup");
 
        handler_obj = region_obj->region.handler;
        if (!handler_obj) {
@@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup (
                 * No installed handler. This shouldn't happen because the dispatch
                 * routine checks before we get here, but we check again just in case.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                       "Attempting to init a region %p, with no handler\n", region_obj));
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                 "Attempting to init a region %p, with no handler\n",
+                                 region_obj));
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        *region_context = NULL;
        if (function == ACPI_REGION_DEACTIVATE) {
                if (pci_id) {
-                       ACPI_MEM_FREE (pci_id);
+                       ACPI_MEM_FREE(pci_id);
                }
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
-       parent_node = acpi_ns_get_parent_node (region_obj->region.node);
+       parent_node = acpi_ns_get_parent_node(region_obj->region.node);
 
        /*
         * Get the _SEG and _BBN values from the device upon which the handler
@@ -216,18 +203,28 @@ acpi_ev_pci_config_region_setup (
 
                pci_root_node = parent_node;
                while (pci_root_node != acpi_gbl_root_node) {
-                       status = acpi_ut_execute_HID (pci_root_node, &object_hID);
-                       if (ACPI_SUCCESS (status)) {
-                               /* Got a valid _HID, check if this is a PCI root */
-
-                               if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
-                                                  sizeof (PCI_ROOT_HID_STRING)))) {
+                       status =
+                           acpi_ut_execute_HID(pci_root_node, &object_hID);
+                       if (ACPI_SUCCESS(status)) {
+                               /*
+                                * Got a valid _HID string, check if this is a PCI root.
+                                * New for ACPI 3.0: check for a PCI Express root also.
+                                */
+                               if (!
+                                   (ACPI_STRNCMP
+                                    (object_hID.value, PCI_ROOT_HID_STRING,
+                                     sizeof(PCI_ROOT_HID_STRING))
+                                    ||
+                                    !(ACPI_STRNCMP
+                                      (object_hID.value,
+                                       PCI_EXPRESS_ROOT_HID_STRING,
+                                       sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
+                               {
                                        /* Install a handler for this PCI root bridge */
 
-                                       status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
-                                                          ACPI_ADR_SPACE_PCI_CONFIG,
-                                                          ACPI_DEFAULT_HANDLER, NULL, NULL);
-                                       if (ACPI_FAILURE (status)) {
+                                       status =
+                                           acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
+                                       if (ACPI_FAILURE(status)) {
                                                if (status == AE_SAME_HANDLER) {
                                                        /*
                                                         * It is OK if the handler is already installed on the root
@@ -235,23 +232,19 @@ acpi_ev_pci_config_region_setup (
                                                         * new PCI_Config operation region, however.
                                                         */
                                                        status = AE_OK;
-                                               }
-                                               else {
-                                                       ACPI_REPORT_ERROR ((
-                                                               "Could not install pci_config handler for Root Bridge %4.4s, %s\n",
-                                                               acpi_ut_get_node_name (pci_root_node), acpi_format_exception (status)));
+                                               } else {
+                                                       ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status)));
                                                }
                                        }
                                        break;
                                }
                        }
 
-                       pci_root_node = acpi_ns_get_parent_node (pci_root_node);
+                       pci_root_node = acpi_ns_get_parent_node(pci_root_node);
                }
 
                /* PCI root bridge not found, use namespace root node */
-       }
-       else {
+       } else {
                pci_root_node = handler_obj->address_space.node;
        }
 
@@ -260,14 +253,14 @@ acpi_ev_pci_config_region_setup (
         * (install_address_space_handler could have initialized it)
         */
        if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Region is still not initialized. Create a new context */
 
-       pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
+       pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id));
        if (!pci_id) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
@@ -279,40 +272,45 @@ acpi_ev_pci_config_region_setup (
         * Get the PCI device and function numbers from the _ADR object
         * contained in the parent's scope.
         */
-       status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value);
+       status =
+           acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node,
+                                           &pci_value);
 
        /*
         * The default is zero, and since the allocation above zeroed
         * the data, just do nothing on failure.
         */
-       if (ACPI_SUCCESS (status)) {
-               pci_id->device  = ACPI_HIWORD (ACPI_LODWORD (pci_value));
-               pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value));
+       if (ACPI_SUCCESS(status)) {
+               pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
+               pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value));
        }
 
        /* The PCI segment number comes from the _SEG method */
 
-       status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
-       if (ACPI_SUCCESS (status)) {
-               pci_id->segment = ACPI_LOWORD (pci_value);
+       status =
+           acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node,
+                                           &pci_value);
+       if (ACPI_SUCCESS(status)) {
+               pci_id->segment = ACPI_LOWORD(pci_value);
        }
 
        /* The PCI bus number comes from the _BBN method */
 
-       status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
-       if (ACPI_SUCCESS (status)) {
-               pci_id->bus = ACPI_LOWORD (pci_value);
+       status =
+           acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node,
+                                           &pci_value);
+       if (ACPI_SUCCESS(status)) {
+               pci_id->bus = ACPI_LOWORD(pci_value);
        }
 
        /* Complete this device's pci_id */
 
-       acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id);
+       acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id);
 
        *region_context = pci_id;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_pci_bar_region_setup
@@ -331,19 +329,15 @@ acpi_ev_pci_config_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_pci_bar_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_pci_bar_region_setup(acpi_handle handle,
+                            u32 function,
+                            void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup");
-
+       ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_cmos_region_setup
@@ -362,19 +356,15 @@ acpi_ev_pci_bar_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_cmos_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_cmos_region_setup(acpi_handle handle,
+                         u32 function,
+                         void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE ("ev_cmos_region_setup");
-
+       ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_default_region_setup
@@ -391,26 +381,21 @@ acpi_ev_cmos_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_default_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context)
+acpi_ev_default_region_setup(acpi_handle handle,
+                            u32 function,
+                            void *handler_context, void **region_context)
 {
-       ACPI_FUNCTION_TRACE ("ev_default_region_setup");
-
+       ACPI_FUNCTION_TRACE("ev_default_region_setup");
 
        if (function == ACPI_REGION_DEACTIVATE) {
                *region_context = NULL;
-       }
-       else {
+       } else {
                *region_context = handler_context;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_initialize_region
@@ -434,37 +419,34 @@ acpi_ev_default_region_setup (
  ******************************************************************************/
 
 acpi_status
-acpi_ev_initialize_region (
-       union acpi_operand_object       *region_obj,
-       u8                              acpi_ns_locked)
+acpi_ev_initialize_region(union acpi_operand_object *region_obj,
+                         u8 acpi_ns_locked)
 {
-       union acpi_operand_object       *handler_obj;
-       union acpi_operand_object       *obj_desc;
-       acpi_adr_space_type             space_id;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       struct acpi_namespace_node      *method_node;
-       acpi_name                       *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
-       union acpi_operand_object       *region_obj2;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked);
+       union acpi_operand_object *handler_obj;
+       union acpi_operand_object *obj_desc;
+       acpi_adr_space_type space_id;
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       struct acpi_namespace_node *method_node;
+       acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+       union acpi_operand_object *region_obj2;
 
+       ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
 
        if (!region_obj) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
-       region_obj2 = acpi_ns_get_secondary_object (region_obj);
+       region_obj2 = acpi_ns_get_secondary_object(region_obj);
        if (!region_obj2) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       node = acpi_ns_get_parent_node (region_obj->region.node);
+       node = acpi_ns_get_parent_node(region_obj->region.node);
        space_id = region_obj->region.space_id;
 
        /* Setup defaults */
@@ -476,9 +458,9 @@ acpi_ev_initialize_region (
 
        /* Find any "_REG" method associated with this region definition */
 
-       status = acpi_ns_search_node (*reg_name_ptr, node,
-                         ACPI_TYPE_METHOD, &method_node);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_ns_search_node(*reg_name_ptr, node,
+                                    ACPI_TYPE_METHOD, &method_node);
+       if (ACPI_SUCCESS(status)) {
                /*
                 * The _REG method is optional and there can be only one per region
                 * definition.  This will be executed when the handler is attached
@@ -495,7 +477,7 @@ acpi_ev_initialize_region (
                /* Check to see if a handler exists */
 
                handler_obj = NULL;
-               obj_desc = acpi_ns_get_attached_object (node);
+               obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
                        /* Can only be a handler if the object exists */
 
@@ -523,37 +505,50 @@ acpi_ev_initialize_region (
                        while (handler_obj) {
                                /* Is this handler of the correct type? */
 
-                               if (handler_obj->address_space.space_id == space_id) {
+                               if (handler_obj->address_space.space_id ==
+                                   space_id) {
                                        /* Found correct handler */
 
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                                               "Found handler %p for region %p in obj %p\n",
-                                               handler_obj, region_obj, obj_desc));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                                         "Found handler %p for region %p in obj %p\n",
+                                                         handler_obj,
+                                                         region_obj,
+                                                         obj_desc));
 
-                                       status = acpi_ev_attach_region (handler_obj, region_obj,
-                                                        acpi_ns_locked);
+                                       status =
+                                           acpi_ev_attach_region(handler_obj,
+                                                                 region_obj,
+                                                                 acpi_ns_locked);
 
                                        /*
                                         * Tell all users that this region is usable by running the _REG
                                         * method
                                         */
                                        if (acpi_ns_locked) {
-                                               status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-                                               if (ACPI_FAILURE (status)) {
-                                                       return_ACPI_STATUS (status);
+                                               status =
+                                                   acpi_ut_release_mutex
+                                                   (ACPI_MTX_NAMESPACE);
+                                               if (ACPI_FAILURE(status)) {
+                                                       return_ACPI_STATUS
+                                                           (status);
                                                }
                                        }
 
-                                       status = acpi_ev_execute_reg_method (region_obj, 1);
+                                       status =
+                                           acpi_ev_execute_reg_method
+                                           (region_obj, 1);
 
                                        if (acpi_ns_locked) {
-                                               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-                                               if (ACPI_FAILURE (status)) {
-                                                       return_ACPI_STATUS (status);
+                                               status =
+                                                   acpi_ut_acquire_mutex
+                                                   (ACPI_MTX_NAMESPACE);
+                                               if (ACPI_FAILURE(status)) {
+                                                       return_ACPI_STATUS
+                                                           (status);
                                                }
                                        }
 
-                                       return_ACPI_STATUS (AE_OK);
+                                       return_ACPI_STATUS(AE_OK);
                                }
 
                                /* Try next handler in the list */
@@ -566,15 +561,15 @@ acpi_ev_initialize_region (
                 * This node does not have the handler we need;
                 * Pop up one level
                 */
-               node = acpi_ns_get_parent_node (node);
+               node = acpi_ns_get_parent_node(node);
        }
 
        /* If we get here, there is no handler for this region */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "No handler for region_type %s(%X) (region_obj %p)\n",
-               acpi_ut_get_region_name (space_id), space_id, region_obj));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "No handler for region_type %s(%X) (region_obj %p)\n",
+                         acpi_ut_get_region_name(space_id), space_id,
+                         region_obj));
 
-       return_ACPI_STATUS (AE_NOT_EXIST);
+       return_ACPI_STATUS(AE_NOT_EXIST);
 }
-
index f3123c26ae987be2e4d489268283417aa36ebbb6..1418359770022a462e1e4f2a53edce4bfacdc6e4 100644 (file)
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 
-
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evsci")
+ACPI_MODULE_NAME("evsci")
 
 /* Local prototypes */
-
-static u32 ACPI_SYSTEM_XFACE
-acpi_ev_sci_xrupt_handler (
-       void                            *context);
-
+static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
 
 /*******************************************************************************
  *
@@ -69,17 +64,13 @@ acpi_ev_sci_xrupt_handler (
  *
  ******************************************************************************/
 
-static u32 ACPI_SYSTEM_XFACE
-acpi_ev_sci_xrupt_handler (
-       void                            *context)
+static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
 {
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_list = context;
-       u32                             interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
-
+       struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
+       u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
        ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
 
-
        /*
         * We are guaranteed by the ACPI CA initialization/shutdown code that
         * if this interrupt handler is installed, ACPI is enabled.
@@ -89,18 +80,17 @@ acpi_ev_sci_xrupt_handler (
         * Fixed Events:
         * Check for and dispatch any Fixed Events that have occurred
         */
-       interrupt_handled |= acpi_ev_fixed_event_detect ();
+       interrupt_handled |= acpi_ev_fixed_event_detect();
 
        /*
         * General Purpose Events:
         * Check for and dispatch any GPEs that have occurred
         */
-       interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
+       interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-       return_VALUE (interrupt_handled);
+       return_VALUE(interrupt_handled);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_gpe_xrupt_handler
@@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler (
  *
  ******************************************************************************/
 
-u32 ACPI_SYSTEM_XFACE
-acpi_ev_gpe_xrupt_handler (
-       void                            *context)
+u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
 {
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_list = context;
-       u32                             interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
-
+       struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
+       u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
 
        ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
 
-
        /*
         * We are guaranteed by the ACPI CA initialization/shutdown code that
         * if this interrupt handler is installed, ACPI is enabled.
@@ -133,12 +119,11 @@ acpi_ev_gpe_xrupt_handler (
         * GPEs:
         * Check for and dispatch any GPEs that have occurred
         */
-       interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
+       interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-       return_VALUE (interrupt_handled);
+       return_VALUE(interrupt_handled);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_install_sci_handler
@@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler (
  *
  ******************************************************************************/
 
-u32
-acpi_ev_install_sci_handler (
-       void)
+u32 acpi_ev_install_sci_handler(void)
 {
-       u32                             status = AE_OK;
-
+       u32 status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("ev_install_sci_handler");
+       ACPI_FUNCTION_TRACE("ev_install_sci_handler");
 
-
-       status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
-                          acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
-       return_ACPI_STATUS (status);
+       status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
+                                                  acpi_ev_sci_xrupt_handler,
+                                                  acpi_gbl_gpe_xrupt_list_head);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ev_remove_sci_handler
@@ -186,22 +167,16 @@ acpi_ev_install_sci_handler (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ev_remove_sci_handler (
-       void)
+acpi_status acpi_ev_remove_sci_handler(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ev_remove_sci_handler");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
 
        /* Just let the OS remove the handler and disable the level */
 
-       status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
-                          acpi_ev_sci_xrupt_handler);
+       status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
+                                                 acpi_ev_sci_xrupt_handler);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 4092d47f67586d823fc2777b25f02a59012bc8c0..43b33d19cdf9169b751b275fb9466cc9b6fa2811 100644 (file)
@@ -49,8 +49,7 @@
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evxface")
-
+ACPI_MODULE_NAME("evxface")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Saves the pointer to the handler function
  *
  ******************************************************************************/
-
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_install_exception_handler (
-       acpi_exception_handler          handler)
+acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("acpi_install_exception_handler");
+       ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
 
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Don't allow two handlers. */
@@ -92,12 +86,11 @@ acpi_install_exception_handler (
 
        acpi_gbl_exception_handler = handler;
 
-cleanup:
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      cleanup:
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -116,26 +109,22 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_install_fixed_event_handler (
-       u32                             event,
-       acpi_event_handler              handler,
-       void                            *context)
+acpi_install_fixed_event_handler(u32 event,
+                                acpi_event_handler handler, void *context)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_install_fixed_event_handler");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
 
        /* Parameter validation */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Don't allow two handlers. */
@@ -150,29 +139,29 @@ acpi_install_fixed_event_handler (
        acpi_gbl_fixed_event_handlers[event].handler = handler;
        acpi_gbl_fixed_event_handlers[event].context = context;
 
-       status = acpi_clear_event (event);
+       status = acpi_clear_event(event);
        if (ACPI_SUCCESS(status))
-               status = acpi_enable_event (event, 0);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+               status = acpi_enable_event(event, 0);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Could not enable fixed event.\n"));
 
                /* Remove the handler */
 
                acpi_gbl_fixed_event_handlers[event].handler = NULL;
                acpi_gbl_fixed_event_handlers[event].context = NULL;
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Enabled fixed event %X, Handler=%p\n", event, handler));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Enabled fixed event %X, Handler=%p\n", event,
+                                 handler));
        }
 
-
-cleanup:
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      cleanup:
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_fixed_event_handler);
 
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -188,49 +177,45 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_fixed_event_handler (
-       u32                             event,
-       acpi_event_handler              handler)
+acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_remove_fixed_event_handler");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
 
        /* Parameter validation */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Disable the event before removing the handler */
 
-       status = acpi_disable_event (event, 0);
+       status = acpi_disable_event(event, 0);
 
        /* Always Remove the handler */
 
        acpi_gbl_fixed_event_handlers[event].handler = NULL;
        acpi_gbl_fixed_event_handlers[event].context = NULL;
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
-                       "Could not write to fixed event enable register.\n"));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Could not write to fixed event enable register.\n"));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n",
+                                 event));
        }
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
 
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
 
 /*******************************************************************************
  *
@@ -251,37 +236,32 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_install_notify_handler (
-       acpi_handle                     device,
-       u32                             handler_type,
-       acpi_notify_handler             handler,
-       void                            *context)
+acpi_install_notify_handler(acpi_handle device,
+                           u32 handler_type,
+                           acpi_notify_handler handler, void *context)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *notify_obj;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_install_notify_handler");
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *notify_obj;
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
 
        /* Parameter validation */
 
-       if ((!device)  ||
-               (!handler) ||
-               (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((!device) ||
+           (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (device);
+       node = acpi_ns_map_handle_to_node(device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -297,21 +277,21 @@ acpi_install_notify_handler (
                /* Make sure the handler is not already installed */
 
                if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-                               acpi_gbl_system_notify.handler)     ||
-                       ((handler_type & ACPI_DEVICE_NOTIFY) &&
-                               acpi_gbl_device_notify.handler)) {
+                    acpi_gbl_system_notify.handler) ||
+                   ((handler_type & ACPI_DEVICE_NOTIFY) &&
+                    acpi_gbl_device_notify.handler)) {
                        status = AE_ALREADY_EXISTS;
                        goto unlock_and_exit;
                }
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
-                       acpi_gbl_system_notify.node  = node;
+                       acpi_gbl_system_notify.node = node;
                        acpi_gbl_system_notify.handler = handler;
                        acpi_gbl_system_notify.context = context;
                }
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
-                       acpi_gbl_device_notify.node  = node;
+                       acpi_gbl_device_notify.node = node;
                        acpi_gbl_device_notify.handler = handler;
                        acpi_gbl_device_notify.context = context;
                }
@@ -327,29 +307,28 @@ acpi_install_notify_handler (
        else {
                /* Notifies allowed on this object? */
 
-               if (!acpi_ev_is_notify_object (node)) {
+               if (!acpi_ev_is_notify_object(node)) {
                        status = AE_TYPE;
                        goto unlock_and_exit;
                }
 
                /* Check for an existing internal object */
 
-               obj_desc = acpi_ns_get_attached_object (node);
+               obj_desc = acpi_ns_get_attached_object(node);
                if (obj_desc) {
                        /* Object exists - make sure there's no handler */
 
                        if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-                                       obj_desc->common_notify.system_notify) ||
-                               ((handler_type & ACPI_DEVICE_NOTIFY) &&
-                                       obj_desc->common_notify.device_notify)) {
+                            obj_desc->common_notify.system_notify) ||
+                           ((handler_type & ACPI_DEVICE_NOTIFY) &&
+                            obj_desc->common_notify.device_notify)) {
                                status = AE_ALREADY_EXISTS;
                                goto unlock_and_exit;
                        }
-               }
-               else {
+               } else {
                        /* Create a new object */
 
-                       obj_desc = acpi_ut_create_internal_object (node->type);
+                       obj_desc = acpi_ut_create_internal_object(node->type);
                        if (!obj_desc) {
                                status = AE_NO_MEMORY;
                                goto unlock_and_exit;
@@ -357,25 +336,27 @@ acpi_install_notify_handler (
 
                        /* Attach new object to the Node */
 
-                       status = acpi_ns_attach_object (device, obj_desc, node->type);
+                       status =
+                           acpi_ns_attach_object(device, obj_desc, node->type);
 
                        /* Remove local reference to the object */
 
-                       acpi_ut_remove_reference (obj_desc);
-                       if (ACPI_FAILURE (status)) {
+                       acpi_ut_remove_reference(obj_desc);
+                       if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
                }
 
                /* Install the handler */
 
-               notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY);
+               notify_obj =
+                   acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY);
                if (!notify_obj) {
                        status = AE_NO_MEMORY;
                        goto unlock_and_exit;
                }
 
-               notify_obj->notify.node   = node;
+               notify_obj->notify.node = node;
                notify_obj->notify.handler = handler;
                notify_obj->notify.context = context;
 
@@ -390,17 +371,16 @@ acpi_install_notify_handler (
                if (handler_type == ACPI_ALL_NOTIFY) {
                        /* Extra ref if installed in both */
 
-                       acpi_ut_add_reference (notify_obj);
+                       acpi_ut_add_reference(notify_obj);
                }
        }
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_notify_handler);
 
+EXPORT_SYMBOL(acpi_install_notify_handler);
 
 /*******************************************************************************
  *
@@ -420,36 +400,31 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_notify_handler (
-       acpi_handle                     device,
-       u32                             handler_type,
-       acpi_notify_handler             handler)
+acpi_remove_notify_handler(acpi_handle device,
+                          u32 handler_type, acpi_notify_handler handler)
 {
-       union acpi_operand_object       *notify_obj;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_remove_notify_handler");
+       union acpi_operand_object *notify_obj;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
 
        /* Parameter validation */
 
-       if ((!device)  ||
-               (!handler) ||
-               (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((!device) ||
+           (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (device);
+       node = acpi_ns_map_handle_to_node(device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -458,34 +433,34 @@ acpi_remove_notify_handler (
        /* Root Object */
 
        if (device == ACPI_ROOT_OBJECT) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Removing notify handler for ROOT object.\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Removing notify handler for ROOT object.\n"));
 
                if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
-                         !acpi_gbl_system_notify.handler)      ||
-                       ((handler_type & ACPI_DEVICE_NOTIFY) &&
-                         !acpi_gbl_device_notify.handler)) {
+                    !acpi_gbl_system_notify.handler) ||
+                   ((handler_type & ACPI_DEVICE_NOTIFY) &&
+                    !acpi_gbl_device_notify.handler)) {
                        status = AE_NOT_EXIST;
                        goto unlock_and_exit;
                }
 
                /* Make sure all deferred tasks are completed */
 
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                acpi_os_wait_events_complete(NULL);
-               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
+               status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
 
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
-                       acpi_gbl_system_notify.node  = NULL;
+                       acpi_gbl_system_notify.node = NULL;
                        acpi_gbl_system_notify.handler = NULL;
                        acpi_gbl_system_notify.context = NULL;
                }
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
-                       acpi_gbl_device_notify.node  = NULL;
+                       acpi_gbl_device_notify.node = NULL;
                        acpi_gbl_device_notify.handler = NULL;
                        acpi_gbl_device_notify.context = NULL;
                }
@@ -496,14 +471,14 @@ acpi_remove_notify_handler (
        else {
                /* Notifies allowed on this object? */
 
-               if (!acpi_ev_is_notify_object (node)) {
+               if (!acpi_ev_is_notify_object(node)) {
                        status = AE_TYPE;
                        goto unlock_and_exit;
                }
 
                /* Check for an existing internal object */
 
-               obj_desc = acpi_ns_get_attached_object (node);
+               obj_desc = acpi_ns_get_attached_object(node);
                if (!obj_desc) {
                        status = AE_NOT_EXIST;
                        goto unlock_and_exit;
@@ -514,53 +489,52 @@ acpi_remove_notify_handler (
                if (handler_type & ACPI_SYSTEM_NOTIFY) {
                        notify_obj = obj_desc->common_notify.system_notify;
                        if ((!notify_obj) ||
-                                (notify_obj->notify.handler != handler)) {
+                           (notify_obj->notify.handler != handler)) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
                        /* Make sure all deferred tasks are completed */
 
-                       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+                       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                        acpi_os_wait_events_complete(NULL);
-                       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
-                       }
+                       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
+                       }
 
                        /* Remove the handler */
                        obj_desc->common_notify.system_notify = NULL;
-                       acpi_ut_remove_reference (notify_obj);
+                       acpi_ut_remove_reference(notify_obj);
                }
 
                if (handler_type & ACPI_DEVICE_NOTIFY) {
                        notify_obj = obj_desc->common_notify.device_notify;
                        if ((!notify_obj) ||
-                                (notify_obj->notify.handler != handler)) {
+                           (notify_obj->notify.handler != handler)) {
                                status = AE_BAD_PARAMETER;
                                goto unlock_and_exit;
                        }
                        /* Make sure all deferred tasks are completed */
 
-                       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+                       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                        acpi_os_wait_events_complete(NULL);
-                       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
-                       }
+                       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
+                       }
 
                        /* Remove the handler */
                        obj_desc->common_notify.device_notify = NULL;
-                       acpi_ut_remove_reference (notify_obj);
+                       acpi_ut_remove_reference(notify_obj);
                }
        }
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_notify_handler);
 
+EXPORT_SYMBOL(acpi_remove_notify_handler);
 
 /*******************************************************************************
  *
@@ -581,35 +555,31 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_install_gpe_handler (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             type,
-       acpi_event_handler              address,
-       void                            *context)
+acpi_install_gpe_handler(acpi_handle gpe_device,
+                        u32 gpe_number,
+                        u32 type, acpi_event_handler address, void *context)
 {
-       struct acpi_gpe_event_info      *gpe_event_info;
-       struct acpi_handler_info        *handler;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
+       struct acpi_gpe_event_info *gpe_event_info;
+       struct acpi_handler_info *handler;
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
 
        /* Parameter validation */
 
        if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -617,49 +587,49 @@ acpi_install_gpe_handler (
 
        /* Make sure that there isn't a handler there already */
 
-       if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) {
+       if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
+           ACPI_GPE_DISPATCH_HANDLER) {
                status = AE_ALREADY_EXISTS;
                goto unlock_and_exit;
        }
 
        /* Allocate and init handler object */
 
-       handler = ACPI_MEM_CALLOCATE (sizeof (struct acpi_handler_info));
+       handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
        if (!handler) {
                status = AE_NO_MEMORY;
                goto unlock_and_exit;
        }
 
-       handler->address    = address;
-       handler->context    = context;
+       handler->address = address;
+       handler->context = context;
        handler->method_node = gpe_event_info->dispatch.method_node;
 
        /* Disable the GPE before installing the handler */
 
-       status = acpi_ev_disable_gpe (gpe_event_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ev_disable_gpe(gpe_event_info);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Install the handler */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        gpe_event_info->dispatch.handler = handler;
 
        /* Setup up dispatch flags to indicate handler (vs. method) */
 
-       gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
+       gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);  /* Clear bits */
        gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
 
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
-
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_gpe_handler);
 
+EXPORT_SYMBOL(acpi_install_gpe_handler);
 
 /*******************************************************************************
  *
@@ -677,33 +647,30 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_gpe_handler (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       acpi_event_handler              address)
+acpi_remove_gpe_handler(acpi_handle gpe_device,
+                       u32 gpe_number, acpi_event_handler address)
 {
-       struct acpi_gpe_event_info      *gpe_event_info;
-       struct acpi_handler_info        *handler;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
+       struct acpi_gpe_event_info *gpe_event_info;
+       struct acpi_handler_info *handler;
+       acpi_status status;
+       u32 flags;
 
+       ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
 
        /* Parameter validation */
 
        if (!address) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -711,7 +678,8 @@ acpi_remove_gpe_handler (
 
        /* Make sure that a handler is indeed installed */
 
-       if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) {
+       if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
+           ACPI_GPE_DISPATCH_HANDLER) {
                status = AE_NOT_EXIST;
                goto unlock_and_exit;
        }
@@ -725,45 +693,44 @@ acpi_remove_gpe_handler (
 
        /* Disable the GPE before removing the handler */
 
-       status = acpi_ev_disable_gpe (gpe_event_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ev_disable_gpe(gpe_event_info);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Make sure all deferred tasks are completed */
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        acpi_os_wait_events_complete(NULL);
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
-       }
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
 
        /* Remove the handler */
 
-       acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
        handler = gpe_event_info->dispatch.handler;
 
        /* Restore Method node (if any), set dispatch flags */
 
        gpe_event_info->dispatch.method_node = handler->method_node;
-       gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
+       gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;       /* Clear bits */
        if (handler->method_node) {
                gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
        }
-       acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
+       acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
 
        /* Now we can free the handler object */
 
-       ACPI_MEM_FREE (handler);
+       ACPI_MEM_FREE(handler);
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_gpe_handler);
 
+EXPORT_SYMBOL(acpi_remove_gpe_handler);
 
 /*******************************************************************************
  *
@@ -779,35 +746,31 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_acquire_global_lock (
-       u16                             timeout,
-       u32                             *handle)
+acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
        if (!handle) {
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ex_enter_interpreter ();
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       status = acpi_ev_acquire_global_lock (timeout);
-       acpi_ex_exit_interpreter ();
+       status = acpi_ev_acquire_global_lock(timeout);
+       acpi_ex_exit_interpreter();
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                acpi_gbl_global_lock_handle++;
                *handle = acpi_gbl_global_lock_handle;
        }
 
        return (status);
 }
-EXPORT_SYMBOL(acpi_acquire_global_lock);
 
+EXPORT_SYMBOL(acpi_acquire_global_lock);
 
 /*******************************************************************************
  *
@@ -821,19 +784,16 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_release_global_lock (
-       u32                             handle)
+acpi_status acpi_release_global_lock(u32 handle)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
        if (handle != acpi_gbl_global_lock_handle) {
                return (AE_NOT_ACQUIRED);
        }
 
-       status = acpi_ev_release_global_lock ();
+       status = acpi_ev_release_global_lock();
        return (status);
 }
-EXPORT_SYMBOL(acpi_release_global_lock);
 
+EXPORT_SYMBOL(acpi_release_global_lock);
index f337dc2cc56984db838a5b490194aa52082b5a71..887ff9f28a0d254277ad31192d17bdcfde3edf17 100644 (file)
@@ -48,8 +48,7 @@
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evxfevnt")
-
+ACPI_MODULE_NAME("evxfevnt")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Transfers the system into ACPI mode.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_enable (
-       void)
+acpi_status acpi_enable(void)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("acpi_enable");
+       ACPI_FUNCTION_TRACE("acpi_enable");
 
-
-       /* Make sure we have the FADT*/
+       /* Make sure we have the FADT */
 
        if (!acpi_gbl_FADT) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "No FADT information present!\n"));
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
-       }
-       else {
+               ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                                 "System is already in ACPI mode\n"));
+       else {
                /* Transition to ACPI mode */
 
-               status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
-                       return_ACPI_STATUS (status);
+               status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n"));
+                       return_ACPI_STATUS(status);
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-                       "Transition to ACPI mode successful\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                                 "Transition to ACPI mode successful\n"));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable
@@ -112,43 +106,38 @@ acpi_enable (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable (
-       void)
+acpi_status acpi_disable(void)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_disable");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_disable");
 
        if (!acpi_gbl_FADT) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "No FADT information present!\n"));
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-                       "System is already in legacy (non-ACPI) mode\n"));
-       }
-       else {
+               ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                                 "System is already in legacy (non-ACPI) mode\n"));
+       } else {
                /* Transition to LEGACY mode */
 
-               status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
+               status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
 
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not exit ACPI mode to legacy mode"));
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not exit ACPI mode to legacy mode"));
+                       return_ACPI_STATUS(status);
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable_event
@@ -162,52 +151,50 @@ acpi_disable (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enable_event (
-       u32                             event,
-       u32                             flags)
+acpi_status acpi_enable_event(u32 event, u32 flags)
 {
-       acpi_status                     status = AE_OK;
-       u32                             value;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_enable_event");
+       acpi_status status = AE_OK;
+       u32 value;
 
+       ACPI_FUNCTION_TRACE("acpi_enable_event");
 
        /* Decode the Fixed Event */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * Enable the requested fixed event (by writing a one to the
         * enable register bit)
         */
-       status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-                        1, ACPI_MTX_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_set_register(acpi_gbl_fixed_event_info[event].
+                             enable_register_id, 1, ACPI_MTX_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Make sure that the hardware responded */
 
-       status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-                         &value, ACPI_MTX_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_get_register(acpi_gbl_fixed_event_info[event].
+                             enable_register_id, &value, ACPI_MTX_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        if (value != 1) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not enable %s event\n", acpi_ut_get_event_name (event)));
-               return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not enable %s event\n",
+                                 acpi_ut_get_event_name(event)));
+               return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_enable_event);
 
+EXPORT_SYMBOL(acpi_enable_event);
 
 /*******************************************************************************
  *
@@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_gpe_type (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u8                              type)
+acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_gpe_event_info      *gpe_event_info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_set_gpe_type");
+       acpi_status status = AE_OK;
+       struct acpi_gpe_event_info *gpe_event_info;
 
+       ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
        if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Set the new type (will disable GPE if currently enabled) */
 
-       status = acpi_ev_set_gpe_type (gpe_event_info, type);
+       status = acpi_ev_set_gpe_type(gpe_event_info, type);
 
-unlock_and_exit:
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_set_gpe_type);
 
+EXPORT_SYMBOL(acpi_set_gpe_type);
 
 /*******************************************************************************
  *
@@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enable_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags)
+acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_gpe_event_info      *gpe_event_info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_enable_gpe");
+       acpi_status status = AE_OK;
+       struct acpi_gpe_event_info *gpe_event_info;
 
+       ACPI_FUNCTION_TRACE("acpi_enable_gpe");
 
        /* Use semaphore lock if not executing at interrupt level */
 
        if (flags & ACPI_NOT_ISR) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -305,16 +280,16 @@ acpi_enable_gpe (
 
        /* Perform the enable */
 
-       status = acpi_ev_enable_gpe (gpe_event_info, TRUE);
+       status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
 
-unlock_and_exit:
+      unlock_and_exit:
        if (flags & ACPI_NOT_ISR) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+               (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_enable_gpe);
 
+EXPORT_SYMBOL(acpi_enable_gpe);
 
 /*******************************************************************************
  *
@@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags)
+acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_gpe_event_info      *gpe_event_info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_disable_gpe");
+       acpi_status status = AE_OK;
+       struct acpi_gpe_event_info *gpe_event_info;
 
+       ACPI_FUNCTION_TRACE("acpi_disable_gpe");
 
        /* Use semaphore lock if not executing at interrupt level */
 
        if (flags & ACPI_NOT_ISR) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
-       status = acpi_ev_disable_gpe (gpe_event_info);
+       status = acpi_ev_disable_gpe(gpe_event_info);
 
-unlock_and_exit:
+      unlock_and_exit:
        if (flags & ACPI_NOT_ISR) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+               (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_disable_event
@@ -384,50 +352,48 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_disable_event (
-       u32                             event,
-       u32                             flags)
+acpi_status acpi_disable_event(u32 event, u32 flags)
 {
-       acpi_status                     status = AE_OK;
-       u32                             value;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_disable_event");
+       acpi_status status = AE_OK;
+       u32 value;
 
+       ACPI_FUNCTION_TRACE("acpi_disable_event");
 
        /* Decode the Fixed Event */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * Disable the requested fixed event (by writing a zero to the
         * enable register bit)
         */
-       status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-                        0, ACPI_MTX_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_set_register(acpi_gbl_fixed_event_info[event].
+                             enable_register_id, 0, ACPI_MTX_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
-                        &value, ACPI_MTX_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_get_register(acpi_gbl_fixed_event_info[event].
+                             enable_register_id, &value, ACPI_MTX_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        if (value != 0) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not disable %s events\n", acpi_ut_get_event_name (event)));
-               return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not disable %s events\n",
+                                 acpi_ut_get_event_name(event)));
+               return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_disable_event);
 
+EXPORT_SYMBOL(acpi_disable_event);
 
 /*******************************************************************************
  *
@@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_clear_event (
-       u32                             event)
+acpi_status acpi_clear_event(u32 event)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_clear_event");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_clear_event");
 
        /* Decode the Fixed Event */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * Clear the requested fixed event (By writing a one to the
         * status register bit)
         */
-       status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
-                       1, ACPI_MTX_LOCK);
+       status =
+           acpi_set_register(acpi_gbl_fixed_event_info[event].
+                             status_register_id, 1, ACPI_MTX_LOCK);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_clear_event);
 
+EXPORT_SYMBOL(acpi_clear_event);
 
 /*******************************************************************************
  *
@@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_clear_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags)
+acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_gpe_event_info      *gpe_event_info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_clear_gpe");
+       acpi_status status = AE_OK;
+       struct acpi_gpe_event_info *gpe_event_info;
 
+       ACPI_FUNCTION_TRACE("acpi_clear_gpe");
 
        /* Use semaphore lock if not executing at interrupt level */
 
        if (flags & ACPI_NOT_ISR) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
-       status = acpi_hw_clear_gpe (gpe_event_info);
+       status = acpi_hw_clear_gpe(gpe_event_info);
 
-unlock_and_exit:
+      unlock_and_exit:
        if (flags & ACPI_NOT_ISR) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+               (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -538,36 +494,31 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_event_status (
-       u32                             event,
-       acpi_event_status               *event_status)
+acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_event_status");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_get_event_status");
 
        if (!event_status) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Decode the Fixed Event */
 
        if (event > ACPI_EVENT_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the status of the requested fixed event */
 
-       status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
-                         event_status, ACPI_MTX_LOCK);
+       status =
+           acpi_get_register(acpi_gbl_fixed_event_info[event].
+                             status_register_id, event_status, ACPI_MTX_LOCK);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_gpe_status
@@ -585,31 +536,26 @@ acpi_get_event_status (
  ******************************************************************************/
 
 acpi_status
-acpi_get_gpe_status (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags,
-       acpi_event_status               *event_status)
+acpi_get_gpe_status(acpi_handle gpe_device,
+                   u32 gpe_number, u32 flags, acpi_event_status * event_status)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_gpe_event_info      *gpe_event_info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_gpe_status");
+       acpi_status status = AE_OK;
+       struct acpi_gpe_event_info *gpe_event_info;
 
+       ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
 
        /* Use semaphore lock if not executing at interrupt level */
 
        if (flags & ACPI_NOT_ISR) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Ensure that we have a valid GPE number */
 
-       gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
+       gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
        if (!gpe_event_info) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -617,16 +563,15 @@ acpi_get_gpe_status (
 
        /* Obtain status on the requested GPE number */
 
-       status = acpi_hw_get_gpe_status (gpe_event_info, event_status);
+       status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
 
-unlock_and_exit:
+      unlock_and_exit:
        if (flags & ACPI_NOT_ISR) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+               (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -635,7 +580,7 @@ unlock_and_exit:
  * PARAMETERS:  gpe_device          - Handle to the parent GPE Block Device
  *              gpe_block_address   - Address and space_iD
  *              register_count      - Number of GPE register pairs in the block
- *              interrupt_level     - H/W interrupt for the block
+ *              interrupt_number    - H/W interrupt for the block
  *
  * RETURN:      Status
  *
@@ -644,33 +589,27 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_install_gpe_block (
-       acpi_handle                     gpe_device,
-       struct acpi_generic_address     *gpe_block_address,
-       u32                             register_count,
-       u32                             interrupt_level)
+acpi_install_gpe_block(acpi_handle gpe_device,
+                      struct acpi_generic_address *gpe_block_address,
+                      u32 register_count, u32 interrupt_number)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       struct acpi_gpe_block_info      *gpe_block;
-
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       struct acpi_gpe_block_info *gpe_block;
 
-       ACPI_FUNCTION_TRACE ("acpi_install_gpe_block");
+       ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
 
-
-       if ((!gpe_device)      ||
-               (!gpe_block_address) ||
-               (!register_count)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       node = acpi_ns_map_handle_to_node (gpe_device);
+       node = acpi_ns_map_handle_to_node(gpe_device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -680,31 +619,33 @@ acpi_install_gpe_block (
         * For user-installed GPE Block Devices, the gpe_block_base_number
         * is always zero
         */
-       status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
-                         0, interrupt_level, &gpe_block);
-       if (ACPI_FAILURE (status)) {
+       status =
+           acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
+                                    interrupt_number, &gpe_block);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Get the device_object attached to the node */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
                /* No object, create a new one */
 
-               obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE);
+               obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
                if (!obj_desc) {
                        status = AE_NO_MEMORY;
                        goto unlock_and_exit;
                }
 
-               status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE);
+               status =
+                   acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
 
                /* Remove local reference to the object */
 
-               acpi_ut_remove_reference (obj_desc);
+               acpi_ut_remove_reference(obj_desc);
 
-               if (ACPI_FAILURE (status)) {
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
        }
@@ -713,13 +654,12 @@ acpi_install_gpe_block (
 
        obj_desc->device.gpe_block = gpe_block;
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_gpe_block);
 
+EXPORT_SYMBOL(acpi_install_gpe_block);
 
 /*******************************************************************************
  *
@@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_remove_gpe_block (
-       acpi_handle                     gpe_device)
+acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
+       struct acpi_namespace_node *node;
 
+       ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
 
        if (!gpe_device) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       node = acpi_ns_map_handle_to_node (gpe_device);
+       node = acpi_ns_map_handle_to_node(gpe_device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -762,22 +698,21 @@ acpi_remove_gpe_block (
 
        /* Get the device_object attached to the node */
 
-       obj_desc = acpi_ns_get_attached_object (node);
-       if (!obj_desc ||
-               !obj_desc->device.gpe_block) {
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+       obj_desc = acpi_ns_get_attached_object(node);
+       if (!obj_desc || !obj_desc->device.gpe_block) {
+               return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
        /* Delete the GPE block (but not the device_object) */
 
-       status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
+       if (ACPI_SUCCESS(status)) {
                obj_desc->device.gpe_block = NULL;
        }
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
 
 EXPORT_SYMBOL(acpi_remove_gpe_block);
index d058587b34276e91742ebd65d8d0d089eefac6f5..6f28ea2db5ba11eb4b8751127a5d1adea27c4762 100644 (file)
@@ -49,8 +49,7 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EVENTS
-        ACPI_MODULE_NAME    ("evxfregn")
-
+ACPI_MODULE_NAME("evxfregn")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Install a handler for all op_regions of a given space_id.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_install_address_space_handler (
-       acpi_handle                     device,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler,
-       acpi_adr_space_setup            setup,
-       void                            *context)
+acpi_install_address_space_handler(acpi_handle device,
+                                  acpi_adr_space_type space_id,
+                                  acpi_adr_space_handler handler,
+                                  acpi_adr_space_setup setup, void *context)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler");
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
 
        /* Parameter validation */
 
        if (!device) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (device);
+       node = acpi_ns_map_handle_to_node(device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -104,21 +98,23 @@ acpi_install_address_space_handler (
 
        /* Install the handler for all Regions for this Space ID */
 
-       status = acpi_ev_install_space_handler (node, space_id, handler, setup, context);
-       if (ACPI_FAILURE (status)) {
+       status =
+           acpi_ev_install_space_handler(node, space_id, handler, setup,
+                                         context);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Run all _REG methods for this address space */
 
-       status = acpi_ev_execute_reg_methods (node, space_id);
+       status = acpi_ev_execute_reg_methods(node, space_id);
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_install_address_space_handler);
 
+EXPORT_SYMBOL(acpi_install_address_space_handler);
 
 /*******************************************************************************
  *
@@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
  ******************************************************************************/
 
 acpi_status
-acpi_remove_address_space_handler (
-       acpi_handle                     device,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler)
+acpi_remove_address_space_handler(acpi_handle device,
+                                 acpi_adr_space_type space_id,
+                                 acpi_adr_space_handler handler)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *handler_obj;
-       union acpi_operand_object       *region_obj;
-       union acpi_operand_object       **last_obj_ptr;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler");
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *handler_obj;
+       union acpi_operand_object *region_obj;
+       union acpi_operand_object **last_obj_ptr;
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
 
        /* Parameter validation */
 
        if (!device) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Convert and validate the device handle */
 
-       node = acpi_ns_map_handle_to_node (device);
+       node = acpi_ns_map_handle_to_node(device);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -172,7 +165,7 @@ acpi_remove_address_space_handler (
 
        /* Make sure the internal object exists */
 
-       obj_desc = acpi_ns_get_attached_object (node);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
                status = AE_NOT_EXIST;
                goto unlock_and_exit;
@@ -188,10 +181,11 @@ acpi_remove_address_space_handler (
                if (handler_obj->address_space.space_id == space_id) {
                        /* Matched space_id, first dereference this in the Regions */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-                               "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
-                               handler_obj, handler, acpi_ut_get_region_name (space_id),
-                               node, obj_desc));
+                       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                                         "Removing address handler %p(%p) for region %s on Device %p(%p)\n",
+                                         handler_obj, handler,
+                                         acpi_ut_get_region_name(space_id),
+                                         node, obj_desc));
 
                        region_obj = handler_obj->address_space.region_list;
 
@@ -205,13 +199,14 @@ acpi_remove_address_space_handler (
                                 * The region is just inaccessible as indicated to
                                 * the _REG method
                                 */
-                               acpi_ev_detach_region (region_obj, TRUE);
+                               acpi_ev_detach_region(region_obj, TRUE);
 
                                /*
                                 * Walk the list: Just grab the head because the
                                 * detach_region removed the previous head.
                                 */
-                               region_obj = handler_obj->address_space.region_list;
+                               region_obj =
+                                   handler_obj->address_space.region_list;
 
                        }
 
@@ -221,7 +216,7 @@ acpi_remove_address_space_handler (
 
                        /* Now we can delete the handler object */
 
-                       acpi_ut_remove_reference (handler_obj);
+                       acpi_ut_remove_reference(handler_obj);
                        goto unlock_and_exit;
                }
 
@@ -233,15 +228,16 @@ acpi_remove_address_space_handler (
 
        /* The handler does not exist */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
-               "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
-               handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
+       ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+                         "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
+                         handler, acpi_ut_get_region_name(space_id), space_id,
+                         node, obj_desc));
 
        status = AE_NOT_EXIST;
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_remove_address_space_handler);
 
+EXPORT_SYMBOL(acpi_remove_address_space_handler);
index 734b2f24af4809aac704ae293c653591b64209ba..1ce365d651d8a8bbb2ba1f47f77a6cdef1fe5a40 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/actables.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exconfig")
+ACPI_MODULE_NAME("exconfig")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_add_table (
-       struct acpi_table_header        *table,
-       struct acpi_namespace_node      *parent_node,
-       union acpi_operand_object       **ddb_handle);
-
+acpi_ex_add_table(struct acpi_table_header *table,
+                 struct acpi_namespace_node *parent_node,
+                 union acpi_operand_object **ddb_handle);
 
 /*******************************************************************************
  *
@@ -79,64 +74,67 @@ acpi_ex_add_table (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_add_table (
-       struct acpi_table_header        *table,
-       struct acpi_namespace_node      *parent_node,
-       union acpi_operand_object       **ddb_handle)
+acpi_ex_add_table(struct acpi_table_header *table,
+                 struct acpi_namespace_node *parent_node,
+                 union acpi_operand_object **ddb_handle)
 {
-       acpi_status                     status;
-       struct acpi_table_desc          table_info;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE ("ex_add_table");
+       acpi_status status;
+       struct acpi_table_desc table_info;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE("ex_add_table");
 
        /* Create an object to be the table handle */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
+       /* Init the table handle */
+
+       obj_desc->reference.opcode = AML_LOAD_OP;
+       *ddb_handle = obj_desc;
+
        /* Install the new table into the local data structures */
 
-       ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
+       ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
 
-       table_info.type      = ACPI_TABLE_SSDT;
-       table_info.pointer   = table;
-       table_info.length    = (acpi_size) table->length;
+       table_info.type = ACPI_TABLE_SSDT;
+       table_info.pointer = table;
+       table_info.length = (acpi_size) table->length;
        table_info.allocation = ACPI_MEM_ALLOCATED;
 
-       status = acpi_tb_install_table (&table_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_install_table(&table_info);
+       obj_desc->reference.object = table_info.installed_desc;
+
+       if (ACPI_FAILURE(status)) {
+               if (status == AE_ALREADY_EXISTS) {
+                       /* Table already exists, just return the handle */
+
+                       return_ACPI_STATUS(AE_OK);
+               }
                goto cleanup;
        }
 
        /* Add the table to the namespace */
 
-       status = acpi_ns_load_table (table_info.installed_desc, parent_node);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ns_load_table(table_info.installed_desc, parent_node);
+       if (ACPI_FAILURE(status)) {
                /* Uninstall table on error */
 
-               (void) acpi_tb_uninstall_table (table_info.installed_desc);
+               (void)acpi_tb_uninstall_table(table_info.installed_desc);
                goto cleanup;
        }
 
-       /* Init the table handle */
+       return_ACPI_STATUS(AE_OK);
 
-       obj_desc->reference.opcode = AML_LOAD_OP;
-       obj_desc->reference.object = table_info.installed_desc;
-       *ddb_handle = obj_desc;
-       return_ACPI_STATUS (AE_OK);
-
-
-cleanup:
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+      cleanup:
+       acpi_ut_remove_reference(obj_desc);
+       *ddb_handle = NULL;
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_load_table_op
@@ -151,56 +149,53 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_load_table_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       **return_desc)
+acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
+                     union acpi_operand_object **return_desc)
 {
-       acpi_status                     status;
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       struct acpi_table_header        *table;
-       struct acpi_namespace_node      *parent_node;
-       struct acpi_namespace_node      *start_node;
-       struct acpi_namespace_node      *parameter_node = NULL;
-       union acpi_operand_object       *ddb_handle;
-
-
-       ACPI_FUNCTION_TRACE ("ex_load_table_op");
+       acpi_status status;
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       struct acpi_table_header *table;
+       struct acpi_namespace_node *parent_node;
+       struct acpi_namespace_node *start_node;
+       struct acpi_namespace_node *parameter_node = NULL;
+       union acpi_operand_object *ddb_handle;
 
+       ACPI_FUNCTION_TRACE("ex_load_table_op");
 
 #if 0
        /*
         * Make sure that the signature does not match one of the tables that
         * is already loaded.
         */
-       status = acpi_tb_match_signature (operand[0]->string.pointer, NULL);
+       status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
        if (status == AE_OK) {
                /* Signature matched -- don't allow override */
 
-               return_ACPI_STATUS (AE_ALREADY_EXISTS);
+               return_ACPI_STATUS(AE_ALREADY_EXISTS);
        }
 #endif
 
        /* Find the ACPI table */
 
-       status = acpi_tb_find_table (operand[0]->string.pointer,
-                          operand[1]->string.pointer,
-                          operand[2]->string.pointer, &table);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_find_table(operand[0]->string.pointer,
+                                   operand[1]->string.pointer,
+                                   operand[2]->string.pointer, &table);
+       if (ACPI_FAILURE(status)) {
                if (status != AE_NOT_FOUND) {
-                       return_ACPI_STATUS (status);
+                       return_ACPI_STATUS(status);
                }
 
                /* Table not found, return an Integer=0 and AE_OK */
 
-               ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!ddb_handle) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                ddb_handle->integer.value = 0;
                *return_desc = ddb_handle;
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Default nodes */
@@ -215,10 +210,12 @@ acpi_ex_load_table_op (
                 * Find the node referenced by the root_path_string. This is the
                 * location within the namespace where the table will be loaded.
                 */
-               status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node,
-                                  ACPI_NS_SEARCH_PARENT, &parent_node);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_get_node_by_path(operand[3]->string.pointer,
+                                            start_node, ACPI_NS_SEARCH_PARENT,
+                                            &parent_node);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -226,7 +223,7 @@ acpi_ex_load_table_op (
 
        if (operand[4]->string.length > 0) {
                if ((operand[4]->string.pointer[0] != '\\') &&
-                       (operand[4]->string.pointer[0] != '^')) {
+                   (operand[4]->string.pointer[0] != '^')) {
                        /*
                         * Path is not absolute, so it will be relative to the node
                         * referenced by the root_path_string (or the NS root if omitted)
@@ -236,18 +233,20 @@ acpi_ex_load_table_op (
 
                /* Find the node referenced by the parameter_path_string */
 
-               status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
-                                ACPI_NS_SEARCH_PARENT, &parameter_node);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_get_node_by_path(operand[4]->string.pointer,
+                                            start_node, ACPI_NS_SEARCH_PARENT,
+                                            &parameter_node);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Load the table into the namespace */
 
-       status = acpi_ex_add_table (table, parent_node, &ddb_handle);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_add_table(table, parent_node, &ddb_handle);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Parameter Data (optional) */
@@ -255,20 +254,20 @@ acpi_ex_load_table_op (
        if (parameter_node) {
                /* Store the parameter data into the optional parameter object */
 
-               status = acpi_ex_store (operand[5],
-                                ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
-                                walk_state);
-               if (ACPI_FAILURE (status)) {
-                       (void) acpi_ex_unload_table (ddb_handle);
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_store(operand[5],
+                                      ACPI_CAST_PTR(union acpi_operand_object,
+                                                    parameter_node),
+                                      walk_state);
+               if (ACPI_FAILURE(status)) {
+                       (void)acpi_ex_unload_table(ddb_handle);
+                       return_ACPI_STATUS(status);
                }
        }
 
        *return_desc = ddb_handle;
-       return_ACPI_STATUS  (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_load_op
@@ -285,38 +284,37 @@ acpi_ex_load_table_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_load_op (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *target,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_load_op(union acpi_operand_object *obj_desc,
+               union acpi_operand_object *target,
+               struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *ddb_handle;
-       union acpi_operand_object       *buffer_desc = NULL;
-       struct acpi_table_header        *table_ptr = NULL;
-       acpi_physical_address           address;
-       struct acpi_table_header        table_header;
-       u32                             i;
-
-       ACPI_FUNCTION_TRACE ("ex_load_op");
+       acpi_status status;
+       union acpi_operand_object *ddb_handle;
+       union acpi_operand_object *buffer_desc = NULL;
+       struct acpi_table_header *table_ptr = NULL;
+       acpi_physical_address address;
+       struct acpi_table_header table_header;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ex_load_op");
 
        /* Object can be either an op_region or a Field */
 
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_REGION:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
-                       obj_desc, acpi_ut_get_object_type_name (obj_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
+                                 obj_desc,
+                                 acpi_ut_get_object_type_name(obj_desc)));
 
                /*
                 * If the Region Address and Length have not been previously evaluated,
                 * evaluate them now and save the results.
                 */
                if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-                       status = acpi_ds_get_region_arguments (obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_get_region_arguments(obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
 
@@ -328,116 +326,127 @@ acpi_ex_load_op (
 
                table_header.length = 0;
                for (i = 0; i < 8; i++) {
-                       status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
-                                          (acpi_physical_address) (i + address), 8,
-                                          ((u8 *) &table_header) + i);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status =
+                           acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
+                                                          (acpi_physical_address)
+                                                          (i + address), 8,
+                                                          ((u8 *) &
+                                                           table_header) + i);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
 
                /* Sanity check the table length */
 
-               if (table_header.length < sizeof (struct acpi_table_header)) {
-                       return_ACPI_STATUS (AE_BAD_HEADER);
+               if (table_header.length < sizeof(struct acpi_table_header)) {
+                       return_ACPI_STATUS(AE_BAD_HEADER);
                }
 
                /* Allocate a buffer for the entire table */
 
-               table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
+               table_ptr = ACPI_MEM_ALLOCATE(table_header.length);
                if (!table_ptr) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Get the entire table from the op region */
 
                for (i = 0; i < table_header.length; i++) {
-                       status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
-                                          (acpi_physical_address) (i + address), 8,
-                                          ((u8 *) table_ptr + i));
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
+                                                          (acpi_physical_address)
+                                                          (i + address), 8,
+                                                          ((u8 *) table_ptr +
+                                                           i));
+                       if (ACPI_FAILURE(status)) {
                                goto cleanup;
                        }
                }
                break;
 
-
        case ACPI_TYPE_LOCAL_REGION_FIELD:
        case ACPI_TYPE_LOCAL_BANK_FIELD:
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
-                       obj_desc, acpi_ut_get_object_type_name (obj_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n",
+                                 obj_desc,
+                                 acpi_ut_get_object_type_name(obj_desc)));
 
                /*
                 * The length of the field must be at least as large as the table.
                 * Read the entire field and thus the entire table.  Buffer is
                 * allocated during the read.
                 */
-               status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
-               if (ACPI_FAILURE (status)) {
-                       goto cleanup;
+               status =
+                   acpi_ex_read_data_from_field(walk_state, obj_desc,
+                                                &buffer_desc);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
-                                 buffer_desc->buffer.pointer);
+               table_ptr = ACPI_CAST_PTR(struct acpi_table_header,
+                                         buffer_desc->buffer.pointer);
 
-                /* Sanity check the table length */
+               /* All done with the buffer_desc, delete it */
 
-               if (table_ptr->length < sizeof (struct acpi_table_header)) {
-                       return_ACPI_STATUS (AE_BAD_HEADER);
+               buffer_desc->buffer.pointer = NULL;
+               acpi_ut_remove_reference(buffer_desc);
+
+               /* Sanity check the table length */
+
+               if (table_ptr->length < sizeof(struct acpi_table_header)) {
+                       status = AE_BAD_HEADER;
+                       goto cleanup;
                }
                break;
 
-
        default:
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /* The table must be either an SSDT or a PSDT */
 
-       if ((!ACPI_STRNCMP (table_ptr->signature,
-                         acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
-                         acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
-               (!ACPI_STRNCMP (table_ptr->signature,
-                                acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
-                                acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
-                       table_ptr->signature));
+       if ((!ACPI_STRNCMP(table_ptr->signature,
+                          acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
+                          acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
+           (!ACPI_STRNCMP(table_ptr->signature,
+                          acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
+                          acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
+                                 table_ptr->signature));
                status = AE_BAD_SIGNATURE;
                goto cleanup;
        }
 
        /* Install the new table into the local data structures */
 
-       status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup;
-       }
-
-       /* Store the ddb_handle into the Target operand */
+       status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
+       if (ACPI_FAILURE(status)) {
+               /* On error, table_ptr was deallocated above */
 
-       status = acpi_ex_store (ddb_handle, target, walk_state);
-       if (ACPI_FAILURE (status)) {
-               (void) acpi_ex_unload_table (ddb_handle);
+               return_ACPI_STATUS(status);
        }
 
-       return_ACPI_STATUS (status);
+       /* Store the ddb_handle into the Target operand */
 
+       status = acpi_ex_store(ddb_handle, target, walk_state);
+       if (ACPI_FAILURE(status)) {
+               (void)acpi_ex_unload_table(ddb_handle);
 
-cleanup:
+               /* table_ptr was deallocated above */
 
-       if (buffer_desc) {
-               acpi_ut_remove_reference (buffer_desc);
+               return_ACPI_STATUS(status);
        }
-       else {
-               ACPI_MEM_FREE (table_ptr);
+
+      cleanup:
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(table_ptr);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_unload_table
@@ -450,17 +459,13 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_unload_table (
-       union acpi_operand_object       *ddb_handle)
+acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *table_desc = ddb_handle;
-       struct acpi_table_desc          *table_info;
-
-
-       ACPI_FUNCTION_TRACE ("ex_unload_table");
+       acpi_status status = AE_OK;
+       union acpi_operand_object *table_desc = ddb_handle;
+       struct acpi_table_desc *table_info;
 
+       ACPI_FUNCTION_TRACE("ex_unload_table");
 
        /*
         * Validate the handle
@@ -469,28 +474,28 @@ acpi_ex_unload_table (
         * validated here.
         */
        if ((!ddb_handle) ||
-               (ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
-               (ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+           (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
+           (ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the actual table descriptor from the ddb_handle */
 
-       table_info = (struct acpi_table_desc *) table_desc->reference.object;
+       table_info = (struct acpi_table_desc *)table_desc->reference.object;
 
        /*
         * Delete the entire namespace under this table Node
         * (Offset contains the table_id)
         */
-       acpi_ns_delete_namespace_by_owner (table_info->table_id);
+       acpi_ns_delete_namespace_by_owner(table_info->owner_id);
+       acpi_ut_release_owner_id(&table_info->owner_id);
 
        /* Delete the table itself */
 
-       (void) acpi_tb_uninstall_table (table_info->installed_desc);
+       (void)acpi_tb_uninstall_table(table_info->installed_desc);
 
        /* Delete the table descriptor (ddb_handle) */
 
-       acpi_ut_remove_reference (table_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(table_desc);
+       return_ACPI_STATUS(status);
 }
-
index 97856c48bd744f200e170536a7d046f1f0a3f112..04e5194989a6ffe51a718f370dedc85ba9e6aadd 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exconvrt")
+ACPI_MODULE_NAME("exconvrt")
 
 /* Local prototypes */
-
 static u32
-acpi_ex_convert_to_ascii (
-       acpi_integer                    integer,
-       u16                             base,
-       u8                              *string,
-       u8                              max_length);
-
+acpi_ex_convert_to_ascii(acpi_integer integer,
+                        u16 base, u8 * string, u8 max_length);
 
 /*******************************************************************************
  *
@@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_integer (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc,
-       u32                             flags)
+acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
+                          union acpi_operand_object **result_desc, u32 flags)
 {
-       union acpi_operand_object       *return_desc;
-       u8                              *pointer;
-       acpi_integer                    result;
-       u32                             i;
-       u32                             count;
-       acpi_status                     status;
-
+       union acpi_operand_object *return_desc;
+       u8 *pointer;
+       acpi_integer result;
+       u32 i;
+       u32 count;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
 
-
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_INTEGER:
 
                /* No conversion necessary */
 
                *result_desc = obj_desc;
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
 
        case ACPI_TYPE_BUFFER:
        case ACPI_TYPE_STRING:
@@ -106,11 +95,11 @@ acpi_ex_convert_to_integer (
                /* Note: Takes advantage of common buffer/string fields */
 
                pointer = obj_desc->buffer.pointer;
-               count   = obj_desc->buffer.length;
+               count = obj_desc->buffer.length;
                break;
 
        default:
-               return_ACPI_STATUS (AE_TYPE);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        /*
@@ -126,7 +115,7 @@ acpi_ex_convert_to_integer (
 
        /* String conversion is different than Buffer conversion */
 
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_STRING:
 
                /*
@@ -135,19 +124,18 @@ acpi_ex_convert_to_integer (
                 * of ACPI 3.0) is that the to_integer() operator allows both decimal
                 * and hexadecimal strings (hex prefixed with "0x").
                 */
-               status = acpi_ut_strtoul64 ((char *) pointer, flags, &result);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_strtoul64((char *)pointer, flags, &result);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
                /* Check for zero-length buffer */
 
                if (!count) {
-                       return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+                       return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
                }
 
                /* Transfer no more than an integer's worth of data */
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer (
                }
                break;
 
-
        default:
                /* No other types can get here */
                break;
@@ -178,20 +165,19 @@ acpi_ex_convert_to_integer (
 
        /* Create a new integer */
 
-       return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!return_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Save the Result */
 
        return_desc->integer.value = result;
-       acpi_ex_truncate_for32bit_table (return_desc);
+       acpi_ex_truncate_for32bit_table(return_desc);
        *result_desc = return_desc;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_buffer
@@ -207,25 +193,21 @@ acpi_ex_convert_to_integer (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_buffer (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc)
+acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
+                         union acpi_operand_object **result_desc)
 {
-       union acpi_operand_object       *return_desc;
-       u8                              *new_buf;
+       union acpi_operand_object *return_desc;
+       u8 *new_buf;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
 
-       ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc);
-
-
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_BUFFER:
 
                /* No conversion necessary */
 
                *result_desc = obj_desc;
-               return_ACPI_STATUS (AE_OK);
-
+               return_ACPI_STATUS(AE_OK);
 
        case ACPI_TYPE_INTEGER:
 
@@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer (
                 * Create a new Buffer object.
                 * Need enough space for one integer
                 */
-               return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width);
+               return_desc =
+                   acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width);
                if (!return_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Copy the integer to the buffer, LSB first */
 
                new_buf = return_desc->buffer.pointer;
-               ACPI_MEMCPY (new_buf,
-                                 &obj_desc->integer.value,
-                                 acpi_gbl_integer_byte_width);
+               ACPI_MEMCPY(new_buf,
+                           &obj_desc->integer.value,
+                           acpi_gbl_integer_byte_width);
                break;
 
-
        case ACPI_TYPE_STRING:
 
                /*
@@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer (
                 * ASL/AML code that depends on the null being transferred to the new
                 * buffer.
                 */
-               return_desc = acpi_ut_create_buffer_object (
-                                 (acpi_size) obj_desc->string.length + 1);
+               return_desc = acpi_ut_create_buffer_object((acpi_size)
+                                                          obj_desc->string.
+                                                          length + 1);
                if (!return_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Copy the string to the buffer */
 
                new_buf = return_desc->buffer.pointer;
-               ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer,
-                       obj_desc->string.length);
+               ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
+                            obj_desc->string.length);
                break;
 
-
        default:
-               return_ACPI_STATUS (AE_TYPE);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        /* Mark buffer initialized */
 
        return_desc->common.flags |= AOPOBJ_DATA_VALID;
        *result_desc = return_desc;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_ascii
@@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer (
  ******************************************************************************/
 
 static u32
-acpi_ex_convert_to_ascii (
-       acpi_integer                    integer,
-       u16                             base,
-       u8                              *string,
-       u8                              data_width)
+acpi_ex_convert_to_ascii(acpi_integer integer,
+                        u16 base, u8 * string, u8 data_width)
 {
-       acpi_integer                    digit;
-       acpi_native_uint                i;
-       acpi_native_uint                j;
-       acpi_native_uint                k = 0;
-       acpi_native_uint                hex_length;
-       acpi_native_uint                decimal_length;
-       u32                             remainder;
-       u8                              supress_zeros;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_integer digit;
+       acpi_native_uint i;
+       acpi_native_uint j;
+       acpi_native_uint k = 0;
+       acpi_native_uint hex_length;
+       acpi_native_uint decimal_length;
+       u32 remainder;
+       u8 supress_zeros;
 
+       ACPI_FUNCTION_ENTRY();
 
        switch (base) {
        case 10:
@@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii (
                        break;
                }
 
-               supress_zeros = TRUE;    /* No leading zeros */
+               supress_zeros = TRUE;   /* No leading zeros */
                remainder = 0;
 
                for (i = decimal_length; i > 0; i--) {
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii (
 
                        digit = integer;
                        for (j = 0; j < i; j++) {
-                               (void) acpi_ut_short_divide (digit, 10, &digit, &remainder);
+                               (void)acpi_ut_short_divide(digit, 10, &digit,
+                                                          &remainder);
                        }
 
                        /* Handle leading zeros */
@@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii (
 
                /* hex_length: 2 ascii hex chars per data byte */
 
-               hex_length = ACPI_MUL_2 (data_width);
-               for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
+               hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
+               for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
                        /* Get one hex digit, most significant digits first */
 
-                       string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j));
+                       string[k] =
+                           (u8) acpi_ut_hex_to_ascii_char(integer,
+                                                          ACPI_MUL_4(j));
                        k++;
                }
                break;
@@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii (
         * Finally, null terminate the string and return the length
         */
        if (!k) {
-               string [0] = ACPI_ASCII_ZERO;
+               string[0] = ACPI_ASCII_ZERO;
                k = 1;
        }
 
-       string [k] = 0;
+       string[k] = 0;
        return ((u32) k);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_string
@@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_string (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc,
-       u32                             type)
+acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
+                         union acpi_operand_object ** result_desc, u32 type)
 {
-       union acpi_operand_object       *return_desc;
-       u8                              *new_buf;
-       u32                             i;
-       u32                             string_length = 0;
-       u16                             base = 16;
-       u8                              separator = ',';
+       union acpi_operand_object *return_desc;
+       u8 *new_buf;
+       u32 i;
+       u32 string_length = 0;
+       u16 base = 16;
+       u8 separator = ',';
 
+       ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
 
-       ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc);
-
-
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_STRING:
 
                /* No conversion necessary */
 
                *result_desc = obj_desc;
-               return_ACPI_STATUS (AE_OK);
-
+               return_ACPI_STATUS(AE_OK);
 
        case ACPI_TYPE_INTEGER:
 
@@ -452,7 +425,7 @@ acpi_ex_convert_to_string (
 
                        /* Two hex string characters for each integer byte */
 
-                       string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width);
+                       string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width);
                        break;
                }
 
@@ -460,31 +433,33 @@ acpi_ex_convert_to_string (
                 * Create a new String
                 * Need enough space for one ASCII integer (plus null terminator)
                 */
-               return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
+               return_desc =
+                   acpi_ut_create_string_object((acpi_size) string_length);
                if (!return_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                new_buf = return_desc->buffer.pointer;
 
                /* Convert integer to string */
 
-               string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base,
-                                  new_buf, acpi_gbl_integer_byte_width);
+               string_length =
+                   acpi_ex_convert_to_ascii(obj_desc->integer.value, base,
+                                            new_buf,
+                                            acpi_gbl_integer_byte_width);
 
                /* Null terminate at the correct place */
 
                return_desc->string.length = string_length;
-               new_buf [string_length] = 0;
+               new_buf[string_length] = 0;
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
                /* Setup string length, base, and separator */
 
                switch (type) {
-               case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
+               case ACPI_EXPLICIT_CONVERT_DECIMAL:     /* Used by to_decimal_string */
                        /*
                         * From ACPI: "If Data is a buffer, it is converted to a string of
                         * decimal values separated by commas."
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string (
                        for (i = 0; i < obj_desc->buffer.length; i++) {
                                if (obj_desc->buffer.pointer[i] >= 100) {
                                        string_length += 4;
-                               }
-                               else if (obj_desc->buffer.pointer[i] >= 10) {
+                               } else if (obj_desc->buffer.pointer[i] >= 10) {
                                        string_length += 3;
-                               }
-                               else {
+                               } else {
                                        string_length += 2;
                                }
                        }
@@ -518,7 +491,7 @@ acpi_ex_convert_to_string (
                        string_length = (obj_desc->buffer.length * 3);
                        break;
 
-               case ACPI_EXPLICIT_CONVERT_HEX:     /* Used by to_hex_string */
+               case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
                        /*
                         * From ACPI: "If Data is a buffer, it is converted to a string of
                         * hexadecimal values separated by commas."
@@ -527,7 +500,7 @@ acpi_ex_convert_to_string (
                        break;
 
                default:
-                       return_ACPI_STATUS (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS(AE_BAD_PARAMETER);
                }
 
                /*
@@ -535,15 +508,16 @@ acpi_ex_convert_to_string (
                 * (-1 because of extra separator included in string_length from above)
                 */
                string_length--;
-               if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ {
-                       return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+               if (string_length > ACPI_MAX_STRING_CONVERSION) {       /* ACPI limit */
+                       return_ACPI_STATUS(AE_AML_STRING_LIMIT);
                }
 
                /* Create a new string object and string buffer */
 
-               return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
+               return_desc =
+                   acpi_ut_create_string_object((acpi_size) string_length);
                if (!return_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                new_buf = return_desc->buffer.pointer;
@@ -553,10 +527,11 @@ acpi_ex_convert_to_string (
                 * (separated by commas or spaces)
                 */
                for (i = 0; i < obj_desc->buffer.length; i++) {
-                       new_buf += acpi_ex_convert_to_ascii (
-                                        (acpi_integer) obj_desc->buffer.pointer[i], base,
-                                        new_buf, 1);
-                       *new_buf++ = separator; /* each separated by a comma or space */
+                       new_buf += acpi_ex_convert_to_ascii((acpi_integer)
+                                                           obj_desc->buffer.
+                                                           pointer[i], base,
+                                                           new_buf, 1);
+                       *new_buf++ = separator; /* each separated by a comma or space */
                }
 
                /*
@@ -568,14 +543,13 @@ acpi_ex_convert_to_string (
                break;
 
        default:
-               return_ACPI_STATUS (AE_TYPE);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        *result_desc = return_desc;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_convert_to_target_type
@@ -592,17 +566,14 @@ acpi_ex_convert_to_string (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_convert_to_target_type (
-       acpi_object_type                destination_type,
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       **result_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_convert_to_target_type(acpi_object_type destination_type,
+                              union acpi_operand_object *source_desc,
+                              union acpi_operand_object **result_desc,
+                              struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_convert_to_target_type");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_convert_to_target_type");
 
        /* Default behavior */
 
@@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type (
         * If required by the target,
         * perform implicit conversion on the source before we store it.
         */
-       switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) {
+       switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) {
        case ARGI_SIMPLE_TARGET:
        case ARGI_FIXED_TARGET:
-       case ARGI_INTEGER_REF:      /* Handles Increment, Decrement cases */
+       case ARGI_INTEGER_REF:  /* Handles Increment, Decrement cases */
 
                switch (destination_type) {
                case ACPI_TYPE_LOCAL_REGION_FIELD:
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type (
                default:
                        /* No conversion allowed for these types */
 
-                       if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                                       "Explicit operator, will store (%s) over existing type (%s)\n",
-                                       acpi_ut_get_object_type_name (source_desc),
-                                       acpi_ut_get_type_name (destination_type)));
+                       if (destination_type !=
+                           ACPI_GET_OBJECT_TYPE(source_desc)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "Explicit operator, will store (%s) over existing type (%s)\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (source_desc),
+                                                 acpi_ut_get_type_name
+                                                 (destination_type)));
                                status = AE_TYPE;
                        }
                }
                break;
 
-
        case ARGI_TARGETREF:
 
                switch (destination_type) {
@@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type (
                         * These types require an Integer operand.  We can convert
                         * a Buffer or a String to an Integer if necessary.
                         */
-                       status = acpi_ex_convert_to_integer (source_desc, result_desc,
-                                        16);
+                       status =
+                           acpi_ex_convert_to_integer(source_desc, result_desc,
+                                                      16);
                        break;
 
-
                case ACPI_TYPE_STRING:
                        /*
                         * The operand must be a String.  We can convert an
                         * Integer or Buffer if necessary
                         */
-                       status = acpi_ex_convert_to_string (source_desc, result_desc,
-                                        ACPI_IMPLICIT_CONVERT_HEX);
+                       status =
+                           acpi_ex_convert_to_string(source_desc, result_desc,
+                                                     ACPI_IMPLICIT_CONVERT_HEX);
                        break;
 
-
                case ACPI_TYPE_BUFFER:
                        /*
                         * The operand must be a Buffer.  We can convert an
                         * Integer or String if necessary
                         */
-                       status = acpi_ex_convert_to_buffer (source_desc, result_desc);
+                       status =
+                           acpi_ex_convert_to_buffer(source_desc, result_desc);
                        break;
 
-
                default:
-                       ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
-                               destination_type));
+                       ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type));
                        status = AE_AML_INTERNAL;
                        break;
                }
                break;
 
-
        case ARGI_REFERENCE:
                /*
                 * create_xxxx_field cases - we are storing the field object into the name
                 */
                break;
 
-
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown Target type ID 0x%X Op %s dest_type %s\n",
-                       GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args),
-                       walk_state->op_info->name, acpi_ut_get_type_name (destination_type)));
-
-               ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
-                       GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)))
-               status = AE_AML_INTERNAL;
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown Target type ID 0x%X Op %s dest_type %s\n",
+                                 GET_CURRENT_ARG_TYPE(walk_state->op_info->
+                                                      runtime_args),
+                                 walk_state->op_info->name,
+                                 acpi_ut_get_type_name(destination_type)));
+
+               ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n",
+                                  GET_CURRENT_ARG_TYPE(walk_state->op_info->
+                                                       runtime_args)))
+                   status = AE_AML_INTERNAL;
        }
 
        /*
@@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type (
                status = AE_OK;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 812cdcb2e3707404b8b59c2045bfb3fbf6404695..91c49188fb0794f488b64e693c499e1ae5a8328b 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acevents.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("excreate")
-
+ACPI_MODULE_NAME("excreate")
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
  * DESCRIPTION: Create a new named alias
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_create_alias (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
 {
-       struct acpi_namespace_node      *target_node;
-       struct acpi_namespace_node      *alias_node;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_create_alias");
+       struct acpi_namespace_node *target_node;
+       struct acpi_namespace_node *alias_node;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_create_alias");
 
        /* Get the source/alias operands (both namespace nodes) */
 
-       alias_node = (struct acpi_namespace_node *) walk_state->operands[0];
-       target_node = (struct acpi_namespace_node *) walk_state->operands[1];
+       alias_node = (struct acpi_namespace_node *)walk_state->operands[0];
+       target_node = (struct acpi_namespace_node *)walk_state->operands[1];
 
        if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) ||
-               (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
+           (target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
                /*
                 * Dereference an existing alias so that we don't create a chain
                 * of aliases.  With this code, we guarantee that an alias is
                 * always exactly one level of indirection away from the
                 * actual aliased name.
                 */
-               target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object);
+               target_node =
+                   ACPI_CAST_PTR(struct acpi_namespace_node,
+                                 target_node->object);
        }
 
        /*
@@ -115,7 +109,8 @@ acpi_ex_create_alias (
                 * types, the object can change dynamically via a Store.
                 */
                alias_node->type = ACPI_TYPE_LOCAL_ALIAS;
-               alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
+               alias_node->object =
+                   ACPI_CAST_PTR(union acpi_operand_object, target_node);
                break;
 
        case ACPI_TYPE_METHOD:
@@ -126,7 +121,8 @@ acpi_ex_create_alias (
                 * types, the object can change dynamically via a Store.
                 */
                alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
-               alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
+               alias_node->object =
+                   ACPI_CAST_PTR(union acpi_operand_object, target_node);
                break;
 
        default:
@@ -139,17 +135,18 @@ acpi_ex_create_alias (
                 * additional reference to prevent deletion out from under either the
                 * target node or the alias Node
                 */
-               status = acpi_ns_attach_object (alias_node,
-                                acpi_ns_get_attached_object (target_node), target_node->type);
+               status = acpi_ns_attach_object(alias_node,
+                                              acpi_ns_get_attached_object
+                                              (target_node),
+                                              target_node->type);
                break;
        }
 
        /* Since both operands are Nodes, we don't need to delete them */
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_event
@@ -162,18 +159,14 @@ acpi_ex_create_alias (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_event (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE ("ex_create_event");
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE("ex_create_event");
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
        if (!obj_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -183,27 +176,27 @@ acpi_ex_create_event (
         * Create the actual OS semaphore, with zero initial units -- meaning
         * that the event is created in an unsignalled state
         */
-       status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
-                        &obj_desc->event.semaphore);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
+                                         &obj_desc->event.semaphore);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Attach object to the Node */
 
-       status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
-                        obj_desc, ACPI_TYPE_EVENT);
+       status =
+           acpi_ns_attach_object((struct acpi_namespace_node *)walk_state->
+                                 operands[0], obj_desc, ACPI_TYPE_EVENT);
 
-cleanup:
+      cleanup:
        /*
         * Remove local reference to the object (on error, will cause deletion
         * of both object and semaphore if present.)
         */
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_mutex
@@ -218,20 +211,16 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_mutex (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS);
+       acpi_status status = AE_OK;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS);
 
        /* Create the new mutex object */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
        if (!obj_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -242,30 +231,30 @@ acpi_ex_create_mutex (
         * One unit max to make it a mutex, with one initial unit to allow
         * the mutex to be acquired.
         */
-       status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Init object and attach to NS node */
 
-       obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
-       obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0];
-
-       status = acpi_ns_attach_object (obj_desc->mutex.node,
-                        obj_desc, ACPI_TYPE_MUTEX);
+       obj_desc->mutex.sync_level =
+           (u8) walk_state->operands[1]->integer.value;
+       obj_desc->mutex.node =
+           (struct acpi_namespace_node *)walk_state->operands[0];
 
+       status = acpi_ns_attach_object(obj_desc->mutex.node,
+                                      obj_desc, ACPI_TYPE_MUTEX);
 
-cleanup:
+      cleanup:
        /*
         * Remove local reference to the object (on error, will cause deletion
         * of both object and semaphore if present.)
         */
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_region
@@ -282,20 +271,16 @@ cleanup:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_create_region (
-       u8                              *aml_start,
-       u32                             aml_length,
-       u8                              region_space,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_create_region(u8 * aml_start,
+                     u32 aml_length,
+                     u8 region_space, struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       *region_obj2;
-
-
-       ACPI_FUNCTION_TRACE ("ex_create_region");
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *region_obj2;
 
+       ACPI_FUNCTION_TRACE("ex_create_region");
 
        /* Get the Namespace Node */
 
@@ -305,8 +290,8 @@ acpi_ex_create_region (
         * If the region object is already attached to this node,
         * just return
         */
-       if (acpi_ns_get_attached_object (node)) {
-               return_ACPI_STATUS (AE_OK);
+       if (acpi_ns_get_attached_object(node)) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -314,17 +299,18 @@ acpi_ex_create_region (
         * range
         */
        if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
-               (region_space < ACPI_USER_REGION_BEGIN)) {
-               ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space));
-               return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
+           (region_space < ACPI_USER_REGION_BEGIN)) {
+               ACPI_REPORT_ERROR(("Invalid address_space type %X\n",
+                                  region_space));
+               return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
-               acpi_ut_get_region_name (region_space), region_space));
+       ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
+                         acpi_ut_get_region_name(region_space), region_space));
 
        /* Create the region descriptor */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
        if (!obj_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -334,7 +320,7 @@ acpi_ex_create_region (
         * Remember location in AML stream of address & length
         * operands since they need to be evaluated at run time.
         */
-       region_obj2                 = obj_desc->common.next_object;
+       region_obj2 = obj_desc->common.next_object;
        region_obj2->extra.aml_start = aml_start;
        region_obj2->extra.aml_length = aml_length;
 
@@ -343,22 +329,20 @@ acpi_ex_create_region (
        obj_desc->region.space_id = region_space;
        obj_desc->region.address = 0;
        obj_desc->region.length = 0;
-       obj_desc->region.node   = node;
+       obj_desc->region.node = node;
 
        /* Install the new region object in the parent Node */
 
-       status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
+       status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
 
-
-cleanup:
+      cleanup:
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_table_region
@@ -371,20 +355,16 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_table_region (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *obj_desc;
-       struct acpi_namespace_node      *node;
-       struct acpi_table_header        *table;
-       union acpi_operand_object       *region_obj2;
-
-
-       ACPI_FUNCTION_TRACE ("ex_create_table_region");
+       acpi_status status;
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *obj_desc;
+       struct acpi_namespace_node *node;
+       struct acpi_table_header *table;
+       union acpi_operand_object *region_obj2;
 
+       ACPI_FUNCTION_TRACE("ex_create_table_region");
 
        /* Get the Node from the object stack  */
 
@@ -394,66 +374,64 @@ acpi_ex_create_table_region (
         * If the region object is already attached to this node,
         * just return
         */
-       if (acpi_ns_get_attached_object (node)) {
-               return_ACPI_STATUS (AE_OK);
+       if (acpi_ns_get_attached_object(node)) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Find the ACPI table */
 
-       status = acpi_tb_find_table (operand[1]->string.pointer,
-                          operand[2]->string.pointer,
-                          operand[3]->string.pointer, &table);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_find_table(operand[1]->string.pointer,
+                                   operand[2]->string.pointer,
+                                   operand[3]->string.pointer, &table);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Create the region descriptor */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       region_obj2                     = obj_desc->common.next_object;
+       region_obj2 = obj_desc->common.next_object;
        region_obj2->extra.region_context = NULL;
 
        /* Init the region from the operands */
 
        obj_desc->region.space_id = REGION_DATA_TABLE;
-       obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table);
+       obj_desc->region.address =
+           (acpi_physical_address) ACPI_TO_INTEGER(table);
        obj_desc->region.length = table->length;
-       obj_desc->region.node   = node;
-       obj_desc->region.flags  = AOPOBJ_DATA_VALID;
+       obj_desc->region.node = node;
+       obj_desc->region.flags = AOPOBJ_DATA_VALID;
 
        /* Install the new region object in the parent Node */
 
-       status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       status = acpi_ev_initialize_region (obj_desc, FALSE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ev_initialize_region(obj_desc, FALSE);
+       if (ACPI_FAILURE(status)) {
                if (status == AE_NOT_EXIST) {
                        status = AE_OK;
-               }
-               else {
+               } else {
                        goto cleanup;
                }
        }
 
        obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
 
-
-cleanup:
+      cleanup:
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_processor
@@ -468,43 +446,39 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_processor (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state);
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state);
 
        /* Create the processor object */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Initialize the processor object from the operands */
 
-       obj_desc->processor.proc_id = (u8)          operand[1]->integer.value;
-       obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
-       obj_desc->processor.length = (u8)           operand[3]->integer.value;
+       obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
+       obj_desc->processor.address =
+           (acpi_io_address) operand[2]->integer.value;
+       obj_desc->processor.length = (u8) operand[3]->integer.value;
 
        /* Install the processor object in the parent Node */
 
-       status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-                         obj_desc, ACPI_TYPE_PROCESSOR);
+       status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+                                      obj_desc, ACPI_TYPE_PROCESSOR);
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_power_resource
@@ -519,43 +493,39 @@ acpi_ex_create_processor (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_create_power_resource (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state);
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       acpi_status status;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state);
 
        /* Create the power resource object */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Initialize the power object from the operands */
 
        obj_desc->power_resource.system_level = (u8) operand[1]->integer.value;
-       obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value;
+       obj_desc->power_resource.resource_order =
+           (u16) operand[2]->integer.value;
 
        /* Install the  power resource object in the parent Node */
 
-       status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-                         obj_desc, ACPI_TYPE_POWER);
+       status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+                                      obj_desc, ACPI_TYPE_POWER);
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_create_method
@@ -571,25 +541,21 @@ acpi_ex_create_power_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_create_method (
-       u8                              *aml_start,
-       u32                             aml_length,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_create_method(u8 * aml_start,
+                     u32 aml_length, struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-       u8                              method_flags;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state);
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
+       u8 method_flags;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state);
 
        /* Create a new method object */
 
-       obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD);
+       obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
        if (!obj_desc) {
-          return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Save the method's AML pointer and length  */
@@ -603,8 +569,10 @@ acpi_ex_create_method (
         */
        method_flags = (u8) operand[1]->integer.value;
 
-       obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
-       obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT);
+       obj_desc->method.method_flags =
+           (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
+       obj_desc->method.param_count =
+           (u8) (method_flags & AML_METHOD_ARG_COUNT);
 
        /*
         * Get the concurrency count.  If required, a semaphore will be
@@ -613,32 +581,28 @@ acpi_ex_create_method (
        if (acpi_gbl_all_methods_serialized) {
                obj_desc->method.concurrency = 1;
                obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
-       }
-       else if (method_flags & AML_METHOD_SERIALIZED) {
+       } else if (method_flags & AML_METHOD_SERIALIZED) {
                /*
                 * ACPI 1.0: Concurrency = 1
                 * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
                 */
                obj_desc->method.concurrency = (u8)
-                                 (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
-       }
-       else {
+                   (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
+       } else {
                obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
        }
 
        /* Attach the new object to the method Node */
 
-       status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
-                         obj_desc, ACPI_TYPE_METHOD);
+       status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
+                                      obj_desc, ACPI_TYPE_METHOD);
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
+       acpi_ut_remove_reference(obj_desc);
 
        /* Remove a reference to the operand */
 
-       acpi_ut_remove_reference (operand[1]);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(operand[1]);
+       return_ACPI_STATUS(status);
 }
-
-
index 408500648114ab639f4f05944a823c17cc56e636..bc2fa996047ef6148ce26101e77fa2ef7a8468cd 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exdump")
+ACPI_MODULE_NAME("exdump")
 
+/*
+ * The following routines are used for debug output only
+ */
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /* Local prototypes */
-
 #ifdef ACPI_FUTURE_USAGE
-static void
-acpi_ex_out_string (
-       char                            *title,
-       char                            *value);
+static void acpi_ex_out_string(char *title, char *value);
 
-static void
-acpi_ex_out_pointer (
-       char                            *title,
-       void                            *value);
+static void acpi_ex_out_pointer(char *title, void *value);
 
-static void
-acpi_ex_out_integer (
-       char                            *title,
-       u32                             value);
+static void acpi_ex_out_integer(char *title, u32 value);
 
-static void
-acpi_ex_out_address (
-       char                            *title,
-       acpi_physical_address           value);
-#endif /* ACPI_FUTURE_USAGE */
+static void acpi_ex_out_address(char *title, acpi_physical_address value);
 
+static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc);
 
-/*
- * The following routines are used for debug output only
- */
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+static void
+acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*******************************************************************************
  *
@@ -94,143 +83,140 @@ acpi_ex_out_address (
  *
  ******************************************************************************/
 
-void
-acpi_ex_dump_operand (
-       union acpi_operand_object       *obj_desc,
-       u32                             depth)
+void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 {
-       u32                             length;
-       u32                             index;
-
+       u32 length;
+       u32 index;
 
-       ACPI_FUNCTION_NAME ("ex_dump_operand")
+       ACPI_FUNCTION_NAME("ex_dump_operand")
 
-
-       if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
+           if (!
+               ((ACPI_LV_EXEC & acpi_dbg_level)
+                && (_COMPONENT & acpi_dbg_layer))) {
                return;
        }
 
        if (!obj_desc) {
                /* This could be a null element of a package */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n"));
                return;
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", obj_desc));
-               ACPI_DUMP_ENTRY (obj_desc, ACPI_LV_EXEC);
+       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
+                                 obj_desc));
+               ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
                return;
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "%p is not a node or operand object: [%s]\n",
-                       obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
-               ACPI_DUMP_BUFFER (obj_desc, sizeof (union acpi_operand_object));
+       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "%p is not a node or operand object: [%s]\n",
+                                 obj_desc,
+                                 acpi_ut_get_descriptor_name(obj_desc)));
+               ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
                return;
        }
 
        /* obj_desc is a valid object */
 
        if (depth > 0) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ",
-                       depth, " ", depth, obj_desc));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
+                                 depth, " ", depth, obj_desc));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
        }
 
        /* Decode object type */
 
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                switch (obj_desc->reference.opcode) {
                case AML_DEBUG_OP:
 
-                       acpi_os_printf ("Reference: Debug\n");
+                       acpi_os_printf("Reference: Debug\n");
                        break;
 
-
                case AML_NAME_OP:
 
-                       ACPI_DUMP_PATHNAME (obj_desc->reference.object,
-                               "Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
-                       ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO);
+                       ACPI_DUMP_PATHNAME(obj_desc->reference.object,
+                                          "Reference: Name: ", ACPI_LV_INFO,
+                                          _COMPONENT);
+                       ACPI_DUMP_ENTRY(obj_desc->reference.object,
+                                       ACPI_LV_INFO);
                        break;
 
-
                case AML_INDEX_OP:
 
-                       acpi_os_printf ("Reference: Index %p\n",
-                               obj_desc->reference.object);
+                       acpi_os_printf("Reference: Index %p\n",
+                                      obj_desc->reference.object);
                        break;
 
-
                case AML_REF_OF_OP:
 
-                       acpi_os_printf ("Reference: (ref_of) %p\n",
-                               obj_desc->reference.object);
+                       acpi_os_printf("Reference: (ref_of) %p\n",
+                                      obj_desc->reference.object);
                        break;
 
-
                case AML_ARG_OP:
 
-                       acpi_os_printf ("Reference: Arg%d",
-                               obj_desc->reference.offset);
+                       acpi_os_printf("Reference: Arg%d",
+                                      obj_desc->reference.offset);
 
-                       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+                       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                                /* Value is an Integer */
 
-                               acpi_os_printf (" value is [%8.8X%8.8x]",
-                                       ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+                               acpi_os_printf(" value is [%8.8X%8.8x]",
+                                              ACPI_FORMAT_UINT64(obj_desc->
+                                                                 integer.
+                                                                 value));
                        }
 
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                        break;
 
-
                case AML_LOCAL_OP:
 
-                       acpi_os_printf ("Reference: Local%d",
-                               obj_desc->reference.offset);
+                       acpi_os_printf("Reference: Local%d",
+                                      obj_desc->reference.offset);
 
-                       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+                       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
 
                                /* Value is an Integer */
 
-                               acpi_os_printf (" value is [%8.8X%8.8x]",
-                                       ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+                               acpi_os_printf(" value is [%8.8X%8.8x]",
+                                              ACPI_FORMAT_UINT64(obj_desc->
+                                                                 integer.
+                                                                 value));
                        }
 
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                        break;
 
-
                case AML_INT_NAMEPATH_OP:
 
-                       acpi_os_printf ("Reference.Node->Name %X\n",
-                               obj_desc->reference.node->name.integer);
+                       acpi_os_printf("Reference.Node->Name %X\n",
+                                      obj_desc->reference.node->name.integer);
                        break;
 
-
                default:
 
                        /* Unknown opcode */
 
-                       acpi_os_printf ("Unknown Reference opcode=%X\n",
-                               obj_desc->reference.opcode);
+                       acpi_os_printf("Unknown Reference opcode=%X\n",
+                                      obj_desc->reference.opcode);
                        break;
 
                }
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
-               acpi_os_printf ("Buffer len %X @ %p \n",
-                       obj_desc->buffer.length, obj_desc->buffer.pointer);
+               acpi_os_printf("Buffer len %X @ %p \n",
+                              obj_desc->buffer.length,
+                              obj_desc->buffer.pointer);
 
                length = obj_desc->buffer.length;
                if (length > 64) {
@@ -240,178 +226,166 @@ acpi_ex_dump_operand (
                /* Debug only -- dump the buffer contents */
 
                if (obj_desc->buffer.pointer) {
-                       acpi_os_printf ("Buffer Contents: ");
+                       acpi_os_printf("Buffer Contents: ");
 
                        for (index = 0; index < length; index++) {
-                               acpi_os_printf (" %02x", obj_desc->buffer.pointer[index]);
+                               acpi_os_printf(" %02x",
+                                              obj_desc->buffer.pointer[index]);
                        }
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                }
                break;
 
-
        case ACPI_TYPE_INTEGER:
 
-               acpi_os_printf ("Integer %8.8X%8.8X\n",
-                       ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+               acpi_os_printf("Integer %8.8X%8.8X\n",
+                              ACPI_FORMAT_UINT64(obj_desc->integer.value));
                break;
 
-
        case ACPI_TYPE_PACKAGE:
 
-               acpi_os_printf ("Package [Len %X] element_array %p\n",
-                       obj_desc->package.count, obj_desc->package.elements);
+               acpi_os_printf("Package [Len %X] element_array %p\n",
+                              obj_desc->package.count,
+                              obj_desc->package.elements);
 
                /*
                 * If elements exist, package element pointer is valid,
                 * and debug_level exceeds 1, dump package's elements.
                 */
                if (obj_desc->package.count &&
-                       obj_desc->package.elements &&
-                       acpi_dbg_level > 1) {
-                       for (index = 0; index < obj_desc->package.count; index++) {
-                               acpi_ex_dump_operand (obj_desc->package.elements[index], depth+1);
+                   obj_desc->package.elements && acpi_dbg_level > 1) {
+                       for (index = 0; index < obj_desc->package.count;
+                            index++) {
+                               acpi_ex_dump_operand(obj_desc->package.
+                                                    elements[index],
+                                                    depth + 1);
                        }
                }
                break;
 
-
        case ACPI_TYPE_REGION:
 
-               acpi_os_printf ("Region %s (%X)",
-                       acpi_ut_get_region_name (obj_desc->region.space_id),
-                       obj_desc->region.space_id);
+               acpi_os_printf("Region %s (%X)",
+                              acpi_ut_get_region_name(obj_desc->region.
+                                                      space_id),
+                              obj_desc->region.space_id);
 
                /*
                 * If the address and length have not been evaluated,
                 * don't print them.
                 */
                if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
-                       acpi_os_printf ("\n");
-               }
-               else {
-                       acpi_os_printf (" base %8.8X%8.8X Length %X\n",
-                               ACPI_FORMAT_UINT64 (obj_desc->region.address),
-                               obj_desc->region.length);
+                       acpi_os_printf("\n");
+               } else {
+                       acpi_os_printf(" base %8.8X%8.8X Length %X\n",
+                                      ACPI_FORMAT_UINT64(obj_desc->region.
+                                                         address),
+                                      obj_desc->region.length);
                }
                break;
 
-
        case ACPI_TYPE_STRING:
 
-               acpi_os_printf ("String length %X @ %p ",
-                       obj_desc->string.length,
-                       obj_desc->string.pointer);
+               acpi_os_printf("String length %X @ %p ",
+                              obj_desc->string.length,
+                              obj_desc->string.pointer);
 
-               acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
-               acpi_os_printf ("\n");
+               acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
+               acpi_os_printf("\n");
                break;
 
-
        case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-               acpi_os_printf ("bank_field\n");
+               acpi_os_printf("bank_field\n");
                break;
 
-
        case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-               acpi_os_printf (
-                       "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
-                       obj_desc->field.bit_length,
-                       obj_desc->field.access_byte_width,
-                       obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
-                       obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
-                       obj_desc->field.base_byte_offset,
-                       obj_desc->field.start_field_bit_offset);
+               acpi_os_printf
+                   ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
+                    obj_desc->field.bit_length,
+                    obj_desc->field.access_byte_width,
+                    obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
+                    obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
+                    obj_desc->field.base_byte_offset,
+                    obj_desc->field.start_field_bit_offset);
 
-               acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1);
+               acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
                break;
 
-
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               acpi_os_printf ("index_field\n");
+               acpi_os_printf("index_field\n");
                break;
 
-
        case ACPI_TYPE_BUFFER_FIELD:
 
-               acpi_os_printf (
-                       "buffer_field: %X bits at byte %X bit %X of \n",
-                       obj_desc->buffer_field.bit_length,
-                       obj_desc->buffer_field.base_byte_offset,
-                       obj_desc->buffer_field.start_field_bit_offset);
+               acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n",
+                              obj_desc->buffer_field.bit_length,
+                              obj_desc->buffer_field.base_byte_offset,
+                              obj_desc->buffer_field.start_field_bit_offset);
 
                if (!obj_desc->buffer_field.buffer_obj) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
-               }
-               else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
-                                ACPI_TYPE_BUFFER) {
-                       acpi_os_printf ("*not a Buffer* \n");
-               }
-               else {
-                       acpi_ex_dump_operand (obj_desc->buffer_field.buffer_obj, depth+1);
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n"));
+               } else
+                   if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
+                       != ACPI_TYPE_BUFFER) {
+                       acpi_os_printf("*not a Buffer* \n");
+               } else {
+                       acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
+                                            depth + 1);
                }
                break;
 
-
        case ACPI_TYPE_EVENT:
 
-               acpi_os_printf ("Event\n");
+               acpi_os_printf("Event\n");
                break;
 
-
        case ACPI_TYPE_METHOD:
 
-               acpi_os_printf ("Method(%X) @ %p:%X\n",
-                       obj_desc->method.param_count,
-                       obj_desc->method.aml_start,
-                       obj_desc->method.aml_length);
+               acpi_os_printf("Method(%X) @ %p:%X\n",
+                              obj_desc->method.param_count,
+                              obj_desc->method.aml_start,
+                              obj_desc->method.aml_length);
                break;
 
-
        case ACPI_TYPE_MUTEX:
 
-               acpi_os_printf ("Mutex\n");
+               acpi_os_printf("Mutex\n");
                break;
 
-
        case ACPI_TYPE_DEVICE:
 
-               acpi_os_printf ("Device\n");
+               acpi_os_printf("Device\n");
                break;
 
-
        case ACPI_TYPE_POWER:
 
-               acpi_os_printf ("Power\n");
+               acpi_os_printf("Power\n");
                break;
 
-
        case ACPI_TYPE_PROCESSOR:
 
-               acpi_os_printf ("Processor\n");
+               acpi_os_printf("Processor\n");
                break;
 
-
        case ACPI_TYPE_THERMAL:
 
-               acpi_os_printf ("Thermal\n");
+               acpi_os_printf("Thermal\n");
                break;
 
-
        default:
                /* Unknown Type */
 
-               acpi_os_printf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
+               acpi_os_printf("Unknown Type %X\n",
+                              ACPI_GET_OBJECT_TYPE(obj_desc));
                break;
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_dump_operands
@@ -429,20 +403,15 @@ acpi_ex_dump_operand (
  ******************************************************************************/
 
 void
-acpi_ex_dump_operands (
-       union acpi_operand_object       **operands,
-       acpi_interpreter_mode           interpreter_mode,
-       char                            *ident,
-       u32                             num_levels,
-       char                            *note,
-       char                            *module_name,
-       u32                             line_number)
+acpi_ex_dump_operands(union acpi_operand_object **operands,
+                     acpi_interpreter_mode interpreter_mode,
+                     char *ident,
+                     u32 num_levels,
+                     char *note, char *module_name, u32 line_number)
 {
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_NAME ("ex_dump_operands");
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_NAME("ex_dump_operands");
 
        if (!ident) {
                ident = "?";
@@ -452,9 +421,9 @@ acpi_ex_dump_operands (
                note = "?";
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
-               ident, num_levels));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
+                         ident, num_levels));
 
        if (num_levels == 0) {
                num_levels = 1;
@@ -463,16 +432,15 @@ acpi_ex_dump_operands (
        /* Dump the operand stack starting at the top */
 
        for (i = 0; num_levels > 0; i--, num_levels--) {
-               acpi_ex_dump_operand (operands[i], 0);
+               acpi_ex_dump_operand(operands[i], 0);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "************* Stack dump from %s(%d), %s\n",
-               module_name, line_number, note));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "************* Operand Stack dump from %s(%d), %s\n",
+                         module_name, line_number, note));
        return;
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -487,44 +455,31 @@ acpi_ex_dump_operands (
  *
  ******************************************************************************/
 
-static void
-acpi_ex_out_string (
-       char                            *title,
-       char                            *value)
+static void acpi_ex_out_string(char *title, char *value)
 {
-       acpi_os_printf ("%20s : %s\n", title, value);
+       acpi_os_printf("%20s : %s\n", title, value);
 }
 
-static void
-acpi_ex_out_pointer (
-       char                            *title,
-       void                            *value)
+static void acpi_ex_out_pointer(char *title, void *value)
 {
-       acpi_os_printf ("%20s : %p\n", title, value);
+       acpi_os_printf("%20s : %p\n", title, value);
 }
 
-static void
-acpi_ex_out_integer (
-       char                            *title,
-       u32                             value)
+static void acpi_ex_out_integer(char *title, u32 value)
 {
-       acpi_os_printf ("%20s : %X\n", title, value);
+       acpi_os_printf("%20s : %.2X\n", title, value);
 }
 
-static void
-acpi_ex_out_address (
-       char                            *title,
-       acpi_physical_address           value)
+static void acpi_ex_out_address(char *title, acpi_physical_address value)
 {
 
 #if ACPI_MACHINE_WIDTH == 16
-       acpi_os_printf ("%20s : %p\n", title, value);
+       acpi_os_printf("%20s : %p\n", title, value);
 #else
-       acpi_os_printf ("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64 (value));
+       acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
 #endif
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_dump_node
@@ -536,38 +491,161 @@ acpi_ex_out_address (
  *
  ******************************************************************************/
 
-void
-acpi_ex_dump_node (
-       struct acpi_namespace_node      *node,
-       u32                             flags)
+void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
 {
 
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        if (!flags) {
-               if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
+               if (!
+                   ((ACPI_LV_OBJECTS & acpi_dbg_level)
+                    && (_COMPONENT & acpi_dbg_layer))) {
                        return;
                }
        }
 
-       acpi_os_printf ("%20s : %4.4s\n",     "Name", acpi_ut_get_node_name (node));
-       acpi_ex_out_string ("Type",           acpi_ut_get_type_name (node->type));
-       acpi_ex_out_integer ("Flags",         node->flags);
-       acpi_ex_out_integer ("Owner Id",      node->owner_id);
-       acpi_ex_out_integer ("Reference Count", node->reference_count);
-       acpi_ex_out_pointer ("Attached Object", acpi_ns_get_attached_object (node));
-       acpi_ex_out_pointer ("child_list",    node->child);
-       acpi_ex_out_pointer ("next_peer",     node->peer);
-       acpi_ex_out_pointer ("Parent",        acpi_ns_get_parent_node (node));
+       acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
+       acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
+       acpi_ex_out_integer("Flags", node->flags);
+       acpi_ex_out_integer("Owner Id", node->owner_id);
+       acpi_ex_out_integer("Reference Count", node->reference_count);
+       acpi_ex_out_pointer("Attached Object",
+                           acpi_ns_get_attached_object(node));
+       acpi_ex_out_pointer("child_list", node->child);
+       acpi_ex_out_pointer("next_peer", node->peer);
+       acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node));
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_dump_reference
+ *
+ * PARAMETERS:  Object              - Descriptor to dump
+ *
+ * DESCRIPTION: Dumps a reference object
+ *
+ ******************************************************************************/
+
+static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
+{
+       struct acpi_buffer ret_buf;
+       acpi_status status;
+
+       if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
+               acpi_os_printf("Named Object %p ", obj_desc->reference.node);
+               ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+               status =
+                   acpi_ns_handle_to_pathname(obj_desc->reference.node,
+                                              &ret_buf);
+               if (ACPI_FAILURE(status)) {
+                       acpi_os_printf("Could not convert name to pathname\n");
+               } else {
+                       acpi_os_printf("%s\n", (char *)ret_buf.pointer);
+                       ACPI_MEM_FREE(ret_buf.pointer);
+               }
+       } else if (obj_desc->reference.object) {
+               acpi_os_printf("\nReferenced Object: %p\n",
+                              obj_desc->reference.object);
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ex_dump_package
+ *
+ * PARAMETERS:  Object              - Descriptor to dump
+ *              Level               - Indentation Level
+ *              Index               - Package index for this object
+ *
+ * DESCRIPTION: Dumps the elements of the package
+ *
+ ******************************************************************************/
+
+static void
+acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
+{
+       u32 i;
+
+       /* Indentation and index output */
+
+       if (level > 0) {
+               for (i = 0; i < level; i++) {
+                       acpi_os_printf(" ");
+               }
+
+               acpi_os_printf("[%.2d] ", index);
+       }
+
+       acpi_os_printf("%p ", obj_desc);
+
+       /* Null package elements are allowed */
+
+       if (!obj_desc) {
+               acpi_os_printf("[Null Object]\n");
+               return;
+       }
+
+       /* Packages may only contain a few object types */
+
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
+       case ACPI_TYPE_INTEGER:
+
+               acpi_os_printf("[Integer] = %8.8X%8.8X\n",
+                              ACPI_FORMAT_UINT64(obj_desc->integer.value));
+               break;
+
+       case ACPI_TYPE_STRING:
+
+               acpi_os_printf("[String] Value: ");
+               for (i = 0; i < obj_desc->string.length; i++) {
+                       acpi_os_printf("%c", obj_desc->string.pointer[i]);
+               }
+               acpi_os_printf("\n");
+               break;
+
+       case ACPI_TYPE_BUFFER:
+
+               acpi_os_printf("[Buffer] Length %.2X = ",
+                              obj_desc->buffer.length);
+               if (obj_desc->buffer.length) {
+                       acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer,
+                                           obj_desc->buffer.length,
+                                           DB_DWORD_DISPLAY, _COMPONENT);
+               } else {
+                       acpi_os_printf("\n");
+               }
+               break;
+
+       case ACPI_TYPE_PACKAGE:
+
+               acpi_os_printf("[Package] Contains %d Elements: \n",
+                              obj_desc->package.count);
+
+               for (i = 0; i < obj_desc->package.count; i++) {
+                       acpi_ex_dump_package(obj_desc->package.elements[i],
+                                            level + 1, i);
+               }
+               break;
+
+       case ACPI_TYPE_LOCAL_REFERENCE:
+
+               acpi_os_printf("[Object Reference] ");
+               acpi_ex_dump_reference(obj_desc);
+               break;
+
+       default:
+
+               acpi_os_printf("[Unknown Type] %X\n",
+                              ACPI_GET_OBJECT_TYPE(obj_desc));
+               break;
+       }
+}
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_dump_object_descriptor
  *
- * PARAMETERS:  *Object             - Descriptor to dump
+ * PARAMETERS:  Object              - Descriptor to dump
  *              Flags               - Force display if TRUE
  *
  * DESCRIPTION: Dumps the members of the object descriptor given.
@@ -575,202 +653,213 @@ acpi_ex_dump_node (
  ******************************************************************************/
 
 void
-acpi_ex_dump_object_descriptor (
-       union acpi_operand_object       *obj_desc,
-       u32                             flags)
+acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
 {
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
-
+       ACPI_FUNCTION_TRACE("ex_dump_object_descriptor");
 
        if (!obj_desc) {
                return_VOID;
        }
 
        if (!flags) {
-               if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
+               if (!
+                   ((ACPI_LV_OBJECTS & acpi_dbg_level)
+                    && (_COMPONENT & acpi_dbg_layer))) {
                        return_VOID;
                }
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
-               acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags);
-               acpi_os_printf ("\nAttached Object (%p):\n",
-                       ((struct acpi_namespace_node *) obj_desc)->object);
-               acpi_ex_dump_object_descriptor (
-                       ((struct acpi_namespace_node *) obj_desc)->object, flags);
+       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
+               acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc,
+                                 flags);
+               acpi_os_printf("\nAttached Object (%p):\n",
+                              ((struct acpi_namespace_node *)obj_desc)->
+                              object);
+               acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *)
+                                               obj_desc)->object, flags);
                return_VOID;
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
-               acpi_os_printf (
-                       "ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
-                       obj_desc, acpi_ut_get_descriptor_name (obj_desc));
+       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
+               acpi_os_printf
+                   ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
+                    obj_desc, acpi_ut_get_descriptor_name(obj_desc));
                return_VOID;
        }
 
        /* Common Fields */
 
-       acpi_ex_out_string ("Type",             acpi_ut_get_object_type_name (obj_desc));
-       acpi_ex_out_integer ("Reference Count", obj_desc->common.reference_count);
-       acpi_ex_out_integer ("Flags",           obj_desc->common.flags);
+       acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc));
+       acpi_ex_out_integer("Reference Count",
+                           obj_desc->common.reference_count);
+       acpi_ex_out_integer("Flags", obj_desc->common.flags);
 
        /* Object-specific Fields */
 
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_INTEGER:
 
-               acpi_os_printf ("%20s : %8.8X%8.8X\n", "Value",
-                               ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+               acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
+                              ACPI_FORMAT_UINT64(obj_desc->integer.value));
                break;
 
-
        case ACPI_TYPE_STRING:
 
-               acpi_ex_out_integer ("Length",      obj_desc->string.length);
+               acpi_ex_out_integer("Length", obj_desc->string.length);
 
-               acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer);
-               acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
-               acpi_os_printf ("\n");
+               acpi_os_printf("%20s : %p ", "Pointer",
+                              obj_desc->string.pointer);
+               acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
+               acpi_os_printf("\n");
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
-               acpi_ex_out_integer ("Length",      obj_desc->buffer.length);
-               acpi_ex_out_pointer ("Pointer",     obj_desc->buffer.pointer);
-               ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length);
+               acpi_ex_out_integer("Length", obj_desc->buffer.length);
+               acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer);
+               ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
+                                obj_desc->buffer.length);
                break;
 
-
        case ACPI_TYPE_PACKAGE:
 
-               acpi_ex_out_integer ("Flags",       obj_desc->package.flags);
-               acpi_ex_out_integer ("Count",       obj_desc->package.count);
-               acpi_ex_out_pointer ("Elements",    obj_desc->package.elements);
+               acpi_ex_out_integer("Flags", obj_desc->package.flags);
+               acpi_ex_out_integer("Elements", obj_desc->package.count);
+               acpi_ex_out_pointer("Element List", obj_desc->package.elements);
 
                /* Dump the package contents */
 
-               if (obj_desc->package.count > 0) {
-                       acpi_os_printf ("\nPackage Contents:\n");
-                       for (i = 0; i < obj_desc->package.count; i++) {
-                               acpi_os_printf ("[%.3d] %p", i, obj_desc->package.elements[i]);
-                               if (obj_desc->package.elements[i]) {
-                                       acpi_os_printf (" %s",
-                                               acpi_ut_get_object_type_name (obj_desc->package.elements[i]));
-                               }
-                               acpi_os_printf ("\n");
-                       }
-               }
+               acpi_os_printf("\nPackage Contents:\n");
+               acpi_ex_dump_package(obj_desc, 0, 0);
                break;
 
-
        case ACPI_TYPE_DEVICE:
 
-               acpi_ex_out_pointer ("Handler",     obj_desc->device.handler);
-               acpi_ex_out_pointer ("system_notify", obj_desc->device.system_notify);
-               acpi_ex_out_pointer ("device_notify", obj_desc->device.device_notify);
+               acpi_ex_out_pointer("Handler", obj_desc->device.handler);
+               acpi_ex_out_pointer("system_notify",
+                                   obj_desc->device.system_notify);
+               acpi_ex_out_pointer("device_notify",
+                                   obj_desc->device.device_notify);
                break;
 
-
        case ACPI_TYPE_EVENT:
 
-               acpi_ex_out_pointer ("Semaphore",   obj_desc->event.semaphore);
+               acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore);
                break;
 
-
        case ACPI_TYPE_METHOD:
 
-               acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
-               acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
-               acpi_ex_out_pointer ("Semaphore",   obj_desc->method.semaphore);
-               acpi_ex_out_integer ("owning_id",   obj_desc->method.owning_id);
-               acpi_ex_out_integer ("aml_length",  obj_desc->method.aml_length);
-               acpi_ex_out_pointer ("aml_start",   obj_desc->method.aml_start);
+               acpi_ex_out_integer("param_count",
+                                   obj_desc->method.param_count);
+               acpi_ex_out_integer("Concurrency",
+                                   obj_desc->method.concurrency);
+               acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore);
+               acpi_ex_out_integer("owner_id", obj_desc->method.owner_id);
+               acpi_ex_out_integer("aml_length", obj_desc->method.aml_length);
+               acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start);
                break;
 
-
        case ACPI_TYPE_MUTEX:
 
-               acpi_ex_out_integer ("sync_level",  obj_desc->mutex.sync_level);
-               acpi_ex_out_pointer ("owner_thread", obj_desc->mutex.owner_thread);
-               acpi_ex_out_integer ("acquire_depth", obj_desc->mutex.acquisition_depth);
-               acpi_ex_out_pointer ("Semaphore",   obj_desc->mutex.semaphore);
+               acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level);
+               acpi_ex_out_pointer("owner_thread",
+                                   obj_desc->mutex.owner_thread);
+               acpi_ex_out_integer("acquire_depth",
+                                   obj_desc->mutex.acquisition_depth);
+               acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore);
                break;
 
-
        case ACPI_TYPE_REGION:
 
-               acpi_ex_out_integer ("space_id",    obj_desc->region.space_id);
-               acpi_ex_out_integer ("Flags",       obj_desc->region.flags);
-               acpi_ex_out_address ("Address",     obj_desc->region.address);
-               acpi_ex_out_integer ("Length",      obj_desc->region.length);
-               acpi_ex_out_pointer ("Handler",     obj_desc->region.handler);
-               acpi_ex_out_pointer ("Next",        obj_desc->region.next);
+               acpi_ex_out_integer("space_id", obj_desc->region.space_id);
+               acpi_ex_out_integer("Flags", obj_desc->region.flags);
+               acpi_ex_out_address("Address", obj_desc->region.address);
+               acpi_ex_out_integer("Length", obj_desc->region.length);
+               acpi_ex_out_pointer("Handler", obj_desc->region.handler);
+               acpi_ex_out_pointer("Next", obj_desc->region.next);
                break;
 
-
        case ACPI_TYPE_POWER:
 
-               acpi_ex_out_integer ("system_level", obj_desc->power_resource.system_level);
-               acpi_ex_out_integer ("resource_order", obj_desc->power_resource.resource_order);
-               acpi_ex_out_pointer ("system_notify", obj_desc->power_resource.system_notify);
-               acpi_ex_out_pointer ("device_notify", obj_desc->power_resource.device_notify);
+               acpi_ex_out_integer("system_level",
+                                   obj_desc->power_resource.system_level);
+               acpi_ex_out_integer("resource_order",
+                                   obj_desc->power_resource.resource_order);
+               acpi_ex_out_pointer("system_notify",
+                                   obj_desc->power_resource.system_notify);
+               acpi_ex_out_pointer("device_notify",
+                                   obj_desc->power_resource.device_notify);
                break;
 
-
        case ACPI_TYPE_PROCESSOR:
 
-               acpi_ex_out_integer ("Processor ID", obj_desc->processor.proc_id);
-               acpi_ex_out_integer ("Length",      obj_desc->processor.length);
-               acpi_ex_out_address ("Address",     (acpi_physical_address) obj_desc->processor.address);
-               acpi_ex_out_pointer ("system_notify", obj_desc->processor.system_notify);
-               acpi_ex_out_pointer ("device_notify", obj_desc->processor.device_notify);
-               acpi_ex_out_pointer ("Handler",     obj_desc->processor.handler);
+               acpi_ex_out_integer("Processor ID",
+                                   obj_desc->processor.proc_id);
+               acpi_ex_out_integer("Length", obj_desc->processor.length);
+               acpi_ex_out_address("Address",
+                                   (acpi_physical_address) obj_desc->processor.
+                                   address);
+               acpi_ex_out_pointer("system_notify",
+                                   obj_desc->processor.system_notify);
+               acpi_ex_out_pointer("device_notify",
+                                   obj_desc->processor.device_notify);
+               acpi_ex_out_pointer("Handler", obj_desc->processor.handler);
                break;
 
-
        case ACPI_TYPE_THERMAL:
 
-               acpi_ex_out_pointer ("system_notify", obj_desc->thermal_zone.system_notify);
-               acpi_ex_out_pointer ("device_notify", obj_desc->thermal_zone.device_notify);
-               acpi_ex_out_pointer ("Handler",     obj_desc->thermal_zone.handler);
+               acpi_ex_out_pointer("system_notify",
+                                   obj_desc->thermal_zone.system_notify);
+               acpi_ex_out_pointer("device_notify",
+                                   obj_desc->thermal_zone.device_notify);
+               acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler);
                break;
 
-
        case ACPI_TYPE_BUFFER_FIELD:
        case ACPI_TYPE_LOCAL_REGION_FIELD:
        case ACPI_TYPE_LOCAL_BANK_FIELD:
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               acpi_ex_out_integer ("field_flags", obj_desc->common_field.field_flags);
-               acpi_ex_out_integer ("access_byte_width",obj_desc->common_field.access_byte_width);
-               acpi_ex_out_integer ("bit_length",  obj_desc->common_field.bit_length);
-               acpi_ex_out_integer ("fld_bit_offset", obj_desc->common_field.start_field_bit_offset);
-               acpi_ex_out_integer ("base_byte_offset", obj_desc->common_field.base_byte_offset);
-               acpi_ex_out_pointer ("parent_node", obj_desc->common_field.node);
-
-               switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+               acpi_ex_out_integer("field_flags",
+                                   obj_desc->common_field.field_flags);
+               acpi_ex_out_integer("access_byte_width",
+                                   obj_desc->common_field.access_byte_width);
+               acpi_ex_out_integer("bit_length",
+                                   obj_desc->common_field.bit_length);
+               acpi_ex_out_integer("fld_bit_offset",
+                                   obj_desc->common_field.
+                                   start_field_bit_offset);
+               acpi_ex_out_integer("base_byte_offset",
+                                   obj_desc->common_field.base_byte_offset);
+               acpi_ex_out_pointer("parent_node", obj_desc->common_field.node);
+
+               switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                case ACPI_TYPE_BUFFER_FIELD:
-                       acpi_ex_out_pointer ("buffer_obj", obj_desc->buffer_field.buffer_obj);
+                       acpi_ex_out_pointer("buffer_obj",
+                                           obj_desc->buffer_field.buffer_obj);
                        break;
 
                case ACPI_TYPE_LOCAL_REGION_FIELD:
-                       acpi_ex_out_pointer ("region_obj", obj_desc->field.region_obj);
+                       acpi_ex_out_pointer("region_obj",
+                                           obj_desc->field.region_obj);
                        break;
 
                case ACPI_TYPE_LOCAL_BANK_FIELD:
-                       acpi_ex_out_integer ("Value",   obj_desc->bank_field.value);
-                       acpi_ex_out_pointer ("region_obj", obj_desc->bank_field.region_obj);
-                       acpi_ex_out_pointer ("bank_obj", obj_desc->bank_field.bank_obj);
+                       acpi_ex_out_integer("Value",
+                                           obj_desc->bank_field.value);
+                       acpi_ex_out_pointer("region_obj",
+                                           obj_desc->bank_field.region_obj);
+                       acpi_ex_out_pointer("bank_obj",
+                                           obj_desc->bank_field.bank_obj);
                        break;
 
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
-                       acpi_ex_out_integer ("Value",   obj_desc->index_field.value);
-                       acpi_ex_out_pointer ("Index",   obj_desc->index_field.index_obj);
-                       acpi_ex_out_pointer ("Data",    obj_desc->index_field.data_obj);
+                       acpi_ex_out_integer("Value",
+                                           obj_desc->index_field.value);
+                       acpi_ex_out_pointer("Index",
+                                           obj_desc->index_field.index_obj);
+                       acpi_ex_out_pointer("Data",
+                                           obj_desc->index_field.data_obj);
                        break;
 
                default:
@@ -779,56 +868,52 @@ acpi_ex_dump_object_descriptor (
                }
                break;
 
-
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               acpi_ex_out_integer ("target_type", obj_desc->reference.target_type);
-               acpi_ex_out_string ("Opcode",       (acpi_ps_get_opcode_info (
-                                 obj_desc->reference.opcode))->name);
-               acpi_ex_out_integer ("Offset",      obj_desc->reference.offset);
-               acpi_ex_out_pointer ("obj_desc",    obj_desc->reference.object);
-               acpi_ex_out_pointer ("Node",        obj_desc->reference.node);
-               acpi_ex_out_pointer ("Where",       obj_desc->reference.where);
-
-               if (obj_desc->reference.object) {
-                       acpi_os_printf ("\nReferenced Object:\n");
-                       acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
-               }
-               break;
+               acpi_ex_out_integer("target_type",
+                                   obj_desc->reference.target_type);
+               acpi_ex_out_string("Opcode",
+                                  (acpi_ps_get_opcode_info
+                                   (obj_desc->reference.opcode))->name);
+               acpi_ex_out_integer("Offset", obj_desc->reference.offset);
+               acpi_ex_out_pointer("obj_desc", obj_desc->reference.object);
+               acpi_ex_out_pointer("Node", obj_desc->reference.node);
+               acpi_ex_out_pointer("Where", obj_desc->reference.where);
 
+               acpi_ex_dump_reference(obj_desc);
+               break;
 
        case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
 
-               acpi_ex_out_integer ("space_id",    obj_desc->address_space.space_id);
-               acpi_ex_out_pointer ("Next",        obj_desc->address_space.next);
-               acpi_ex_out_pointer ("region_list", obj_desc->address_space.region_list);
-               acpi_ex_out_pointer ("Node",        obj_desc->address_space.node);
-               acpi_ex_out_pointer ("Context",     obj_desc->address_space.context);
+               acpi_ex_out_integer("space_id",
+                                   obj_desc->address_space.space_id);
+               acpi_ex_out_pointer("Next", obj_desc->address_space.next);
+               acpi_ex_out_pointer("region_list",
+                                   obj_desc->address_space.region_list);
+               acpi_ex_out_pointer("Node", obj_desc->address_space.node);
+               acpi_ex_out_pointer("Context", obj_desc->address_space.context);
                break;
 
-
        case ACPI_TYPE_LOCAL_NOTIFY:
 
-               acpi_ex_out_pointer ("Node",        obj_desc->notify.node);
-               acpi_ex_out_pointer ("Context",     obj_desc->notify.context);
+               acpi_ex_out_pointer("Node", obj_desc->notify.node);
+               acpi_ex_out_pointer("Context", obj_desc->notify.context);
                break;
 
-
        case ACPI_TYPE_LOCAL_ALIAS:
        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
        case ACPI_TYPE_LOCAL_EXTRA:
        case ACPI_TYPE_LOCAL_DATA:
        default:
 
-               acpi_os_printf (
-                       "ex_dump_object_descriptor: Display not implemented for object type %s\n",
-                       acpi_ut_get_object_type_name (obj_desc));
+               acpi_os_printf
+                   ("ex_dump_object_descriptor: Display not implemented for object type %s\n",
+                    acpi_ut_get_object_type_name(obj_desc));
                break;
        }
 
        return_VOID;
 }
 
-#endif  /*  ACPI_FUTURE_USAGE  */
+#endif                         /*  ACPI_FUTURE_USAGE  */
 #endif
-
index 22c8fa480f60f6669a48bebbeb1b2765f32034ee..ab1ba399aa283bfbe18070cdfd61fc98474f2583 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exfield")
-
+ACPI_MODULE_NAME("exfield")
 
 /*******************************************************************************
  *
  *              Buffer, depending on the size of the field.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_read_data_from_field (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **ret_buffer_desc)
+acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
+                            union acpi_operand_object *obj_desc,
+                            union acpi_operand_object **ret_buffer_desc)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *buffer_desc;
-       acpi_size                       length;
-       void                            *buffer;
-       u8                              locked;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_read_data_from_field", obj_desc);
+       acpi_status status;
+       union acpi_operand_object *buffer_desc;
+       acpi_size length;
+       void *buffer;
+       u8 locked;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc);
 
        /* Parameter validation */
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
+       }
+       if (!ret_buffer_desc) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
                /*
                 * If the buffer_field arguments have not been previously evaluated,
                 * evaluate them now and save the results.
                 */
                if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-                       status = acpi_ds_get_buffer_field_arguments (obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_get_buffer_field_arguments(obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
-       }
-       else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
-                        (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
+       } else
+           if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
+               && (obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_SMBUS)) {
                /*
                 * This is an SMBus read.  We must create a buffer to hold the data
                 * and directly access the region handler.
                 */
-               buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
+               buffer_desc =
+                   acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
                if (!buffer_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Lock entire transaction if requested */
 
-               locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+               locked =
+                   acpi_ex_acquire_global_lock(obj_desc->common_field.
+                                               field_flags);
 
                /*
                 * Perform the read.
                 * Note: Smbus protocol value is passed in upper 16-bits of Function
                 */
-               status = acpi_ex_access_region (obj_desc, 0,
-                                ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
-                                ACPI_READ | (obj_desc->field.attribute << 16));
-               acpi_ex_release_global_lock (locked);
+               status = acpi_ex_access_region(obj_desc, 0,
+                                              ACPI_CAST_PTR(acpi_integer,
+                                                            buffer_desc->
+                                                            buffer.pointer),
+                                              ACPI_READ | (obj_desc->field.
+                                                           attribute << 16));
+               acpi_ex_release_global_lock(locked);
                goto exit;
        }
 
@@ -136,22 +139,22 @@ acpi_ex_read_data_from_field (
         *
         * Note: Field.length is in bits.
         */
-       length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
+       length =
+           (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
        if (length > acpi_gbl_integer_byte_width) {
                /* Field is too large for an Integer, create a Buffer instead */
 
-               buffer_desc = acpi_ut_create_buffer_object (length);
+               buffer_desc = acpi_ut_create_buffer_object(length);
                if (!buffer_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
                buffer = buffer_desc->buffer.pointer;
-       }
-       else {
+       } else {
                /* Field will fit within an Integer (normal case) */
 
-               buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!buffer_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                length = acpi_gbl_integer_byte_width;
@@ -159,37 +162,36 @@ acpi_ex_read_data_from_field (
                buffer = &buffer_desc->integer.value;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
-               obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
-               obj_desc->common_field.bit_length,
-               obj_desc->common_field.start_field_bit_offset,
-               obj_desc->common_field.base_byte_offset));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "field_read [TO]:  Obj %p, Type %X, Buf %p, byte_len %X\n",
+                         obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
+                         (u32) length));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
+                         obj_desc->common_field.bit_length,
+                         obj_desc->common_field.start_field_bit_offset,
+                         obj_desc->common_field.base_byte_offset));
 
        /* Lock entire transaction if requested */
 
-       locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+       locked =
+           acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
 
        /* Read from the field */
 
-       status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length);
-       acpi_ex_release_global_lock (locked);
+       status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length);
+       acpi_ex_release_global_lock(locked);
 
-
-exit:
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (buffer_desc);
-       }
-       else if (ret_buffer_desc) {
+      exit:
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(buffer_desc);
+       } else {
                *ret_buffer_desc = buffer_desc;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_write_data_to_field
@@ -205,97 +207,96 @@ exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ex_write_data_to_field (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc)
+acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
+                           union acpi_operand_object *obj_desc,
+                           union acpi_operand_object **result_desc)
 {
-       acpi_status                     status;
-       u32                             length;
-       u32                             required_length;
-       void                            *buffer;
-       void                            *new_buffer;
-       u8                              locked;
-       union acpi_operand_object       *buffer_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_write_data_to_field", obj_desc);
+       acpi_status status;
+       u32 length;
+       u32 required_length;
+       void *buffer;
+       void *new_buffer;
+       u8 locked;
+       union acpi_operand_object *buffer_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc);
 
        /* Parameter validation */
 
        if (!source_desc || !obj_desc) {
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
                /*
                 * If the buffer_field arguments have not been previously evaluated,
                 * evaluate them now and save the results.
                 */
                if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-                       status = acpi_ds_get_buffer_field_arguments (obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_get_buffer_field_arguments(obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
-       }
-       else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
-                        (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
+       } else
+           if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
+               && (obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_SMBUS)) {
                /*
                 * This is an SMBus write.  We will bypass the entire field mechanism
                 * and handoff the buffer directly to the handler.
                 *
                 * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
                 */
-               if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
-                       ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
+               if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
+                       ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc)));
 
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
-                       ACPI_REPORT_ERROR ((
-                               "SMBus write requires Buffer of length %X, found length %X\n",
-                               ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
+                       ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
 
-                       return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+                       return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
                }
 
-               buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
+               buffer_desc =
+                   acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
                if (!buffer_desc) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                buffer = buffer_desc->buffer.pointer;
-               ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
-                       ACPI_SMBUS_BUFFER_SIZE);
+               ACPI_MEMCPY(buffer, source_desc->buffer.pointer,
+                           ACPI_SMBUS_BUFFER_SIZE);
 
                /* Lock entire transaction if requested */
 
-               locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+               locked =
+                   acpi_ex_acquire_global_lock(obj_desc->common_field.
+                                               field_flags);
 
                /*
                 * Perform the write (returns status and perhaps data in the
                 * same buffer)
                 * Note: SMBus protocol type is passed in upper 16-bits of Function.
                 */
-               status = acpi_ex_access_region (obj_desc, 0,
-                                 (acpi_integer *) buffer,
-                                 ACPI_WRITE | (obj_desc->field.attribute << 16));
-               acpi_ex_release_global_lock (locked);
+               status = acpi_ex_access_region(obj_desc, 0,
+                                              (acpi_integer *) buffer,
+                                              ACPI_WRITE | (obj_desc->field.
+                                                            attribute << 16));
+               acpi_ex_release_global_lock(locked);
 
                *result_desc = buffer_desc;
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Get a pointer to the data to be written */
 
-       switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
        case ACPI_TYPE_INTEGER:
                buffer = &source_desc->integer.value;
-               length = sizeof (source_desc->integer.value);
+               length = sizeof(source_desc->integer.value);
                break;
 
        case ACPI_TYPE_BUFFER:
@@ -309,7 +310,7 @@ acpi_ex_write_data_to_field (
                break;
 
        default:
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /*
@@ -319,15 +320,15 @@ acpi_ex_write_data_to_field (
         * the ACPI specification.
         */
        new_buffer = NULL;
-       required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
-                          obj_desc->common_field.bit_length);
+       required_length =
+           ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
 
        if (length < required_length) {
                /* We need to create a new buffer */
 
-               new_buffer = ACPI_MEM_CALLOCATE (required_length);
+               new_buffer = ACPI_MEM_CALLOCATE(required_length);
                if (!new_buffer) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /*
@@ -335,40 +336,42 @@ acpi_ex_write_data_to_field (
                 * at Byte zero.  All unused (upper) bytes of the
                 * buffer will be 0.
                 */
-               ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length);
+               ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length);
                buffer = new_buffer;
                length = required_length;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
-               source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
-               ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
-               obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
-               ACPI_GET_OBJECT_TYPE (obj_desc),
-               obj_desc->common_field.bit_length,
-               obj_desc->common_field.start_field_bit_offset,
-               obj_desc->common_field.base_byte_offset));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
+                         source_desc,
+                         acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
+                                               (source_desc)),
+                         ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
+
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "field_write [TO]:  Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
+                         obj_desc,
+                         acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
+                         ACPI_GET_OBJECT_TYPE(obj_desc),
+                         obj_desc->common_field.bit_length,
+                         obj_desc->common_field.start_field_bit_offset,
+                         obj_desc->common_field.base_byte_offset));
 
        /* Lock entire transaction if requested */
 
-       locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
+       locked =
+           acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
 
        /* Write to the field */
 
-       status = acpi_ex_insert_into_field (obj_desc, buffer, length);
-       acpi_ex_release_global_lock (locked);
+       status = acpi_ex_insert_into_field(obj_desc, buffer, length);
+       acpi_ex_release_global_lock(locked);
 
        /* Free temporary buffer if we used one */
 
        if (new_buffer) {
-               ACPI_MEM_FREE (new_buffer);
+               ACPI_MEM_FREE(new_buffer);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 3c2f89e00f786a303c130bf9b19f33376499cd7a..ba6e08843c29894ee749c3f88ee6be3217ee2eab 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acevents.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exfldio")
+ACPI_MODULE_NAME("exfldio")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_field_datum_io (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset,
-       acpi_integer                    *value,
-       u32                             read_write);
+acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
+                      u32 field_datum_byte_offset,
+                      acpi_integer * value, u32 read_write);
 
 static u8
-acpi_ex_register_overflow (
-       union acpi_operand_object       *obj_desc,
-       acpi_integer                    value);
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
+                         acpi_integer value);
 
 static acpi_status
-acpi_ex_setup_region (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset);
-
+acpi_ex_setup_region(union acpi_operand_object *obj_desc,
+                    u32 field_datum_byte_offset);
 
 /*******************************************************************************
  *
@@ -89,27 +81,25 @@ acpi_ex_setup_region (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_setup_region (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset)
+acpi_ex_setup_region(union acpi_operand_object *obj_desc,
+                    u32 field_datum_byte_offset)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *rgn_desc;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ex_setup_region", field_datum_byte_offset);
+       acpi_status status = AE_OK;
+       union acpi_operand_object *rgn_desc;
 
+       ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset);
 
        rgn_desc = obj_desc->common_field.region_obj;
 
        /* We must have a valid region */
 
-       if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
-                       ACPI_GET_OBJECT_TYPE (rgn_desc),
-                       acpi_ut_get_object_type_name (rgn_desc)));
+       if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Needed Region, found type %X (%s)\n",
+                                 ACPI_GET_OBJECT_TYPE(rgn_desc),
+                                 acpi_ut_get_object_type_name(rgn_desc)));
 
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /*
@@ -117,26 +107,25 @@ acpi_ex_setup_region (
         * evaluate them now and save the results.
         */
        if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) {
-               status = acpi_ds_get_region_arguments (rgn_desc);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ds_get_region_arguments(rgn_desc);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
                /* SMBus has a non-linear address space */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
-
 #ifdef ACPI_UNDER_DEVELOPMENT
        /*
         * If the Field access is any_acc, we can now compute the optimal
         * access (because we know know the length of the parent region)
         */
        if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 #endif
@@ -147,56 +136,64 @@ acpi_ex_setup_region (
         * (Region length is specified in bytes)
         */
        if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
-                          field_datum_byte_offset +
-                          obj_desc->common_field.access_byte_width)) {
+                                      field_datum_byte_offset +
+                                      obj_desc->common_field.
+                                      access_byte_width)) {
                if (acpi_gbl_enable_interpreter_slack) {
                        /*
                         * Slack mode only:  We will go ahead and allow access to this
                         * field if it is within the region length rounded up to the next
                         * access width boundary.
                         */
-                       if (ACPI_ROUND_UP (rgn_desc->region.length,
-                                          obj_desc->common_field.access_byte_width) >=
-                               (obj_desc->common_field.base_byte_offset +
-                                (acpi_native_uint) obj_desc->common_field.access_byte_width +
-                                field_datum_byte_offset)) {
-                               return_ACPI_STATUS (AE_OK);
+                       if (ACPI_ROUND_UP(rgn_desc->region.length,
+                                         obj_desc->common_field.
+                                         access_byte_width) >=
+                           (obj_desc->common_field.base_byte_offset +
+                            (acpi_native_uint) obj_desc->common_field.
+                            access_byte_width + field_datum_byte_offset)) {
+                               return_ACPI_STATUS(AE_OK);
                        }
                }
 
-               if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) {
+               if (rgn_desc->region.length <
+                   obj_desc->common_field.access_byte_width) {
                        /*
                         * This is the case where the access_type (acc_word, etc.) is wider
                         * than the region itself.  For example, a region of length one
                         * byte, and a field with Dword access specified.
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
-                               acpi_ut_get_node_name (obj_desc->common_field.node),
-                               obj_desc->common_field.access_byte_width,
-                               acpi_ut_get_node_name (rgn_desc->region.node),
-                               rgn_desc->region.length));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+                                         acpi_ut_get_node_name(obj_desc->
+                                                               common_field.
+                                                               node),
+                                         obj_desc->common_field.
+                                         access_byte_width,
+                                         acpi_ut_get_node_name(rgn_desc->
+                                                               region.node),
+                                         rgn_desc->region.length));
                }
 
                /*
                 * Offset rounded up to next multiple of field width
                 * exceeds region length, indicate an error
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
-                       acpi_ut_get_node_name (obj_desc->common_field.node),
-                       obj_desc->common_field.base_byte_offset,
-                       field_datum_byte_offset, obj_desc->common_field.access_byte_width,
-                       acpi_ut_get_node_name (rgn_desc->region.node),
-                       rgn_desc->region.length));
-
-               return_ACPI_STATUS (AE_AML_REGION_LIMIT);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+                                 acpi_ut_get_node_name(obj_desc->common_field.
+                                                       node),
+                                 obj_desc->common_field.base_byte_offset,
+                                 field_datum_byte_offset,
+                                 obj_desc->common_field.access_byte_width,
+                                 acpi_ut_get_node_name(rgn_desc->region.node),
+                                 rgn_desc->region.length));
+
+               return_ACPI_STATUS(AE_AML_REGION_LIMIT);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_access_region
@@ -216,27 +213,23 @@ acpi_ex_setup_region (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_access_region (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset,
-       acpi_integer                    *value,
-       u32                             function)
+acpi_ex_access_region(union acpi_operand_object *obj_desc,
+                     u32 field_datum_byte_offset,
+                     acpi_integer * value, u32 function)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *rgn_desc;
-       acpi_physical_address           address;
-
-
-       ACPI_FUNCTION_TRACE ("ex_access_region");
+       acpi_status status;
+       union acpi_operand_object *rgn_desc;
+       acpi_physical_address address;
 
+       ACPI_FUNCTION_TRACE("ex_access_region");
 
        /*
         * Ensure that the region operands are fully evaluated and verify
         * the validity of the request
         */
-       status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_setup_region(obj_desc, field_datum_byte_offset);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -248,50 +241,53 @@ acpi_ex_access_region (
         */
        rgn_desc = obj_desc->common_field.region_obj;
        address = rgn_desc->region.address +
-                        obj_desc->common_field.base_byte_offset +
-                        field_datum_byte_offset;
+           obj_desc->common_field.base_byte_offset + field_datum_byte_offset;
 
        if ((function & ACPI_IO_MASK) == ACPI_READ) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]"));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]"));
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
-               " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
-               acpi_ut_get_region_name (rgn_desc->region.space_id),
-               rgn_desc->region.space_id,
-               obj_desc->common_field.access_byte_width,
-               obj_desc->common_field.base_byte_offset,
-               field_datum_byte_offset,
-               ACPI_FORMAT_UINT64 (address)));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
+                             " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
+                             acpi_ut_get_region_name(rgn_desc->region.
+                                                     space_id),
+                             rgn_desc->region.space_id,
+                             obj_desc->common_field.access_byte_width,
+                             obj_desc->common_field.base_byte_offset,
+                             field_datum_byte_offset,
+                             ACPI_FORMAT_UINT64(address)));
 
        /* Invoke the appropriate address_space/op_region handler */
 
-       status = acpi_ev_address_space_dispatch (rgn_desc, function,
-                        address,
-                        ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
+       status = acpi_ev_address_space_dispatch(rgn_desc, function,
+                                               address,
+                                               ACPI_MUL_8(obj_desc->
+                                                          common_field.
+                                                          access_byte_width),
+                                               value);
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                if (status == AE_NOT_IMPLEMENTED) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Region %s(%X) not implemented\n",
-                               acpi_ut_get_region_name (rgn_desc->region.space_id),
-                               rgn_desc->region.space_id));
-               }
-               else if (status == AE_NOT_EXIST) {
-                       ACPI_REPORT_ERROR ((
-                               "Region %s(%X) has no handler\n",
-                               acpi_ut_get_region_name (rgn_desc->region.space_id),
-                               rgn_desc->region.space_id));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Region %s(%X) not implemented\n",
+                                         acpi_ut_get_region_name(rgn_desc->
+                                                                 region.
+                                                                 space_id),
+                                         rgn_desc->region.space_id));
+               } else if (status == AE_NOT_EXIST) {
+                       ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n",
+                                          acpi_ut_get_region_name(rgn_desc->
+                                                                  region.
+                                                                  space_id),
+                                          rgn_desc->region.space_id));
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_register_overflow
@@ -310,9 +306,8 @@ acpi_ex_access_region (
  ******************************************************************************/
 
 static u8
-acpi_ex_register_overflow (
-       union acpi_operand_object       *obj_desc,
-       acpi_integer                    value)
+acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
+                         acpi_integer value)
 {
 
        if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
@@ -336,7 +331,6 @@ acpi_ex_register_overflow (
        return (FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_field_datum_io
@@ -356,18 +350,14 @@ acpi_ex_register_overflow (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_field_datum_io (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset,
-       acpi_integer                    *value,
-       u32                             read_write)
+acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
+                      u32 field_datum_byte_offset,
+                      acpi_integer * value, u32 read_write)
 {
-       acpi_status                     status;
-       acpi_integer                    local_value;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset);
+       acpi_status status;
+       acpi_integer local_value;
 
+       ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset);
 
        if (read_write == ACPI_READ) {
                if (!value) {
@@ -392,16 +382,16 @@ acpi_ex_field_datum_io (
         * index_field - Write to an Index Register, then read/write from/to a
         *               Data Register
         */
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_BUFFER_FIELD:
                /*
                 * If the buffer_field arguments have not been previously evaluated,
                 * evaluate them now and save the results.
                 */
                if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
-                       status = acpi_ds_get_buffer_field_arguments (obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_get_buffer_field_arguments(obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
 
@@ -410,47 +400,50 @@ acpi_ex_field_datum_io (
                         * Copy the data from the source buffer.
                         * Length is the field width in bytes.
                         */
-                       ACPI_MEMCPY (value,
-                               (obj_desc->buffer_field.buffer_obj)->buffer.pointer +
-                                       obj_desc->buffer_field.base_byte_offset +
-                                       field_datum_byte_offset,
-                               obj_desc->common_field.access_byte_width);
-               }
-               else {
+                       ACPI_MEMCPY(value,
+                                   (obj_desc->buffer_field.buffer_obj)->buffer.
+                                   pointer +
+                                   obj_desc->buffer_field.base_byte_offset +
+                                   field_datum_byte_offset,
+                                   obj_desc->common_field.access_byte_width);
+               else {
                        /*
                         * Copy the data to the target buffer.
                         * Length is the field width in bytes.
                         */
-                       ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
-                                       obj_desc->buffer_field.base_byte_offset +
-                                       field_datum_byte_offset,
-                                       value, obj_desc->common_field.access_byte_width);
+                       ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer.
+                                   pointer +
+                                   obj_desc->buffer_field.base_byte_offset +
+                                   field_datum_byte_offset, value,
+                                   obj_desc->common_field.access_byte_width);
                }
 
                status = AE_OK;
                break;
 
-
        case ACPI_TYPE_LOCAL_BANK_FIELD:
 
                /*
                 * Ensure that the bank_value is not beyond the capacity of
                 * the register
                 */
-               if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
-                                 (acpi_integer) obj_desc->bank_field.value)) {
-                       return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+               if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
+                                             (acpi_integer) obj_desc->
+                                             bank_field.value)) {
+                       return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
                }
 
                /*
                 * For bank_fields, we must write the bank_value to the bank_register
                 * (itself a region_field) before we can access the data.
                 */
-               status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj,
-                                &obj_desc->bank_field.value,
-                                sizeof (obj_desc->bank_field.value));
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj,
+                                             &obj_desc->bank_field.value,
+                                             sizeof(obj_desc->bank_field.
+                                                    value));
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /*
@@ -460,90 +453,92 @@ acpi_ex_field_datum_io (
 
                /*lint -fallthrough */
 
-
        case ACPI_TYPE_LOCAL_REGION_FIELD:
                /*
                 * For simple region_fields, we just directly access the owning
                 * Operation Region.
                 */
-               status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,
-                                 read_write);
+               status =
+                   acpi_ex_access_region(obj_desc, field_datum_byte_offset,
+                                         value, read_write);
                break;
 
-
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-
                /*
                 * Ensure that the index_value is not beyond the capacity of
                 * the register
                 */
-               if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
-                                 (acpi_integer) obj_desc->index_field.value)) {
-                       return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
+               if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
+                                             (acpi_integer) obj_desc->
+                                             index_field.value)) {
+                       return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
                }
 
                /* Write the index value to the index_register (itself a region_field) */
 
                field_datum_byte_offset += obj_desc->index_field.value;
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                               "Write to Index Register: Value %8.8X\n",
-                               field_datum_byte_offset));
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                 "Write to Index Register: Value %8.8X\n",
+                                 field_datum_byte_offset));
 
-               status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
-                                &field_datum_byte_offset,
-                                sizeof (field_datum_byte_offset));
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_insert_into_field(obj_desc->index_field.index_obj,
+                                             &field_datum_byte_offset,
+                                             sizeof(field_datum_byte_offset));
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                               "I/O to Data Register: value_ptr %p\n",
-                               value));
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                 "I/O to Data Register: value_ptr %p\n",
+                                 value));
 
                if (read_write == ACPI_READ) {
                        /* Read the datum from the data_register */
 
-                       status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
-                                         value, sizeof (acpi_integer));
-               }
-               else {
+                       status =
+                           acpi_ex_extract_from_field(obj_desc->index_field.
+                                                      data_obj, value,
+                                                      sizeof(acpi_integer));
+               } else {
                        /* Write the datum to the data_register */
 
-                       status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
-                                         value, sizeof (acpi_integer));
+                       status =
+                           acpi_ex_insert_into_field(obj_desc->index_field.
+                                                     data_obj, value,
+                                                     sizeof(acpi_integer));
                }
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",
-                       ACPI_GET_OBJECT_TYPE (obj_desc)));
+               ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n",
+                                  ACPI_GET_OBJECT_TYPE(obj_desc)));
                status = AE_AML_INTERNAL;
                break;
        }
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                if (read_write == ACPI_READ) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                               "Value Read %8.8X%8.8X, Width %d\n",
-                               ACPI_FORMAT_UINT64 (*value),
-                               obj_desc->common_field.access_byte_width));
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                               "Value Written %8.8X%8.8X, Width %d\n",
-                               ACPI_FORMAT_UINT64 (*value),
-                               obj_desc->common_field.access_byte_width));
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Value Read %8.8X%8.8X, Width %d\n",
+                                         ACPI_FORMAT_UINT64(*value),
+                                         obj_desc->common_field.
+                                         access_byte_width));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Value Written %8.8X%8.8X, Width %d\n",
+                                         ACPI_FORMAT_UINT64(*value),
+                                         obj_desc->common_field.
+                                         access_byte_width));
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_write_with_update_rule
@@ -560,19 +555,16 @@ acpi_ex_field_datum_io (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_write_with_update_rule (
-       union acpi_operand_object       *obj_desc,
-       acpi_integer                    mask,
-       acpi_integer                    field_value,
-       u32                             field_datum_byte_offset)
+acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
+                              acpi_integer mask,
+                              acpi_integer field_value,
+                              u32 field_datum_byte_offset)
 {
-       acpi_status                     status = AE_OK;
-       acpi_integer                    merged_value;
-       acpi_integer                    current_value;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ex_write_with_update_rule", mask);
+       acpi_status status = AE_OK;
+       acpi_integer merged_value;
+       acpi_integer current_value;
 
+       ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
 
        /* Start with the new bits  */
 
@@ -583,22 +575,27 @@ acpi_ex_write_with_update_rule (
        if (mask != ACPI_INTEGER_MAX) {
                /* Decode the update rule */
 
-               switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) {
+               switch (obj_desc->common_field.
+                       field_flags & AML_FIELD_UPDATE_RULE_MASK) {
                case AML_FIELD_UPDATE_PRESERVE:
                        /*
                         * Check if update rule needs to be applied (not if mask is all
                         * ones)  The left shift drops the bits we want to ignore.
                         */
-                       if ((~mask << (ACPI_MUL_8 (sizeof (mask)) -
-                                        ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) {
+                       if ((~mask << (ACPI_MUL_8(sizeof(mask)) -
+                                      ACPI_MUL_8(obj_desc->common_field.
+                                                 access_byte_width))) != 0) {
                                /*
                                 * Read the current contents of the byte/word/dword containing
                                 * the field, and merge with the new field value.
                                 */
-                               status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
-                                                 &current_value, ACPI_READ);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                               status =
+                                   acpi_ex_field_datum_io(obj_desc,
+                                                          field_datum_byte_offset,
+                                                          &current_value,
+                                                          ACPI_READ);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
                                }
 
                                merged_value |= (current_value & ~mask);
@@ -621,30 +618,31 @@ acpi_ex_write_with_update_rule (
 
                default:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "write_with_update_rule: Unknown update_rule setting: %X\n",
-                               (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "write_with_update_rule: Unknown update_rule setting: %X\n",
+                                         (obj_desc->common_field.
+                                          field_flags &
+                                          AML_FIELD_UPDATE_RULE_MASK)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-               "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (mask),
-               field_datum_byte_offset,
-               obj_desc->common_field.access_byte_width,
-               ACPI_FORMAT_UINT64 (field_value),
-               ACPI_FORMAT_UINT64 (merged_value)));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
+                         ACPI_FORMAT_UINT64(mask),
+                         field_datum_byte_offset,
+                         obj_desc->common_field.access_byte_width,
+                         ACPI_FORMAT_UINT64(field_value),
+                         ACPI_FORMAT_UINT64(merged_value)));
 
        /* Write the merged value */
 
-       status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
-                         &merged_value, ACPI_WRITE);
+       status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset,
+                                       &merged_value, ACPI_WRITE);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_extract_from_field
@@ -660,54 +658,54 @@ acpi_ex_write_with_update_rule (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_extract_from_field (
-       union acpi_operand_object       *obj_desc,
-       void                            *buffer,
-       u32                             buffer_length)
+acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
+                          void *buffer, u32 buffer_length)
 {
-       acpi_status                     status;
-       acpi_integer                    raw_datum;
-       acpi_integer                    merged_datum;
-       u32                             field_offset = 0;
-       u32                             buffer_offset = 0;
-       u32                             buffer_tail_bits;
-       u32                             datum_count;
-       u32                             field_datum_count;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ex_extract_from_field");
-
+       acpi_status status;
+       acpi_integer raw_datum;
+       acpi_integer merged_datum;
+       u32 field_offset = 0;
+       u32 buffer_offset = 0;
+       u32 buffer_tail_bits;
+       u32 datum_count;
+       u32 field_datum_count;
+       u32 i;
+
+       ACPI_FUNCTION_TRACE("ex_extract_from_field");
 
        /* Validate target buffer and clear it */
 
-       if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
-                        obj_desc->common_field.bit_length)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Field size %X (bits) is too large for buffer (%X)\n",
-                       obj_desc->common_field.bit_length, buffer_length));
+       if (buffer_length <
+           ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Field size %X (bits) is too large for buffer (%X)\n",
+                                 obj_desc->common_field.bit_length,
+                                 buffer_length));
 
-               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
        }
-       ACPI_MEMSET (buffer, 0, buffer_length);
+       ACPI_MEMSET(buffer, 0, buffer_length);
 
        /* Compute the number of datums (access width data items) */
 
-       datum_count = ACPI_ROUND_UP_TO (
-                          obj_desc->common_field.bit_length,
-                          obj_desc->common_field.access_bit_width);
-       field_datum_count = ACPI_ROUND_UP_TO (
-                          obj_desc->common_field.bit_length +
-                          obj_desc->common_field.start_field_bit_offset,
-                          obj_desc->common_field.access_bit_width);
+       datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
+                                      obj_desc->common_field.access_bit_width);
+       field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
+                                            obj_desc->common_field.
+                                            start_field_bit_offset,
+                                            obj_desc->common_field.
+                                            access_bit_width);
 
        /* Priming read from the field */
 
-       status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum,
+                                  ACPI_READ);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
-       merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
+       merged_datum =
+           raw_datum >> obj_desc->common_field.start_field_bit_offset;
 
        /* Read the rest of the field */
 
@@ -715,17 +713,17 @@ acpi_ex_extract_from_field (
                /* Get next input datum from the field */
 
                field_offset += obj_desc->common_field.access_byte_width;
-               status = acpi_ex_field_datum_io (obj_desc, field_offset,
-                                 &raw_datum, ACPI_READ);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_field_datum_io(obj_desc, field_offset,
+                                               &raw_datum, ACPI_READ);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Merge with previous datum if necessary */
 
                merged_datum |= raw_datum <<
-                       (obj_desc->common_field.access_bit_width -
-                               obj_desc->common_field.start_field_bit_offset);
+                   (obj_desc->common_field.access_bit_width -
+                    obj_desc->common_field.start_field_bit_offset);
 
                if (i == datum_count) {
                        break;
@@ -733,32 +731,32 @@ acpi_ex_extract_from_field (
 
                /* Write merged datum to target buffer */
 
-               ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum,
-                       ACPI_MIN(obj_desc->common_field.access_byte_width,
-                                        buffer_length - buffer_offset));
+               ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
+                           ACPI_MIN(obj_desc->common_field.access_byte_width,
+                                    buffer_length - buffer_offset));
 
                buffer_offset += obj_desc->common_field.access_byte_width;
-               merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
+               merged_datum =
+                   raw_datum >> obj_desc->common_field.start_field_bit_offset;
        }
 
        /* Mask off any extra bits in the last datum */
 
        buffer_tail_bits = obj_desc->common_field.bit_length %
-                          obj_desc->common_field.access_bit_width;
+           obj_desc->common_field.access_bit_width;
        if (buffer_tail_bits) {
-               merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
+               merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
        }
 
        /* Write the last datum to the buffer */
 
-       ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum,
-               ACPI_MIN(obj_desc->common_field.access_byte_width,
-                                buffer_length - buffer_offset));
+       ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
+                   ACPI_MIN(obj_desc->common_field.access_byte_width,
+                            buffer_length - buffer_offset));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_insert_into_field
@@ -774,53 +772,54 @@ acpi_ex_extract_from_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_insert_into_field (
-       union acpi_operand_object       *obj_desc,
-       void                            *buffer,
-       u32                             buffer_length)
+acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
+                         void *buffer, u32 buffer_length)
 {
-       acpi_status                     status;
-       acpi_integer                    mask;
-       acpi_integer                    merged_datum;
-       acpi_integer                    raw_datum = 0;
-       u32                             field_offset = 0;
-       u32                             buffer_offset = 0;
-       u32                             buffer_tail_bits;
-       u32                             datum_count;
-       u32                             field_datum_count;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ex_insert_into_field");
-
+       acpi_status status;
+       acpi_integer mask;
+       acpi_integer merged_datum;
+       acpi_integer raw_datum = 0;
+       u32 field_offset = 0;
+       u32 buffer_offset = 0;
+       u32 buffer_tail_bits;
+       u32 datum_count;
+       u32 field_datum_count;
+       u32 i;
+
+       ACPI_FUNCTION_TRACE("ex_insert_into_field");
 
        /* Validate input buffer */
 
-       if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
-                        obj_desc->common_field.bit_length)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Field size %X (bits) is too large for buffer (%X)\n",
-                       obj_desc->common_field.bit_length, buffer_length));
+       if (buffer_length <
+           ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Field size %X (bits) is too large for buffer (%X)\n",
+                                 obj_desc->common_field.bit_length,
+                                 buffer_length));
 
-               return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+               return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
        }
 
        /* Compute the number of datums (access width data items) */
 
-       mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
-       datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length,
-                         obj_desc->common_field.access_bit_width);
-       field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length +
-                          obj_desc->common_field.start_field_bit_offset,
-                          obj_desc->common_field.access_bit_width);
+       mask =
+           ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
+       datum_count =
+           ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
+                            obj_desc->common_field.access_bit_width);
+       field_datum_count =
+           ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
+                            obj_desc->common_field.start_field_bit_offset,
+                            obj_desc->common_field.access_bit_width);
 
        /* Get initial Datum from the input buffer */
 
-       ACPI_MEMCPY (&raw_datum, buffer,
-               ACPI_MIN(obj_desc->common_field.access_byte_width,
-                                buffer_length - buffer_offset));
+       ACPI_MEMCPY(&raw_datum, buffer,
+                   ACPI_MIN(obj_desc->common_field.access_byte_width,
+                            buffer_length - buffer_offset));
 
-       merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset;
+       merged_datum =
+           raw_datum << obj_desc->common_field.start_field_bit_offset;
 
        /* Write the entire field */
 
@@ -828,18 +827,19 @@ acpi_ex_insert_into_field (
                /* Write merged datum to the target field */
 
                merged_datum &= mask;
-               status = acpi_ex_write_with_update_rule (obj_desc, mask,
-                                merged_datum, field_offset);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_write_with_update_rule(obj_desc, mask,
+                                                       merged_datum,
+                                                       field_offset);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Start new output datum by merging with previous input datum */
 
                field_offset += obj_desc->common_field.access_byte_width;
                merged_datum = raw_datum >>
-                       (obj_desc->common_field.access_bit_width -
-                               obj_desc->common_field.start_field_bit_offset);
+                   (obj_desc->common_field.access_bit_width -
+                    obj_desc->common_field.start_field_bit_offset);
                mask = ACPI_INTEGER_MAX;
 
                if (i == datum_count) {
@@ -849,28 +849,28 @@ acpi_ex_insert_into_field (
                /* Get the next input datum from the buffer */
 
                buffer_offset += obj_desc->common_field.access_byte_width;
-               ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset,
-                       ACPI_MIN(obj_desc->common_field.access_byte_width,
-                                        buffer_length - buffer_offset));
-               merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset;
+               ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
+                           ACPI_MIN(obj_desc->common_field.access_byte_width,
+                                    buffer_length - buffer_offset));
+               merged_datum |=
+                   raw_datum << obj_desc->common_field.start_field_bit_offset;
        }
 
        /* Mask off any extra bits in the last datum */
 
        buffer_tail_bits = (obj_desc->common_field.bit_length +
-                       obj_desc->common_field.start_field_bit_offset) %
-                               obj_desc->common_field.access_bit_width;
+                           obj_desc->common_field.start_field_bit_offset) %
+           obj_desc->common_field.access_bit_width;
        if (buffer_tail_bits) {
-               mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
+               mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
        }
 
        /* Write the last datum to the field */
 
        merged_datum &= mask;
-       status = acpi_ex_write_with_update_rule (obj_desc,
-                        mask, merged_datum, field_offset);
+       status = acpi_ex_write_with_update_rule(obj_desc,
+                                               mask, merged_datum,
+                                               field_offset);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 022f281345b856fbfd8dd4ffb346aca6e8094ba4..a3f4d72bedc979b45c77e3b86516b08d763bc7e2 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exmisc")
-
+ACPI_MODULE_NAME("exmisc")
 
 /*******************************************************************************
  *
  *              Common code for the ref_of_op and the cond_ref_of_op.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_get_object_reference (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **return_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
+                            union acpi_operand_object **return_desc,
+                            struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *reference_obj;
-       union acpi_operand_object       *referenced_obj;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc);
+       union acpi_operand_object *reference_obj;
+       union acpi_operand_object *referenced_obj;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
 
        *return_desc = NULL;
 
-       switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+       switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
        case ACPI_DESC_TYPE_OPERAND:
 
-               if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /*
@@ -104,13 +97,11 @@ acpi_ex_get_object_reference (
 
                default:
 
-                       ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n",
-                               obj_desc->reference.opcode));
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
+                       ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode));
+                       return_ACPI_STATUS(AE_AML_INTERNAL);
                }
                break;
 
-
        case ACPI_DESC_TYPE_NAMED:
 
                /*
@@ -119,34 +110,32 @@ acpi_ex_get_object_reference (
                referenced_obj = obj_desc;
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n",
-                               ACPI_GET_DESCRIPTOR_TYPE (obj_desc)));
-               return_ACPI_STATUS (AE_TYPE);
+               ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
+               return_ACPI_STATUS(AE_TYPE);
        }
 
-
        /* Create a new reference object */
 
-       reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+       reference_obj =
+           acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
        if (!reference_obj) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        reference_obj->reference.opcode = AML_REF_OF_OP;
        reference_obj->reference.object = referenced_obj;
        *return_desc = reference_obj;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "Object %p Type [%s], returning Reference %p\n",
-               obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Object %p Type [%s], returning Reference %p\n",
+                         obj_desc, acpi_ut_get_object_type_name(obj_desc),
+                         *return_desc));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_concat_template
@@ -163,63 +152,58 @@ acpi_ex_get_object_reference (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_concat_template (
-       union acpi_operand_object       *operand0,
-       union acpi_operand_object       *operand1,
-       union acpi_operand_object       **actual_return_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_concat_template(union acpi_operand_object *operand0,
+                       union acpi_operand_object *operand1,
+                       union acpi_operand_object **actual_return_desc,
+                       struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *return_desc;
-       u8                              *new_buf;
-       u8                              *end_tag1;
-       u8                              *end_tag2;
-       acpi_size                       length1;
-       acpi_size                       length2;
-
-
-       ACPI_FUNCTION_TRACE ("ex_concat_template");
+       union acpi_operand_object *return_desc;
+       u8 *new_buf;
+       u8 *end_tag1;
+       u8 *end_tag2;
+       acpi_size length1;
+       acpi_size length2;
 
+       ACPI_FUNCTION_TRACE("ex_concat_template");
 
        /* Find the end_tags in each resource template */
 
-       end_tag1 = acpi_ut_get_resource_end_tag (operand0);
-       end_tag2 = acpi_ut_get_resource_end_tag (operand1);
+       end_tag1 = acpi_ut_get_resource_end_tag(operand0);
+       end_tag2 = acpi_ut_get_resource_end_tag(operand1);
        if (!end_tag1 || !end_tag2) {
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /* Compute the length of each part */
 
-       length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer);
-       length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) +
-                         2; /* Size of END_TAG */
+       length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
+       length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2;        /* Size of END_TAG */
 
        /* Create a new buffer object for the result */
 
-       return_desc = acpi_ut_create_buffer_object (length1 + length2);
+       return_desc = acpi_ut_create_buffer_object(length1 + length2);
        if (!return_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Copy the templates to the new descriptor */
 
        new_buf = return_desc->buffer.pointer;
-       ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1);
-       ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2);
+       ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1);
+       ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2);
 
        /* Compute the new checksum */
 
        new_buf[return_desc->buffer.length - 1] =
-                       acpi_ut_generate_checksum (return_desc->buffer.pointer,
-                                          (return_desc->buffer.length - 1));
+           acpi_ut_generate_checksum(return_desc->buffer.pointer,
+                                     (return_desc->buffer.length - 1));
 
        /* Return the completed template descriptor */
 
        *actual_return_desc = return_desc;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_concatenate
@@ -236,21 +220,18 @@ acpi_ex_concat_template (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_concatenate (
-       union acpi_operand_object       *operand0,
-       union acpi_operand_object       *operand1,
-       union acpi_operand_object       **actual_return_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_do_concatenate(union acpi_operand_object *operand0,
+                      union acpi_operand_object *operand1,
+                      union acpi_operand_object **actual_return_desc,
+                      struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *local_operand1 = operand1;
-       union acpi_operand_object       *return_desc;
-       char                            *new_buf;
-       acpi_status                     status;
-       acpi_size                       new_length;
-
-
-       ACPI_FUNCTION_TRACE ("ex_do_concatenate");
+       union acpi_operand_object *local_operand1 = operand1;
+       union acpi_operand_object *return_desc;
+       char *new_buf;
+       acpi_status status;
+       acpi_size new_length;
 
+       ACPI_FUNCTION_TRACE("ex_do_concatenate");
 
        /*
         * Convert the second operand if necessary.  The first operand
@@ -259,27 +240,28 @@ acpi_ex_do_concatenate (
         * guaranteed to be either Integer/String/Buffer by the operand
         * resolution mechanism.
         */
-       switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+       switch (ACPI_GET_OBJECT_TYPE(operand0)) {
        case ACPI_TYPE_INTEGER:
-               status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+               status =
+                   acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
                break;
 
        case ACPI_TYPE_STRING:
-               status = acpi_ex_convert_to_string (operand1, &local_operand1,
-                                ACPI_IMPLICIT_CONVERT_HEX);
+               status = acpi_ex_convert_to_string(operand1, &local_operand1,
+                                                  ACPI_IMPLICIT_CONVERT_HEX);
                break;
 
        case ACPI_TYPE_BUFFER:
-               status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+               status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
                break;
 
        default:
-               ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
-                               ACPI_GET_OBJECT_TYPE (operand0)));
+               ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n",
+                                  ACPI_GET_OBJECT_TYPE(operand0)));
                status = AE_AML_INTERNAL;
        }
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -296,32 +278,33 @@ acpi_ex_do_concatenate (
         * 2) Two Strings concatenated to produce a new String
         * 3) Two Buffers concatenated to produce a new Buffer
         */
-       switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+       switch (ACPI_GET_OBJECT_TYPE(operand0)) {
        case ACPI_TYPE_INTEGER:
 
                /* Result of two Integers is a Buffer */
                /* Need enough buffer space for two integers */
 
-               return_desc = acpi_ut_create_buffer_object (
-                                  ACPI_MUL_2 (acpi_gbl_integer_byte_width));
+               return_desc = acpi_ut_create_buffer_object((acpi_size)
+                                                          ACPI_MUL_2
+                                                          (acpi_gbl_integer_byte_width));
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               new_buf = (char *) return_desc->buffer.pointer;
+               new_buf = (char *)return_desc->buffer.pointer;
 
                /* Copy the first integer, LSB first */
 
-               ACPI_MEMCPY (new_buf,
-                                 &operand0->integer.value,
-                                 acpi_gbl_integer_byte_width);
+               ACPI_MEMCPY(new_buf,
+                           &operand0->integer.value,
+                           acpi_gbl_integer_byte_width);
 
                /* Copy the second integer (LSB first) after the first */
 
-               ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width,
-                                 &local_operand1->integer.value,
-                                 acpi_gbl_integer_byte_width);
+               ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
+                           &local_operand1->integer.value,
+                           acpi_gbl_integer_byte_width);
                break;
 
        case ACPI_TYPE_STRING:
@@ -329,13 +312,13 @@ acpi_ex_do_concatenate (
                /* Result of two Strings is a String */
 
                new_length = (acpi_size) operand0->string.length +
-                                (acpi_size) local_operand1->string.length;
+                   (acpi_size) local_operand1->string.length;
                if (new_length > ACPI_MAX_STRING_CONVERSION) {
                        status = AE_AML_STRING_LIMIT;
                        goto cleanup;
                }
 
-               return_desc = acpi_ut_create_string_object (new_length);
+               return_desc = acpi_ut_create_string_object(new_length);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -345,56 +328,56 @@ acpi_ex_do_concatenate (
 
                /* Concatenate the strings */
 
-               ACPI_STRCPY (new_buf,
-                                 operand0->string.pointer);
-               ACPI_STRCPY (new_buf + operand0->string.length,
-                                 local_operand1->string.pointer);
+               ACPI_STRCPY(new_buf, operand0->string.pointer);
+               ACPI_STRCPY(new_buf + operand0->string.length,
+                           local_operand1->string.pointer);
                break;
 
        case ACPI_TYPE_BUFFER:
 
                /* Result of two Buffers is a Buffer */
 
-               return_desc = acpi_ut_create_buffer_object (
-                                  (acpi_size) operand0->buffer.length +
-                                  (acpi_size) local_operand1->buffer.length);
+               return_desc = acpi_ut_create_buffer_object((acpi_size)
+                                                          operand0->buffer.
+                                                          length +
+                                                          (acpi_size)
+                                                          local_operand1->
+                                                          buffer.length);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               new_buf = (char *) return_desc->buffer.pointer;
+               new_buf = (char *)return_desc->buffer.pointer;
 
                /* Concatenate the buffers */
 
-               ACPI_MEMCPY (new_buf,
-                                 operand0->buffer.pointer,
-                                 operand0->buffer.length);
-               ACPI_MEMCPY (new_buf + operand0->buffer.length,
-                                 local_operand1->buffer.pointer,
-                                 local_operand1->buffer.length);
+               ACPI_MEMCPY(new_buf,
+                           operand0->buffer.pointer, operand0->buffer.length);
+               ACPI_MEMCPY(new_buf + operand0->buffer.length,
+                           local_operand1->buffer.pointer,
+                           local_operand1->buffer.length);
                break;
 
        default:
 
                /* Invalid object type, should not happen here */
 
-               ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
-                               ACPI_GET_OBJECT_TYPE (operand0)));
-               status =AE_AML_INTERNAL;
+               ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n",
+                                  ACPI_GET_OBJECT_TYPE(operand0)));
+               status = AE_AML_INTERNAL;
                goto cleanup;
        }
 
        *actual_return_desc = return_desc;
 
-cleanup:
+      cleanup:
        if (local_operand1 != operand1) {
-               acpi_ut_remove_reference (local_operand1);
+               acpi_ut_remove_reference(local_operand1);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_math_op
@@ -412,62 +395,49 @@ cleanup:
  ******************************************************************************/
 
 acpi_integer
-acpi_ex_do_math_op (
-       u16                             opcode,
-       acpi_integer                    integer0,
-       acpi_integer                    integer1)
+acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
 {
 
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        switch (opcode) {
-       case AML_ADD_OP:                /* Add (Integer0, Integer1, Result) */
+       case AML_ADD_OP:        /* Add (Integer0, Integer1, Result) */
 
                return (integer0 + integer1);
 
-
-       case AML_BIT_AND_OP:            /* And (Integer0, Integer1, Result) */
+       case AML_BIT_AND_OP:    /* And (Integer0, Integer1, Result) */
 
                return (integer0 & integer1);
 
-
-       case AML_BIT_NAND_OP:           /* NAnd (Integer0, Integer1, Result) */
+       case AML_BIT_NAND_OP:   /* NAnd (Integer0, Integer1, Result) */
 
                return (~(integer0 & integer1));
 
-
-       case AML_BIT_OR_OP:             /* Or (Integer0, Integer1, Result) */
+       case AML_BIT_OR_OP:     /* Or (Integer0, Integer1, Result) */
 
                return (integer0 | integer1);
 
-
-       case AML_BIT_NOR_OP:            /* NOr (Integer0, Integer1, Result) */
+       case AML_BIT_NOR_OP:    /* NOr (Integer0, Integer1, Result) */
 
                return (~(integer0 | integer1));
 
-
-       case AML_BIT_XOR_OP:            /* XOr (Integer0, Integer1, Result) */
+       case AML_BIT_XOR_OP:    /* XOr (Integer0, Integer1, Result) */
 
                return (integer0 ^ integer1);
 
-
-       case AML_MULTIPLY_OP:           /* Multiply (Integer0, Integer1, Result) */
+       case AML_MULTIPLY_OP:   /* Multiply (Integer0, Integer1, Result) */
 
                return (integer0 * integer1);
 
-
-       case AML_SHIFT_LEFT_OP:         /* shift_left (Operand, shift_count, Result)*/
+       case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
 
                return (integer0 << integer1);
 
-
-       case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
+       case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
 
                return (integer0 >> integer1);
 
-
-       case AML_SUBTRACT_OP:           /* Subtract (Integer0, Integer1, Result) */
+       case AML_SUBTRACT_OP:   /* Subtract (Integer0, Integer1, Result) */
 
                return (integer0 - integer1);
 
@@ -477,7 +447,6 @@ acpi_ex_do_math_op (
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_numeric_op
@@ -499,28 +468,24 @@ acpi_ex_do_math_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_numeric_op (
-       u16                             opcode,
-       acpi_integer                    integer0,
-       acpi_integer                    integer1,
-       u8                              *logical_result)
+acpi_ex_do_logical_numeric_op(u16 opcode,
+                             acpi_integer integer0,
+                             acpi_integer integer1, u8 * logical_result)
 {
-       acpi_status                     status = AE_OK;
-       u8                              local_result = FALSE;
-
-
-       ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op");
+       acpi_status status = AE_OK;
+       u8 local_result = FALSE;
 
+       ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
 
        switch (opcode) {
-       case AML_LAND_OP:               /* LAnd (Integer0, Integer1) */
+       case AML_LAND_OP:       /* LAnd (Integer0, Integer1) */
 
                if (integer0 && integer1) {
                        local_result = TRUE;
                }
                break;
 
-       case AML_LOR_OP:                /* LOr (Integer0, Integer1) */
+       case AML_LOR_OP:        /* LOr (Integer0, Integer1) */
 
                if (integer0 || integer1) {
                        local_result = TRUE;
@@ -535,10 +500,9 @@ acpi_ex_do_logical_numeric_op (
        /* Return the logical result and status */
 
        *logical_result = local_result;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_op
@@ -566,24 +530,20 @@ acpi_ex_do_logical_numeric_op (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_op (
-       u16                             opcode,
-       union acpi_operand_object       *operand0,
-       union acpi_operand_object       *operand1,
-       u8                              *logical_result)
+acpi_ex_do_logical_op(u16 opcode,
+                     union acpi_operand_object *operand0,
+                     union acpi_operand_object *operand1, u8 * logical_result)
 {
-       union acpi_operand_object       *local_operand1 = operand1;
-       acpi_integer                    integer0;
-       acpi_integer                    integer1;
-       u32                             length0;
-       u32                             length1;
-       acpi_status                     status = AE_OK;
-       u8                              local_result = FALSE;
-       int                             compare;
-
-
-       ACPI_FUNCTION_TRACE ("ex_do_logical_op");
+       union acpi_operand_object *local_operand1 = operand1;
+       acpi_integer integer0;
+       acpi_integer integer1;
+       u32 length0;
+       u32 length1;
+       acpi_status status = AE_OK;
+       u8 local_result = FALSE;
+       int compare;
 
+       ACPI_FUNCTION_TRACE("ex_do_logical_op");
 
        /*
         * Convert the second operand if necessary.  The first operand
@@ -592,18 +552,19 @@ acpi_ex_do_logical_op (
         * guaranteed to be either Integer/String/Buffer by the operand
         * resolution mechanism.
         */
-       switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+       switch (ACPI_GET_OBJECT_TYPE(operand0)) {
        case ACPI_TYPE_INTEGER:
-               status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+               status =
+                   acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
                break;
 
        case ACPI_TYPE_STRING:
-               status = acpi_ex_convert_to_string (operand1, &local_operand1,
-                                ACPI_IMPLICIT_CONVERT_HEX);
+               status = acpi_ex_convert_to_string(operand1, &local_operand1,
+                                                  ACPI_IMPLICIT_CONVERT_HEX);
                break;
 
        case ACPI_TYPE_BUFFER:
-               status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+               status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
                break;
 
        default:
@@ -611,14 +572,14 @@ acpi_ex_do_logical_op (
                break;
        }
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /*
         * Two cases: 1) Both Integers, 2) Both Strings or Buffers
         */
-       if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) {
+       if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) {
                /*
                 * 1) Both operands are of type integer
                 *    Note: local_operand1 may have changed above
@@ -627,21 +588,21 @@ acpi_ex_do_logical_op (
                integer1 = local_operand1->integer.value;
 
                switch (opcode) {
-               case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+               case AML_LEQUAL_OP:     /* LEqual (Operand0, Operand1) */
 
                        if (integer0 == integer1) {
                                local_result = TRUE;
                        }
                        break;
 
-               case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+               case AML_LGREATER_OP:   /* LGreater (Operand0, Operand1) */
 
                        if (integer0 > integer1) {
                                local_result = TRUE;
                        }
                        break;
 
-               case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+               case AML_LLESS_OP:      /* LLess (Operand0, Operand1) */
 
                        if (integer0 < integer1) {
                                local_result = TRUE;
@@ -652,8 +613,7 @@ acpi_ex_do_logical_op (
                        status = AE_AML_INTERNAL;
                        break;
                }
-       }
-       else {
+       } else {
                /*
                 * 2) Both operands are Strings or both are Buffers
                 *    Note: Code below takes advantage of common Buffer/String
@@ -665,31 +625,31 @@ acpi_ex_do_logical_op (
 
                /* Lexicographic compare: compare the data bytes */
 
-               compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer,
-                                (const char * ) local_operand1->buffer.pointer,
-                                (length0 > length1) ? length1 : length0);
+               compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
+                                     (const char *)local_operand1->buffer.
+                                     pointer,
+                                     (length0 > length1) ? length1 : length0);
 
                switch (opcode) {
-               case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+               case AML_LEQUAL_OP:     /* LEqual (Operand0, Operand1) */
 
                        /* Length and all bytes must be equal */
 
-                       if ((length0 == length1) &&
-                               (compare == 0)) {
+                       if ((length0 == length1) && (compare == 0)) {
                                /* Length and all bytes match ==> TRUE */
 
                                local_result = TRUE;
                        }
                        break;
 
-               case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+               case AML_LGREATER_OP:   /* LGreater (Operand0, Operand1) */
 
                        if (compare > 0) {
                                local_result = TRUE;
-                               goto cleanup;   /* TRUE */
+                               goto cleanup;   /* TRUE */
                        }
                        if (compare < 0) {
-                               goto cleanup;   /* FALSE */
+                               goto cleanup;   /* FALSE */
                        }
 
                        /* Bytes match (to shortest length), compare lengths */
@@ -699,14 +659,14 @@ acpi_ex_do_logical_op (
                        }
                        break;
 
-               case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+               case AML_LLESS_OP:      /* LLess (Operand0, Operand1) */
 
                        if (compare > 0) {
-                               goto cleanup;   /* FALSE */
+                               goto cleanup;   /* FALSE */
                        }
                        if (compare < 0) {
                                local_result = TRUE;
-                               goto cleanup;   /* TRUE */
+                               goto cleanup;   /* TRUE */
                        }
 
                        /* Bytes match (to shortest length), compare lengths */
@@ -722,18 +682,16 @@ acpi_ex_do_logical_op (
                }
        }
 
-cleanup:
+      cleanup:
 
        /* New object was created if implicit conversion performed - delete */
 
        if (local_operand1 != operand1) {
-               acpi_ut_remove_reference (local_operand1);
+               acpi_ut_remove_reference(local_operand1);
        }
 
        /* Return the logical result and status */
 
        *logical_result = local_result;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index c3cb714d2cbaaa81e239b5b2f0c76e59af96cec0..ab47f6d8b5c0bd664c471788b11f70823a9f479f 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exmutex")
+ACPI_MODULE_NAME("exmutex")
 
 /* Local prototypes */
-
 static void
-acpi_ex_link_mutex (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_thread_state        *thread);
-
+acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
+                  struct acpi_thread_state *thread);
 
 /*******************************************************************************
  *
@@ -69,12 +65,9 @@ acpi_ex_link_mutex (
  *
  ******************************************************************************/
 
-void
-acpi_ex_unlink_mutex (
-       union acpi_operand_object       *obj_desc)
+void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
 {
-       struct acpi_thread_state        *thread = obj_desc->mutex.owner_thread;
-
+       struct acpi_thread_state *thread = obj_desc->mutex.owner_thread;
 
        if (!thread) {
                return;
@@ -88,13 +81,11 @@ acpi_ex_unlink_mutex (
 
        if (obj_desc->mutex.prev) {
                (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
-       }
-       else {
+       } else {
                thread->acquired_mutex_list = obj_desc->mutex.next;
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_link_mutex
@@ -109,12 +100,10 @@ acpi_ex_unlink_mutex (
  ******************************************************************************/
 
 static void
-acpi_ex_link_mutex (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_thread_state        *thread)
+acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
+                  struct acpi_thread_state *thread)
 {
-       union acpi_operand_object       *list_head;
-
+       union acpi_operand_object *list_head;
 
        list_head = thread->acquired_mutex_list;
 
@@ -134,7 +123,6 @@ acpi_ex_link_mutex (
        thread->acquired_mutex_list = obj_desc;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_acquire_mutex
@@ -150,27 +138,23 @@ acpi_ex_link_mutex (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_acquire_mutex (
-       union acpi_operand_object       *time_desc,
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
+                     union acpi_operand_object *obj_desc,
+                     struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_acquire_mutex", obj_desc);
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc);
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Sanity check -- we must have a valid thread ID */
 
        if (!walk_state->thread) {
-               ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
-                       acpi_ut_get_node_name (obj_desc->mutex.node)));
-               return_ACPI_STATUS (AE_AML_INTERNAL);
+               ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+               return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
        /*
@@ -178,10 +162,8 @@ acpi_ex_acquire_mutex (
         * mutex.  This mechanism provides some deadlock prevention
         */
        if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
-               ACPI_REPORT_ERROR ((
-                       "Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
-                       acpi_ut_get_node_name (obj_desc->mutex.node)));
-               return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+               ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+               return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
        }
 
        /* Support for multiple acquires by the owning thread */
@@ -190,43 +172,43 @@ acpi_ex_acquire_mutex (
                /* Special case for Global Lock, allow all threads */
 
                if ((obj_desc->mutex.owner_thread->thread_id ==
-                               walk_state->thread->thread_id)      ||
-                       (obj_desc->mutex.semaphore ==
-                               acpi_gbl_global_lock_semaphore)) {
+                    walk_state->thread->thread_id) ||
+                   (obj_desc->mutex.semaphore ==
+                    acpi_gbl_global_lock_semaphore)) {
                        /*
                         * The mutex is already owned by this thread,
                         * just increment the acquisition depth
                         */
                        obj_desc->mutex.acquisition_depth++;
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
        /* Acquire the mutex, wait if necessary */
 
-       status = acpi_ex_system_acquire_mutex (time_desc, obj_desc);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
+       if (ACPI_FAILURE(status)) {
                /* Includes failure from a timeout on time_desc */
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Have the mutex: update mutex and walk info and save the sync_level */
 
-       obj_desc->mutex.owner_thread     = walk_state->thread;
+       obj_desc->mutex.owner_thread = walk_state->thread;
        obj_desc->mutex.acquisition_depth = 1;
-       obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level;
+       obj_desc->mutex.original_sync_level =
+           walk_state->thread->current_sync_level;
 
        walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
 
        /* Link the mutex to the current thread for force-unlock at method exit */
 
-       acpi_ex_link_mutex (obj_desc, walk_state->thread);
+       acpi_ex_link_mutex(obj_desc, walk_state->thread);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_mutex
@@ -241,48 +223,40 @@ acpi_ex_acquire_mutex (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_release_mutex (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
+                     struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ex_release_mutex");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_release_mutex");
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* The mutex must have been previously acquired in order to release it */
 
        if (!obj_desc->mutex.owner_thread) {
-               ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
-                               acpi_ut_get_node_name (obj_desc->mutex.node)));
-               return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
+               ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+               return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
        }
 
        /* Sanity check -- we must have a valid thread ID */
 
        if (!walk_state->thread) {
-               ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
-                               acpi_ut_get_node_name (obj_desc->mutex.node)));
-               return_ACPI_STATUS (AE_AML_INTERNAL);
+               ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+               return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
        /*
         * The Mutex is owned, but this thread must be the owner.
         * Special case for Global Lock, any thread can release
         */
-       if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) &&
-               (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
-               ACPI_REPORT_ERROR ((
-                       "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
-                       walk_state->thread->thread_id,
-                       acpi_ut_get_node_name (obj_desc->mutex.node),
-                       obj_desc->mutex.owner_thread->thread_id));
-               return_ACPI_STATUS (AE_AML_NOT_OWNER);
+       if ((obj_desc->mutex.owner_thread->thread_id !=
+            walk_state->thread->thread_id)
+           && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
+               ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id));
+               return_ACPI_STATUS(AE_AML_NOT_OWNER);
        }
 
        /*
@@ -290,10 +264,8 @@ acpi_ex_release_mutex (
         * equal to the current sync level
         */
        if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
-               ACPI_REPORT_ERROR ((
-                       "Cannot release Mutex [%4.4s], incorrect sync_level\n",
-                       acpi_ut_get_node_name (obj_desc->mutex.node)));
-               return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+               ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
+               return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
        }
 
        /* Match multiple Acquires with multiple Releases */
@@ -302,26 +274,26 @@ acpi_ex_release_mutex (
        if (obj_desc->mutex.acquisition_depth != 0) {
                /* Just decrement the depth and return */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Unlink the mutex from the owner's list */
 
-       acpi_ex_unlink_mutex (obj_desc);
+       acpi_ex_unlink_mutex(obj_desc);
 
        /* Release the mutex */
 
-       status = acpi_ex_system_release_mutex (obj_desc);
+       status = acpi_ex_system_release_mutex(obj_desc);
 
        /* Update the mutex and walk state, restore sync_level before acquire */
 
        obj_desc->mutex.owner_thread = NULL;
-       walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level;
+       walk_state->thread->current_sync_level =
+           obj_desc->mutex.original_sync_level;
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_all_mutexes
@@ -334,17 +306,13 @@ acpi_ex_release_mutex (
  *
  ******************************************************************************/
 
-void
-acpi_ex_release_all_mutexes (
-       struct acpi_thread_state        *thread)
+void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
 {
-       union acpi_operand_object       *next = thread->acquired_mutex_list;
-       union acpi_operand_object       *this;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_operand_object *next = thread->acquired_mutex_list;
+       union acpi_operand_object *this;
+       acpi_status status;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Traverse the list of owned mutexes, releasing each one */
 
@@ -353,13 +321,13 @@ acpi_ex_release_all_mutexes (
                next = this->mutex.next;
 
                this->mutex.acquisition_depth = 1;
-               this->mutex.prev             = NULL;
-               this->mutex.next             = NULL;
+               this->mutex.prev = NULL;
+               this->mutex.next = NULL;
 
-                /* Release the mutex */
+               /* Release the mutex */
 
-               status = acpi_ex_system_release_mutex (this);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ex_system_release_mutex(this);
+               if (ACPI_FAILURE(status)) {
                        continue;
                }
 
@@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes (
                thread->current_sync_level = this->mutex.original_sync_level;
        }
 }
-
-
index 639f0bd3f6d86dd25c77c9df9b626be8edbef058..239d8473e9a5c8d7195861d03ccb02d89688ef9f 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exnames")
+ACPI_MODULE_NAME("exnames")
 
 /* Local prototypes */
-
-static char *
-acpi_ex_allocate_name_string (
-       u32                             prefix_count,
-       u32                             num_name_segs);
+static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
 
 static acpi_status
-acpi_ex_name_segment (
-       u8                              **in_aml_address,
-       char                            *name_string);
-
+acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
 
 /*******************************************************************************
  *
@@ -79,17 +71,13 @@ acpi_ex_name_segment (
  *
  ******************************************************************************/
 
-static char *
-acpi_ex_allocate_name_string (
-       u32                             prefix_count,
-       u32                             num_name_segs)
+static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
 {
-       char                            *temp_ptr;
-       char                            *name_string;
-       u32                              size_needed;
-
-       ACPI_FUNCTION_TRACE ("ex_allocate_name_string");
+       char *temp_ptr;
+       char *name_string;
+       u32 size_needed;
 
+       ACPI_FUNCTION_TRACE("ex_allocate_name_string");
 
        /*
         * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
@@ -100,20 +88,19 @@ acpi_ex_allocate_name_string (
                /* Special case for root */
 
                size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
-       }
-       else {
-               size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
+       } else {
+               size_needed =
+                   prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
        }
 
        /*
         * Allocate a buffer for the name.
         * This buffer must be deleted by the caller!
         */
-       name_string = ACPI_MEM_ALLOCATE (size_needed);
+       name_string = ACPI_MEM_ALLOCATE(size_needed);
        if (!name_string) {
-               ACPI_REPORT_ERROR ((
-                       "ex_allocate_name_string: Could not allocate size %d\n", size_needed));
-               return_PTR (NULL);
+               ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed));
+               return_PTR(NULL);
        }
 
        temp_ptr = name_string;
@@ -122,23 +109,20 @@ acpi_ex_allocate_name_string (
 
        if (prefix_count == ACPI_UINT32_MAX) {
                *temp_ptr++ = AML_ROOT_PREFIX;
-       }
-       else {
+       } else {
                while (prefix_count--) {
                        *temp_ptr++ = AML_PARENT_PREFIX;
                }
        }
 
-
        /* Set up Dual or Multi prefixes if needed */
 
        if (num_name_segs > 2) {
                /* Set up multi prefixes   */
 
                *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
-               *temp_ptr++ = (char) num_name_segs;
-       }
-       else if (2 == num_name_segs) {
+               *temp_ptr++ = (char)num_name_segs;
+       } else if (2 == num_name_segs) {
                /* Set up dual prefixes */
 
                *temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -150,7 +134,7 @@ acpi_ex_allocate_name_string (
         */
        *temp_ptr = 0;
 
-       return_PTR (name_string);
+       return_PTR(name_string);
 }
 
 /*******************************************************************************
@@ -167,19 +151,14 @@ acpi_ex_allocate_name_string (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ex_name_segment (
-       u8                              **in_aml_address,
-       char                            *name_string)
+static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 {
-       char                            *aml_address = (void *) *in_aml_address;
-       acpi_status                     status = AE_OK;
-       u32                             index;
-       char                            char_buf[5];
-
-
-       ACPI_FUNCTION_TRACE ("ex_name_segment");
+       char *aml_address = (void *)*in_aml_address;
+       acpi_status status = AE_OK;
+       u32 index;
+       char char_buf[5];
 
+       ACPI_FUNCTION_TRACE("ex_name_segment");
 
        /*
         * If first character is a digit, then we know that we aren't looking at a
@@ -188,20 +167,20 @@ acpi_ex_name_segment (
        char_buf[0] = *aml_address;
 
        if ('0' <= char_buf[0] && char_buf[0] <= '9') {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0]));
-               return_ACPI_STATUS (AE_CTRL_PENDING);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n",
+                                 char_buf[0]));
+               return_ACPI_STATUS(AE_CTRL_PENDING);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
 
        for (index = 0;
-               (index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address));
-               index++) {
+            (index < ACPI_NAME_SIZE)
+            && (acpi_ut_valid_acpi_character(*aml_address)); index++) {
                char_buf[index] = *aml_address++;
-               ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index]));
+               ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
        }
 
-
        /* Valid name segment  */
 
        if (index == 4) {
@@ -210,41 +189,37 @@ acpi_ex_name_segment (
                char_buf[4] = '\0';
 
                if (name_string) {
-                       ACPI_STRCAT (name_string, char_buf);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Appended to - %s \n", name_string));
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "No Name string - %s \n", char_buf));
+                       ACPI_STRCAT(name_string, char_buf);
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Appended to - %s \n", name_string));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "No Name string - %s \n", char_buf));
                }
-       }
-       else if (index == 0) {
+       } else if (index == 0) {
                /*
                 * First character was not a valid name character,
                 * so we are looking at something other than a name.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Leading character is not alpha: %02Xh (not a name)\n",
-                       char_buf[0]));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Leading character is not alpha: %02Xh (not a name)\n",
+                                 char_buf[0]));
                status = AE_CTRL_PENDING;
-       }
-       else {
+       } else {
                /*
                 * Segment started with one or more valid characters, but fewer than
                 * the required 4
                 */
                status = AE_AML_BAD_NAME;
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Bad character %02x in name, at %p\n",
-                       *aml_address, aml_address));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Bad character %02x in name, at %p\n",
+                                 *aml_address, aml_address));
        }
 
        *in_aml_address = (u8 *) aml_address;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_get_name_string
@@ -263,37 +238,32 @@ acpi_ex_name_segment (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_get_name_string (
-       acpi_object_type                data_type,
-       u8                              *in_aml_address,
-       char                            **out_name_string,
-       u32                             *out_name_length)
+acpi_ex_get_name_string(acpi_object_type data_type,
+                       u8 * in_aml_address,
+                       char **out_name_string, u32 * out_name_length)
 {
-       acpi_status                     status = AE_OK;
-       u8                              *aml_address = in_aml_address;
-       char                            *name_string = NULL;
-       u32                             num_segments;
-       u32                             prefix_count = 0;
-       u8                              has_prefix = FALSE;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_get_name_string", aml_address);
-
-
-       if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type  ||
-               ACPI_TYPE_LOCAL_BANK_FIELD == data_type    ||
-               ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
+       acpi_status status = AE_OK;
+       u8 *aml_address = in_aml_address;
+       char *name_string = NULL;
+       u32 num_segments;
+       u32 prefix_count = 0;
+       u8 has_prefix = FALSE;
+
+       ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address);
+
+       if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
+           ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
+           ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
                /* Disallow prefixes for types associated with field_unit names */
 
-               name_string = acpi_ex_allocate_name_string (0, 1);
+               name_string = acpi_ex_allocate_name_string(0, 1);
                if (!name_string) {
                        status = AE_NO_MEMORY;
+               } else {
+                       status =
+                           acpi_ex_name_segment(&aml_address, name_string);
                }
-               else {
-                       status = acpi_ex_name_segment (&aml_address, name_string);
-               }
-       }
-       else {
+       } else {
                /*
                 * data_type is not a field name.
                 * Examine first character of name for root or parent prefix operators
@@ -301,8 +271,9 @@ acpi_ex_get_name_string (
                switch (*aml_address) {
                case AML_ROOT_PREFIX:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
-                               aml_address));
+                       ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                         "root_prefix(\\) at %p\n",
+                                         aml_address));
 
                        /*
                         * Remember that we have a root_prefix --
@@ -313,14 +284,14 @@ acpi_ex_get_name_string (
                        has_prefix = TRUE;
                        break;
 
-
                case AML_PARENT_PREFIX:
 
                        /* Increment past possibly multiple parent prefixes */
 
                        do {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
-                                       aml_address));
+                               ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                                 "parent_prefix (^) at %p\n",
+                                                 aml_address));
 
                                aml_address++;
                                prefix_count++;
@@ -330,7 +301,6 @@ acpi_ex_get_name_string (
                        has_prefix = TRUE;
                        break;
 
-
                default:
 
                        /* Not a prefix character */
@@ -343,11 +313,13 @@ acpi_ex_get_name_string (
                switch (*aml_address) {
                case AML_DUAL_NAME_PREFIX:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
-                               aml_address));
+                       ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                         "dual_name_prefix at %p\n",
+                                         aml_address));
 
                        aml_address++;
-                       name_string = acpi_ex_allocate_name_string (prefix_count, 2);
+                       name_string =
+                           acpi_ex_allocate_name_string(prefix_count, 2);
                        if (!name_string) {
                                status = AE_NO_MEMORY;
                                break;
@@ -357,24 +329,29 @@ acpi_ex_get_name_string (
 
                        has_prefix = TRUE;
 
-                       status = acpi_ex_name_segment (&aml_address, name_string);
-                       if (ACPI_SUCCESS (status)) {
-                               status = acpi_ex_name_segment (&aml_address, name_string);
+                       status =
+                           acpi_ex_name_segment(&aml_address, name_string);
+                       if (ACPI_SUCCESS(status)) {
+                               status =
+                                   acpi_ex_name_segment(&aml_address,
+                                                        name_string);
                        }
                        break;
 
-
                case AML_MULTI_NAME_PREFIX_OP:
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
-                               aml_address));
+                       ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
+                                         "multi_name_prefix at %p\n",
+                                         aml_address));
 
                        /* Fetch count of segments remaining in name path */
 
                        aml_address++;
                        num_segments = *aml_address;
 
-                       name_string = acpi_ex_allocate_name_string (prefix_count, num_segments);
+                       name_string =
+                           acpi_ex_allocate_name_string(prefix_count,
+                                                        num_segments);
                        if (!name_string) {
                                status = AE_NO_MEMORY;
                                break;
@@ -386,27 +363,28 @@ acpi_ex_get_name_string (
                        has_prefix = TRUE;
 
                        while (num_segments &&
-                                       (status = acpi_ex_name_segment (&aml_address, name_string)) ==
-                                               AE_OK) {
+                              (status =
+                               acpi_ex_name_segment(&aml_address,
+                                                    name_string)) == AE_OK) {
                                num_segments--;
                        }
 
                        break;
 
-
                case 0:
 
                        /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
 
                        if (prefix_count == ACPI_UINT32_MAX) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                                       "name_seg is \"\\\" followed by NULL\n"));
+                               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                 "name_seg is \"\\\" followed by NULL\n"));
                        }
 
                        /* Consume the NULL byte */
 
                        aml_address++;
-                       name_string = acpi_ex_allocate_name_string (prefix_count, 0);
+                       name_string =
+                           acpi_ex_allocate_name_string(prefix_count, 0);
                        if (!name_string) {
                                status = AE_NO_MEMORY;
                                break;
@@ -414,18 +392,19 @@ acpi_ex_get_name_string (
 
                        break;
 
-
                default:
 
                        /* Name segment string */
 
-                       name_string = acpi_ex_allocate_name_string (prefix_count, 1);
+                       name_string =
+                           acpi_ex_allocate_name_string(prefix_count, 1);
                        if (!name_string) {
                                status = AE_NO_MEMORY;
                                break;
                        }
 
-                       status = acpi_ex_name_segment (&aml_address, name_string);
+                       status =
+                           acpi_ex_name_segment(&aml_address, name_string);
                        break;
                }
        }
@@ -433,15 +412,20 @@ acpi_ex_get_name_string (
        if (AE_CTRL_PENDING == status && has_prefix) {
                /* Ran out of segments after processing a prefix */
 
-               ACPI_REPORT_ERROR (
-                       ("ex_do_name: Malformed Name at %p\n", name_string));
+               ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n",
+                                  name_string));
                status = AE_AML_BAD_NAME;
        }
 
+       if (ACPI_FAILURE(status)) {
+               if (name_string) {
+                       ACPI_MEM_FREE(name_string);
+               }
+               return_ACPI_STATUS(status);
+       }
+
        *out_name_string = name_string;
        *out_name_length = (u32) (aml_address - in_aml_address);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index dbdf8262ba00d88e6cc51bb6817143778434997c..97e34542f5e44746bea68b73f9f01e2e353f9841 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exoparg1")
-
+ACPI_MODULE_NAME("exoparg1")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -76,7 +73,6 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_0A_0T_1R
  * DESCRIPTION: Execute operator with no operands, one return value
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_opcode_0A_0T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *return_desc = NULL;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       acpi_status status = AE_OK;
+       union acpi_operand_object *return_desc = NULL;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
 
        switch (walk_state->opcode) {
-       case AML_TIMER_OP:      /*  Timer () */
+       case AML_TIMER_OP:      /*  Timer () */
 
                /* Create a return object of type Integer */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
-
-               return_desc->integer.value = acpi_os_get_timer ();
+#if ACPI_MACHINE_WIDTH != 16
+               return_desc->integer.value = acpi_os_get_timer();
+#endif
                break;
 
-       default:                /*  Unknown opcode  */
+       default:                /*  Unknown opcode  */
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                break;
        }
 
-cleanup:
-
-       if (!walk_state->result_obj) {
-               walk_state->result_obj = return_desc;
-       }
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if ((ACPI_FAILURE(status)) || walk_state->result_obj) {
+               acpi_ut_remove_reference(return_desc);
+       } else {
+               /* Save the return value */
+
+               walk_state->result_obj = return_desc;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_1A_0T_0R
@@ -154,69 +144,58 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_1A_0T_0R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
 
        switch (walk_state->opcode) {
-       case AML_RELEASE_OP:    /*  Release (mutex_object) */
+       case AML_RELEASE_OP:    /*  Release (mutex_object) */
 
-               status = acpi_ex_release_mutex (operand[0], walk_state);
+               status = acpi_ex_release_mutex(operand[0], walk_state);
                break;
 
+       case AML_RESET_OP:      /*  Reset (event_object) */
 
-       case AML_RESET_OP:      /*  Reset (event_object) */
-
-               status = acpi_ex_system_reset_event (operand[0]);
+               status = acpi_ex_system_reset_event(operand[0]);
                break;
 
+       case AML_SIGNAL_OP:     /*  Signal (event_object) */
 
-       case AML_SIGNAL_OP:     /*  Signal (event_object) */
-
-               status = acpi_ex_system_signal_event (operand[0]);
+               status = acpi_ex_system_signal_event(operand[0]);
                break;
 
+       case AML_SLEEP_OP:      /*  Sleep (msec_time) */
 
-       case AML_SLEEP_OP:      /*  Sleep (msec_time) */
-
-               status = acpi_ex_system_do_suspend (operand[0]->integer.value);
+               status = acpi_ex_system_do_suspend(operand[0]->integer.value);
                break;
 
+       case AML_STALL_OP:      /*  Stall (usec_time) */
 
-       case AML_STALL_OP:      /*  Stall (usec_time) */
-
-               status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
+               status =
+                   acpi_ex_system_do_stall((u32) operand[0]->integer.value);
                break;
 
+       case AML_UNLOAD_OP:     /*  Unload (Handle) */
 
-       case AML_UNLOAD_OP:     /*  Unload (Handle) */
-
-               status = acpi_ex_unload_table (operand[0]);
+               status = acpi_ex_unload_table(operand[0]);
                break;
 
+       default:                /*  Unknown opcode  */
 
-       default:                /*  Unknown opcode  */
-
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_1A_1T_0R
@@ -230,41 +209,34 @@ acpi_ex_opcode_1A_0T_0R (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_1A_1T_0R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       acpi_status status = AE_OK;
+       union acpi_operand_object **operand = &walk_state->operands[0];
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
 
        switch (walk_state->opcode) {
        case AML_LOAD_OP:
 
-               status = acpi_ex_load_op (operand[0], operand[1], walk_state);
+               status = acpi_ex_load_op(operand[0], operand[1], walk_state);
                break;
 
-       default:                        /* Unknown opcode */
+       default:                /* Unknown opcode */
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
+      cleanup:
 
-cleanup:
-
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_1A_1T_1R
@@ -278,23 +250,19 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_1A_1T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc = NULL;
-       union acpi_operand_object       *return_desc2 = NULL;
-       u32                             temp32;
-       u32                             i;
-       acpi_integer                    power_of_ten;
-       acpi_integer                    digit;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
-
+       acpi_status status = AE_OK;
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc = NULL;
+       union acpi_operand_object *return_desc2 = NULL;
+       u32 temp32;
+       u32 i;
+       acpi_integer power_of_ten;
+       acpi_integer digit;
+
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
 
@@ -308,20 +276,19 @@ acpi_ex_opcode_1A_1T_1R (
 
                /* Create a return object of type Integer for these opcodes */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
                switch (walk_state->opcode) {
-               case AML_BIT_NOT_OP:            /* Not (Operand, Result)  */
+               case AML_BIT_NOT_OP:    /* Not (Operand, Result)  */
 
                        return_desc->integer.value = ~operand[0]->integer.value;
                        break;
 
-
-               case AML_FIND_SET_LEFT_BIT_OP:  /* find_set_left_bit (Operand, Result) */
+               case AML_FIND_SET_LEFT_BIT_OP:  /* find_set_left_bit (Operand, Result) */
 
                        return_desc->integer.value = operand[0]->integer.value;
 
@@ -330,15 +297,14 @@ acpi_ex_opcode_1A_1T_1R (
                         * endian unsigned value, so this boundary condition is valid.
                         */
                        for (temp32 = 0; return_desc->integer.value &&
-                                          temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+                            temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
                                return_desc->integer.value >>= 1;
                        }
 
                        return_desc->integer.value = temp32;
                        break;
 
-
-               case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
+               case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
 
                        return_desc->integer.value = operand[0]->integer.value;
 
@@ -347,18 +313,17 @@ acpi_ex_opcode_1A_1T_1R (
                         * endian unsigned value, so this boundary condition is valid.
                         */
                        for (temp32 = 0; return_desc->integer.value &&
-                                          temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
+                            temp32 < ACPI_INTEGER_BIT_SIZE; ++temp32) {
                                return_desc->integer.value <<= 1;
                        }
 
                        /* Since the bit position is one-based, subtract from 33 (65) */
 
                        return_desc->integer.value = temp32 == 0 ? 0 :
-                                         (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
+                           (ACPI_INTEGER_BIT_SIZE + 1) - temp32;
                        break;
 
-
-               case AML_FROM_BCD_OP:           /* from_bcd (BCDValue, Result) */
+               case AML_FROM_BCD_OP:   /* from_bcd (BCDValue, Result) */
 
                        /*
                         * The 64-bit ACPI integer can hold 16 4-bit BCD characters
@@ -371,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R (
 
                        /* Convert each BCD digit (each is one nybble wide) */
 
-                       for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
+                       for (i = 0;
+                            (i < acpi_gbl_integer_nybble_width) && (digit > 0);
+                            i++) {
                                /* Get the least significant 4-bit BCD digit */
 
                                temp32 = ((u32) digit) & 0xF;
@@ -379,9 +346,9 @@ acpi_ex_opcode_1A_1T_1R (
                                /* Check the range of the digit */
 
                                if (temp32 > 9) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "BCD digit too large (not decimal): 0x%X\n",
-                                               temp32));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "BCD digit too large (not decimal): 0x%X\n",
+                                                         temp32));
 
                                        status = AE_AML_NUMERIC_OVERFLOW;
                                        goto cleanup;
@@ -389,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R (
 
                                /* Sum the digit into the result with the current power of 10 */
 
-                               return_desc->integer.value += (((acpi_integer) temp32) *
-                                                power_of_ten);
+                               return_desc->integer.value +=
+                                   (((acpi_integer) temp32) * power_of_ten);
 
                                /* Shift to next BCD digit */
 
@@ -402,45 +369,50 @@ acpi_ex_opcode_1A_1T_1R (
                        }
                        break;
 
-
-               case AML_TO_BCD_OP:             /* to_bcd (Operand, Result) */
+               case AML_TO_BCD_OP:     /* to_bcd (Operand, Result) */
 
                        return_desc->integer.value = 0;
                        digit = operand[0]->integer.value;
 
                        /* Each BCD digit is one nybble wide */
 
-                       for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
-                               (void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
+                       for (i = 0;
+                            (i < acpi_gbl_integer_nybble_width) && (digit > 0);
+                            i++) {
+                               (void)acpi_ut_short_divide(digit, 10, &digit,
+                                                          &temp32);
 
                                /*
                                 * Insert the BCD digit that resides in the
                                 * remainder from above
                                 */
-                               return_desc->integer.value |= (((acpi_integer) temp32) <<
-                                                  ACPI_MUL_4 (i));
+                               return_desc->integer.value |=
+                                   (((acpi_integer) temp32) << ACPI_MUL_4(i));
                        }
 
                        /* Overflow if there is any data left in Digit */
 
                        if (digit > 0) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Integer too large to convert to BCD: %8.8X%8.8X\n",
-                                       ACPI_FORMAT_UINT64 (operand[0]->integer.value)));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Integer too large to convert to BCD: %8.8X%8.8X\n",
+                                                 ACPI_FORMAT_UINT64(operand
+                                                                    [0]->
+                                                                    integer.
+                                                                    value)));
                                status = AE_AML_NUMERIC_OVERFLOW;
                                goto cleanup;
                        }
                        break;
 
-
-               case AML_COND_REF_OF_OP:        /* cond_ref_of (source_object, Result) */
+               case AML_COND_REF_OF_OP:        /* cond_ref_of (source_object, Result) */
 
                        /*
                         * This op is a little strange because the internal return value is
                         * different than the return value stored in the result descriptor
                         * (There are really two return values)
                         */
-                       if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) {
+                       if ((struct acpi_namespace_node *)operand[0] ==
+                           acpi_gbl_root_node) {
                                /*
                                 * This means that the object does not exist in the namespace,
                                 * return FALSE
@@ -451,38 +423,38 @@ acpi_ex_opcode_1A_1T_1R (
 
                        /* Get the object reference, store it, and remove our reference */
 
-                       status = acpi_ex_get_object_reference (operand[0],
-                                        &return_desc2, walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ex_get_object_reference(operand[0],
+                                                             &return_desc2,
+                                                             walk_state);
+                       if (ACPI_FAILURE(status)) {
                                goto cleanup;
                        }
 
-                       status = acpi_ex_store (return_desc2, operand[1], walk_state);
-                       acpi_ut_remove_reference (return_desc2);
+                       status =
+                           acpi_ex_store(return_desc2, operand[1], walk_state);
+                       acpi_ut_remove_reference(return_desc2);
 
                        /* The object exists in the namespace, return TRUE */
 
                        return_desc->integer.value = ACPI_INTEGER_MAX;
                        goto cleanup;
 
-
                default:
                        /* No other opcodes get here */
                        break;
                }
                break;
 
-
-       case AML_STORE_OP:              /* Store (Source, Target) */
+       case AML_STORE_OP:      /* Store (Source, Target) */
 
                /*
                 * A store operand is typically a number, string, buffer or lvalue
                 * Be careful about deleting the source object,
                 * since the object itself may have been stored.
                 */
-               status = acpi_ex_store (operand[0], operand[1], walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_store(operand[0], operand[1], walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* It is possible that the Store already produced a return object */
@@ -495,92 +467,84 @@ acpi_ex_opcode_1A_1T_1R (
                         * cancel out, and we simply don't do anything.
                         */
                        walk_state->result_obj = operand[0];
-                       walk_state->operands[0] = NULL; /* Prevent deletion */
+                       walk_state->operands[0] = NULL; /* Prevent deletion */
                }
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
 
+               /*
+                * ACPI 2.0 Opcodes
+                */
+       case AML_COPY_OP:       /* Copy (Source, Target) */
 
-       /*
-        * ACPI 2.0 Opcodes
-        */
-       case AML_COPY_OP:               /* Copy (Source, Target) */
-
-               status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc,
-                                walk_state);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc,
+                                                   walk_state);
                break;
 
+       case AML_TO_DECSTRING_OP:       /* to_decimal_string (Data, Result) */
 
-       case AML_TO_DECSTRING_OP:       /* to_decimal_string (Data, Result) */
-
-               status = acpi_ex_convert_to_string (operand[0], &return_desc,
-                                ACPI_EXPLICIT_CONVERT_DECIMAL);
+               status = acpi_ex_convert_to_string(operand[0], &return_desc,
+                                                  ACPI_EXPLICIT_CONVERT_DECIMAL);
                if (return_desc == operand[0]) {
                        /* No conversion performed, add ref to handle return value */
-                       acpi_ut_add_reference (return_desc);
+                       acpi_ut_add_reference(return_desc);
                }
                break;
 
+       case AML_TO_HEXSTRING_OP:       /* to_hex_string (Data, Result) */
 
-       case AML_TO_HEXSTRING_OP:       /* to_hex_string (Data, Result) */
-
-               status = acpi_ex_convert_to_string (operand[0], &return_desc,
-                                ACPI_EXPLICIT_CONVERT_HEX);
+               status = acpi_ex_convert_to_string(operand[0], &return_desc,
+                                                  ACPI_EXPLICIT_CONVERT_HEX);
                if (return_desc == operand[0]) {
                        /* No conversion performed, add ref to handle return value */
-                       acpi_ut_add_reference (return_desc);
+                       acpi_ut_add_reference(return_desc);
                }
                break;
 
+       case AML_TO_BUFFER_OP:  /* to_buffer (Data, Result) */
 
-       case AML_TO_BUFFER_OP:          /* to_buffer (Data, Result) */
-
-               status = acpi_ex_convert_to_buffer (operand[0], &return_desc);
+               status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
                if (return_desc == operand[0]) {
                        /* No conversion performed, add ref to handle return value */
-                       acpi_ut_add_reference (return_desc);
+                       acpi_ut_add_reference(return_desc);
                }
                break;
 
+       case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */
 
-       case AML_TO_INTEGER_OP:         /* to_integer (Data, Result) */
-
-               status = acpi_ex_convert_to_integer (operand[0], &return_desc,
-                                ACPI_ANY_BASE);
+               status = acpi_ex_convert_to_integer(operand[0], &return_desc,
+                                                   ACPI_ANY_BASE);
                if (return_desc == operand[0]) {
                        /* No conversion performed, add ref to handle return value */
-                       acpi_ut_add_reference (return_desc);
+                       acpi_ut_add_reference(return_desc);
                }
                break;
 
-
-       case AML_SHIFT_LEFT_BIT_OP:     /* shift_left_bit (Source, bit_num) */
-       case AML_SHIFT_RIGHT_BIT_OP:    /* shift_right_bit (Source, bit_num) */
+       case AML_SHIFT_LEFT_BIT_OP:     /* shift_left_bit (Source, bit_num) */
+       case AML_SHIFT_RIGHT_BIT_OP:    /* shift_right_bit (Source, bit_num) */
 
                /* These are two obsolete opcodes */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "%s is obsolete and not implemented\n",
-                       acpi_ps_get_opcode_name (walk_state->opcode)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%s is obsolete and not implemented\n",
+                                 acpi_ps_get_opcode_name(walk_state->opcode)));
                status = AE_SUPPORT;
                goto cleanup;
 
+       default:                /* Unknown opcode */
 
-       default:                        /* Unknown opcode */
-
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                /* Store the return value computed above into the target object */
 
-               status = acpi_ex_store (return_desc, operand[1], walk_state);
+               status = acpi_ex_store(return_desc, operand[1], walk_state);
        }
 
-
-cleanup:
+      cleanup:
 
        if (!walk_state->result_obj) {
                walk_state->result_obj = return_desc;
@@ -588,14 +552,13 @@ cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(return_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_1A_0T_1R
@@ -608,28 +571,24 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_1A_0T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *temp_desc;
-       union acpi_operand_object       *return_desc = NULL;
-       acpi_status                     status = AE_OK;
-       u32                             type;
-       acpi_integer                    value;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *temp_desc;
+       union acpi_operand_object *return_desc = NULL;
+       acpi_status status = AE_OK;
+       u32 type;
+       acpi_integer value;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the AML opcode */
 
        switch (walk_state->opcode) {
-       case AML_LNOT_OP:               /* LNot (Operand) */
+       case AML_LNOT_OP:       /* LNot (Operand) */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -644,15 +603,14 @@ acpi_ex_opcode_1A_0T_1R (
                }
                break;
 
-
-       case AML_DECREMENT_OP:          /* Decrement (Operand)  */
-       case AML_INCREMENT_OP:          /* Increment (Operand)  */
+       case AML_DECREMENT_OP:  /* Decrement (Operand)  */
+       case AML_INCREMENT_OP:  /* Increment (Operand)  */
 
                /*
                 * Create a new integer.  Can't just get the base integer and
                 * increment it because it may be an Arg or Field.
                 */
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -663,10 +621,11 @@ acpi_ex_opcode_1A_0T_1R (
                 * NS Node or an internal object.
                 */
                temp_desc = operand[0];
-               if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) {
+               if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
+                   ACPI_DESC_TYPE_OPERAND) {
                        /* Internal reference object - prevent deletion */
 
-                       acpi_ut_add_reference (temp_desc);
+                       acpi_ut_add_reference(temp_desc);
                }
 
                /*
@@ -676,11 +635,15 @@ acpi_ex_opcode_1A_0T_1R (
                 * NOTE:  We use LNOT_OP here in order to force resolution of the
                 * reference operand to an actual integer.
                 */
-               status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
-                               acpi_ps_get_opcode_name (walk_state->opcode),
-                               acpi_format_exception(status)));
+               status =
+                   acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc,
+                                            walk_state);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "%s: bad operand(s) %s\n",
+                                         acpi_ps_get_opcode_name(walk_state->
+                                                                 opcode),
+                                         acpi_format_exception(status)));
 
                        goto cleanup;
                }
@@ -690,25 +653,25 @@ acpi_ex_opcode_1A_0T_1R (
                 * Perform the actual increment or decrement
                 */
                if (walk_state->opcode == AML_INCREMENT_OP) {
-                       return_desc->integer.value = temp_desc->integer.value +1;
-               }
-               else {
-                       return_desc->integer.value = temp_desc->integer.value -1;
+                       return_desc->integer.value =
+                           temp_desc->integer.value + 1;
+               } else {
+                       return_desc->integer.value =
+                           temp_desc->integer.value - 1;
                }
 
                /* Finished with this Integer object */
 
-               acpi_ut_remove_reference (temp_desc);
+               acpi_ut_remove_reference(temp_desc);
 
                /*
                 * Store the result back (indirectly) through the original
                 * Reference object
                 */
-               status = acpi_ex_store (return_desc, operand[0], walk_state);
+               status = acpi_ex_store(return_desc, operand[0], walk_state);
                break;
 
-
-       case AML_TYPE_OP:               /* object_type (source_object) */
+       case AML_TYPE_OP:       /* object_type (source_object) */
 
                /*
                 * Note: The operand is not resolved at this point because we want to
@@ -719,13 +682,15 @@ acpi_ex_opcode_1A_0T_1R (
 
                /* Get the type of the base object */
 
-               status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_resolve_multiple(walk_state, operand[0], &type,
+                                            NULL);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
                /* Allocate a descriptor to hold the type. */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -734,8 +699,7 @@ acpi_ex_opcode_1A_0T_1R (
                return_desc->integer.value = type;
                break;
 
-
-       case AML_SIZE_OF_OP:            /* size_of (source_object) */
+       case AML_SIZE_OF_OP:    /* size_of (source_object) */
 
                /*
                 * Note: The operand is not resolved at this point because we want to
@@ -744,9 +708,10 @@ acpi_ex_opcode_1A_0T_1R (
 
                /* Get the base object */
 
-               status = acpi_ex_resolve_multiple (walk_state,
-                                operand[0], &type, &temp_desc);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ex_resolve_multiple(walk_state,
+                                                 operand[0], &type,
+                                                 &temp_desc);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
@@ -777,9 +742,9 @@ acpi_ex_opcode_1A_0T_1R (
                        break;
 
                default:
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n",
-                               acpi_ut_get_type_name (type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n",
+                                         acpi_ut_get_type_name(type)));
                        status = AE_AML_OPERAND_TYPE;
                        goto cleanup;
                }
@@ -788,7 +753,7 @@ acpi_ex_opcode_1A_0T_1R (
                 * Now that we have the size of the object, create a result
                 * object to hold the value
                 */
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -797,22 +762,23 @@ acpi_ex_opcode_1A_0T_1R (
                return_desc->integer.value = value;
                break;
 
+       case AML_REF_OF_OP:     /* ref_of (source_object) */
 
-       case AML_REF_OF_OP:             /* ref_of (source_object) */
-
-               status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_get_object_reference(operand[0], &return_desc,
+                                                walk_state);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
                break;
 
-
-       case AML_DEREF_OF_OP:           /* deref_of (obj_reference | String) */
+       case AML_DEREF_OF_OP:   /* deref_of (obj_reference | String) */
 
                /* Check for a method local or argument, or standalone String */
 
-               if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {
-                       switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
+               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
+                   ACPI_DESC_TYPE_NAMED) {
+                       switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
                        case ACPI_TYPE_LOCAL_REFERENCE:
                                /*
                                 * This is a deref_of (local_x | arg_x)
@@ -825,11 +791,12 @@ acpi_ex_opcode_1A_0T_1R (
 
                                        /* Set Operand[0] to the value of the local/arg */
 
-                                       status = acpi_ds_method_data_get_value (
-                                                        operand[0]->reference.opcode,
-                                                        operand[0]->reference.offset,
-                                                        walk_state, &temp_desc);
-                                       if (ACPI_FAILURE (status)) {
+                                       status =
+                                           acpi_ds_method_data_get_value
+                                           (operand[0]->reference.opcode,
+                                            operand[0]->reference.offset,
+                                            walk_state, &temp_desc);
+                                       if (ACPI_FAILURE(status)) {
                                                goto cleanup;
                                        }
 
@@ -837,7 +804,7 @@ acpi_ex_opcode_1A_0T_1R (
                                         * Delete our reference to the input object and
                                         * point to the object just retrieved
                                         */
-                                       acpi_ut_remove_reference (operand[0]);
+                                       acpi_ut_remove_reference(operand[0]);
                                        operand[0] = temp_desc;
                                        break;
 
@@ -845,8 +812,9 @@ acpi_ex_opcode_1A_0T_1R (
 
                                        /* Get the object to which the reference refers */
 
-                                       temp_desc = operand[0]->reference.object;
-                                       acpi_ut_remove_reference (operand[0]);
+                                       temp_desc =
+                                           operand[0]->reference.object;
+                                       acpi_ut_remove_reference(operand[0]);
                                        operand[0] = temp_desc;
                                        break;
 
@@ -857,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R (
                                }
                                break;
 
-
                        case ACPI_TYPE_STRING:
 
                                /*
@@ -868,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R (
                                 * 2) Dereference the node to an actual object.  Could be a
                                 *    Field, so we need to resolve the node to a value.
                                 */
-                               status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
-                                                walk_state->scope_info->scope.node,
-                                                ACPI_NS_SEARCH_PARENT,
-                                                ACPI_CAST_INDIRECT_PTR (
-                                                               struct acpi_namespace_node, &return_desc));
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_ns_get_node_by_path(operand[0]->string.
+                                                            pointer,
+                                                            walk_state->
+                                                            scope_info->scope.
+                                                            node,
+                                                            ACPI_NS_SEARCH_PARENT,
+                                                            ACPI_CAST_INDIRECT_PTR
+                                                            (struct
+                                                             acpi_namespace_node,
+                                                             &return_desc));
+                               if (ACPI_FAILURE(status)) {
                                        goto cleanup;
                                }
 
-                               status = acpi_ex_resolve_node_to_value (
-                                                 ACPI_CAST_INDIRECT_PTR (
-                                                                struct acpi_namespace_node, &return_desc),
-                                                               walk_state);
+                               status =
+                                   acpi_ex_resolve_node_to_value
+                                   (ACPI_CAST_INDIRECT_PTR
+                                    (struct acpi_namespace_node, &return_desc),
+                                    walk_state);
                                goto cleanup;
 
-
                        default:
 
                                status = AE_AML_OPERAND_TYPE;
@@ -893,17 +866,20 @@ acpi_ex_opcode_1A_0T_1R (
 
                /* Operand[0] may have changed from the code above */
 
-               if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) {
+               if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
+                   ACPI_DESC_TYPE_NAMED) {
                        /*
                         * This is a deref_of (object_reference)
                         * Get the actual object from the Node (This is the dereference).
                         * This case may only happen when a local_x or arg_x is
                         * dereferenced above.
                         */
-                       return_desc = acpi_ns_get_attached_object (
-                                         (struct acpi_namespace_node *) operand[0]);
-               }
-               else {
+                       return_desc = acpi_ns_get_attached_object((struct
+                                                                  acpi_namespace_node
+                                                                  *)
+                                                                 operand[0]);
+                       acpi_ut_add_reference(return_desc);
+               } else {
                        /*
                         * This must be a reference object produced by either the
                         * Index() or ref_of() operator
@@ -918,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R (
                                switch (operand[0]->reference.target_type) {
                                case ACPI_TYPE_BUFFER_FIELD:
 
-                                       temp_desc = operand[0]->reference.object;
+                                       temp_desc =
+                                           operand[0]->reference.object;
 
                                        /*
                                         * Create a new object that contains one element of the
@@ -928,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R (
                                         * sub-buffer of the main buffer, it is only a pointer to a
                                         * single element (byte) of the buffer!
                                         */
-                                       return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+                                       return_desc =
+                                           acpi_ut_create_internal_object
+                                           (ACPI_TYPE_INTEGER);
                                        if (!return_desc) {
                                                status = AE_NO_MEMORY;
                                                goto cleanup;
@@ -940,66 +919,63 @@ acpi_ex_opcode_1A_0T_1R (
                                         * reference to the buffer itself.
                                         */
                                        return_desc->integer.value =
-                                               temp_desc->buffer.pointer[operand[0]->reference.offset];
+                                           temp_desc->buffer.
+                                           pointer[operand[0]->reference.
+                                                   offset];
                                        break;
 
-
                                case ACPI_TYPE_PACKAGE:
 
                                        /*
                                         * Return the referenced element of the package.  We must
                                         * add another reference to the referenced object, however.
                                         */
-                                       return_desc = *(operand[0]->reference.where);
-                                       if (!return_desc) {
-                                               /*
-                                                * We can't return a NULL dereferenced value.  This is
-                                                * an uninitialized package element and is thus a
-                                                * severe error.
-                                                */
-                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                                       "NULL package element obj %p\n",
-                                                       operand[0]));
-                                               status = AE_AML_UNINITIALIZED_ELEMENT;
-                                               goto cleanup;
+                                       return_desc =
+                                           *(operand[0]->reference.where);
+                                       if (return_desc) {
+                                               acpi_ut_add_reference
+                                                   (return_desc);
                                        }
 
-                                       acpi_ut_add_reference (return_desc);
                                        break;
 
-
                                default:
 
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Unknown Index target_type %X in obj %p\n",
-                                               operand[0]->reference.target_type, operand[0]));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Unknown Index target_type %X in obj %p\n",
+                                                         operand[0]->reference.
+                                                         target_type,
+                                                         operand[0]));
                                        status = AE_AML_OPERAND_TYPE;
                                        goto cleanup;
                                }
                                break;
 
-
                        case AML_REF_OF_OP:
 
                                return_desc = operand[0]->reference.object;
 
-                               if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) ==
-                                               ACPI_DESC_TYPE_NAMED) {
+                               if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
+                                   ACPI_DESC_TYPE_NAMED) {
 
-                                       return_desc = acpi_ns_get_attached_object (
-                                                         (struct acpi_namespace_node *) return_desc);
+                                       return_desc =
+                                           acpi_ns_get_attached_object((struct
+                                                                        acpi_namespace_node
+                                                                        *)
+                                                                       return_desc);
                                }
 
                                /* Add another reference to the object! */
 
-                               acpi_ut_add_reference (return_desc);
+                               acpi_ut_add_reference(return_desc);
                                break;
 
-
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Unknown opcode in ref(%p) - %X\n",
-                                       operand[0], operand[0]->reference.opcode));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Unknown opcode in ref(%p) - %X\n",
+                                                 operand[0],
+                                                 operand[0]->reference.
+                                                 opcode));
 
                                status = AE_TYPE;
                                goto cleanup;
@@ -1007,25 +983,21 @@ acpi_ex_opcode_1A_0T_1R (
                }
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
-
-cleanup:
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(return_desc);
        }
 
        walk_state->result_obj = return_desc;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
index 7429032c2b6c4e7db34f4ad64e750dd10616c720..8d70c6beef00c9f6d875320c0ea3c7e6d3b352b7 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 #include <acpi/acevents.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exoparg2")
-
+ACPI_MODULE_NAME("exoparg2")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -74,8 +71,6 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_0T_0R
  * ALLOCATION:  Deletes both operands
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_opcode_2A_0T_0R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       struct acpi_namespace_node      *node;
-       u32                             value;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R",
-                       acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       struct acpi_namespace_node *node;
+       u32 value;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the opcode */
 
        switch (walk_state->opcode) {
-       case AML_NOTIFY_OP:         /* Notify (notify_object, notify_value) */
+       case AML_NOTIFY_OP:     /* Notify (notify_object, notify_value) */
 
                /* The first operand is a namespace node */
 
-               node = (struct acpi_namespace_node *) operand[0];
+               node = (struct acpi_namespace_node *)operand[0];
 
                /* Second value is the notify value */
 
@@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R (
 
                /* Are notifies allowed on this object? */
 
-               if (!acpi_ev_is_notify_object (node)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Unexpected notify object type [%s]\n",
-                                       acpi_ut_get_type_name (node->type)));
+               if (!acpi_ev_is_notify_object(node)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unexpected notify object type [%s]\n",
+                                         acpi_ut_get_type_name(node->type)));
 
                        status = AE_AML_OPERAND_TYPE;
                        break;
                }
-
 #ifdef ACPI_GPE_NOTIFY_CHECK
                /*
                 * GPE method wake/notify check.  Here, we want to ensure that we
@@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R (
                 * If all three cases are true, this is a wake-only GPE that should
                 * be disabled at runtime.
                 */
-               if (value == 2)     /* device_wake */ {
-                       status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info);
-                       if (ACPI_FAILURE (status)) {
+               if (value == 2) {       /* device_wake */
+                       status =
+                           acpi_ev_check_for_wake_only_gpe(walk_state->
+                                                           gpe_event_info);
+                       if (ACPI_FAILURE(status)) {
                                /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
 
-                               return_ACPI_STATUS (AE_OK)
+                               return_ACPI_STATUS(AE_OK)
                        }
                }
 #endif
@@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R (
                 * from this thread -- because handlers may in turn run other
                 * control methods.
                 */
-               status = acpi_ev_queue_notify_request (node, value);
+               status = acpi_ev_queue_notify_request(node, value);
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_2T_1R
@@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_2T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc1 = NULL;
-       union acpi_operand_object       *return_desc2 = NULL;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc1 = NULL;
+       union acpi_operand_object *return_desc2 = NULL;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
 
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R (
 
                /* Divide (Dividend, Divisor, remainder_result quotient_result) */
 
-               return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc1 =
+                   acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc1) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc2 =
+                   acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc2) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R (
 
                /* Quotient to return_desc1, remainder to return_desc2 */
 
-               status = acpi_ut_divide (operand[0]->integer.value,
-                                  operand[1]->integer.value,
-                                  &return_desc1->integer.value,
-                                  &return_desc2->integer.value);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ut_divide(operand[0]->integer.value,
+                                       operand[1]->integer.value,
+                                       &return_desc1->integer.value,
+                                       &return_desc2->integer.value);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
        /* Store the results to the target reference operands */
 
-       status = acpi_ex_store (return_desc2, operand[2], walk_state);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_store(return_desc2, operand[2], walk_state);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       status = acpi_ex_store (return_desc1, operand[3], walk_state);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_store(return_desc1, operand[3], walk_state);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R (
 
        walk_state->result_obj = return_desc1;
 
-
-cleanup:
+      cleanup:
        /*
         * Since the remainder is not returned indirectly, remove a reference to
         * it. Only the quotient is returned indirectly.
         */
-       acpi_ut_remove_reference (return_desc2);
+       acpi_ut_remove_reference(return_desc2);
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                /* Delete the return object */
 
-               acpi_ut_remove_reference (return_desc1);
+               acpi_ut_remove_reference(return_desc1);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_1T_1R
@@ -289,42 +271,39 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_1T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc = NULL;
-       acpi_integer                    index;
-       acpi_status                     status = AE_OK;
-       acpi_size                       length;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc = NULL;
+       acpi_integer index;
+       acpi_status status = AE_OK;
+       acpi_size length;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
 
        if (walk_state->op_info->flags & AML_MATH) {
                /* All simple math opcodes (add, etc.) */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
-                                 operand[0]->integer.value,
-                                 operand[1]->integer.value);
+               return_desc->integer.value =
+                   acpi_ex_do_math_op(walk_state->opcode,
+                                      operand[0]->integer.value,
+                                      operand[1]->integer.value);
                goto store_result_to_target;
        }
 
        switch (walk_state->opcode) {
-       case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
+       case AML_MOD_OP:        /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R (
 
                /* return_desc will contain the remainder */
 
-               status = acpi_ut_divide (operand[0]->integer.value,
-                                  operand[1]->integer.value,
-                                  NULL,
-                                  &return_desc->integer.value);
+               status = acpi_ut_divide(operand[0]->integer.value,
+                                       operand[1]->integer.value,
+                                       NULL, &return_desc->integer.value);
                break;
 
+       case AML_CONCAT_OP:     /* Concatenate (Data1, Data2, Result) */
 
-       case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
-
-               status = acpi_ex_do_concatenate (operand[0], operand[1],
-                                &return_desc, walk_state);
+               status = acpi_ex_do_concatenate(operand[0], operand[1],
+                                               &return_desc, walk_state);
                break;
 
-
-       case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
+       case AML_TO_STRING_OP:  /* to_string (Buffer, Length, Result) (ACPI 2.0) */
 
                /*
                 * Input object is guaranteed to be a buffer at this point (it may have
@@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R (
                 */
                length = 0;
                while ((length < operand[0]->buffer.length) &&
-                          (length < operand[1]->integer.value) &&
-                          (operand[0]->buffer.pointer[length])) {
+                      (length < operand[1]->integer.value) &&
+                      (operand[0]->buffer.pointer[length])) {
                        length++;
                        if (length > ACPI_MAX_STRING_CONVERSION) {
                                status = AE_AML_STRING_LIMIT;
@@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R (
 
                /* Allocate a new string object */
 
-               return_desc = acpi_ut_create_string_object (length);
+               return_desc = acpi_ut_create_string_object(length);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
                }
 
-               /* Copy the raw buffer data with no transform. NULL terminated already*/
+               /* Copy the raw buffer data with no transform. NULL terminated already */
 
-               ACPI_MEMCPY (return_desc->string.pointer,
-                       operand[0]->buffer.pointer, length);
+               ACPI_MEMCPY(return_desc->string.pointer,
+                           operand[0]->buffer.pointer, length);
                break;
 
-
        case AML_CONCAT_RES_OP:
 
                /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
 
-               status = acpi_ex_concat_template (operand[0], operand[1],
-                                &return_desc, walk_state);
+               status = acpi_ex_concat_template(operand[0], operand[1],
+                                                &return_desc, walk_state);
                break;
 
-
-       case AML_INDEX_OP:              /* Index (Source Index Result) */
+       case AML_INDEX_OP:      /* Index (Source Index Result) */
 
                /* Create the internal return object */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+               return_desc =
+                   acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R (
 
                /* At this point, the Source operand is a Package, Buffer, or String */
 
-               if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
+               if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
                        /* Object to be indexed is a Package */
 
                        if (index >= operand[0]->package.count) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Index value (%X%8.8X) beyond package end (%X)\n",
-                                       ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Index value (%X%8.8X) beyond package end (%X)\n",
+                                                 ACPI_FORMAT_UINT64(index),
+                                                 operand[0]->package.count));
                                status = AE_AML_PACKAGE_LIMIT;
                                goto cleanup;
                        }
 
                        return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
-                       return_desc->reference.object    = operand[0];
-                       return_desc->reference.where     = &operand[0]->package.elements [
-                                         index];
-               }
-               else {
+                       return_desc->reference.object = operand[0];
+                       return_desc->reference.where =
+                           &operand[0]->package.elements[index];
+               } else {
                        /* Object to be indexed is a Buffer/String */
 
                        if (index >= operand[0]->buffer.length) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Index value (%X%8.8X) beyond end of buffer (%X)\n",
-                                       ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Index value (%X%8.8X) beyond end of buffer (%X)\n",
+                                                 ACPI_FORMAT_UINT64(index),
+                                                 operand[0]->buffer.length));
                                status = AE_AML_BUFFER_LIMIT;
                                goto cleanup;
                        }
 
-                       return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
-                       return_desc->reference.object    = operand[0];
+                       return_desc->reference.target_type =
+                           ACPI_TYPE_BUFFER_FIELD;
+                       return_desc->reference.object = operand[0];
                }
 
                /*
                 * Add a reference to the target package/buffer/string for the life
                 * of the index.
                 */
-               acpi_ut_add_reference (operand[0]);
+               acpi_ut_add_reference(operand[0]);
 
                /* Complete the Index reference object */
 
-               return_desc->reference.opcode    = AML_INDEX_OP;
-               return_desc->reference.offset    = (u32) index;
+               return_desc->reference.opcode = AML_INDEX_OP;
+               return_desc->reference.offset = (u32) index;
 
                /* Store the reference to the Target */
 
-               status = acpi_ex_store (return_desc, operand[2], walk_state);
+               status = acpi_ex_store(return_desc, operand[2], walk_state);
 
                /* Return the reference */
 
                walk_state->result_obj = return_desc;
                goto cleanup;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                break;
        }
 
+      store_result_to_target:
 
-store_result_to_target:
-
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                /*
                 * Store the result of the operation (which is now in return_desc) into
                 * the Target descriptor.
                 */
-               status = acpi_ex_store (return_desc, operand[2], walk_state);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ex_store(return_desc, operand[2], walk_state);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
@@ -490,19 +464,17 @@ store_result_to_target:
                }
        }
 
-
-cleanup:
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(return_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_2A_0T_1R
@@ -515,23 +487,19 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_2A_0T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc = NULL;
-       acpi_status                     status = AE_OK;
-       u8                              logical_result = FALSE;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc = NULL;
+       acpi_status status = AE_OK;
+       u8 logical_result = FALSE;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Create the internal return object */
 
-       return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!return_desc) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R (
        if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
                /* logical_op (Operand0, Operand1) */
 
-               status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
-                                 operand[0]->integer.value, operand[1]->integer.value,
-                                 &logical_result);
+               status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
+                                                      operand[0]->integer.
+                                                      value,
+                                                      operand[1]->integer.
+                                                      value, &logical_result);
                goto store_logical_result;
-       }
-       else if (walk_state->op_info->flags & AML_LOGICAL) {
+       } else if (walk_state->op_info->flags & AML_LOGICAL) {
                /* logical_op (Operand0, Operand1) */
 
-               status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
-                                operand[1], &logical_result);
+               status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
+                                              operand[1], &logical_result);
                goto store_logical_result;
        }
 
        switch (walk_state->opcode) {
-       case AML_ACQUIRE_OP:            /* Acquire (mutex_object, Timeout) */
+       case AML_ACQUIRE_OP:    /* Acquire (mutex_object, Timeout) */
 
-               status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
+               status =
+                   acpi_ex_acquire_mutex(operand[1], operand[0], walk_state);
                if (status == AE_TIME) {
-                       logical_result = TRUE;      /* TRUE = Acquire timed out */
+                       logical_result = TRUE;  /* TRUE = Acquire timed out */
                        status = AE_OK;
                }
                break;
 
+       case AML_WAIT_OP:       /* Wait (event_object, Timeout) */
 
-       case AML_WAIT_OP:               /* Wait (event_object, Timeout) */
-
-               status = acpi_ex_system_wait_event (operand[1], operand[0]);
+               status = acpi_ex_system_wait_event(operand[1], operand[0]);
                if (status == AE_TIME) {
-                       logical_result = TRUE;      /* TRUE, Wait timed out */
+                       logical_result = TRUE;  /* TRUE, Wait timed out */
                        status = AE_OK;
                }
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n",
-                       walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
-
-store_logical_result:
+      store_logical_result:
        /*
         * Set return value to according to logical_result. logical TRUE (all ones)
         * Default is FALSE (zero)
@@ -596,16 +562,13 @@ store_logical_result:
 
        walk_state->result_obj = return_desc;
 
-
-cleanup:
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(return_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 23b068adbf5806217011de9ada3aa04d77f745f8..483365777670d00a2100ac81de158167e7fe13b4 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exoparg3")
-
+ACPI_MODULE_NAME("exoparg3")
 
 /*!
  * Naming convention for AML interpreter execution routines.
@@ -74,8 +71,6 @@
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_3A_0T_0R
  * DESCRIPTION: Execute Triadic operator (3 operands)
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_opcode_3A_0T_0R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       struct acpi_signal_fatal_info   *fatal;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       struct acpi_signal_fatal_info *fatal;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
-       case AML_FATAL_OP:          /* Fatal (fatal_type fatal_code fatal_arg) */
+       case AML_FATAL_OP:      /* Fatal (fatal_type fatal_code fatal_arg) */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
-                       (u32) operand[0]->integer.value,
-                       (u32) operand[1]->integer.value,
-                       (u32) operand[2]->integer.value));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
+                                 (u32) operand[0]->integer.value,
+                                 (u32) operand[1]->integer.value,
+                                 (u32) operand[2]->integer.value));
 
-               fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info));
+               fatal =
+                   ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
                if (fatal) {
-                       fatal->type     = (u32) operand[0]->integer.value;
-                       fatal->code     = (u32) operand[1]->integer.value;
+                       fatal->type = (u32) operand[0]->integer.value;
+                       fatal->code = (u32) operand[1]->integer.value;
                        fatal->argument = (u32) operand[2]->integer.value;
                }
 
                /* Always signal the OS! */
 
-               status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
+               status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal);
 
                /* Might return while OS is shutting down, just continue */
 
-               ACPI_MEM_FREE (fatal);
+               ACPI_MEM_FREE(fatal);
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
+      cleanup:
 
-cleanup:
-
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_3A_1T_1R
@@ -154,31 +141,28 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_3A_1T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc = NULL;
-       char                            *buffer;
-       acpi_status                     status = AE_OK;
-       acpi_integer                    index;
-       acpi_size                       length;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc = NULL;
+       char *buffer = NULL;
+       acpi_status status = AE_OK;
+       acpi_integer index;
+       acpi_size length;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
-       case AML_MID_OP:    /* Mid (Source[0], Index[1], Length[2], Result[3]) */
+       case AML_MID_OP:        /* Mid (Source[0], Index[1], Length[2], Result[3]) */
 
                /*
                 * Create the return object.  The Source operand is guaranteed to be
                 * either a String or a Buffer, so just use its type.
                 */
-               return_desc = acpi_ut_create_internal_object (
-                                 ACPI_GET_OBJECT_TYPE (operand[0]));
+               return_desc =
+                   acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
+                                                  (operand[0]));
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -193,67 +177,92 @@ acpi_ex_opcode_3A_1T_1R (
                 * If the index is beyond the length of the String/Buffer, or if the
                 * requested length is zero, return a zero-length String/Buffer
                 */
-               if ((index < operand[0]->string.length) &&
-                       (length > 0)) {
-                       /* Truncate request if larger than the actual String/Buffer */
-
-                       if ((index + length) >
-                               operand[0]->string.length) {
-                               length = (acpi_size) operand[0]->string.length -
-                                                (acpi_size) index;
-                       }
+               if (index >= operand[0]->string.length) {
+                       length = 0;
+               }
+
+               /* Truncate request if larger than the actual String/Buffer */
+
+               else if ((index + length) > operand[0]->string.length) {
+                       length = (acpi_size) operand[0]->string.length -
+                           (acpi_size) index;
+               }
+
+               /* Strings always have a sub-pointer, not so for buffers */
+
+               switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
+               case ACPI_TYPE_STRING:
 
-                       /* Allocate a new buffer for the String/Buffer */
+                       /* Always allocate a new buffer for the String */
 
-                       buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
+                       buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1);
                        if (!buffer) {
                                status = AE_NO_MEMORY;
                                goto cleanup;
                        }
+                       break;
 
-                       /* Copy the portion requested */
+               case ACPI_TYPE_BUFFER:
 
-                       ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
-                                         length);
+                       /* If the requested length is zero, don't allocate a buffer */
 
-                       /* Set the length of the new String/Buffer */
+                       if (length > 0) {
+                               /* Allocate a new buffer for the Buffer */
 
-                       return_desc->string.pointer = buffer;
-                       return_desc->string.length = (u32) length;
+                               buffer = ACPI_MEM_CALLOCATE(length);
+                               if (!buffer) {
+                                       status = AE_NO_MEMORY;
+                                       goto cleanup;
+                               }
+                       }
+                       break;
+
+               default:        /* Should not happen */
+
+                       status = AE_AML_OPERAND_TYPE;
+                       goto cleanup;
                }
 
+               if (length > 0) {
+                       /* Copy the portion requested */
+
+                       ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
+                                   length);
+               }
+
+               /* Set the length of the new String/Buffer */
+
+               return_desc->string.pointer = buffer;
+               return_desc->string.length = (u32) length;
+
                /* Mark buffer initialized */
 
                return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
        /* Store the result in the target */
 
-       status = acpi_ex_store (return_desc, operand[3], walk_state);
+       status = acpi_ex_store(return_desc, operand[3], walk_state);
 
-cleanup:
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status) || walk_state->result_obj) {
+               acpi_ut_remove_reference(return_desc);
        }
 
        /* Set the return object and exit */
 
-       if (!walk_state->result_obj) {
+       else {
                walk_state->result_obj = return_desc;
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 17f81d42ee414cff65da0dd8dcbd8347464f5278..5dee771395769a54349ac3ce1cf34431d15c3a3a 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exoparg6")
-
+ACPI_MODULE_NAME("exoparg6")
 
 /*!
  * Naming convention for AML interpreter execution routines.
  * The AcpiExOpcode* functions are called via the Dispatcher component with
  * fully resolved operands.
 !*/
-
 /* Local prototypes */
-
 static u8
-acpi_ex_do_match (
-       u32                             match_op,
-       union acpi_operand_object       *package_obj,
-       union acpi_operand_object       *match_obj);
-
+acpi_ex_do_match(u32 match_op,
+                union acpi_operand_object *package_obj,
+                union acpi_operand_object *match_obj);
 
 /*******************************************************************************
  *
@@ -101,14 +94,12 @@ acpi_ex_do_match (
  ******************************************************************************/
 
 static u8
-acpi_ex_do_match (
-       u32                             match_op,
-       union acpi_operand_object       *package_obj,
-       union acpi_operand_object       *match_obj)
+acpi_ex_do_match(u32 match_op,
+                union acpi_operand_object *package_obj,
+                union acpi_operand_object *match_obj)
 {
-       u8                              logical_result = TRUE;
-       acpi_status                     status;
-
+       u8 logical_result = TRUE;
+       acpi_status status;
 
        /*
         * Note: Since the package_obj/match_obj ordering is opposite to that of
@@ -133,9 +124,10 @@ acpi_ex_do_match (
                 * True if equal: (P[i] == M)
                 * Change to:     (M == P[i])
                 */
-               status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj,
-                                &logical_result);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
+                                         &logical_result);
+               if (ACPI_FAILURE(status)) {
                        return (FALSE);
                }
                break;
@@ -146,12 +138,13 @@ acpi_ex_do_match (
                 * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
                 * Change to:                  (M >= P[i]) (M not_less than P[i])
                 */
-               status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
-                                &logical_result);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
+                                         &logical_result);
+               if (ACPI_FAILURE(status)) {
                        return (FALSE);
                }
-               logical_result = (u8) !logical_result;
+               logical_result = (u8) ! logical_result;
                break;
 
        case MATCH_MLT:
@@ -160,9 +153,10 @@ acpi_ex_do_match (
                 * True if less than: (P[i] < M)
                 * Change to:         (M > P[i])
                 */
-               status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
-                                &logical_result);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
+                                         package_obj, &logical_result);
+               if (ACPI_FAILURE(status)) {
                        return (FALSE);
                }
                break;
@@ -173,12 +167,13 @@ acpi_ex_do_match (
                 * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
                 * Change to:                     (M <= P[i]) (M not_greater than P[i])
                 */
-               status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
-                                &logical_result);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
+                                         package_obj, &logical_result);
+               if (ACPI_FAILURE(status)) {
                        return (FALSE);
                }
-               logical_result = (u8)!logical_result;
+               logical_result = (u8) ! logical_result;
                break;
 
        case MATCH_MGT:
@@ -187,9 +182,10 @@ acpi_ex_do_match (
                 * True if greater than: (P[i] > M)
                 * Change to:            (M < P[i])
                 */
-               status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
-                                &logical_result);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
+                                         &logical_result);
+               if (ACPI_FAILURE(status)) {
                        return (FALSE);
                }
                break;
@@ -204,7 +200,6 @@ acpi_ex_do_match (
        return logical_result;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_opcode_6A_0T_1R
@@ -217,20 +212,16 @@ acpi_ex_do_match (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_opcode_6A_0T_1R (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
 {
-       union acpi_operand_object       **operand = &walk_state->operands[0];
-       union acpi_operand_object       *return_desc = NULL;
-       acpi_status                     status = AE_OK;
-       acpi_integer                    index;
-       union acpi_operand_object       *this_element;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
-               acpi_ps_get_opcode_name (walk_state->opcode));
+       union acpi_operand_object **operand = &walk_state->operands[0];
+       union acpi_operand_object *return_desc = NULL;
+       acpi_status status = AE_OK;
+       acpi_integer index;
+       union acpi_operand_object *this_element;
 
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
+                               acpi_ps_get_opcode_name(walk_state->opcode));
 
        switch (walk_state->opcode) {
        case AML_MATCH_OP:
@@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R (
                /* Validate both Match Term Operators (MTR, MEQ, etc.) */
 
                if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
-                       (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n"));
+                   (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Match operator out of range\n"));
                        status = AE_AML_OPERAND_VALUE;
                        goto cleanup;
                }
@@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R (
 
                index = operand[5]->integer.value;
                if (index >= operand[0]->package.count) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Index (%X%8.8X) beyond package end (%X)\n",
-                               ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Index (%X%8.8X) beyond package end (%X)\n",
+                                         ACPI_FORMAT_UINT64(index),
+                                         operand[0]->package.count));
                        status = AE_AML_PACKAGE_LIMIT;
                        goto cleanup;
                }
 
                /* Create an integer for the return value */
 
-               return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+               return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
                if (!return_desc) {
                        status = AE_NO_MEMORY;
                        goto cleanup;
@@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R (
                 * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
                 * match was found.
                 */
-               for ( ; index < operand[0]->package.count; index++) {
+               for (; index < operand[0]->package.count; index++) {
                        /* Get the current package element */
 
                        this_element = operand[0]->package.elements[index];
@@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R (
                         * (proceed to next iteration of enclosing for loop) signifies a
                         * non-match.
                         */
-                       if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
-                                          this_element, operand[2])) {
+                       if (!acpi_ex_do_match((u32) operand[1]->integer.value,
+                                             this_element, operand[2])) {
                                continue;
                        }
 
-                       if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
-                                          this_element, operand[4])) {
+                       if (!acpi_ex_do_match((u32) operand[3]->integer.value,
+                                             this_element, operand[4])) {
                                continue;
                        }
 
@@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R (
                }
                break;
 
-
        case AML_LOAD_TABLE_OP:
 
-               status = acpi_ex_load_table_op (walk_state, &return_desc);
+               status = acpi_ex_load_table_op(walk_state, &return_desc);
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
-                               walk_state->opcode));
+               ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
                status = AE_AML_BAD_OPCODE;
                goto cleanup;
        }
 
        walk_state->result_obj = return_desc;
 
-
-cleanup:
+      cleanup:
 
        /* Delete return object on error */
 
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_remove_reference (return_desc);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_remove_reference(return_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
index c9e3c68b554996c7c51b1f9b928ee75f239fa7d0..7476c363e407e30b9f67c899bcfdeaa068ee8aed 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exprep")
+ACPI_MODULE_NAME("exprep")
 
 /* Local prototypes */
-
 static u32
-acpi_ex_decode_field_access (
-       union acpi_operand_object       *obj_desc,
-       u8                              field_flags,
-       u32                             *return_byte_alignment);
-
+acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
+                           u8 field_flags, u32 * return_byte_alignment);
 
 #ifdef ACPI_UNDER_DEVELOPMENT
 
 static u32
-acpi_ex_generate_access (
-       u32                             field_bit_offset,
-       u32                             field_bit_length,
-       u32                             region_length);
+acpi_ex_generate_access(u32 field_bit_offset,
+                       u32 field_bit_length, u32 region_length);
 
 /*******************************************************************************
  *
@@ -92,39 +84,36 @@ acpi_ex_generate_access (
  ******************************************************************************/
 
 static u32
-acpi_ex_generate_access (
-       u32                             field_bit_offset,
-       u32                             field_bit_length,
-       u32                             region_length)
+acpi_ex_generate_access(u32 field_bit_offset,
+                       u32 field_bit_length, u32 region_length)
 {
-       u32                             field_byte_length;
-       u32                             field_byte_offset;
-       u32                             field_byte_end_offset;
-       u32                             access_byte_width;
-       u32                             field_start_offset;
-       u32                             field_end_offset;
-       u32                             minimum_access_width = 0xFFFFFFFF;
-       u32                             minimum_accesses = 0xFFFFFFFF;
-       u32                             accesses;
-
-
-       ACPI_FUNCTION_TRACE ("ex_generate_access");
-
+       u32 field_byte_length;
+       u32 field_byte_offset;
+       u32 field_byte_end_offset;
+       u32 access_byte_width;
+       u32 field_start_offset;
+       u32 field_end_offset;
+       u32 minimum_access_width = 0xFFFFFFFF;
+       u32 minimum_accesses = 0xFFFFFFFF;
+       u32 accesses;
+
+       ACPI_FUNCTION_TRACE("ex_generate_access");
 
        /* Round Field start offset and length to "minimal" byte boundaries */
 
-       field_byte_offset  = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
-       field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
-                          field_bit_offset, 8));
-       field_byte_length  = field_byte_end_offset - field_byte_offset;
+       field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
+       field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length +
+                                                        field_bit_offset, 8));
+       field_byte_length = field_byte_end_offset - field_byte_offset;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "Bit length %d, Bit offset %d\n",
-                       field_bit_length, field_bit_offset));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "Bit length %d, Bit offset %d\n",
+                         field_bit_length, field_bit_offset));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "Byte Length %d, Byte Offset %d, End Offset %d\n",
-                       field_byte_length, field_byte_offset, field_byte_end_offset));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "Byte Length %d, Byte Offset %d, End Offset %d\n",
+                         field_byte_length, field_byte_offset,
+                         field_byte_end_offset));
 
        /*
         * Iterative search for the maximum access width that is both aligned
@@ -132,7 +121,8 @@ acpi_ex_generate_access (
         *
         * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
         */
-       for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
+       for (access_byte_width = 1; access_byte_width <= 8;
+            access_byte_width <<= 1) {
                /*
                 * 1) Round end offset up to next access boundary and make sure that
                 *    this does not go beyond the end of the parent region.
@@ -140,31 +130,37 @@ acpi_ex_generate_access (
                 *    are done. (This does not optimize for the perfectly aligned
                 *    case yet).
                 */
-               if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
+               if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <=
+                   region_length) {
                        field_start_offset =
-                               ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
-                               access_byte_width;
+                           ACPI_ROUND_DOWN(field_byte_offset,
+                                           access_byte_width) /
+                           access_byte_width;
 
                        field_end_offset =
-                               ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
-                                       access_byte_width) / access_byte_width;
+                           ACPI_ROUND_UP((field_byte_length +
+                                          field_byte_offset),
+                                         access_byte_width) /
+                           access_byte_width;
 
                        accesses = field_end_offset - field_start_offset;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                                       "access_width %d end is within region\n", access_byte_width));
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "access_width %d end is within region\n",
+                                         access_byte_width));
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                                       "Field Start %d, Field End %d -- requires %d accesses\n",
-                                       field_start_offset, field_end_offset, accesses));
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Field Start %d, Field End %d -- requires %d accesses\n",
+                                         field_start_offset, field_end_offset,
+                                         accesses));
 
                        /* Single access is optimal */
 
                        if (accesses <= 1) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                                       "Entire field can be accessed with one operation of size %d\n",
-                                       access_byte_width));
-                               return_VALUE (access_byte_width);
+                               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                                 "Entire field can be accessed with one operation of size %d\n",
+                                                 access_byte_width));
+                               return_VALUE(access_byte_width);
                        }
 
                        /*
@@ -172,30 +168,30 @@ acpi_ex_generate_access (
                         * try the next wider access on next iteration
                         */
                        if (accesses < minimum_accesses) {
-                               minimum_accesses   = accesses;
+                               minimum_accesses = accesses;
                                minimum_access_width = access_byte_width;
                        }
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                               "access_width %d end is NOT within region\n", access_byte_width));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "access_width %d end is NOT within region\n",
+                                         access_byte_width));
                        if (access_byte_width == 1) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                                               "Field goes beyond end-of-region!\n"));
+                               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                                 "Field goes beyond end-of-region!\n"));
 
                                /* Field does not fit in the region at all */
 
-                               return_VALUE (0);
+                               return_VALUE(0);
                        }
 
                        /*
                         * This width goes beyond the end-of-region, back off to
                         * previous access
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                                       "Backing off to previous optimal access width of %d\n",
-                                       minimum_access_width));
-                       return_VALUE (minimum_access_width);
+                       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                         "Backing off to previous optimal access width of %d\n",
+                                         minimum_access_width));
+                       return_VALUE(minimum_access_width);
                }
        }
 
@@ -203,12 +199,11 @@ acpi_ex_generate_access (
         * Could not read/write field with one operation,
         * just use max access width
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "Cannot access field in one operation, using width 8\n"));
-       return_VALUE (8);
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "Cannot access field in one operation, using width 8\n"));
+       return_VALUE(8);
 }
-#endif /* ACPI_UNDER_DEVELOPMENT */
-
+#endif                         /* ACPI_UNDER_DEVELOPMENT */
 
 /*******************************************************************************
  *
@@ -226,18 +221,14 @@ acpi_ex_generate_access (
  ******************************************************************************/
 
 static u32
-acpi_ex_decode_field_access (
-       union acpi_operand_object       *obj_desc,
-       u8                              field_flags,
-       u32                             *return_byte_alignment)
+acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
+                           u8 field_flags, u32 * return_byte_alignment)
 {
-       u32                             access;
-       u32                             byte_alignment;
-       u32                             bit_length;
-
-
-       ACPI_FUNCTION_TRACE ("ex_decode_field_access");
+       u32 access;
+       u32 byte_alignment;
+       u32 bit_length;
 
+       ACPI_FUNCTION_TRACE("ex_decode_field_access");
 
        access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
 
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access (
 
 #ifdef ACPI_UNDER_DEVELOPMENT
                byte_alignment =
-                       acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
-                               obj_desc->common_field.bit_length,
-                               0xFFFFFFFF /* Temp until we pass region_length as parameter */);
+                   acpi_ex_generate_access(obj_desc->common_field.
+                                           start_field_bit_offset,
+                                           obj_desc->common_field.bit_length,
+                                           0xFFFFFFFF
+                                           /* Temp until we pass region_length as parameter */
+                                           );
                bit_length = byte_alignment * 8;
 #endif
 
@@ -257,36 +251,35 @@ acpi_ex_decode_field_access (
                break;
 
        case AML_FIELD_ACCESS_BYTE:
-       case AML_FIELD_ACCESS_BUFFER:   /* ACPI 2.0 (SMBus Buffer) */
+       case AML_FIELD_ACCESS_BUFFER:   /* ACPI 2.0 (SMBus Buffer) */
                byte_alignment = 1;
-               bit_length    = 8;
+               bit_length = 8;
                break;
 
        case AML_FIELD_ACCESS_WORD:
                byte_alignment = 2;
-               bit_length    = 16;
+               bit_length = 16;
                break;
 
        case AML_FIELD_ACCESS_DWORD:
                byte_alignment = 4;
-               bit_length    = 32;
+               bit_length = 32;
                break;
 
-       case AML_FIELD_ACCESS_QWORD:    /* ACPI 2.0 */
+       case AML_FIELD_ACCESS_QWORD:    /* ACPI 2.0 */
                byte_alignment = 8;
-               bit_length    = 64;
+               bit_length = 64;
                break;
 
        default:
                /* Invalid field access type */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown field access type %X\n",
-                       access));
-               return_VALUE (0);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown field access type %X\n", access));
+               return_VALUE(0);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
                /*
                 * buffer_field access can be on any byte boundary, so the
                 * byte_alignment is always 1 byte -- regardless of any byte_alignment
@@ -296,10 +289,9 @@ acpi_ex_decode_field_access (
        }
 
        *return_byte_alignment = byte_alignment;
-       return_VALUE (bit_length);
+       return_VALUE(bit_length);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_prep_common_field_object
@@ -322,20 +314,16 @@ acpi_ex_decode_field_access (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_prep_common_field_object (
-       union acpi_operand_object       *obj_desc,
-       u8                              field_flags,
-       u8                              field_attribute,
-       u32                             field_bit_position,
-       u32                             field_bit_length)
+acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
+                                u8 field_flags,
+                                u8 field_attribute,
+                                u32 field_bit_position, u32 field_bit_length)
 {
-       u32                             access_bit_width;
-       u32                             byte_alignment;
-       u32                             nearest_byte_address;
-
-
-       ACPI_FUNCTION_TRACE ("ex_prep_common_field_object");
+       u32 access_bit_width;
+       u32 byte_alignment;
+       u32 nearest_byte_address;
 
+       ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
 
        /*
         * Note: the structure being initialized is the
@@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object (
         * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
         * the same (equivalent) as the byte_alignment.
         */
-       access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags,
-                         &byte_alignment);
+       access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags,
+                                                      &byte_alignment);
        if (!access_bit_width) {
-               return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+               return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
 
        /* Setup width (access granularity) fields */
 
        obj_desc->common_field.access_byte_width = (u8)
-                       ACPI_DIV_8 (access_bit_width);          /* 1,  2,  4,  8 */
+           ACPI_DIV_8(access_bit_width);       /* 1,  2,  4,  8 */
 
        obj_desc->common_field.access_bit_width = (u8) access_bit_width;
 
@@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object (
         * region or buffer.
         */
        nearest_byte_address =
-                       ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
+           ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position);
        obj_desc->common_field.base_byte_offset = (u32)
-                       ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
+           ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment);
 
        /*
         * start_field_bit_offset is the offset of the first bit of the field within
         * a field datum.
         */
        obj_desc->common_field.start_field_bit_offset = (u8)
-               (field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
+           (field_bit_position -
+            ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
 
        /*
         * Does the entire field fit within a single field access element? (datum)
         * (i.e., without crossing a datum boundary)
         */
-       if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
-                       (u16) access_bit_width) {
+       if ((obj_desc->common_field.start_field_bit_offset +
+            field_bit_length) <= (u16) access_bit_width) {
                obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_prep_field_value
@@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_prep_field_value (
-       struct acpi_create_field_info   *info)
+acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 {
-       union acpi_operand_object       *obj_desc;
-       u32                             type;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ex_prep_field_value");
+       union acpi_operand_object *obj_desc;
+       u32 type;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_prep_field_value");
 
        /* Parameter validation */
 
        if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
                if (!info->region_node) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n"));
-                       return_ACPI_STATUS (AE_AML_NO_OPERAND);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n"));
+                       return_ACPI_STATUS(AE_AML_NO_OPERAND);
                }
 
-               type = acpi_ns_get_type (info->region_node);
+               type = acpi_ns_get_type(info->region_node);
                if (type != ACPI_TYPE_REGION) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Needed Region, found type %X (%s)\n",
-                               type, acpi_ut_get_type_name (type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Needed Region, found type %X (%s)\n",
+                                         type, acpi_ut_get_type_name(type)));
 
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
        }
 
        /* Allocate a new field object */
 
-       obj_desc = acpi_ut_create_internal_object (info->field_type);
+       obj_desc = acpi_ut_create_internal_object(info->field_type);
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Initialize areas of the object that are common to all fields */
 
        obj_desc->common_field.node = info->field_node;
-       status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags,
-                        info->attribute, info->field_bit_position, info->field_bit_length);
-       if (ACPI_FAILURE (status)) {
-               acpi_ut_delete_object_desc (obj_desc);
-               return_ACPI_STATUS (status);
+       status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags,
+                                                 info->attribute,
+                                                 info->field_bit_position,
+                                                 info->field_bit_length);
+       if (ACPI_FAILURE(status)) {
+               acpi_ut_delete_object_desc(obj_desc);
+               return_ACPI_STATUS(status);
        }
 
        /* Initialize areas of the object that are specific to the field type */
@@ -474,71 +460,73 @@ acpi_ex_prep_field_value (
        switch (info->field_type) {
        case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-               obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
+               obj_desc->field.region_obj =
+                   acpi_ns_get_attached_object(info->region_node);
 
                /* An additional reference for the container */
 
-               acpi_ut_add_reference (obj_desc->field.region_obj);
+               acpi_ut_add_reference(obj_desc->field.region_obj);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
-                       obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
-                       obj_desc->field.access_byte_width, obj_desc->field.region_obj));
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                 "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
+                                 obj_desc->field.start_field_bit_offset,
+                                 obj_desc->field.base_byte_offset,
+                                 obj_desc->field.access_byte_width,
+                                 obj_desc->field.region_obj));
                break;
 
-
        case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-               obj_desc->bank_field.value   = info->bank_value;
-               obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
-                                info->region_node);
-               obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
-                                info->register_node);
+               obj_desc->bank_field.value = info->bank_value;
+               obj_desc->bank_field.region_obj =
+                   acpi_ns_get_attached_object(info->region_node);
+               obj_desc->bank_field.bank_obj =
+                   acpi_ns_get_attached_object(info->register_node);
 
                /* An additional reference for the attached objects */
 
-               acpi_ut_add_reference (obj_desc->bank_field.region_obj);
-               acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
+               acpi_ut_add_reference(obj_desc->bank_field.region_obj);
+               acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
-                       obj_desc->bank_field.start_field_bit_offset,
-                       obj_desc->bank_field.base_byte_offset,
-                       obj_desc->field.access_byte_width,
-                       obj_desc->bank_field.region_obj,
-                       obj_desc->bank_field.bank_obj));
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                 "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
+                                 obj_desc->bank_field.start_field_bit_offset,
+                                 obj_desc->bank_field.base_byte_offset,
+                                 obj_desc->field.access_byte_width,
+                                 obj_desc->bank_field.region_obj,
+                                 obj_desc->bank_field.bank_obj));
                break;
 
-
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
-                                info->register_node);
-               obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
-                                info->data_register_node);
-               obj_desc->index_field.value  = (u32)
-                       (info->field_bit_position / ACPI_MUL_8 (
-                                         obj_desc->field.access_byte_width));
-
-               if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
-                       ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
-                       acpi_ut_delete_object_desc (obj_desc);
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
+               obj_desc->index_field.index_obj =
+                   acpi_ns_get_attached_object(info->register_node);
+               obj_desc->index_field.data_obj =
+                   acpi_ns_get_attached_object(info->data_register_node);
+               obj_desc->index_field.value = (u32)
+                   (info->field_bit_position /
+                    ACPI_MUL_8(obj_desc->field.access_byte_width));
+
+               if (!obj_desc->index_field.data_obj
+                   || !obj_desc->index_field.index_obj) {
+                       ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
+                       acpi_ut_delete_object_desc(obj_desc);
+                       return_ACPI_STATUS(AE_AML_INTERNAL);
                }
 
                /* An additional reference for the attached objects */
 
-               acpi_ut_add_reference (obj_desc->index_field.data_obj);
-               acpi_ut_add_reference (obj_desc->index_field.index_obj);
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
-                       "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
-                       obj_desc->index_field.start_field_bit_offset,
-                       obj_desc->index_field.base_byte_offset,
-                       obj_desc->index_field.value,
-                       obj_desc->field.access_byte_width,
-                       obj_desc->index_field.index_obj,
-                       obj_desc->index_field.data_obj));
+               acpi_ut_add_reference(obj_desc->index_field.data_obj);
+               acpi_ut_add_reference(obj_desc->index_field.index_obj);
+
+               ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                                 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
+                                 obj_desc->index_field.start_field_bit_offset,
+                                 obj_desc->index_field.base_byte_offset,
+                                 obj_desc->index_field.value,
+                                 obj_desc->field.access_byte_width,
+                                 obj_desc->index_field.index_obj,
+                                 obj_desc->index_field.data_obj));
                break;
 
        default:
@@ -550,15 +538,16 @@ acpi_ex_prep_field_value (
         * Store the constructed descriptor (obj_desc) into the parent Node,
         * preserving the current type of that named_obj.
         */
-       status = acpi_ns_attach_object (info->field_node, obj_desc,
-                         acpi_ns_get_type (info->field_node));
+       status = acpi_ns_attach_object(info->field_node, obj_desc,
+                                      acpi_ns_get_type(info->field_node));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n",
-                       info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc));
+       ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
+                         "Set named_obj %p [%4.4s], obj_desc %p\n",
+                         info->field_node,
+                         acpi_ut_get_node_name(info->field_node), obj_desc));
 
        /* Remove local reference to the object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
-
index 723aaef4bb4a53855e0ba68595462c5558ba1e9e..9a2f5bea3afe9618bbb5de54614683672d28629b 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exregion")
-
+ACPI_MODULE_NAME("exregion")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Handler for the System Memory address space (Op Region)
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_system_memory_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_system_memory_space_handler(u32 function,
+                                   acpi_physical_address address,
+                                   u32 bit_width,
+                                   acpi_integer * value,
+                                   void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-       void                            *logical_addr_ptr = NULL;
-       struct acpi_mem_space_context   *mem_info = region_context;
-       u32                             length;
-       acpi_size                       window_size;
+       acpi_status status = AE_OK;
+       void *logical_addr_ptr = NULL;
+       struct acpi_mem_space_context *mem_info = region_context;
+       u32 length;
+       acpi_size window_size;
 #ifndef ACPI_MISALIGNED_TRANSFERS
-       u32                             remainder;
+       u32 remainder;
 #endif
 
-       ACPI_FUNCTION_TRACE ("ex_system_memory_space_handler");
-
+       ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
 
        /* Validate and translate the bit width */
 
@@ -110,9 +103,10 @@ acpi_ex_system_memory_space_handler (
                break;
 
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n",
-                       bit_width));
-               return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid system_memory width %d\n",
+                                 bit_width));
+               return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
 
 #ifndef ACPI_MISALIGNED_TRANSFERS
@@ -120,9 +114,10 @@ acpi_ex_system_memory_space_handler (
         * Hardware does not support non-aligned data transfers, we must verify
         * the request.
         */
-       (void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder);
+       (void)acpi_ut_short_divide((acpi_integer) address, length, NULL,
+                                  &remainder);
        if (remainder != 0) {
-               return_ACPI_STATUS (AE_AML_ALIGNMENT);
+               return_ACPI_STATUS(AE_AML_ALIGNMENT);
        }
 #endif
 
@@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler (
         *    2) Address beyond the current mapping?
         */
        if ((address < mem_info->mapped_physical_address) ||
-               (((acpi_integer) address + length) >
-                       ((acpi_integer)
-                       mem_info->mapped_physical_address + mem_info->mapped_length))) {
+           (((acpi_integer) address + length) > ((acpi_integer)
+                                                 mem_info->
+                                                 mapped_physical_address +
+                                                 mem_info->mapped_length))) {
                /*
                 * The request cannot be resolved by the current memory mapping;
                 * Delete the existing mapping and create a new one.
@@ -142,8 +138,8 @@ acpi_ex_system_memory_space_handler (
                if (mem_info->mapped_length) {
                        /* Valid mapping, delete it */
 
-                       acpi_os_unmap_memory (mem_info->mapped_logical_address,
-                                          mem_info->mapped_length);
+                       acpi_os_unmap_memory(mem_info->mapped_logical_address,
+                                            mem_info->mapped_length);
                }
 
                /*
@@ -151,7 +147,7 @@ acpi_ex_system_memory_space_handler (
                 * constrain the maximum mapping size to something reasonable.
                 */
                window_size = (acpi_size)
-                       ((mem_info->address + mem_info->length) - address);
+                   ((mem_info->address + mem_info->length) - address);
 
                if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
                        window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
@@ -159,14 +155,16 @@ acpi_ex_system_memory_space_handler (
 
                /* Create a new mapping starting at the address given */
 
-               status = acpi_os_map_memory (address, window_size,
-                                 (void **) &mem_info->mapped_logical_address);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not map memory at %8.8X%8.8X, size %X\n",
-                               ACPI_FORMAT_UINT64 (address), (u32) window_size));
+               status = acpi_os_map_memory(address, window_size,
+                                           (void **)&mem_info->
+                                           mapped_logical_address);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not map memory at %8.8X%8.8X, size %X\n",
+                                         ACPI_FORMAT_UINT64(address),
+                                         (u32) window_size));
                        mem_info->mapped_length = 0;
-                       return_ACPI_STATUS (status);
+                       return_ACPI_STATUS(status);
                }
 
                /* Save the physical address and mapping size */
@@ -180,42 +178,41 @@ acpi_ex_system_memory_space_handler (
         * access
         */
        logical_addr_ptr = mem_info->mapped_logical_address +
-                          ((acpi_integer) address -
-                                         (acpi_integer) mem_info->mapped_physical_address);
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "system_memory %d (%d width) Address=%8.8X%8.8X\n",
-                       function, bit_width,
-                       ACPI_FORMAT_UINT64 (address)));
-
-   /*
-       * Perform the memory read or write
-       *
-       * Note: For machines that do not support non-aligned transfers, the target
-       * address was checked for alignment above.  We do not attempt to break the
-       * transfer up into smaller (byte-size) chunks because the AML specifically
-       * asked for a transfer width that the hardware may require.
-       */
+           ((acpi_integer) address -
+            (acpi_integer) mem_info->mapped_physical_address);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "system_memory %d (%d width) Address=%8.8X%8.8X\n",
+                         function, bit_width, ACPI_FORMAT_UINT64(address)));
+
+       /*
+        * Perform the memory read or write
+        *
+        * Note: For machines that do not support non-aligned transfers, the target
+        * address was checked for alignment above.  We do not attempt to break the
+        * transfer up into smaller (byte-size) chunks because the AML specifically
+        * asked for a transfer width that the hardware may require.
+        */
        switch (function) {
        case ACPI_READ:
 
                *value = 0;
                switch (bit_width) {
                case 8:
-                       *value = (acpi_integer) *((u8 *) logical_addr_ptr);
+                       *value = (acpi_integer) * ((u8 *) logical_addr_ptr);
                        break;
 
                case 16:
-                       *value = (acpi_integer) *((u16 *) logical_addr_ptr);
+                       *value = (acpi_integer) * ((u16 *) logical_addr_ptr);
                        break;
 
                case 32:
-                       *value = (acpi_integer) *((u32 *) logical_addr_ptr);
+                       *value = (acpi_integer) * ((u32 *) logical_addr_ptr);
                        break;
 
 #if ACPI_MACHINE_WIDTH != 16
                case 64:
-                       *value = (acpi_integer) *((u64 *) logical_addr_ptr);
+                       *value = (acpi_integer) * ((u64 *) logical_addr_ptr);
                        break;
 #endif
                default:
@@ -228,20 +225,20 @@ acpi_ex_system_memory_space_handler (
 
                switch (bit_width) {
                case 8:
-                       *(u8 *) logical_addr_ptr = (u8) *value;
+                       *(u8 *) logical_addr_ptr = (u8) * value;
                        break;
 
                case 16:
-                       *(u16 *) logical_addr_ptr = (u16) *value;
+                       *(u16 *) logical_addr_ptr = (u16) * value;
                        break;
 
                case 32:
-                       *(u32 *) logical_addr_ptr = (u32) *value;
+                       *(u32 *) logical_addr_ptr = (u32) * value;
                        break;
 
 #if ACPI_MACHINE_WIDTH != 16
                case 64:
-                       *(u64 *) logical_addr_ptr = (u64) *value;
+                       *(u64 *) logical_addr_ptr = (u64) * value;
                        break;
 #endif
 
@@ -256,10 +253,9 @@ acpi_ex_system_memory_space_handler (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_io_space_handler
@@ -279,39 +275,35 @@ acpi_ex_system_memory_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_io_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_system_io_space_handler(u32 function,
+                               acpi_physical_address address,
+                               u32 bit_width,
+                               acpi_integer * value,
+                               void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-       u32                             value32;
+       acpi_status status = AE_OK;
+       u32 value32;
 
+       ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
 
-       ACPI_FUNCTION_TRACE ("ex_system_io_space_handler");
-
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
-                       ACPI_FORMAT_UINT64 (address)));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "system_iO %d (%d width) Address=%8.8X%8.8X\n",
+                         function, bit_width, ACPI_FORMAT_UINT64(address)));
 
        /* Decode the function parameter */
 
        switch (function) {
        case ACPI_READ:
 
-               status = acpi_os_read_port ((acpi_io_address) address,
-                                &value32, bit_width);
+               status = acpi_os_read_port((acpi_io_address) address,
+                                          &value32, bit_width);
                *value = value32;
                break;
 
        case ACPI_WRITE:
 
-               status = acpi_os_write_port ((acpi_io_address) address,
-                                (u32) *value, bit_width);
+               status = acpi_os_write_port((acpi_io_address) address,
+                                           (u32) * value, bit_width);
                break;
 
        default:
@@ -319,10 +311,9 @@ acpi_ex_system_io_space_handler (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_pci_config_space_handler
@@ -342,21 +333,17 @@ acpi_ex_system_io_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_pci_config_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_pci_config_space_handler(u32 function,
+                                acpi_physical_address address,
+                                u32 bit_width,
+                                acpi_integer * value,
+                                void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_pci_id              *pci_id;
-       u16                             pci_register;
-
-
-       ACPI_FUNCTION_TRACE ("ex_pci_config_space_handler");
+       acpi_status status = AE_OK;
+       struct acpi_pci_id *pci_id;
+       u16 pci_register;
 
+       ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
 
        /*
         *  The arguments to acpi_os(Read|Write)pci_configuration are:
@@ -370,26 +357,26 @@ acpi_ex_pci_config_space_handler (
         *  Value - input value for write, output address for read
         *
         */
-       pci_id      = (struct acpi_pci_id *) region_context;
+       pci_id = (struct acpi_pci_id *)region_context;
        pci_register = (u16) (u32) address;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
-               function, bit_width, pci_id->segment, pci_id->bus, pci_id->device,
-               pci_id->function, pci_register));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+                         function, bit_width, pci_id->segment, pci_id->bus,
+                         pci_id->device, pci_id->function, pci_register));
 
        switch (function) {
        case ACPI_READ:
 
                *value = 0;
-               status = acpi_os_read_pci_configuration (pci_id, pci_register,
-                                value, bit_width);
+               status = acpi_os_read_pci_configuration(pci_id, pci_register,
+                                                       value, bit_width);
                break;
 
        case ACPI_WRITE:
 
-               status = acpi_os_write_pci_configuration (pci_id, pci_register,
-                                *value, bit_width);
+               status = acpi_os_write_pci_configuration(pci_id, pci_register,
+                                                        *value, bit_width);
                break;
 
        default:
@@ -398,10 +385,9 @@ acpi_ex_pci_config_space_handler (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_cmos_space_handler
@@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_cmos_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_cmos_space_handler(u32 function,
+                          acpi_physical_address address,
+                          u32 bit_width,
+                          acpi_integer * value,
+                          void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("ex_cmos_space_handler");
+       ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
 
-
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_pci_bar_space_handler
@@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_pci_bar_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_pci_bar_space_handler(u32 function,
+                             acpi_physical_address address,
+                             u32 bit_width,
+                             acpi_integer * value,
+                             void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("ex_pci_bar_space_handler");
+       ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
 
-
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_data_table_space_handler
@@ -495,24 +471,20 @@ acpi_ex_pci_bar_space_handler (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_data_table_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context)
+acpi_ex_data_table_space_handler(u32 function,
+                                acpi_physical_address address,
+                                u32 bit_width,
+                                acpi_integer * value,
+                                void *handler_context, void *region_context)
 {
-       acpi_status                     status = AE_OK;
-       u32                             byte_width = ACPI_DIV_8 (bit_width);
-       u32                             i;
-       char                            *logical_addr_ptr;
-
+       acpi_status status = AE_OK;
+       u32 byte_width = ACPI_DIV_8(bit_width);
+       u32 i;
+       char *logical_addr_ptr;
 
-       ACPI_FUNCTION_TRACE ("ex_data_table_space_handler");
+       ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
 
-
-       logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
+       logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
 
        /* Perform the memory read or write */
 
@@ -520,17 +492,15 @@ acpi_ex_data_table_space_handler (
        case ACPI_READ:
 
                for (i = 0; i < byte_width; i++) {
-                       ((char *) value) [i] = logical_addr_ptr[i];
+                       ((char *)value)[i] = logical_addr_ptr[i];
                }
                break;
 
        case ACPI_WRITE:
        default:
 
-               return_ACPI_STATUS (AE_SUPPORT);
+               return_ACPI_STATUS(AE_SUPPORT);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 21d5c74fa30901f01ac9aa9eedaec706a80345b0..ff5d8f97e8eb6dfe9024b5d61ab885ba56bfa59c 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exresnte")
-
+ACPI_MODULE_NAME("exresnte")
 
 /*******************************************************************************
  *
  *      ACPI_TYPE_PACKAGE
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_resolve_node_to_value (
-       struct acpi_namespace_node      **object_ptr,
-       struct acpi_walk_state          *walk_state)
-
+acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
+                             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *source_desc;
-       union acpi_operand_object       *obj_desc = NULL;
-       struct acpi_namespace_node      *node;
-       acpi_object_type                entry_type;
-
-
-       ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value");
+       acpi_status status = AE_OK;
+       union acpi_operand_object *source_desc;
+       union acpi_operand_object *obj_desc = NULL;
+       struct acpi_namespace_node *node;
+       acpi_object_type entry_type;
 
+       ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
 
        /*
         * The stack pointer points to a struct acpi_namespace_node (Node).  Get the
         * object that is attached to the Node.
         */
-       node       = *object_ptr;
-       source_desc = acpi_ns_get_attached_object (node);
-       entry_type = acpi_ns_get_type ((acpi_handle) node);
+       node = *object_ptr;
+       source_desc = acpi_ns_get_attached_object(node);
+       entry_type = acpi_ns_get_type((acpi_handle) node);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
-                node, source_desc, acpi_ut_get_type_name (entry_type)));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
+                         node, source_desc,
+                         acpi_ut_get_type_name(entry_type)));
 
        if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
-               (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
+           (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
                /* There is always exactly one level of indirection */
 
-               node       = ACPI_CAST_PTR (struct acpi_namespace_node, node->object);
-               source_desc = acpi_ns_get_attached_object (node);
-               entry_type = acpi_ns_get_type ((acpi_handle) node);
+               node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
+               source_desc = acpi_ns_get_attached_object(node);
+               entry_type = acpi_ns_get_type((acpi_handle) node);
                *object_ptr = node;
        }
 
@@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value (
         * 2) Method locals and arguments have a pseudo-Node
         */
        if (entry_type == ACPI_TYPE_DEVICE ||
-               (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
-               return_ACPI_STATUS (AE_OK);
+           (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        if (!source_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
-                       node));
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No object attached to node %p\n", node));
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
        /*
@@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value (
        switch (entry_type) {
        case ACPI_TYPE_PACKAGE:
 
-               if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Object not a Package, type %s\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
-               status = acpi_ds_get_package_arguments (source_desc);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ds_get_package_arguments(source_desc);
+               if (ACPI_SUCCESS(status)) {
                        /* Return an additional reference to the object */
 
                        obj_desc = source_desc;
-                       acpi_ut_add_reference (obj_desc);
+                       acpi_ut_add_reference(obj_desc);
                }
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
-               if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Object not a Buffer, type %s\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
-               status = acpi_ds_get_buffer_arguments (source_desc);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ds_get_buffer_arguments(source_desc);
+               if (ACPI_SUCCESS(status)) {
                        /* Return an additional reference to the object */
 
                        obj_desc = source_desc;
-                       acpi_ut_add_reference (obj_desc);
+                       acpi_ut_add_reference(obj_desc);
                }
                break;
 
-
        case ACPI_TYPE_STRING:
 
-               if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Object not a String, type %s\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /* Return an additional reference to the object */
 
                obj_desc = source_desc;
-               acpi_ut_add_reference (obj_desc);
+               acpi_ut_add_reference(obj_desc);
                break;
 
-
        case ACPI_TYPE_INTEGER:
 
-               if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Object not a Integer, type %s\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /* Return an additional reference to the object */
 
                obj_desc = source_desc;
-               acpi_ut_add_reference (obj_desc);
+               acpi_ut_add_reference(obj_desc);
                break;
 
-
        case ACPI_TYPE_BUFFER_FIELD:
        case ACPI_TYPE_LOCAL_REGION_FIELD:
        case ACPI_TYPE_LOCAL_BANK_FIELD:
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "field_read Node=%p source_desc=%p Type=%X\n",
-                       node, source_desc, entry_type));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "field_read Node=%p source_desc=%p Type=%X\n",
+                                 node, source_desc, entry_type));
 
-               status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
+               status =
+                   acpi_ex_read_data_from_field(walk_state, source_desc,
+                                                &obj_desc);
                break;
 
-       /* For these objects, just return the object attached to the Node */
+               /* For these objects, just return the object attached to the Node */
 
        case ACPI_TYPE_MUTEX:
        case ACPI_TYPE_METHOD:
@@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value (
                /* Return an additional reference to the object */
 
                obj_desc = source_desc;
-               acpi_ut_add_reference (obj_desc);
+               acpi_ut_add_reference(obj_desc);
                break;
 
-       /* TYPE_ANY is untyped, and thus there is no object associated with it */
+               /* TYPE_ANY is untyped, and thus there is no object associated with it */
 
        case ACPI_TYPE_ANY:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Untyped entry %p, no attached object!\n",
-                       node));
-
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Untyped entry %p, no attached object!\n",
+                                 node));
 
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);        /* Cannot be AE_TYPE */
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
@@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value (
                        /* Return an additional reference to the object */
 
                        obj_desc = source_desc;
-                       acpi_ut_add_reference (obj_desc);
+                       acpi_ut_add_reference(obj_desc);
                        break;
 
                default:
                        /* No named references are allowed here */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Unsupported Reference opcode %X (%s)\n",
-                               source_desc->reference.opcode,
-                               acpi_ps_get_opcode_name (source_desc->reference.opcode)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unsupported Reference opcode %X (%s)\n",
+                                         source_desc->reference.opcode,
+                                         acpi_ps_get_opcode_name(source_desc->
+                                                                 reference.
+                                                                 opcode)));
 
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
                break;
 
-
        default:
 
                /* Default case is for unknown types */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Node %p - Unknown object type %X\n",
-                       node, entry_type));
-
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Node %p - Unknown object type %X\n",
+                                 node, entry_type));
 
-       } /* switch (entry_type) */
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 
+       }                       /* switch (entry_type) */
 
        /* Return the object descriptor */
 
-       *object_ptr = (void *) obj_desc;
-       return_ACPI_STATUS (status);
+       *object_ptr = (void *)obj_desc;
+       return_ACPI_STATUS(status);
 }
-
-
index 3de45672379a301cfab377b35cd46cf928187058..97eecbd3242dc9e067b5aa3ac89191ea9e35fbc1 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acdispat.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exresolv")
+ACPI_MODULE_NAME("exresolv")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_resolve_object_to_value (
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
+                               struct acpi_walk_state *walk_state);
 
 /*******************************************************************************
  *
@@ -78,19 +73,16 @@ acpi_ex_resolve_object_to_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_to_value (
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
+                        struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_resolve_to_value", stack_ptr);
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
 
        if (!stack_ptr || !*stack_ptr) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
        /*
@@ -98,15 +90,16 @@ acpi_ex_resolve_to_value (
         * 1) A valid union acpi_operand_object, or
         * 2) A struct acpi_namespace_node (named_obj)
         */
-       if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
-               status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+       if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
+               status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                if (!*stack_ptr) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
-                       return_ACPI_STATUS (AE_AML_NO_OPERAND);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Internal - null pointer\n"));
+                       return_ACPI_STATUS(AE_AML_NO_OPERAND);
                }
        }
 
@@ -114,20 +107,20 @@ acpi_ex_resolve_to_value (
         * Object on the stack may have changed if acpi_ex_resolve_object_to_value()
         * was called (i.e., we can't use an _else_ here.)
         */
-       if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
-               status = acpi_ex_resolve_node_to_value (
-                                 ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr),
-                                 walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+       if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
+               status =
+                   acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
+                                                 (struct acpi_namespace_node,
+                                                  stack_ptr), walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_object_to_value
@@ -143,25 +136,22 @@ acpi_ex_resolve_to_value (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_resolve_object_to_value (
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
+                               struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *stack_desc;
-       void                            *temp_node;
-       union acpi_operand_object       *obj_desc;
-       u16                             opcode;
-
-
-       ACPI_FUNCTION_TRACE ("ex_resolve_object_to_value");
+       acpi_status status = AE_OK;
+       union acpi_operand_object *stack_desc;
+       void *temp_node;
+       union acpi_operand_object *obj_desc;
+       u16 opcode;
 
+       ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
 
        stack_desc = *stack_ptr;
 
        /* This is an union acpi_operand_object    */
 
-       switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                opcode = stack_desc->reference.opcode;
@@ -177,14 +167,13 @@ acpi_ex_resolve_object_to_value (
 
                        /* Delete the Reference Object */
 
-                       acpi_ut_remove_reference (stack_desc);
+                       acpi_ut_remove_reference(stack_desc);
 
                        /* Return the namespace node */
 
                        (*stack_ptr) = temp_node;
                        break;
 
-
                case AML_LOCAL_OP:
                case AML_ARG_OP:
 
@@ -192,24 +181,28 @@ acpi_ex_resolve_object_to_value (
                         * Get the local from the method's state info
                         * Note: this increments the local's object reference count
                         */
-                       status = acpi_ds_method_data_get_value (opcode,
-                                         stack_desc->reference.offset, walk_state, &obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_ds_method_data_get_value(opcode,
+                                                              stack_desc->
+                                                              reference.offset,
+                                                              walk_state,
+                                                              &obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] value_obj is %p\n",
-                               stack_desc->reference.offset, obj_desc));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "[Arg/Local %X] value_obj is %p\n",
+                                         stack_desc->reference.offset,
+                                         obj_desc));
 
                        /*
                         * Now we can delete the original Reference Object and
                         * replace it with the resolved value
                         */
-                       acpi_ut_remove_reference (stack_desc);
+                       acpi_ut_remove_reference(stack_desc);
                        *stack_ptr = obj_desc;
                        break;
 
-
                case AML_INDEX_OP:
 
                        switch (stack_desc->reference.target_type) {
@@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value (
                                /* Just return - leave the Reference on the stack */
                                break;
 
-
                        case ACPI_TYPE_PACKAGE:
 
                                obj_desc = *stack_desc->reference.where;
@@ -228,36 +220,31 @@ acpi_ex_resolve_object_to_value (
                                         * (i.e., dereference the package index)
                                         * Delete the ref object, increment the returned object
                                         */
-                                       acpi_ut_remove_reference (stack_desc);
-                                       acpi_ut_add_reference (obj_desc);
+                                       acpi_ut_remove_reference(stack_desc);
+                                       acpi_ut_add_reference(obj_desc);
                                        *stack_ptr = obj_desc;
-                               }
-                               else {
+                               } else {
                                        /*
                                         * A NULL object descriptor means an unitialized element of
                                         * the package, can't dereference it
                                         */
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Attempt to deref an Index to NULL pkg element Idx=%p\n",
-                                               stack_desc));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+                                                         stack_desc));
                                        status = AE_AML_UNINITIALIZED_ELEMENT;
                                }
                                break;
 
-
                        default:
 
                                /* Invalid reference object */
 
-                               ACPI_REPORT_ERROR ((
-                                       "During resolve, Unknown target_type %X in Index/Reference obj %p\n",
-                                       stack_desc->reference.target_type, stack_desc));
+                               ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc));
                                status = AE_AML_INTERNAL;
                                break;
                        }
                        break;
 
-
                case AML_REF_OF_OP:
                case AML_DEBUG_OP:
                case AML_LOAD_OP:
@@ -266,60 +253,58 @@ acpi_ex_resolve_object_to_value (
 
                        break;
 
-               case AML_INT_NAMEPATH_OP:   /* Reference to a named object */
+               case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
 
                        /* Get the object pointed to by the namespace node */
 
                        *stack_ptr = (stack_desc->reference.node)->object;
-                       acpi_ut_add_reference (*stack_ptr);
-                       acpi_ut_remove_reference (stack_desc);
+                       acpi_ut_add_reference(*stack_ptr);
+                       acpi_ut_remove_reference(stack_desc);
                        break;
 
                default:
 
-                       ACPI_REPORT_ERROR ((
-                               "During resolve, Unknown Reference opcode %X (%s) in %p\n",
-                               opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
+                       ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
                }
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
-               status = acpi_ds_get_buffer_arguments (stack_desc);
+               status = acpi_ds_get_buffer_arguments(stack_desc);
                break;
 
-
        case ACPI_TYPE_PACKAGE:
 
-               status = acpi_ds_get_package_arguments (stack_desc);
+               status = acpi_ds_get_package_arguments(stack_desc);
                break;
 
-
-       /* These cases may never happen here, but just in case.. */
+               /* These cases may never happen here, but just in case.. */
 
        case ACPI_TYPE_BUFFER_FIELD:
        case ACPI_TYPE_LOCAL_REGION_FIELD:
        case ACPI_TYPE_LOCAL_BANK_FIELD:
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n",
-                       stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "field_read source_desc=%p Type=%X\n",
+                                 stack_desc,
+                                 ACPI_GET_OBJECT_TYPE(stack_desc)));
 
-               status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc);
-               *stack_ptr = (void *) obj_desc;
+               status =
+                   acpi_ex_read_data_from_field(walk_state, stack_desc,
+                                                &obj_desc);
+               *stack_ptr = (void *)obj_desc;
                break;
 
        default:
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_multiple
@@ -337,42 +322,44 @@ acpi_ex_resolve_object_to_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_multiple (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *operand,
-       acpi_object_type                *return_type,
-       union acpi_operand_object       **return_desc)
+acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
+                        union acpi_operand_object *operand,
+                        acpi_object_type * return_type,
+                        union acpi_operand_object **return_desc)
 {
-       union acpi_operand_object       *obj_desc = (void *) operand;
-       struct acpi_namespace_node      *node;
-       acpi_object_type                type;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
+       union acpi_operand_object *obj_desc = (void *)operand;
+       struct acpi_namespace_node *node;
+       acpi_object_type type;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
 
        /* Operand can be either a namespace node or an operand descriptor */
 
-       switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+       switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
        case ACPI_DESC_TYPE_OPERAND:
                type = obj_desc->common.type;
                break;
 
        case ACPI_DESC_TYPE_NAMED:
-               type = ((struct acpi_namespace_node *) obj_desc)->type;
-               obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
+               type = ((struct acpi_namespace_node *)obj_desc)->type;
+               obj_desc =
+                   acpi_ns_get_attached_object((struct acpi_namespace_node *)
+                                               obj_desc);
 
                /* If we had an Alias node, use the attached object for type info */
 
                if (type == ACPI_TYPE_LOCAL_ALIAS) {
-                       type = ((struct acpi_namespace_node *) obj_desc)->type;
-                       obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
+                       type = ((struct acpi_namespace_node *)obj_desc)->type;
+                       obj_desc =
+                           acpi_ns_get_attached_object((struct
+                                                        acpi_namespace_node *)
+                                                       obj_desc);
                }
                break;
 
        default:
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /* If type is anything other than a reference, we are done */
@@ -387,7 +374,7 @@ acpi_ex_resolve_multiple (
         * of the object_type and size_of operators). This means traversing
         * the list of possibly many nested references.
         */
-       while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
+       while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
                switch (obj_desc->reference.opcode) {
                case AML_REF_OF_OP:
 
@@ -397,31 +384,29 @@ acpi_ex_resolve_multiple (
 
                        /* All "References" point to a NS node */
 
-                       if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
-                               ACPI_REPORT_ERROR ((
-                                       "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
-                                       node, acpi_ut_get_descriptor_name (node)));
-                               return_ACPI_STATUS (AE_AML_INTERNAL);
+                       if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
+                           ACPI_DESC_TYPE_NAMED) {
+                               ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
+                               return_ACPI_STATUS(AE_AML_INTERNAL);
                        }
 
                        /* Get the attached object */
 
-                       obj_desc = acpi_ns_get_attached_object (node);
+                       obj_desc = acpi_ns_get_attached_object(node);
                        if (!obj_desc) {
                                /* No object, use the NS node type */
 
-                               type = acpi_ns_get_type (node);
+                               type = acpi_ns_get_type(node);
                                goto exit;
                        }
 
                        /* Check for circular references */
 
                        if (obj_desc == operand) {
-                               return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+                               return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
                        }
                        break;
 
-
                case AML_INDEX_OP:
 
                        /* Get the type of this reference (index into another object) */
@@ -442,12 +427,11 @@ acpi_ex_resolve_multiple (
                        if (!obj_desc) {
                                /* NULL package elements are allowed */
 
-                               type = 0; /* Uninitialized */
+                               type = 0;       /* Uninitialized */
                                goto exit;
                        }
                        break;
 
-
                case AML_INT_NAMEPATH_OP:
 
                        /* Dereference the reference pointer */
@@ -456,50 +440,61 @@ acpi_ex_resolve_multiple (
 
                        /* All "References" point to a NS node */
 
-                       if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
-                               ACPI_REPORT_ERROR ((
-                                       "acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
-                                       node, acpi_ut_get_descriptor_name (node)));
-                          return_ACPI_STATUS (AE_AML_INTERNAL);
+                       if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
+                           ACPI_DESC_TYPE_NAMED) {
+                               ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
+                               return_ACPI_STATUS(AE_AML_INTERNAL);
                        }
 
                        /* Get the attached object */
 
-                       obj_desc = acpi_ns_get_attached_object (node);
+                       obj_desc = acpi_ns_get_attached_object(node);
                        if (!obj_desc) {
                                /* No object, use the NS node type */
 
-                               type = acpi_ns_get_type (node);
+                               type = acpi_ns_get_type(node);
                                goto exit;
                        }
 
                        /* Check for circular references */
 
                        if (obj_desc == operand) {
-                               return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
+                               return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
                        }
                        break;
 
-
                case AML_LOCAL_OP:
                case AML_ARG_OP:
 
                        if (return_desc) {
-                               status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
-                                                obj_desc->reference.offset, walk_state, &obj_desc);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                               status =
+                                   acpi_ds_method_data_get_value(obj_desc->
+                                                                 reference.
+                                                                 opcode,
+                                                                 obj_desc->
+                                                                 reference.
+                                                                 offset,
+                                                                 walk_state,
+                                                                 &obj_desc);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
                                }
-                               acpi_ut_remove_reference (obj_desc);
-                       }
-                       else {
-                               status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
-                                                obj_desc->reference.offset, walk_state, &node);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                               acpi_ut_remove_reference(obj_desc);
+                       } else {
+                               status =
+                                   acpi_ds_method_data_get_node(obj_desc->
+                                                                reference.
+                                                                opcode,
+                                                                obj_desc->
+                                                                reference.
+                                                                offset,
+                                                                walk_state,
+                                                                &node);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
                                }
 
-                               obj_desc = acpi_ns_get_attached_object (node);
+                               obj_desc = acpi_ns_get_attached_object(node);
                                if (!obj_desc) {
                                        type = ACPI_TYPE_ANY;
                                        goto exit;
@@ -507,7 +502,6 @@ acpi_ex_resolve_multiple (
                        }
                        break;
 
-
                case AML_DEBUG_OP:
 
                        /* The Debug Object is of type "debug_object" */
@@ -515,13 +509,10 @@ acpi_ex_resolve_multiple (
                        type = ACPI_TYPE_DEBUG_OBJECT;
                        goto exit;
 
-
                default:
 
-                       ACPI_REPORT_ERROR ((
-                               "acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
-                               obj_desc->reference.opcode));
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
+                       ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
+                       return_ACPI_STATUS(AE_AML_INTERNAL);
                }
        }
 
@@ -529,10 +520,9 @@ acpi_ex_resolve_multiple (
         * Now we are guaranteed to have an object that has not been created
         * via the ref_of or Index operators.
         */
-       type = ACPI_GET_OBJECT_TYPE (obj_desc);
+       type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
-
-exit:
+      exit:
        /* Convert internal types to external types */
 
        switch (type) {
@@ -559,7 +549,5 @@ exit:
        if (return_desc) {
                *return_desc = obj_desc;
        }
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index d8b470eefe7a5832cd0eec7d66bab5794338d892..ff064e79ab90d66995213dc498e473731bb58af9 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exresop")
+ACPI_MODULE_NAME("exresop")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ex_check_object_type (
-       acpi_object_type                type_needed,
-       acpi_object_type                this_type,
-       void                            *object);
-
+acpi_ex_check_object_type(acpi_object_type type_needed,
+                         acpi_object_type this_type, void *object);
 
 /*******************************************************************************
  *
@@ -76,13 +70,10 @@ acpi_ex_check_object_type (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_check_object_type (
-       acpi_object_type                type_needed,
-       acpi_object_type                this_type,
-       void                            *object)
+acpi_ex_check_object_type(acpi_object_type type_needed,
+                         acpi_object_type this_type, void *object)
 {
-       ACPI_FUNCTION_NAME ("ex_check_object_type");
-
+       ACPI_FUNCTION_NAME("ex_check_object_type");
 
        if (type_needed == ACPI_TYPE_ANY) {
                /* All types OK, so we don't perform any typechecks */
@@ -97,16 +88,17 @@ acpi_ex_check_object_type (
                 * specification, a store to a constant is a noop.)
                 */
                if ((this_type == ACPI_TYPE_INTEGER) &&
-                       (((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) {
+                   (((union acpi_operand_object *)object)->common.
+                    flags & AOPOBJ_AML_CONSTANT)) {
                        return (AE_OK);
                }
        }
 
        if (type_needed != this_type) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Needed [%s], found [%s] %p\n",
-                       acpi_ut_get_type_name (type_needed),
-                       acpi_ut_get_type_name (this_type), object));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Needed [%s], found [%s] %p\n",
+                                 acpi_ut_get_type_name(type_needed),
+                                 acpi_ut_get_type_name(this_type), object));
 
                return (AE_AML_OPERAND_TYPE);
        }
@@ -114,7 +106,6 @@ acpi_ex_check_object_type (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_resolve_operands
@@ -137,41 +128,37 @@ acpi_ex_check_object_type (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_resolve_operands (
-       u16                             opcode,
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_operands(u16 opcode,
+                        union acpi_operand_object ** stack_ptr,
+                        struct acpi_walk_state * walk_state)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status = AE_OK;
-       u8                              object_type;
-       void                            *temp_node;
-       u32                             arg_types;
-       const struct acpi_opcode_info   *op_info;
-       u32                             this_arg_type;
-       acpi_object_type                type_needed;
-       u16                             target_op = 0;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
-
-
-       op_info = acpi_ps_get_opcode_info (opcode);
+       union acpi_operand_object *obj_desc;
+       acpi_status status = AE_OK;
+       u8 object_type;
+       void *temp_node;
+       u32 arg_types;
+       const struct acpi_opcode_info *op_info;
+       u32 this_arg_type;
+       acpi_object_type type_needed;
+       u16 target_op = 0;
+
+       ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
+
+       op_info = acpi_ps_get_opcode_info(opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
-               return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+               return_ACPI_STATUS(AE_AML_BAD_OPCODE);
        }
 
        arg_types = op_info->runtime_args;
        if (arg_types == ARGI_INVALID_OPCODE) {
-               ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n",
-                       opcode));
+               ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode));
 
-               return_ACPI_STATUS (AE_AML_INTERNAL);
+               return_ACPI_STATUS(AE_AML_INTERNAL);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-               "Opcode %X [%s] required_operand_types=%8.8X \n",
-               opcode, op_info->name, arg_types));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Opcode %X [%s] required_operand_types=%8.8X \n",
+                         opcode, op_info->name, arg_types));
 
        /*
         * Normal exit is with (arg_types == 0) at end of argument list.
@@ -180,12 +167,11 @@ acpi_ex_resolve_operands (
         * to) the required type; if stack underflows; or upon
         * finding a NULL stack entry (which should not happen).
         */
-       while (GET_CURRENT_ARG_TYPE (arg_types)) {
+       while (GET_CURRENT_ARG_TYPE(arg_types)) {
                if (!stack_ptr || !*stack_ptr) {
-                       ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n",
-                               stack_ptr));
+                       ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr));
 
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
+                       return_ACPI_STATUS(AE_AML_INTERNAL);
                }
 
                /* Extract useful items */
@@ -194,37 +180,37 @@ acpi_ex_resolve_operands (
 
                /* Decode the descriptor type */
 
-               switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+               switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
                case ACPI_DESC_TYPE_NAMED:
 
                        /* Namespace Node */
 
-                       object_type = ((struct acpi_namespace_node *) obj_desc)->type;
+                       object_type =
+                           ((struct acpi_namespace_node *)obj_desc)->type;
                        break;
 
-
                case ACPI_DESC_TYPE_OPERAND:
 
                        /* ACPI internal object */
 
-                       object_type = ACPI_GET_OBJECT_TYPE (obj_desc);
+                       object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
                        /* Check for bad acpi_object_type */
 
-                       if (!acpi_ut_valid_object_type (object_type)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Bad operand object type [%X]\n",
-                                       object_type));
+                       if (!acpi_ut_valid_object_type(object_type)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Bad operand object type [%X]\n",
+                                                 object_type));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
 
                        if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
                                /* Decode the Reference */
 
-                               op_info = acpi_ps_get_opcode_info (opcode);
+                               op_info = acpi_ps_get_opcode_info(opcode);
                                if (op_info->class == AML_CLASS_UNKNOWN) {
-                                       return_ACPI_STATUS (AE_AML_BAD_OPCODE);
+                                       return_ACPI_STATUS(AE_AML_BAD_OPCODE);
                                }
 
                                switch (obj_desc->reference.opcode) {
@@ -238,51 +224,62 @@ acpi_ex_resolve_operands (
                                case AML_REF_OF_OP:
                                case AML_ARG_OP:
                                case AML_LOCAL_OP:
-                               case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
-                               case AML_INT_NAMEPATH_OP: /* Reference to a named object */
-
-                                       ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                                               "Operand is a Reference, ref_opcode [%s]\n",
-                                               (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)));
+                               case AML_LOAD_OP:       /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
+                               case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
+
+                                       ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
+                                                               ((ACPI_DB_EXEC,
+                                                                 "Operand is a Reference, ref_opcode [%s]\n",
+                                                                 (acpi_ps_get_opcode_info
+                                                                  (obj_desc->
+                                                                   reference.
+                                                                   opcode))->
+                                                                 name)));
                                        break;
 
                                default:
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
-                                               obj_desc->reference.opcode,
-                                               (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
-
-                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
+                                                         obj_desc->reference.
+                                                         opcode,
+                                                         (acpi_ps_get_opcode_info
+                                                          (obj_desc->reference.
+                                                           opcode))->name));
+
+                                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
                        }
                        break;
 
-
                default:
 
                        /* Invalid descriptor */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Invalid descriptor %p [%s]\n",
-                                       obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid descriptor %p [%s]\n",
+                                         obj_desc,
+                                         acpi_ut_get_descriptor_name
+                                         (obj_desc)));
 
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /* Get one argument type, point to the next */
 
-               this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
-               INCREMENT_ARG_LIST (arg_types);
+               this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
+               INCREMENT_ARG_LIST(arg_types);
 
                /*
                 * Handle cases where the object does not need to be
                 * resolved to a value
                 */
                switch (this_arg_type) {
-               case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
+               case ARGI_REF_OR_STRING:        /* Can be a String or Reference */
 
-                       if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
-                               (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
+                       if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
+                            ACPI_DESC_TYPE_OPERAND)
+                           && (ACPI_GET_OBJECT_TYPE(obj_desc) ==
+                               ACPI_TYPE_STRING)) {
                                /*
                                 * String found - the string references a named object and
                                 * must be resolved to a node
@@ -296,39 +293,40 @@ acpi_ex_resolve_operands (
                         */
                        /*lint -fallthrough */
 
-               case ARGI_REFERENCE:            /* References: */
+               case ARGI_REFERENCE:    /* References: */
                case ARGI_INTEGER_REF:
                case ARGI_OBJECT_REF:
                case ARGI_DEVICE_REF:
-               case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
-               case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
-               case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
+               case ARGI_TARGETREF:    /* Allows implicit conversion rules before store */
+               case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
+               case ARGI_SIMPLE_TARGET:        /* Name, Local, or Arg - no implicit conversion  */
 
                        /*
                         * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
                         * A Namespace Node is OK as-is
                         */
-                       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
+                       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
+                           ACPI_DESC_TYPE_NAMED) {
                                goto next_operand;
                        }
 
-                       status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE,
-                                         object_type, obj_desc);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status =
+                           acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
+                                                     object_type, obj_desc);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
 
                        if (obj_desc->reference.opcode == AML_NAME_OP) {
                                /* Convert a named reference to the actual named object */
 
                                temp_node = obj_desc->reference.object;
-                               acpi_ut_remove_reference (obj_desc);
+                               acpi_ut_remove_reference(obj_desc);
                                (*stack_ptr) = temp_node;
                        }
                        goto next_operand;
 
-
-               case ARGI_DATAREFOBJ:  /* Store operator only */
+               case ARGI_DATAREFOBJ:   /* Store operator only */
 
                        /*
                         * We don't want to resolve index_op reference objects during
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands (
                         * -- All others must be resolved below.
                         */
                        if ((opcode == AML_STORE_OP) &&
-                               (ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) &&
-                               ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
+                           (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
+                            ACPI_TYPE_LOCAL_REFERENCE)
+                           && ((*stack_ptr)->reference.opcode ==
+                               AML_INDEX_OP)) {
                                goto next_operand;
                        }
                        break;
@@ -351,9 +351,9 @@ acpi_ex_resolve_operands (
                /*
                 * Resolve this object to a value
                 */
-               status = acpi_ex_resolve_to_value (stack_ptr, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Get the resolved object */
@@ -364,10 +364,10 @@ acpi_ex_resolve_operands (
                 * Check the resulting object (value) type
                 */
                switch (this_arg_type) {
-               /*
-                * For the simple cases, only one type of resolved object
-                * is allowed
-                */
+                       /*
+                        * For the simple cases, only one type of resolved object
+                        * is allowed
+                        */
                case ARGI_MUTEX:
 
                        /* Need an operand of type ACPI_TYPE_MUTEX */
@@ -382,7 +382,7 @@ acpi_ex_resolve_operands (
                        type_needed = ACPI_TYPE_EVENT;
                        break;
 
-               case ARGI_PACKAGE:   /* Package */
+               case ARGI_PACKAGE:      /* Package */
 
                        /* Need an operand of type ACPI_TYPE_PACKAGE */
 
@@ -403,10 +403,9 @@ acpi_ex_resolve_operands (
                        type_needed = ACPI_TYPE_LOCAL_REFERENCE;
                        break;
 
-
-               /*
-                * The more complex cases allow multiple resolved object types
-                */
+                       /*
+                        * The more complex cases allow multiple resolved object types
+                        */
                case ARGI_INTEGER:
 
                        /*
@@ -414,20 +413,26 @@ acpi_ex_resolve_operands (
                         * But we can implicitly convert from a STRING or BUFFER
                         * Aka - "Implicit Source Operand Conversion"
                         */
-                       status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
+                       if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
-                                               acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                                         acpi_ut_get_object_type_name
+                                                         (obj_desc),
+                                                         obj_desc));
 
-                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
 
-                               return_ACPI_STATUS (status);
+                               return_ACPI_STATUS(status);
                        }
-                       goto next_operand;
 
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference(obj_desc);
+                       }
+                       goto next_operand;
 
                case ARGI_BUFFER:
 
@@ -436,20 +441,25 @@ acpi_ex_resolve_operands (
                         * But we can implicitly convert from a STRING or INTEGER
                         * Aka - "Implicit Source Operand Conversion"
                         */
-                       status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
+                       if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
-                                               acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                                         acpi_ut_get_object_type_name
+                                                         (obj_desc),
+                                                         obj_desc));
 
-                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
 
-                               return_ACPI_STATUS (status);
+                               return_ACPI_STATUS(status);
                        }
-                       goto next_operand;
 
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference(obj_desc);
+                       }
+                       goto next_operand;
 
                case ARGI_STRING:
 
@@ -458,75 +468,86 @@ acpi_ex_resolve_operands (
                         * But we can implicitly convert from a BUFFER or INTEGER
                         * Aka - "Implicit Source Operand Conversion"
                         */
-                       status = acpi_ex_convert_to_string (obj_desc, stack_ptr,
-                                        ACPI_IMPLICIT_CONVERT_HEX);
-                       if (ACPI_FAILURE (status)) {
+                       status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
+                                                          ACPI_IMPLICIT_CONVERT_HEX);
+                       if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Needed [Integer/String/Buffer], found [%s] %p\n",
-                                               acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                                         acpi_ut_get_object_type_name
+                                                         (obj_desc),
+                                                         obj_desc));
 
-                                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
 
-                               return_ACPI_STATUS (status);
+                               return_ACPI_STATUS(status);
                        }
-                       goto next_operand;
 
+                       if (obj_desc != *stack_ptr) {
+                               acpi_ut_remove_reference(obj_desc);
+                       }
+                       goto next_operand;
 
                case ARGI_COMPUTEDATA:
 
                        /* Need an operand of type INTEGER, STRING or BUFFER */
 
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_INTEGER:
                        case ACPI_TYPE_STRING:
                        case ACPI_TYPE_BUFFER:
 
                                /* Valid operand */
-                          break;
+                               break;
 
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed [Integer/String/Buffer], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                case ARGI_BUFFER_OR_STRING:
 
                        /* Need an operand of type STRING or BUFFER */
 
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_STRING:
                        case ACPI_TYPE_BUFFER:
 
                                /* Valid operand */
-                          break;
+                               break;
 
                        case ACPI_TYPE_INTEGER:
 
                                /* Highest priority conversion is to type Buffer */
 
-                               status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
-                               if (ACPI_FAILURE (status)) {
-                                       return_ACPI_STATUS (status);
+                               status =
+                                   acpi_ex_convert_to_buffer(obj_desc,
+                                                             stack_ptr);
+                               if (ACPI_FAILURE(status)) {
+                                       return_ACPI_STATUS(status);
+                               }
+
+                               if (obj_desc != *stack_ptr) {
+                                       acpi_ut_remove_reference(obj_desc);
                                }
                                break;
 
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed [Integer/String/Buffer], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed [Integer/String/Buffer], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                case ARGI_DATAOBJECT:
                        /*
                         * ARGI_DATAOBJECT is only used by the size_of operator.
@@ -535,7 +556,7 @@ acpi_ex_resolve_operands (
                         * The only reference allowed here is a direct reference to
                         * a namespace node.
                         */
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_PACKAGE:
                        case ACPI_TYPE_STRING:
                        case ACPI_TYPE_BUFFER:
@@ -545,20 +566,20 @@ acpi_ex_resolve_operands (
                                break;
 
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                case ARGI_COMPLEXOBJ:
 
                        /* Need a buffer or package or (ACPI 2.0) String */
 
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_PACKAGE:
                        case ACPI_TYPE_STRING:
                        case ACPI_TYPE_BUFFER:
@@ -567,20 +588,20 @@ acpi_ex_resolve_operands (
                                break;
 
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed [Buffer/String/Package], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed [Buffer/String/Package], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                case ARGI_REGION_OR_FIELD:
 
                        /* Need an operand of type REGION or a FIELD in a region */
 
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_REGION:
                        case ACPI_TYPE_LOCAL_REGION_FIELD:
                        case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -590,20 +611,20 @@ acpi_ex_resolve_operands (
                                break;
 
                        default:
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed [Region/region_field], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed [Region/region_field], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                case ARGI_DATAREFOBJ:
 
                        /* Used by the Store() operator only */
 
-                       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+                       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_INTEGER:
                        case ACPI_TYPE_PACKAGE:
                        case ACPI_TYPE_STRING:
@@ -635,47 +656,46 @@ acpi_ex_resolve_operands (
                                        break;
                                }
 
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
-                                       acpi_ut_get_object_type_name (obj_desc), obj_desc));
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
+                                                 acpi_ut_get_object_type_name
+                                                 (obj_desc), obj_desc));
 
-                               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
                        goto next_operand;
 
-
                default:
 
                        /* Unknown type */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Internal - Unknown ARGI (required operand) type %X\n",
-                               this_arg_type));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Internal - Unknown ARGI (required operand) type %X\n",
+                                         this_arg_type));
 
-                       return_ACPI_STATUS (AE_BAD_PARAMETER);
+                       return_ACPI_STATUS(AE_BAD_PARAMETER);
                }
 
                /*
                 * Make sure that the original object was resolved to the
                 * required object type (Simple cases only).
                 */
-               status = acpi_ex_check_object_type (type_needed,
-                                 ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ex_check_object_type(type_needed,
+                                                  ACPI_GET_OBJECT_TYPE
+                                                  (*stack_ptr), *stack_ptr);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
-next_operand:
+             next_operand:
                /*
                 * If more operands needed, decrement stack_ptr to point
                 * to next operand on stack
                 */
-               if (GET_CURRENT_ARG_TYPE (arg_types)) {
+               if (GET_CURRENT_ARG_TYPE(arg_types)) {
                        stack_ptr--;
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 2725db0901b827133003aa9d21400cd5dcec1384..a7d8eea305c2a80f305055a6851bffcb6d8709ab 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exstore")
+ACPI_MODULE_NAME("exstore")
 
 /* Local prototypes */
-
 static void
-acpi_ex_do_debug_object (
-       union acpi_operand_object       *source_desc,
-       u32                             level,
-       u32                             index);
+acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
+                       u32 level, u32 index);
 
 static acpi_status
-acpi_ex_store_object_to_index (
-       union acpi_operand_object       *val_desc,
-       union acpi_operand_object       *dest_desc,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
+                             union acpi_operand_object *dest_desc,
+                             struct acpi_walk_state *walk_state);
 
 /*******************************************************************************
  *
@@ -84,136 +77,146 @@ acpi_ex_store_object_to_index (
  ******************************************************************************/
 
 static void
-acpi_ex_do_debug_object (
-       union acpi_operand_object       *source_desc,
-       u32                             level,
-       u32                             index)
+acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
+                       u32 level, u32 index)
 {
-       u32                             i;
-
+       u32 i;
 
-       ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
+       ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
 
-
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
-               level, " "));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
+                             level, " "));
 
        /* Display index for package output only */
 
        if (index > 0) {
-          ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
-                  "(%.2u) ", index -1));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+                                     "(%.2u) ", index - 1));
        }
 
        if (!source_desc) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
                return_VOID;
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
-                       acpi_ut_get_object_type_name (source_desc)));
+       if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ",
+                                     acpi_ut_get_object_type_name
+                                     (source_desc)));
 
-               if (!acpi_ut_valid_internal_object (source_desc)) {
-                  ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
-                          "%p, Invalid Internal Object!\n", source_desc));
-                  return_VOID;
+               if (!acpi_ut_valid_internal_object(source_desc)) {
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+                                             "%p, Invalid Internal Object!\n",
+                                             source_desc));
+                       return_VOID;
                }
-       }
-       else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
-                       acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
-                       source_desc));
+       } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
+                  ACPI_DESC_TYPE_NAMED) {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
+                                     acpi_ut_get_type_name(((struct
+                                                             acpi_namespace_node
+                                                             *)source_desc)->
+                                                           type),
+                                     source_desc));
                return_VOID;
-       }
-       else {
+       } else {
                return_VOID;
        }
 
-       switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
        case ACPI_TYPE_INTEGER:
 
                /* Output correct integer width */
 
                if (acpi_gbl_integer_byte_width == 4) {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
-                               (u32) source_desc->integer.value));
-               }
-               else {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
-                               ACPI_FORMAT_UINT64 (source_desc->integer.value)));
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
+                                             (u32) source_desc->integer.
+                                             value));
+               } else {
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+                                             "0x%8.8X%8.8X\n",
+                                             ACPI_FORMAT_UINT64(source_desc->
+                                                                integer.
+                                                                value)));
                }
                break;
 
        case ACPI_TYPE_BUFFER:
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
-                       (u32) source_desc->buffer.length));
-               ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
-                       (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
+                                     (u32) source_desc->buffer.length));
+               ACPI_DUMP_BUFFER(source_desc->buffer.pointer,
+                                (source_desc->buffer.length <
+                                 32) ? source_desc->buffer.length : 32);
                break;
 
        case ACPI_TYPE_STRING:
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
-                       source_desc->string.length, source_desc->string.pointer));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
+                                     source_desc->string.length,
+                                     source_desc->string.pointer));
                break;
 
        case ACPI_TYPE_PACKAGE:
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
-                       source_desc->package.count));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+                                     "[0x%.2X Elements]\n",
+                                     source_desc->package.count));
 
                /* Output the entire contents of the package */
 
                for (i = 0; i < source_desc->package.count; i++) {
-                       acpi_ex_do_debug_object (source_desc->package.elements[i],
-                               level+4, i+1);
+                       acpi_ex_do_debug_object(source_desc->package.
+                                               elements[i], level + 4, i + 1);
                }
                break;
 
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                if (source_desc->reference.opcode == AML_INDEX_OP) {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
-                               acpi_ps_get_opcode_name (source_desc->reference.opcode),
-                               source_desc->reference.offset));
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
+                                             "[%s, 0x%X]\n",
+                                             acpi_ps_get_opcode_name
+                                             (source_desc->reference.opcode),
+                                             source_desc->reference.offset));
+               } else {
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
+                                             acpi_ps_get_opcode_name
+                                             (source_desc->reference.opcode)));
                }
-               else {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
-                               acpi_ps_get_opcode_name (source_desc->reference.opcode)));
-               }
-
 
                if (source_desc->reference.object) {
-                       if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
-                                       ACPI_DESC_TYPE_NAMED) {
-                               acpi_ex_do_debug_object (((struct acpi_namespace_node *)
-                                       source_desc->reference.object)->object,
-                                       level+4, 0);
+                       if (ACPI_GET_DESCRIPTOR_TYPE
+                           (source_desc->reference.object) ==
+                           ACPI_DESC_TYPE_NAMED) {
+                               acpi_ex_do_debug_object(((struct
+                                                         acpi_namespace_node *)
+                                                        source_desc->reference.
+                                                        object)->object,
+                                                       level + 4, 0);
+                       } else {
+                               acpi_ex_do_debug_object(source_desc->reference.
+                                                       object, level + 4, 0);
                        }
-                       else {
-                               acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
-                       }
-               }
-               else if (source_desc->reference.node) {
-                       acpi_ex_do_debug_object ((source_desc->reference.node)->object,
-                               level+4, 0);
+               } else if (source_desc->reference.node) {
+                       acpi_ex_do_debug_object((source_desc->reference.node)->
+                                               object, level + 4, 0);
                }
                break;
 
        default:
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
-                       source_desc, acpi_ut_get_object_type_name (source_desc)));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
+                                     source_desc,
+                                     acpi_ut_get_object_type_name
+                                     (source_desc)));
                break;
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store
@@ -235,42 +238,41 @@ acpi_ex_do_debug_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_store(union acpi_operand_object *source_desc,
+             union acpi_operand_object *dest_desc,
+             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *ref_desc = dest_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc);
+       acpi_status status = AE_OK;
+       union acpi_operand_object *ref_desc = dest_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
 
        /* Validate parameters */
 
        if (!source_desc || !dest_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
-               return_ACPI_STATUS (AE_AML_NO_OPERAND);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n"));
+               return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
        /* dest_desc can be either a namespace node or an ACPI object */
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) {
                /*
                 * Dest is a namespace node,
                 * Storing an object into a Named node.
                 */
-               status = acpi_ex_store_object_to_node (source_desc,
-                                (struct acpi_namespace_node *) dest_desc, walk_state,
-                                ACPI_IMPLICIT_CONVERSION);
+               status = acpi_ex_store_object_to_node(source_desc,
+                                                     (struct
+                                                      acpi_namespace_node *)
+                                                     dest_desc, walk_state,
+                                                     ACPI_IMPLICIT_CONVERSION);
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Destination object must be a Reference or a Constant object */
 
-       switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
                break;
 
@@ -279,7 +281,7 @@ acpi_ex_store (
                /* Allow stores to Constants -- a Noop as per ACPI spec */
 
                if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /*lint -fallthrough */
@@ -288,16 +290,18 @@ acpi_ex_store (
 
                /* Destination is not a Reference object */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Target is not a Reference or Constant object - %s [%p]\n",
-                       acpi_ut_get_object_type_name (dest_desc), dest_desc));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Target is not a Reference or Constant object - %s [%p]\n",
+                                 acpi_ut_get_object_type_name(dest_desc),
+                                 dest_desc));
 
-               ACPI_DUMP_STACK_ENTRY (source_desc);
-               ACPI_DUMP_STACK_ENTRY (dest_desc);
-               ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
-                                 2, "Target is not a Reference or Constant object");
+               ACPI_DUMP_STACK_ENTRY(source_desc);
+               ACPI_DUMP_STACK_ENTRY(dest_desc);
+               ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
+                                  2,
+                                  "Target is not a Reference or Constant object");
 
-               return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
        }
 
        /*
@@ -314,58 +318,59 @@ acpi_ex_store (
 
                /* Storing an object into a Name "container" */
 
-               status = acpi_ex_store_object_to_node (source_desc,
-                                ref_desc->reference.object,
-                                walk_state, ACPI_IMPLICIT_CONVERSION);
+               status = acpi_ex_store_object_to_node(source_desc,
+                                                     ref_desc->reference.
+                                                     object, walk_state,
+                                                     ACPI_IMPLICIT_CONVERSION);
                break;
 
-
        case AML_INDEX_OP:
 
                /* Storing to an Index (pointer into a packager or buffer) */
 
-               status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state);
+               status =
+                   acpi_ex_store_object_to_index(source_desc, ref_desc,
+                                                 walk_state);
                break;
 
-
        case AML_LOCAL_OP:
        case AML_ARG_OP:
 
                /* Store to a method local/arg  */
 
-               status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
-                                ref_desc->reference.offset, source_desc, walk_state);
+               status =
+                   acpi_ds_store_object_to_local(ref_desc->reference.opcode,
+                                                 ref_desc->reference.offset,
+                                                 source_desc, walk_state);
                break;
 
-
        case AML_DEBUG_OP:
 
                /*
                 * Storing to the Debug object causes the value stored to be
                 * displayed and otherwise has no effect -- see ACPI Specification
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "**** Write to Debug Object: Object %p %s ****:\n\n",
-                       source_desc, acpi_ut_get_object_type_name (source_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "**** Write to Debug Object: Object %p %s ****:\n\n",
+                                 source_desc,
+                                 acpi_ut_get_object_type_name(source_desc)));
 
-               acpi_ex_do_debug_object (source_desc, 0, 0);
+               acpi_ex_do_debug_object(source_desc, 0, 0);
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n",
-                       ref_desc->reference.opcode));
-               ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
+               ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
+                                  ref_desc->reference.opcode));
+               ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
 
                status = AE_AML_INTERNAL;
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_index
@@ -381,20 +386,17 @@ acpi_ex_store (
  ******************************************************************************/
 
 static acpi_status
-acpi_ex_store_object_to_index (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *index_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
+                             union acpi_operand_object *index_desc,
+                             struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *new_desc;
-       u8                              value = 0;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ex_store_object_to_index");
+       acpi_status status = AE_OK;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *new_desc;
+       u8 value = 0;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ex_store_object_to_index");
 
        /*
         * Destination must be a reference pointer, and
@@ -413,19 +415,20 @@ acpi_ex_store_object_to_index (
                 */
                obj_desc = *(index_desc->reference.where);
 
-               status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
+                                                   walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                if (obj_desc) {
                        /* Decrement reference count by the ref count of the parent package */
 
-                       for (i = 0;
-                                i < ((union acpi_operand_object *)
-                                               index_desc->reference.object)->common.reference_count;
-                                i++) {
-                               acpi_ut_remove_reference (obj_desc);
+                       for (i = 0; i < ((union acpi_operand_object *)
+                                        index_desc->reference.object)->common.
+                            reference_count; i++) {
+                               acpi_ut_remove_reference(obj_desc);
                        }
                }
 
@@ -433,16 +436,14 @@ acpi_ex_store_object_to_index (
 
                /* Increment ref count by the ref count of the parent package-1 */
 
-               for (i = 1;
-                        i < ((union acpi_operand_object *)
-                                       index_desc->reference.object)->common.reference_count;
-                        i++) {
-                       acpi_ut_add_reference (new_desc);
+               for (i = 1; i < ((union acpi_operand_object *)
+                                index_desc->reference.object)->common.
+                    reference_count; i++) {
+                       acpi_ut_add_reference(new_desc);
                }
 
                break;
 
-
        case ACPI_TYPE_BUFFER_FIELD:
 
                /*
@@ -460,16 +461,16 @@ acpi_ex_store_object_to_index (
                 * by the INDEX_OP code.
                 */
                obj_desc = index_desc->reference.object;
-               if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) &&
-                       (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) &&
+                   (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) {
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /*
                 * The assignment of the individual elements will be slightly
                 * different for each source type.
                 */
-               switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
+               switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
                case ACPI_TYPE_INTEGER:
 
                        /* Use the least-significant byte of the integer */
@@ -489,10 +490,11 @@ acpi_ex_store_object_to_index (
 
                        /* All other types are invalid */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Source must be Integer/Buffer/String type, not %s\n",
-                               acpi_ut_get_object_type_name (source_desc)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Source must be Integer/Buffer/String type, not %s\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /* Store the source value into the target buffer byte */
@@ -500,18 +502,16 @@ acpi_ex_store_object_to_index (
                obj_desc->buffer.pointer[index_desc->reference.offset] = value;
                break;
 
-
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Target is not a Package or buffer_field\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Target is not a Package or buffer_field\n"));
                status = AE_AML_OPERAND_TYPE;
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_node
@@ -539,42 +539,40 @@ acpi_ex_store_object_to_index (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_object_to_node (
-       union acpi_operand_object       *source_desc,
-       struct acpi_namespace_node      *node,
-       struct acpi_walk_state          *walk_state,
-       u8                              implicit_conversion)
+acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
+                            struct acpi_namespace_node *node,
+                            struct acpi_walk_state *walk_state,
+                            u8 implicit_conversion)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *target_desc;
-       union acpi_operand_object       *new_desc;
-       acpi_object_type                target_type;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
+       acpi_status status = AE_OK;
+       union acpi_operand_object *target_desc;
+       union acpi_operand_object *new_desc;
+       acpi_object_type target_type;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
 
        /* Get current type of the node, and object attached to Node */
 
-       target_type = acpi_ns_get_type (node);
-       target_desc = acpi_ns_get_attached_object (node);
+       target_type = acpi_ns_get_type(node);
+       target_desc = acpi_ns_get_attached_object(node);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
-               source_desc, acpi_ut_get_object_type_name (source_desc),
-                         node, acpi_ut_get_type_name (target_type)));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
+                         source_desc,
+                         acpi_ut_get_object_type_name(source_desc), node,
+                         acpi_ut_get_type_name(target_type)));
 
        /*
         * Resolve the source object to an actual value
         * (If it is a reference object)
         */
-       status = acpi_ex_resolve_object (&source_desc, target_type, walk_state);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_resolve_object(&source_desc, target_type, walk_state);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* If no implicit conversion, drop into the default case below */
 
-       if (!implicit_conversion) {
+       if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) {
                /* Force execution of default (no implicit conversion) */
 
                target_type = ACPI_TYPE_ANY;
@@ -590,11 +588,10 @@ acpi_ex_store_object_to_node (
 
                /* For fields, copy the source data to the target field. */
 
-               status = acpi_ex_write_data_to_field (source_desc, target_desc,
-                                &walk_state->result_obj);
+               status = acpi_ex_write_data_to_field(source_desc, target_desc,
+                                                    &walk_state->result_obj);
                break;
 
-
        case ACPI_TYPE_INTEGER:
        case ACPI_TYPE_STRING:
        case ACPI_TYPE_BUFFER:
@@ -605,10 +602,11 @@ acpi_ex_store_object_to_node (
                 *
                 * Copy and/or convert the source object to a new target object
                 */
-               status = acpi_ex_store_object_to_object (source_desc, target_desc,
-                                &new_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_store_object_to_object(source_desc, target_desc,
+                                                  &new_desc, walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                if (new_desc != target_desc) {
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node (
                         * has been performed such that the node/object type has been
                         * changed.
                         */
-                       status = acpi_ns_attach_object (node, new_desc, new_desc->common.type);
-
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "Store %s into %s via Convert/Attach\n",
-                               acpi_ut_get_object_type_name (source_desc),
-                               acpi_ut_get_object_type_name (new_desc)));
+                       status =
+                           acpi_ns_attach_object(node, new_desc,
+                                                 new_desc->common.type);
+
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "Store %s into %s via Convert/Attach\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc),
+                                         acpi_ut_get_object_type_name
+                                         (new_desc)));
                }
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Storing %s (%p) directly into node (%p), no implicit conversion\n",
-                       acpi_ut_get_object_type_name (source_desc), source_desc, node));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
+                                 acpi_ut_get_object_type_name(source_desc),
+                                 source_desc, node));
 
                /* No conversions for all other types.  Just attach the source object */
 
-               status = acpi_ns_attach_object (node, source_desc,
-                                ACPI_GET_OBJECT_TYPE (source_desc));
+               status = acpi_ns_attach_object(node, source_desc,
+                                              ACPI_GET_OBJECT_TYPE
+                                              (source_desc));
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 120f30ed0bd4a017c7a7363783329f13828fbb99..382f63c14ea1cd10954c0e76d26b795b6a82aa50 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exstoren")
-
+ACPI_MODULE_NAME("exstoren")
 
 /*******************************************************************************
  *
  *              it and return the actual object in the source_desc_ptr.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_resolve_object (
-       union acpi_operand_object       **source_desc_ptr,
-       acpi_object_type                target_type,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
+                      acpi_object_type target_type,
+                      struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *source_desc = *source_desc_ptr;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_resolve_object");
+       union acpi_operand_object *source_desc = *source_desc_ptr;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_resolve_object");
 
        /* Ensure we have a Target that can be stored to */
 
@@ -102,11 +95,14 @@ acpi_ex_resolve_object (
                 * are all essentially the same.  This case handles the
                 * "interchangeable" types Integer, String, and Buffer.
                 */
-               if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
+               if (ACPI_GET_OBJECT_TYPE(source_desc) ==
+                   ACPI_TYPE_LOCAL_REFERENCE) {
                        /* Resolve a reference object first */
 
-                       status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ex_resolve_to_value(source_desc_ptr,
+                                                    walk_state);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
                }
@@ -119,31 +115,32 @@ acpi_ex_resolve_object (
 
                /* Must have a Integer, Buffer, or String */
 
-               if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER)   &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER)    &&
-                       (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING)    &&
-                       !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
+               if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
+                   (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
+                   (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
+                   !((ACPI_GET_OBJECT_TYPE(source_desc) ==
+                      ACPI_TYPE_LOCAL_REFERENCE)
+                     && (source_desc->reference.opcode == AML_LOAD_OP))) {
                        /* Conversion successful but still not a valid type */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
-                               acpi_ut_get_object_type_name (source_desc),
-                               acpi_ut_get_type_name (target_type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+                                         acpi_ut_get_object_type_name
+                                         (source_desc),
+                                         acpi_ut_get_type_name(target_type)));
                        status = AE_AML_OPERAND_TYPE;
                }
                break;
 
-
        case ACPI_TYPE_LOCAL_ALIAS:
        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
 
                /* Aliases are resolved by acpi_ex_prep_operands */
 
-               ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
+               ACPI_REPORT_ERROR(("Store into Alias - should never happen\n"));
                status = AE_AML_INTERNAL;
                break;
 
-
        case ACPI_TYPE_PACKAGE:
        default:
 
@@ -154,10 +151,9 @@ acpi_ex_resolve_object (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_object_to_object
@@ -194,18 +190,15 @@ acpi_ex_resolve_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_object_to_object (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc,
-       union acpi_operand_object       **new_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *dest_desc,
+                              union acpi_operand_object **new_desc,
+                              struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *actual_src_desc;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc);
+       union acpi_operand_object *actual_src_desc;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
 
        actual_src_desc = source_desc;
        if (!dest_desc) {
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object (
                 * package element), so we can simply copy the source object
                 * creating a new destination object
                 */
-               status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
-               return_ACPI_STATUS (status);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc,
+                                                   walk_state);
+               return_ACPI_STATUS(status);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) {
+       if (ACPI_GET_OBJECT_TYPE(source_desc) !=
+           ACPI_GET_OBJECT_TYPE(dest_desc)) {
                /*
                 * The source type does not match the type of the destination.
                 * Perform the "implicit conversion" of the source to the current type
@@ -228,10 +224,13 @@ acpi_ex_store_object_to_object (
                 * Otherwise, actual_src_desc is a temporary object to hold the
                 * converted object.
                 */
-               status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc),
-                                 source_desc, &actual_src_desc, walk_state);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
+                                                  (dest_desc), source_desc,
+                                                  &actual_src_desc,
+                                                  walk_state);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                if (source_desc == actual_src_desc) {
@@ -240,7 +239,7 @@ acpi_ex_store_object_to_object (
                         * new object.
                         */
                        *new_desc = source_desc;
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
@@ -248,42 +247,42 @@ acpi_ex_store_object_to_object (
         * We now have two objects of identical types, and we can perform a
         * copy of the *value* of the source object.
         */
-       switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
        case ACPI_TYPE_INTEGER:
 
                dest_desc->integer.value = actual_src_desc->integer.value;
 
                /* Truncate value if we are executing from a 32-bit ACPI table */
 
-               acpi_ex_truncate_for32bit_table (dest_desc);
+               acpi_ex_truncate_for32bit_table(dest_desc);
                break;
 
        case ACPI_TYPE_STRING:
 
-               status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc);
+               status =
+                   acpi_ex_store_string_to_string(actual_src_desc, dest_desc);
                break;
 
        case ACPI_TYPE_BUFFER:
 
-               /*
-                * Note: There is different store behavior depending on the original
-                * source type
-                */
-               status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
+               status =
+                   acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc);
                break;
 
        case ACPI_TYPE_PACKAGE:
 
-               status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc,
-                                walk_state);
+               status =
+                   acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
+                                                   walk_state);
                break;
 
        default:
                /*
                 * All other types come here.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
-                       acpi_ut_get_object_type_name (dest_desc)));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Store into type %s not implemented\n",
+                                 acpi_ut_get_object_type_name(dest_desc)));
 
                status = AE_NOT_IMPLEMENTED;
                break;
@@ -292,11 +291,9 @@ acpi_ex_store_object_to_object (
        if (actual_src_desc != source_desc) {
                /* Delete the intermediate (temporary) source object */
 
-               acpi_ut_remove_reference (actual_src_desc);
+               acpi_ut_remove_reference(actual_src_desc);
        }
 
        *new_desc = dest_desc;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 12d1527669c834d8a3240b54fbb01c89b6399062..c4ff654a669717637baf578766d9524fd062fb40 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exstorob")
-
+ACPI_MODULE_NAME("exstorob")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Copy a buffer object to another buffer object.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_store_buffer_to_buffer (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc)
+acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *target_desc)
 {
-       u32                             length;
-       u8                              *buffer;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store_buffer_to_buffer", source_desc);
+       u32 length;
+       u8 *buffer;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc);
 
        /* We know that source_desc is a buffer by now */
 
@@ -86,10 +79,10 @@ acpi_ex_store_buffer_to_buffer (
         * allocate a new buffer of the proper length
         */
        if ((target_desc->buffer.length == 0) ||
-               (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
-               target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length);
+           (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
+               target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length);
                if (!target_desc->buffer.pointer) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                target_desc->buffer.length = length;
@@ -100,8 +93,9 @@ acpi_ex_store_buffer_to_buffer (
        if (length <= target_desc->buffer.length) {
                /* Clear existing buffer and copy in the new one */
 
-               ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
-               ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length);
+               ACPI_MEMSET(target_desc->buffer.pointer, 0,
+                           target_desc->buffer.length);
+               ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
 
 #ifdef ACPI_OBSOLETE_BEHAVIOR
                /*
@@ -124,26 +118,24 @@ acpi_ex_store_buffer_to_buffer (
                        target_desc->buffer.length = length;
                }
 #endif
-       }
-       else {
+       } else {
                /* Truncate the source, copy only what will fit */
 
-               ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
-                       target_desc->buffer.length);
+               ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
+                           target_desc->buffer.length);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Truncating source buffer from %X to %X\n",
-                       length, target_desc->buffer.length));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Truncating source buffer from %X to %X\n",
+                                 length, target_desc->buffer.length));
        }
 
        /* Copy flags */
 
        target_desc->buffer.flags = source_desc->buffer.flags;
        target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_store_string_to_string
@@ -158,16 +150,13 @@ acpi_ex_store_buffer_to_buffer (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_store_string_to_string (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc)
+acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *target_desc)
 {
-       u32                             length;
-       u8                              *buffer;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc);
+       u32 length;
+       u8 *buffer;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc);
 
        /* We know that source_desc is a string by now */
 
@@ -179,41 +168,38 @@ acpi_ex_store_string_to_string (
         * pointer is not a static pointer (part of an ACPI table)
         */
        if ((length < target_desc->string.length) &&
-          (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+           (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
                /*
                 * String will fit in existing non-static buffer.
                 * Clear old string and copy in the new one
                 */
-               ACPI_MEMSET (target_desc->string.pointer, 0,
-                       (acpi_size) target_desc->string.length + 1);
-               ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
-       }
-       else {
+               ACPI_MEMSET(target_desc->string.pointer, 0,
+                           (acpi_size) target_desc->string.length + 1);
+               ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+       } else {
                /*
                 * Free the current buffer, then allocate a new buffer
                 * large enough to hold the value
                 */
                if (target_desc->string.pointer &&
-                  (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+                   (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
                        /* Only free if not a pointer into the DSDT */
 
-                       ACPI_MEM_FREE (target_desc->string.pointer);
+                       ACPI_MEM_FREE(target_desc->string.pointer);
                }
 
-               target_desc->string.pointer = ACPI_MEM_CALLOCATE (
-                                  (acpi_size) length + 1);
+               target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size)
+                                                                length + 1);
                if (!target_desc->string.pointer) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-               ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
+               ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
        }
 
        /* Set the new target length */
 
        target_desc->string.length = length;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index cafa702108dc834c8c9ee7d04da8b8048427c686..8a88b841237d551ec0a440b537a9b2eeac192326 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exsystem")
-
+ACPI_MODULE_NAME("exsystem")
 
 /*******************************************************************************
  *
  *              interpreter is released.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ex_system_wait_semaphore (
-       acpi_handle                     semaphore,
-       u16                             timeout)
+acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
 {
-       acpi_status                     status;
-       acpi_status                     status2;
-
+       acpi_status status;
+       acpi_status status2;
 
-       ACPI_FUNCTION_TRACE ("ex_system_wait_semaphore");
+       ACPI_FUNCTION_TRACE("ex_system_wait_semaphore");
 
-
-       status = acpi_os_wait_semaphore (semaphore, 1, 0);
-       if (ACPI_SUCCESS (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_os_wait_semaphore(semaphore, 1, 0);
+       if (ACPI_SUCCESS(status)) {
+               return_ACPI_STATUS(status);
        }
 
        if (status == AE_TIME) {
                /* We must wait, so unlock the interpreter */
 
-               acpi_ex_exit_interpreter ();
+               acpi_ex_exit_interpreter();
 
-               status = acpi_os_wait_semaphore (semaphore, 1, timeout);
+               status = acpi_os_wait_semaphore(semaphore, 1, timeout);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "*** Thread awake after blocking, %s\n",
-                       acpi_format_exception (status)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "*** Thread awake after blocking, %s\n",
+                                 acpi_format_exception(status)));
 
                /* Reacquire the interpreter */
 
-               status2 = acpi_ex_enter_interpreter ();
-               if (ACPI_FAILURE (status2)) {
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_FAILURE(status2)) {
                        /* Report fatal error, could not acquire interpreter */
 
-                       return_ACPI_STATUS (status2);
+                       return_ACPI_STATUS(status2);
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_do_stall
@@ -125,35 +116,29 @@ acpi_ex_system_wait_semaphore (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_do_stall (
-       u32                             how_long)
+acpi_status acpi_ex_system_do_stall(u32 how_long)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
-
-       if (how_long > 255) /* 255 microseconds */ {
+       if (how_long > 255) {   /* 255 microseconds */
                /*
                 * Longer than 255 usec, this is an error
                 *
                 * (ACPI specifies 100 usec as max, but this gives some slack in
                 * order to support existing BIOSs)
                 */
-               ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
-                       how_long));
+               ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n",
+                                  how_long));
                status = AE_AML_OPERAND_VALUE;
-       }
-       else {
-               acpi_os_stall (how_long);
+       } else {
+               acpi_os_stall(how_long);
        }
 
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_do_suspend
@@ -167,29 +152,24 @@ acpi_ex_system_do_stall (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_do_suspend (
-       acpi_integer                    how_long)
+acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_status status;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Since this thread will sleep, we must release the interpreter */
 
-       acpi_ex_exit_interpreter ();
+       acpi_ex_exit_interpreter();
 
-       acpi_os_sleep (how_long);
+       acpi_os_sleep(how_long);
 
        /* And now we must get the interpreter again */
 
-       status = acpi_ex_enter_interpreter ();
+       status = acpi_ex_enter_interpreter();
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_acquire_mutex
@@ -206,33 +186,30 @@ acpi_ex_system_do_suspend (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_acquire_mutex (
-       union acpi_operand_object       *time_desc,
-       union acpi_operand_object       *obj_desc)
+acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
+                            union acpi_operand_object * obj_desc)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ex_system_acquire_mutex", obj_desc);
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc);
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Support for the _GL_ Mutex object -- go get the global lock */
 
        if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-               status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
-               return_ACPI_STATUS (status);
+               status =
+                   acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
-                        (u16) time_desc->integer.value);
-       return_ACPI_STATUS (status);
+       status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore,
+                                              (u16) time_desc->integer.value);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_release_mutex
@@ -248,32 +225,27 @@ acpi_ex_system_acquire_mutex (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_release_mutex (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_system_release_mutex");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_system_release_mutex");
 
        if (!obj_desc) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Support for the _GL_ Mutex object -- release the global lock */
 
        if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
-               status = acpi_ev_release_global_lock ();
-               return_ACPI_STATUS (status);
+               status = acpi_ev_release_global_lock();
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
-       return_ACPI_STATUS (status);
+       status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_signal_event
@@ -287,24 +259,19 @@ acpi_ex_system_release_mutex (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_signal_event (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_system_signal_event");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_system_signal_event");
 
        if (obj_desc) {
-               status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
+               status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_wait_event
@@ -321,25 +288,23 @@ acpi_ex_system_signal_event (
  ******************************************************************************/
 
 acpi_status
-acpi_ex_system_wait_event (
-       union acpi_operand_object       *time_desc,
-       union acpi_operand_object       *obj_desc)
+acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
+                         union acpi_operand_object *obj_desc)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ex_system_wait_event");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ex_system_wait_event");
 
        if (obj_desc) {
-               status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
-                                (u16) time_desc->integer.value);
+               status =
+                   acpi_ex_system_wait_semaphore(obj_desc->event.semaphore,
+                                                 (u16) time_desc->integer.
+                                                 value);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_system_reset_event
@@ -352,27 +317,23 @@ acpi_ex_system_wait_event (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_system_reset_event (
-       union acpi_operand_object       *obj_desc)
+acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
 {
-       acpi_status                     status = AE_OK;
-       void                            *temp_semaphore;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_status status = AE_OK;
+       void *temp_semaphore;
 
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * We are going to simply delete the existing semaphore and
         * create a new one!
         */
-       status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
-       if (ACPI_SUCCESS (status)) {
-               (void) acpi_os_delete_semaphore (obj_desc->event.semaphore);
+       status =
+           acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
+       if (ACPI_SUCCESS(status)) {
+               (void)acpi_os_delete_semaphore(obj_desc->event.semaphore);
                obj_desc->event.semaphore = temp_semaphore;
        }
 
        return (status);
 }
-
index 5c7ec0c0417767243df04097713a95f441dc9834..1ee79d8c8f8827d2895ac6a221b592eea6c78cd0 100644 (file)
@@ -42,7 +42,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * DEFINE_AML_GLOBALS is tested in amlcode.h
  * to determine whether certain global names should be "defined" or only
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_EXECUTER
-        ACPI_MODULE_NAME    ("exutils")
+ACPI_MODULE_NAME("exutils")
 
 /* Local prototypes */
-
-static u32
-acpi_ex_digits_needed (
-       acpi_integer                    value,
-       u32                             base);
-
+static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
 
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
@@ -89,24 +83,20 @@ acpi_ex_digits_needed (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ex_enter_interpreter (
-       void)
+acpi_status acpi_ex_enter_interpreter(void)
 {
-       acpi_status                     status;
-
-       ACPI_FUNCTION_TRACE ("ex_enter_interpreter");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_enter_interpreter");
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
+       status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n"));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_exit_interpreter
@@ -129,25 +119,20 @@ acpi_ex_enter_interpreter (
  *
  ******************************************************************************/
 
-void
-acpi_ex_exit_interpreter (
-       void)
+void acpi_ex_exit_interpreter(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ex_exit_interpreter");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_exit_interpreter");
 
-       status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+       status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not release interpreter mutex\n"));
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_truncate_for32bit_table
@@ -161,20 +146,17 @@ acpi_ex_exit_interpreter (
  *
  ******************************************************************************/
 
-void
-acpi_ex_truncate_for32bit_table (
-       union acpi_operand_object       *obj_desc)
+void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
 {
 
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * Object must be a valid number and we must be executing
         * a control method
         */
        if ((!obj_desc) ||
-               (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) {
+           (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) {
                return;
        }
 
@@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table (
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_acquire_global_lock
@@ -203,37 +184,31 @@ acpi_ex_truncate_for32bit_table (
  *
  ******************************************************************************/
 
-u8
-acpi_ex_acquire_global_lock (
-       u32                             field_flags)
+u8 acpi_ex_acquire_global_lock(u32 field_flags)
 {
-       u8                              locked = FALSE;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ex_acquire_global_lock");
+       u8 locked = FALSE;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_acquire_global_lock");
 
        /* Only attempt lock if the always_lock bit is set */
 
        if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
                /* We should attempt to get the lock, wait forever */
 
-               status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
+               if (ACPI_SUCCESS(status)) {
                        locked = TRUE;
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not acquire Global Lock, %s\n",
-                               acpi_format_exception (status)));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not acquire Global Lock, %s\n",
+                                         acpi_format_exception(status)));
                }
        }
 
-       return_VALUE (locked);
+       return_VALUE(locked);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_release_global_lock
@@ -247,34 +222,28 @@ acpi_ex_acquire_global_lock (
  *
  ******************************************************************************/
 
-void
-acpi_ex_release_global_lock (
-       u8                              locked_by_me)
+void acpi_ex_release_global_lock(u8 locked_by_me)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ex_release_global_lock");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ex_release_global_lock");
 
        /* Only attempt unlock if the caller locked it */
 
        if (locked_by_me) {
                /* OK, now release the lock */
 
-               status = acpi_ev_release_global_lock ();
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ev_release_global_lock();
+               if (ACPI_FAILURE(status)) {
                        /* Report the error, but there isn't much else we can do */
 
-                       ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
-                               acpi_format_exception (status)));
+                       ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status)));
                }
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_digits_needed
@@ -289,22 +258,17 @@ acpi_ex_release_global_lock (
  *
  ******************************************************************************/
 
-static u32
-acpi_ex_digits_needed (
-       acpi_integer                    value,
-       u32                             base)
+static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
 {
-       u32                             num_digits;
-       acpi_integer                    current_value;
-
-
-       ACPI_FUNCTION_TRACE ("ex_digits_needed");
+       u32 num_digits;
+       acpi_integer current_value;
 
+       ACPI_FUNCTION_TRACE("ex_digits_needed");
 
        /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
 
        if (value == 0) {
-               return_VALUE (1);
+               return_VALUE(1);
        }
 
        current_value = value;
@@ -313,14 +277,14 @@ acpi_ex_digits_needed (
        /* Count the digits in the requested base */
 
        while (current_value) {
-               (void) acpi_ut_short_divide (current_value, base, &current_value, NULL);
+               (void)acpi_ut_short_divide(current_value, base, &current_value,
+                                          NULL);
                num_digits++;
        }
 
-       return_VALUE (num_digits);
+       return_VALUE(num_digits);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_eisa_id_to_string
@@ -334,32 +298,26 @@ acpi_ex_digits_needed (
  *
  ******************************************************************************/
 
-void
-acpi_ex_eisa_id_to_string (
-       u32                             numeric_id,
-       char                            *out_string)
+void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string)
 {
-       u32                             eisa_id;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       u32 eisa_id;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Swap ID to big-endian to get contiguous bits */
 
-       eisa_id = acpi_ut_dword_byte_swap (numeric_id);
+       eisa_id = acpi_ut_dword_byte_swap(numeric_id);
 
-       out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f));
-       out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f));
-       out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f));
-       out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12);
-       out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8);
-       out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4);
-       out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0);
+       out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f));
+       out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f));
+       out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f));
+       out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12);
+       out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8);
+       out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4);
+       out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0);
        out_string[7] = 0;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_unsigned_integer_to_string
@@ -369,30 +327,25 @@ acpi_ex_eisa_id_to_string (
  *
  * RETURN:      None, string
  *
- * DESCRIPTOIN: Convert a number to string representation. Assumes string
+ * DESCRIPTION: Convert a number to string representation. Assumes string
  *              buffer is large enough to hold the string.
  *
  ******************************************************************************/
 
-void
-acpi_ex_unsigned_integer_to_string (
-       acpi_integer                    value,
-       char                            *out_string)
+void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string)
 {
-       u32                             count;
-       u32                             digits_needed;
-       u32                             remainder;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       u32 count;
+       u32 digits_needed;
+       u32 remainder;
 
+       ACPI_FUNCTION_ENTRY();
 
-       digits_needed = acpi_ex_digits_needed (value, 10);
+       digits_needed = acpi_ex_digits_needed(value, 10);
        out_string[digits_needed] = 0;
 
        for (count = digits_needed; count > 0; count--) {
-               (void) acpi_ut_short_divide (value, 10, &value, &remainder);
-               out_string[count-1] = (char) ('0' + remainder);\
+               (void)acpi_ut_short_divide(value, 10, &value, &remainder);
+               out_string[count - 1] = (char)('0' + remainder);
        }
 }
 
index 14192ee55f8f1d907ad32fba8ef4f70d17a108bf..e8165c4f162a238bb9627539e32de41e767846e0 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define ACPI_FAN_COMPONENT             0x00200000
 #define ACPI_FAN_CLASS                 "fan"
-#define ACPI_FAN_HID                   "PNP0C0B"
 #define ACPI_FAN_DRIVER_NAME           "ACPI Fan Driver"
-#define ACPI_FAN_DEVICE_NAME           "Fan"
 #define ACPI_FAN_FILE_STATE            "state"
-#define ACPI_FAN_NOTIFY_STATUS         0x80
 
 #define _COMPONENT             ACPI_FAN_COMPONENT
-ACPI_MODULE_NAME               ("acpi_fan")
+ACPI_MODULE_NAME("acpi_fan")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_fan_add (struct acpi_device *device);
-static int acpi_fan_remove (struct acpi_device *device, int type);
+static int acpi_fan_add(struct acpi_device *device);
+static int acpi_fan_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_fan_driver = {
-       .name =         ACPI_FAN_DRIVER_NAME,
-       .class =        ACPI_FAN_CLASS,
-       .ids =          ACPI_FAN_HID,
-       .ops =          {
-                               .add =          acpi_fan_add,
-                               .remove =       acpi_fan_remove,
-                       },
+       .name = ACPI_FAN_DRIVER_NAME,
+       .class = ACPI_FAN_CLASS,
+       .ids = "PNP0C0B",
+       .ops = {
+               .add = acpi_fan_add,
+               .remove = acpi_fan_remove,
+               },
 };
 
 struct acpi_fan {
-       acpi_handle             handle;
+       acpi_handle handle;
 };
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_fan_dir;
+static struct proc_dir_entry *acpi_fan_dir;
 
-
-static int
-acpi_fan_read_state (struct seq_file *seq, void *offset)
+static int acpi_fan_read_state(struct seq_file *seq, void *offset)
 {
-       struct acpi_fan         *fan = seq->private;
-       int                     state = 0;
+       struct acpi_fan *fan = seq->private;
+       int state = 0;
 
        ACPI_FUNCTION_TRACE("acpi_fan_read_state");
 
@@ -88,7 +81,7 @@ acpi_fan_read_state (struct seq_file *seq, void *offset)
                        seq_printf(seq, "status:                  ERROR\n");
                else
                        seq_printf(seq, "status:                  %s\n",
-                                    !state?"on":"off");
+                                  !state ? "on" : "off");
        }
        return_VALUE(0);
 }
@@ -99,29 +92,26 @@ static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
 }
 
 static ssize_t
-acpi_fan_write_state (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_fan_write_state(struct file *file, const char __user * buffer,
+                    size_t count, loff_t * ppos)
 {
-       int                     result = 0;
-       struct seq_file         *m = (struct seq_file *)file->private_data;
-       struct acpi_fan         *fan = (struct acpi_fan *) m->private;
-       char                    state_string[12] = {'\0'};
+       int result = 0;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_fan *fan = (struct acpi_fan *)m->private;
+       char state_string[12] = { '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_fan_write_state");
 
        if (!fan || (count > sizeof(state_string) - 1))
                return_VALUE(-EINVAL);
-       
+
        if (copy_from_user(state_string, buffer, count))
                return_VALUE(-EFAULT);
-       
+
        state_string[count] = '\0';
-       
-       result = acpi_bus_set_power(fan->handle, 
-               simple_strtoul(state_string, NULL, 0));
+
+       result = acpi_bus_set_power(fan->handle,
+                                   simple_strtoul(state_string, NULL, 0));
        if (result)
                return_VALUE(result);
 
@@ -129,19 +119,17 @@ acpi_fan_write_state (
 }
 
 static struct file_operations acpi_fan_state_ops = {
-       .open           = acpi_fan_state_open_fs,
-       .read           = seq_read,
-       .write          = acpi_fan_write_state,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_fan_state_open_fs,
+       .read = seq_read,
+       .write = acpi_fan_write_state,
+       .llseek = seq_lseek,
+       .release = single_release,
        .owner = THIS_MODULE,
 };
 
-static int
-acpi_fan_add_fs (
-       struct acpi_device      *device)
+static int acpi_fan_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
 
@@ -150,7 +138,7 @@ acpi_fan_add_fs (
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_fan_dir);
+                                                    acpi_fan_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                acpi_device_dir(device)->owner = THIS_MODULE;
@@ -158,11 +146,12 @@ acpi_fan_add_fs (
 
        /* 'status' [R/W] */
        entry = create_proc_entry(ACPI_FAN_FILE_STATE,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_FAN_FILE_STATE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_FAN_FILE_STATE));
        else {
                entry->proc_fops = &acpi_fan_state_ops;
                entry->data = acpi_driver_data(device);
@@ -172,16 +161,12 @@ acpi_fan_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_fan_remove_fs (
-       struct acpi_device      *device)
+static int acpi_fan_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
 
        if (acpi_device_dir(device)) {
-               remove_proc_entry(ACPI_FAN_FILE_STATE,
-                                 acpi_device_dir(device));
+               remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
                remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
                acpi_device_dir(device) = NULL;
        }
@@ -189,18 +174,15 @@ acpi_fan_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static int
-acpi_fan_add (
-       struct acpi_device      *device)
+static int acpi_fan_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       struct acpi_fan         *fan = NULL;
-       int                     state = 0;
+       int result = 0;
+       struct acpi_fan *fan = NULL;
+       int state = 0;
 
        ACPI_FUNCTION_TRACE("acpi_fan_add");
 
@@ -213,14 +195,14 @@ acpi_fan_add (
        memset(fan, 0, sizeof(struct acpi_fan));
 
        fan->handle = device->handle;
-       strcpy(acpi_device_name(device), ACPI_FAN_DEVICE_NAME);
+       strcpy(acpi_device_name(device), "Fan");
        strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
        acpi_driver_data(device) = fan;
 
        result = acpi_bus_get_power(fan->handle, &state);
        if (result) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error reading power state\n"));
+                                 "Error reading power state\n"));
                goto end;
        }
 
@@ -229,30 +211,26 @@ acpi_fan_add (
                goto end;
 
        printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
-               acpi_device_name(device), acpi_device_bid(device),
-               !device->power.state?"on":"off");
+              acpi_device_name(device), acpi_device_bid(device),
+              !device->power.state ? "on" : "off");
 
-end:
+      end:
        if (result)
                kfree(fan);
 
        return_VALUE(result);
 }
 
-
-static int
-acpi_fan_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_fan_remove(struct acpi_device *device, int type)
 {
-       struct acpi_fan         *fan = NULL;
+       struct acpi_fan *fan = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_fan_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       fan = (struct acpi_fan *) acpi_driver_data(device);
+       fan = (struct acpi_fan *)acpi_driver_data(device);
 
        acpi_fan_remove_fs(device);
 
@@ -261,11 +239,9 @@ acpi_fan_remove (
        return_VALUE(0);
 }
 
-
-static int __init
-acpi_fan_init (void)
+static int __init acpi_fan_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_fan_init");
 
@@ -283,9 +259,7 @@ acpi_fan_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_fan_exit (void)
+static void __exit acpi_fan_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_fan_exit");
 
@@ -296,7 +270,5 @@ acpi_fan_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_fan_init);
 module_exit(acpi_fan_exit);
-
index 770cfc8b17e0cdbf00f85639ec508f7a6c12a6e2..e36c5da2b31a78efaa2661c053b2b0f8d9e4cd02 100644 (file)
@@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
                down_write(&bus_type_sem);
                list_add_tail(&type->list, &bus_type_list);
                up_write(&bus_type_sem);
-               printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name);
+               printk(KERN_INFO PREFIX "bus type %s registered\n",
+                      type->bus->name);
                return 0;
        }
        return -ENODEV;
@@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
                down_write(&bus_type_sem);
                list_del_init(&type->list);
                up_write(&bus_type_sem);
-               printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name);
+               printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n",
+                      type->bus->name);
                return 0;
        }
        return -ENODEV;
@@ -168,9 +170,6 @@ find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv)
        status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &seg);
        if (status == AE_NOT_FOUND) {
                /* Assume seg = 0 */
-               printk(KERN_INFO PREFIX
-                      "Assume root bridge [%s] segment is 0\n",
-                      (char *)buffer.pointer);
                status = AE_OK;
                seg = 0;
        }
index b51001e74eea9c8440c2e2db7a2a10243a809f3f..1bb3463d7040ae6b5913a8863999bff17e920543 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
-
 #define _COMPONENT          ACPI_HARDWARE
-        ACPI_MODULE_NAME    ("hwacpi")
-
+ACPI_MODULE_NAME("hwacpi")
 
 /******************************************************************************
  *
  *              the FADT.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_hw_initialize (
-       void)
+acpi_status acpi_hw_initialize(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("hw_initialize");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("hw_initialize");
 
        /* We must have the ACPI tables by the time we get here */
 
        if (!acpi_gbl_FADT) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n"));
 
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        /* Sanity check the FADT for valid values */
 
-       status = acpi_ut_validate_fadt ();
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_fadt();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_set_mode
@@ -104,24 +95,21 @@ acpi_hw_initialize (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_set_mode (
-       u32                             mode)
+acpi_status acpi_hw_set_mode(u32 mode)
 {
 
-       acpi_status                     status;
-       u32                             retry;
-
+       acpi_status status;
+       u32 retry;
 
-       ACPI_FUNCTION_TRACE ("hw_set_mode");
+       ACPI_FUNCTION_TRACE("hw_set_mode");
 
        /*
         * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
         * system does not support mode transition.
         */
        if (!acpi_gbl_FADT->smi_cmd) {
-               ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n"));
-               return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+               ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n"));
+               return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
        }
 
        /*
@@ -132,9 +120,8 @@ acpi_hw_set_mode (
         * transitions are not supported.
         */
        if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
-               ACPI_REPORT_ERROR ((
-                       "No ACPI mode transition supported in this system (enable/disable both zero)\n"));
-               return_ACPI_STATUS (AE_OK);
+               ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
+               return_ACPI_STATUS(AE_OK);
        }
 
        switch (mode) {
@@ -142,9 +129,11 @@ acpi_hw_set_mode (
 
                /* BIOS should have disabled ALL fixed and GP events */
 
-               status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-                                 (u32) acpi_gbl_FADT->acpi_enable, 8);
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
+               status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+                                           (u32) acpi_gbl_FADT->acpi_enable,
+                                           8);
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Attempting to enable ACPI mode\n"));
                break;
 
        case ACPI_SYS_MODE_LEGACY:
@@ -153,20 +142,21 @@ acpi_hw_set_mode (
                 * BIOS should clear all fixed status bits and restore fixed event
                 * enable bits to default
                 */
-               status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-                                (u32) acpi_gbl_FADT->acpi_disable, 8);
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                                "Attempting to enable Legacy (non-ACPI) mode\n"));
+               status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+                                           (u32) acpi_gbl_FADT->acpi_disable,
+                                           8);
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Attempting to enable Legacy (non-ACPI) mode\n"));
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not write mode change, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -176,19 +166,19 @@ acpi_hw_set_mode (
        retry = 3000;
        while (retry) {
                if (acpi_hw_get_mode() == mode) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
-                               mode));
-                       return_ACPI_STATUS (AE_OK);
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Mode %X successfully enabled\n",
+                                         mode));
+                       return_ACPI_STATUS(AE_OK);
                }
                acpi_os_stall(1000);
                retry--;
        }
 
-       ACPI_REPORT_ERROR (("Hardware never changed modes\n"));
-       return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
+       ACPI_REPORT_ERROR(("Hardware never changed modes\n"));
+       return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_hw_get_mode
@@ -202,34 +192,30 @@ acpi_hw_set_mode (
  *
  ******************************************************************************/
 
-u32
-acpi_hw_get_mode (
-       void)
+u32 acpi_hw_get_mode(void)
 {
-       acpi_status                     status;
-       u32                             value;
-
-
-       ACPI_FUNCTION_TRACE ("hw_get_mode");
+       acpi_status status;
+       u32 value;
 
+       ACPI_FUNCTION_TRACE("hw_get_mode");
 
        /*
         * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
         * system does not support mode transition.
         */
        if (!acpi_gbl_FADT->smi_cmd) {
-               return_VALUE (ACPI_SYS_MODE_ACPI);
+               return_VALUE(ACPI_SYS_MODE_ACPI);
        }
 
-       status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_VALUE (ACPI_SYS_MODE_LEGACY);
+       status =
+           acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_VALUE(ACPI_SYS_MODE_LEGACY);
        }
 
        if (value) {
-               return_VALUE (ACPI_SYS_MODE_ACPI);
-       }
-       else {
-               return_VALUE (ACPI_SYS_MODE_LEGACY);
+               return_VALUE(ACPI_SYS_MODE_ACPI);
+       } else {
+               return_VALUE(ACPI_SYS_MODE_LEGACY);
        }
 }
index 8daeabb2fc7abdd386d689d2286d676bf3dd0340..5c8e5dfd024e5fea65c093a2afe7ca9912265799 100644 (file)
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-        ACPI_MODULE_NAME    ("hwgpe")
+ACPI_MODULE_NAME("hwgpe")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_hw_enable_wakeup_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
-
+acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                               struct acpi_gpe_block_info *gpe_block);
 
 /******************************************************************************
  *
@@ -71,15 +68,12 @@ acpi_hw_enable_wakeup_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_write_gpe_enable_reg (
-       struct acpi_gpe_event_info      *gpe_event_info)
+acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
 {
-       struct acpi_gpe_register_info   *gpe_register_info;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_gpe_register_info *gpe_register_info;
+       acpi_status status;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Get the info block for the entire GPE register */
 
@@ -90,13 +84,12 @@ acpi_hw_write_gpe_enable_reg (
 
        /* Write the entire GPE (runtime) enable register */
 
-       status = acpi_hw_low_level_write (8, gpe_register_info->enable_for_run,
-                         &gpe_register_info->enable_address);
+       status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
+                                        &gpe_register_info->enable_address);
 
        return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_clear_gpe
@@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_clear_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info)
+acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_status status;
 
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * Write a one to the appropriate bit in the status register to
         * clear this GPE.
         */
-       status = acpi_hw_low_level_write (8, gpe_event_info->register_bit,
-                         &gpe_event_info->register_info->status_address);
+       status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
+                                        &gpe_event_info->register_info->
+                                        status_address);
 
        return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_get_gpe_status
@@ -145,19 +134,16 @@ acpi_hw_clear_gpe (
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_hw_get_gpe_status (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       acpi_event_status               *event_status)
+acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
+                      acpi_event_status * event_status)
 {
-       u32                             in_byte;
-       u8                              register_bit;
-       struct acpi_gpe_register_info   *gpe_register_info;
-       acpi_status                     status;
-       acpi_event_status               local_event_status = 0;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       u32 in_byte;
+       u8 register_bit;
+       struct acpi_gpe_register_info *gpe_register_info;
+       acpi_status status;
+       acpi_event_status local_event_status = 0;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (!event_status) {
                return (AE_BAD_PARAMETER);
@@ -185,8 +171,10 @@ acpi_hw_get_gpe_status (
 
        /* GPE currently active (status bit == 1)? */
 
-       status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address);
-       if (ACPI_FAILURE (status)) {
+       status =
+           acpi_hw_low_level_read(8, &in_byte,
+                                  &gpe_register_info->status_address);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
@@ -198,12 +186,10 @@ acpi_hw_get_gpe_status (
 
        (*event_status) = local_event_status;
 
-
-unlock_and_exit:
+      unlock_and_exit:
        return (status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /******************************************************************************
  *
@@ -219,22 +205,21 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_hw_disable_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+                         struct acpi_gpe_block_info * gpe_block)
 {
-       u32                             i;
-       acpi_status                     status;
-
+       u32 i;
+       acpi_status status;
 
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
                /* Disable all GPEs in this register */
 
-               status = acpi_hw_low_level_write (8, 0x00,
-                                &gpe_block->register_info[i].enable_address);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_low_level_write(8, 0x00,
+                                                &gpe_block->register_info[i].
+                                                enable_address);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
@@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block (
        return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_clear_gpe_block
@@ -257,22 +241,21 @@ acpi_hw_disable_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_clear_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+                       struct acpi_gpe_block_info * gpe_block)
 {
-       u32                             i;
-       acpi_status                     status;
-
+       u32 i;
+       acpi_status status;
 
        /* Examine each GPE Register within the block */
 
        for (i = 0; i < gpe_block->register_count; i++) {
                /* Clear status on all GPEs in this register */
 
-               status = acpi_hw_low_level_write (8, 0xFF,
-                                &gpe_block->register_info[i].status_address);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_low_level_write(8, 0xFF,
+                                                &gpe_block->register_info[i].
+                                                status_address);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
@@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block (
        return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_runtime_gpe_block
@@ -296,13 +278,11 @@ acpi_hw_clear_gpe_block (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_enable_runtime_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
+                                struct acpi_gpe_block_info * gpe_block)
 {
-       u32                             i;
-       acpi_status                     status;
-
+       u32 i;
+       acpi_status status;
 
        /* NOTE: assumes that all GPEs are currently disabled */
 
@@ -315,9 +295,13 @@ acpi_hw_enable_runtime_gpe_block (
 
                /* Enable all "runtime" GPEs in this register */
 
-               status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run,
-                                &gpe_block->register_info[i].enable_address);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_write(8,
+                                           gpe_block->register_info[i].
+                                           enable_for_run,
+                                           &gpe_block->register_info[i].
+                                           enable_address);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
@@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block (
        return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_wakeup_gpe_block
@@ -341,13 +324,11 @@ acpi_hw_enable_runtime_gpe_block (
  ******************************************************************************/
 
 static acpi_status
-acpi_hw_enable_wakeup_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block)
+acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                               struct acpi_gpe_block_info *gpe_block)
 {
-       u32                             i;
-       acpi_status                     status;
-
+       u32 i;
+       acpi_status status;
 
        /* Examine each GPE Register within the block */
 
@@ -358,10 +339,12 @@ acpi_hw_enable_wakeup_gpe_block (
 
                /* Enable all "wake" GPEs in this register */
 
-               status = acpi_hw_low_level_write (8,
-                                gpe_block->register_info[i].enable_for_wake,
-                                &gpe_block->register_info[i].enable_address);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_low_level_write(8,
+                                                gpe_block->register_info[i].
+                                                enable_for_wake,
+                                                &gpe_block->register_info[i].
+                                                enable_address);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
@@ -369,12 +352,11 @@ acpi_hw_enable_wakeup_gpe_block (
        return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_disable_all_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -382,27 +364,22 @@ acpi_hw_enable_wakeup_gpe_block (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_disable_all_gpes (
-       u32                             flags)
+acpi_status acpi_hw_disable_all_gpes(void)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("hw_disable_all_gpes");
+       ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
 
-
-       status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block, flags);
-       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, flags);
-       return_ACPI_STATUS (status);
+       status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
+       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_all_runtime_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -410,26 +387,21 @@ acpi_hw_disable_all_gpes (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_enable_all_runtime_gpes (
-       u32                             flags)
+acpi_status acpi_hw_enable_all_runtime_gpes(void)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
+       ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
 
-
-       status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block, flags);
-       return_ACPI_STATUS (status);
+       status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_enable_all_wakeup_gpes
  *
- * PARAMETERS:  Flags           - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS:  None
  *
  * RETURN:      Status
  *
@@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_enable_all_wakeup_gpes (
-       u32                             flags)
+acpi_status acpi_hw_enable_all_wakeup_gpes(void)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
+       ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
 
-
-       status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block, flags);
-       return_ACPI_STATUS (status);
+       status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
+       return_ACPI_STATUS(status);
 }
-
index 6d9e4eb848361539bce2d394279d37d7ce8389ab..536a7aea80c93a802f206a0268d9c688d48478a3 100644 (file)
@@ -50,8 +50,7 @@
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-        ACPI_MODULE_NAME    ("hwregs")
-
+ACPI_MODULE_NAME("hwregs")
 
 /*******************************************************************************
  *
  *              THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
  *
  ******************************************************************************/
-
-acpi_status
-acpi_hw_clear_acpi_status (
-       u32                             flags)
+acpi_status acpi_hw_clear_acpi_status(u32 flags)
 {
-       acpi_status                     status;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("hw_clear_acpi_status");
+       ACPI_FUNCTION_TRACE("hw_clear_acpi_status");
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
-               ACPI_BITMASK_ALL_FIXED_STATUS,
-               (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
+       ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
+                         ACPI_BITMASK_ALL_FIXED_STATUS,
+                         (u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
 
        if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
-       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1_STATUS,
-                        ACPI_BITMASK_ALL_FIXED_STATUS);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                       ACPI_REGISTER_PM1_STATUS,
+                                       ACPI_BITMASK_ALL_FIXED_STATUS);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Clear the fixed events */
 
        if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
-               status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
-                                &acpi_gbl_FADT->xpm1b_evt_blk);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
+                                           &acpi_gbl_FADT->xpm1b_evt_blk);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
        }
 
        /* Clear the GPE Bits in all GPE registers in all GPE blocks */
 
-       status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block, ACPI_ISR);
+       status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
 
-unlock_and_exit:
+      unlock_and_exit:
        if (flags & ACPI_MTX_LOCK) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_sleep_type_data
@@ -132,53 +126,48 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_get_sleep_type_data (
-       u8                              sleep_state,
-       u8                              *sleep_type_a,
-       u8                              *sleep_type_b)
+acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_parameter_info      info;
-       char                            *sleep_state_name;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
+       acpi_status status = AE_OK;
+       struct acpi_parameter_info info;
+       char *sleep_state_name;
 
+       ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data");
 
        /* Validate parameters */
 
-       if ((sleep_state > ACPI_S_STATES_MAX) ||
-               !sleep_type_a || !sleep_type_b) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Evaluate the namespace object containing the values for this state */
 
        info.parameters = NULL;
        info.return_object = NULL;
-       sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
+       sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state];
 
-       status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "%s while evaluating sleep_state [%s]\n",
-                       acpi_format_exception (status), sleep_state_name));
+       status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "%s while evaluating sleep_state [%s]\n",
+                                 acpi_format_exception(status),
+                                 sleep_state_name));
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Must have a return object */
 
        if (!info.return_object) {
-               ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
-                       sleep_state_name));
+               ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n",
+                                  sleep_state_name));
                status = AE_NOT_EXIST;
        }
 
        /* It must be of type Package */
 
-       else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
-               ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
+       else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) {
+               ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n"));
                status = AE_AML_OPERAND_TYPE;
        }
 
@@ -190,45 +179,41 @@ acpi_get_sleep_type_data (
         * one per sleep type (A/B).
         */
        else if (info.return_object->package.count < 2) {
-               ACPI_REPORT_ERROR ((
-                       "Sleep State return package does not have at least two elements\n"));
+               ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n"));
                status = AE_AML_NO_OPERAND;
        }
 
        /* The first two elements must both be of type Integer */
 
-       else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
-                        != ACPI_TYPE_INTEGER) ||
-                        (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
-                               != ACPI_TYPE_INTEGER)) {
-               ACPI_REPORT_ERROR ((
-                       "Sleep State return package elements are not both Integers (%s, %s)\n",
-                       acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
-                       acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
+       else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0])
+                 != ACPI_TYPE_INTEGER) ||
+                (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
+                 != ACPI_TYPE_INTEGER)) {
+               ACPI_REPORT_ERROR(("Sleep State return package elements are not both Integers (%s, %s)\n", acpi_ut_get_object_type_name(info.return_object->package.elements[0]), acpi_ut_get_object_type_name(info.return_object->package.elements[1])));
                status = AE_AML_OPERAND_TYPE;
-       }
-       else {
+       } else {
                /* Valid _Sx_ package size, type, and value */
 
                *sleep_type_a = (u8)
-                       (info.return_object->package.elements[0])->integer.value;
+                   (info.return_object->package.elements[0])->integer.value;
                *sleep_type_b = (u8)
-                       (info.return_object->package.elements[1])->integer.value;
+                   (info.return_object->package.elements[1])->integer.value;
        }
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
-                       acpi_format_exception (status),
-                       sleep_state_name, info.return_object,
-                       acpi_ut_get_object_type_name (info.return_object)));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
+                                 acpi_format_exception(status),
+                                 sleep_state_name, info.return_object,
+                                 acpi_ut_get_object_type_name(info.
+                                                              return_object)));
        }
 
-       acpi_ut_remove_reference (info.return_object);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(info.return_object);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_sleep_type_data);
 
+EXPORT_SYMBOL(acpi_get_sleep_type_data);
 
 /*******************************************************************************
  *
@@ -242,22 +227,20 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
  *
  ******************************************************************************/
 
-struct acpi_bit_register_info *
-acpi_hw_get_bit_register_info (
-       u32                             register_id)
+struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
 {
-       ACPI_FUNCTION_NAME ("hw_get_bit_register_info");
-
+       ACPI_FUNCTION_NAME("hw_get_bit_register_info");
 
        if (register_id > ACPI_BITREG_MAX) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid bit_register ID: %X\n", register_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid bit_register ID: %X\n",
+                                 register_id));
                return (NULL);
        }
 
        return (&acpi_gbl_bit_register_info[register_id]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_register
@@ -273,59 +256,56 @@ acpi_hw_get_bit_register_info (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_register (
-       u32                             register_id,
-       u32                             *return_value,
-       u32                             flags)
+acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
 {
-       u32                             register_value = 0;
-       struct acpi_bit_register_info   *bit_reg_info;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_register");
+       u32 register_value = 0;
+       struct acpi_bit_register_info *bit_reg_info;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_register");
 
        /* Get the info structure corresponding to the requested ACPI Register */
 
-       bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+       bit_reg_info = acpi_hw_get_bit_register_info(register_id);
        if (!bit_reg_info) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Read from the register */
 
-       status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-                         bit_reg_info->parent_register, &register_value);
+       status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                      bit_reg_info->parent_register,
+                                      &register_value);
 
        if (flags & ACPI_MTX_LOCK) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
        }
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                /* Normalize the value that was read */
 
-               register_value = ((register_value & bit_reg_info->access_bit_mask)
-                                  >> bit_reg_info->bit_position);
+               register_value =
+                   ((register_value & bit_reg_info->access_bit_mask)
+                    >> bit_reg_info->bit_position);
 
                *return_value = register_value;
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
-                               register_value, bit_reg_info->parent_register));
+               ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n",
+                                 register_value,
+                                 bit_reg_info->parent_register));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_register);
 
+EXPORT_SYMBOL(acpi_get_register);
 
 /*******************************************************************************
  *
@@ -342,40 +322,36 @@ EXPORT_SYMBOL(acpi_get_register);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_register (
-       u32                             register_id,
-       u32                             value,
-       u32                             flags)
+acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
 {
-       u32                             register_value = 0;
-       struct acpi_bit_register_info   *bit_reg_info;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id);
+       u32 register_value = 0;
+       struct acpi_bit_register_info *bit_reg_info;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id);
 
        /* Get the info structure corresponding to the requested ACPI Register */
 
-       bit_reg_info = acpi_hw_get_bit_register_info (register_id);
+       bit_reg_info = acpi_hw_get_bit_register_info(register_id);
        if (!bit_reg_info) {
-               ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n",
+                                  register_id));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (flags & ACPI_MTX_LOCK) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Always do a register read first so we can insert the new bits  */
 
-       status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-                        bit_reg_info->parent_register, &register_value);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                      bit_reg_info->parent_register,
+                                      &register_value);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
@@ -395,26 +371,30 @@ acpi_set_register (
                 * information is the single bit we're interested in, all others should
                 * be written as 0 so they will be left unchanged.
                 */
-               value = ACPI_REGISTER_PREPARE_BITS (value,
-                                bit_reg_info->bit_position, bit_reg_info->access_bit_mask);
+               value = ACPI_REGISTER_PREPARE_BITS(value,
+                                                  bit_reg_info->bit_position,
+                                                  bit_reg_info->
+                                                  access_bit_mask);
                if (value) {
-                       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                        ACPI_REGISTER_PM1_STATUS, (u16) value);
+                       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                                       ACPI_REGISTER_PM1_STATUS,
+                                                       (u16) value);
                        register_value = 0;
                }
                break;
 
-
        case ACPI_REGISTER_PM1_ENABLE:
 
-               ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-                               bit_reg_info->access_bit_mask, value);
+               ACPI_REGISTER_INSERT_VALUE(register_value,
+                                          bit_reg_info->bit_position,
+                                          bit_reg_info->access_bit_mask,
+                                          value);
 
-               status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
+               status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                               ACPI_REGISTER_PM1_ENABLE,
+                                               (u16) register_value);
                break;
 
-
        case ACPI_REGISTER_PM1_CONTROL:
 
                /*
@@ -422,65 +402,73 @@ acpi_set_register (
                 * Note that at this level, the fact that there are actually TWO
                 * registers (A and B - and B may not exist) is abstracted.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
+               ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n",
+                                 register_value));
 
-               ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-                               bit_reg_info->access_bit_mask, value);
+               ACPI_REGISTER_INSERT_VALUE(register_value,
+                                          bit_reg_info->bit_position,
+                                          bit_reg_info->access_bit_mask,
+                                          value);
 
-               status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM1_CONTROL, (u16) register_value);
+               status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                               ACPI_REGISTER_PM1_CONTROL,
+                                               (u16) register_value);
                break;
 
-
        case ACPI_REGISTER_PM2_CONTROL:
 
-               status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM2_CONTROL, &register_value);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                              ACPI_REGISTER_PM2_CONTROL,
+                                              &register_value);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
-                       register_value,
-                       ACPI_FORMAT_UINT64 (
-                               acpi_gbl_FADT->xpm2_cnt_blk.address)));
-
-               ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
-                               bit_reg_info->access_bit_mask, value);
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
-                       register_value,
-                       ACPI_FORMAT_UINT64 (
-                               acpi_gbl_FADT->xpm2_cnt_blk.address)));
-
-               status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
+               ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                                 "PM2 control: Read %X from %8.8X%8.8X\n",
+                                 register_value,
+                                 ACPI_FORMAT_UINT64(acpi_gbl_FADT->
+                                                    xpm2_cnt_blk.address)));
+
+               ACPI_REGISTER_INSERT_VALUE(register_value,
+                                          bit_reg_info->bit_position,
+                                          bit_reg_info->access_bit_mask,
+                                          value);
+
+               ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                                 "About to write %4.4X to %8.8X%8.8X\n",
+                                 register_value,
+                                 ACPI_FORMAT_UINT64(acpi_gbl_FADT->
+                                                    xpm2_cnt_blk.address)));
+
+               status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                               ACPI_REGISTER_PM2_CONTROL,
+                                               (u8) (register_value));
                break;
 
-
        default:
                break;
        }
 
-
-unlock_and_exit:
+      unlock_and_exit:
 
        if (flags & ACPI_MTX_LOCK) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
        }
 
        /* Normalize the value that was read */
 
-       ACPI_DEBUG_EXEC (register_value =
-               ((register_value & bit_reg_info->access_bit_mask) >>
-                       bit_reg_info->bit_position));
+       ACPI_DEBUG_EXEC(register_value =
+                       ((register_value & bit_reg_info->access_bit_mask) >>
+                        bit_reg_info->bit_position));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
-                       value, register_value, bit_reg_info->parent_register));
-       return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Set bits: %8.8X actual %8.8X register %X\n", value,
+                         register_value, bit_reg_info->parent_register));
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_set_register);
 
+EXPORT_SYMBOL(acpi_set_register);
 
 /******************************************************************************
  *
@@ -498,103 +486,107 @@ EXPORT_SYMBOL(acpi_set_register);
  ******************************************************************************/
 
 acpi_status
-acpi_hw_register_read (
-       u8                              use_lock,
-       u32                             register_id,
-       u32                             *return_value)
+acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
 {
-       u32                             value1 = 0;
-       u32                             value2 = 0;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("hw_register_read");
+       u32 value1 = 0;
+       u32 value2 = 0;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("hw_register_read");
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        switch (register_id) {
-       case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
+       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
 
-               status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_read(16, &value1,
+                                          &acpi_gbl_FADT->xpm1a_evt_blk);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
                /* PM1B is optional */
 
-               status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_evt_blk);
+               status =
+                   acpi_hw_low_level_read(16, &value2,
+                                          &acpi_gbl_FADT->xpm1b_evt_blk);
                value1 |= value2;
                break;
 
+       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
 
-       case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access */
-
-               status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_xpm1a_enable);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
                /* PM1B is optional */
 
-               status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_xpm1b_enable);
+               status =
+                   acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
                value1 |= value2;
                break;
 
+       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
 
-       case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
-
-               status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_read(16, &value1,
+                                          &acpi_gbl_FADT->xpm1a_cnt_blk);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
-               status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_cnt_blk);
+               status =
+                   acpi_hw_low_level_read(16, &value2,
+                                          &acpi_gbl_FADT->xpm1b_cnt_blk);
                value1 |= value2;
                break;
 
+       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
 
-       case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
-               status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk);
+               status =
+                   acpi_hw_low_level_read(8, &value1,
+                                          &acpi_gbl_FADT->xpm2_cnt_blk);
                break;
 
+       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
 
-       case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
-
-               status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk);
+               status =
+                   acpi_hw_low_level_read(32, &value1,
+                                          &acpi_gbl_FADT->xpm_tmr_blk);
                break;
 
-       case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
+       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
 
-               status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8);
+               status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8);
                break;
 
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
-                       register_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
+                                 register_id));
                status = AE_BAD_PARAMETER;
                break;
        }
 
-unlock_and_exit:
+      unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
        }
 
-       if (ACPI_SUCCESS (status)) {
+       if (ACPI_SUCCESS(status)) {
                *return_value = value1;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_register_write
@@ -610,109 +602,112 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_hw_register_write (
-       u8                              use_lock,
-       u32                             register_id,
-       u32                             value)
+acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("hw_register_write");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("hw_register_write");
 
        if (ACPI_MTX_LOCK == use_lock) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        switch (register_id) {
-       case ACPI_REGISTER_PM1_STATUS:           /* 16-bit access */
+       case ACPI_REGISTER_PM1_STATUS:  /* 16-bit access */
 
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1a_evt_blk);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
                /* PM1B is optional */
 
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_evt_blk);
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1b_evt_blk);
                break;
 
+       case ACPI_REGISTER_PM1_ENABLE:  /* 16-bit access */
 
-       case ACPI_REGISTER_PM1_ENABLE:           /* 16-bit access*/
-
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1a_enable);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
                /* PM1B is optional */
 
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1b_enable);
+               status =
+                   acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
                break;
 
+       case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
 
-       case ACPI_REGISTER_PM1_CONTROL:          /* 16-bit access */
-
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1a_cnt_blk);
+               if (ACPI_FAILURE(status)) {
                        goto unlock_and_exit;
                }
 
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1b_cnt_blk);
                break;
 
+       case ACPI_REGISTER_PM1A_CONTROL:        /* 16-bit access */
 
-       case ACPI_REGISTER_PM1A_CONTROL:         /* 16-bit access */
-
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1a_cnt_blk);
                break;
 
+       case ACPI_REGISTER_PM1B_CONTROL:        /* 16-bit access */
 
-       case ACPI_REGISTER_PM1B_CONTROL:         /* 16-bit access */
-
-               status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
+               status =
+                   acpi_hw_low_level_write(16, value,
+                                           &acpi_gbl_FADT->xpm1b_cnt_blk);
                break;
 
+       case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
 
-       case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
-               status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk);
+               status =
+                   acpi_hw_low_level_write(8, value,
+                                           &acpi_gbl_FADT->xpm2_cnt_blk);
                break;
 
+       case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
 
-       case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
-
-               status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk);
+               status =
+                   acpi_hw_low_level_write(32, value,
+                                           &acpi_gbl_FADT->xpm_tmr_blk);
                break;
 
-
-       case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
+       case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
 
                /* SMI_CMD is currently always in IO space */
 
-               status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
+               status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
                break;
 
-
        default:
                status = AE_BAD_PARAMETER;
                break;
        }
 
-unlock_and_exit:
+      unlock_and_exit:
        if (ACPI_MTX_LOCK == use_lock) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_low_level_read
@@ -728,17 +723,12 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_hw_low_level_read (
-       u32                             width,
-       u32                             *value,
-       struct acpi_generic_address     *reg)
+acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
 {
-       u64                             address;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_NAME ("hw_low_level_read");
+       u64 address;
+       acpi_status status;
 
+       ACPI_FUNCTION_NAME("hw_low_level_read");
 
        /*
         * Must have a valid pointer to a GAS structure, and
@@ -751,7 +741,7 @@ acpi_hw_low_level_read (
 
        /* Get a local copy of the address.  Handles possible alignment issues */
 
-       ACPI_MOVE_64_TO_64 (&address, &reg->address);
+       ACPI_MOVE_64_TO_64(&address, &reg->address);
        if (!address) {
                return (AE_OK);
        }
@@ -764,35 +754,32 @@ acpi_hw_low_level_read (
        switch (reg->address_space_id) {
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
-               status = acpi_os_read_memory (
-                                (acpi_physical_address) address,
-                                value, width);
+               status = acpi_os_read_memory((acpi_physical_address) address,
+                                            value, width);
                break;
 
-
        case ACPI_ADR_SPACE_SYSTEM_IO:
 
-               status = acpi_os_read_port ((acpi_io_address) address,
-                                value, width);
+               status = acpi_os_read_port((acpi_io_address) address,
+                                          value, width);
                break;
 
-
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unsupported address space: %X\n", reg->address_space_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unsupported address space: %X\n",
+                                 reg->address_space_id));
                return (AE_BAD_PARAMETER);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-               "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-               *value, width,
-               ACPI_FORMAT_UINT64 (address),
-               acpi_ut_get_region_name (reg->address_space_id)));
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
+                         *value, width,
+                         ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->address_space_id)));
 
        return (status);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_hw_low_level_write
@@ -808,17 +795,12 @@ acpi_hw_low_level_read (
  ******************************************************************************/
 
 acpi_status
-acpi_hw_low_level_write (
-       u32                             width,
-       u32                             value,
-       struct acpi_generic_address     *reg)
+acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
 {
-       u64                             address;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_NAME ("hw_low_level_write");
+       u64 address;
+       acpi_status status;
 
+       ACPI_FUNCTION_NAME("hw_low_level_write");
 
        /*
         * Must have a valid pointer to a GAS structure, and
@@ -831,7 +813,7 @@ acpi_hw_low_level_write (
 
        /* Get a local copy of the address.  Handles possible alignment issues */
 
-       ACPI_MOVE_64_TO_64 (&address, &reg->address);
+       ACPI_MOVE_64_TO_64(&address, &reg->address);
        if (!address) {
                return (AE_OK);
        }
@@ -843,30 +825,28 @@ acpi_hw_low_level_write (
        switch (reg->address_space_id) {
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 
-               status = acpi_os_write_memory (
-                                (acpi_physical_address) address,
-                                value, width);
+               status = acpi_os_write_memory((acpi_physical_address) address,
+                                             value, width);
                break;
 
-
        case ACPI_ADR_SPACE_SYSTEM_IO:
 
-               status = acpi_os_write_port ((acpi_io_address) address,
-                                value, width);
+               status = acpi_os_write_port((acpi_io_address) address,
+                                           value, width);
                break;
 
-
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unsupported address space: %X\n", reg->address_space_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unsupported address space: %X\n",
+                                 reg->address_space_id));
                return (AE_BAD_PARAMETER);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_IO,
-               "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-               value, width,
-               ACPI_FORMAT_UINT64 (address),
-               acpi_ut_get_region_name (reg->address_space_id)));
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
+                         value, width,
+                         ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->address_space_id)));
 
        return (status);
 }
index 415d342aeab5cf41661ac5b38e9513757940ca7d..34519069050c2da488fa445759398220f3ecf897 100644 (file)
@@ -46,8 +46,7 @@
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-        ACPI_MODULE_NAME    ("hwsleep")
-
+ACPI_MODULE_NAME("hwsleep")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
  *
  ******************************************************************************/
-
 acpi_status
-acpi_set_firmware_waking_vector (
-       acpi_physical_address physical_address)
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
 {
 
-       ACPI_FUNCTION_TRACE ("acpi_set_firmware_waking_vector");
-
+       ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector");
 
        /* Set the vector */
 
        if (acpi_gbl_common_fACS.vector_width == 32) {
-               *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector))
-                               = (u32) physical_address;
-       }
-       else {
-               *acpi_gbl_common_fACS.firmware_waking_vector
-                               = physical_address;
+               *(ACPI_CAST_PTR
+                 (u32, acpi_gbl_common_fACS.firmware_waking_vector))
+                   = (u32) physical_address;
+       } else {
+               *acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_firmware_waking_vector
@@ -101,33 +95,31 @@ acpi_set_firmware_waking_vector (
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_firmware_waking_vector (
-       acpi_physical_address *physical_address)
+acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
 {
 
-       ACPI_FUNCTION_TRACE ("acpi_get_firmware_waking_vector");
-
+       ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector");
 
        if (!physical_address) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the vector */
 
        if (acpi_gbl_common_fACS.vector_width == 32) {
                *physical_address = (acpi_physical_address)
-                       *(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector));
-       }
-       else {
+                   *
+                   (ACPI_CAST_PTR
+                    (u32, acpi_gbl_common_fACS.firmware_waking_vector));
+       } else {
                *physical_address =
-                       *acpi_gbl_common_fACS.firmware_waking_vector;
+                   *acpi_gbl_common_fACS.firmware_waking_vector;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_prep
@@ -143,25 +135,22 @@ acpi_get_firmware_waking_vector (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enter_sleep_state_prep (
-       u8                          sleep_state)
+acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
 {
-       acpi_status                 status;
-       struct acpi_object_list     arg_list;
-       union acpi_object           arg;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_prep");
+       acpi_status status;
+       struct acpi_object_list arg_list;
+       union acpi_object arg;
 
+       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep");
 
        /*
         * _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
         */
-       status = acpi_get_sleep_type_data (sleep_state,
-                         &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_get_sleep_type_data(sleep_state,
+                                         &acpi_gbl_sleep_type_a,
+                                         &acpi_gbl_sleep_type_b);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Setup parameter object */
@@ -174,14 +163,14 @@ acpi_enter_sleep_state_prep (
 
        /* Run the _PTS and _GTS methods */
 
-       status = acpi_evaluate_object (NULL, METHOD_NAME__PTS, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               return_ACPI_STATUS (status);
+       status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_evaluate_object (NULL, METHOD_NAME__GTS, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               return_ACPI_STATUS (status);
+       status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               return_ACPI_STATUS(status);
        }
 
        /* Setup the argument to _SST */
@@ -202,22 +191,21 @@ acpi_enter_sleep_state_prep (
                break;
 
        default:
-               arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
+               arg.integer.value = ACPI_SST_INDICATOR_OFF;     /* Default is off */
                break;
        }
 
        /* Set the system indicators to show the desired sleep state. */
 
-       status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-                ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+                                  acpi_format_exception(status)));
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state
@@ -231,80 +219,82 @@ acpi_enter_sleep_state_prep (
  *
  ******************************************************************************/
 
-acpi_status asmlinkage
-acpi_enter_sleep_state (
-       u8                              sleep_state)
+acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
 {
-       u32                             PM1Acontrol;
-       u32                             PM1Bcontrol;
-       struct acpi_bit_register_info   *sleep_type_reg_info;
-       struct acpi_bit_register_info   *sleep_enable_reg_info;
-       u32                             in_value;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state");
+       u32 PM1Acontrol;
+       u32 PM1Bcontrol;
+       struct acpi_bit_register_info *sleep_type_reg_info;
+       struct acpi_bit_register_info *sleep_enable_reg_info;
+       u32 in_value;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state");
 
        if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
-               (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
-               ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
-                       acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
-               return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
+           (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
+               ACPI_REPORT_ERROR(("Sleep values out of range: A=%X B=%X\n",
+                                  acpi_gbl_sleep_type_a,
+                                  acpi_gbl_sleep_type_b));
+               return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
        }
 
-       sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
-       sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
+       sleep_type_reg_info =
+           acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
+       sleep_enable_reg_info =
+           acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
 
        /* Clear wake status */
 
-       status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Clear all fixed and general purpose status bits */
 
-       status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_disable_all_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
        acpi_gbl_system_awake_and_running = FALSE;
 
-       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_enable_all_wakeup_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get current value of PM1A control */
 
-       status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                      ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
-       ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
-               "Entering sleep state [S%d]\n", sleep_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_INIT,
+                         "Entering sleep state [S%d]\n", sleep_state));
 
        /* Clear SLP_EN and SLP_TYP fields */
 
        PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
-                          sleep_enable_reg_info->access_bit_mask);
+                        sleep_enable_reg_info->access_bit_mask);
        PM1Bcontrol = PM1Acontrol;
 
        /* Insert SLP_TYP bits */
 
-       PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
-       PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
+       PM1Acontrol |=
+           (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
+       PM1Bcontrol |=
+           (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
 
        /*
         * We split the writes of SLP_TYP and SLP_EN to workaround
@@ -313,16 +303,18 @@ acpi_enter_sleep_state (
 
        /* Write #1: fill in SLP_TYP data */
 
-       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                       ACPI_REGISTER_PM1A_CONTROL,
+                                       PM1Acontrol);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                       ACPI_REGISTER_PM1B_CONTROL,
+                                       PM1Bcontrol);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Insert SLP_ENABLE bit */
@@ -332,18 +324,20 @@ acpi_enter_sleep_state (
 
        /* Write #2: SLP_TYP + SLP_EN */
 
-       ACPI_FLUSH_CPU_CACHE ();
+       ACPI_FLUSH_CPU_CACHE();
 
-       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                       ACPI_REGISTER_PM1A_CONTROL,
+                                       PM1Acontrol);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                        ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                       ACPI_REGISTER_PM1B_CONTROL,
+                                       PM1Bcontrol);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        if (sleep_state > ACPI_STATE_S3) {
@@ -358,33 +352,34 @@ acpi_enter_sleep_state (
                 * still read the right value. Ideally, this block would go
                 * away entirely.
                 */
-               acpi_os_stall (10000000);
-
-               status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM1_CONTROL,
-                                sleep_enable_reg_info->access_bit_mask);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               acpi_os_stall(10000000);
+
+               status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                               ACPI_REGISTER_PM1_CONTROL,
+                                               sleep_enable_reg_info->
+                                               access_bit_mask);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Wait until we enter sleep state */
 
        do {
-               status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
-                       ACPI_MTX_DO_NOT_LOCK);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
+                                          ACPI_MTX_DO_NOT_LOCK);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Spin until we wake */
 
        } while (!in_value);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_enter_sleep_state);
 
+EXPORT_SYMBOL(acpi_enter_sleep_state);
 
 /*******************************************************************************
  *
@@ -399,60 +394,57 @@ EXPORT_SYMBOL(acpi_enter_sleep_state);
  *
  ******************************************************************************/
 
-acpi_status asmlinkage
-acpi_enter_sleep_state_s4bios (
-       void)
+acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
 {
-       u32                             in_value;
-       acpi_status                     status;
-
+       u32 in_value;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios");
+       ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios");
 
-
-       status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * 1) Disable/Clear all GPEs
         * 2) Enable all wakeup GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_disable_all_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
        acpi_gbl_system_awake_and_running = FALSE;
 
-       status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_enable_all_wakeup_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_FLUSH_CPU_CACHE ();
+       ACPI_FLUSH_CPU_CACHE();
 
-       status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
-                        (u32) acpi_gbl_FADT->S4bios_req, 8);
+       status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
+                                   (u32) acpi_gbl_FADT->S4bios_req, 8);
 
        do {
                acpi_os_stall(1000);
-               status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
-                       ACPI_MTX_DO_NOT_LOCK);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
+                                          ACPI_MTX_DO_NOT_LOCK);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        } while (!in_value);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
 
+EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
 
 /*******************************************************************************
  *
@@ -467,55 +459,62 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_leave_sleep_state (
-       u8                              sleep_state)
+acpi_status acpi_leave_sleep_state(u8 sleep_state)
 {
-       struct acpi_object_list         arg_list;
-       union acpi_object               arg;
-       acpi_status                     status;
-       struct acpi_bit_register_info   *sleep_type_reg_info;
-       struct acpi_bit_register_info   *sleep_enable_reg_info;
-       u32                             PM1Acontrol;
-       u32                             PM1Bcontrol;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_leave_sleep_state");
+       struct acpi_object_list arg_list;
+       union acpi_object arg;
+       acpi_status status;
+       struct acpi_bit_register_info *sleep_type_reg_info;
+       struct acpi_bit_register_info *sleep_enable_reg_info;
+       u32 PM1Acontrol;
+       u32 PM1Bcontrol;
 
+       ACPI_FUNCTION_TRACE("acpi_leave_sleep_state");
 
        /*
         * Set SLP_TYPE and SLP_EN to state S0.
         * This is unclear from the ACPI Spec, but it is required
         * by some machines.
         */
-       status = acpi_get_sleep_type_data (ACPI_STATE_S0,
-                         &acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
-       if (ACPI_SUCCESS (status)) {
-               sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
-               sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
+       status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+                                         &acpi_gbl_sleep_type_a,
+                                         &acpi_gbl_sleep_type_b);
+       if (ACPI_SUCCESS(status)) {
+               sleep_type_reg_info =
+                   acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
+               sleep_enable_reg_info =
+                   acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
 
                /* Get current value of PM1A control */
 
-               status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
-                                ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
+                                              ACPI_REGISTER_PM1_CONTROL,
+                                              &PM1Acontrol);
+               if (ACPI_SUCCESS(status)) {
                        /* Clear SLP_EN and SLP_TYP fields */
 
                        PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
-                                          sleep_enable_reg_info->access_bit_mask);
+                                        sleep_enable_reg_info->
+                                        access_bit_mask);
                        PM1Bcontrol = PM1Acontrol;
 
                        /* Insert SLP_TYP bits */
 
-                       PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
-                       PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
+                       PM1Acontrol |=
+                           (acpi_gbl_sleep_type_a << sleep_type_reg_info->
+                            bit_position);
+                       PM1Bcontrol |=
+                           (acpi_gbl_sleep_type_b << sleep_type_reg_info->
+                            bit_position);
 
                        /* Just ignore any errors */
 
-                       (void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                         ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
-                       (void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
-                                         ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
+                       (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                                    ACPI_REGISTER_PM1A_CONTROL,
+                                                    PM1Acontrol);
+                       (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
+                                                    ACPI_REGISTER_PM1B_CONTROL,
+                                                    PM1Bcontrol);
                }
        }
 
@@ -532,23 +531,23 @@ acpi_leave_sleep_state (
        /* Ignore any errors from these methods */
 
        arg.integer.value = ACPI_SST_WAKING;
-       status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+                                  acpi_format_exception(status)));
        }
 
        arg.integer.value = sleep_state;
-       status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_REPORT_ERROR(("Method _BFS failed, %s\n",
+                                  acpi_format_exception(status)));
        }
 
-       status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_REPORT_ERROR(("Method _WAK failed, %s\n",
+                                  acpi_format_exception(status)));
        }
        /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
 
@@ -557,33 +556,35 @@ acpi_leave_sleep_state (
         * 1) Disable/Clear all GPEs
         * 2) Enable all runtime GPEs
         */
-       status = acpi_hw_disable_all_gpes (ACPI_NOT_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_disable_all_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
        acpi_gbl_system_awake_and_running = TRUE;
 
-       status = acpi_hw_enable_all_runtime_gpes (ACPI_NOT_ISR);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_hw_enable_all_runtime_gpes();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Enable power button */
 
-       (void) acpi_set_register(
-                       acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
-                       1, ACPI_MTX_DO_NOT_LOCK);
+       (void)
+           acpi_set_register(acpi_gbl_fixed_event_info
+                             [ACPI_EVENT_POWER_BUTTON].enable_register_id, 1,
+                             ACPI_MTX_DO_NOT_LOCK);
 
-       (void) acpi_set_register(
-                       acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
-                       1, ACPI_MTX_DO_NOT_LOCK);
+       (void)
+           acpi_set_register(acpi_gbl_fixed_event_info
+                             [ACPI_EVENT_POWER_BUTTON].status_register_id, 1,
+                             ACPI_MTX_DO_NOT_LOCK);
 
        arg.integer.value = ACPI_SST_WORKING;
-       status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
-       if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
-               ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+               ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
+                                  acpi_format_exception(status)));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
index 49d7b395322e85ffaffbafacd636c90fa4524ebb..aff6dc1417845490516365fc7dff3c968531c7a9 100644 (file)
@@ -46,8 +46,7 @@
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_HARDWARE
-        ACPI_MODULE_NAME    ("hwtimer")
-
+ACPI_MODULE_NAME("hwtimer")
 
 /******************************************************************************
  *
  * DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
  *
  ******************************************************************************/
-
-acpi_status
-acpi_get_timer_resolution (
-       u32                             *resolution)
+acpi_status acpi_get_timer_resolution(u32 * resolution)
 {
-       ACPI_FUNCTION_TRACE ("acpi_get_timer_resolution");
-
+       ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
 
        if (!resolution) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (0 == acpi_gbl_FADT->tmr_val_ext) {
                *resolution = 24;
-       }
-       else {
+       } else {
                *resolution = 32;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_get_timer
@@ -95,26 +88,22 @@ acpi_get_timer_resolution (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_timer (
-       u32                             *ticks)
+acpi_status acpi_get_timer(u32 * ticks)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_timer");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_timer");
 
        if (!ticks) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
+       status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_timer);
 
+EXPORT_SYMBOL(acpi_get_timer);
 
 /******************************************************************************
  *
@@ -146,21 +135,16 @@ EXPORT_SYMBOL(acpi_get_timer);
  ******************************************************************************/
 
 acpi_status
-acpi_get_timer_duration (
-       u32                             start_ticks,
-       u32                             end_ticks,
-       u32                             *time_elapsed)
+acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 {
-       acpi_status                     status;
-       u32                             delta_ticks;
-       acpi_integer                    quotient;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_timer_duration");
+       acpi_status status;
+       u32 delta_ticks;
+       acpi_integer quotient;
 
+       ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
 
        if (!time_elapsed) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -169,22 +153,22 @@ acpi_get_timer_duration (
         */
        if (start_ticks < end_ticks) {
                delta_ticks = end_ticks - start_ticks;
-       }
-       else if (start_ticks > end_ticks) {
+       } else if (start_ticks > end_ticks) {
                if (0 == acpi_gbl_FADT->tmr_val_ext) {
                        /* 24-bit Timer */
 
-                       delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
-               }
-               else {
+                       delta_ticks =
+                           (((0x00FFFFFF - start_ticks) +
+                             end_ticks) & 0x00FFFFFF);
+               } else {
                        /* 32-bit Timer */
 
                        delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
                }
-       }
-       else /* start_ticks == end_ticks */ {
+       } else {                /* start_ticks == end_ticks */
+
                *time_elapsed = 0;
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -192,12 +176,11 @@ acpi_get_timer_duration (
         *
         * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
         */
-       status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000,
-                        PM_TIMER_FREQUENCY, &quotient, NULL);
+       status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000,
+                                     PM_TIMER_FREQUENCY, &quotient, NULL);
 
        *time_elapsed = (u32) quotient;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
 EXPORT_SYMBOL(acpi_get_timer_duration);
-
index 1f76a40badecea06e7de62811df078fdb1cb23c9..2e2e4051dfa7abb0180023313b21303e248ac67a 100644 (file)
@@ -62,7 +62,7 @@
 #define _COMPONENT              ACPI_HOTKEY_COMPONENT
 ACPI_MODULE_NAME("acpi_hotkey")
 
-MODULE_AUTHOR("luming.yu@intel.com");
+    MODULE_AUTHOR("luming.yu@intel.com");
 MODULE_DESCRIPTION(ACPI_HOTK_NAME);
 MODULE_LICENSE("GPL");
 
@@ -180,8 +180,8 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset);
 static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
 static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
 static union acpi_hotkey *get_hotkey_by_event(struct
-                             acpi_hotkey_list
-                             *hotkey_list, int event);
+                                             acpi_hotkey_list
+                                             *hotkey_list, int event);
 
 /* event based config */
 static struct file_operations hotkey_config_fops = {
@@ -246,7 +246,7 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file)
 static char *format_result(union acpi_object *object)
 {
        char *buf = NULL;
-       
+
        buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL);
        if (buf)
                memset(buf, 0, RESULT_STR_LEN);
@@ -256,7 +256,7 @@ static char *format_result(union acpi_object *object)
        /* Now, just support integer type */
        if (object->type == ACPI_TYPE_INTEGER)
                sprintf(buf, "%d\n", (u32) object->integer.value);
-do_fail:
+      do_fail:
        return (buf);
 }
 
@@ -268,9 +268,9 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
 
        ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
 
-       if (poll_hotkey->poll_result){
+       if (poll_hotkey->poll_result) {
                buf = format_result(poll_hotkey->poll_result);
-               if(buf)
+               if (buf)
                        seq_printf(seq, "%s", buf);
                kfree(buf);
        }
@@ -299,7 +299,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
                union acpi_hotkey *key =
                    container_of(entries, union acpi_hotkey, entries);
                if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
-                   && key->event_hotkey.external_hotkey_num == event){
+                   && key->event_hotkey.external_hotkey_num == event) {
                        val = key->link.hotkey_standard_num;
                        break;
                }
@@ -343,7 +343,7 @@ static int auto_hotkey_remove(struct acpi_device *device, int type)
 static int create_polling_proc(union acpi_hotkey *device)
 {
        struct proc_dir_entry *proc;
-       char  proc_name[80];
+       char proc_name[80];
        mode_t mode;
 
        ACPI_FUNCTION_TRACE("create_polling_proc");
@@ -351,8 +351,8 @@ static int create_polling_proc(union acpi_hotkey *device)
 
        sprintf(proc_name, "%d", device->link.hotkey_standard_num);
        /*
-       strcat(proc_name, device->poll_hotkey.poll_method);
-       */
+          strcat(proc_name, device->poll_hotkey.poll_method);
+        */
        proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
 
        if (!proc) {
@@ -415,50 +415,50 @@ static int hotkey_remove(union acpi_hotkey *device)
        return_VALUE(0);
 }
 
-static int  hotkey_update(union acpi_hotkey *key)
+static int hotkey_update(union acpi_hotkey *key)
 {
        struct list_head *entries;
 
        ACPI_FUNCTION_TRACE("hotkey_update");
 
        list_for_each(entries, global_hotkey_list.entries) {
-               union acpi_hotkey *tmp=
+               union acpi_hotkey *tmp =
                    container_of(entries, union acpi_hotkey, entries);
                if (tmp->link.hotkey_standard_num ==
                    key->link.hotkey_standard_num) {
                        if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
                                free_hotkey_buffer(tmp);
                                tmp->event_hotkey.bus_handle =
-                                       key->event_hotkey.bus_handle;
+                                   key->event_hotkey.bus_handle;
                                tmp->event_hotkey.external_hotkey_num =
-                                       key->event_hotkey.external_hotkey_num;
+                                   key->event_hotkey.external_hotkey_num;
                                tmp->event_hotkey.action_handle =
-                                       key->event_hotkey.action_handle;
+                                   key->event_hotkey.action_handle;
                                tmp->event_hotkey.action_method =
-                                       key->event_hotkey.action_method;
+                                   key->event_hotkey.action_method;
                                kfree(key);
                        } else {
                                /*
-                               char  proc_name[80];
+                                  char  proc_name[80];
 
-                               sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
-                               strcat(proc_name, tmp->poll_hotkey.poll_method);
-                               remove_proc_entry(proc_name,hotkey_proc_dir);
-                               */
+                                  sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
+                                  strcat(proc_name, tmp->poll_hotkey.poll_method);
+                                  remove_proc_entry(proc_name,hotkey_proc_dir);
+                                */
                                free_poll_hotkey_buffer(tmp);
                                tmp->poll_hotkey.poll_handle =
-                                       key->poll_hotkey.poll_handle;
+                                   key->poll_hotkey.poll_handle;
                                tmp->poll_hotkey.poll_method =
-                                       key->poll_hotkey.poll_method;
+                                   key->poll_hotkey.poll_method;
                                tmp->poll_hotkey.action_handle =
-                                       key->poll_hotkey.action_handle;
+                                   key->poll_hotkey.action_handle;
                                tmp->poll_hotkey.action_method =
-                                       key->poll_hotkey.action_method;
+                                   key->poll_hotkey.action_method;
                                tmp->poll_hotkey.poll_result =
-                                       key->poll_hotkey.poll_result;
+                                   key->poll_hotkey.poll_result;
                                /*
-                               create_polling_proc(tmp);
-                               */
+                                  create_polling_proc(tmp);
+                                */
                                kfree(key);
                        }
                        return_VALUE(0);
@@ -483,27 +483,25 @@ static void free_hotkey_device(union acpi_hotkey *key)
                                                   acpi_hotkey_notify_handler);
                free_hotkey_buffer(key);
        } else {
-               char  proc_name[80];
+               char proc_name[80];
 
                sprintf(proc_name, "%d", key->link.hotkey_standard_num);
                /*
-               strcat(proc_name, key->poll_hotkey.poll_method);
-               */
-               remove_proc_entry(proc_name,hotkey_proc_dir);
+                  strcat(proc_name, key->poll_hotkey.poll_method);
+                */
+               remove_proc_entry(proc_name, hotkey_proc_dir);
                free_poll_hotkey_buffer(key);
        }
        kfree(key);
        return_VOID;
 }
 
-static void
-free_hotkey_buffer(union acpi_hotkey *key)
+static void free_hotkey_buffer(union acpi_hotkey *key)
 {
        kfree(key->event_hotkey.action_method);
 }
 
-static void
-free_poll_hotkey_buffer(union acpi_hotkey *key)
+static void free_poll_hotkey_buffer(union acpi_hotkey *key)
 {
        kfree(key->poll_hotkey.action_method);
        kfree(key->poll_hotkey.poll_method);
@@ -513,15 +511,15 @@ static int
 init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
                   char *method, int std_num, int external_num)
 {
-       acpi_handle     tmp_handle;
+       acpi_handle tmp_handle;
        acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("init_hotkey_device");
 
-       if(std_num < 0 || IS_POLL(std_num) || !key )
+       if (std_num < 0 || IS_POLL(std_num) || !key)
                goto do_fail;
 
-       if(!bus_str || !action_str || !method)
+       if (!bus_str || !action_str || !method)
                goto do_fail;
 
        key->link.hotkey_type = ACPI_HOTKEY_EVENT;
@@ -529,19 +527,22 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
        key->event_hotkey.flag = 0;
        key->event_hotkey.action_method = method;
 
-       status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle));
-       if(ACPI_FAILURE(status))
+       status =
+           acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle));
+       if (ACPI_FAILURE(status))
                goto do_fail;
        key->event_hotkey.external_hotkey_num = external_num;
-       status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle));
-       if(ACPI_FAILURE(status))
+       status =
+           acpi_get_handle(NULL, action_str,
+                           &(key->event_hotkey.action_handle));
+       if (ACPI_FAILURE(status))
                goto do_fail;
        status = acpi_get_handle(key->event_hotkey.action_handle,
-                               method, &tmp_handle);
+                                method, &tmp_handle);
        if (ACPI_FAILURE(status))
                goto do_fail;
        return_VALUE(AE_OK);
-do_fail:
+      do_fail:
        return_VALUE(-ENODEV);
 }
 
@@ -552,14 +553,14 @@ init_poll_hotkey_device(union acpi_hotkey *key,
                        char *action_str, char *action_method, int std_num)
 {
        acpi_status status = AE_OK;
-       acpi_handle     tmp_handle;
+       acpi_handle tmp_handle;
 
        ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
 
-       if(std_num < 0 || IS_EVENT(std_num) || !key)
+       if (std_num < 0 || IS_EVENT(std_num) || !key)
                goto do_fail;
 
-       if(!poll_str || !poll_method || !action_str || !action_method)
+       if (!poll_str || !poll_method || !action_str || !action_method)
                goto do_fail;
 
        key->link.hotkey_type = ACPI_HOTKEY_POLLING;
@@ -568,30 +569,32 @@ init_poll_hotkey_device(union acpi_hotkey *key,
        key->poll_hotkey.poll_method = poll_method;
        key->poll_hotkey.action_method = action_method;
 
-       status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle));
-       if(ACPI_FAILURE(status))
+       status =
+           acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle));
+       if (ACPI_FAILURE(status))
                goto do_fail;
        status = acpi_get_handle(key->poll_hotkey.poll_handle,
-                               poll_method, &tmp_handle);
-        if (ACPI_FAILURE(status))
-                       goto do_fail;
-       status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle));
+                                poll_method, &tmp_handle);
+       if (ACPI_FAILURE(status))
+               goto do_fail;
+       status =
+           acpi_get_handle(NULL, action_str,
+                           &(key->poll_hotkey.action_handle));
        if (ACPI_FAILURE(status))
                goto do_fail;
        status = acpi_get_handle(key->poll_hotkey.action_handle,
-                               action_method, &tmp_handle);
+                                action_method, &tmp_handle);
        if (ACPI_FAILURE(status))
                goto do_fail;
        key->poll_hotkey.poll_result =
            (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
-       if(!key->poll_hotkey.poll_result)
+       if (!key->poll_hotkey.poll_result)
                goto do_fail;
        return_VALUE(AE_OK);
-do_fail:
+      do_fail:
        return_VALUE(-ENODEV);
 }
 
-
 static int hotkey_open_config(struct inode *inode, struct file *file)
 {
        ACPI_FUNCTION_TRACE("hotkey_open_config");
@@ -679,8 +682,9 @@ get_parms(char *config_record,
 
        sscanf(config_record, "%d", cmd);
 
-       if(*cmd == 1){
-               if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2)
+       if (*cmd == 1) {
+               if (sscanf(config_record, "%d:%d", cmd, internal_event_num) !=
+                   2)
                        goto do_fail;
                else
                        return (6);
@@ -694,8 +698,8 @@ get_parms(char *config_record,
                goto do_fail;
 
        count = tmp1 - tmp;
-       *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL);
-       if(!*bus_handle)
+       *bus_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!*bus_handle)
                goto do_fail;
        strncpy(*bus_handle, tmp, count);
        *(*bus_handle + count) = 0;
@@ -706,8 +710,8 @@ get_parms(char *config_record,
        if (!tmp1)
                goto do_fail;
        count = tmp1 - tmp;
-       *bus_method = (char *) kmalloc(count+1, GFP_KERNEL);
-       if(!*bus_method)
+       *bus_method = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!*bus_method)
                goto do_fail;
        strncpy(*bus_method, tmp, count);
        *(*bus_method + count) = 0;
@@ -718,7 +722,7 @@ get_parms(char *config_record,
        if (!tmp1)
                goto do_fail;
        count = tmp1 - tmp;
-       *action_handle = (char *) kmalloc(count+1, GFP_KERNEL);
+       *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
        strncpy(*action_handle, tmp, count);
        *(*action_handle + count) = 0;
 
@@ -728,17 +732,18 @@ get_parms(char *config_record,
        if (!tmp1)
                goto do_fail;
        count = tmp1 - tmp;
-       *method = (char *) kmalloc(count+1, GFP_KERNEL);
-       if(!*method)
+       *method = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!*method)
                goto do_fail;
        strncpy(*method, tmp, count);
        *(*method + count) = 0;
 
-       if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0)
+       if (sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num) <=
+           0)
                goto do_fail;
 
        return_VALUE(6);
-do_fail:
+      do_fail:
        return_VALUE(-1);
 }
 
@@ -758,8 +763,8 @@ static ssize_t hotkey_write_config(struct file *file,
 
        ACPI_FUNCTION_TRACE(("hotkey_write_config"));
 
-       config_record = (char *) kmalloc(count+1, GFP_KERNEL);
-       if(!config_record)
+       config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!config_record)
                return_VALUE(-ENOMEM);
 
        if (copy_from_user(config_record, buffer, count)) {
@@ -777,10 +782,10 @@ static ssize_t hotkey_write_config(struct file *file,
                        &method, &internal_event_num, &external_event_num);
 
        kfree(config_record);
-       if(IS_OTHERS(internal_event_num))
+       if (IS_OTHERS(internal_event_num))
                goto do_fail;
        if (ret != 6) {
-do_fail:       
+             do_fail:
                kfree(bus_handle);
                kfree(bus_method);
                kfree(action_handle);
@@ -791,14 +796,14 @@ do_fail:
        }
 
        key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
-       if(!key)
+       if (!key)
                goto do_fail;
        memset(key, 0, sizeof(union acpi_hotkey));
-       if(cmd == 1) {
+       if (cmd == 1) {
                union acpi_hotkey *tmp = NULL;
                tmp = get_hotkey_by_event(&global_hotkey_list,
-                               internal_event_num);
-               if(!tmp)
+                                         internal_event_num);
+               if (!tmp)
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
                else
                        memcpy(key, tmp, sizeof(union acpi_hotkey));
@@ -807,15 +812,16 @@ do_fail:
        if (IS_EVENT(internal_event_num)) {
                kfree(bus_method);
                ret = init_hotkey_device(key, bus_handle, action_handle, method,
-                                internal_event_num, external_event_num);
+                                        internal_event_num,
+                                        external_event_num);
        } else
                ret = init_poll_hotkey_device(key, bus_handle, bus_method,
-                                     action_handle, method,
-                                     internal_event_num);
+                                             action_handle, method,
+                                             internal_event_num);
        if (ret) {
                kfree(bus_handle);
                kfree(action_handle);
-               if(IS_EVENT(internal_event_num))
+               if (IS_EVENT(internal_event_num))
                        free_hotkey_buffer(key);
                else
                        free_poll_hotkey_buffer(key);
@@ -824,13 +830,14 @@ do_fail:
                return_VALUE(-EINVAL);
        }
 
-cont_cmd:
+      cont_cmd:
        kfree(bus_handle);
        kfree(action_handle);
 
        switch (cmd) {
        case 0:
-               if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num))
+               if (get_hotkey_by_event
+                   (&global_hotkey_list, key->link.hotkey_standard_num))
                        goto fail_out;
                else
                        hotkey_add(key);
@@ -839,7 +846,7 @@ cont_cmd:
                hotkey_remove(key);
                break;
        case 2:
-               if(hotkey_update(key))
+               if (hotkey_update(key))
                        goto fail_out;
                break;
        default:
@@ -847,8 +854,8 @@ cont_cmd:
                break;
        }
        return_VALUE(count);
-fail_out:
-       if(IS_EVENT(internal_event_num))
+      fail_out:
+       if (IS_EVENT(internal_event_num))
                free_hotkey_buffer(key);
        else
                free_poll_hotkey_buffer(key);
@@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
        return_VALUE(status == AE_OK);
 }
 
-static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val)
+static int read_acpi_int(acpi_handle handle, const char *method,
+                        union acpi_object *val)
 {
        struct acpi_buffer output;
        union acpi_object out_obj;
@@ -893,7 +901,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
        output.pointer = &out_obj;
 
        status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
-       if(val){
+       if (val) {
                val->integer.value = out_obj.integer.value;
                val->type = out_obj.type;
        } else
@@ -903,8 +911,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
 }
 
 static union acpi_hotkey *get_hotkey_by_event(struct
-                             acpi_hotkey_list
-                             *hotkey_list, int event)
+                                             acpi_hotkey_list
+                                             *hotkey_list, int event)
 {
        struct list_head *entries;
 
@@ -912,10 +920,10 @@ static union acpi_hotkey *get_hotkey_by_event(struct
                union acpi_hotkey *key =
                    container_of(entries, union acpi_hotkey, entries);
                if (key->link.hotkey_standard_num == event) {
-                       return(key);
+                       return (key);
                }
        }
-       return(NULL);
+       return (NULL);
 }
 
 /*
@@ -932,15 +940,15 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
 {
        struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
        char *arg;
-       int event,method_type,type, value;
+       int event, method_type, type, value;
        union acpi_hotkey *key;
 
        ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
 
-       arg = (char *) kmalloc(count+1, GFP_KERNEL);
-       if(!arg)
+       arg = (char *)kmalloc(count + 1, GFP_KERNEL);
+       if (!arg)
                return_VALUE(-ENOMEM);
-       arg[count]=0;
+       arg[count] = 0;
 
        if (copy_from_user(arg, buffer, count)) {
                kfree(arg);
@@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
                return_VALUE(-EINVAL);
        }
 
-       if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) {
+       if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
+           4) {
                kfree(arg);
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
                return_VALUE(-EINVAL);
@@ -956,19 +965,21 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
        kfree(arg);
        if (type == ACPI_TYPE_INTEGER) {
                key = get_hotkey_by_event(hotkey_list, event);
-               if(!key)
+               if (!key)
                        goto do_fail;
                if (IS_EVENT(event))
                        write_acpi_int(key->event_hotkey.action_handle,
-                                       key->event_hotkey.action_method, value, NULL);
+                                      key->event_hotkey.action_method, value,
+                                      NULL);
                else if (IS_POLL(event)) {
-                       if ( method_type == POLL_METHOD )
+                       if (method_type == POLL_METHOD)
                                read_acpi_int(key->poll_hotkey.poll_handle,
-                                       key->poll_hotkey.poll_method,
-                                       key->poll_hotkey.poll_result);
-                       else if ( method_type == ACTION_METHOD )
+                                             key->poll_hotkey.poll_method,
+                                             key->poll_hotkey.poll_result);
+                       else if (method_type == ACTION_METHOD)
                                write_acpi_int(key->poll_hotkey.action_handle,
-                                       key->poll_hotkey.action_method, value, NULL);
+                                              key->poll_hotkey.action_method,
+                                              value, NULL);
                        else
                                goto do_fail;
 
@@ -978,7 +989,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
                return_VALUE(-EINVAL);
        }
        return_VALUE(count);
-do_fail:
+      do_fail:
        return_VALUE(-EINVAL);
 
 }
@@ -1074,15 +1085,15 @@ static int __init hotkey_init(void)
 
        return (0);
 
-do_fail5:
+      do_fail5:
        remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
-do_fail4:
+      do_fail4:
        remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
-do_fail3:
+      do_fail3:
        remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
-do_fail2:
+      do_fail2:
        remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
-do_fail1:
+      do_fail1:
        remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
        return (-ENODEV);
 }
index ad85e10001f461f81710bd33656a39ef086e44fd..5cc090326ddc3c134d3550074dbab8e130f077e6 100644 (file)
@@ -2,7 +2,7 @@
  *  ibm_acpi.c - IBM ThinkPad ACPI Extras
  *
  *
- *  Copyright (C) 2004 Borislav Deianov
+ *  Copyright (C) 2004-2005 Borislav Deianov <borislav@users.sf.net>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
+ */
+
+#define IBM_VERSION "0.12a"
+
+/*
  *  Changelog:
- *
- *  2004-08-09 0.1     initial release, support for X series
- *  2004-08-14 0.2     support for T series, X20
- *                     bluetooth enable/disable
- *                     hotkey events disabled by default
- *                     removed fan control, currently useless
- *  2004-08-17 0.3     support for R40
- *                     lcd off, brightness control
- *                     thinklight on/off
- *  2004-09-16 0.4     support for module parameters
- *                     hotkey mask can be prefixed by 0x
- *                     video output switching
- *                     video expansion control
- *                     ultrabay eject support
- *                     removed lcd brightness/on/off control, didn't work
+ *  
+ *  2005-08-17  0.12   fix compilation on 2.6.13-rc kernels
+ *  2005-03-17 0.11    support for 600e, 770x
+ *                         thanks to Jamie Lentin <lentinj@dial.pipex.com>
+ *                     support for 770e, G41
+ *                     G40 and G41 don't have a thinklight
+ *                     temperatures no longer experimental
+ *                     experimental brightness control
+ *                     experimental volume control
+ *                     experimental fan enable/disable
+ *  2005-01-16 0.10    fix module loading on R30, R31 
+ *  2005-01-16 0.9     support for 570, R30, R31
+ *                     ultrabay support on A22p, A3x
+ *                     limit arg for cmos, led, beep, drop experimental status
+ *                     more capable led control on A21e, A22p, T20-22, X20
+ *                     experimental temperatures and fan speed
+ *                     experimental embedded controller register dump
+ *                     mark more functions as __init, drop incorrect __exit
+ *                     use MODULE_VERSION
+ *                         thanks to Henrik Brix Andersen <brix@gentoo.org>
+ *                     fix parameter passing on module loading
+ *                         thanks to Rusty Russell <rusty@rustcorp.com.au>
+ *                         thanks to Jim Radford <radford@blackbean.org>
+ *  2004-11-08 0.8     fix init error case, don't return from a macro
+ *                         thanks to Chris Wright <chrisw@osdl.org>
+ *  2004-10-23 0.7     fix module loading on A21e, A22p, T20, T21, X20
+ *                     fix led control on A21e
+ *  2004-10-19 0.6     use acpi_bus_register_driver() to claim HKEY device
  *  2004-10-18 0.5     thinklight support on A21e, G40, R32, T20, T21, X20
  *                     proc file format changed
  *                     video_switch command
  *                     experimental cmos control
  *                     experimental led control
  *                     experimental acpi sounds
- *  2004-10-19 0.6     use acpi_bus_register_driver() to claim HKEY device
- *  2004-10-23 0.7     fix module loading on A21e, A22p, T20, T21, X20
- *                     fix LED control on A21e
- *  2004-11-08 0.8     fix init error case, don't return from a macro
- *                             thanks to Chris Wright <chrisw@osdl.org>
+ *  2004-09-16 0.4     support for module parameters
+ *                     hotkey mask can be prefixed by 0x
+ *                     video output switching
+ *                     video expansion control
+ *                     ultrabay eject support
+ *                     removed lcd brightness/on/off control, didn't work
+ *  2004-08-17 0.3     support for R40
+ *                     lcd off, brightness control
+ *                     thinklight on/off
+ *  2004-08-14 0.2     support for T series, X20
+ *                     bluetooth enable/disable
+ *                     hotkey events disabled by default
+ *                     removed fan control, currently useless
+ *  2004-08-09 0.1     initial release, support for X series
  */
 
-#define IBM_VERSION "0.8"
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #define IBM_FILE "ibm_acpi"
 #define IBM_URL "http://ibm-acpi.sf.net/"
 
+MODULE_AUTHOR("Borislav Deianov");
+MODULE_DESCRIPTION(IBM_DESC);
+MODULE_VERSION(IBM_VERSION);
+MODULE_LICENSE("GPL");
+
 #define IBM_DIR IBM_NAME
 
 #define IBM_LOG IBM_FILE ": "
@@ -84,54 +113,122 @@ static acpi_handle root_handle = NULL;
 #define IBM_HANDLE(object, parent, paths...)                   \
        static acpi_handle  object##_handle;                    \
        static acpi_handle *object##_parent = &parent##_handle; \
+       static char        *object##_path;                      \
        static char        *object##_paths[] = { paths }
 
-IBM_HANDLE(ec, root,
-          "\\_SB.PCI0.ISA.EC",    /* A21e, A22p, T20, T21, X20 */
-          "\\_SB.PCI0.LPC.EC",    /* all others */
-);
-
-IBM_HANDLE(vid, root, 
-          "\\_SB.PCI0.VID",       /* A21e, G40, X30, X40 */
-          "\\_SB.PCI0.AGP.VID",   /* all others */
-);
-
-IBM_HANDLE(cmos, root,
-          "\\UCMS",               /* R50, R50p, R51, T4x, X31, X40 */
-          "\\CMOS",               /* A3x, G40, R32, T23, T30, X22, X24, X30 */
-          "\\CMS",                /* R40, R40e */
-);                                 /* A21e, A22p, T20, T21, X20 */
-
-IBM_HANDLE(dock, root,
-          "\\_SB.GDCK",           /* X30, X31, X40 */
-          "\\_SB.PCI0.DOCK",      /* A22p, T20, T21, X20 */
-          "\\_SB.PCI0.PCI1.DOCK", /* all others */
-);                                 /* A21e, G40, R32, R40, R40e */
-
-IBM_HANDLE(bay, root,
-          "\\_SB.PCI0.IDE0.SCND.MSTR");      /* all except A21e */
-IBM_HANDLE(bayej, root,
-          "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */
-
-IBM_HANDLE(lght, root, "\\LGHT");  /* A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(hkey, ec,   "HKEY");    /* all */
-IBM_HANDLE(led,  ec,   "LED");     /* all except A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(sysl, ec,   "SYSL");    /* A21e, A22p, T20, T21, X20 */
-IBM_HANDLE(bled, ec,   "BLED");    /* A22p, T20, T21, X20 */
-IBM_HANDLE(beep, ec,   "BEEP");    /* all models */
+/*
+ * The following models are supported to various degrees:
+ *
+ * 570, 600e, 600x, 770e, 770x
+ * A20m, A21e, A21m, A21p, A22p, A30, A30p, A31, A31p
+ * G40, G41
+ * R30, R31, R32, R40, R40e, R50, R50e, R50p, R51
+ * T20, T21, T22, T23, T30, T40, T40p, T41, T41p, T42, T42p, T43
+ * X20, X21, X22, X23, X24, X30, X31, X40
+ *
+ * The following models have no supported features:
+ *
+ * 240, 240x, i1400
+ *
+ * Still missing DSDTs for the following models:
+ *
+ * A20p, A22e, A22m
+ * R52
+ * S31
+ * T43p
+ */
+
+IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0",     /* 240, 240x */
+          "\\_SB.PCI.ISA.EC",  /* 570 */
+          "\\_SB.PCI0.ISA0.EC0",       /* 600e/x, 770e, 770x */
+          "\\_SB.PCI0.ISA.EC", /* A21e, A2xm/p, T20-22, X20-21 */
+          "\\_SB.PCI0.AD4S.EC0",       /* i1400, R30 */
+          "\\_SB.PCI0.ICH3.EC0",       /* R31 */
+          "\\_SB.PCI0.LPC.EC", /* all others */
+    );
+
+IBM_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA",     /* 570 */
+          "\\_SB.PCI0.AGP0.VID0",      /* 600e/x, 770x */
+          "\\_SB.PCI0.VID0",   /* 770e */
+          "\\_SB.PCI0.VID",    /* A21e, G4x, R50e, X30, X40 */
+          "\\_SB.PCI0.AGP.VID",        /* all others */
+    );                         /* R30, R31 */
+
+IBM_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */
+
+IBM_HANDLE(cmos, root, "\\UCMS",       /* R50, R50e, R50p, R51, T4x, X31, X40 */
+          "\\CMOS",            /* A3x, G4x, R32, T23, T30, X22-24, X30 */
+          "\\CMS",             /* R40, R40e */
+    );                         /* all others */
+
+IBM_HANDLE(dock, root, "\\_SB.GDCK",   /* X30, X31, X40 */
+          "\\_SB.PCI0.DOCK",   /* 600e/x,770e,770x,A2xm/p,T20-22,X20-21 */
+          "\\_SB.PCI0.PCI1.DOCK",      /* all others */
+          "\\_SB.PCI.ISA.SLCE",        /* 570 */
+    );                         /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
+
+IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST",       /* 570 */
+          "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
+          "\\_SB.PCI0.IDE0.SCND.MSTR", /* all others */
+    );                         /* A21e, R30, R31 */
+
+IBM_HANDLE(bay_ej, bay, "_EJ3",        /* 600e/x, A2xm/p, A3x */
+          "_EJ0",              /* all others */
+    );                         /* 570,A21e,G4x,R30,R31,R32,R40e,R50e */
+
+IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV",    /* A3x, R32 */
+          "\\_SB.PCI0.IDE0.IDEP.IDPS", /* 600e/x, 770e, 770x */
+    );                         /* all others */
+
+IBM_HANDLE(bay2_ej, bay2, "_EJ3",      /* 600e/x, 770e, A3x */
+          "_EJ0",              /* 770x */
+    );                         /* all others */
+
+/* don't list other alternatives as we install a notify handler on the 570 */
+IBM_HANDLE(pci, root, "\\_SB.PCI");    /* 570 */
+
+IBM_HANDLE(hkey, ec, "\\_SB.HKEY",     /* 600e/x, 770e, 770x */
+          "^HKEY",             /* R30, R31 */
+          "HKEY",              /* all others */
+    );                         /* 570 */
+
+IBM_HANDLE(lght, root, "\\LGHT");      /* A21e, A2xm/p, T20-22, X20-21 */
+IBM_HANDLE(ledb, ec, "LEDB");  /* G4x */
+
+IBM_HANDLE(led, ec, "SLED",    /* 570 */
+          "SYSL",              /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
+          "LED",               /* all others */
+    );                         /* R30, R31 */
+
+IBM_HANDLE(beep, ec, "BEEP");  /* all except R30, R31 */
+IBM_HANDLE(ecrd, ec, "ECRD");  /* 570 */
+IBM_HANDLE(ecwr, ec, "ECWR");  /* 570 */
+IBM_HANDLE(fans, ec, "FANS");  /* X31, X40 */
+
+IBM_HANDLE(gfan, ec, "GFAN",   /* 570 */
+          "\\FSPD",            /* 600e/x, 770e, 770x */
+    );                         /* all others */
+
+IBM_HANDLE(sfan, ec, "SFAN",   /* 570 */
+          "JFNS",              /* 770x-JL */
+    );                         /* all others */
+
+#define IBM_HKEY_HID   "IBM0068"
+#define IBM_PCI_HID    "PNP0A03"
 
 struct ibm_struct {
        char *name;
+       char param[32];
 
        char *hid;
        struct acpi_driver *driver;
-       
-       int  (*init)   (struct ibm_struct *);
-       int  (*read)   (struct ibm_struct *, char *);
-       int  (*write)  (struct ibm_struct *, char *);
-       void (*exit)   (struct ibm_struct *);
 
-       void (*notify) (struct ibm_struct *, u32);      
+       int (*init) (void);
+       int (*read) (char *);
+       int (*write) (char *);
+       void (*exit) (void);
+
+       void (*notify) (struct ibm_struct *, u32);
        acpi_handle *handle;
        int type;
        struct acpi_device *device;
@@ -141,17 +238,6 @@ struct ibm_struct {
        int init_called;
        int notify_installed;
 
-       int supported;
-       union {
-               struct {
-                       int status;
-                       int mask;
-               } hotkey;
-               struct {
-                       int autoswitch;
-               } video;
-       } state;
-
        int experimental;
 };
 
@@ -165,15 +251,15 @@ static int acpi_evalf(acpi_handle handle,
                      void *res, char *method, char *fmt, ...)
 {
        char *fmt0 = fmt;
-        struct acpi_object_list        params;
-        union acpi_object      in_objs[IBM_MAX_ACPI_ARGS];
-        struct acpi_buffer     result;
-        union acpi_object      out_obj;
-        acpi_status            status;
-       va_list                 ap;
-       char                    res_type;
-       int                     success;
-       int                     quiet;
+       struct acpi_object_list params;
+       union acpi_object in_objs[IBM_MAX_ACPI_ARGS];
+       struct acpi_buffer result, *resultp;
+       union acpi_object out_obj;
+       acpi_status status;
+       va_list ap;
+       char res_type;
+       int success;
+       int quiet;
 
        if (!*fmt) {
                printk(IBM_ERR "acpi_evalf() called with empty format\n");
@@ -199,7 +285,7 @@ static int acpi_evalf(acpi_handle handle,
                        in_objs[params.count].integer.value = va_arg(ap, int);
                        in_objs[params.count++].type = ACPI_TYPE_INTEGER;
                        break;
-               /* add more types as needed */
+                       /* add more types as needed */
                default:
                        printk(IBM_ERR "acpi_evalf() called "
                               "with invalid format character '%c'\n", c);
@@ -208,21 +294,25 @@ static int acpi_evalf(acpi_handle handle,
        }
        va_end(ap);
 
-       result.length = sizeof(out_obj);
-       result.pointer = &out_obj;
+       if (res_type != 'v') {
+               result.length = sizeof(out_obj);
+               result.pointer = &out_obj;
+               resultp = &result;
+       } else
+               resultp = NULL;
 
-       status = acpi_evaluate_object(handle, method, &params, &result);
+       status = acpi_evaluate_object(handle, method, &params, resultp);
 
        switch (res_type) {
-       case 'd':       /* int */
+       case 'd':               /* int */
                if (res)
                        *(int *)res = out_obj.integer.value;
                success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER;
                break;
-       case 'v':       /* void */
+       case 'v':               /* void */
                success = status == AE_OK;
                break;
-       /* add more types as needed */
+               /* add more types as needed */
        default:
                printk(IBM_ERR "acpi_evalf() called "
                       "with invalid format character '%c'\n", res_type);
@@ -262,7 +352,7 @@ static char *next_cmd(char **cmds)
        return start;
 }
 
-static int driver_init(struct ibm_struct *ibm)
+static int driver_init(void)
 {
        printk(IBM_INFO "%s v%s\n", IBM_DESC, IBM_VERSION);
        printk(IBM_INFO "%s\n", IBM_URL);
@@ -270,7 +360,7 @@ static int driver_init(struct ibm_struct *ibm)
        return 0;
 }
 
-static int driver_read(struct ibm_struct *ibm, char *p)
+static int driver_read(char *p)
 {
        int len = 0;
 
@@ -280,67 +370,74 @@ static int driver_read(struct ibm_struct *ibm, char *p)
        return len;
 }
 
-static int hotkey_get(struct ibm_struct *ibm, int *status, int *mask)
+static int hotkey_supported;
+static int hotkey_mask_supported;
+static int hotkey_orig_status;
+static int hotkey_orig_mask;
+
+static int hotkey_get(int *status, int *mask)
 {
        if (!acpi_evalf(hkey_handle, status, "DHKC", "d"))
-               return -EIO;
-       if (ibm->supported) {
-               if (!acpi_evalf(hkey_handle, mask, "DHKN", "qd"))
-                       return -EIO;
-       } else {
-               *mask = ibm->state.hotkey.mask;
-       }
-       return 0;
+               return 0;
+
+       if (hotkey_mask_supported)
+               if (!acpi_evalf(hkey_handle, mask, "DHKN", "d"))
+                       return 0;
+
+       return 1;
 }
 
-static int hotkey_set(struct ibm_struct *ibm, int status, int mask)
+static int hotkey_set(int status, int mask)
 {
        int i;
 
        if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", status))
-               return -EIO;
-
-       if (!ibm->supported)
                return 0;
 
-       for (i=0; i<32; i++) {
-               int bit = ((1 << i) & mask) != 0;
-               if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i+1, bit))
-                       return -EIO;
-       }
+       if (hotkey_mask_supported)
+               for (i = 0; i < 32; i++) {
+                       int bit = ((1 << i) & mask) != 0;
+                       if (!acpi_evalf(hkey_handle,
+                                       NULL, "MHKM", "vdd", i + 1, bit))
+                               return 0;
+               }
 
-       return 0;
+       return 1;
 }
 
-static int hotkey_init(struct ibm_struct *ibm)
+static int hotkey_init(void)
 {
-       int ret;
+       /* hotkey not supported on 570 */
+       hotkey_supported = hkey_handle != NULL;
 
-       ibm->supported = 1;
-       ret = hotkey_get(ibm,
-                        &ibm->state.hotkey.status,
-                        &ibm->state.hotkey.mask);
-       if (ret < 0) {
-               /* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */
-               ibm->supported = 0;
-               ret = hotkey_get(ibm,
-                                &ibm->state.hotkey.status,
-                                &ibm->state.hotkey.mask);
+       if (hotkey_supported) {
+               /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
+                  A30, R30, R31, T20-22, X20-21, X22-24 */
+               hotkey_mask_supported =
+                   acpi_evalf(hkey_handle, NULL, "DHKN", "qv");
+
+               if (!hotkey_get(&hotkey_orig_status, &hotkey_orig_mask))
+                       return -ENODEV;
        }
 
-       return ret;
-}      
+       return 0;
+}
 
-static int hotkey_read(struct ibm_struct *ibm, char *p)
+static int hotkey_read(char *p)
 {
        int status, mask;
        int len = 0;
 
-       if (hotkey_get(ibm, &status, &mask) < 0)
+       if (!hotkey_supported) {
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+               return len;
+       }
+
+       if (!hotkey_get(&status, &mask))
                return -EIO;
 
        len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 0));
-       if (ibm->supported) {
+       if (hotkey_mask_supported) {
                len += sprintf(p + len, "mask:\t\t0x%04x\n", mask);
                len += sprintf(p + len,
                               "commands:\tenable, disable, reset, <mask>\n");
@@ -352,23 +449,26 @@ static int hotkey_read(struct ibm_struct *ibm, char *p)
        return len;
 }
 
-static int hotkey_write(struct ibm_struct *ibm, char *buf)
+static int hotkey_write(char *buf)
 {
        int status, mask;
        char *cmd;
        int do_cmd = 0;
 
-       if (hotkey_get(ibm, &status, &mask) < 0)
+       if (!hotkey_supported)
                return -ENODEV;
 
+       if (!hotkey_get(&status, &mask))
+               return -EIO;
+
        while ((cmd = next_cmd(&buf))) {
                if (strlencmp(cmd, "enable") == 0) {
                        status = 1;
                } else if (strlencmp(cmd, "disable") == 0) {
                        status = 0;
                } else if (strlencmp(cmd, "reset") == 0) {
-                       status = ibm->state.hotkey.status;
-                       mask   = ibm->state.hotkey.mask;
+                       status = hotkey_orig_status;
+                       mask = hotkey_orig_mask;
                } else if (sscanf(cmd, "0x%x", &mask) == 1) {
                        /* mask set */
                } else if (sscanf(cmd, "%x", &mask) == 1) {
@@ -378,15 +478,16 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf)
                do_cmd = 1;
        }
 
-       if (do_cmd && hotkey_set(ibm, status, mask) < 0)
+       if (do_cmd && !hotkey_set(status, mask))
                return -EIO;
 
        return 0;
-}      
+}
 
-static void hotkey_exit(struct ibm_struct *ibm)
+static void hotkey_exit(void)
 {
-       hotkey_set(ibm, ibm->state.hotkey.status, ibm->state.hotkey.mask);
+       if (hotkey_supported)
+               hotkey_set(hotkey_orig_status, hotkey_orig_mask);
 }
 
 static void hotkey_notify(struct ibm_struct *ibm, u32 event)
@@ -398,33 +499,38 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
        else {
                printk(IBM_ERR "unknown hotkey event %d\n", event);
                acpi_bus_generate_event(ibm->device, event, 0);
-       }       
+       }
 }
 
-static int bluetooth_init(struct ibm_struct *ibm)
+static int bluetooth_supported;
+
+static int bluetooth_init(void)
 {
-       /* bluetooth not supported on A21e, G40, T20, T21, X20 */
-       ibm->supported = acpi_evalf(hkey_handle, NULL, "GBDC", "qv");
+       /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
+          G4x, R30, R31, R40e, R50e, T20-22, X20-21 */
+       bluetooth_supported = hkey_handle &&
+           acpi_evalf(hkey_handle, NULL, "GBDC", "qv");
 
        return 0;
 }
 
-static int bluetooth_status(struct ibm_struct *ibm)
+static int bluetooth_status(void)
 {
        int status;
 
-       if (!ibm->supported || !acpi_evalf(hkey_handle, &status, "GBDC", "d"))
+       if (!bluetooth_supported ||
+           !acpi_evalf(hkey_handle, &status, "GBDC", "d"))
                status = 0;
 
        return status;
 }
 
-static int bluetooth_read(struct ibm_struct *ibm, char *p)
+static int bluetooth_read(char *p)
 {
        int len = 0;
-       int status = bluetooth_status(ibm);
+       int status = bluetooth_status();
 
-       if (!ibm->supported)
+       if (!bluetooth_supported)
                len += sprintf(p + len, "status:\t\tnot supported\n");
        else if (!(status & 1))
                len += sprintf(p + len, "status:\t\tnot installed\n");
@@ -436,14 +542,14 @@ static int bluetooth_read(struct ibm_struct *ibm, char *p)
        return len;
 }
 
-static int bluetooth_write(struct ibm_struct *ibm, char *buf)
+static int bluetooth_write(char *buf)
 {
-       int status = bluetooth_status(ibm);
+       int status = bluetooth_status();
        char *cmd;
        int do_cmd = 0;
 
-       if (!ibm->supported)
-               return -EINVAL;
+       if (!bluetooth_supported)
+               return -ENODEV;
 
        while ((cmd = next_cmd(&buf))) {
                if (strlencmp(cmd, "enable") == 0) {
@@ -456,64 +562,166 @@ static int bluetooth_write(struct ibm_struct *ibm, char *buf)
        }
 
        if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
-           return -EIO;
+               return -EIO;
 
        return 0;
 }
 
-static int video_init(struct ibm_struct *ibm)
+static int video_supported;
+static int video_orig_autosw;
+
+#define VIDEO_570 1
+#define VIDEO_770 2
+#define VIDEO_NEW 3
+
+static int video_init(void)
 {
-       if (!acpi_evalf(vid_handle,
-                       &ibm->state.video.autoswitch, "^VDEE", "d"))
-               return -ENODEV;
+       int ivga;
+
+       if (vid2_handle && acpi_evalf(NULL, &ivga, "\\IVGA", "d") && ivga)
+               /* G41, assume IVGA doesn't change */
+               vid_handle = vid2_handle;
+
+       if (!vid_handle)
+               /* video switching not supported on R30, R31 */
+               video_supported = 0;
+       else if (acpi_evalf(vid_handle, &video_orig_autosw, "SWIT", "qd"))
+               /* 570 */
+               video_supported = VIDEO_570;
+       else if (acpi_evalf(vid_handle, &video_orig_autosw, "^VADL", "qd"))
+               /* 600e/x, 770e, 770x */
+               video_supported = VIDEO_770;
+       else
+               /* all others */
+               video_supported = VIDEO_NEW;
 
        return 0;
 }
 
-static int video_status(struct ibm_struct *ibm)
+static int video_status(void)
 {
        int status = 0;
        int i;
 
-       acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1);
-       if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
-               status |= 0x02 * i;
+       if (video_supported == VIDEO_570) {
+               if (acpi_evalf(NULL, &i, "\\_SB.PHS", "dd", 0x87))
+                       status = i & 3;
+       } else if (video_supported == VIDEO_770) {
+               if (acpi_evalf(NULL, &i, "\\VCDL", "d"))
+                       status |= 0x01 * i;
+               if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
+                       status |= 0x02 * i;
+       } else if (video_supported == VIDEO_NEW) {
+               acpi_evalf(NULL, NULL, "\\VUPS", "vd", 1);
+               if (acpi_evalf(NULL, &i, "\\VCDC", "d"))
+                       status |= 0x02 * i;
+
+               acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0);
+               if (acpi_evalf(NULL, &i, "\\VCDL", "d"))
+                       status |= 0x01 * i;
+               if (acpi_evalf(NULL, &i, "\\VCDD", "d"))
+                       status |= 0x08 * i;
+       }
+
+       return status;
+}
 
-       acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0);
-       if (acpi_evalf(NULL, &i, "\\VCDL", "d"))
-               status |= 0x01 * i;
-       if (acpi_evalf(NULL, &i, "\\VCDD", "d"))
-               status |= 0x08 * i;
+static int video_autosw(void)
+{
+       int autosw = 0;
 
-       if (acpi_evalf(vid_handle, &i, "^VDEE", "d"))
-               status |= 0x10 * (i & 1);
+       if (video_supported == VIDEO_570)
+               acpi_evalf(vid_handle, &autosw, "SWIT", "d");
+       else if (video_supported == VIDEO_770 || video_supported == VIDEO_NEW)
+               acpi_evalf(vid_handle, &autosw, "^VDEE", "d");
 
-       return status;
+       return autosw & 1;
 }
 
-static int video_read(struct ibm_struct *ibm, char *p)
+static int video_read(char *p)
 {
-       int status = video_status(ibm);
+       int status = video_status();
+       int autosw = video_autosw();
        int len = 0;
 
+       if (!video_supported) {
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+               return len;
+       }
+
+       len += sprintf(p + len, "status:\t\tsupported\n");
        len += sprintf(p + len, "lcd:\t\t%s\n", enabled(status, 0));
        len += sprintf(p + len, "crt:\t\t%s\n", enabled(status, 1));
-       len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3));
-       len += sprintf(p + len, "auto:\t\t%s\n", enabled(status, 4));
-       len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable, "
-                      "crt_enable, crt_disable\n");
-       len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable, "
-                      "auto_enable, auto_disable\n");
+       if (video_supported == VIDEO_NEW)
+               len += sprintf(p + len, "dvi:\t\t%s\n", enabled(status, 3));
+       len += sprintf(p + len, "auto:\t\t%s\n", enabled(autosw, 0));
+       len += sprintf(p + len, "commands:\tlcd_enable, lcd_disable\n");
+       len += sprintf(p + len, "commands:\tcrt_enable, crt_disable\n");
+       if (video_supported == VIDEO_NEW)
+               len += sprintf(p + len, "commands:\tdvi_enable, dvi_disable\n");
+       len += sprintf(p + len, "commands:\tauto_enable, auto_disable\n");
        len += sprintf(p + len, "commands:\tvideo_switch, expand_toggle\n");
 
        return len;
 }
 
-static int video_write(struct ibm_struct *ibm, char *buf)
+static int video_switch(void)
+{
+       int autosw = video_autosw();
+       int ret;
+
+       if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
+               return -EIO;
+       ret = video_supported == VIDEO_570 ?
+           acpi_evalf(ec_handle, NULL, "_Q16", "v") :
+           acpi_evalf(vid_handle, NULL, "VSWT", "v");
+       acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw);
+
+       return ret;
+}
+
+static int video_expand(void)
+{
+       if (video_supported == VIDEO_570)
+               return acpi_evalf(ec_handle, NULL, "_Q17", "v");
+       else if (video_supported == VIDEO_770)
+               return acpi_evalf(vid_handle, NULL, "VEXP", "v");
+       else
+               return acpi_evalf(NULL, NULL, "\\VEXP", "v");
+}
+
+static int video_switch2(int status)
+{
+       int ret;
+
+       if (video_supported == VIDEO_570) {
+               ret = acpi_evalf(NULL, NULL,
+                                "\\_SB.PHS2", "vdd", 0x8b, status | 0x80);
+       } else if (video_supported == VIDEO_770) {
+               int autosw = video_autosw();
+               if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
+                       return -EIO;
+
+               ret = acpi_evalf(vid_handle, NULL,
+                                "ASWT", "vdd", status * 0x100, 0);
+
+               acpi_evalf(vid_handle, NULL, "_DOS", "vd", autosw);
+       } else {
+               ret = acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0x80) &&
+                   acpi_evalf(NULL, NULL, "\\VSDS", "vdd", status, 1);
+       }
+
+       return ret;
+}
+
+static int video_write(char *buf)
 {
        char *cmd;
        int enable, disable, status;
 
+       if (!video_supported)
+               return -ENODEV;
+
        enable = disable = 0;
 
        while ((cmd = next_cmd(&buf))) {
@@ -525,9 +733,11 @@ static int video_write(struct ibm_struct *ibm, char *buf)
                        enable |= 0x02;
                } else if (strlencmp(cmd, "crt_disable") == 0) {
                        disable |= 0x02;
-               } else if (strlencmp(cmd, "dvi_enable") == 0) {
+               } else if (video_supported == VIDEO_NEW &&
+                          strlencmp(cmd, "dvi_enable") == 0) {
                        enable |= 0x08;
-               } else if (strlencmp(cmd, "dvi_disable") == 0) {
+               } else if (video_supported == VIDEO_NEW &&
+                          strlencmp(cmd, "dvi_disable") == 0) {
                        disable |= 0x08;
                } else if (strlencmp(cmd, "auto_enable") == 0) {
                        if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
@@ -536,71 +746,75 @@ static int video_write(struct ibm_struct *ibm, char *buf)
                        if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 0))
                                return -EIO;
                } else if (strlencmp(cmd, "video_switch") == 0) {
-                       int autoswitch;
-                       if (!acpi_evalf(vid_handle, &autoswitch, "^VDEE", "d"))
-                               return -EIO;
-                       if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", 1))
-                               return -EIO;
-                       if (!acpi_evalf(vid_handle, NULL, "VSWT", "v"))
-                               return -EIO;
-                       if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd",
-                                       autoswitch))
+                       if (!video_switch())
                                return -EIO;
                } else if (strlencmp(cmd, "expand_toggle") == 0) {
-                       if (!acpi_evalf(NULL, NULL, "\\VEXP", "v"))
+                       if (!video_expand())
                                return -EIO;
                } else
                        return -EINVAL;
        }
 
        if (enable || disable) {
-               status = (video_status(ibm) & 0x0f & ~disable) | enable;
-               if (!acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0x80))
-                       return -EIO;
-               if (!acpi_evalf(NULL, NULL, "\\VSDS", "vdd", status, 1))
+               status = (video_status() & 0x0f & ~disable) | enable;
+               if (!video_switch2(status))
                        return -EIO;
        }
 
        return 0;
 }
 
-static void video_exit(struct ibm_struct *ibm)
+static void video_exit(void)
 {
-       acpi_evalf(vid_handle, NULL, "_DOS", "vd",
-                  ibm->state.video.autoswitch);
+       acpi_evalf(vid_handle, NULL, "_DOS", "vd", video_orig_autosw);
 }
 
-static int light_init(struct ibm_struct *ibm)
+static int light_supported;
+static int light_status_supported;
+
+static int light_init(void)
 {
-       /* kblt not supported on G40, R32, X20 */
-       ibm->supported = acpi_evalf(ec_handle, NULL, "KBLT", "qv");
+       /* light not supported on 570, 600e/x, 770e, 770x, G4x, R30, R31 */
+       light_supported = (cmos_handle || lght_handle) && !ledb_handle;
+
+       if (light_supported)
+               /* light status not supported on
+                  570, 600e/x, 770e, 770x, G4x, R30, R31, R32, X20 */
+               light_status_supported = acpi_evalf(ec_handle, NULL,
+                                                   "KBLT", "qv");
 
        return 0;
 }
 
-static int light_read(struct ibm_struct *ibm, char *p)
+static int light_read(char *p)
 {
        int len = 0;
        int status = 0;
 
-       if (ibm->supported) {
+       if (!light_supported) {
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+       } else if (!light_status_supported) {
+               len += sprintf(p + len, "status:\t\tunknown\n");
+               len += sprintf(p + len, "commands:\ton, off\n");
+       } else {
                if (!acpi_evalf(ec_handle, &status, "KBLT", "d"))
                        return -EIO;
                len += sprintf(p + len, "status:\t\t%s\n", onoff(status, 0));
-       } else
-               len += sprintf(p + len, "status:\t\tunknown\n");
-
-       len += sprintf(p + len, "commands:\ton, off\n");
+               len += sprintf(p + len, "commands:\ton, off\n");
+       }
 
        return len;
 }
 
-static int light_write(struct ibm_struct *ibm, char *buf)
+static int light_write(char *buf)
 {
        int cmos_cmd, lght_cmd;
        char *cmd;
        int success;
-       
+
+       if (!light_supported)
+               return -ENODEV;
+
        while ((cmd = next_cmd(&buf))) {
                if (strlencmp(cmd, "on") == 0) {
                        cmos_cmd = 0x0c;
@@ -610,10 +824,10 @@ static int light_write(struct ibm_struct *ibm, char *buf)
                        lght_cmd = 0;
                } else
                        return -EINVAL;
-               
+
                success = cmos_handle ?
-                       acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
-                       acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
+                   acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
+                   acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
                if (!success)
                        return -EIO;
        }
@@ -633,7 +847,7 @@ static int _sta(acpi_handle handle)
 
 #define dock_docked() (_sta(dock_handle) & 1)
 
-static int dock_read(struct ibm_struct *ibm, char *p)
+static int dock_read(char *p)
 {
        int len = 0;
        int docked = dock_docked();
@@ -650,18 +864,17 @@ static int dock_read(struct ibm_struct *ibm, char *p)
        return len;
 }
 
-static int dock_write(struct ibm_struct *ibm, char *buf)
+static int dock_write(char *buf)
 {
        char *cmd;
 
        if (!dock_docked())
-               return -EINVAL;
+               return -ENODEV;
 
        while ((cmd = next_cmd(&buf))) {
                if (strlencmp(cmd, "undock") == 0) {
-                       if (!acpi_evalf(dock_handle, NULL, "_DCK", "vd", 0))
-                               return -EIO;
-                       if (!acpi_evalf(dock_handle, NULL, "_EJ0", "vd", 1))
+                       if (!acpi_evalf(dock_handle, NULL, "_DCK", "vd", 0) ||
+                           !acpi_evalf(dock_handle, NULL, "_EJ0", "vd", 1))
                                return -EIO;
                } else if (strlencmp(cmd, "dock") == 0) {
                        if (!acpi_evalf(dock_handle, NULL, "_DCK", "vd", 1))
@@ -671,90 +884,131 @@ static int dock_write(struct ibm_struct *ibm, char *buf)
        }
 
        return 0;
-}      
+}
 
 static void dock_notify(struct ibm_struct *ibm, u32 event)
 {
        int docked = dock_docked();
-
-       if (event == 3 && docked)
-               acpi_bus_generate_event(ibm->device, event, 1); /* button */
+       int pci = ibm->hid && strstr(ibm->hid, IBM_PCI_HID);
+
+       if (event == 1 && !pci) /* 570 */
+               acpi_bus_generate_event(ibm->device, event, 1); /* button */
+       else if (event == 1 && pci)     /* 570 */
+               acpi_bus_generate_event(ibm->device, event, 3); /* dock */
+       else if (event == 3 && docked)
+               acpi_bus_generate_event(ibm->device, event, 1); /* button */
        else if (event == 3 && !docked)
-               acpi_bus_generate_event(ibm->device, event, 2); /* undock */
+               acpi_bus_generate_event(ibm->device, event, 2); /* undock */
        else if (event == 0 && docked)
-               acpi_bus_generate_event(ibm->device, event, 3); /* dock */
+               acpi_bus_generate_event(ibm->device, event, 3); /* dock */
        else {
                printk(IBM_ERR "unknown dock event %d, status %d\n",
                       event, _sta(dock_handle));
-               acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
+               acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
        }
 }
 
-#define bay_occupied() (_sta(bay_handle) & 1)
+static int bay_status_supported;
+static int bay_status2_supported;
+static int bay_eject_supported;
+static int bay_eject2_supported;
 
-static int bay_init(struct ibm_struct *ibm)
+static int bay_init(void)
 {
-       /* bay not supported on A21e, A22p, A31, A31p, G40, R32, R40e */
-       ibm->supported = bay_handle && bayej_handle &&
-               acpi_evalf(bay_handle, NULL, "_STA", "qv");
+       bay_status_supported = bay_handle &&
+           acpi_evalf(bay_handle, NULL, "_STA", "qv");
+       bay_status2_supported = bay2_handle &&
+           acpi_evalf(bay2_handle, NULL, "_STA", "qv");
+
+       bay_eject_supported = bay_handle && bay_ej_handle &&
+           (strlencmp(bay_ej_path, "_EJ0") == 0 || experimental);
+       bay_eject2_supported = bay2_handle && bay2_ej_handle &&
+           (strlencmp(bay2_ej_path, "_EJ0") == 0 || experimental);
 
        return 0;
 }
 
-static int bay_read(struct ibm_struct *ibm, char *p)
+#define bay_occupied(b) (_sta(b##_handle) & 1)
+
+static int bay_read(char *p)
 {
        int len = 0;
-       int occupied = bay_occupied();
-       
-       if (!ibm->supported)
-               len += sprintf(p + len, "status:\t\tnot supported\n");
-       else if (!occupied)
-               len += sprintf(p + len, "status:\t\tunoccupied\n");
-       else {
-               len += sprintf(p + len, "status:\t\toccupied\n");
+       int occupied = bay_occupied(bay);
+       int occupied2 = bay_occupied(bay2);
+       int eject, eject2;
+
+       len += sprintf(p + len, "status:\t\t%s\n", bay_status_supported ?
+                      (occupied ? "occupied" : "unoccupied") :
+                      "not supported");
+       if (bay_status2_supported)
+               len += sprintf(p + len, "status2:\t%s\n", occupied2 ?
+                              "occupied" : "unoccupied");
+
+       eject = bay_eject_supported && occupied;
+       eject2 = bay_eject2_supported && occupied2;
+
+       if (eject && eject2)
+               len += sprintf(p + len, "commands:\teject, eject2\n");
+       else if (eject)
                len += sprintf(p + len, "commands:\teject\n");
-       }
+       else if (eject2)
+               len += sprintf(p + len, "commands:\teject2\n");
 
        return len;
 }
 
-static int bay_write(struct ibm_struct *ibm, char *buf)
+static int bay_write(char *buf)
 {
        char *cmd;
 
+       if (!bay_eject_supported && !bay_eject2_supported)
+               return -ENODEV;
+
        while ((cmd = next_cmd(&buf))) {
-               if (strlencmp(cmd, "eject") == 0) {
-                       if (!ibm->supported ||
-                           !acpi_evalf(bay_handle, NULL, "_EJ0", "vd", 1))
+               if (bay_eject_supported && strlencmp(cmd, "eject") == 0) {
+                       if (!acpi_evalf(bay_ej_handle, NULL, NULL, "vd", 1))
+                               return -EIO;
+               } else if (bay_eject2_supported &&
+                          strlencmp(cmd, "eject2") == 0) {
+                       if (!acpi_evalf(bay2_ej_handle, NULL, NULL, "vd", 1))
                                return -EIO;
                } else
                        return -EINVAL;
        }
 
        return 0;
-}      
+}
 
 static void bay_notify(struct ibm_struct *ibm, u32 event)
 {
        acpi_bus_generate_event(ibm->device, event, 0);
 }
 
-static int cmos_read(struct ibm_struct *ibm, char *p)
+static int cmos_read(char *p)
 {
        int len = 0;
 
-       /* cmos not supported on A21e, A22p, T20, T21, X20 */
+       /* cmos not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
+          R30, R31, T20-22, X20-21 */
        if (!cmos_handle)
                len += sprintf(p + len, "status:\t\tnot supported\n");
        else {
                len += sprintf(p + len, "status:\t\tsupported\n");
-               len += sprintf(p + len, "commands:\t<int>\n");
+               len += sprintf(p + len, "commands:\t<cmd> (<cmd> is 0-21)\n");
        }
 
        return len;
 }
 
-static int cmos_write(struct ibm_struct *ibm, char *buf)
+static int cmos_eval(int cmos_cmd)
+{
+       if (cmos_handle)
+               return acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd);
+       else
+               return 1;
+}
+
+static int cmos_write(char *buf)
 {
        char *cmd;
        int cmos_cmd;
@@ -763,183 +1017,644 @@ static int cmos_write(struct ibm_struct *ibm, char *buf)
                return -EINVAL;
 
        while ((cmd = next_cmd(&buf))) {
-               if (sscanf(cmd, "%u", &cmos_cmd) == 1) {
+               if (sscanf(cmd, "%u", &cmos_cmd) == 1 &&
+                   cmos_cmd >= 0 && cmos_cmd <= 21) {
                        /* cmos_cmd set */
                } else
                        return -EINVAL;
 
-               if (!acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd))
+               if (!cmos_eval(cmos_cmd))
                        return -EIO;
        }
 
        return 0;
-}      
-               
-static int led_read(struct ibm_struct *ibm, char *p)
+}
+
+static int led_supported;
+
+#define LED_570 1
+#define LED_OLD 2
+#define LED_NEW 3
+
+static int led_init(void)
+{
+       if (!led_handle)
+               /* led not supported on R30, R31 */
+               led_supported = 0;
+       else if (strlencmp(led_path, "SLED") == 0)
+               /* 570 */
+               led_supported = LED_570;
+       else if (strlencmp(led_path, "SYSL") == 0)
+               /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
+               led_supported = LED_OLD;
+       else
+               /* all others */
+               led_supported = LED_NEW;
+
+       return 0;
+}
+
+#define led_status(s) ((s) == 0 ? "off" : ((s) == 1 ? "on" : "blinking"))
+
+static int led_read(char *p)
 {
        int len = 0;
 
+       if (!led_supported) {
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+               return len;
+       }
+       len += sprintf(p + len, "status:\t\tsupported\n");
+
+       if (led_supported == LED_570) {
+               /* 570 */
+               int i, status;
+               for (i = 0; i < 8; i++) {
+                       if (!acpi_evalf(ec_handle,
+                                       &status, "GLED", "dd", 1 << i))
+                               return -EIO;
+                       len += sprintf(p + len, "%d:\t\t%s\n",
+                                      i, led_status(status));
+               }
+       }
+
        len += sprintf(p + len, "commands:\t"
-                      "<int> on, <int> off, <int> blink\n");
+                      "<led> on, <led> off, <led> blink (<led> is 0-7)\n");
 
        return len;
 }
 
-static int led_write(struct ibm_struct *ibm, char *buf)
+/* off, on, blink */
+static const int led_sled_arg1[] = { 0, 1, 3 };
+static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */
+static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */
+static const int led_led_arg1[] = { 0, 0x80, 0xc0 };
+
+#define EC_HLCL 0x0c
+#define EC_HLBL 0x0d
+#define EC_HLMS 0x0e
+
+static int led_write(char *buf)
 {
        char *cmd;
-       unsigned int led;
-       int led_cmd, sysl_cmd, bled_a, bled_b;
+       int led, ind, ret;
+
+       if (!led_supported)
+               return -ENODEV;
 
        while ((cmd = next_cmd(&buf))) {
-               if (sscanf(cmd, "%u", &led) != 1)
+               if (sscanf(cmd, "%d", &led) != 1 || led < 0 || led > 7)
                        return -EINVAL;
 
-               if (strstr(cmd, "blink")) {
-                       led_cmd = 0xc0;
-                       sysl_cmd = 2;
-                       bled_a = 2;
-                       bled_b = 1;
+               if (strstr(cmd, "off")) {
+                       ind = 0;
                } else if (strstr(cmd, "on")) {
-                       led_cmd = 0x80;
-                       sysl_cmd = 1;
-                       bled_a = 2;
-                       bled_b = 0;
-               } else if (strstr(cmd, "off")) {
-                       led_cmd = sysl_cmd = bled_a = bled_b = 0;
+                       ind = 1;
+               } else if (strstr(cmd, "blink")) {
+                       ind = 2;
                } else
                        return -EINVAL;
-               
-               if (led_handle) {
+
+               if (led_supported == LED_570) {
+                       /* 570 */
+                       led = 1 << led;
                        if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
-                                       led, led_cmd))
+                                       led, led_sled_arg1[ind]))
                                return -EIO;
-               } else if (led < 2) {
-                       if (acpi_evalf(sysl_handle, NULL, NULL, "vdd",
-                                      led, sysl_cmd))
+               } else if (led_supported == LED_OLD) {
+                       /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */
+                       led = 1 << led;
+                       ret = ec_write(EC_HLMS, led);
+                       if (ret >= 0)
+                               ret =
+                                   ec_write(EC_HLBL, led * led_exp_hlbl[ind]);
+                       if (ret >= 0)
+                               ret =
+                                   ec_write(EC_HLCL, led * led_exp_hlcl[ind]);
+                       if (ret < 0)
+                               return ret;
+               } else {
+                       /* all others */
+                       if (!acpi_evalf(led_handle, NULL, NULL, "vdd",
+                                       led, led_led_arg1[ind]))
                                return -EIO;
-               } else if (led == 2 && bled_handle) {
-                       if (acpi_evalf(bled_handle, NULL, NULL, "vdd",
-                                      bled_a, bled_b))
+               }
+       }
+
+       return 0;
+}
+
+static int beep_read(char *p)
+{
+       int len = 0;
+
+       if (!beep_handle)
+               len += sprintf(p + len, "status:\t\tnot supported\n");
+       else {
+               len += sprintf(p + len, "status:\t\tsupported\n");
+               len += sprintf(p + len, "commands:\t<cmd> (<cmd> is 0-17)\n");
+       }
+
+       return len;
+}
+
+static int beep_write(char *buf)
+{
+       char *cmd;
+       int beep_cmd;
+
+       if (!beep_handle)
+               return -ENODEV;
+
+       while ((cmd = next_cmd(&buf))) {
+               if (sscanf(cmd, "%u", &beep_cmd) == 1 &&
+                   beep_cmd >= 0 && beep_cmd <= 17) {
+                       /* beep_cmd set */
+               } else
+                       return -EINVAL;
+               if (!acpi_evalf(beep_handle, NULL, NULL, "vdd", beep_cmd, 0))
+                       return -EIO;
+       }
+
+       return 0;
+}
+
+static int acpi_ec_read(int i, u8 * p)
+{
+       int v;
+
+       if (ecrd_handle) {
+               if (!acpi_evalf(ecrd_handle, &v, NULL, "dd", i))
+                       return 0;
+               *p = v;
+       } else {
+               if (ec_read(i, p) < 0)
+                       return 0;
+       }
+
+       return 1;
+}
+
+static int acpi_ec_write(int i, u8 v)
+{
+       if (ecwr_handle) {
+               if (!acpi_evalf(ecwr_handle, NULL, NULL, "vdd", i, v))
+                       return 0;
+       } else {
+               if (ec_write(i, v) < 0)
+                       return 0;
+       }
+
+       return 1;
+}
+
+static int thermal_tmp_supported;
+static int thermal_updt_supported;
+
+static int thermal_init(void)
+{
+       /* temperatures not supported on 570, G4x, R30, R31, R32 */
+       thermal_tmp_supported = acpi_evalf(ec_handle, NULL, "TMP7", "qv");
+
+       /* 600e/x, 770e, 770x */
+       thermal_updt_supported = acpi_evalf(ec_handle, NULL, "UPDT", "qv");
+
+       return 0;
+}
+
+static int thermal_read(char *p)
+{
+       int len = 0;
+
+       if (!thermal_tmp_supported)
+               len += sprintf(p + len, "temperatures:\tnot supported\n");
+       else {
+               int i, t;
+               char tmpi[] = "TMPi";
+               s8 tmp[8];
+
+               if (thermal_updt_supported)
+                       if (!acpi_evalf(ec_handle, NULL, "UPDT", "v"))
+                               return -EIO;
+
+               for (i = 0; i < 8; i++) {
+                       tmpi[3] = '0' + i;
+                       if (!acpi_evalf(ec_handle, &t, tmpi, "d"))
+                               return -EIO;
+                       if (thermal_updt_supported)
+                               tmp[i] = (t - 2732 + 5) / 10;
+                       else
+                               tmp[i] = t;
+               }
+
+               len += sprintf(p + len,
+                              "temperatures:\t%d %d %d %d %d %d %d %d\n",
+                              tmp[0], tmp[1], tmp[2], tmp[3],
+                              tmp[4], tmp[5], tmp[6], tmp[7]);
+       }
+
+       return len;
+}
+
+static u8 ecdump_regs[256];
+
+static int ecdump_read(char *p)
+{
+       int len = 0;
+       int i, j;
+       u8 v;
+
+       len += sprintf(p + len, "EC      "
+                      " +00 +01 +02 +03 +04 +05 +06 +07"
+                      " +08 +09 +0a +0b +0c +0d +0e +0f\n");
+       for (i = 0; i < 256; i += 16) {
+               len += sprintf(p + len, "EC 0x%02x:", i);
+               for (j = 0; j < 16; j++) {
+                       if (!acpi_ec_read(i + j, &v))
+                               break;
+                       if (v != ecdump_regs[i + j])
+                               len += sprintf(p + len, " *%02x", v);
+                       else
+                               len += sprintf(p + len, "  %02x", v);
+                       ecdump_regs[i + j] = v;
+               }
+               len += sprintf(p + len, "\n");
+               if (j != 16)
+                       break;
+       }
+
+       /* These are way too dangerous to advertise openly... */
+#if 0
+       len += sprintf(p + len, "commands:\t0x<offset> 0x<value>"
+                      " (<offset> is 00-ff, <value> is 00-ff)\n");
+       len += sprintf(p + len, "commands:\t0x<offset> <value>  "
+                      " (<offset> is 00-ff, <value> is 0-255)\n");
+#endif
+       return len;
+}
+
+static int ecdump_write(char *buf)
+{
+       char *cmd;
+       int i, v;
+
+       while ((cmd = next_cmd(&buf))) {
+               if (sscanf(cmd, "0x%x 0x%x", &i, &v) == 2) {
+                       /* i and v set */
+               } else if (sscanf(cmd, "0x%x %u", &i, &v) == 2) {
+                       /* i and v set */
+               } else
+                       return -EINVAL;
+               if (i >= 0 && i < 256 && v >= 0 && v < 256) {
+                       if (!acpi_ec_write(i, v))
                                return -EIO;
                } else
                        return -EINVAL;
        }
 
        return 0;
-}      
-               
-static int beep_read(struct ibm_struct *ibm, char *p)
+}
+
+static int brightness_offset = 0x31;
+
+static int brightness_read(char *p)
 {
        int len = 0;
+       u8 level;
 
-       len += sprintf(p + len, "commands:\t<int>\n");
+       if (!acpi_ec_read(brightness_offset, &level)) {
+               len += sprintf(p + len, "level:\t\tunreadable\n");
+       } else {
+               len += sprintf(p + len, "level:\t\t%d\n", level & 0x7);
+               len += sprintf(p + len, "commands:\tup, down\n");
+               len += sprintf(p + len, "commands:\tlevel <level>"
+                              " (<level> is 0-7)\n");
+       }
 
        return len;
 }
 
-static int beep_write(struct ibm_struct *ibm, char *buf)
+#define BRIGHTNESS_UP  4
+#define BRIGHTNESS_DOWN        5
+
+static int brightness_write(char *buf)
 {
+       int cmos_cmd, inc, i;
+       u8 level;
+       int new_level;
        char *cmd;
-       int beep_cmd;
 
        while ((cmd = next_cmd(&buf))) {
-               if (sscanf(cmd, "%u", &beep_cmd) == 1) {
-                       /* beep_cmd set */
+               if (!acpi_ec_read(brightness_offset, &level))
+                       return -EIO;
+               level &= 7;
+
+               if (strlencmp(cmd, "up") == 0) {
+                       new_level = level == 7 ? 7 : level + 1;
+               } else if (strlencmp(cmd, "down") == 0) {
+                       new_level = level == 0 ? 0 : level - 1;
+               } else if (sscanf(cmd, "level %d", &new_level) == 1 &&
+                          new_level >= 0 && new_level <= 7) {
+                       /* new_level set */
+               } else
+                       return -EINVAL;
+
+               cmos_cmd = new_level > level ? BRIGHTNESS_UP : BRIGHTNESS_DOWN;
+               inc = new_level > level ? 1 : -1;
+               for (i = level; i != new_level; i += inc) {
+                       if (!cmos_eval(cmos_cmd))
+                               return -EIO;
+                       if (!acpi_ec_write(brightness_offset, i + inc))
+                               return -EIO;
+               }
+       }
+
+       return 0;
+}
+
+static int volume_offset = 0x30;
+
+static int volume_read(char *p)
+{
+       int len = 0;
+       u8 level;
+
+       if (!acpi_ec_read(volume_offset, &level)) {
+               len += sprintf(p + len, "level:\t\tunreadable\n");
+       } else {
+               len += sprintf(p + len, "level:\t\t%d\n", level & 0xf);
+               len += sprintf(p + len, "mute:\t\t%s\n", onoff(level, 6));
+               len += sprintf(p + len, "commands:\tup, down, mute\n");
+               len += sprintf(p + len, "commands:\tlevel <level>"
+                              " (<level> is 0-15)\n");
+       }
+
+       return len;
+}
+
+#define VOLUME_DOWN    0
+#define VOLUME_UP      1
+#define VOLUME_MUTE    2
+
+static int volume_write(char *buf)
+{
+       int cmos_cmd, inc, i;
+       u8 level, mute;
+       int new_level, new_mute;
+       char *cmd;
+
+       while ((cmd = next_cmd(&buf))) {
+               if (!acpi_ec_read(volume_offset, &level))
+                       return -EIO;
+               new_mute = mute = level & 0x40;
+               new_level = level = level & 0xf;
+
+               if (strlencmp(cmd, "up") == 0) {
+                       if (mute)
+                               new_mute = 0;
+                       else
+                               new_level = level == 15 ? 15 : level + 1;
+               } else if (strlencmp(cmd, "down") == 0) {
+                       if (mute)
+                               new_mute = 0;
+                       else
+                               new_level = level == 0 ? 0 : level - 1;
+               } else if (sscanf(cmd, "level %d", &new_level) == 1 &&
+                          new_level >= 0 && new_level <= 15) {
+                       /* new_level set */
+               } else if (strlencmp(cmd, "mute") == 0) {
+                       new_mute = 0x40;
                } else
                        return -EINVAL;
 
-               if (!acpi_evalf(beep_handle, NULL, NULL, "vd", beep_cmd))
+               if (new_level != level) {       /* mute doesn't change */
+                       cmos_cmd = new_level > level ? VOLUME_UP : VOLUME_DOWN;
+                       inc = new_level > level ? 1 : -1;
+
+                       if (mute && (!cmos_eval(cmos_cmd) ||
+                                    !acpi_ec_write(volume_offset, level)))
+                               return -EIO;
+
+                       for (i = level; i != new_level; i += inc)
+                               if (!cmos_eval(cmos_cmd) ||
+                                   !acpi_ec_write(volume_offset, i + inc))
+                                       return -EIO;
+
+                       if (mute && (!cmos_eval(VOLUME_MUTE) ||
+                                    !acpi_ec_write(volume_offset,
+                                                   new_level + mute)))
+                               return -EIO;
+               }
+
+               if (new_mute != mute) { /* level doesn't change */
+                       cmos_cmd = new_mute ? VOLUME_MUTE : VOLUME_UP;
+
+                       if (!cmos_eval(cmos_cmd) ||
+                           !acpi_ec_write(volume_offset, level + new_mute))
+                               return -EIO;
+               }
+       }
+
+       return 0;
+}
+
+static int fan_status_offset = 0x2f;
+static int fan_rpm_offset = 0x84;
+
+static int fan_read(char *p)
+{
+       int len = 0;
+       int s;
+       u8 lo, hi, status;
+
+       if (gfan_handle) {
+               /* 570, 600e/x, 770e, 770x */
+               if (!acpi_evalf(gfan_handle, &s, NULL, "d"))
                        return -EIO;
+
+               len += sprintf(p + len, "level:\t\t%d\n", s);
+       } else {
+               /* all except 570, 600e/x, 770e, 770x */
+               if (!acpi_ec_read(fan_status_offset, &status))
+                       len += sprintf(p + len, "status:\t\tunreadable\n");
+               else
+                       len += sprintf(p + len, "status:\t\t%s\n",
+                                      enabled(status, 7));
+
+               if (!acpi_ec_read(fan_rpm_offset, &lo) ||
+                   !acpi_ec_read(fan_rpm_offset + 1, &hi))
+                       len += sprintf(p + len, "speed:\t\tunreadable\n");
+               else
+                       len += sprintf(p + len, "speed:\t\t%d\n",
+                                      (hi << 8) + lo);
+       }
+
+       if (sfan_handle)
+               /* 570, 770x-JL */
+               len += sprintf(p + len, "commands:\tlevel <level>"
+                              " (<level> is 0-7)\n");
+       if (!gfan_handle)
+               /* all except 570, 600e/x, 770e, 770x */
+               len += sprintf(p + len, "commands:\tenable, disable\n");
+       if (fans_handle)
+               /* X31, X40 */
+               len += sprintf(p + len, "commands:\tspeed <speed>"
+                              " (<speed> is 0-65535)\n");
+
+       return len;
+}
+
+static int fan_write(char *buf)
+{
+       char *cmd;
+       int level, speed;
+
+       while ((cmd = next_cmd(&buf))) {
+               if (sfan_handle &&
+                   sscanf(cmd, "level %d", &level) == 1 &&
+                   level >= 0 && level <= 7) {
+                       /* 570, 770x-JL */
+                       if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", level))
+                               return -EIO;
+               } else if (!gfan_handle && strlencmp(cmd, "enable") == 0) {
+                       /* all except 570, 600e/x, 770e, 770x */
+                       if (!acpi_ec_write(fan_status_offset, 0x80))
+                               return -EIO;
+               } else if (!gfan_handle && strlencmp(cmd, "disable") == 0) {
+                       /* all except 570, 600e/x, 770e, 770x */
+                       if (!acpi_ec_write(fan_status_offset, 0x00))
+                               return -EIO;
+               } else if (fans_handle &&
+                          sscanf(cmd, "speed %d", &speed) == 1 &&
+                          speed >= 0 && speed <= 65535) {
+                       /* X31, X40 */
+                       if (!acpi_evalf(fans_handle, NULL, NULL, "vddd",
+                                       speed, speed, speed))
+                               return -EIO;
+               } else
+                       return -EINVAL;
        }
 
        return 0;
-}      
-               
+}
+
 static struct ibm_struct ibms[] = {
        {
-               .name   = "driver",
-               .init   = driver_init,
-               .read   = driver_read,
-       },
+        .name = "driver",
+        .init = driver_init,
+        .read = driver_read,
+        },
+       {
+        .name = "hotkey",
+        .hid = IBM_HKEY_HID,
+        .init = hotkey_init,
+        .read = hotkey_read,
+        .write = hotkey_write,
+        .exit = hotkey_exit,
+        .notify = hotkey_notify,
+        .handle = &hkey_handle,
+        .type = ACPI_DEVICE_NOTIFY,
+        },
+       {
+        .name = "bluetooth",
+        .init = bluetooth_init,
+        .read = bluetooth_read,
+        .write = bluetooth_write,
+        },
+       {
+        .name = "video",
+        .init = video_init,
+        .read = video_read,
+        .write = video_write,
+        .exit = video_exit,
+        },
        {
-               .name   = "hotkey",
-               .hid    = "IBM0068",
-               .init   = hotkey_init,
-               .read   = hotkey_read,
-               .write  = hotkey_write,
-               .exit   = hotkey_exit,
-               .notify = hotkey_notify,
-               .handle = &hkey_handle,
-               .type   = ACPI_DEVICE_NOTIFY,
-       },
+        .name = "light",
+        .init = light_init,
+        .read = light_read,
+        .write = light_write,
+        },
        {
-               .name   = "bluetooth",
-               .init   = bluetooth_init,
-               .read   = bluetooth_read,
-               .write  = bluetooth_write,
-       },
+        .name = "dock",
+        .read = dock_read,
+        .write = dock_write,
+        .notify = dock_notify,
+        .handle = &dock_handle,
+        .type = ACPI_SYSTEM_NOTIFY,
+        },
        {
-               .name   = "video",
-               .init   = video_init,
-               .read   = video_read,
-               .write  = video_write,
-               .exit   = video_exit,
-       },
+        .name = "dock",
+        .hid = IBM_PCI_HID,
+        .notify = dock_notify,
+        .handle = &pci_handle,
+        .type = ACPI_SYSTEM_NOTIFY,
+        },
        {
-               .name   = "light",
-               .init   = light_init,
-               .read   = light_read,
-               .write  = light_write,
-       },
+        .name = "bay",
+        .init = bay_init,
+        .read = bay_read,
+        .write = bay_write,
+        .notify = bay_notify,
+        .handle = &bay_handle,
+        .type = ACPI_SYSTEM_NOTIFY,
+        },
        {
-               .name   = "dock",
-               .read   = dock_read,
-               .write  = dock_write,
-               .notify = dock_notify,
-               .handle = &dock_handle,
-               .type   = ACPI_SYSTEM_NOTIFY,
-       },
+        .name = "cmos",
+        .read = cmos_read,
+        .write = cmos_write,
+        },
        {
-               .name   = "bay",
-               .init   = bay_init,
-               .read   = bay_read,
-               .write  = bay_write,
-               .notify = bay_notify,
-               .handle = &bay_handle,
-               .type   = ACPI_SYSTEM_NOTIFY,
-       },
+        .name = "led",
+        .init = led_init,
+        .read = led_read,
+        .write = led_write,
+        },
        {
-               .name   = "cmos",
-               .read   = cmos_read,
-               .write  = cmos_write,
-               .experimental = 1,
-       },
+        .name = "beep",
+        .read = beep_read,
+        .write = beep_write,
+        },
        {
-               .name   = "led",
-               .read   = led_read,
-               .write  = led_write,
-               .experimental = 1,
-       },
+        .name = "thermal",
+        .init = thermal_init,
+        .read = thermal_read,
+        },
        {
-               .name   = "beep",
-               .read   = beep_read,
-               .write  = beep_write,
-               .experimental = 1,
-       },
+        .name = "ecdump",
+        .read = ecdump_read,
+        .write = ecdump_write,
+        .experimental = 1,
+        },
+       {
+        .name = "brightness",
+        .read = brightness_read,
+        .write = brightness_write,
+        .experimental = 1,
+        },
+       {
+        .name = "volume",
+        .read = volume_read,
+        .write = volume_write,
+        .experimental = 1,
+        },
+       {
+        .name = "fan",
+        .read = fan_read,
+        .write = fan_write,
+        .experimental = 1,
+        },
 };
-#define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0]))
 
 static int dispatch_read(char *page, char **start, off_t off, int count,
                         int *eof, void *data)
 {
        struct ibm_struct *ibm = (struct ibm_struct *)data;
        int len;
-       
+
        if (!ibm || !ibm->read)
                return -EINVAL;
 
-       len = ibm->read(ibm, page);
+       len = ibm->read(page);
        if (len < 0)
                return len;
 
@@ -955,7 +1670,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count,
        return len;
 }
 
-static int dispatch_write(struct file *file, const char __user *userbuf,
+static int dispatch_write(struct file *file, const char __user * userbuf,
                          unsigned long count, void *data)
 {
        struct ibm_struct *ibm = (struct ibm_struct *)data;
@@ -969,20 +1684,20 @@ static int dispatch_write(struct file *file, const char __user *userbuf,
        if (!kernbuf)
                return -ENOMEM;
 
-        if (copy_from_user(kernbuf, userbuf, count)) {
+       if (copy_from_user(kernbuf, userbuf, count)) {
                kfree(kernbuf);
-                return -EFAULT;
+               return -EFAULT;
        }
 
        kernbuf[count] = 0;
        strcat(kernbuf, ",");
-       ret = ibm->write(ibm, kernbuf);
+       ret = ibm->write(kernbuf);
        if (ret == 0)
                ret = count;
 
        kfree(kernbuf);
 
-        return ret;
+       return ret;
 }
 
 static void dispatch_notify(acpi_handle handle, u32 event, void *data)
@@ -995,7 +1710,7 @@ static void dispatch_notify(acpi_handle handle, u32 event, void *data)
        ibm->notify(ibm, event);
 }
 
-static int setup_notify(struct ibm_struct *ibm)
+static int __init setup_notify(struct ibm_struct *ibm)
 {
        acpi_status status;
        int ret;
@@ -1020,17 +1735,15 @@ static int setup_notify(struct ibm_struct *ibm)
                return -ENODEV;
        }
 
-       ibm->notify_installed = 1;
-
        return 0;
 }
 
-static int ibmacpi_device_add(struct acpi_device *device)
+static int __init ibm_device_add(struct acpi_device *device)
 {
        return 0;
 }
 
-static int register_driver(struct ibm_struct *ibm)
+static int __init register_driver(struct ibm_struct *ibm)
 {
        int ret;
 
@@ -1043,7 +1756,7 @@ static int register_driver(struct ibm_struct *ibm)
        memset(ibm->driver, 0, sizeof(struct acpi_driver));
        sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name);
        ibm->driver->ids = ibm->hid;
-       ibm->driver->ops.add = &ibmacpi_device_add;
+       ibm->driver->ops.add = &ibm_device_add;
 
        ret = acpi_bus_register_driver(ibm->driver);
        if (ret < 0) {
@@ -1055,7 +1768,7 @@ static int register_driver(struct ibm_struct *ibm)
        return ret;
 }
 
-static int ibm_init(struct ibm_struct *ibm)
+static int __init ibm_init(struct ibm_struct *ibm)
 {
        int ret;
        struct proc_dir_entry *entry;
@@ -1071,31 +1784,34 @@ static int ibm_init(struct ibm_struct *ibm)
        }
 
        if (ibm->init) {
-               ret = ibm->init(ibm);
+               ret = ibm->init();
                if (ret != 0)
                        return ret;
                ibm->init_called = 1;
        }
 
-       entry = create_proc_entry(ibm->name, S_IFREG | S_IRUGO | S_IWUSR,
-                                 proc_dir);
-       if (!entry) {
-               printk(IBM_ERR "unable to create proc entry %s\n", ibm->name);
-               return -ENODEV;
-       }
-       entry->owner = THIS_MODULE;
-       ibm->proc_created = 1;
-       
-       entry->data = ibm;
-       if (ibm->read)
+       if (ibm->read) {
+               entry = create_proc_entry(ibm->name,
+                                         S_IFREG | S_IRUGO | S_IWUSR,
+                                         proc_dir);
+               if (!entry) {
+                       printk(IBM_ERR "unable to create proc entry %s\n",
+                              ibm->name);
+                       return -ENODEV;
+               }
+               entry->owner = THIS_MODULE;
+               entry->data = ibm;
                entry->read_proc = &dispatch_read;
-       if (ibm->write)
-               entry->write_proc = &dispatch_write;
+               if (ibm->write)
+                       entry->write_proc = &dispatch_write;
+               ibm->proc_created = 1;
+       }
 
        if (ibm->notify) {
                ret = setup_notify(ibm);
                if (ret < 0)
                        return ret;
+               ibm->notify_installed = 1;
        }
 
        return 0;
@@ -1111,7 +1827,7 @@ static void ibm_exit(struct ibm_struct *ibm)
                remove_proc_entry(ibm->name, proc_dir);
 
        if (ibm->init_called && ibm->exit)
-               ibm->exit(ibm);
+               ibm->exit();
 
        if (ibm->driver_registered) {
                acpi_bus_unregister_driver(ibm->driver);
@@ -1119,60 +1835,66 @@ static void ibm_exit(struct ibm_struct *ibm)
        }
 }
 
-static int ibm_handle_init(char *name,
-                          acpi_handle *handle, acpi_handle parent,
-                          char **paths, int num_paths, int required)
+static void __init ibm_handle_init(char *name,
+                                  acpi_handle * handle, acpi_handle parent,
+                                  char **paths, int num_paths, char **path)
 {
        int i;
        acpi_status status;
 
-       for (i=0; i<num_paths; i++) {
+       for (i = 0; i < num_paths; i++) {
                status = acpi_get_handle(parent, paths[i], handle);
-               if (ACPI_SUCCESS(status))
-                       return 0;
-       }
-       
-       *handle = NULL;
-
-       if (required) {
-               printk(IBM_ERR "%s object not found\n", name);
-               return -1;
+               if (ACPI_SUCCESS(status)) {
+                       *path = paths[i];
+                       return;
+               }
        }
 
-       return 0;
+       *handle = NULL;
 }
 
-#define IBM_HANDLE_INIT(object, required)                              \
+#define IBM_HANDLE_INIT(object)                                                \
        ibm_handle_init(#object, &object##_handle, *object##_parent,    \
-               object##_paths, sizeof(object##_paths)/sizeof(char*), required)
-
+               object##_paths, ARRAY_SIZE(object##_paths), &object##_path)
 
 static int set_ibm_param(const char *val, struct kernel_param *kp)
 {
        unsigned int i;
-       char arg_with_comma[32];
-
-       if (strlen(val) > 30)
-               return -ENOSPC;
 
-       strcpy(arg_with_comma, val);
-       strcat(arg_with_comma, ",");
+       for (i = 0; i < ARRAY_SIZE(ibms); i++)
+               if (strcmp(ibms[i].name, kp->name) == 0 && ibms[i].write) {
+                       if (strlen(val) > sizeof(ibms[i].param) - 2)
+                               return -ENOSPC;
+                       strcpy(ibms[i].param, val);
+                       strcat(ibms[i].param, ",");
+                       return 0;
+               }
 
-       for (i=0; i<NUM_IBMS; i++)
-               if (strcmp(ibms[i].name, kp->name) == 0)
-                       return ibms[i].write(&ibms[i], arg_with_comma);
-       BUG();
        return -EINVAL;
 }
 
 #define IBM_PARAM(feature) \
        module_param_call(feature, set_ibm_param, NULL, NULL, 0)
 
+IBM_PARAM(hotkey);
+IBM_PARAM(bluetooth);
+IBM_PARAM(video);
+IBM_PARAM(light);
+IBM_PARAM(dock);
+IBM_PARAM(bay);
+IBM_PARAM(cmos);
+IBM_PARAM(led);
+IBM_PARAM(beep);
+IBM_PARAM(ecdump);
+IBM_PARAM(brightness);
+IBM_PARAM(volume);
+IBM_PARAM(fan);
+
 static void acpi_ibm_exit(void)
 {
        int i;
 
-       for (i=NUM_IBMS-1; i>=0; i--)
+       for (i = ARRAY_SIZE(ibms) - 1; i >= 0; i--)
                ibm_exit(&ibms[i]);
 
        remove_proc_entry(IBM_DIR, acpi_root_dir);
@@ -1185,30 +1907,40 @@ static int __init acpi_ibm_init(void)
        if (acpi_disabled)
                return -ENODEV;
 
-       if (!acpi_specific_hotkey_enabled){
-               printk(IBM_ERR "Using generic hotkey driver\n");
-               return -ENODEV; 
-       }
-       /* these handles are required */
-       if (IBM_HANDLE_INIT(ec,   1) < 0 ||
-           IBM_HANDLE_INIT(hkey, 1) < 0 ||
-           IBM_HANDLE_INIT(vid,  1) < 0 ||
-           IBM_HANDLE_INIT(beep, 1) < 0)
+       if (!acpi_specific_hotkey_enabled) {
+               printk(IBM_ERR "using generic hotkey driver\n");
                return -ENODEV;
+       }
 
-       /* these handles have alternatives */
-       IBM_HANDLE_INIT(lght, 0);
-       if (IBM_HANDLE_INIT(cmos, !lght_handle) < 0)
-               return -ENODEV;
-       IBM_HANDLE_INIT(sysl, 0);
-       if (IBM_HANDLE_INIT(led, !sysl_handle) < 0)
+       /* ec is required because many other handles are relative to it */
+       IBM_HANDLE_INIT(ec);
+       if (!ec_handle) {
+               printk(IBM_ERR "ec object not found\n");
                return -ENODEV;
+       }
 
        /* these handles are not required */
-       IBM_HANDLE_INIT(dock,  0);
-       IBM_HANDLE_INIT(bay,   0);
-       IBM_HANDLE_INIT(bayej, 0);
-       IBM_HANDLE_INIT(bled,  0);
+       IBM_HANDLE_INIT(vid);
+       IBM_HANDLE_INIT(vid2);
+       IBM_HANDLE_INIT(ledb);
+       IBM_HANDLE_INIT(led);
+       IBM_HANDLE_INIT(hkey);
+       IBM_HANDLE_INIT(lght);
+       IBM_HANDLE_INIT(cmos);
+       IBM_HANDLE_INIT(dock);
+       IBM_HANDLE_INIT(pci);
+       IBM_HANDLE_INIT(bay);
+       if (bay_handle)
+               IBM_HANDLE_INIT(bay_ej);
+       IBM_HANDLE_INIT(bay2);
+       if (bay2_handle)
+               IBM_HANDLE_INIT(bay2_ej);
+       IBM_HANDLE_INIT(beep);
+       IBM_HANDLE_INIT(ecrd);
+       IBM_HANDLE_INIT(ecwr);
+       IBM_HANDLE_INIT(fans);
+       IBM_HANDLE_INIT(gfan);
+       IBM_HANDLE_INIT(sfan);
 
        proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
        if (!proc_dir) {
@@ -1216,9 +1948,11 @@ static int __init acpi_ibm_init(void)
                return -ENODEV;
        }
        proc_dir->owner = THIS_MODULE;
-       
-       for (i=0; i<NUM_IBMS; i++) {
+
+       for (i = 0; i < ARRAY_SIZE(ibms); i++) {
                ret = ibm_init(&ibms[i]);
+               if (ret >= 0 && *ibms[i].param)
+                       ret = ibms[i].write(ibms[i].param);
                if (ret < 0) {
                        acpi_ibm_exit();
                        return ret;
@@ -1230,17 +1964,3 @@ static int __init acpi_ibm_init(void)
 
 module_init(acpi_ibm_init);
 module_exit(acpi_ibm_exit);
-
-MODULE_AUTHOR("Borislav Deianov");
-MODULE_DESCRIPTION(IBM_DESC);
-MODULE_LICENSE("GPL");
-
-IBM_PARAM(hotkey);
-IBM_PARAM(bluetooth);
-IBM_PARAM(video);
-IBM_PARAM(light);
-IBM_PARAM(dock);
-IBM_PARAM(bay);
-IBM_PARAM(cmos);
-IBM_PARAM(led);
-IBM_PARAM(beep);
index 61ea70742d4912863df0fe4a25f01c1a98d54829..e928e8c2c6ec90629aab15eeef143319c8c2462e 100644 (file)
 #include <acpi/acpi_drivers.h>
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("acpi_motherboard")
+ACPI_MODULE_NAME("acpi_motherboard")
 
 /* Dell use PNP0C01 instead of PNP0C02 */
 #define ACPI_MB_HID1                   "PNP0C01"
 #define ACPI_MB_HID2                   "PNP0C02"
-
 /**
  * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
  * Doesn't care about the failure of 'request_region', since other may reserve 
@@ -44,15 +43,12 @@ ACPI_MODULE_NAME            ("acpi_motherboard")
 #define IS_RESERVED_ADDR(base, len) \
        (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
        && ((base) + (len) > PCIBIOS_MIN_IO))
-
 /*
  * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
  * the io ports if they really know they can use it, while
  * still preventing hotplug PCI devices from using it. 
  */
-
-static acpi_status
-acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
+static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
 {
        struct resource *requested_res = NULL;
 
@@ -63,22 +59,32 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
 
                if (io_res->min_base_address != io_res->max_base_address)
                        return_VALUE(AE_OK);
-               if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
-                               io_res->min_base_address, 
-                               io_res->min_base_address + io_res->range_length));
-                       requested_res = request_region(io_res->min_base_address, 
-                               io_res->range_length, "motherboard");
+               if (IS_RESERVED_ADDR
+                   (io_res->min_base_address, io_res->range_length)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Motherboard resources 0x%08x - 0x%08x\n",
+                                         io_res->min_base_address,
+                                         io_res->min_base_address +
+                                         io_res->range_length));
+                       requested_res =
+                           request_region(io_res->min_base_address,
+                                          io_res->range_length, "motherboard");
                }
        } else if (res->id == ACPI_RSTYPE_FIXED_IO) {
-               struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
-
-               if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
-                               fixed_io_res->base_address, 
-                               fixed_io_res->base_address + fixed_io_res->range_length));
-                       requested_res = request_region(fixed_io_res->base_address, 
-                               fixed_io_res->range_length, "motherboard");
+               struct acpi_resource_fixed_io *fixed_io_res =
+                   &res->data.fixed_io;
+
+               if (IS_RESERVED_ADDR
+                   (fixed_io_res->base_address, fixed_io_res->range_length)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Motherboard resources 0x%08x - 0x%08x\n",
+                                         fixed_io_res->base_address,
+                                         fixed_io_res->base_address +
+                                         fixed_io_res->range_length));
+                       requested_res =
+                           request_region(fixed_io_res->base_address,
+                                          fixed_io_res->range_length,
+                                          "motherboard");
                }
        } else {
                /* Memory mapped IO? */
@@ -89,72 +95,70 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
        return_VALUE(AE_OK);
 }
 
-static int acpi_motherboard_add (struct acpi_device *device)
+static int acpi_motherboard_add(struct acpi_device *device)
 {
        if (!device)
                return -EINVAL;
-       acpi_walk_resources(device->handle, METHOD_NAME__CRS, 
-               acpi_reserve_io_ranges, NULL);
+       acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+                           acpi_reserve_io_ranges, NULL);
 
        return 0;
 }
 
 static struct acpi_driver acpi_motherboard_driver1 = {
-       .name =         "motherboard",
-       .class =        "",
-       .ids =          ACPI_MB_HID1,
-       .ops =  {
-               .add =          acpi_motherboard_add,
-       },
+       .name = "motherboard",
+       .class = "",
+       .ids = ACPI_MB_HID1,
+       .ops = {
+               .add = acpi_motherboard_add,
+               },
 };
 
 static struct acpi_driver acpi_motherboard_driver2 = {
-       .name =         "motherboard",
-       .class =        "",
-       .ids =          ACPI_MB_HID2,
-       .ops =  {
-               .add =          acpi_motherboard_add,
-       },
+       .name = "motherboard",
+       .class = "",
+       .ids = ACPI_MB_HID2,
+       .ops = {
+               .add = acpi_motherboard_add,
+               },
 };
 
-static void __init
-acpi_reserve_resources (void)
+static void __init acpi_reserve_resources(void)
 {
        if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
-               request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, 
-                       acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
+               request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
+                              acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
 
        if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
                request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
-                       acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
+                              acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
 
        if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-               request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, 
-                       acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
+               request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
+                              acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
 
        if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
-               request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, 
-                       acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
+               request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
+                              acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
 
        if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
-               request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
-                       4, "PM_TMR");
+               request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
 
        if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
                request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
-                       acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
+                              acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
 
        /* Length of GPE blocks must be a non-negative multiple of 2 */
 
        if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
-                       !(acpi_gbl_FADT->gpe0_blk_len & 0x1))
+           !(acpi_gbl_FADT->gpe0_blk_len & 0x1))
                request_region(acpi_gbl_FADT->xgpe0_blk.address,
-                       acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
+                              acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
 
        if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
-                       !(acpi_gbl_FADT->gpe1_blk_len & 0x1))
+           !(acpi_gbl_FADT->gpe1_blk_len & 0x1))
                request_region(acpi_gbl_FADT->xgpe1_blk.address,
-                       acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
+                              acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
 }
 
 static int __init acpi_motherboard_init(void)
@@ -166,7 +170,7 @@ static int __init acpi_motherboard_init(void)
         * This module must run after scan.c
         */
        if (!acpi_disabled)
-               acpi_reserve_resources ();
+               acpi_reserve_resources();
        return 0;
 }
 
index ece7a9dedd5c740a4b5f95c194538b7ec48513e5..edfbe34600f5178b66b9ec39f18c768eee2b1dfd 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsaccess")
-
+ACPI_MODULE_NAME("nsaccess")
 
 /*******************************************************************************
  *
  * MUTEX:       Locks namespace for entire execution
  *
  ******************************************************************************/
-
-acpi_status
-acpi_ns_root_initialize (
-       void)
+acpi_status acpi_ns_root_initialize(void)
 {
-       acpi_status                         status;
+       acpi_status status;
        const struct acpi_predefined_names *init_val = NULL;
-       struct acpi_namespace_node          *new_node;
-       union acpi_operand_object           *obj_desc;
-       acpi_string                         val = NULL;
-
-
-       ACPI_FUNCTION_TRACE ("ns_root_initialize");
+       struct acpi_namespace_node *new_node;
+       union acpi_operand_object *obj_desc;
+       acpi_string val = NULL;
 
+       ACPI_FUNCTION_TRACE("ns_root_initialize");
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -102,24 +94,26 @@ acpi_ns_root_initialize (
 
        /* Enter the pre-defined names in the name table */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Entering predefined entries into namespace\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Entering predefined entries into namespace\n"));
 
        for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
                /* _OSI is optional for now, will be permanent later */
 
-               if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) {
+               if (!ACPI_STRCMP(init_val->name, "_OSI")
+                   && !acpi_gbl_create_osi_method) {
                        continue;
                }
 
-               status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
-                                 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
-                                 NULL, &new_node);
+               status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
+                                       ACPI_IMODE_LOAD_PASS2,
+                                       ACPI_NS_NO_UPSEARCH, NULL, &new_node);
 
-               if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not create predefined name %s, %s\n",
-                               init_val->name, acpi_format_exception (status)));
+               if (ACPI_FAILURE(status) || (!new_node)) {      /* Must be on same line for code converter */
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not create predefined name %s, %s\n",
+                                         init_val->name,
+                                         acpi_format_exception(status)));
                }
 
                /*
@@ -128,11 +122,11 @@ acpi_ns_root_initialize (
                 * initial value, create the initial value.
                 */
                if (init_val->val) {
-                       status = acpi_os_predefined_override (init_val, &val);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Could not override predefined %s\n",
-                                       init_val->name));
+                       status = acpi_os_predefined_override(init_val, &val);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Could not override predefined %s\n",
+                                                 init_val->name));
                        }
 
                        if (!val) {
@@ -143,7 +137,8 @@ acpi_ns_root_initialize (
                         * Entry requests an initial value, allocate a
                         * descriptor for it.
                         */
-                       obj_desc = acpi_ut_create_internal_object (init_val->type);
+                       obj_desc =
+                           acpi_ut_create_internal_object(init_val->type);
                        if (!obj_desc) {
                                status = AE_NO_MEMORY;
                                goto unlock_and_exit;
@@ -156,55 +151,62 @@ acpi_ns_root_initialize (
                         */
                        switch (init_val->type) {
                        case ACPI_TYPE_METHOD:
-                               obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
+                               obj_desc->method.param_count =
+                                   (u8) ACPI_TO_INTEGER(val);
                                obj_desc->common.flags |= AOPOBJ_DATA_VALID;
 
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
+#if defined (ACPI_ASL_COMPILER)
 
-                               /*
-                                * i_aSL Compiler cheats by putting parameter count
-                                * in the owner_iD
-                                */
-                               new_node->owner_id = obj_desc->method.param_count;
+                               /* save the parameter count for the i_aSL compiler */
+
+                               new_node->value = obj_desc->method.param_count;
 #else
                                /* Mark this as a very SPECIAL method */
 
-                               obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
-                               obj_desc->method.implementation = acpi_ut_osi_implementation;
+                               obj_desc->method.method_flags =
+                                   AML_METHOD_INTERNAL_ONLY;
+
+#ifndef ACPI_DUMP_APP
+                               obj_desc->method.implementation =
+                                   acpi_ut_osi_implementation;
+#endif
 #endif
                                break;
 
                        case ACPI_TYPE_INTEGER:
 
-                               obj_desc->integer.value = ACPI_TO_INTEGER (val);
+                               obj_desc->integer.value = ACPI_TO_INTEGER(val);
                                break;
 
-
                        case ACPI_TYPE_STRING:
 
                                /*
                                 * Build an object around the static string
                                 */
-                               obj_desc->string.length = (u32) ACPI_STRLEN (val);
+                               obj_desc->string.length =
+                                   (u32) ACPI_STRLEN(val);
                                obj_desc->string.pointer = val;
                                obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
                                break;
 
-
                        case ACPI_TYPE_MUTEX:
 
                                obj_desc->mutex.node = new_node;
-                               obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1);
+                               obj_desc->mutex.sync_level =
+                                   (u8) (ACPI_TO_INTEGER(val) - 1);
 
-                               if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
+                               if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
                                        /*
                                         * Create a counting semaphore for the
                                         * global lock
                                         */
-                                       status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
-                                                        1, &obj_desc->mutex.semaphore);
-                                       if (ACPI_FAILURE (status)) {
-                                               acpi_ut_remove_reference (obj_desc);
+                                       status =
+                                           acpi_os_create_semaphore
+                                           (ACPI_NO_UNIT_LIMIT, 1,
+                                            &obj_desc->mutex.semaphore);
+                                       if (ACPI_FAILURE(status)) {
+                                               acpi_ut_remove_reference
+                                                   (obj_desc);
                                                goto unlock_and_exit;
                                        }
 
@@ -212,56 +214,58 @@ acpi_ns_root_initialize (
                                         * We just created the mutex for the
                                         * global lock, save it
                                         */
-                                       acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
-                               }
-                               else {
+                                       acpi_gbl_global_lock_semaphore =
+                                           obj_desc->mutex.semaphore;
+                               else {
                                        /* Create a mutex */
 
-                                       status = acpi_os_create_semaphore (1, 1,
-                                                          &obj_desc->mutex.semaphore);
-                                       if (ACPI_FAILURE (status)) {
-                                               acpi_ut_remove_reference (obj_desc);
+                                       status = acpi_os_create_semaphore(1, 1,
+                                                                         &obj_desc->
+                                                                         mutex.
+                                                                         semaphore);
+                                       if (ACPI_FAILURE(status)) {
+                                               acpi_ut_remove_reference
+                                                   (obj_desc);
                                                goto unlock_and_exit;
                                        }
                                }
                                break;
 
-
                        default:
 
-                               ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
-                                       init_val->type));
-                               acpi_ut_remove_reference (obj_desc);
+                               ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type));
+                               acpi_ut_remove_reference(obj_desc);
                                obj_desc = NULL;
                                continue;
                        }
 
                        /* Store pointer to value descriptor in the Node */
 
-                       status = acpi_ns_attach_object (new_node, obj_desc,
-                                        ACPI_GET_OBJECT_TYPE (obj_desc));
+                       status = acpi_ns_attach_object(new_node, obj_desc,
+                                                      ACPI_GET_OBJECT_TYPE
+                                                      (obj_desc));
 
                        /* Remove local reference to the object */
 
-                       acpi_ut_remove_reference (obj_desc);
+                       acpi_ut_remove_reference(obj_desc);
                }
        }
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
        /* Save a handle to "_GPE", it is always present */
 
-       if (ACPI_SUCCESS (status)) {
-               status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
-                                 &acpi_gbl_fadt_gpe_device);
+       if (ACPI_SUCCESS(status)) {
+               status =
+                   acpi_ns_get_node_by_path("\\_GPE", NULL,
+                                            ACPI_NS_NO_UPSEARCH,
+                                            &acpi_gbl_fadt_gpe_device);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_lookup
@@ -286,62 +290,57 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_ns_lookup (
-       union acpi_generic_state        *scope_info,
-       char                            *pathname,
-       acpi_object_type                type,
-       acpi_interpreter_mode           interpreter_mode,
-       u32                             flags,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      **return_node)
+acpi_ns_lookup(union acpi_generic_state *scope_info,
+              char *pathname,
+              acpi_object_type type,
+              acpi_interpreter_mode interpreter_mode,
+              u32 flags,
+              struct acpi_walk_state *walk_state,
+              struct acpi_namespace_node **return_node)
 {
-       acpi_status                     status;
-       char                            *path = pathname;
-       struct acpi_namespace_node      *prefix_node;
-       struct acpi_namespace_node      *current_node = NULL;
-       struct acpi_namespace_node      *this_node = NULL;
-       u32                             num_segments;
-       u32                             num_carats;
-       acpi_name                       simple_name;
-       acpi_object_type                type_to_check_for;
-       acpi_object_type                this_search_type;
-       u32                             search_parent_flag = ACPI_NS_SEARCH_PARENT;
-       u32                             local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
-                          ACPI_NS_SEARCH_PARENT);
-
-
-       ACPI_FUNCTION_TRACE ("ns_lookup");
-
+       acpi_status status;
+       char *path = pathname;
+       struct acpi_namespace_node *prefix_node;
+       struct acpi_namespace_node *current_node = NULL;
+       struct acpi_namespace_node *this_node = NULL;
+       u32 num_segments;
+       u32 num_carats;
+       acpi_name simple_name;
+       acpi_object_type type_to_check_for;
+       acpi_object_type this_search_type;
+       u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
+       u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
+                                   ACPI_NS_SEARCH_PARENT);
+
+       ACPI_FUNCTION_TRACE("ns_lookup");
 
        if (!return_node) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        acpi_gbl_ns_lookup_count++;
        *return_node = ACPI_ENTRY_NOT_FOUND;
 
        if (!acpi_gbl_root_node) {
-               return_ACPI_STATUS (AE_NO_NAMESPACE);
+               return_ACPI_STATUS(AE_NO_NAMESPACE);
        }
 
        /*
         * Get the prefix scope.
         * A null scope means use the root scope
         */
-       if ((!scope_info) ||
-               (!scope_info->scope.node)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                       "Null scope prefix, using root node (%p)\n",
-                       acpi_gbl_root_node));
+       if ((!scope_info) || (!scope_info->scope.node)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                 "Null scope prefix, using root node (%p)\n",
+                                 acpi_gbl_root_node));
 
                prefix_node = acpi_gbl_root_node;
-       }
-       else {
+       } else {
                prefix_node = scope_info->scope.node;
-               if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) {
-                       ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n",
-                                       prefix_node, acpi_ut_get_descriptor_name (prefix_node)));
-                       return_ACPI_STATUS (AE_AML_INTERNAL);
+               if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
+                   ACPI_DESC_TYPE_NAMED) {
+                       ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node)));
+                       return_ACPI_STATUS(AE_AML_INTERNAL);
                }
 
                /*
@@ -349,9 +348,9 @@ acpi_ns_lookup (
                 * Device/Method, etc.)  It could be a Package or other object node.
                 * Backup up the tree to find the containing scope node.
                 */
-               while (!acpi_ns_opens_scope (prefix_node->type) &&
-                               prefix_node->type != ACPI_TYPE_ANY) {
-                       prefix_node = acpi_ns_get_parent_node (prefix_node);
+               while (!acpi_ns_opens_scope(prefix_node->type) &&
+                      prefix_node->type != ACPI_TYPE_ANY) {
+                       prefix_node = acpi_ns_get_parent_node(prefix_node);
                }
        }
 
@@ -366,13 +365,13 @@ acpi_ns_lookup (
                /* A Null name_path is allowed and refers to the root */
 
                num_segments = 0;
-               this_node    = acpi_gbl_root_node;
-               path     = "";
+               this_node = acpi_gbl_root_node;
+               path = "";
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                       "Null Pathname (Zero segments), Flags=%X\n", flags));
-       }
-       else {
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                 "Null Pathname (Zero segments), Flags=%X\n",
+                                 flags));
+       else {
                /*
                 * Name pointer is valid (and must be in internal name format)
                 *
@@ -396,15 +395,16 @@ acpi_ns_lookup (
 
                        path++;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Path is absolute from root [%p]\n", this_node));
-               }
-               else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Path is absolute from root [%p]\n",
+                                         this_node));
+               else {
                        /* Pathname is relative to current scope, start there */
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Searching relative to prefix scope [%4.4s] (%p)\n",
-                               acpi_ut_get_node_name (prefix_node), prefix_node));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Searching relative to prefix scope [%4.4s] (%p)\n",
+                                         acpi_ut_get_node_name(prefix_node),
+                                         prefix_node));
 
                        /*
                         * Handle multiple Parent Prefixes (carat) by just getting
@@ -425,20 +425,20 @@ acpi_ns_lookup (
                                /* Backup to the parent node */
 
                                num_carats++;
-                               this_node = acpi_ns_get_parent_node (this_node);
+                               this_node = acpi_ns_get_parent_node(this_node);
                                if (!this_node) {
                                        /* Current scope has no parent scope */
 
-                                       ACPI_REPORT_ERROR (
-                                               ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
-                                       return_ACPI_STATUS (AE_NOT_FOUND);
+                                       ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+                                       return_ACPI_STATUS(AE_NOT_FOUND);
                                }
                        }
 
                        if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                                       "Search scope is [%4.4s], path has %d carat(s)\n",
-                                       acpi_ut_get_node_name (this_node), num_carats));
+                               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                                 "Search scope is [%4.4s], path has %d carat(s)\n",
+                                                 acpi_ut_get_node_name
+                                                 (this_node), num_carats));
                        }
                }
 
@@ -464,9 +464,9 @@ acpi_ns_lookup (
                        num_segments = 0;
                        type = this_node->type;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Prefix-only Pathname (Zero name segments), Flags=%X\n",
-                               flags));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Prefix-only Pathname (Zero name segments), Flags=%X\n",
+                                         flags));
                        break;
 
                case AML_DUAL_NAME_PREFIX:
@@ -480,8 +480,9 @@ acpi_ns_lookup (
                        num_segments = 2;
                        path++;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Dual Pathname (2 segments, Flags=%X)\n", flags));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Dual Pathname (2 segments, Flags=%X)\n",
+                                         flags));
                        break;
 
                case AML_MULTI_NAME_PREFIX_OP:
@@ -493,12 +494,12 @@ acpi_ns_lookup (
                        /* Extract segment count, point to first name segment */
 
                        path++;
-                       num_segments = (u32) (u8) *path;
+                       num_segments = (u32) (u8) * path;
                        path++;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Multi Pathname (%d Segments, Flags=%X) \n",
-                               num_segments, flags));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Multi Pathname (%d Segments, Flags=%X) \n",
+                                         num_segments, flags));
                        break;
 
                default:
@@ -508,15 +509,15 @@ acpi_ns_lookup (
                         */
                        num_segments = 1;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Simple Pathname (1 segment, Flags=%X)\n", flags));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Simple Pathname (1 segment, Flags=%X)\n",
+                                         flags));
                        break;
                }
 
-               ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path));
+               ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
        }
 
-
        /*
         * Search namespace for each segment of the name.  Loop through and
         * verify (or add to the namespace) each name segment.
@@ -540,7 +541,7 @@ acpi_ns_lookup (
                         * requested it AND we have a single, non-fully-qualified name_seg
                         */
                        if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
-                               (flags & ACPI_NS_SEARCH_PARENT)) {
+                           (flags & ACPI_NS_SEARCH_PARENT)) {
                                local_flags |= ACPI_NS_SEARCH_PARENT;
                        }
 
@@ -553,24 +554,28 @@ acpi_ns_lookup (
 
                /* Extract one ACPI name from the front of the pathname */
 
-               ACPI_MOVE_32_TO_32 (&simple_name, path);
+               ACPI_MOVE_32_TO_32(&simple_name, path);
 
                /* Try to find the single (4 character) ACPI name */
 
-               status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
-                                interpreter_mode, this_search_type, local_flags, &this_node);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ns_search_and_enter(simple_name, walk_state,
+                                            current_node, interpreter_mode,
+                                            this_search_type, local_flags,
+                                            &this_node);
+               if (ACPI_FAILURE(status)) {
                        if (status == AE_NOT_FOUND) {
                                /* Name not found in ACPI namespace */
 
-                               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                                       "Name [%4.4s] not found in scope [%4.4s] %p\n",
-                                       (char *) &simple_name, (char *) &current_node->name,
-                                       current_node));
+                               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                                 "Name [%4.4s] not found in scope [%4.4s] %p\n",
+                                                 (char *)&simple_name,
+                                                 (char *)&current_node->name,
+                                                 current_node));
                        }
 
                        *return_node = this_node;
-                       return_ACPI_STATUS (status);
+                       return_ACPI_STATUS(status);
                }
 
                /*
@@ -586,19 +591,16 @@ acpi_ns_lookup (
                 *
                 * Then we have a type mismatch.  Just warn and ignore it.
                 */
-               if ((num_segments       == 0)                               &&
-                       (type_to_check_for  != ACPI_TYPE_ANY)                   &&
-                       (type_to_check_for  != ACPI_TYPE_LOCAL_ALIAS)           &&
-                       (type_to_check_for  != ACPI_TYPE_LOCAL_METHOD_ALIAS)    &&
-                       (type_to_check_for  != ACPI_TYPE_LOCAL_SCOPE)           &&
-                       (this_node->type    != ACPI_TYPE_ANY)                   &&
-                       (this_node->type    != type_to_check_for)) {
+               if ((num_segments == 0) &&
+                   (type_to_check_for != ACPI_TYPE_ANY) &&
+                   (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
+                   (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
+                   (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
+                   (this_node->type != ACPI_TYPE_ANY) &&
+                   (this_node->type != type_to_check_for)) {
                        /* Complain about a type mismatch */
 
-                       ACPI_REPORT_WARNING (
-                               ("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
-                               (char *) &simple_name, acpi_ut_get_type_name (this_node->type),
-                               acpi_ut_get_type_name (type_to_check_for)));
+                       ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for)));
                }
 
                /*
@@ -624,15 +626,16 @@ acpi_ns_lookup (
                 * If entry is a type which opens a scope, push the new scope on the
                 * scope stack.
                 */
-               if (acpi_ns_opens_scope (type)) {
-                       status = acpi_ds_scope_stack_push (this_node, type, walk_state);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+               if (acpi_ns_opens_scope(type)) {
+                       status =
+                           acpi_ds_scope_stack_push(this_node, type,
+                                                    walk_state);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
        }
 
        *return_node = this_node;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index 5653a19d7172b7f1a6383e5adf6169d8005265bb..cc7a85f8cfe686004d29abd3c7e735367e021472 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsalloc")
+ACPI_MODULE_NAME("nsalloc")
 
 /* Local prototypes */
-
-static void
-acpi_ns_remove_reference (
-       struct acpi_namespace_node      *node);
-
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
 
 /*******************************************************************************
  *
@@ -68,31 +62,26 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_create_node (
-       u32                             name)
+struct acpi_namespace_node *acpi_ns_create_node(u32 name)
 {
-       struct acpi_namespace_node      *node;
-
+       struct acpi_namespace_node *node;
 
-       ACPI_FUNCTION_TRACE ("ns_create_node");
+       ACPI_FUNCTION_TRACE("ns_create_node");
 
-
-       node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node));
+       node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
        if (!node) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
+       ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
 
-       node->name.integer   = name;
+       node->name.integer = name;
        node->reference_count = 1;
-       ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
+       ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
 
-       return_PTR (node);
+       return_PTR(node);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_node
@@ -105,19 +94,15 @@ acpi_ns_create_node (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_node (
-       struct acpi_namespace_node      *node)
+void acpi_ns_delete_node(struct acpi_namespace_node *node)
 {
-       struct acpi_namespace_node      *parent_node;
-       struct acpi_namespace_node      *prev_node;
-       struct acpi_namespace_node      *next_node;
-
+       struct acpi_namespace_node *parent_node;
+       struct acpi_namespace_node *prev_node;
+       struct acpi_namespace_node *next_node;
 
-       ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node);
+       ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
 
-
-       parent_node = acpi_ns_get_parent_node (node);
+       parent_node = acpi_ns_get_parent_node(node);
 
        prev_node = NULL;
        next_node = parent_node->child;
@@ -136,32 +121,29 @@ acpi_ns_delete_node (
                if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
                        prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
                }
-       }
-       else {
+       } else {
                /* Node is first child (has no previous peer) */
 
                if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
                        /* No peers at all */
 
                        parent_node->child = NULL;
-               }
-               else {   /* Link peer list to parent */
+               } else {        /* Link peer list to parent */
 
                        parent_node->child = next_node->peer;
                }
        }
 
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+       ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
 
        /*
         * Detach an object if there is one then delete the node
         */
-       acpi_ns_detach_object (node);
-       ACPI_MEM_FREE (node);
+       acpi_ns_detach_object(node);
+       ACPI_MEM_FREE(node);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_install_node
@@ -176,30 +158,20 @@ acpi_ns_delete_node (
  * DESCRIPTION: Initialize a new namespace node and install it amongst
  *              its peers.
  *
- *              Note: Current namespace lookup is linear search.  However, the
- *              nodes are linked in alphabetical order to 1) put all reserved
- *              names (start with underscore) first, and to 2) make a readable
- *              namespace dump.
+ *              Note: Current namespace lookup is linear search. This appears
+ *              to be sufficient as namespace searches consume only a small
+ *              fraction of the execution time of the ACPI subsystem.
  *
  ******************************************************************************/
 
-void
-acpi_ns_install_node (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *parent_node,   /* Parent */
-       struct acpi_namespace_node      *node,          /* New Child*/
-       acpi_object_type                type)
+void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */
+                         struct acpi_namespace_node *node,     /* New Child */
+                         acpi_object_type type)
 {
-       u16                             owner_id = 0;
-       struct acpi_namespace_node      *child_node;
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-
-       struct acpi_namespace_node      *previous_child_node;
-#endif
-
-
-       ACPI_FUNCTION_TRACE ("ns_install_node");
+       acpi_owner_id owner_id = 0;
+       struct acpi_namespace_node *child_node;
 
+       ACPI_FUNCTION_TRACE("ns_install_node");
 
        /*
         * Get the owner ID from the Walk state
@@ -217,59 +189,7 @@ acpi_ns_install_node (
                parent_node->child = node;
                node->flags |= ANOBJ_END_OF_PEER_LIST;
                node->peer = parent_node;
-       }
-       else {
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-               /*
-                * Walk the list whilst searching for the correct
-                * alphabetic placement.
-                */
-               previous_child_node = NULL;
-               while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
-                                acpi_ut_get_node_name (node)) < 0) {
-                       if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
-                               /* Last peer;  Clear end-of-list flag */
-
-                               child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-
-                               /* This node is the new peer to the child node */
-
-                               child_node->peer = node;
-
-                               /* This node is the new end-of-list */
-
-                               node->flags |= ANOBJ_END_OF_PEER_LIST;
-                               node->peer = parent_node;
-                               break;
-                       }
-
-                       /* Get next peer */
-
-                       previous_child_node = child_node;
-                       child_node = child_node->peer;
-               }
-
-               /* Did the node get inserted at the end-of-list? */
-
-               if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
-                       /*
-                        * Loop above terminated without reaching the end-of-list.
-                        * Insert the new node at the current location
-                        */
-                       if (previous_child_node) {
-                               /* Insert node alphabetically */
-
-                               node->peer = child_node;
-                               previous_child_node->peer = node;
-                       }
-                       else {
-                               /* Insert node alphabetically at start of list */
-
-                               node->peer = child_node;
-                               parent_node->child = node;
-                       }
-               }
-#else
+       } else {
                while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
                        child_node = child_node->peer;
                }
@@ -279,9 +199,8 @@ acpi_ns_install_node (
                /* Clear end-of-list flag */
 
                child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-               node->flags     |= ANOBJ_END_OF_PEER_LIST;
+               node->flags |= ANOBJ_END_OF_PEER_LIST;
                node->peer = parent_node;
-#endif
        }
 
        /* Init the new entry */
@@ -289,24 +208,25 @@ acpi_ns_install_node (
        node->owner_id = owner_id;
        node->type = (u8) type;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-               "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
-               acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id,
-               acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type),
-               parent_node));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
+                         acpi_ut_get_node_name(node),
+                         acpi_ut_get_type_name(node->type), node, owner_id,
+                         acpi_ut_get_node_name(parent_node),
+                         acpi_ut_get_type_name(parent_node->type),
+                         parent_node));
 
        /*
         * Increment the reference count(s) of all parents up to
         * the root!
         */
-       while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+       while ((node = acpi_ns_get_parent_node(node)) != NULL) {
                node->reference_count++;
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_children
@@ -320,18 +240,14 @@ acpi_ns_install_node (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_children (
-       struct acpi_namespace_node      *parent_node)
+void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
 {
-       struct acpi_namespace_node      *child_node;
-       struct acpi_namespace_node      *next_node;
-       struct acpi_namespace_node      *node;
-       u8                              flags;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node);
+       struct acpi_namespace_node *child_node;
+       struct acpi_namespace_node *next_node;
+       struct acpi_namespace_node *node;
+       u8 flags;
 
+       ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
 
        if (!parent_node) {
                return_VOID;
@@ -350,48 +266,48 @@ acpi_ns_delete_children (
        do {
                /* Get the things we need */
 
-               next_node   = child_node->peer;
-               flags       = child_node->flags;
+               next_node = child_node->peer;
+               flags = child_node->flags;
 
                /* Grandchildren should have all been deleted already */
 
                if (child_node->child) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
-                               parent_node, child_node));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Found a grandchild! P=%p C=%p\n",
+                                         parent_node, child_node));
                }
 
                /* Now we can free this child object */
 
-               ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+               ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
-                       child_node, acpi_gbl_current_node_count));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "Object %p, Remaining %X\n", child_node,
+                                 acpi_gbl_current_node_count));
 
                /*
                 * Detach an object if there is one, then free the child node
                 */
-               acpi_ns_detach_object (child_node);
+               acpi_ns_detach_object(child_node);
 
                /*
                 * Decrement the reference count(s) of all parents up to
                 * the root! (counts were incremented when the node was created)
                 */
                node = child_node;
-               while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+               while ((node = acpi_ns_get_parent_node(node)) != NULL) {
                        node->reference_count--;
                }
 
                /* There should be only one reference remaining on this node */
 
                if (child_node->reference_count != 1) {
-                       ACPI_REPORT_WARNING ((
-                               "Existing references (%d) on node being deleted (%p)\n",
-                               child_node->reference_count, child_node));
+                       ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node));
                }
 
                /* Now we can delete the node */
 
-               ACPI_MEM_FREE (child_node);
+               ACPI_MEM_FREE(child_node);
 
                /* And move on to the next child in the list */
 
@@ -399,7 +315,6 @@ acpi_ns_delete_children (
 
        } while (!(flags & ANOBJ_END_OF_PEER_LIST));
 
-
        /* Clear the parent's child pointer */
 
        parent_node->child = NULL;
@@ -407,7 +322,6 @@ acpi_ns_delete_children (
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_namespace_subtree
@@ -421,16 +335,12 @@ acpi_ns_delete_children (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_namespace_subtree (
-       struct acpi_namespace_node      *parent_node)
+void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
 {
-       struct acpi_namespace_node      *child_node = NULL;
-       u32                             level = 1;
-
-
-       ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree");
+       struct acpi_namespace_node *child_node = NULL;
+       u32 level = 1;
 
+       ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
 
        if (!parent_node) {
                return_VOID;
@@ -443,16 +353,17 @@ acpi_ns_delete_namespace_subtree (
        while (level > 0) {
                /* Get the next node in this scope (NULL if none) */
 
-               child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
-                                child_node);
+               child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+                                                  child_node);
                if (child_node) {
                        /* Found a child node - detach any attached object */
 
-                       acpi_ns_detach_object (child_node);
+                       acpi_ns_detach_object(child_node);
 
                        /* Check if this node has any children */
 
-                       if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+                       if (acpi_ns_get_next_node
+                           (ACPI_TYPE_ANY, child_node, NULL)) {
                                /*
                                 * There is at least one child of this node,
                                 * visit the node
@@ -461,8 +372,7 @@ acpi_ns_delete_namespace_subtree (
                                parent_node = child_node;
                                child_node = NULL;
                        }
-               }
-               else {
+               } else {
                        /*
                         * No more children of this parent node.
                         * Move up to the grandparent.
@@ -473,7 +383,7 @@ acpi_ns_delete_namespace_subtree (
                         * Now delete all of the children of this parent
                         * all at the same time.
                         */
-                       acpi_ns_delete_children (parent_node);
+                       acpi_ns_delete_children(parent_node);
 
                        /* New "last child" is this parent node */
 
@@ -481,14 +391,13 @@ acpi_ns_delete_namespace_subtree (
 
                        /* Move up the tree to the grandparent */
 
-                       parent_node = acpi_ns_get_parent_node (parent_node);
+                       parent_node = acpi_ns_get_parent_node(parent_node);
                }
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_remove_reference
@@ -504,16 +413,12 @@ acpi_ns_delete_namespace_subtree (
  *
  ******************************************************************************/
 
-static void
-acpi_ns_remove_reference (
-       struct acpi_namespace_node      *node)
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
 {
-       struct acpi_namespace_node      *parent_node;
-       struct acpi_namespace_node      *this_node;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_namespace_node *parent_node;
+       struct acpi_namespace_node *this_node;
 
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * Decrement the reference count(s) of this node and all
@@ -523,7 +428,7 @@ acpi_ns_remove_reference (
        while (this_node) {
                /* Prepare to move up to parent */
 
-               parent_node = acpi_ns_get_parent_node (this_node);
+               parent_node = acpi_ns_get_parent_node(this_node);
 
                /* Decrement the reference count on this node */
 
@@ -534,15 +439,14 @@ acpi_ns_remove_reference (
                if (!this_node->reference_count) {
                        /* Delete all children and delete the node */
 
-                       acpi_ns_delete_children (this_node);
-                       acpi_ns_delete_node (this_node);
+                       acpi_ns_delete_children(this_node);
+                       acpi_ns_delete_node(this_node);
                }
 
                this_node = parent_node;
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_delete_namespace_by_owner
@@ -557,23 +461,23 @@ acpi_ns_remove_reference (
  *
  ******************************************************************************/
 
-void
-acpi_ns_delete_namespace_by_owner (
-       u16                             owner_id)
+void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
 {
-       struct acpi_namespace_node      *child_node;
-       struct acpi_namespace_node      *deletion_node;
-       u32                             level;
-       struct acpi_namespace_node      *parent_node;
-
+       struct acpi_namespace_node *child_node;
+       struct acpi_namespace_node *deletion_node;
+       u32 level;
+       struct acpi_namespace_node *parent_node;
 
-       ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
+       ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
 
+       if (owner_id == 0) {
+               return_VOID;
+       }
 
-       parent_node   = acpi_gbl_root_node;
-       child_node    = NULL;
+       parent_node = acpi_gbl_root_node;
+       child_node = NULL;
        deletion_node = NULL;
-       level         = 1;
+       level = 1;
 
        /*
         * Traverse the tree of nodes until we bubble back up
@@ -584,10 +488,12 @@ acpi_ns_delete_namespace_by_owner (
                 * Get the next child of this parent node. When child_node is NULL,
                 * the first child of the parent is returned
                 */
-               child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+               child_node =
+                   acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+                                         child_node);
 
                if (deletion_node) {
-                       acpi_ns_remove_reference (deletion_node);
+                       acpi_ns_remove_reference(deletion_node);
                        deletion_node = NULL;
                }
 
@@ -595,12 +501,13 @@ acpi_ns_delete_namespace_by_owner (
                        if (child_node->owner_id == owner_id) {
                                /* Found a matching child node - detach any attached object */
 
-                               acpi_ns_detach_object (child_node);
+                               acpi_ns_detach_object(child_node);
                        }
 
                        /* Check if this node has any children */
 
-                       if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+                       if (acpi_ns_get_next_node
+                           (ACPI_TYPE_ANY, child_node, NULL)) {
                                /*
                                 * There is at least one child of this node,
                                 * visit the node
@@ -608,12 +515,10 @@ acpi_ns_delete_namespace_by_owner (
                                level++;
                                parent_node = child_node;
                                child_node = NULL;
-                       }
-                       else if (child_node->owner_id == owner_id) {
+                       } else if (child_node->owner_id == owner_id) {
                                deletion_node = child_node;
                        }
-               }
-               else {
+               } else {
                        /*
                         * No more children of this parent node.
                         * Move up to the grandparent.
@@ -631,62 +536,9 @@ acpi_ns_delete_namespace_by_owner (
 
                        /* Move up the tree to the grandparent */
 
-                       parent_node = acpi_ns_get_parent_node (parent_node);
+                       parent_node = acpi_ns_get_parent_node(parent_node);
                }
        }
 
        return_VOID;
 }
-
-
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_compare_names
- *
- * PARAMETERS:  Name1           - First name to compare
- *              Name2           - Second name to compare
- *
- * RETURN:      value from strncmp
- *
- * DESCRIPTION: Compare two ACPI names.  Names that are prefixed with an
- *              underscore are forced to be alphabetically first.
- *
- ******************************************************************************/
-
-int
-acpi_ns_compare_names (
-       char                            *name1,
-       char                            *name2)
-{
-       char                            reversed_name1[ACPI_NAME_SIZE];
-       char                            reversed_name2[ACPI_NAME_SIZE];
-       u32                             i;
-       u32                             j;
-
-
-       /*
-        * Replace all instances of "underscore" with a value that is smaller so
-        * that all names that are prefixed with underscore(s) are alphabetically
-        * first.
-        *
-        * Reverse the name bytewise so we can just do a 32-bit compare instead
-        * of a strncmp.
-        */
-       for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
-               reversed_name1[j] = name1[i];
-               if (name1[i] == '_') {
-                       reversed_name1[j] = '*';
-               }
-
-               reversed_name2[j] = name2[i];
-               if (name2[i] == '_') {
-                       reversed_name2[j] = '*';
-               }
-       }
-
-       return (*(int *) reversed_name1 - *(int *) reversed_name2);
-}
-#endif
-
-
index 6c2aef0e0dd4d47b8f451c487d7c83777a1f8cc8..9faf1d5c86ed8179ecdd7210df20f81d22b11d2a 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsdump")
+ACPI_MODULE_NAME("nsdump")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-void
-acpi_ns_dump_root_devices (
-       void);
+void acpi_ns_dump_root_devices(void);
 
 static acpi_status
-acpi_ns_dump_one_device (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value);
 #endif
 
-
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*******************************************************************************
  *
@@ -80,36 +71,38 @@ acpi_ns_dump_one_device (
  *
  ******************************************************************************/
 
-void
-acpi_ns_print_pathname (
-       u32                             num_segments,
-       char                            *pathname)
+void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 {
-       ACPI_FUNCTION_NAME ("ns_print_pathname");
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_NAME("ns_print_pathname");
 
-       if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
+       if (!(acpi_dbg_level & ACPI_LV_NAMES)
+           || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
                return;
        }
 
        /* Print the entire name */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "["));
 
        while (num_segments) {
-               acpi_os_printf ("%4.4s", pathname);
-               pathname += ACPI_NAME_SIZE;
+               for (i = 0; i < 4; i++) {
+                       ACPI_IS_PRINT(pathname[i]) ?
+                           acpi_os_printf("%c", pathname[i]) :
+                           acpi_os_printf("?");
+               }
 
+               pathname += ACPI_NAME_SIZE;
                num_segments--;
                if (num_segments) {
-                       acpi_os_printf (".");
+                       acpi_os_printf(".");
                }
        }
 
-       acpi_os_printf ("]\n");
+       acpi_os_printf("]\n");
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_pathname
@@ -127,15 +120,10 @@ acpi_ns_print_pathname (
  ******************************************************************************/
 
 void
-acpi_ns_dump_pathname (
-       acpi_handle                     handle,
-       char                            *msg,
-       u32                             level,
-       u32                             component)
+acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
 {
 
-       ACPI_FUNCTION_TRACE ("ns_dump_pathname");
-
+       ACPI_FUNCTION_TRACE("ns_dump_pathname");
 
        /* Do this only if the requested debug level and component are enabled */
 
@@ -145,12 +133,11 @@ acpi_ns_dump_pathname (
 
        /* Convert handle to a full pathname and print it (with supplied message) */
 
-       acpi_ns_print_node_pathname (handle, msg);
-       acpi_os_printf ("\n");
+       acpi_ns_print_node_pathname(handle, msg);
+       acpi_os_printf("\n");
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_one_object
@@ -168,24 +155,19 @@ acpi_ns_dump_pathname (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_dump_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_dump_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value)
 {
-       struct acpi_walk_info           *info = (struct acpi_walk_info *) context;
-       struct acpi_namespace_node      *this_node;
-       union acpi_operand_object       *obj_desc = NULL;
-       acpi_object_type                obj_type;
-       acpi_object_type                type;
-       u32                             bytes_to_dump;
-       u32                             dbg_level;
-       u32                             i;
-
-
-       ACPI_FUNCTION_NAME ("ns_dump_one_object");
+       struct acpi_walk_info *info = (struct acpi_walk_info *)context;
+       struct acpi_namespace_node *this_node;
+       union acpi_operand_object *obj_desc = NULL;
+       acpi_object_type obj_type;
+       acpi_object_type type;
+       u32 bytes_to_dump;
+       u32 dbg_level;
+       u32 i;
 
+       ACPI_FUNCTION_NAME("ns_dump_one_object");
 
        /* Is output enabled? */
 
@@ -194,193 +176,215 @@ acpi_ns_dump_one_object (
        }
 
        if (!obj_handle) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n"));
                return (AE_OK);
        }
 
-       this_node = acpi_ns_map_handle_to_node (obj_handle);
+       this_node = acpi_ns_map_handle_to_node(obj_handle);
        type = this_node->type;
 
        /* Check if the owner matches */
 
-       if ((info->owner_id != ACPI_UINT32_MAX) &&
-               (info->owner_id != this_node->owner_id)) {
+       if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
+           (info->owner_id != this_node->owner_id)) {
                return (AE_OK);
        }
 
-       /* Indent the object according to the level */
+       if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
+               /* Indent the object according to the level */
 
-       acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
+               acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
 
-       /* Check the node type and name */
+               /* Check the node type and name */
 
-       if (type > ACPI_TYPE_LOCAL_MAX) {
-               ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
-       }
+               if (type > ACPI_TYPE_LOCAL_MAX) {
+                       ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type));
+               }
+
+               if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
+                       ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n",
+                                            this_node->name.integer));
+               }
 
-       if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
-               ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
-                       this_node->name.integer));
+               acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
        }
 
        /*
         * Now we can print out the pertinent information
         */
-       acpi_os_printf ("%4.4s %-12s %p ",
-                       acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node);
+       acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node);
 
        dbg_level = acpi_dbg_level;
        acpi_dbg_level = 0;
-       obj_desc = acpi_ns_get_attached_object (this_node);
+       obj_desc = acpi_ns_get_attached_object(this_node);
        acpi_dbg_level = dbg_level;
 
-       switch (info->display_type) {
+       switch (info->display_type & ACPI_DISPLAY_MASK) {
        case ACPI_DISPLAY_SUMMARY:
 
                if (!obj_desc) {
                        /* No attached object, we are done */
 
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                        return (AE_OK);
                }
 
                switch (type) {
                case ACPI_TYPE_PROCESSOR:
 
-                       acpi_os_printf ("ID %X Len %.4X Addr %p\n",
-                               obj_desc->processor.proc_id, obj_desc->processor.length,
-                               (char *) obj_desc->processor.address);
+                       acpi_os_printf("ID %X Len %.4X Addr %p\n",
+                                      obj_desc->processor.proc_id,
+                                      obj_desc->processor.length,
+                                      (char *)obj_desc->processor.address);
                        break;
 
-
                case ACPI_TYPE_DEVICE:
 
-                       acpi_os_printf ("Notify Object: %p\n", obj_desc);
+                       acpi_os_printf("Notify Object: %p\n", obj_desc);
                        break;
 
-
                case ACPI_TYPE_METHOD:
 
-                       acpi_os_printf ("Args %X Len %.4X Aml %p\n",
-                               (u32) obj_desc->method.param_count,
-                               obj_desc->method.aml_length, obj_desc->method.aml_start);
+                       acpi_os_printf("Args %X Len %.4X Aml %p\n",
+                                      (u32) obj_desc->method.param_count,
+                                      obj_desc->method.aml_length,
+                                      obj_desc->method.aml_start);
                        break;
 
-
                case ACPI_TYPE_INTEGER:
 
-                       acpi_os_printf ("= %8.8X%8.8X\n",
-                               ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+                       acpi_os_printf("= %8.8X%8.8X\n",
+                                      ACPI_FORMAT_UINT64(obj_desc->integer.
+                                                         value));
                        break;
 
-
                case ACPI_TYPE_PACKAGE:
 
                        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-                               acpi_os_printf ("Elements %.2X\n",
-                                       obj_desc->package.count);
-                       }
-                       else {
-                               acpi_os_printf ("[Length not yet evaluated]\n");
+                               acpi_os_printf("Elements %.2X\n",
+                                              obj_desc->package.count);
+                       } else {
+                               acpi_os_printf("[Length not yet evaluated]\n");
                        }
                        break;
 
-
                case ACPI_TYPE_BUFFER:
 
                        if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
-                               acpi_os_printf ("Len %.2X",
-                                                obj_desc->buffer.length);
+                               acpi_os_printf("Len %.2X",
+                                              obj_desc->buffer.length);
 
                                /* Dump some of the buffer */
 
                                if (obj_desc->buffer.length > 0) {
-                                       acpi_os_printf (" =");
-                                       for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
-                                               acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
+                                       acpi_os_printf(" =");
+                                       for (i = 0;
+                                            (i < obj_desc->buffer.length
+                                             && i < 12); i++) {
+                                               acpi_os_printf(" %.2hX",
+                                                              obj_desc->buffer.
+                                                              pointer[i]);
                                        }
                                }
-                               acpi_os_printf ("\n");
-                       }
-                       else {
-                               acpi_os_printf ("[Length not yet evaluated]\n");
+                               acpi_os_printf("\n");
+                       } else {
+                               acpi_os_printf("[Length not yet evaluated]\n");
                        }
                        break;
 
-
                case ACPI_TYPE_STRING:
 
-                       acpi_os_printf ("Len %.2X ", obj_desc->string.length);
-                       acpi_ut_print_string (obj_desc->string.pointer, 32);
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("Len %.2X ", obj_desc->string.length);
+                       acpi_ut_print_string(obj_desc->string.pointer, 32);
+                       acpi_os_printf("\n");
                        break;
 
-
                case ACPI_TYPE_REGION:
 
-                       acpi_os_printf ("[%s]",
-                               acpi_ut_get_region_name (obj_desc->region.space_id));
+                       acpi_os_printf("[%s]",
+                                      acpi_ut_get_region_name(obj_desc->region.
+                                                              space_id));
                        if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
-                               acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
-                                       ACPI_FORMAT_UINT64 (obj_desc->region.address),
-                                       obj_desc->region.length);
-                       }
-                       else {
-                               acpi_os_printf (" [Address/Length not yet evaluated]\n");
+                               acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
+                                              ACPI_FORMAT_UINT64(obj_desc->
+                                                                 region.
+                                                                 address),
+                                              obj_desc->region.length);
+                       } else {
+                               acpi_os_printf
+                                   (" [Address/Length not yet evaluated]\n");
                        }
                        break;
 
-
                case ACPI_TYPE_LOCAL_REFERENCE:
 
-                       acpi_os_printf ("[%s]\n",
-                               acpi_ps_get_opcode_name (obj_desc->reference.opcode));
+                       acpi_os_printf("[%s]\n",
+                                      acpi_ps_get_opcode_name(obj_desc->
+                                                              reference.
+                                                              opcode));
                        break;
 
-
                case ACPI_TYPE_BUFFER_FIELD:
 
                        if (obj_desc->buffer_field.buffer_obj &&
-                               obj_desc->buffer_field.buffer_obj->buffer.node) {
-                               acpi_os_printf ("Buf [%4.4s]",
-                                       acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
+                           obj_desc->buffer_field.buffer_obj->buffer.node) {
+                               acpi_os_printf("Buf [%4.4s]",
+                                              acpi_ut_get_node_name(obj_desc->
+                                                                    buffer_field.
+                                                                    buffer_obj->
+                                                                    buffer.
+                                                                    node));
                        }
                        break;
 
-
                case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-                       acpi_os_printf ("Rgn [%4.4s]",
-                               acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
+                       acpi_os_printf("Rgn [%4.4s]",
+                                      acpi_ut_get_node_name(obj_desc->
+                                                            common_field.
+                                                            region_obj->region.
+                                                            node));
                        break;
 
-
                case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-                       acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
-                               acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
-                               acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
+                       acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]",
+                                      acpi_ut_get_node_name(obj_desc->
+                                                            common_field.
+                                                            region_obj->region.
+                                                            node),
+                                      acpi_ut_get_node_name(obj_desc->
+                                                            bank_field.
+                                                            bank_obj->
+                                                            common_field.
+                                                            node));
                        break;
 
-
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-                       acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
-                               acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
-                               acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
+                       acpi_os_printf("Idx [%4.4s] Dat [%4.4s]",
+                                      acpi_ut_get_node_name(obj_desc->
+                                                            index_field.
+                                                            index_obj->
+                                                            common_field.node),
+                                      acpi_ut_get_node_name(obj_desc->
+                                                            index_field.
+                                                            data_obj->
+                                                            common_field.
+                                                            node));
                        break;
 
-
                case ACPI_TYPE_LOCAL_ALIAS:
                case ACPI_TYPE_LOCAL_METHOD_ALIAS:
 
-                       acpi_os_printf ("Target %4.4s (%p)\n",
-                               acpi_ut_get_node_name (obj_desc), obj_desc);
+                       acpi_os_printf("Target %4.4s (%p)\n",
+                                      acpi_ut_get_node_name(obj_desc),
+                                      obj_desc);
                        break;
 
                default:
 
-                       acpi_os_printf ("Object %p\n", obj_desc);
+                       acpi_os_printf("Object %p\n", obj_desc);
                        break;
                }
 
@@ -392,11 +396,15 @@ acpi_ns_dump_one_object (
                case ACPI_TYPE_LOCAL_BANK_FIELD:
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-                       acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
-                               (obj_desc->common_field.base_byte_offset * 8)
-                                       + obj_desc->common_field.start_field_bit_offset,
-                               obj_desc->common_field.bit_length,
-                               obj_desc->common_field.access_byte_width);
+                       acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n",
+                                      (obj_desc->common_field.
+                                       base_byte_offset * 8)
+                                      +
+                                      obj_desc->common_field.
+                                      start_field_bit_offset,
+                                      obj_desc->common_field.bit_length,
+                                      obj_desc->common_field.
+                                      access_byte_width);
                        break;
 
                default:
@@ -404,56 +412,55 @@ acpi_ns_dump_one_object (
                }
                break;
 
-
        case ACPI_DISPLAY_OBJECTS:
 
-               acpi_os_printf ("O:%p", obj_desc);
+               acpi_os_printf("O:%p", obj_desc);
                if (!obj_desc) {
                        /* No attached object, we are done */
 
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                        return (AE_OK);
                }
 
-               acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
+               acpi_os_printf("(R%d)", obj_desc->common.reference_count);
 
                switch (type) {
                case ACPI_TYPE_METHOD:
 
                        /* Name is a Method and its AML offset/length are set */
 
-                       acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start,
-                                         obj_desc->method.aml_length);
+                       acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start,
+                                      obj_desc->method.aml_length);
                        break;
 
                case ACPI_TYPE_INTEGER:
 
-                       acpi_os_printf (" I:%8.8X8.8%X\n",
-                                       ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+                       acpi_os_printf(" I:%8.8X8.8%X\n",
+                                      ACPI_FORMAT_UINT64(obj_desc->integer.
+                                                         value));
                        break;
 
                case ACPI_TYPE_STRING:
 
-                       acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer,
-                                         obj_desc->string.length);
+                       acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer,
+                                      obj_desc->string.length);
                        break;
 
                case ACPI_TYPE_BUFFER:
 
-                       acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer,
-                                         obj_desc->buffer.length);
+                       acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer,
+                                      obj_desc->buffer.length);
                        break;
 
                default:
 
-                       acpi_os_printf ("\n");
+                       acpi_os_printf("\n");
                        break;
                }
                break;
 
-
        default:
-               acpi_os_printf ("\n");
+               acpi_os_printf("\n");
                break;
        }
 
@@ -463,61 +470,58 @@ acpi_ns_dump_one_object (
                return (AE_OK);
        }
 
-
        /* If there is an attached object, display it */
 
-       dbg_level    = acpi_dbg_level;
+       dbg_level = acpi_dbg_level;
        acpi_dbg_level = 0;
-       obj_desc     = acpi_ns_get_attached_object (this_node);
+       obj_desc = acpi_ns_get_attached_object(this_node);
        acpi_dbg_level = dbg_level;
 
        /* Dump attached objects */
 
        while (obj_desc) {
                obj_type = ACPI_TYPE_INVALID;
-               acpi_os_printf ("      Attached Object %p: ", obj_desc);
+               acpi_os_printf("Attached Object %p: ", obj_desc);
 
                /* Decode the type of attached object and dump the contents */
 
-               switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+               switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
                case ACPI_DESC_TYPE_NAMED:
 
-                       acpi_os_printf ("(Ptr to Node)\n");
-                       bytes_to_dump = sizeof (struct acpi_namespace_node);
+                       acpi_os_printf("(Ptr to Node)\n");
+                       bytes_to_dump = sizeof(struct acpi_namespace_node);
+                       ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
                        break;
 
-
                case ACPI_DESC_TYPE_OPERAND:
 
-                       obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
+                       obj_type = ACPI_GET_OBJECT_TYPE(obj_desc);
 
                        if (obj_type > ACPI_TYPE_LOCAL_MAX) {
-                               acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
-                                       obj_type);
+                               acpi_os_printf
+                                   ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
+                                    obj_type);
                                bytes_to_dump = 32;
+                       } else {
+                               acpi_os_printf
+                                   ("(Ptr to ACPI Object type %X [%s])\n",
+                                    obj_type, acpi_ut_get_type_name(obj_type));
+                               bytes_to_dump =
+                                   sizeof(union acpi_operand_object);
                        }
-                       else {
-                               acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n",
-                                       acpi_ut_get_type_name (obj_type), obj_type);
-                               bytes_to_dump = sizeof (union acpi_operand_object);
-                       }
-                       break;
 
+                       ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
+                       break;
 
                default:
 
-                       acpi_os_printf (
-                               "(String or Buffer ptr - not an object descriptor) [%s]\n",
-                               acpi_ut_get_descriptor_name (obj_desc));
-                       bytes_to_dump = 16;
                        break;
                }
 
-               ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
-
                /* If value is NOT an internal object, we are done */
 
-               if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
+               if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
+                   ACPI_DESC_TYPE_OPERAND) {
                        goto cleanup;
                }
 
@@ -525,51 +529,56 @@ acpi_ns_dump_one_object (
                 * Valid object, get the pointer to next level, if any
                 */
                switch (obj_type) {
-               case ACPI_TYPE_STRING:
-                       obj_desc = (void *) obj_desc->string.pointer;
-                       break;
-
                case ACPI_TYPE_BUFFER:
-                       obj_desc = (void *) obj_desc->buffer.pointer;
-                       break;
+               case ACPI_TYPE_STRING:
+                       /*
+                        * NOTE: takes advantage of common fields between string/buffer
+                        */
+                       bytes_to_dump = obj_desc->string.length;
+                       obj_desc = (void *)obj_desc->string.pointer;
+                       acpi_os_printf("(Buffer/String pointer %p length %X)\n",
+                                      obj_desc, bytes_to_dump);
+                       ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
+                       goto cleanup;
 
                case ACPI_TYPE_BUFFER_FIELD:
-                       obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
+                       obj_desc =
+                           (union acpi_operand_object *)obj_desc->buffer_field.
+                           buffer_obj;
                        break;
 
                case ACPI_TYPE_PACKAGE:
-                       obj_desc = (void *) obj_desc->package.elements;
+                       obj_desc = (void *)obj_desc->package.elements;
                        break;
 
                case ACPI_TYPE_METHOD:
-                       obj_desc = (void *) obj_desc->method.aml_start;
+                       obj_desc = (void *)obj_desc->method.aml_start;
                        break;
 
                case ACPI_TYPE_LOCAL_REGION_FIELD:
-                       obj_desc = (void *) obj_desc->field.region_obj;
+                       obj_desc = (void *)obj_desc->field.region_obj;
                        break;
 
                case ACPI_TYPE_LOCAL_BANK_FIELD:
-                       obj_desc = (void *) obj_desc->bank_field.region_obj;
+                       obj_desc = (void *)obj_desc->bank_field.region_obj;
                        break;
 
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
-                       obj_desc = (void *) obj_desc->index_field.index_obj;
+                       obj_desc = (void *)obj_desc->index_field.index_obj;
                        break;
 
                default:
                        goto cleanup;
                }
 
-               obj_type = ACPI_TYPE_INVALID;  /* Terminate loop after next pass */
+               obj_type = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
        }
 
-cleanup:
-       acpi_os_printf ("\n");
+      cleanup:
+       acpi_os_printf("\n");
        return (AE_OK);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -591,29 +600,25 @@ cleanup:
  ******************************************************************************/
 
 void
-acpi_ns_dump_objects (
-       acpi_object_type                type,
-       u8                              display_type,
-       u32                             max_depth,
-       u32                             owner_id,
-       acpi_handle                     start_handle)
+acpi_ns_dump_objects(acpi_object_type type,
+                    u8 display_type,
+                    u32 max_depth,
+                    acpi_owner_id owner_id, acpi_handle start_handle)
 {
-       struct acpi_walk_info           info;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_walk_info info;
 
+       ACPI_FUNCTION_ENTRY();
 
        info.debug_level = ACPI_LV_TABLES;
        info.owner_id = owner_id;
        info.display_type = display_type;
 
-       (void) acpi_ns_walk_namespace (type, start_handle, max_depth,
-                        ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
-                        (void *) &info, NULL);
+       (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
+                                    ACPI_NS_WALK_NO_UNLOCK,
+                                    acpi_ns_dump_one_object, (void *)&info,
+                                    NULL);
 }
-#endif /* ACPI_FUTURE_USAGE */
-
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*******************************************************************************
  *
@@ -628,26 +633,20 @@ acpi_ns_dump_objects (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_entry (
-       acpi_handle                     handle,
-       u32                             debug_level)
+void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
 {
-       struct acpi_walk_info           info;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_walk_info info;
 
+       ACPI_FUNCTION_ENTRY();
 
        info.debug_level = debug_level;
-       info.owner_id = ACPI_UINT32_MAX;
+       info.owner_id = ACPI_OWNER_ID_MAX;
        info.display_type = ACPI_DISPLAY_SUMMARY;
 
-       (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
+       (void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
 }
 
-
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_tables
@@ -663,23 +662,19 @@ acpi_ns_dump_entry (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_tables (
-       acpi_handle                     search_base,
-       u32                             max_depth)
+void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
 {
-       acpi_handle                     search_handle = search_base;
-
-
-       ACPI_FUNCTION_TRACE ("ns_dump_tables");
+       acpi_handle search_handle = search_base;
 
+       ACPI_FUNCTION_TRACE("ns_dump_tables");
 
        if (!acpi_gbl_root_node) {
                /*
                 * If the name space has not been initialized,
                 * there is nothing to dump.
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+                                 "namespace not initialized!\n"));
                return_VOID;
        }
 
@@ -687,12 +682,12 @@ acpi_ns_dump_tables (
                /* Entire namespace */
 
                search_handle = acpi_gbl_root_node;
-               ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n"));
        }
 
-       acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
-                       ACPI_UINT32_MAX, search_handle);
+       acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
+                            ACPI_OWNER_ID_MAX, search_handle);
        return_VOID;
 }
-#endif /* _ACPI_ASL_COMPILER */
-#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
+#endif                         /* _ACPI_ASL_COMPILER */
+#endif                         /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
index 27c4f7cd2a43a6a96f8c5ed92f6b2d93b7f3e171..55de883943d67d976c3b14334a4ae0cb3733d279 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
-
 /* TBD: This entire module is apparently obsolete and should be removed */
 
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsdumpdv")
-
+ACPI_MODULE_NAME("nsdumpdv")
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-
 #include <acpi/acnamesp.h>
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_one_device
  *              This procedure is a user_function called by acpi_ns_walk_namespace.
  *
  ******************************************************************************/
-
 static acpi_status
-acpi_ns_dump_one_device (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value)
 {
-       struct acpi_buffer              buffer;
-       struct acpi_device_info         *info;
-       acpi_status                     status;
-       u32                             i;
-
+       struct acpi_buffer buffer;
+       struct acpi_device_info *info;
+       acpi_status status;
+       u32 i;
 
-       ACPI_FUNCTION_NAME ("ns_dump_one_device");
+       ACPI_FUNCTION_NAME("ns_dump_one_device");
 
-
-       status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
+       status =
+           acpi_ns_dump_one_object(obj_handle, level, context, return_value);
 
        buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_get_object_info (obj_handle, &buffer);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_get_object_info(obj_handle, &buffer);
+       if (ACPI_SUCCESS(status)) {
                info = buffer.pointer;
                for (i = 0; i < level; i++) {
-                       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+                       ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
                }
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
-                       "    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
-                       info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
-                       info->current_status));
-               ACPI_MEM_FREE (info);
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
+                                     "    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
+                                     info->hardware_id.value,
+                                     ACPI_FORMAT_UINT64(info->address),
+                                     info->current_status));
+               ACPI_MEM_FREE(info);
        }
 
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_dump_root_devices
@@ -120,16 +110,12 @@ acpi_ns_dump_one_device (
  *
  ******************************************************************************/
 
-void
-acpi_ns_dump_root_devices (
-       void)
+void acpi_ns_dump_root_devices(void)
 {
-       acpi_handle                     sys_bus_handle;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_NAME ("ns_dump_root_devices");
+       acpi_handle sys_bus_handle;
+       acpi_status status;
 
+       ACPI_FUNCTION_NAME("ns_dump_root_devices");
 
        /* Only dump the table if tracing is enabled */
 
@@ -138,19 +124,17 @@ acpi_ns_dump_root_devices (
        }
 
        status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                return;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
-               "Display of all devices in the namespace:\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+                         "Display of all devices in the namespace:\n"));
 
-       status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
-                        ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
-                        acpi_ns_dump_one_device, NULL, NULL);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
+                                       ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+                                       acpi_ns_dump_one_device, NULL, NULL);
 }
 
 #endif
 #endif
-
-
index 1ae89a1c88268a4a05db959585b6ad86b300c0ab..0191c7d92824234a91444505e517045909dd5b5b 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nseval")
+ACPI_MODULE_NAME("nseval")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_execute_control_method (
-       struct acpi_parameter_info      *info);
-
-static acpi_status
-acpi_ns_get_object_value (
-       struct acpi_parameter_info      *info);
+acpi_ns_execute_control_method(struct acpi_parameter_info *info);
 
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info);
 
 /*******************************************************************************
  *
@@ -85,48 +78,44 @@ acpi_ns_get_object_value (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_evaluate_relative (
-       char                            *pathname,
-       struct acpi_parameter_info      *info)
+acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node = NULL;
-       union acpi_generic_state        *scope_info;
-       char                            *internal_path = NULL;
-
-
-       ACPI_FUNCTION_TRACE ("ns_evaluate_relative");
+       acpi_status status;
+       struct acpi_namespace_node *node = NULL;
+       union acpi_generic_state *scope_info;
+       char *internal_path = NULL;
 
+       ACPI_FUNCTION_TRACE("ns_evaluate_relative");
 
        /*
         * Must have a valid object handle
         */
        if (!info || !info->node) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Build an internal name string for the method */
 
-       status = acpi_ns_internalize_name (pathname, &internal_path);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ns_internalize_name(pathname, &internal_path);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       scope_info = acpi_ut_create_generic_state ();
+       scope_info = acpi_ut_create_generic_state();
        if (!scope_info) {
                goto cleanup1;
        }
 
        /* Get the prefix handle and Node */
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       info->node = acpi_ns_map_handle_to_node (info->node);
+       info->node = acpi_ns_map_handle_to_node(info->node);
        if (!info->node) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                status = AE_BAD_PARAMETER;
                goto cleanup;
        }
@@ -134,39 +123,38 @@ acpi_ns_evaluate_relative (
        /* Lookup the name in the namespace */
 
        scope_info->scope.node = info->node;
-       status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY,
-                        ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-                        &node);
+       status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY,
+                               ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+                               &node);
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
-                       pathname, acpi_format_exception (status)));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
+                                 pathname, acpi_format_exception(status)));
                goto cleanup;
        }
 
        /*
         * Now that we have a handle to the object, we can attempt to evaluate it.
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-               pathname, node, acpi_ns_get_attached_object (node)));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+                         pathname, node, acpi_ns_get_attached_object(node)));
 
        info->node = node;
-       status = acpi_ns_evaluate_by_handle (info);
+       status = acpi_ns_evaluate_by_handle(info);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
-               pathname));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "*** Completed eval of object %s ***\n", pathname));
 
-cleanup:
-       acpi_ut_delete_generic_state (scope_info);
+      cleanup:
+       acpi_ut_delete_generic_state(scope_info);
 
-cleanup1:
-       ACPI_MEM_FREE (internal_path);
-       return_ACPI_STATUS (status);
+      cleanup1:
+       ACPI_MEM_FREE(internal_path);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_evaluate_by_name
@@ -189,68 +177,63 @@ cleanup1:
  ******************************************************************************/
 
 acpi_status
-acpi_ns_evaluate_by_name (
-       char                            *pathname,
-       struct acpi_parameter_info      *info)
+acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
 {
-       acpi_status                     status;
-       char                            *internal_path = NULL;
-
-
-       ACPI_FUNCTION_TRACE ("ns_evaluate_by_name");
+       acpi_status status;
+       char *internal_path = NULL;
 
+       ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
 
        /* Build an internal name string for the method */
 
-       status = acpi_ns_internalize_name (pathname, &internal_path);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ns_internalize_name(pathname, &internal_path);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Lookup the name in the namespace */
 
-       status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY,
-                        ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
-                        &info->node);
+       status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY,
+                               ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+                               &info->node);
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                       "Object at [%s] was not found, status=%.4X\n",
-                       pathname, status));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                 "Object at [%s] was not found, status=%.4X\n",
+                                 pathname, status));
                goto cleanup;
        }
 
        /*
         * Now that we have a handle to the object, we can attempt to evaluate it.
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
-               pathname, info->node, acpi_ns_get_attached_object (info->node)));
-
-       status = acpi_ns_evaluate_by_handle (info);
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+                         pathname, info->node,
+                         acpi_ns_get_attached_object(info->node)));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
-               pathname));
+       status = acpi_ns_evaluate_by_handle(info);
 
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "*** Completed eval of object %s ***\n", pathname));
 
-cleanup:
+      cleanup:
 
        /* Cleanup */
 
        if (internal_path) {
-               ACPI_MEM_FREE (internal_path);
+               ACPI_MEM_FREE(internal_path);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_evaluate_by_handle
@@ -275,26 +258,22 @@ cleanup:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_evaluate_by_handle (
-       struct acpi_parameter_info      *info)
+acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
 
        /* Check if namespace has been initialized */
 
        if (!acpi_gbl_root_node) {
-               return_ACPI_STATUS (AE_NO_NAMESPACE);
+               return_ACPI_STATUS(AE_NO_NAMESPACE);
        }
 
        /* Parameter Validation */
 
        if (!info) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Initialize the return value to an invalid object */
@@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle (
 
        /* Get the prefix handle and Node */
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       info->node = acpi_ns_map_handle_to_node (info->node);
+       info->node = acpi_ns_map_handle_to_node(info->node);
        if (!info->node) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * For a method alias, we must grab the actual method node so that proper
         * scoping context will be established before execution.
         */
-       if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-               info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
+       if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+               info->node =
+                   ACPI_CAST_PTR(struct acpi_namespace_node,
+                                 info->node->object);
        }
 
        /*
@@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle (
         *
         * In both cases, the namespace is unlocked by the acpi_ns* procedure
         */
-       if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
+       if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) {
                /*
                 * Case 1) We have an actual control method to execute
                 */
-               status = acpi_ns_execute_control_method (info);
-       }
-       else {
+               status = acpi_ns_execute_control_method(info);
+       } else {
                /*
                 * Case 2) Object is NOT a method, just return its current value
                 */
-               status = acpi_ns_get_object_value (info);
+               status = acpi_ns_get_object_value(info);
        }
 
        /*
@@ -355,16 +335,16 @@ acpi_ns_evaluate_by_handle (
         * Namespace was unlocked by the handling acpi_ns* function, so we
         * just return
         */
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_execute_control_method
  *
  * PARAMETERS:  Info            - Method info block, contains:
  *                  Node            - Method Node to execute
+ *                  obj_desc        - Method object
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
@@ -383,31 +363,29 @@ acpi_ns_evaluate_by_handle (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_execute_control_method (
-       struct acpi_parameter_info      *info)
+acpi_ns_execute_control_method(struct acpi_parameter_info *info)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE ("ns_execute_control_method");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_execute_control_method");
 
        /* Verify that there is a method associated with this object */
 
-       obj_desc = acpi_ns_get_attached_object (info->node);
-       if (!obj_desc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
+       info->obj_desc = acpi_ns_get_attached_object(info->node);
+       if (!info->obj_desc) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No attached method object\n"));
 
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+               return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
-       ACPI_DUMP_PATHNAME (info->node, "Execute Method:",
-               ACPI_LV_INFO, _COMPONENT);
+       ACPI_DUMP_PATHNAME(info->node, "Execute Method:",
+                          ACPI_LV_INFO, _COMPONENT);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
-               obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
+                         info->obj_desc->method.aml_start + 1,
+                         info->obj_desc->method.aml_length - 1));
 
        /*
         * Unlock the namespace before execution.  This allows namespace access
@@ -416,27 +394,26 @@ acpi_ns_execute_control_method (
         * interpreter locks to ensure that no thread is using the portion of the
         * namespace that is being deleted.
         */
-       status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Execute the method via the interpreter.  The interpreter is locked
         * here before calling into the AML parser
         */
-       status = acpi_ex_enter_interpreter ();
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_psx_execute (info);
-       acpi_ex_exit_interpreter ();
+       status = acpi_ps_execute_method(info);
+       acpi_ex_exit_interpreter();
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_object_value
@@ -454,16 +431,12 @@ acpi_ns_execute_control_method (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_get_object_value (
-       struct acpi_parameter_info      *info)
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_namespace_node      *resolved_node = info->node;
-
-
-       ACPI_FUNCTION_TRACE ("ns_get_object_value");
+       acpi_status status = AE_OK;
+       struct acpi_namespace_node *resolved_node = info->node;
 
+       ACPI_FUNCTION_TRACE("ns_get_object_value");
 
        /*
         * Objects require additional resolution steps (e.g., the Node may be a
@@ -486,32 +459,33 @@ acpi_ns_get_object_value (
         *
         * We must release the namespace lock before entering the intepreter.
         */
-       status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ex_enter_interpreter ();
-       if (ACPI_SUCCESS (status)) {
-               status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_SUCCESS(status)) {
+               status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
                /*
                 * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
                 * in resolved_node.
                 */
-               acpi_ex_exit_interpreter ();
+               acpi_ex_exit_interpreter();
 
-               if (ACPI_SUCCESS (status)) {
+               if (ACPI_SUCCESS(status)) {
                        status = AE_CTRL_RETURN_VALUE;
                        info->return_object = ACPI_CAST_PTR
-                                        (union acpi_operand_object, resolved_node);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
-                               info->return_object,
-                               acpi_ut_get_object_type_name (info->return_object)));
+                           (union acpi_operand_object, resolved_node);
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Returning object %p [%s]\n",
+                                         info->return_object,
+                                         acpi_ut_get_object_type_name(info->
+                                                                      return_object)));
                }
        }
 
        /* Namespace is unlocked */
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
index 362802ae29a215f0b9cdd4e23af7ec7c64b09b46..0a08d2f04a06bd5394d18698338c0c6cdb9db985 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsinit")
+ACPI_MODULE_NAME("nsinit")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_init_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
+acpi_ns_init_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value);
 
 static acpi_status
-acpi_ns_init_one_device (
-       acpi_handle                     obj_handle,
-       u32                             nesting_level,
-       void                            *context,
-       void                            **return_value);
-
+acpi_ns_init_one_device(acpi_handle obj_handle,
+                       u32 nesting_level, void *context, void **return_value);
 
 /*******************************************************************************
  *
@@ -80,52 +71,48 @@ acpi_ns_init_one_device (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_initialize_objects (
-       void)
+acpi_status acpi_ns_initialize_objects(void)
 {
-       acpi_status                     status;
-       struct acpi_init_walk_info      info;
-
+       acpi_status status;
+       struct acpi_init_walk_info info;
 
-       ACPI_FUNCTION_TRACE ("ns_initialize_objects");
+       ACPI_FUNCTION_TRACE("ns_initialize_objects");
 
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "**** Starting initialization of namespace objects ****\n"));
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "Completing Region/Field/Buffer/Package initialization:"));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "**** Starting initialization of namespace objects ****\n"));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "Completing Region/Field/Buffer/Package initialization:"));
 
        /* Set all init info to zero */
 
-       ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info));
+       ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
 
        /* Walk entire namespace from the supplied root */
 
-       status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                         ACPI_UINT32_MAX, acpi_ns_init_one_object,
-                         &info, NULL);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+                                    ACPI_UINT32_MAX, acpi_ns_init_one_object,
+                                    &info, NULL);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+                                 acpi_format_exception(status)));
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
-               info.op_region_init, info.op_region_count,
-               info.field_init,    info.field_count,
-               info.buffer_init,   info.buffer_count,
-               info.package_init,  info.package_count, info.object_count));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
+                             info.op_region_init, info.op_region_count,
+                             info.field_init, info.field_count,
+                             info.buffer_init, info.buffer_count,
+                             info.package_init, info.package_count,
+                             info.object_count));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "%hd Control Methods found\n", info.method_count));
-       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-               "%hd Op Regions found\n", info.op_region_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "%hd Control Methods found\n", info.method_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+                         "%hd Op Regions found\n", info.op_region_count));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_initialize_devices
@@ -142,16 +129,12 @@ acpi_ns_initialize_objects (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_initialize_devices (
-       void)
+acpi_status acpi_ns_initialize_devices(void)
 {
-       acpi_status                     status;
-       struct acpi_device_walk_info    info;
-
-
-       ACPI_FUNCTION_TRACE ("ns_initialize_devices");
+       acpi_status status;
+       struct acpi_device_walk_info info;
 
+       ACPI_FUNCTION_TRACE("ns_initialize_devices");
 
        /* Init counters */
 
@@ -159,34 +142,34 @@ acpi_ns_initialize_devices (
        info.num_STA = 0;
        info.num_INI = 0;
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "Executing all Device _STA and_INI methods:"));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "Executing all Device _STA and_INI methods:"));
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Walk namespace for all objects */
 
-       status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                         ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+                                       ACPI_UINT32_MAX, TRUE,
+                                       acpi_ns_init_one_device, &info, NULL);
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
-                       acpi_format_exception (status)));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+                                 acpi_format_exception(status)));
        }
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
-               info.device_count, info.num_STA, info.num_INI));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
+                             info.device_count, info.num_STA, info.num_INI));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_init_one_object
@@ -208,28 +191,25 @@ acpi_ns_initialize_devices (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_init_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_init_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value)
 {
-       acpi_object_type                type;
-       acpi_status                     status;
-       struct acpi_init_walk_info      *info = (struct acpi_init_walk_info *) context;
-       struct acpi_namespace_node      *node = (struct acpi_namespace_node *) obj_handle;
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_NAME ("ns_init_one_object");
+       acpi_object_type type;
+       acpi_status status;
+       struct acpi_init_walk_info *info =
+           (struct acpi_init_walk_info *)context;
+       struct acpi_namespace_node *node =
+           (struct acpi_namespace_node *)obj_handle;
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_NAME("ns_init_one_object");
 
        info->object_count++;
 
        /* And even then, we are only interested in a few object types */
 
-       type = acpi_ns_get_type (obj_handle);
-       obj_desc = acpi_ns_get_attached_object (node);
+       type = acpi_ns_get_type(obj_handle);
+       obj_desc = acpi_ns_get_attached_object(node);
        if (!obj_desc) {
                return (AE_OK);
        }
@@ -269,8 +249,8 @@ acpi_ns_init_one_object (
        /*
         * Must lock the interpreter before executing AML code
         */
-       status = acpi_ex_enter_interpreter ();
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ex_enter_interpreter();
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
@@ -282,25 +262,25 @@ acpi_ns_init_one_object (
        case ACPI_TYPE_REGION:
 
                info->op_region_init++;
-               status = acpi_ds_get_region_arguments (obj_desc);
+               status = acpi_ds_get_region_arguments(obj_desc);
                break;
 
        case ACPI_TYPE_BUFFER_FIELD:
 
                info->field_init++;
-               status = acpi_ds_get_buffer_field_arguments (obj_desc);
+               status = acpi_ds_get_buffer_field_arguments(obj_desc);
                break;
 
        case ACPI_TYPE_BUFFER:
 
                info->buffer_init++;
-               status = acpi_ds_get_buffer_arguments (obj_desc);
+               status = acpi_ds_get_buffer_arguments(obj_desc);
                break;
 
        case ACPI_TYPE_PACKAGE:
 
                info->package_init++;
-               status = acpi_ds_get_package_arguments (obj_desc);
+               status = acpi_ds_get_package_arguments(obj_desc);
                break;
 
        default:
@@ -308,12 +288,13 @@ acpi_ns_init_one_object (
                break;
        }
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not execute arguments for [%4.4s] (%s), %s\n",
-                               acpi_ut_get_node_name (node), acpi_ut_get_type_name (type),
-                               acpi_format_exception (status)));
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not execute arguments for [%4.4s] (%s), %s\n",
+                                 acpi_ut_get_node_name(node),
+                                 acpi_ut_get_type_name(type),
+                                 acpi_format_exception(status)));
        }
 
        /*
@@ -321,18 +302,17 @@ acpi_ns_init_one_object (
         * pathname
         */
        if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
        }
 
        /*
         * We ignore errors from above, and always return OK, since we don't want
         * to abort the walk on any single error.
         */
-       acpi_ex_exit_interpreter ();
+       acpi_ex_exit_interpreter();
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_init_one_device
@@ -348,41 +328,37 @@ acpi_ns_init_one_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_init_one_device (
-       acpi_handle                     obj_handle,
-       u32                             nesting_level,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_init_one_device(acpi_handle obj_handle,
+                       u32 nesting_level, void *context, void **return_value)
 {
-       struct acpi_device_walk_info   *info = (struct acpi_device_walk_info *) context;
-       struct acpi_parameter_info      pinfo;
-       u32                             flags;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_init_one_device");
+       struct acpi_device_walk_info *info =
+           (struct acpi_device_walk_info *)context;
+       struct acpi_parameter_info pinfo;
+       u32 flags;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_init_one_device");
 
        pinfo.parameters = NULL;
        pinfo.parameter_type = ACPI_PARAM_ARGS;
 
-       pinfo.node = acpi_ns_map_handle_to_node (obj_handle);
+       pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
        if (!pinfo.node) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * We will run _STA/_INI on Devices, Processors and thermal_zones only
         */
-       if ((pinfo.node->type != ACPI_TYPE_DEVICE)      &&
-               (pinfo.node->type != ACPI_TYPE_PROCESSOR)   &&
-               (pinfo.node->type != ACPI_TYPE_THERMAL)) {
-               return_ACPI_STATUS (AE_OK);
+       if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
+           (pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
+           (pinfo.node->type != ACPI_TYPE_THERMAL)) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
-               (!(acpi_dbg_level & ACPI_LV_INFO))) {
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+           (!(acpi_dbg_level & ACPI_LV_INFO))) {
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
        }
 
        info->device_count++;
@@ -390,20 +366,20 @@ acpi_ns_init_one_device (
        /*
         * Run _STA to determine if we can run _INI on the device.
         */
-       ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
-                          pinfo.node, METHOD_NAME__STA));
-       status = acpi_ut_execute_STA (pinfo.node, &flags);
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+                                                     pinfo.node,
+                                                     METHOD_NAME__STA));
+       status = acpi_ut_execute_STA(pinfo.node, &flags);
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                if (pinfo.node->type == ACPI_TYPE_DEVICE) {
                        /* Ignore error and move on to next device */
 
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /* _STA is not required for Processor or thermal_zone objects */
-       }
-       else {
+       } else {
                info->num_STA++;
 
                if (!(flags & 0x01)) {
@@ -416,32 +392,34 @@ acpi_ns_init_one_device (
        /*
         * The device is present. Run _INI.
         */
-       ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
-                          pinfo.node, METHOD_NAME__INI));
-       status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
-       if (ACPI_FAILURE (status)) {
+       ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+                                                     pinfo.node,
+                                                     METHOD_NAME__INI));
+       status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
+       if (ACPI_FAILURE(status)) {
                /* No _INI (AE_NOT_FOUND) means device requires no initialization */
 
                if (status != AE_NOT_FOUND) {
                        /* Ignore error and move on to next device */
 
 #ifdef ACPI_DEBUG_OUTPUT
-                       char                *scope_name = acpi_ns_get_external_pathname (pinfo.node);
+                       char *scope_name =
+                           acpi_ns_get_external_pathname(pinfo.node);
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
-                                       scope_name, acpi_format_exception (status)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
+                                         scope_name,
+                                         acpi_format_exception(status)));
 
-                       ACPI_MEM_FREE (scope_name);
+                       ACPI_MEM_FREE(scope_name);
 #endif
                }
 
                status = AE_OK;
-       }
-       else {
+       } else {
                /* Delete any return object (especially if implicit_return is enabled) */
 
                if (pinfo.return_object) {
-                       acpi_ut_remove_reference (pinfo.return_object);
+                       acpi_ut_remove_reference(pinfo.return_object);
                }
 
                /* Count of successful INIs */
@@ -452,8 +430,9 @@ acpi_ns_init_one_device (
        if (acpi_gbl_init_handler) {
                /* External initialization handler is present, call it */
 
-               status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
+               status =
+                   acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
index 34e497016601de5b27af03e8f54ec4f12e83d0ff..c28849de465a61fbb442a63b1a49c7d6f68e3f71 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsload")
+ACPI_MODULE_NAME("nsload")
 
 /* Local prototypes */
-
-static acpi_status
-acpi_ns_load_table_by_type (
-       acpi_table_type                 table_type);
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
 
 #ifdef ACPI_FUTURE_IMPLEMENTATION
-acpi_status
-acpi_ns_unload_namespace (
-       acpi_handle                     handle);
+acpi_status acpi_ns_unload_namespace(acpi_handle handle);
 
-static acpi_status
-acpi_ns_delete_subtree (
-       acpi_handle                     start_handle);
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
 #endif
 
-
 #ifndef ACPI_NO_METHOD_EXECUTION
 /*******************************************************************************
  *
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_load_table (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *node)
+acpi_ns_load_table(struct acpi_table_desc *table_desc,
+                  struct acpi_namespace_node *node)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_load_table");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_load_table");
 
        /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
 
-       if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
+       if (!
+           (acpi_gbl_table_data[table_desc->type].
+            flags & ACPI_TABLE_EXECUTABLE)) {
                /* Just ignore this table */
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Check validity of the AML start and length */
 
        if (!table_desc->aml_start) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
-               table_desc->aml_start));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
+                         table_desc->aml_start));
 
        /* Ignore table if there is no AML contained within */
 
        if (!table_desc->aml_length) {
-               ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
-                       table_desc->pointer->signature));
-               return_ACPI_STATUS (AE_OK);
+               ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n",
+                                    table_desc->pointer->signature));
+               return_ACPI_STATUS(AE_OK);
        }
 
        /*
@@ -127,19 +116,19 @@ acpi_ns_load_table (
         * to another control method, we can't continue parsing
         * because we don't know how many arguments to parse next!
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "**** Loading table into namespace ****\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "**** Loading table into namespace ****\n"));
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ns_parse_table (table_desc, node->child);
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       status = acpi_ns_parse_table(table_desc, node->child);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -148,18 +137,17 @@ acpi_ns_load_table (
         * just-in-time parsing, we delete the control method
         * parse trees.
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "**** Begin Table Method Parsing and Object Initialization ****\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "**** Begin Table Method Parsing and Object Initialization ****\n"));
 
-       status = acpi_ds_initialize_objects (table_desc, node);
+       status = acpi_ds_initialize_objects(table_desc, node);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "**** Completed Table Method Parsing and Object Initialization ****\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "**** Completed Table Method Parsing and Object Initialization ****\n"));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_load_table_by_type
@@ -174,21 +162,17 @@ acpi_ns_load_table (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_load_table_by_type (
-       acpi_table_type                 table_type)
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
 {
-       u32                             i;
-       acpi_status                     status;
-       struct acpi_table_desc          *table_desc;
-
+       u32 i;
+       acpi_status status;
+       struct acpi_table_desc *table_desc;
 
-       ACPI_FUNCTION_TRACE ("ns_load_table_by_type");
+       ACPI_FUNCTION_TRACE("ns_load_table_by_type");
 
-
-       status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type (
        switch (table_type) {
        case ACPI_TABLE_DSDT:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
 
                table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
 
@@ -210,57 +194,33 @@ acpi_ns_load_table_by_type (
 
                /* Now load the single DSDT */
 
-               status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
+               if (ACPI_SUCCESS(status)) {
                        table_desc->loaded_into_namespace = TRUE;
                }
                break;
 
-
        case ACPI_TABLE_SSDT:
+       case ACPI_TABLE_PSDT:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
-                       acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Namespace load: %d SSDT or PSDTs\n",
+                                 acpi_gbl_table_lists[table_type].count));
 
                /*
-                * Traverse list of SSDT tables
+                * Traverse list of SSDT or PSDT tables
                 */
-               table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
-               for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
+               table_desc = acpi_gbl_table_lists[table_type].next;
+               for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
                        /*
-                        * Only attempt to load table if it is not
+                        * Only attempt to load table into namespace if it is not
                         * already loaded!
                         */
                        if (!table_desc->loaded_into_namespace) {
-                               status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-                               if (ACPI_FAILURE (status)) {
-                                       break;
-                               }
-
-                               table_desc->loaded_into_namespace = TRUE;
-                       }
-
-                       table_desc = table_desc->next;
-               }
-               break;
-
-
-       case ACPI_TABLE_PSDT:
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
-                       acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
-
-               /*
-                * Traverse list of PSDT tables
-                */
-               table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
-
-               for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
-                       /* Only attempt to load table if it is not already loaded! */
-
-                       if (!table_desc->loaded_into_namespace) {
-                               status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_ns_load_table(table_desc,
+                                                      acpi_gbl_root_node);
+                               if (ACPI_FAILURE(status)) {
                                        break;
                                }
 
@@ -271,19 +231,16 @@ acpi_ns_load_table_by_type (
                }
                break;
 
-
        default:
                status = AE_SUPPORT;
                break;
        }
 
-
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_load_namespace
@@ -297,45 +254,40 @@ unlock_and_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_load_namespace (
-       void)
+acpi_status acpi_ns_load_namespace(void)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_load_name_space");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_load_name_space");
 
        /* There must be at least a DSDT installed */
 
        if (acpi_gbl_DSDT == NULL) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        /*
         * Load the namespace.  The DSDT is required,
         * but the SSDT and PSDT tables are optional.
         */
-       status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Ignore exceptions from these */
 
-       (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
-       (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+       (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
+       (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
 
-       ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
-               "ACPI Namespace successfully loaded at root %p\n",
-               acpi_gbl_root_node));
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+                             "ACPI Namespace successfully loaded at root %p\n",
+                             acpi_gbl_root_node));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_IMPLEMENTATION
 /*******************************************************************************
  *
@@ -353,24 +305,20 @@ acpi_ns_load_namespace (
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_delete_subtree (
-       acpi_handle                     start_handle)
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
 {
-       acpi_status                     status;
-       acpi_handle                     child_handle;
-       acpi_handle                     parent_handle;
-       acpi_handle                     next_child_handle;
-       acpi_handle                     dummy;
-       u32                             level;
-
-
-       ACPI_FUNCTION_TRACE ("ns_delete_subtree");
+       acpi_status status;
+       acpi_handle child_handle;
+       acpi_handle parent_handle;
+       acpi_handle next_child_handle;
+       acpi_handle dummy;
+       u32 level;
 
+       ACPI_FUNCTION_TRACE("ns_delete_subtree");
 
        parent_handle = start_handle;
        child_handle = NULL;
-       level        = 1;
+       level = 1;
 
        /*
         * Traverse the tree of objects until we bubble back up
@@ -379,18 +327,19 @@ acpi_ns_delete_subtree (
        while (level > 0) {
                /* Attempt to get the next object in this scope */
 
-               status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle,
-                                 child_handle, &next_child_handle);
+               status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
+                                             child_handle, &next_child_handle);
 
                child_handle = next_child_handle;
 
                /* Did we get a new object? */
 
-               if (ACPI_SUCCESS (status)) {
+               if (ACPI_SUCCESS(status)) {
                        /* Check if this object has any children */
 
-                       if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
-                                        NULL, &dummy))) {
+                       if (ACPI_SUCCESS
+                           (acpi_get_next_object
+                            (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
                                /*
                                 * There is at least one child of this object,
                                 * visit the object
@@ -399,8 +348,7 @@ acpi_ns_delete_subtree (
                                parent_handle = child_handle;
                                child_handle = NULL;
                        }
-               }
-               else {
+               } else {
                        /*
                         * No more children in this object, go back up to
                         * the object's parent
@@ -409,24 +357,23 @@ acpi_ns_delete_subtree (
 
                        /* Delete all children now */
 
-                       acpi_ns_delete_children (child_handle);
+                       acpi_ns_delete_children(child_handle);
 
                        child_handle = parent_handle;
-                       status = acpi_get_parent (parent_handle, &parent_handle);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_get_parent(parent_handle, &parent_handle);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
                }
        }
 
        /* Now delete the starting object, and we are done */
 
-       acpi_ns_delete_node (child_handle);
+       acpi_ns_delete_node(child_handle);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  *  FUNCTION:       acpi_ns_unload_name_space
@@ -441,32 +388,27 @@ acpi_ns_delete_subtree (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_unload_namespace (
-       acpi_handle                     handle)
+acpi_status acpi_ns_unload_namespace(acpi_handle handle)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_unload_name_space");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_unload_name_space");
 
        /* Parameter validation */
 
        if (!acpi_gbl_root_node) {
-               return_ACPI_STATUS (AE_NO_NAMESPACE);
+               return_ACPI_STATUS(AE_NO_NAMESPACE);
        }
 
        if (!handle) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* This function does the real work */
 
-       status = acpi_ns_delete_subtree (handle);
+       status = acpi_ns_delete_subtree(handle);
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 #endif
 #endif
-
index d8ce7e39795fde0a5450b7c07859c6115c568530..d5e8dea61c278f1e3f2fe76d3713e9fd380b851b 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsnames")
+ACPI_MODULE_NAME("nsnames")
 
 /* Local prototypes */
-
 static void
-acpi_ns_build_external_path (
-       struct acpi_namespace_node      *node,
-       acpi_size                       size,
-       char                            *name_buffer);
-
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+                           acpi_size size, char *name_buffer);
 
 /*******************************************************************************
  *
@@ -75,17 +69,13 @@ acpi_ns_build_external_path (
  ******************************************************************************/
 
 static void
-acpi_ns_build_external_path (
-       struct acpi_namespace_node      *node,
-       acpi_size                       size,
-       char                            *name_buffer)
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+                           acpi_size size, char *name_buffer)
 {
-       acpi_size                       index;
-       struct acpi_namespace_node      *parent_node;
-
-
-       ACPI_FUNCTION_NAME ("ns_build_external_path");
+       acpi_size index;
+       struct acpi_namespace_node *parent_node;
 
+       ACPI_FUNCTION_NAME("ns_build_external_path");
 
        /* Special case for root */
 
@@ -106,8 +96,8 @@ acpi_ns_build_external_path (
 
                /* Put the name into the buffer */
 
-               ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name);
-               parent_node = acpi_ns_get_parent_node (parent_node);
+               ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
+               parent_node = acpi_ns_get_parent_node(parent_node);
 
                /* Prefix name with the path separator */
 
@@ -120,15 +110,14 @@ acpi_ns_build_external_path (
        name_buffer[index] = AML_ROOT_PREFIX;
 
        if (index != 0) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Could not construct pathname; index=%X, size=%X, Path=%s\n",
-                       (u32) index, (u32) size, &name_buffer[size]));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+                                 (u32) index, (u32) size, &name_buffer[size]));
        }
 
        return;
 }
 
-
 #ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
@@ -144,37 +133,32 @@ acpi_ns_build_external_path (
  *
  ******************************************************************************/
 
-char *
-acpi_ns_get_external_pathname (
-       struct acpi_namespace_node      *node)
+char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 {
-       char                            *name_buffer;
-       acpi_size                       size;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node);
+       char *name_buffer;
+       acpi_size size;
 
+       ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
 
        /* Calculate required buffer size based on depth below root */
 
-       size = acpi_ns_get_pathname_length (node);
+       size = acpi_ns_get_pathname_length(node);
 
        /* Allocate a buffer to be returned to caller */
 
-       name_buffer = ACPI_MEM_CALLOCATE (size);
+       name_buffer = ACPI_MEM_CALLOCATE(size);
        if (!name_buffer) {
-               ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n"));
-               return_PTR (NULL);
+               ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n"));
+               return_PTR(NULL);
        }
 
        /* Build the path in the allocated buffer */
 
-       acpi_ns_build_external_path (node, size, name_buffer);
-       return_PTR (name_buffer);
+       acpi_ns_build_external_path(node, size, name_buffer);
+       return_PTR(name_buffer);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_pathname_length
@@ -187,16 +171,12 @@ acpi_ns_get_external_pathname (
  *
  ******************************************************************************/
 
-acpi_size
-acpi_ns_get_pathname_length (
-       struct acpi_namespace_node      *node)
+acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
 {
-       acpi_size                       size;
-       struct acpi_namespace_node      *next_node;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_size size;
+       struct acpi_namespace_node *next_node;
 
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * Compute length of pathname as 5 * number of name segments.
@@ -207,17 +187,16 @@ acpi_ns_get_pathname_length (
 
        while (next_node && (next_node != acpi_gbl_root_node)) {
                size += ACPI_PATH_SEGMENT_LENGTH;
-               next_node = acpi_ns_get_parent_node (next_node);
+               next_node = acpi_ns_get_parent_node(next_node);
        }
 
        if (!size) {
-               size = 1;       /* Root node case */
+               size = 1;       /* Root node case */
        }
 
-       return (size + 1);  /* +1 for null string terminator */
+       return (size + 1);      /* +1 for null string terminator */
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_handle_to_pathname
@@ -233,41 +212,36 @@ acpi_ns_get_pathname_length (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_handle_to_pathname (
-       acpi_handle                     target_handle,
-       struct acpi_buffer              *buffer)
+acpi_ns_handle_to_pathname(acpi_handle target_handle,
+                          struct acpi_buffer * buffer)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       acpi_size                       required_size;
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       acpi_size required_size;
 
+       ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
 
-       ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle);
-
-
-       node = acpi_ns_map_handle_to_node (target_handle);
+       node = acpi_ns_map_handle_to_node(target_handle);
        if (!node) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Determine size required for the caller buffer */
 
-       required_size = acpi_ns_get_pathname_length (node);
+       required_size = acpi_ns_get_pathname_length(node);
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (buffer, required_size);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_initialize_buffer(buffer, required_size);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Build the path in the caller buffer */
 
-       acpi_ns_build_external_path (node, required_size, buffer->pointer);
+       acpi_ns_build_external_path(node, required_size, buffer->pointer);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
-               (char *) buffer->pointer, (u32) required_size));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
+                         (char *)buffer->pointer, (u32) required_size));
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 27258c1ca4f12170b76cb99bbc5ffdbc91e75222..fc9be946ebed7c24c3fef227ceed40f2bc7b8499 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsobject")
-
+ACPI_MODULE_NAME("nsobject")
 
 /*******************************************************************************
  *
  * MUTEX:       Assumes namespace is locked
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ns_attach_object (
-       struct acpi_namespace_node      *node,
-       union acpi_operand_object       *object,
-       acpi_object_type                type)
+acpi_ns_attach_object(struct acpi_namespace_node *node,
+                     union acpi_operand_object *object, acpi_object_type type)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *last_obj_desc;
-       acpi_object_type                object_type = ACPI_TYPE_ANY;
-
-
-       ACPI_FUNCTION_TRACE ("ns_attach_object");
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *last_obj_desc;
+       acpi_object_type object_type = ACPI_TYPE_ANY;
 
+       ACPI_FUNCTION_TRACE("ns_attach_object");
 
        /*
         * Parameter validation
@@ -92,40 +84,39 @@ acpi_ns_attach_object (
        if (!node) {
                /* Invalid handle */
 
-               ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (!object && (ACPI_TYPE_ANY != type)) {
                /* Null object */
 
-               ACPI_REPORT_ERROR ((
-                       "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
                /* Not a name handle */
 
-               ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n",
-                               node, acpi_ut_get_descriptor_name (node)));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n",
+                                  node, acpi_ut_get_descriptor_name(node)));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Check if this object is already attached */
 
        if (node->object == object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Obj %p already installed in name_obj %p\n",
-                       object, node));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Obj %p already installed in name_obj %p\n",
+                                 object, node));
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* If null object, we will just install it */
 
        if (!object) {
-               obj_desc   = NULL;
+               obj_desc = NULL;
                object_type = ACPI_TYPE_ANY;
        }
 
@@ -133,14 +124,14 @@ acpi_ns_attach_object (
         * If the source object is a namespace Node with an attached object,
         * we will use that (attached) object
         */
-       else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) &&
-                       ((struct acpi_namespace_node *) object)->object) {
+       else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) &&
+                ((struct acpi_namespace_node *)object)->object) {
                /*
                 * Value passed is a name handle and that name has a
                 * non-null value.  Use that name's value and type.
                 */
-               obj_desc   = ((struct acpi_namespace_node *) object)->object;
-               object_type = ((struct acpi_namespace_node *) object)->type;
+               obj_desc = ((struct acpi_namespace_node *)object)->object;
+               object_type = ((struct acpi_namespace_node *)object)->type;
        }
 
        /*
@@ -148,20 +139,20 @@ acpi_ns_attach_object (
         * it first
         */
        else {
-               obj_desc = (union acpi_operand_object   *) object;
+               obj_desc = (union acpi_operand_object *)object;
 
                /* Use the given type */
 
                object_type = type;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
-               obj_desc, node, acpi_ut_get_node_name (node)));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
+                         obj_desc, node, acpi_ut_get_node_name(node)));
 
        /* Detach an existing attached object if present */
 
        if (node->object) {
-               acpi_ns_detach_object (node);
+               acpi_ns_detach_object(node);
        }
 
        if (obj_desc) {
@@ -169,7 +160,7 @@ acpi_ns_attach_object (
                 * Must increment the new value's reference count
                 * (if it is an internal object)
                 */
-               acpi_ut_add_reference (obj_desc);
+               acpi_ut_add_reference(obj_desc);
 
                /*
                 * Handle objects with multiple descriptors - walk
@@ -185,13 +176,12 @@ acpi_ns_attach_object (
                last_obj_desc->common.next_object = node->object;
        }
 
-       node->type     = (u8) object_type;
-       node->object   = obj_desc;
+       node->type = (u8) object_type;
+       node->object = obj_desc;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_detach_object
@@ -206,30 +196,27 @@ acpi_ns_attach_object (
  *
  ******************************************************************************/
 
-void
-acpi_ns_detach_object (
-       struct acpi_namespace_node      *node)
+void acpi_ns_detach_object(struct acpi_namespace_node *node)
 {
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE ("ns_detach_object");
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE("ns_detach_object");
 
        obj_desc = node->object;
 
        if (!obj_desc ||
-               (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
+           (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
                return_VOID;
        }
 
        /* Clear the entry in all cases */
 
        node->object = NULL;
-       if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
                node->object = obj_desc->common.next_object;
                if (node->object &&
-                  (ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) {
+                   (ACPI_GET_OBJECT_TYPE(node->object) !=
+                    ACPI_TYPE_LOCAL_DATA)) {
                        node->object = node->object->common.next_object;
                }
        }
@@ -238,16 +225,15 @@ acpi_ns_detach_object (
 
        node->type = ACPI_TYPE_ANY;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
-               node, acpi_ut_get_node_name (node), obj_desc));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
+                         node, acpi_ut_get_node_name(node), obj_desc));
 
        /* Remove one reference on the object (and all subobjects) */
 
-       acpi_ut_remove_reference (obj_desc);
+       acpi_ut_remove_reference(obj_desc);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_attached_object
@@ -261,29 +247,28 @@ acpi_ns_detach_object (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ns_get_attached_object (
-       struct acpi_namespace_node      *node)
+union acpi_operand_object *acpi_ns_get_attached_object(struct
+                                                      acpi_namespace_node
+                                                      *node)
 {
-       ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node);
-
+       ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
 
        if (!node) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
-               return_PTR (NULL);
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n"));
+               return_PTR(NULL);
        }
 
        if (!node->object ||
-                       ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
-                        (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED))  ||
-               (ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
-               return_PTR (NULL);
+           ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
+            && (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
+                ACPI_DESC_TYPE_NAMED))
+           || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) {
+               return_PTR(NULL);
        }
 
-       return_PTR (node->object);
+       return_PTR(node->object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_secondary_object
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ns_get_secondary_object (
-       union acpi_operand_object       *obj_desc)
+union acpi_operand_object *acpi_ns_get_secondary_object(union
+                                                       acpi_operand_object
+                                                       *obj_desc)
 {
-       ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc);
-
-
-       if ((!obj_desc)                                               ||
-               (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
-               (!obj_desc->common.next_object)                           ||
-               (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
-               return_PTR (NULL);
+       ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
+
+       if ((!obj_desc) ||
+           (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
+           (!obj_desc->common.next_object) ||
+           (ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) ==
+            ACPI_TYPE_LOCAL_DATA)) {
+               return_PTR(NULL);
        }
 
-       return_PTR (obj_desc->common.next_object);
+       return_PTR(obj_desc->common.next_object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_attach_data
@@ -330,23 +314,20 @@ acpi_ns_get_secondary_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_attach_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler,
-       void                            *data)
+acpi_ns_attach_data(struct acpi_namespace_node *node,
+                   acpi_object_handler handler, void *data)
 {
-       union acpi_operand_object       *prev_obj_desc;
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *data_desc;
-
+       union acpi_operand_object *prev_obj_desc;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *data_desc;
 
        /* We only allow one attachment per handler */
 
        prev_obj_desc = NULL;
        obj_desc = node->object;
        while (obj_desc) {
-               if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-                       (obj_desc->data.handler == handler)) {
+               if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+                   (obj_desc->data.handler == handler)) {
                        return (AE_ALREADY_EXISTS);
                }
 
@@ -356,7 +337,7 @@ acpi_ns_attach_data (
 
        /* Create an internal object for the data */
 
-       data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
+       data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA);
        if (!data_desc) {
                return (AE_NO_MEMORY);
        }
@@ -368,15 +349,13 @@ acpi_ns_attach_data (
 
        if (prev_obj_desc) {
                prev_obj_desc->common.next_object = data_desc;
-       }
-       else {
+       } else {
                node->object = data_desc;
        }
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_detach_data
@@ -392,27 +371,25 @@ acpi_ns_attach_data (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_detach_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler)
+acpi_ns_detach_data(struct acpi_namespace_node * node,
+                   acpi_object_handler handler)
 {
-       union acpi_operand_object       *obj_desc;
-       union acpi_operand_object       *prev_obj_desc;
-
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object *prev_obj_desc;
 
        prev_obj_desc = NULL;
        obj_desc = node->object;
        while (obj_desc) {
-               if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-                       (obj_desc->data.handler == handler)) {
+               if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+                   (obj_desc->data.handler == handler)) {
                        if (prev_obj_desc) {
-                               prev_obj_desc->common.next_object = obj_desc->common.next_object;
-                       }
-                       else {
+                               prev_obj_desc->common.next_object =
+                                   obj_desc->common.next_object;
+                       else {
                                node->object = obj_desc->common.next_object;
                        }
 
-                       acpi_ut_remove_reference (obj_desc);
+                       acpi_ut_remove_reference(obj_desc);
                        return (AE_OK);
                }
 
@@ -423,7 +400,6 @@ acpi_ns_detach_data (
        return (AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_attached_data
@@ -440,18 +416,15 @@ acpi_ns_detach_data (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_attached_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler,
-       void                            **data)
+acpi_ns_get_attached_data(struct acpi_namespace_node * node,
+                         acpi_object_handler handler, void **data)
 {
-       union acpi_operand_object       *obj_desc;
-
+       union acpi_operand_object *obj_desc;
 
        obj_desc = node->object;
        while (obj_desc) {
-               if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
-                       (obj_desc->data.handler == handler)) {
+               if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+                   (obj_desc->data.handler == handler)) {
                        *data = obj_desc->data.pointer;
                        return (AE_OK);
                }
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data (
 
        return (AE_NOT_FOUND);
 }
-
-
index a0e13e8d376489ee000c2724136f7729b5815c70..433442a9ec7441c019f0360e147519f38df315b7 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsparse")
-
+ACPI_MODULE_NAME("nsparse")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ns_one_complete_parse (
-       u32                             pass_number,
-       struct acpi_table_desc          *table_desc)
+acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
 {
-       union acpi_parse_object         *parse_root;
-       acpi_status                     status;
-       struct acpi_walk_state          *walk_state;
-
-
-       ACPI_FUNCTION_TRACE ("ns_one_complete_parse");
+       union acpi_parse_object *parse_root;
+       acpi_status status;
+       struct acpi_walk_state *walk_state;
 
+       ACPI_FUNCTION_TRACE("ns_one_complete_parse");
 
        /* Create and init a Root Node */
 
-       parse_root = acpi_ps_create_scope_op ();
+       parse_root = acpi_ps_create_scope_op();
        if (!parse_root) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Create and initialize a new walk state */
 
-       walk_state = acpi_ds_create_walk_state (table_desc->table_id,
-                          NULL, NULL, NULL);
+       walk_state = acpi_ds_create_walk_state(table_desc->owner_id,
+                                              NULL, NULL, NULL);
        if (!walk_state) {
-               acpi_ps_free_op (parse_root);
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               acpi_ps_free_op(parse_root);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL,
-                         table_desc->aml_start, table_desc->aml_length,
-                         NULL, pass_number);
-       if (ACPI_FAILURE (status)) {
-               acpi_ds_delete_walk_state (walk_state);
-               return_ACPI_STATUS (status);
+       status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
+                                      table_desc->aml_start,
+                                      table_desc->aml_length, NULL,
+                                      pass_number);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               return_ACPI_STATUS(status);
        }
 
        /* Parse the AML */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
-       status = acpi_ps_parse_aml (walk_state);
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
+                         pass_number));
+       status = acpi_ps_parse_aml(walk_state);
 
-       acpi_ps_delete_parse_tree (parse_root);
-       return_ACPI_STATUS (status);
+       acpi_ps_delete_parse_tree(parse_root);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_parse_table
@@ -126,15 +119,12 @@ acpi_ns_one_complete_parse (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_parse_table (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *start_node)
+acpi_ns_parse_table(struct acpi_table_desc *table_desc,
+                   struct acpi_namespace_node *start_node)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_parse_table");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_parse_table");
 
        /*
         * AML Parse, pass 1
@@ -146,9 +136,10 @@ acpi_ns_parse_table (
         * to service the entire parse.  The second pass of the parse then
         * performs another complete parse of the AML..
         */
-       status = acpi_ns_one_complete_parse (1, table_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
+       status = acpi_ns_one_complete_parse(1, table_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -160,12 +151,11 @@ acpi_ns_parse_table (
         * overhead of this is compensated for by the fact that the
         * parse objects are all cached.
         */
-       status = acpi_ns_one_complete_parse (2, table_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
+       status = acpi_ns_one_complete_parse(2, table_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index af8aaa9cc4f31eb4728331918997f017e6b39421..50a3ca5470ed6f1c41cd0332d7e03bec14ad4768 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nssearch")
+ACPI_MODULE_NAME("nssearch")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ns_search_parent_tree (
-       u32                             target_name,
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_namespace_node      **return_node);
-
+acpi_ns_search_parent_tree(u32 target_name,
+                          struct acpi_namespace_node *node,
+                          acpi_object_type type,
+                          struct acpi_namespace_node **return_node);
 
 /*******************************************************************************
  *
@@ -87,30 +82,28 @@ acpi_ns_search_parent_tree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_search_node (
-       u32                             target_name,
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_namespace_node      **return_node)
+acpi_ns_search_node(u32 target_name,
+                   struct acpi_namespace_node *node,
+                   acpi_object_type type,
+                   struct acpi_namespace_node **return_node)
 {
-       struct acpi_namespace_node      *next_node;
-
-
-       ACPI_FUNCTION_TRACE ("ns_search_node");
+       struct acpi_namespace_node *next_node;
 
+       ACPI_FUNCTION_TRACE("ns_search_node");
 
 #ifdef ACPI_DEBUG_OUTPUT
        if (ACPI_LV_NAMES & acpi_dbg_level) {
-               char                        *scope_name;
+               char *scope_name;
 
-               scope_name = acpi_ns_get_external_pathname (node);
+               scope_name = acpi_ns_get_external_pathname(node);
                if (scope_name) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Searching %s (%p) For [%4.4s] (%s)\n",
-                               scope_name, node, (char *) &target_name,
-                               acpi_ut_get_type_name (type)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Searching %s (%p) For [%4.4s] (%s)\n",
+                                         scope_name, node,
+                                         (char *)&target_name,
+                                         acpi_ut_get_type_name(type)));
 
-                       ACPI_MEM_FREE (scope_name);
+                       ACPI_MEM_FREE(scope_name);
                }
        }
 #endif
@@ -126,20 +119,26 @@ acpi_ns_search_node (
                if (next_node->name.integer == target_name) {
                        /* Resolve a control method alias if any */
 
-                       if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
-                               next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object);
+                       if (acpi_ns_get_type(next_node) ==
+                           ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+                               next_node =
+                                   ACPI_CAST_PTR(struct acpi_namespace_node,
+                                                 next_node->object);
                        }
 
                        /*
                         * Found matching entry.
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                               "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
-                               (char *) &target_name, acpi_ut_get_type_name (next_node->type),
-                               next_node, acpi_ut_get_node_name (node), node));
+                       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                         "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
+                                         (char *)&target_name,
+                                         acpi_ut_get_type_name(next_node->
+                                                               type),
+                                         next_node,
+                                         acpi_ut_get_node_name(node), node));
 
                        *return_node = next_node;
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
 
                /*
@@ -159,15 +158,14 @@ acpi_ns_search_node (
 
        /* Searched entire namespace level, not found */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-               "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
-               (char *) &target_name, acpi_ut_get_type_name (type),
-               acpi_ut_get_node_name (node), node, node->child));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
+                         (char *)&target_name, acpi_ut_get_type_name(type),
+                         acpi_ut_get_node_name(node), node, node->child));
 
-       return_ACPI_STATUS (AE_NOT_FOUND);
+       return_ACPI_STATUS(AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_search_parent_tree
@@ -194,43 +192,42 @@ acpi_ns_search_node (
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_search_parent_tree (
-       u32                             target_name,
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_namespace_node      **return_node)
+acpi_ns_search_parent_tree(u32 target_name,
+                          struct acpi_namespace_node *node,
+                          acpi_object_type type,
+                          struct acpi_namespace_node **return_node)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *parent_node;
+       acpi_status status;
+       struct acpi_namespace_node *parent_node;
 
+       ACPI_FUNCTION_TRACE("ns_search_parent_tree");
 
-       ACPI_FUNCTION_TRACE ("ns_search_parent_tree");
-
-
-       parent_node = acpi_ns_get_parent_node (node);
+       parent_node = acpi_ns_get_parent_node(node);
 
        /*
         * If there is no parent (i.e., we are at the root) or type is "local",
         * we won't be searching the parent tree.
         */
        if (!parent_node) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
-                       (char *) &target_name));
-               return_ACPI_STATUS (AE_NOT_FOUND);
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
+                                 (char *)&target_name));
+               return_ACPI_STATUS(AE_NOT_FOUND);
        }
 
-       if (acpi_ns_local (type)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                       "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
-                       (char *) &target_name, acpi_ut_get_type_name (type)));
-               return_ACPI_STATUS (AE_NOT_FOUND);
+       if (acpi_ns_local(type)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                 "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
+                                 (char *)&target_name,
+                                 acpi_ut_get_type_name(type)));
+               return_ACPI_STATUS(AE_NOT_FOUND);
        }
 
        /* Search the parent tree */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-               "Searching parent [%4.4s] for [%4.4s]\n",
-               acpi_ut_get_node_name (parent_node), (char *) &target_name));
+       ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                         "Searching parent [%4.4s] for [%4.4s]\n",
+                         acpi_ut_get_node_name(parent_node),
+                         (char *)&target_name));
 
        /*
         * Search parents until target is found or we have backed up to the root
@@ -241,25 +238,24 @@ acpi_ns_search_parent_tree (
                 * object type at this point, we only care about the existence of
                 * the actual name we are searching for.  Typechecking comes later.
                 */
-               status = acpi_ns_search_node (target_name, parent_node,
-                                 ACPI_TYPE_ANY, return_node);
-               if (ACPI_SUCCESS (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ns_search_node(target_name, parent_node,
+                                            ACPI_TYPE_ANY, return_node);
+               if (ACPI_SUCCESS(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /*
                 * Not found here, go up another level
                 * (until we reach the root)
                 */
-               parent_node = acpi_ns_get_parent_node (parent_node);
+               parent_node = acpi_ns_get_parent_node(parent_node);
        }
 
        /* Not found in parent tree */
 
-       return_ACPI_STATUS (AE_NOT_FOUND);
+       return_ACPI_STATUS(AE_NOT_FOUND);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_search_and_enter
@@ -286,52 +282,46 @@ acpi_ns_search_parent_tree (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_search_and_enter (
-       u32                             target_name,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *node,
-       acpi_interpreter_mode           interpreter_mode,
-       acpi_object_type                type,
-       u32                             flags,
-       struct acpi_namespace_node      **return_node)
+acpi_ns_search_and_enter(u32 target_name,
+                        struct acpi_walk_state *walk_state,
+                        struct acpi_namespace_node *node,
+                        acpi_interpreter_mode interpreter_mode,
+                        acpi_object_type type,
+                        u32 flags, struct acpi_namespace_node **return_node)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *new_node;
-
-
-       ACPI_FUNCTION_TRACE ("ns_search_and_enter");
+       acpi_status status;
+       struct acpi_namespace_node *new_node;
 
+       ACPI_FUNCTION_TRACE("ns_search_and_enter");
 
        /* Parameter validation */
 
        if (!node || !target_name || !return_node) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Null param: Node %p Name %X return_node %p\n",
-                       node, target_name, return_node));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Null param: Node %p Name %X return_node %p\n",
+                                 node, target_name, return_node));
 
-               ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n"));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Name must consist of printable characters */
 
-       if (!acpi_ut_valid_acpi_name (target_name)) {
-               ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n",
-                       target_name));
-               return_ACPI_STATUS (AE_BAD_CHARACTER);
+       if (!acpi_ut_valid_acpi_name(target_name)) {
+               ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name));
+               return_ACPI_STATUS(AE_BAD_CHARACTER);
        }
 
        /* Try to find the name in the namespace level specified by the caller */
 
        *return_node = ACPI_ENTRY_NOT_FOUND;
-       status = acpi_ns_search_node (target_name, node, type, return_node);
+       status = acpi_ns_search_node(target_name, node, type, return_node);
        if (status != AE_NOT_FOUND) {
                /*
                 * If we found it AND the request specifies that a find is an error,
                 * return the error
                 */
-               if ((status == AE_OK) &&
-                       (flags & ACPI_NS_ERROR_IF_FOUND)) {
+               if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
                        status = AE_ALREADY_EXISTS;
                }
 
@@ -339,7 +329,7 @@ acpi_ns_search_and_enter (
                 * Either found it or there was an error
                 * -- finished either way
                 */
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -351,14 +341,16 @@ acpi_ns_search_and_enter (
         * and during the execution phase.
         */
        if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
-               (flags & ACPI_NS_SEARCH_PARENT)) {
+           (flags & ACPI_NS_SEARCH_PARENT)) {
                /*
                 * Not found at this level - search parent tree according to the
                 * ACPI specification
                 */
-               status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
-               if (ACPI_SUCCESS (status)) {
-                       return_ACPI_STATUS (status);
+               status =
+                   acpi_ns_search_parent_tree(target_name, node, type,
+                                              return_node);
+               if (ACPI_SUCCESS(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -366,25 +358,24 @@ acpi_ns_search_and_enter (
         * In execute mode, just search, never add names.  Exit now.
         */
        if (interpreter_mode == ACPI_IMODE_EXECUTE) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
-                       "%4.4s Not found in %p [Not adding]\n",
-                       (char *) &target_name, node));
+               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                 "%4.4s Not found in %p [Not adding]\n",
+                                 (char *)&target_name, node));
 
-               return_ACPI_STATUS (AE_NOT_FOUND);
+               return_ACPI_STATUS(AE_NOT_FOUND);
        }
 
        /* Create the new named object */
 
-       new_node = acpi_ns_create_node (target_name);
+       new_node = acpi_ns_create_node(target_name);
        if (!new_node) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Install the new object into the parent's list of children */
 
-       acpi_ns_install_node (walk_state, node, new_node, type);
+       acpi_ns_install_node(walk_state, node, new_node, type);
        *return_node = new_node;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index c53b82e94ce3b973a2f0cac18871166734e1ea97..ebec036423c9af25db4d25d029d946a5fce08a35 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/amlcode.h>
 #include <acpi/actables.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsutils")
+ACPI_MODULE_NAME("nsutils")
 
 /* Local prototypes */
-
-static u8
-acpi_ns_valid_path_separator (
-       char                            sep);
+static u8 acpi_ns_valid_path_separator(char sep);
 
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-acpi_name
-acpi_ns_find_parent_name (
-       struct acpi_namespace_node      *node_to_search);
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_report_error
@@ -81,51 +74,45 @@ acpi_ns_find_parent_name (
  ******************************************************************************/
 
 void
-acpi_ns_report_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       char                            *internal_name,
-       acpi_status                     lookup_status)
+acpi_ns_report_error(char *module_name,
+                    u32 line_number,
+                    u32 component_id,
+                    char *internal_name, acpi_status lookup_status)
 {
-       acpi_status                     status;
-       char                            *name = NULL;
-
+       acpi_status status;
+       char *name = NULL;
 
-       acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
-               module_name, line_number);
+       acpi_os_printf("%8s-%04d: *** Error: Looking up ",
+                      module_name, line_number);
 
        if (lookup_status == AE_BAD_CHARACTER) {
                /* There is a non-ascii character in the name */
 
-               acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
-                       *(ACPI_CAST_PTR (u32, internal_name)));
-       }
-       else {
+               acpi_os_printf("[0x%4.4X] (NON-ASCII)\n",
+                              *(ACPI_CAST_PTR(u32, internal_name)));
+       } else {
                /* Convert path to external format */
 
-               status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
-                                internal_name, NULL, &name);
+               status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
+                                                 internal_name, NULL, &name);
 
                /* Print target name */
 
-               if (ACPI_SUCCESS (status)) {
-                       acpi_os_printf ("[%s]", name);
-               }
-               else {
-                       acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
+               if (ACPI_SUCCESS(status)) {
+                       acpi_os_printf("[%s]", name);
+               } else {
+                       acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
                }
 
                if (name) {
-                       ACPI_MEM_FREE (name);
+                       ACPI_MEM_FREE(name);
                }
        }
 
-       acpi_os_printf (" in namespace, %s\n",
-               acpi_format_exception (lookup_status));
+       acpi_os_printf(" in namespace, %s\n",
+                      acpi_format_exception(lookup_status));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_report_method_error
@@ -145,34 +132,31 @@ acpi_ns_report_error (
  ******************************************************************************/
 
 void
-acpi_ns_report_method_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       char                            *message,
-       struct acpi_namespace_node      *prefix_node,
-       char                            *path,
-       acpi_status                     method_status)
+acpi_ns_report_method_error(char *module_name,
+                           u32 line_number,
+                           u32 component_id,
+                           char *message,
+                           struct acpi_namespace_node *prefix_node,
+                           char *path, acpi_status method_status)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node = prefix_node;
-
+       acpi_status status;
+       struct acpi_namespace_node *node = prefix_node;
 
        if (path) {
-               status = acpi_ns_get_node_by_path (path, prefix_node,
-                                ACPI_NS_NO_UPSEARCH, &node);
-               if (ACPI_FAILURE (status)) {
-                       acpi_os_printf ("report_method_error: Could not get node\n");
+               status = acpi_ns_get_node_by_path(path, prefix_node,
+                                                 ACPI_NS_NO_UPSEARCH, &node);
+               if (ACPI_FAILURE(status)) {
+                       acpi_os_printf
+                           ("report_method_error: Could not get node\n");
                        return;
                }
        }
 
-       acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
-       acpi_ns_print_node_pathname (node, message);
-       acpi_os_printf (", %s\n", acpi_format_exception (method_status));
+       acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
+       acpi_ns_print_node_pathname(node, message);
+       acpi_os_printf(", %s\n", acpi_format_exception(method_status));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_print_node_pathname
@@ -186,16 +170,13 @@ acpi_ns_report_method_error (
  ******************************************************************************/
 
 void
-acpi_ns_print_node_pathname (
-       struct acpi_namespace_node      *node,
-       char                            *message)
+acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
 {
-       struct acpi_buffer              buffer;
-       acpi_status                     status;
-
+       struct acpi_buffer buffer;
+       acpi_status status;
 
        if (!node) {
-               acpi_os_printf ("[NULL NAME]");
+               acpi_os_printf("[NULL NAME]");
                return;
        }
 
@@ -203,18 +184,17 @@ acpi_ns_print_node_pathname (
 
        buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
-       status = acpi_ns_handle_to_pathname (node, &buffer);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_ns_handle_to_pathname(node, &buffer);
+       if (ACPI_SUCCESS(status)) {
                if (message) {
-                       acpi_os_printf ("%s ", message);
+                       acpi_os_printf("%s ", message);
                }
 
-               acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
-               ACPI_MEM_FREE (buffer.pointer);
+               acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
+               ACPI_MEM_FREE(buffer.pointer);
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_valid_root_prefix
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname (
  *
  ******************************************************************************/
 
-u8
-acpi_ns_valid_root_prefix (
-       char                            prefix)
+u8 acpi_ns_valid_root_prefix(char prefix)
 {
 
        return ((u8) (prefix == '\\'));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_valid_path_separator
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix (
  *
  ******************************************************************************/
 
-static u8
-acpi_ns_valid_path_separator (
-       char                            sep)
+static u8 acpi_ns_valid_path_separator(char sep)
 {
 
        return ((u8) (sep == '.'));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_type
@@ -269,22 +243,18 @@ acpi_ns_valid_path_separator (
  *
  ******************************************************************************/
 
-acpi_object_type
-acpi_ns_get_type (
-       struct acpi_namespace_node      *node)
+acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 {
-       ACPI_FUNCTION_TRACE ("ns_get_type");
-
+       ACPI_FUNCTION_TRACE("ns_get_type");
 
        if (!node) {
-               ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n"));
-               return_VALUE (ACPI_TYPE_ANY);
+               ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
+               return_VALUE(ACPI_TYPE_ANY);
        }
 
-       return_VALUE ((acpi_object_type) node->type);
+       return_VALUE((acpi_object_type) node->type);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_local
@@ -298,24 +268,20 @@ acpi_ns_get_type (
  *
  ******************************************************************************/
 
-u32
-acpi_ns_local (
-       acpi_object_type                type)
+u32 acpi_ns_local(acpi_object_type type)
 {
-       ACPI_FUNCTION_TRACE ("ns_local");
-
+       ACPI_FUNCTION_TRACE("ns_local");
 
-       if (!acpi_ut_valid_object_type (type)) {
+       if (!acpi_ut_valid_object_type(type)) {
                /* Type code out of range  */
 
-               ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n"));
-               return_VALUE (ACPI_NS_NORMAL);
+               ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
+               return_VALUE(ACPI_NS_NORMAL);
        }
 
-       return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+       return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_internal_name_length
@@ -330,16 +296,12 @@ acpi_ns_local (
  *
  ******************************************************************************/
 
-void
-acpi_ns_get_internal_name_length (
-       struct acpi_namestring_info     *info)
+void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
 {
-       char                            *next_external_char;
-       u32                             i;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       char *next_external_char;
+       u32 i;
 
+       ACPI_FUNCTION_ENTRY();
 
        next_external_char = info->external_name;
        info->num_carats = 0;
@@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length (
         *
         * strlen() + 1 covers the first name_seg, which has no path separator
         */
-       if (acpi_ns_valid_root_prefix (next_external_char[0])) {
+       if (acpi_ns_valid_root_prefix(next_external_char[0])) {
                info->fully_qualified = TRUE;
                next_external_char++;
-       }
-       else {
+       } else {
                /*
                 * Handle Carat prefixes
                 */
@@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length (
        if (*next_external_char) {
                info->num_segments = 1;
                for (i = 0; next_external_char[i]; i++) {
-                       if (acpi_ns_valid_path_separator (next_external_char[i])) {
+                       if (acpi_ns_valid_path_separator(next_external_char[i])) {
                                info->num_segments++;
                        }
                }
        }
 
        info->length = (ACPI_NAME_SIZE * info->num_segments) +
-                         4 + info->num_carats;
+           4 + info->num_carats;
 
        info->next_external_char = next_external_char;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_build_internal_name
@@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ns_build_internal_name (
-       struct acpi_namestring_info     *info)
+acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
 {
-       u32                             num_segments = info->num_segments;
-       char                            *internal_name = info->internal_name;
-       char                            *external_name = info->next_external_char;
-       char                            *result = NULL;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_TRACE ("ns_build_internal_name");
+       u32 num_segments = info->num_segments;
+       char *internal_name = info->internal_name;
+       char *external_name = info->next_external_char;
+       char *result = NULL;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE("ns_build_internal_name");
 
        /* Setup the correct prefixes, counts, and pointers */
 
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name (
 
                if (num_segments <= 1) {
                        result = &internal_name[1];
-               }
-               else if (num_segments == 2) {
+               } else if (num_segments == 2) {
                        internal_name[1] = AML_DUAL_NAME_PREFIX;
                        result = &internal_name[2];
-               }
-               else {
+               } else {
                        internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
-                       internal_name[2] = (char) num_segments;
+                       internal_name[2] = (char)num_segments;
                        result = &internal_name[3];
                }
-       }
-       else {
+       } else {
                /*
                 * Not fully qualified.
                 * Handle Carats first, then append the name segments
@@ -447,15 +400,14 @@ acpi_ns_build_internal_name (
 
                if (num_segments <= 1) {
                        result = &internal_name[i];
-               }
-               else if (num_segments == 2) {
+               } else if (num_segments == 2) {
                        internal_name[i] = AML_DUAL_NAME_PREFIX;
-                       result = &internal_name[(acpi_native_uint) (i+1)];
-               }
-               else {
+                       result = &internal_name[(acpi_native_uint) (i + 1)];
+               } else {
                        internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
-                       internal_name[(acpi_native_uint) (i+1)] = (char) num_segments;
-                       result = &internal_name[(acpi_native_uint) (i+2)];
+                       internal_name[(acpi_native_uint) (i + 1)] =
+                           (char)num_segments;
+                       result = &internal_name[(acpi_native_uint) (i + 2)];
                }
        }
 
@@ -463,25 +415,25 @@ acpi_ns_build_internal_name (
 
        for (; num_segments; num_segments--) {
                for (i = 0; i < ACPI_NAME_SIZE; i++) {
-                       if (acpi_ns_valid_path_separator (*external_name) ||
-                          (*external_name == 0)) {
+                       if (acpi_ns_valid_path_separator(*external_name) ||
+                           (*external_name == 0)) {
                                /* Pad the segment with underscore(s) if segment is short */
 
                                result[i] = '_';
-                       }
-                       else {
+                       } else {
                                /* Convert the character to uppercase and save it */
 
-                               result[i] = (char) ACPI_TOUPPER ((int) *external_name);
+                               result[i] =
+                                   (char)ACPI_TOUPPER((int)*external_name);
                                external_name++;
                        }
                }
 
                /* Now we must have a path separator, or the pathname is bad */
 
-               if (!acpi_ns_valid_path_separator (*external_name) &&
-                       (*external_name != 0)) {
-                       return_ACPI_STATUS (AE_BAD_PARAMETER);
+               if (!acpi_ns_valid_path_separator(*external_name) &&
+                   (*external_name != 0)) {
+                       return_ACPI_STATUS(AE_BAD_PARAMETER);
                }
 
                /* Move on the next segment */
@@ -495,18 +447,17 @@ acpi_ns_build_internal_name (
        *result = 0;
 
        if (info->fully_qualified) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
-                       internal_name, internal_name));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
-                       internal_name, internal_name));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Returning [%p] (abs) \"\\%s\"\n",
+                                 internal_name, internal_name));
+       else {
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
+                                 internal_name, internal_name));
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_internalize_name
@@ -522,51 +473,43 @@ acpi_ns_build_internal_name (
  *
  *******************************************************************************/
 
-acpi_status
-acpi_ns_internalize_name (
-       char                            *external_name,
-       char                            **converted_name)
+acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
 {
-       char                            *internal_name;
-       struct acpi_namestring_info     info;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ns_internalize_name");
+       char *internal_name;
+       struct acpi_namestring_info info;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ns_internalize_name");
 
-       if ((!external_name)     ||
-               (*external_name == 0) ||
-               (!converted_name)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((!external_name) || (*external_name == 0) || (!converted_name)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get the length of the new internal name */
 
        info.external_name = external_name;
-       acpi_ns_get_internal_name_length (&info);
+       acpi_ns_get_internal_name_length(&info);
 
        /* We need a segment to store the internal  name */
 
-       internal_name = ACPI_MEM_CALLOCATE (info.length);
+       internal_name = ACPI_MEM_CALLOCATE(info.length);
        if (!internal_name) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Build the name */
 
        info.internal_name = internal_name;
-       status = acpi_ns_build_internal_name (&info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_MEM_FREE (internal_name);
-               return_ACPI_STATUS (status);
+       status = acpi_ns_build_internal_name(&info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(internal_name);
+               return_ACPI_STATUS(status);
        }
 
        *converted_name = internal_name;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_externalize_name
@@ -585,27 +528,21 @@ acpi_ns_internalize_name (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_externalize_name (
-       u32                             internal_name_length,
-       char                            *internal_name,
-       u32                             *converted_name_length,
-       char                            **converted_name)
+acpi_ns_externalize_name(u32 internal_name_length,
+                        char *internal_name,
+                        u32 * converted_name_length, char **converted_name)
 {
-       acpi_native_uint                names_index = 0;
-       acpi_native_uint                num_segments = 0;
-       acpi_native_uint                required_length;
-       acpi_native_uint                prefix_length = 0;
-       acpi_native_uint                i = 0;
-       acpi_native_uint                j = 0;
-
+       acpi_native_uint names_index = 0;
+       acpi_native_uint num_segments = 0;
+       acpi_native_uint required_length;
+       acpi_native_uint prefix_length = 0;
+       acpi_native_uint i = 0;
+       acpi_native_uint j = 0;
 
-       ACPI_FUNCTION_TRACE ("ns_externalize_name");
+       ACPI_FUNCTION_TRACE("ns_externalize_name");
 
-
-       if (!internal_name_length   ||
-               !internal_name          ||
-               !converted_name) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if (!internal_name_length || !internal_name || !converted_name) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -620,8 +557,7 @@ acpi_ns_externalize_name (
                for (i = 0; i < internal_name_length; i++) {
                        if (internal_name[i] == '^') {
                                prefix_length = i + 1;
-                       }
-                       else {
+                       } else {
                                break;
                        }
                }
@@ -648,7 +584,8 @@ acpi_ns_externalize_name (
 
                        names_index = prefix_length + 2;
                        num_segments = (acpi_native_uint) (u8)
-                                          internal_name[(acpi_native_uint) (prefix_length + 1)];
+                           internal_name[(acpi_native_uint)
+                                         (prefix_length + 1)];
                        break;
 
                case AML_DUAL_NAME_PREFIX:
@@ -683,23 +620,23 @@ acpi_ns_externalize_name (
         * punctuation ('.') between object names, plus the NULL terminator.
         */
        required_length = prefix_length + (4 * num_segments) +
-                          ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
+           ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
 
        /*
         * Check to see if we're still in bounds.  If not, there's a problem
         * with internal_name (invalid format).
         */
        if (required_length > internal_name_length) {
-               ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n"));
-               return_ACPI_STATUS (AE_BAD_PATHNAME);
+               ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n"));
+               return_ACPI_STATUS(AE_BAD_PATHNAME);
        }
 
        /*
         * Build converted_name
         */
-       *converted_name = ACPI_MEM_CALLOCATE (required_length);
+       *converted_name = ACPI_MEM_CALLOCATE(required_length);
        if (!(*converted_name)) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        j = 0;
@@ -725,10 +662,9 @@ acpi_ns_externalize_name (
                *converted_name_length = (u32) required_length;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_map_handle_to_node
@@ -745,13 +681,10 @@ acpi_ns_externalize_name (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_map_handle_to_node (
-       acpi_handle                     handle)
+struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
 {
 
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        /*
         * Simple implementation.
@@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node (
 
        /* We can at least attempt to verify the handle */
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
                return (NULL);
        }
 
-       return ((struct acpi_namespace_node *) handle);
+       return ((struct acpi_namespace_node *)handle);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_convert_entry_to_handle
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node (
  *
  ******************************************************************************/
 
-acpi_handle
-acpi_ns_convert_entry_to_handle (
-       struct acpi_namespace_node          *node)
+acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
 {
 
-
        /*
         * Simple implementation for now;
         */
        return ((acpi_handle) node);
 
-
 /* Example future implementation ---------------------
 
        if (!Node)
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle (
                return (ACPI_ROOT_OBJECT);
        }
 
-
        return ((acpi_handle) Node);
 ------------------------------------------------------*/
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_terminate
@@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle (
  *
  ******************************************************************************/
 
-void
-acpi_ns_terminate (
-       void)
+void acpi_ns_terminate(void)
 {
-       union acpi_operand_object       *obj_desc;
-
-
-       ACPI_FUNCTION_TRACE ("ns_terminate");
+       union acpi_operand_object *obj_desc;
 
+       ACPI_FUNCTION_TRACE("ns_terminate");
 
        /*
         * 1) Free the entire namespace -- all nodes and objects
         *
         * Delete all object descriptors attached to namepsace nodes
         */
-       acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
+       acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
 
        /* Detach any objects attached to the root */
 
-       obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
+       obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
        if (obj_desc) {
-               acpi_ns_detach_object (acpi_gbl_root_node);
+               acpi_ns_detach_object(acpi_gbl_root_node);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
 
        /*
         * 2) Now we can delete the ACPI tables
         */
-       acpi_tb_delete_all_tables ();
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+       acpi_tb_delete_all_tables();
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_opens_scope
@@ -875,24 +796,21 @@ acpi_ns_terminate (
  *
  ******************************************************************************/
 
-u32
-acpi_ns_opens_scope (
-       acpi_object_type                type)
+u32 acpi_ns_opens_scope(acpi_object_type type)
 {
-       ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type));
-
+       ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
 
-       if (!acpi_ut_valid_object_type (type)) {
+       if (!acpi_ut_valid_object_type(type)) {
                /* type code out of range  */
 
-               ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
-               return_VALUE (ACPI_NS_NORMAL);
+               ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
+                                    type));
+               return_VALUE(ACPI_NS_NORMAL);
        }
 
-       return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
+       return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_node_by_path
@@ -916,33 +834,29 @@ acpi_ns_opens_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_get_node_by_path (
-       char                            *pathname,
-       struct acpi_namespace_node      *start_node,
-       u32                             flags,
-       struct acpi_namespace_node      **return_node)
+acpi_ns_get_node_by_path(char *pathname,
+                        struct acpi_namespace_node *start_node,
+                        u32 flags, struct acpi_namespace_node **return_node)
 {
-       union acpi_generic_state        scope_info;
-       acpi_status                     status;
-       char                            *internal_path = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname);
+       union acpi_generic_state scope_info;
+       acpi_status status;
+       char *internal_path = NULL;
 
+       ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
 
        if (pathname) {
                /* Convert path to internal representation */
 
-               status = acpi_ns_internalize_name (pathname, &internal_path);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ns_internalize_name(pathname, &internal_path);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Must lock namespace during lookup */
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -952,25 +866,25 @@ acpi_ns_get_node_by_path (
 
        /* Lookup the name in the namespace */
 
-       status = acpi_ns_lookup (&scope_info, internal_path,
-                        ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                        (flags | ACPI_NS_DONT_OPEN_SCOPE),
-                        NULL, return_node);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
-                               internal_path, acpi_format_exception (status)));
+       status = acpi_ns_lookup(&scope_info, internal_path,
+                               ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+                               (flags | ACPI_NS_DONT_OPEN_SCOPE),
+                               NULL, return_node);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
+                                 internal_path,
+                                 acpi_format_exception(status)));
        }
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
-cleanup:
+      cleanup:
        if (internal_path) {
-               ACPI_MEM_FREE (internal_path);
+               ACPI_MEM_FREE(internal_path);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_parent_node
@@ -983,12 +897,10 @@ cleanup:
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_get_parent_node (
-       struct acpi_namespace_node      *node)
+struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
+                                                   *node)
 {
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        if (!node) {
                return (NULL);
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node (
        return (node->peer);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_next_valid_node
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node (
  *
  ******************************************************************************/
 
-struct acpi_namespace_node *
-acpi_ns_get_next_valid_node (
-       struct acpi_namespace_node      *node)
+struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
+                                                       acpi_namespace_node
+                                                       *node)
 {
 
        /* If we are at the end of this peer list, return NULL */
@@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node (
        return (node->peer);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node (
  *
  ******************************************************************************/
 
-acpi_name
-acpi_ns_find_parent_name (
-       struct acpi_namespace_node      *child_node)
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
 {
-       struct acpi_namespace_node      *parent_node;
-
-
-       ACPI_FUNCTION_TRACE ("ns_find_parent_name");
+       struct acpi_namespace_node *parent_node;
 
+       ACPI_FUNCTION_TRACE("ns_find_parent_name");
 
        if (child_node) {
                /* Valid entry.  Get the parent Node */
 
-               parent_node = acpi_ns_get_parent_node (child_node);
+               parent_node = acpi_ns_get_parent_node(child_node);
                if (parent_node) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "Parent of %p [%4.4s] is %p [%4.4s]\n",
-                               child_node, acpi_ut_get_node_name (child_node),
-                               parent_node, acpi_ut_get_node_name (parent_node)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "Parent of %p [%4.4s] is %p [%4.4s]\n",
+                                         child_node,
+                                         acpi_ut_get_node_name(child_node),
+                                         parent_node,
+                                         acpi_ut_get_node_name(parent_node)));
 
                        if (parent_node->name.integer) {
-                               return_VALUE ((acpi_name) parent_node->name.integer);
+                               return_VALUE((acpi_name) parent_node->name.
+                                            integer);
                        }
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "Unable to find parent of %p (%4.4s)\n",
-                       child_node, acpi_ut_get_node_name (child_node)));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "Unable to find parent of %p (%4.4s)\n",
+                                 child_node,
+                                 acpi_ut_get_node_name(child_node)));
        }
 
-       return_VALUE (ACPI_UNKNOWN_NAME);
+       return_VALUE(ACPI_UNKNOWN_NAME);
 }
 #endif
-
-
index f9a7277dca6ea916490038997eeab5a00a325cf5..5f164c0df33b15e34a7dd4eb9638c5d2449cc319 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nswalk")
-
+ACPI_MODULE_NAME("nswalk")
 
 /*******************************************************************************
  *
  *              within Scope is returned.
  *
  ******************************************************************************/
-
-struct acpi_namespace_node *
-acpi_ns_get_next_node (
-       acpi_object_type                type,
-       struct acpi_namespace_node      *parent_node,
-       struct acpi_namespace_node      *child_node)
+struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
+                                                 struct acpi_namespace_node
+                                                 *parent_node,
+                                                 struct acpi_namespace_node
+                                                 *child_node)
 {
-       struct acpi_namespace_node      *next_node = NULL;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_namespace_node *next_node = NULL;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (!child_node) {
                /* It's really the parent's _scope_ that we want */
@@ -92,7 +86,7 @@ acpi_ns_get_next_node (
        else {
                /* Start search at the NEXT node */
 
-               next_node = acpi_ns_get_next_valid_node (child_node);
+               next_node = acpi_ns_get_next_valid_node(child_node);
        }
 
        /* If any type is OK, we are done */
@@ -114,7 +108,7 @@ acpi_ns_get_next_node (
 
                /* Otherwise, move on to the next node */
 
-               next_node = acpi_ns_get_next_valid_node (next_node);
+               next_node = acpi_ns_get_next_valid_node(next_node);
        }
 
        /* Not found */
@@ -122,7 +116,6 @@ acpi_ns_get_next_node (
        return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_walk_namespace
@@ -154,25 +147,21 @@ acpi_ns_get_next_node (
  ******************************************************************************/
 
 acpi_status
-acpi_ns_walk_namespace (
-       acpi_object_type                type,
-       acpi_handle                     start_node,
-       u32                             max_depth,
-       u8                              unlock_before_callback,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_walk_namespace(acpi_object_type type,
+                      acpi_handle start_node,
+                      u32 max_depth,
+                      u8 unlock_before_callback,
+                      acpi_walk_callback user_function,
+                      void *context, void **return_value)
 {
-       acpi_status                     status;
-       acpi_status                     mutex_status;
-       struct acpi_namespace_node      *child_node;
-       struct acpi_namespace_node      *parent_node;
-       acpi_object_type                child_type;
-       u32                             level;
-
-
-       ACPI_FUNCTION_TRACE ("ns_walk_namespace");
+       acpi_status status;
+       acpi_status mutex_status;
+       struct acpi_namespace_node *child_node;
+       struct acpi_namespace_node *parent_node;
+       acpi_object_type child_type;
+       u32 level;
 
+       ACPI_FUNCTION_TRACE("ns_walk_namespace");
 
        /* Special case for the namespace Root Node */
 
@@ -183,9 +172,9 @@ acpi_ns_walk_namespace (
        /* Null child means "get first node" */
 
        parent_node = start_node;
-       child_node  = NULL;
-       child_type  = ACPI_TYPE_ANY;
-       level       = 1;
+       child_node = NULL;
+       child_type = ACPI_TYPE_ANY;
+       level = 1;
 
        /*
         * Traverse the tree of nodes until we bubble back up to where we
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace (
                /* Get the next node in this scope.  Null if not found */
 
                status = AE_OK;
-               child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+               child_node =
+                   acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+                                         child_node);
                if (child_node) {
                        /*
                         * Found node, Get the type if we are not
@@ -212,19 +203,25 @@ acpi_ns_walk_namespace (
                                 * callback function
                                 */
                                if (unlock_before_callback) {
-                                       mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-                                       if (ACPI_FAILURE (mutex_status)) {
-                                               return_ACPI_STATUS (mutex_status);
+                                       mutex_status =
+                                           acpi_ut_release_mutex
+                                           (ACPI_MTX_NAMESPACE);
+                                       if (ACPI_FAILURE(mutex_status)) {
+                                               return_ACPI_STATUS
+                                                   (mutex_status);
                                        }
                                }
 
-                               status = user_function (child_node, level,
-                                                context, return_value);
+                               status = user_function(child_node, level,
+                                                      context, return_value);
 
                                if (unlock_before_callback) {
-                                       mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-                                       if (ACPI_FAILURE (mutex_status)) {
-                                               return_ACPI_STATUS (mutex_status);
+                                       mutex_status =
+                                           acpi_ut_acquire_mutex
+                                           (ACPI_MTX_NAMESPACE);
+                                       if (ACPI_FAILURE(mutex_status)) {
+                                               return_ACPI_STATUS
+                                                   (mutex_status);
                                        }
                                }
 
@@ -239,13 +236,13 @@ acpi_ns_walk_namespace (
 
                                        /* Exit now, with OK status */
 
-                                       return_ACPI_STATUS (AE_OK);
+                                       return_ACPI_STATUS(AE_OK);
 
                                default:
 
                                        /* All others are valid exceptions */
 
-                                       return_ACPI_STATUS (status);
+                                       return_ACPI_STATUS(status);
                                }
                        }
 
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace (
                         * maximum depth has been reached.
                         */
                        if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
-                               if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+                               if (acpi_ns_get_next_node
+                                   (ACPI_TYPE_ANY, child_node, NULL)) {
                                        /*
                                         * There is at least one child of this
                                         * node, visit the onde
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace (
                                        child_node = NULL;
                                }
                        }
-               }
-               else {
+               } else {
                        /*
                         * No more children of this node (acpi_ns_get_next_node
                         * failed), go back upwards in the namespace tree to
@@ -277,13 +274,11 @@ acpi_ns_walk_namespace (
                         */
                        level--;
                        child_node = parent_node;
-                       parent_node = acpi_ns_get_parent_node (parent_node);
+                       parent_node = acpi_ns_get_parent_node(parent_node);
                }
        }
 
        /* Complete walk, not terminated by user function */
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 12ea202257fa257dd0f6277baf31d9ab964ade1f..c07b046659ff6c9dd298bf9ca6afd7dbdefce089 100644 (file)
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsxfeval")
-
+ACPI_MODULE_NAME("nsxfeval")
 
 /*******************************************************************************
  *
  *              be valid (non-null)
  *
  ******************************************************************************/
-
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_evaluate_object_typed (
-       acpi_handle                     handle,
-       acpi_string                     pathname,
-       struct acpi_object_list         *external_params,
-       struct acpi_buffer              *return_buffer,
-       acpi_object_type                return_type)
+acpi_evaluate_object_typed(acpi_handle handle,
+                          acpi_string pathname,
+                          struct acpi_object_list *external_params,
+                          struct acpi_buffer *return_buffer,
+                          acpi_object_type return_type)
 {
-       acpi_status                     status;
-       u8                              must_free = FALSE;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed");
+       acpi_status status;
+       u8 must_free = FALSE;
 
+       ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
 
        /* Return buffer must be valid */
 
        if (!return_buffer) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
@@ -102,51 +96,52 @@ acpi_evaluate_object_typed (
 
        /* Evaluate the object */
 
-       status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_evaluate_object(handle, pathname, external_params,
+                                return_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Type ANY means "don't care" */
 
        if (return_type == ACPI_TYPE_ANY) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        if (return_buffer->length == 0) {
                /* Error because caller specifically asked for a return value */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "No return value\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n"));
 
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+               return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
        /* Examine the object type returned from evaluate_object */
 
-       if (((union acpi_object *) return_buffer->pointer)->type == return_type) {
-               return_ACPI_STATUS (AE_OK);
+       if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Return object type does not match requested type */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-               "Incorrect return type [%s] requested [%s]\n",
-               acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type),
-               acpi_ut_get_type_name (return_type)));
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "Incorrect return type [%s] requested [%s]\n",
+                         acpi_ut_get_type_name(((union acpi_object *)
+                                                return_buffer->pointer)->type),
+                         acpi_ut_get_type_name(return_type)));
 
        if (must_free) {
                /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
 
-               acpi_os_free (return_buffer->pointer);
+               acpi_os_free(return_buffer->pointer);
                return_buffer->pointer = NULL;
        }
 
        return_buffer->length = 0;
-       return_ACPI_STATUS (AE_TYPE);
+       return_ACPI_STATUS(AE_TYPE);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -169,21 +164,18 @@ acpi_evaluate_object_typed (
  ******************************************************************************/
 
 acpi_status
-acpi_evaluate_object (
-       acpi_handle                     handle,
-       acpi_string                     pathname,
-       struct acpi_object_list         *external_params,
-       struct acpi_buffer              *return_buffer)
+acpi_evaluate_object(acpi_handle handle,
+                    acpi_string pathname,
+                    struct acpi_object_list *external_params,
+                    struct acpi_buffer *return_buffer)
 {
-       acpi_status                     status;
-       acpi_status                     status2;
-       struct acpi_parameter_info      info;
-       acpi_size                       buffer_space_needed;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_evaluate_object");
+       acpi_status status;
+       acpi_status status2;
+       struct acpi_parameter_info info;
+       acpi_size buffer_space_needed;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("acpi_evaluate_object");
 
        info.node = handle;
        info.parameters = NULL;
@@ -200,11 +192,11 @@ acpi_evaluate_object (
                 * Allocate a new parameter block for the internal objects
                 * Add 1 to count to allow for null terminated internal list
                 */
-               info.parameters = ACPI_MEM_CALLOCATE (
-                                ((acpi_size) external_params->count + 1) *
-                                sizeof (void *));
+               info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
+                                                     external_params->count +
+                                                     1) * sizeof(void *));
                if (!info.parameters) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /*
@@ -212,48 +204,47 @@ acpi_evaluate_object (
                 * internal object
                 */
                for (i = 0; i < external_params->count; i++) {
-                       status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
-                                         &info.parameters[i]);
-                       if (ACPI_FAILURE (status)) {
-                               acpi_ut_delete_internal_object_list (info.parameters);
-                               return_ACPI_STATUS (status);
+                       status =
+                           acpi_ut_copy_eobject_to_iobject(&external_params->
+                                                           pointer[i],
+                                                           &info.
+                                                           parameters[i]);
+                       if (ACPI_FAILURE(status)) {
+                               acpi_ut_delete_internal_object_list(info.
+                                                                   parameters);
+                               return_ACPI_STATUS(status);
                        }
                }
                info.parameters[external_params->count] = NULL;
        }
 
-
        /*
         * Three major cases:
         * 1) Fully qualified pathname
         * 2) No handle, not fully qualified pathname (error)
         * 3) Valid handle
         */
-       if ((pathname) &&
-               (acpi_ns_valid_root_prefix (pathname[0]))) {
+       if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
                /*
                 *  The path is fully qualified, just evaluate by name
                 */
-               status = acpi_ns_evaluate_by_name (pathname, &info);
-       }
-       else if (!handle) {
+               status = acpi_ns_evaluate_by_name(pathname, &info);
+       } else if (!handle) {
                /*
                 * A handle is optional iff a fully qualified pathname
                 * is specified.  Since we've already handled fully
                 * qualified names above, this is an error
                 */
                if (!pathname) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Both Handle and Pathname are NULL\n"));
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Handle is NULL and Pathname is relative\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Both Handle and Pathname are NULL\n"));
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Handle is NULL and Pathname is relative\n"));
                }
 
                status = AE_BAD_PARAMETER;
-       }
-       else {
+       } else {
                /*
                 * We get here if we have a handle -- and if we have a
                 * pathname it is relative.  The handle will be validated
@@ -264,17 +255,15 @@ acpi_evaluate_object (
                         * The null pathname case means the handle is for
                         * the actual object to be evaluated
                         */
-                       status = acpi_ns_evaluate_by_handle (&info);
-               }
-               else {
-                  /*
-                       * Both a Handle and a relative Pathname
-                       */
-                       status = acpi_ns_evaluate_relative (pathname, &info);
+                       status = acpi_ns_evaluate_by_handle(&info);
+               } else {
+                       /*
+                        * Both a Handle and a relative Pathname
+                        */
+                       status = acpi_ns_evaluate_relative(pathname, &info);
                }
        }
 
-
        /*
         * If we are expecting a return value, and all went well above,
         * copy the return value to an external object.
@@ -282,9 +271,9 @@ acpi_evaluate_object (
        if (return_buffer) {
                if (!info.return_object) {
                        return_buffer->length = 0;
-               }
-               else {
-                       if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
+               } else {
+                       if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
+                           ACPI_DESC_TYPE_NAMED) {
                                /*
                                 * If we received a NS Node as a return object, this means that
                                 * the object we are evaluating has nothing interesting to
@@ -294,37 +283,43 @@ acpi_evaluate_object (
                                 * support for various types at a later date if necessary.
                                 */
                                status = AE_TYPE;
-                               info.return_object = NULL;  /* No need to delete a NS Node */
+                               info.return_object = NULL;      /* No need to delete a NS Node */
                                return_buffer->length = 0;
                        }
 
-                       if (ACPI_SUCCESS (status)) {
+                       if (ACPI_SUCCESS(status)) {
                                /*
                                 * Find out how large a buffer is needed
                                 * to contain the returned object
                                 */
-                               status = acpi_ut_get_object_size (info.return_object,
-                                                  &buffer_space_needed);
-                               if (ACPI_SUCCESS (status)) {
+                               status =
+                                   acpi_ut_get_object_size(info.return_object,
+                                                           &buffer_space_needed);
+                               if (ACPI_SUCCESS(status)) {
                                        /* Validate/Allocate/Clear caller buffer */
 
-                                       status = acpi_ut_initialize_buffer (return_buffer,
-                                                         buffer_space_needed);
-                                       if (ACPI_FAILURE (status)) {
+                                       status =
+                                           acpi_ut_initialize_buffer
+                                           (return_buffer,
+                                            buffer_space_needed);
+                                       if (ACPI_FAILURE(status)) {
                                                /*
                                                 * Caller's buffer is too small or a new one can't be allocated
                                                 */
-                                               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                                                       "Needed buffer size %X, %s\n",
-                                                       (u32) buffer_space_needed,
-                                                       acpi_format_exception (status)));
-                                       }
-                                       else {
+                                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                                 "Needed buffer size %X, %s\n",
+                                                                 (u32)
+                                                                 buffer_space_needed,
+                                                                 acpi_format_exception
+                                                                 (status)));
+                                       } else {
                                                /*
                                                 *  We have enough space for the object, build it
                                                 */
-                                               status = acpi_ut_copy_iobject_to_eobject (info.return_object,
-                                                                 return_buffer);
+                                               status =
+                                                   acpi_ut_copy_iobject_to_eobject
+                                                   (info.return_object,
+                                                    return_buffer);
                                        }
                                }
                        }
@@ -336,14 +331,14 @@ acpi_evaluate_object (
                 * Delete the internal return object.  NOTE: Interpreter
                 * must be locked to avoid race condition.
                 */
-               status2 = acpi_ex_enter_interpreter ();
-               if (ACPI_SUCCESS (status2)) {
+               status2 = acpi_ex_enter_interpreter();
+               if (ACPI_SUCCESS(status2)) {
                        /*
                         * Delete the internal return object. (Or at least
                         * decrement the reference count by one)
                         */
-                       acpi_ut_remove_reference (info.return_object);
-                       acpi_ex_exit_interpreter ();
+                       acpi_ut_remove_reference(info.return_object);
+                       acpi_ex_exit_interpreter();
                }
        }
 
@@ -353,13 +348,13 @@ acpi_evaluate_object (
        if (info.parameters) {
                /* Free the allocated parameter block */
 
-               acpi_ut_delete_internal_object_list (info.parameters);
+               acpi_ut_delete_internal_object_list(info.parameters);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_evaluate_object);
 
+EXPORT_SYMBOL(acpi_evaluate_object);
 
 /*******************************************************************************
  *
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object);
  ******************************************************************************/
 
 acpi_status
-acpi_walk_namespace (
-       acpi_object_type                type,
-       acpi_handle                     start_object,
-       u32                             max_depth,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value)
+acpi_walk_namespace(acpi_object_type type,
+                   acpi_handle start_object,
+                   u32 max_depth,
+                   acpi_walk_callback user_function,
+                   void *context, void **return_value)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_walk_namespace");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_walk_namespace");
 
        /* Parameter validation */
 
-       if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
-               (!max_depth)                    ||
-               (!user_function)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -420,20 +409,20 @@ acpi_walk_namespace (
         * to the user function - since this function
         * must be allowed to make Acpi calls itself.
         */
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ns_walk_namespace (type, start_object, max_depth,
-                         ACPI_NS_WALK_UNLOCK,
-                         user_function, context, return_value);
+       status = acpi_ns_walk_namespace(type, start_object, max_depth,
+                                       ACPI_NS_WALK_UNLOCK,
+                                       user_function, context, return_value);
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_walk_namespace);
 
+EXPORT_SYMBOL(acpi_walk_namespace);
 
 /*******************************************************************************
  *
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace);
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_get_device_callback (
-       acpi_handle                     obj_handle,
-       u32                             nesting_level,
-       void                            *context,
-       void                            **return_value)
+acpi_ns_get_device_callback(acpi_handle obj_handle,
+                           u32 nesting_level,
+                           void *context, void **return_value)
 {
-       struct acpi_get_devices_info    *info = context;
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       u32                             flags;
-       struct acpi_device_id           hid;
+       struct acpi_get_devices_info *info = context;
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       u32 flags;
+       struct acpi_device_id hid;
        struct acpi_compatible_id_list *cid;
-       acpi_native_uint                i;
-
+       acpi_native_uint i;
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
-       status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       node = acpi_ns_map_handle_to_node(obj_handle);
+       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
@@ -482,8 +468,8 @@ acpi_ns_get_device_callback (
 
        /* Run _STA to determine if device is present */
 
-       status = acpi_ut_execute_STA (node, &flags);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_execute_STA(node, &flags);
+       if (ACPI_FAILURE(status)) {
                return (AE_CTRL_DEPTH);
        }
 
@@ -496,44 +482,43 @@ acpi_ns_get_device_callback (
        /* Filter based on device HID & CID */
 
        if (info->hid != NULL) {
-               status = acpi_ut_execute_HID (node, &hid);
+               status = acpi_ut_execute_HID(node, &hid);
                if (status == AE_NOT_FOUND) {
                        return (AE_OK);
-               }
-               else if (ACPI_FAILURE (status)) {
+               } else if (ACPI_FAILURE(status)) {
                        return (AE_CTRL_DEPTH);
                }
 
-               if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) {
+               if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
                        /* Get the list of Compatible IDs */
 
-                       status = acpi_ut_execute_CID (node, &cid);
+                       status = acpi_ut_execute_CID(node, &cid);
                        if (status == AE_NOT_FOUND) {
                                return (AE_OK);
-                       }
-                       else if (ACPI_FAILURE (status)) {
+                       } else if (ACPI_FAILURE(status)) {
                                return (AE_CTRL_DEPTH);
                        }
 
                        /* Walk the CID list */
 
                        for (i = 0; i < cid->count; i++) {
-                               if (ACPI_STRNCMP (cid->id[i].value, info->hid,
-                                                sizeof (struct acpi_compatible_id)) != 0) {
-                                       ACPI_MEM_FREE (cid);
+                               if (ACPI_STRNCMP(cid->id[i].value, info->hid,
+                                                sizeof(struct
+                                                       acpi_compatible_id)) !=
+                                   0) {
+                                       ACPI_MEM_FREE(cid);
                                        return (AE_OK);
                                }
                        }
-                       ACPI_MEM_FREE (cid);
+                       ACPI_MEM_FREE(cid);
                }
        }
 
-       status = info->user_function (obj_handle, nesting_level, info->context,
-                        return_value);
+       status = info->user_function(obj_handle, nesting_level, info->context,
+                                    return_value);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_devices
@@ -560,32 +545,28 @@ acpi_ns_get_device_callback (
  ******************************************************************************/
 
 acpi_status
-acpi_get_devices (
-       char                            *HID,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value)
+acpi_get_devices(char *HID,
+                acpi_walk_callback user_function,
+                void *context, void **return_value)
 {
-       acpi_status                     status;
-       struct acpi_get_devices_info    info;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_devices");
+       acpi_status status;
+       struct acpi_get_devices_info info;
 
+       ACPI_FUNCTION_TRACE("acpi_get_devices");
 
        /* Parameter validation */
 
        if (!user_function) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
         * We're going to call their callback from OUR callback, so we need
         * to know what it is, and their context parameter.
         */
-       info.context      = context;
+       info.context = context;
        info.user_function = user_function;
-       info.hid          = HID;
+       info.hid = HID;
 
        /*
         * Lock the namespace around the walk.
@@ -593,22 +574,22 @@ acpi_get_devices (
         * to the user function - since this function
         * must be allowed to make Acpi calls itself.
         */
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
-                          ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                          ACPI_NS_WALK_UNLOCK,
-                          acpi_ns_get_device_callback, &info,
-                          return_value);
+       status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
+                                       ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+                                       ACPI_NS_WALK_UNLOCK,
+                                       acpi_ns_get_device_callback, &info,
+                                       return_value);
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       return_ACPI_STATUS (status);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_devices);
 
+EXPORT_SYMBOL(acpi_get_devices);
 
 /*******************************************************************************
  *
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices);
  ******************************************************************************/
 
 acpi_status
-acpi_attach_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler,
-       void                            *data)
+acpi_attach_data(acpi_handle obj_handle,
+                acpi_object_handler handler, void *data)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
        /* Parameter validation */
 
-       if (!obj_handle ||
-               !handler    ||
-               !data) {
+       if (!obj_handle || !handler || !data) {
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        /* Convert and validate the handle */
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
+       node = acpi_ns_map_handle_to_node(obj_handle);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
-       status = acpi_ns_attach_data (node, handler, data);
+       status = acpi_ns_attach_data(node, handler, data);
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_detach_data
@@ -677,42 +652,37 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_detach_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler)
+acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
        /* Parameter validation */
 
-       if (!obj_handle ||
-               !handler) {
+       if (!obj_handle || !handler) {
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        /* Convert and validate the handle */
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
+       node = acpi_ns_map_handle_to_node(obj_handle);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
-       status = acpi_ns_detach_data (node, handler);
+       status = acpi_ns_detach_data(node, handler);
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_data
@@ -728,41 +698,33 @@ unlock_and_exit:
  ******************************************************************************/
 
 acpi_status
-acpi_get_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler,
-       void                            **data)
+acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
        /* Parameter validation */
 
-       if (!obj_handle ||
-               !handler    ||
-               !data) {
+       if (!obj_handle || !handler || !data) {
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        /* Convert and validate the handle */
 
-       node = acpi_ns_map_handle_to_node (obj_handle);
+       node = acpi_ns_map_handle_to_node(obj_handle);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
        }
 
-       status = acpi_ns_get_attached_data (node, handler, data);
+       status = acpi_ns_get_attached_data(node, handler, data);
 
-unlock_and_exit:
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
-
-
index 8d097914c49ad2fc4427ff39f9a958f52a041428..6b5f8d4481d131f8140da6fd2b9b5890d995d9e8 100644 (file)
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsxfname")
-
+ACPI_MODULE_NAME("nsxfname")
 
 /******************************************************************************
  *
  *              namespace handle.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_get_handle (
-       acpi_handle                     parent,
-       acpi_string                     pathname,
-       acpi_handle                     *ret_handle)
+acpi_get_handle(acpi_handle parent,
+               acpi_string pathname, acpi_handle * ret_handle)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node = NULL;
-       struct acpi_namespace_node      *prefix_node = NULL;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_status status;
+       struct acpi_namespace_node *node = NULL;
+       struct acpi_namespace_node *prefix_node = NULL;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Parameter Validation */
 
@@ -93,45 +86,47 @@ acpi_get_handle (
        /* Convert a parent handle to a prefix node */
 
        if (parent) {
-               status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
 
-               prefix_node = acpi_ns_map_handle_to_node (parent);
+               prefix_node = acpi_ns_map_handle_to_node(parent);
                if (!prefix_node) {
-                       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+                       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                        return (AE_BAD_PARAMETER);
                }
 
-               status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
        }
 
        /* Special case for root, since we can't search for it */
 
-       if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) {
-               *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
+       if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
+               *ret_handle =
+                   acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
                return (AE_OK);
        }
 
        /*
         *  Find the Node and convert to a handle
         */
-       status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
-                         &node);
+       status =
+           acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
+                                    &node);
 
        *ret_handle = NULL;
-       if (ACPI_SUCCESS (status)) {
-               *ret_handle = acpi_ns_convert_entry_to_handle (node);
+       if (ACPI_SUCCESS(status)) {
+               *ret_handle = acpi_ns_convert_entry_to_handle(node);
        }
 
        return (status);
 }
-EXPORT_SYMBOL(acpi_get_handle);
 
+EXPORT_SYMBOL(acpi_get_handle);
 
 /******************************************************************************
  *
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle);
  ******************************************************************************/
 
 acpi_status
-acpi_get_name (
-       acpi_handle                     handle,
-       u32                             name_type,
-       struct acpi_buffer              *buffer)
+acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-
+       acpi_status status;
+       struct acpi_namespace_node *node;
 
        /* Parameter validation */
 
@@ -165,15 +156,15 @@ acpi_get_name (
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (buffer);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_validate_buffer(buffer);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        if (name_type == ACPI_FULL_PATHNAME) {
                /* Get the full pathname (From the namespace root) */
 
-               status = acpi_ns_handle_to_pathname (handle, buffer);
+               status = acpi_ns_handle_to_pathname(handle, buffer);
                return (status);
        }
 
@@ -181,12 +172,12 @@ acpi_get_name (
         * Wants the single segment ACPI name.
         * Validate handle and convert to a namespace Node
         */
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       node = acpi_ns_map_handle_to_node (handle);
+       node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -194,26 +185,25 @@ acpi_get_name (
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
+       if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
 
        /* Just copy the ACPI name from the Node and zero terminate it */
 
-       ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node),
-                        ACPI_NAME_SIZE);
-       ((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
+       ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
+                    ACPI_NAME_SIZE);
+       ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
        status = AE_OK;
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
-EXPORT_SYMBOL(acpi_get_name);
 
+EXPORT_SYMBOL(acpi_get_name);
 
 /******************************************************************************
  *
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name);
  ******************************************************************************/
 
 acpi_status
-acpi_get_object_info (
-       acpi_handle                     handle,
-       struct acpi_buffer              *buffer)
+acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       struct acpi_device_info         *info;
-       struct acpi_device_info         *return_info;
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       struct acpi_device_info *info;
+       struct acpi_device_info *return_info;
        struct acpi_compatible_id_list *cid_list = NULL;
-       acpi_size                       size;
-
+       acpi_size size;
 
        /* Parameter validation */
 
@@ -249,37 +236,37 @@ acpi_get_object_info (
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (buffer);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_validate_buffer(buffer);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
-       info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info));
+       info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
        if (!info) {
                return (AE_NO_MEMORY);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       node = acpi_ns_map_handle_to_node (handle);
+       node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                goto cleanup;
        }
 
        /* Init return structure */
 
-       size = sizeof (struct acpi_device_info);
+       size = sizeof(struct acpi_device_info);
 
-       info->type  = node->type;
-       info->name  = node->name.integer;
+       info->type = node->type;
+       info->name = node->name.integer;
        info->valid = 0;
 
-       status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
@@ -297,73 +284,73 @@ acpi_get_object_info (
 
                /* Execute the Device._HID method */
 
-               status = acpi_ut_execute_HID (node, &info->hardware_id);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_execute_HID(node, &info->hardware_id);
+               if (ACPI_SUCCESS(status)) {
                        info->valid |= ACPI_VALID_HID;
                }
 
                /* Execute the Device._UID method */
 
-               status = acpi_ut_execute_UID (node, &info->unique_id);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_execute_UID(node, &info->unique_id);
+               if (ACPI_SUCCESS(status)) {
                        info->valid |= ACPI_VALID_UID;
                }
 
                /* Execute the Device._CID method */
 
-               status = acpi_ut_execute_CID (node, &cid_list);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_execute_CID(node, &cid_list);
+               if (ACPI_SUCCESS(status)) {
                        size += ((acpi_size) cid_list->count - 1) *
-                                        sizeof (struct acpi_compatible_id);
+                           sizeof(struct acpi_compatible_id);
                        info->valid |= ACPI_VALID_CID;
                }
 
                /* Execute the Device._STA method */
 
-               status = acpi_ut_execute_STA (node, &info->current_status);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_execute_STA(node, &info->current_status);
+               if (ACPI_SUCCESS(status)) {
                        info->valid |= ACPI_VALID_STA;
                }
 
                /* Execute the Device._ADR method */
 
-               status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node,
-                                 &info->address);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
+                                                        &info->address);
+               if (ACPI_SUCCESS(status)) {
                        info->valid |= ACPI_VALID_ADR;
                }
 
                /* Execute the Device._sx_d methods */
 
-               status = acpi_ut_execute_sxds (node, info->highest_dstates);
-               if (ACPI_SUCCESS (status)) {
+               status = acpi_ut_execute_sxds(node, info->highest_dstates);
+               if (ACPI_SUCCESS(status)) {
                        info->valid |= ACPI_VALID_SXDS;
                }
        }
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (buffer, size);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_initialize_buffer(buffer, size);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Populate the return buffer */
 
        return_info = buffer->pointer;
-       ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info));
+       ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
 
        if (cid_list) {
-               ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size);
+               ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
+                           cid_list->size);
        }
 
-
-cleanup:
-       ACPI_MEM_FREE (info);
+      cleanup:
+       ACPI_MEM_FREE(info);
        if (cid_list) {
-               ACPI_MEM_FREE (cid_list);
+               ACPI_MEM_FREE(cid_list);
        }
        return (status);
 }
-EXPORT_SYMBOL(acpi_get_object_info);
 
+EXPORT_SYMBOL(acpi_get_object_info);
index 363e1f6cfb182670d1420739ff5b9239ad8bb81e..0856d42e690982c66790ddb564a080a79c8421d9 100644 (file)
@@ -47,9 +47,8 @@
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_NAMESPACE
-        ACPI_MODULE_NAME    ("nsxfobj")
+ACPI_MODULE_NAME("nsxfobj")
 
 /*******************************************************************************
  *
  * DESCRIPTION: This routine returns the type associatd with a particular handle
  *
  ******************************************************************************/
-
-acpi_status
-acpi_get_type (
-       acpi_handle                     handle,
-       acpi_object_type                *ret_type)
+acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
        /* Parameter Validation */
 
@@ -88,27 +82,26 @@ acpi_get_type (
                return (AE_OK);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        /* Convert and validate the handle */
 
-       node = acpi_ns_map_handle_to_node (handle);
+       node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
-               (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+               (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
                return (AE_BAD_PARAMETER);
        }
 
        *ret_type = node->type;
 
-
-       status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
-EXPORT_SYMBOL(acpi_get_type);
 
+EXPORT_SYMBOL(acpi_get_type);
 
 /*******************************************************************************
  *
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_parent (
-       acpi_handle                     handle,
-       acpi_handle                     *ret_handle)
+acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
 {
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-
+       struct acpi_namespace_node *node;
+       acpi_status status;
 
        if (!ret_handle) {
                return (AE_BAD_PARAMETER);
@@ -143,14 +132,14 @@ acpi_get_parent (
                return (AE_NULL_ENTRY);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
        /* Convert and validate the handle */
 
-       node = acpi_ns_map_handle_to_node (handle);
+       node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
                status = AE_BAD_PARAMETER;
                goto unlock_and_exit;
@@ -159,22 +148,21 @@ acpi_get_parent (
        /* Get the parent entry */
 
        *ret_handle =
-               acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
+           acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
 
        /* Return exception if parent is null */
 
-       if (!acpi_ns_get_parent_node (node)) {
+       if (!acpi_ns_get_parent_node(node)) {
                status = AE_NULL_ENTRY;
        }
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
-EXPORT_SYMBOL(acpi_get_parent);
 
+EXPORT_SYMBOL(acpi_get_parent);
 
 /*******************************************************************************
  *
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent);
  ******************************************************************************/
 
 acpi_status
-acpi_get_next_object (
-       acpi_object_type                type,
-       acpi_handle                     parent,
-       acpi_handle                     child,
-       acpi_handle                     *ret_handle)
+acpi_get_next_object(acpi_object_type type,
+                    acpi_handle parent,
+                    acpi_handle child, acpi_handle * ret_handle)
 {
-       acpi_status                     status;
-       struct acpi_namespace_node      *node;
-       struct acpi_namespace_node      *parent_node = NULL;
-       struct acpi_namespace_node      *child_node = NULL;
-
+       acpi_status status;
+       struct acpi_namespace_node *node;
+       struct acpi_namespace_node *parent_node = NULL;
+       struct acpi_namespace_node *child_node = NULL;
 
        /* Parameter validation */
 
@@ -213,8 +198,8 @@ acpi_get_next_object (
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+       if (ACPI_FAILURE(status)) {
                return (status);
        }
 
@@ -223,17 +208,16 @@ acpi_get_next_object (
        if (!child) {
                /* Start search at the beginning of the specified scope */
 
-               parent_node = acpi_ns_map_handle_to_node (parent);
+               parent_node = acpi_ns_map_handle_to_node(parent);
                if (!parent_node) {
                        status = AE_BAD_PARAMETER;
                        goto unlock_and_exit;
                }
-       }
-       else {
+       } else {
                /* Non-null handle, ignore the parent */
                /* Convert and validate the handle */
 
-               child_node = acpi_ns_map_handle_to_node (child);
+               child_node = acpi_ns_map_handle_to_node(child);
                if (!child_node) {
                        status = AE_BAD_PARAMETER;
                        goto unlock_and_exit;
@@ -242,20 +226,19 @@ acpi_get_next_object (
 
        /* Internal function does the real work */
 
-       node = acpi_ns_get_next_node (type, parent_node, child_node);
+       node = acpi_ns_get_next_node(type, parent_node, child_node);
        if (!node) {
                status = AE_NOT_FOUND;
                goto unlock_and_exit;
        }
 
        if (ret_handle) {
-               *ret_handle = acpi_ns_convert_entry_to_handle (node);
+               *ret_handle = acpi_ns_convert_entry_to_handle(node);
        }
 
+      unlock_and_exit:
 
-unlock_and_exit:
-
-       (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+       (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return (status);
 }
 
index a82834b32752b094f02a68b8c9ece04c47223a61..64b98e82feb736985394ae32e48723f4fd8c29ef 100644 (file)
 
 #define ACPI_NUMA      0x80000000
 #define _COMPONENT     ACPI_NUMA
-       ACPI_MODULE_NAME ("numa")
+ACPI_MODULE_NAME("numa")
 
-extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
+extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
+                                              unsigned long madt_size,
+                                              int entry_id,
+                                              acpi_madt_entry_handler handler,
+                                              unsigned int max_entries);
 
-void __init
-acpi_table_print_srat_entry (
-       acpi_table_entry_header *header)
+void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
 {
 
-       ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry");
+       ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
 
        if (!header)
                return;
@@ -52,48 +54,55 @@ acpi_table_print_srat_entry (
 
        case ACPI_SRAT_PROCESSOR_AFFINITY:
 #ifdef ACPI_DEBUG_OUTPUT
-       {
-               struct acpi_table_processor_affinity *p =
-                       (struct acpi_table_processor_affinity*) header;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
-                      p->apic_id, p->lsapic_eid, p->proximity_domain,
-                      p->flags.enabled?"enabled":"disabled"));
-       }
-#endif /* ACPI_DEBUG_OUTPUT */
+               {
+                       struct acpi_table_processor_affinity *p =
+                           (struct acpi_table_processor_affinity *)header;
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
+                                         p->apic_id, p->lsapic_eid,
+                                         p->proximity_domain,
+                                         p->flags.
+                                         enabled ? "enabled" : "disabled"));
+               }
+#endif                         /* ACPI_DEBUG_OUTPUT */
                break;
 
        case ACPI_SRAT_MEMORY_AFFINITY:
 #ifdef ACPI_DEBUG_OUTPUT
-       {
-               struct acpi_table_memory_affinity *p =
-                       (struct acpi_table_memory_affinity*) header;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
-                      p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
-                      p->memory_type, p->proximity_domain,
-                      p->flags.enabled ? "enabled" : "disabled",
-                      p->flags.hot_pluggable ? " hot-pluggable" : ""));
-       }
-#endif /* ACPI_DEBUG_OUTPUT */
+               {
+                       struct acpi_table_memory_affinity *p =
+                           (struct acpi_table_memory_affinity *)header;
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
+                                         p->base_addr_hi, p->base_addr_lo,
+                                         p->length_hi, p->length_lo,
+                                         p->memory_type, p->proximity_domain,
+                                         p->flags.
+                                         enabled ? "enabled" : "disabled",
+                                         p->flags.
+                                         hot_pluggable ? " hot-pluggable" :
+                                         ""));
+               }
+#endif                         /* ACPI_DEBUG_OUTPUT */
                break;
 
        default:
-               printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
-                       header->type);
+               printk(KERN_WARNING PREFIX
+                      "Found unsupported SRAT entry (type = 0x%x)\n",
+                      header->type);
                break;
        }
 }
 
-
-static int __init
-acpi_parse_slit (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
 {
-       struct acpi_table_slit  *slit;
-       u32                     localities;
+       struct acpi_table_slit *slit;
+       u32 localities;
 
        if (!phys_addr || !size)
                return -EINVAL;
 
-       slit = (struct acpi_table_slit *) __va(phys_addr);
+       slit = (struct acpi_table_slit *)__va(phys_addr);
 
        /* downcast just for %llu vs %lu for i386/ia64  */
        localities = (u32) slit->localities;
@@ -103,15 +112,13 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
        return 0;
 }
 
-
 static int __init
-acpi_parse_processor_affinity (
-       acpi_table_entry_header *header,
-       const unsigned long end)
+acpi_parse_processor_affinity(acpi_table_entry_header * header,
+                             const unsigned long end)
 {
        struct acpi_table_processor_affinity *processor_affinity;
 
-       processor_affinity = (struct acpi_table_processor_affinity*) header;
+       processor_affinity = (struct acpi_table_processor_affinity *)header;
        if (!processor_affinity)
                return -EINVAL;
 
@@ -123,15 +130,13 @@ acpi_parse_processor_affinity (
        return 0;
 }
 
-
 static int __init
-acpi_parse_memory_affinity (
-       acpi_table_entry_header *header,
-       const unsigned long end)
+acpi_parse_memory_affinity(acpi_table_entry_header * header,
+                          const unsigned long end)
 {
        struct acpi_table_memory_affinity *memory_affinity;
 
-       memory_affinity = (struct acpi_table_memory_affinity*) header;
+       memory_affinity = (struct acpi_table_memory_affinity *)header;
        if (!memory_affinity)
                return -EINVAL;
 
@@ -143,36 +148,30 @@ acpi_parse_memory_affinity (
        return 0;
 }
 
-
-static int __init
-acpi_parse_srat (unsigned long phys_addr, unsigned long size)
+static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size)
 {
-       struct acpi_table_srat  *srat;
+       struct acpi_table_srat *srat;
 
        if (!phys_addr || !size)
                return -EINVAL;
 
-       srat = (struct acpi_table_srat *) __va(phys_addr);
+       srat = (struct acpi_table_srat *)__va(phys_addr);
 
        return 0;
 }
 
-
 int __init
-acpi_table_parse_srat (
-       enum acpi_srat_entry_id id,
-       acpi_madt_entry_handler handler,
-       unsigned int max_entries)
+acpi_table_parse_srat(enum acpi_srat_entry_id id,
+                     acpi_madt_entry_handler handler, unsigned int max_entries)
 {
-       return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
-                                           id, handler, max_entries);
+       return acpi_table_parse_madt_family(ACPI_SRAT,
+                                           sizeof(struct acpi_table_srat), id,
+                                           handler, max_entries);
 }
 
-
-int __init
-acpi_numa_init(void)
+int __init acpi_numa_init(void)
 {
-       int                     result;
+       int result;
 
        /* SRAT: Static Resource Affinity Table */
        result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
@@ -181,9 +180,7 @@ acpi_numa_init(void)
                result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
                                               acpi_parse_processor_affinity,
                                               NR_CPUS);
-               result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
-                                              acpi_parse_memory_affinity,
-                                              NR_NODE_MEMBLKS);        // IA64 specific
+               result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
        }
 
        /* SLIT: System Locality Information Table */
@@ -193,8 +190,7 @@ acpi_numa_init(void)
        return 0;
 }
 
-int
-acpi_get_pxm(acpi_handle h)
+int acpi_get_pxm(acpi_handle h)
 {
        unsigned long pxm;
        acpi_status status;
@@ -207,7 +203,8 @@ acpi_get_pxm(acpi_handle h)
                if (ACPI_SUCCESS(status))
                        return (int)pxm;
                status = acpi_get_parent(handle, &phandle);
-       } while(ACPI_SUCCESS(status));
+       } while (ACPI_SUCCESS(status));
        return -1;
 }
+
 EXPORT_SYMBOL(acpi_get_pxm);
index 0d11d6e6abd6d652efab6c2831a81b340c7a50f7..d528c750a3801bd65591639baec49d3f64a381fe 100644 (file)
 
 #include <linux/efi.h>
 
-
 #define _COMPONENT             ACPI_OS_SERVICES
-ACPI_MODULE_NAME       ("osl")
-
+ACPI_MODULE_NAME("osl")
 #define PREFIX         "ACPI: "
-
-struct acpi_os_dpc
-{
-    acpi_osd_exec_callback  function;
-    void                   *context;
+struct acpi_os_dpc {
+       acpi_osd_exec_callback function;
+       void *context;
 };
 
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
@@ -69,7 +65,7 @@ int acpi_in_debugger;
 EXPORT_SYMBOL(acpi_in_debugger);
 
 extern char line_buf[80];
-#endif /*ENABLE_DEBUGGER*/
+#endif                         /*ENABLE_DEBUGGER */
 
 int acpi_specific_hotkey_enabled = TRUE;
 EXPORT_SYMBOL(acpi_specific_hotkey_enabled);
@@ -79,33 +75,29 @@ static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
 static struct workqueue_struct *kacpid_wq;
 
-acpi_status
-acpi_os_initialize(void)
+acpi_status acpi_os_initialize(void)
 {
        return AE_OK;
 }
 
-acpi_status
-acpi_os_initialize1(void)
+acpi_status acpi_os_initialize1(void)
 {
        /*
         * Initialize PCI configuration space access, as we'll need to access
         * it while walking the namespace (bus 0 and root bridges w/ _BBNs).
         */
-#ifdef CONFIG_ACPI_PCI
        if (!raw_pci_ops) {
-               printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n");
+               printk(KERN_ERR PREFIX
+                      "Access to PCI configuration space unavailable\n");
                return AE_NULL_ENTRY;
        }
-#endif
        kacpid_wq = create_singlethread_workqueue("kacpid");
        BUG_ON(!kacpid_wq);
 
        return AE_OK;
 }
 
-acpi_status
-acpi_os_terminate(void)
+acpi_status acpi_os_terminate(void)
 {
        if (acpi_irq_handler) {
                acpi_os_remove_interrupt_handler(acpi_irq_irq,
@@ -117,21 +109,20 @@ acpi_os_terminate(void)
        return AE_OK;
 }
 
-void
-acpi_os_printf(const char *fmt,...)
+void acpi_os_printf(const char *fmt, ...)
 {
        va_list args;
        va_start(args, fmt);
        acpi_os_vprintf(fmt, args);
        va_end(args);
 }
+
 EXPORT_SYMBOL(acpi_os_printf);
 
-void
-acpi_os_vprintf(const char *fmt, va_list args)
+void acpi_os_vprintf(const char *fmt, va_list args)
 {
        static char buffer[512];
-       
+
        vsprintf(buffer, fmt, args);
 
 #ifdef ENABLE_DEBUGGER
@@ -146,8 +137,7 @@ acpi_os_vprintf(const char *fmt, va_list args)
 }
 
 extern int acpi_in_resume;
-void *
-acpi_os_allocate(acpi_size size)
+void *acpi_os_allocate(acpi_size size)
 {
        if (acpi_in_resume)
                return kmalloc(size, GFP_ATOMIC);
@@ -155,31 +145,32 @@ acpi_os_allocate(acpi_size size)
                return kmalloc(size, GFP_KERNEL);
 }
 
-void
-acpi_os_free(void *ptr)
+void acpi_os_free(void *ptr)
 {
        kfree(ptr);
 }
+
 EXPORT_SYMBOL(acpi_os_free);
 
-acpi_status
-acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
+acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
 {
        if (efi_enabled) {
                addr->pointer_type = ACPI_PHYSICAL_POINTER;
                if (efi.acpi20)
                        addr->pointer.physical =
-                               (acpi_physical_address) virt_to_phys(efi.acpi20);
+                           (acpi_physical_address) virt_to_phys(efi.acpi20);
                else if (efi.acpi)
                        addr->pointer.physical =
-                               (acpi_physical_address) virt_to_phys(efi.acpi);
+                           (acpi_physical_address) virt_to_phys(efi.acpi);
                else {
-                       printk(KERN_ERR PREFIX "System description tables not found\n");
+                       printk(KERN_ERR PREFIX
+                              "System description tables not found\n");
                        return AE_NOT_FOUND;
                }
        } else {
                if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) {
-                       printk(KERN_ERR PREFIX "System description tables not found\n");
+                       printk(KERN_ERR PREFIX
+                              "System description tables not found\n");
                        return AE_NOT_FOUND;
                }
        }
@@ -188,11 +179,12 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
 }
 
 acpi_status
-acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **virt)
+acpi_os_map_memory(acpi_physical_address phys, acpi_size size,
+                  void __iomem ** virt)
 {
        if (efi_enabled) {
                if (EFI_MEMORY_WB & efi_mem_attributes(phys)) {
-                       *virt = (void __iomem *) phys_to_virt(phys);
+                       *virt = (void __iomem *)phys_to_virt(phys);
                } else {
                        *virt = ioremap(phys, size);
                }
@@ -202,9 +194,9 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi
                        return AE_BAD_PARAMETER;
                }
                /*
-                * ioremap checks to ensure this is in reserved space
-                */
-               *virt = ioremap((unsigned long) phys, size);
+                * ioremap checks to ensure this is in reserved space
+                */
+               *virt = ioremap((unsigned long)phys, size);
        }
 
        if (!*virt)
@@ -213,17 +205,16 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi
        return AE_OK;
 }
 
-void
-acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
+void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
 {
        iounmap(virt);
 }
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_os_get_physical_address(void *virt, acpi_physical_address *phys)
+acpi_os_get_physical_address(void *virt, acpi_physical_address * phys)
 {
-       if(!phys || !virt)
+       if (!phys || !virt)
                return AE_BAD_PARAMETER;
 
        *phys = virt_to_phys(virt);
@@ -237,16 +228,16 @@ acpi_os_get_physical_address(void *virt, acpi_physical_address *phys)
 static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
 
 acpi_status
-acpi_os_predefined_override (const struct acpi_predefined_names *init_val,
-                            acpi_string *new_val)
+acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
+                           acpi_string * new_val)
 {
        if (!init_val || !new_val)
                return AE_BAD_PARAMETER;
 
        *new_val = NULL;
-       if (!memcmp (init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
+       if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
                printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
-                       acpi_os_name);
+                      acpi_os_name);
                *new_val = acpi_os_name;
        }
 
@@ -254,15 +245,15 @@ acpi_os_predefined_override (const struct acpi_predefined_names *init_val,
 }
 
 acpi_status
-acpi_os_table_override (struct acpi_table_header *existing_table,
-                       struct acpi_table_header **new_table)
+acpi_os_table_override(struct acpi_table_header * existing_table,
+                      struct acpi_table_header ** new_table)
 {
        if (!existing_table || !new_table)
                return AE_BAD_PARAMETER;
 
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
        if (strncmp(existing_table->signature, "DSDT", 4) == 0)
-               *new_table = (struct acpi_table_header*)AmlCode;
+               *new_table = (struct acpi_table_header *)AmlCode;
        else
                *new_table = NULL;
 #else
@@ -271,14 +262,14 @@ acpi_os_table_override (struct acpi_table_header *existing_table,
        return AE_OK;
 }
 
-static irqreturn_t
-acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
 {
-       return (*acpi_irq_handler)(acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
+       return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
 }
 
 acpi_status
-acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *context)
+acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
+                                 void *context)
 {
        unsigned int irq;
 
@@ -305,8 +296,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *conte
        return AE_OK;
 }
 
-acpi_status
-acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
+acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
 {
        if (irq) {
                free_irq(irq, acpi_irq);
@@ -321,16 +311,15 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
  * Running in interpreter thread context, safe to sleep
  */
 
-void
-acpi_os_sleep(acpi_integer ms)
+void acpi_os_sleep(acpi_integer ms)
 {
        current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(((signed long) ms * HZ) / 1000);
+       schedule_timeout(((signed long)ms * HZ) / 1000);
 }
+
 EXPORT_SYMBOL(acpi_os_sleep);
 
-void
-acpi_os_stall(u32 us)
+void acpi_os_stall(u32 us)
 {
        while (us) {
                u32 delay = 1000;
@@ -342,6 +331,7 @@ acpi_os_stall(u32 us)
                us -= delay;
        }
 }
+
 EXPORT_SYMBOL(acpi_os_stall);
 
 /*
@@ -349,8 +339,7 @@ EXPORT_SYMBOL(acpi_os_stall);
  * Returns 64-bit free-running, monotonically increasing timer
  * with 100ns granularity
  */
-u64
-acpi_os_get_timer (void)
+u64 acpi_os_get_timer(void)
 {
        static u64 t;
 
@@ -367,27 +356,22 @@ acpi_os_get_timer (void)
        return ++t;
 }
 
-acpi_status
-acpi_os_read_port(
-       acpi_io_address port,
-       u32             *value,
-       u32             width)
+acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
 {
        u32 dummy;
 
        if (!value)
                value = &dummy;
 
-       switch (width)
-       {
+       switch (width) {
        case 8:
-               *(u8*)  value = inb(port);
+               *(u8 *) value = inb(port);
                break;
        case 16:
-               *(u16*) value = inw(port);
+               *(u16 *) value = inw(port);
                break;
        case 32:
-               *(u32*) value = inl(port);
+               *(u32 *) value = inl(port);
                break;
        default:
                BUG();
@@ -395,16 +379,12 @@ acpi_os_read_port(
 
        return AE_OK;
 }
+
 EXPORT_SYMBOL(acpi_os_read_port);
 
-acpi_status
-acpi_os_write_port(
-       acpi_io_address port,
-       u32             value,
-       u32             width)
+acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
 {
-       switch (width)
-       {
+       switch (width) {
        case 8:
                outb(value, port);
                break;
@@ -420,40 +400,38 @@ acpi_os_write_port(
 
        return AE_OK;
 }
+
 EXPORT_SYMBOL(acpi_os_write_port);
 
 acpi_status
-acpi_os_read_memory(
-       acpi_physical_address   phys_addr,
-       u32                     *value,
-       u32                     width)
+acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
 {
-       u32                     dummy;
-       void __iomem            *virt_addr;
-       int                     iomem = 0;
+       u32 dummy;
+       void __iomem *virt_addr;
+       int iomem = 0;
 
        if (efi_enabled) {
                if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
                        /* HACK ALERT! We can use readb/w/l on real memory too.. */
-                       virt_addr = (void __iomem *) phys_to_virt(phys_addr);
+                       virt_addr = (void __iomem *)phys_to_virt(phys_addr);
                } else {
                        iomem = 1;
                        virt_addr = ioremap(phys_addr, width);
                }
        } else
-               virt_addr = (void __iomem *) phys_to_virt(phys_addr);
+               virt_addr = (void __iomem *)phys_to_virt(phys_addr);
        if (!value)
                value = &dummy;
 
        switch (width) {
        case 8:
-               *(u8*) value = readb(virt_addr);
+               *(u8 *) value = readb(virt_addr);
                break;
        case 16:
-               *(u16*) value = readw(virt_addr);
+               *(u16 *) value = readw(virt_addr);
                break;
        case 32:
-               *(u32*) value = readl(virt_addr);
+               *(u32 *) value = readl(virt_addr);
                break;
        default:
                BUG();
@@ -468,24 +446,21 @@ acpi_os_read_memory(
 }
 
 acpi_status
-acpi_os_write_memory(
-       acpi_physical_address   phys_addr,
-       u32                     value,
-       u32                     width)
+acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
 {
-       void __iomem            *virt_addr;
-       int                     iomem = 0;
+       void __iomem *virt_addr;
+       int iomem = 0;
 
        if (efi_enabled) {
                if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
                        /* HACK ALERT! We can use writeb/w/l on real memory too */
-                       virt_addr = (void __iomem *) phys_to_virt(phys_addr);
+                       virt_addr = (void __iomem *)phys_to_virt(phys_addr);
                } else {
                        iomem = 1;
                        virt_addr = ioremap(phys_addr, width);
                }
        } else
-               virt_addr = (void __iomem *) phys_to_virt(phys_addr);
+               virt_addr = (void __iomem *)phys_to_virt(phys_addr);
 
        switch (width) {
        case 8:
@@ -507,10 +482,9 @@ acpi_os_write_memory(
        return AE_OK;
 }
 
-#ifdef CONFIG_ACPI_PCI
-
 acpi_status
-acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value, u32 width)
+acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
+                              void *value, u32 width)
 {
        int result, size;
 
@@ -534,15 +508,17 @@ acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value
        BUG_ON(!raw_pci_ops);
 
        result = raw_pci_ops->read(pci_id->segment, pci_id->bus,
-                               PCI_DEVFN(pci_id->device, pci_id->function),
-                               reg, size, value);
+                                  PCI_DEVFN(pci_id->device, pci_id->function),
+                                  reg, size, value);
 
        return (result ? AE_ERROR : AE_OK);
 }
+
 EXPORT_SYMBOL(acpi_os_read_pci_configuration);
 
 acpi_status
-acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integer value, u32 width)
+acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
+                               acpi_integer value, u32 width)
 {
        int result, size;
 
@@ -563,56 +539,62 @@ acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integ
        BUG_ON(!raw_pci_ops);
 
        result = raw_pci_ops->write(pci_id->segment, pci_id->bus,
-                               PCI_DEVFN(pci_id->device, pci_id->function),
-                               reg, size, value);
+                                   PCI_DEVFN(pci_id->device, pci_id->function),
+                                   reg, size, value);
 
        return (result ? AE_ERROR : AE_OK);
 }
 
 /* TODO: Change code to take advantage of driver model more */
-static void
-acpi_os_derive_pci_id_2 (
-       acpi_handle             rhandle,        /* upper bound  */
-       acpi_handle             chandle,        /* current node */
-       struct acpi_pci_id      **id,
-       int                     *is_bridge,
-       u8                      *bus_number)
+static void acpi_os_derive_pci_id_2(acpi_handle rhandle,       /* upper bound  */
+                                   acpi_handle chandle,        /* current node */
+                                   struct acpi_pci_id **id,
+                                   int *is_bridge, u8 * bus_number)
 {
-       acpi_handle             handle;
-       struct acpi_pci_id      *pci_id = *id;
-       acpi_status             status;
-       unsigned long           temp;
-       acpi_object_type        type;
-       u8                      tu8;
+       acpi_handle handle;
+       struct acpi_pci_id *pci_id = *id;
+       acpi_status status;
+       unsigned long temp;
+       acpi_object_type type;
+       u8 tu8;
 
        acpi_get_parent(chandle, &handle);
        if (handle != rhandle) {
-               acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, bus_number);
+               acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
+                                       bus_number);
 
                status = acpi_get_type(handle, &type);
-               if ( (ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE) )
+               if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
                        return;
 
-               status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp);
+               status =
+                   acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
+                                         &temp);
                if (ACPI_SUCCESS(status)) {
-                       pci_id->device  = ACPI_HIWORD (ACPI_LODWORD (temp));
-                       pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
+                       pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
+                       pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
 
                        if (*is_bridge)
                                pci_id->bus = *bus_number;
 
                        /* any nicer way to get bus number of bridge ? */
-                       status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8);
-                       if (ACPI_SUCCESS(status) &&
-                           ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
-                               status = acpi_os_read_pci_configuration(pci_id, 0x18, &tu8, 8);
+                       status =
+                           acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
+                                                          8);
+                       if (ACPI_SUCCESS(status)
+                           && ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
+                               status =
+                                   acpi_os_read_pci_configuration(pci_id, 0x18,
+                                                                  &tu8, 8);
                                if (!ACPI_SUCCESS(status)) {
                                        /* Certainly broken...  FIX ME */
                                        return;
                                }
                                *is_bridge = 1;
                                pci_id->bus = tu8;
-                               status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8);
+                               status =
+                                   acpi_os_read_pci_configuration(pci_id, 0x19,
+                                                                  &tu8, 8);
                                if (ACPI_SUCCESS(status)) {
                                        *bus_number = tu8;
                                }
@@ -622,11 +604,9 @@ acpi_os_derive_pci_id_2 (
        }
 }
 
-void
-acpi_os_derive_pci_id (
-       acpi_handle             rhandle,        /* upper bound  */
-       acpi_handle             chandle,        /* current node */
-       struct acpi_pci_id      **id)
+void acpi_os_derive_pci_id(acpi_handle rhandle,        /* upper bound  */
+                          acpi_handle chandle, /* current node */
+                          struct acpi_pci_id **id)
 {
        int is_bridge = 1;
        u8 bus_number = (*id)->bus;
@@ -634,49 +614,15 @@ acpi_os_derive_pci_id (
        acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number);
 }
 
-#else /*!CONFIG_ACPI_PCI*/
-
-acpi_status
-acpi_os_write_pci_configuration (
-       struct acpi_pci_id      *pci_id,
-       u32                     reg,
-       acpi_integer            value,
-       u32                     width)
-{
-       return AE_SUPPORT;
-}
-
-acpi_status
-acpi_os_read_pci_configuration (
-       struct acpi_pci_id      *pci_id,
-       u32                     reg,
-       void                    *value,
-       u32                     width)
-{
-       return AE_SUPPORT;
-}
-
-void
-acpi_os_derive_pci_id (
-       acpi_handle             rhandle,        /* upper bound  */
-       acpi_handle             chandle,        /* current node */
-       struct acpi_pci_id      **id)
-{
-}
-
-#endif /*CONFIG_ACPI_PCI*/
-
-static void
-acpi_os_execute_deferred (
-       void *context)
+static void acpi_os_execute_deferred(void *context)
 {
-       struct acpi_os_dpc      *dpc = NULL;
+       struct acpi_os_dpc *dpc = NULL;
 
-       ACPI_FUNCTION_TRACE ("os_execute_deferred");
+       ACPI_FUNCTION_TRACE("os_execute_deferred");
 
-       dpc = (struct acpi_os_dpc *) context;
+       dpc = (struct acpi_os_dpc *)context;
        if (!dpc) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
                return_VOID;
        }
 
@@ -688,21 +634,21 @@ acpi_os_execute_deferred (
 }
 
 acpi_status
-acpi_os_queue_for_execution(
-       u32                     priority,
-       acpi_osd_exec_callback  function,
-       void                    *context)
+acpi_os_queue_for_execution(u32 priority,
+                           acpi_osd_exec_callback function, void *context)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_os_dpc      *dpc;
-       struct work_struct      *task;
+       acpi_status status = AE_OK;
+       struct acpi_os_dpc *dpc;
+       struct work_struct *task;
 
-       ACPI_FUNCTION_TRACE ("os_queue_for_execution");
+       ACPI_FUNCTION_TRACE("os_queue_for_execution");
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context));
+       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                         "Scheduling function [%p(%p)] for deferred execution.\n",
+                         function, context));
 
        if (!function)
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        /*
         * Allocate/initialize DPC structure.  Note that this memory will be
@@ -715,146 +661,94 @@ acpi_os_queue_for_execution(
         * from the same memory.
         */
 
-       dpc = kmalloc(sizeof(struct acpi_os_dpc)+sizeof(struct work_struct), GFP_ATOMIC);
+       dpc =
+           kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
+                   GFP_ATOMIC);
        if (!dpc)
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
 
        dpc->function = function;
        dpc->context = context;
 
-       task = (void *)(dpc+1);
-       INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc);
+       task = (void *)(dpc + 1);
+       INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
 
        if (!queue_work(kacpid_wq, task)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Call to queue_work() failed.\n"));
                kfree(dpc);
                status = AE_ERROR;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
+
 EXPORT_SYMBOL(acpi_os_queue_for_execution);
 
-void
-acpi_os_wait_events_complete(
-       void *context)
+void acpi_os_wait_events_complete(void *context)
 {
        flush_workqueue(kacpid_wq);
 }
+
 EXPORT_SYMBOL(acpi_os_wait_events_complete);
 
 /*
  * Allocate the memory for a spinlock and initialize it.
  */
-acpi_status
-acpi_os_create_lock (
-       acpi_handle     *out_handle)
+acpi_status acpi_os_create_lock(acpi_handle * out_handle)
 {
        spinlock_t *lock_ptr;
 
-       ACPI_FUNCTION_TRACE ("os_create_lock");
+       ACPI_FUNCTION_TRACE("os_create_lock");
 
        lock_ptr = acpi_os_allocate(sizeof(spinlock_t));
 
        spin_lock_init(lock_ptr);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr));
 
        *out_handle = lock_ptr;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*
  * Deallocate the memory for a spinlock.
  */
-void
-acpi_os_delete_lock (
-       acpi_handle     handle)
+void acpi_os_delete_lock(acpi_handle handle)
 {
-       ACPI_FUNCTION_TRACE ("os_create_lock");
+       ACPI_FUNCTION_TRACE("os_create_lock");
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle));
 
        acpi_os_free(handle);
 
        return_VOID;
 }
 
-/*
- * Acquire a spinlock.
- *
- * handle is a pointer to the spinlock_t.
- * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
- *   that indicates whether we are at interrupt level.
- */
-void
-acpi_os_acquire_lock (
-       acpi_handle     handle,
-       u32             flags)
-{
-       ACPI_FUNCTION_TRACE ("os_acquire_lock");
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquiring spinlock[%p] from %s level\n", handle,
-               ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
-       if (flags & ACPI_NOT_ISR)
-               ACPI_DISABLE_IRQS();
-
-       spin_lock((spinlock_t *)handle);
-
-       return_VOID;
-}
-
-
-/*
- * Release a spinlock. See above.
- */
-void
-acpi_os_release_lock (
-       acpi_handle     handle,
-       u32             flags)
-{
-       ACPI_FUNCTION_TRACE ("os_release_lock");
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Releasing spinlock[%p] from %s level\n", handle,
-               ((flags & ACPI_NOT_ISR) ? "non-interrupt" : "interrupt")));
-
-       spin_unlock((spinlock_t *)handle);
-
-       if (flags & ACPI_NOT_ISR)
-               ACPI_ENABLE_IRQS();
-
-       return_VOID;
-}
-
-
 acpi_status
-acpi_os_create_semaphore(
-       u32             max_units,
-       u32             initial_units,
-       acpi_handle     *handle)
+acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
 {
-       struct semaphore        *sem = NULL;
+       struct semaphore *sem = NULL;
 
-       ACPI_FUNCTION_TRACE ("os_create_semaphore");
+       ACPI_FUNCTION_TRACE("os_create_semaphore");
 
        sem = acpi_os_allocate(sizeof(struct semaphore));
        if (!sem)
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        memset(sem, 0, sizeof(struct semaphore));
 
        sema_init(sem, initial_units);
 
-       *handle = (acpi_handle*)sem;
+       *handle = (acpi_handle *) sem;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
+                         *handle, initial_units));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_os_create_semaphore);
 
+EXPORT_SYMBOL(acpi_os_create_semaphore);
 
 /*
  * TODO: A better way to delete semaphores?  Linux doesn't have a
@@ -863,25 +757,24 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);
  * we at least check for blocked threads and signal/cancel them?
  */
 
-acpi_status
-acpi_os_delete_semaphore(
-       acpi_handle     handle)
+acpi_status acpi_os_delete_semaphore(acpi_handle handle)
 {
-       struct semaphore *sem = (struct semaphore*) handle;
+       struct semaphore *sem = (struct semaphore *)handle;
 
-       ACPI_FUNCTION_TRACE ("os_delete_semaphore");
+       ACPI_FUNCTION_TRACE("os_delete_semaphore");
 
        if (!sem)
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
 
-       acpi_os_free(sem); sem =  NULL;
+       acpi_os_free(sem);
+       sem = NULL;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_os_delete_semaphore);
 
+EXPORT_SYMBOL(acpi_os_delete_semaphore);
 
 /*
  * TODO: The kernel doesn't have a 'down_timeout' function -- had to
@@ -892,31 +785,27 @@ EXPORT_SYMBOL(acpi_os_delete_semaphore);
  *
  * TODO: Support for units > 1?
  */
-acpi_status
-acpi_os_wait_semaphore(
-       acpi_handle             handle,
-       u32                     units,
-       u16                     timeout)
+acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
 {
-       acpi_status             status = AE_OK;
-       struct semaphore        *sem = (struct semaphore*)handle;
-       int                     ret = 0;
+       acpi_status status = AE_OK;
+       struct semaphore *sem = (struct semaphore *)handle;
+       int ret = 0;
 
-       ACPI_FUNCTION_TRACE ("os_wait_semaphore");
+       ACPI_FUNCTION_TRACE("os_wait_semaphore");
 
        if (!sem || (units < 1))
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        if (units > 1)
-               return_ACPI_STATUS (AE_SUPPORT);
+               return_ACPI_STATUS(AE_SUPPORT);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
+                         handle, units, timeout));
 
        if (in_atomic())
                timeout = 0;
 
-       switch (timeout)
-       {
+       switch (timeout) {
                /*
                 * No Wait:
                 * --------
@@ -924,8 +813,8 @@ acpi_os_wait_semaphore(
                 * acquire the semaphore if available otherwise return AE_TIME
                 * (a.k.a. 'would block').
                 */
-               case 0:
-               if(down_trylock(sem))
+       case 0:
+               if (down_trylock(sem))
                        status = AE_TIME;
                break;
 
@@ -933,7 +822,7 @@ acpi_os_wait_semaphore(
                 * Wait Indefinitely:
                 * ------------------
                 */
-               case ACPI_WAIT_FOREVER:
+       case ACPI_WAIT_FOREVER:
                down(sem);
                break;
 
@@ -941,11 +830,11 @@ acpi_os_wait_semaphore(
                 * Wait w/ Timeout:
                 * ----------------
                 */
-               default:
+       default:
                // TODO: A better timeout algorithm?
                {
                        int i = 0;
-                       static const int quantum_ms = 1000/HZ;
+                       static const int quantum_ms = 1000 / HZ;
 
                        ret = down_trylock(sem);
                        for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) {
@@ -953,7 +842,7 @@ acpi_os_wait_semaphore(
                                schedule_timeout(1);
                                ret = down_trylock(sem);
                        }
-       
+
                        if (ret != 0)
                                status = AE_TIME;
                }
@@ -961,47 +850,48 @@ acpi_os_wait_semaphore(
        }
 
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to acquire semaphore[%p|%d|%d], %s\n", 
-                       handle, units, timeout, acpi_format_exception(status)));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Failed to acquire semaphore[%p|%d|%d], %s\n",
+                                 handle, units, timeout,
+                                 acpi_format_exception(status)));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
+                                 "Acquired semaphore[%p|%d|%d]\n", handle,
+                                 units, timeout));
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_os_wait_semaphore);
 
+EXPORT_SYMBOL(acpi_os_wait_semaphore);
 
 /*
  * TODO: Support for units > 1?
  */
-acpi_status
-acpi_os_signal_semaphore(
-    acpi_handle            handle,
-    u32                    units)
+acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
 {
-       struct semaphore *sem = (struct semaphore *) handle;
+       struct semaphore *sem = (struct semaphore *)handle;
 
-       ACPI_FUNCTION_TRACE ("os_signal_semaphore");
+       ACPI_FUNCTION_TRACE("os_signal_semaphore");
 
        if (!sem || (units < 1))
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        if (units > 1)
-               return_ACPI_STATUS (AE_SUPPORT);
+               return_ACPI_STATUS(AE_SUPPORT);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
+                         units));
 
        up(sem);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
+
 EXPORT_SYMBOL(acpi_os_signal_semaphore);
 
 #ifdef ACPI_FUTURE_USAGE
-u32
-acpi_os_get_line(char *buffer)
+u32 acpi_os_get_line(char *buffer)
 {
 
 #ifdef ENABLE_DEBUGGER
@@ -1018,22 +908,21 @@ acpi_os_get_line(char *buffer)
 
        return 0;
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /* Assumes no unreadable holes inbetween */
-u8
-acpi_os_readable(void *ptr, acpi_size len)
+u8 acpi_os_readable(void *ptr, acpi_size len)
 {
-#if defined(__i386__) || defined(__x86_64__) 
+#if defined(__i386__) || defined(__x86_64__)
        char tmp;
-       return !__get_user(tmp, (char __user *)ptr) && !__get_user(tmp, (char __user *)ptr + len - 1);
+       return !__get_user(tmp, (char __user *)ptr)
+           && !__get_user(tmp, (char __user *)ptr + len - 1);
 #endif
        return 1;
 }
 
 #ifdef ACPI_FUTURE_USAGE
-u8
-acpi_os_writable(void *ptr, acpi_size len)
+u8 acpi_os_writable(void *ptr, acpi_size len)
 {
        /* could do dummy write (racy) or a kernel page table lookup.
           The later may be difficult at early boot when kmap doesn't work yet. */
@@ -1041,8 +930,7 @@ acpi_os_writable(void *ptr, acpi_size len)
 }
 #endif
 
-u32
-acpi_os_get_thread_id (void)
+u32 acpi_os_get_thread_id(void)
 {
        if (!in_atomic())
                return current->pid;
@@ -1050,13 +938,9 @@ acpi_os_get_thread_id (void)
        return 0;
 }
 
-acpi_status
-acpi_os_signal (
-    u32                function,
-    void       *info)
+acpi_status acpi_os_signal(u32 function, void *info)
 {
-       switch (function)
-       {
+       switch (function) {
        case ACPI_SIGNAL_FATAL:
                printk(KERN_ERR PREFIX "Fatal opcode executed\n");
                break;
@@ -1076,13 +960,13 @@ acpi_os_signal (
 
        return AE_OK;
 }
+
 EXPORT_SYMBOL(acpi_os_signal);
 
-static int __init
-acpi_os_name_setup(char *str)
+static int __init acpi_os_name_setup(char *str)
 {
        char *p = acpi_os_name;
-       int count = ACPI_MAX_OVERRIDE_LEN-1;
+       int count = ACPI_MAX_OVERRIDE_LEN - 1;
 
        if (!str || !*str)
                return 0;
@@ -1098,7 +982,7 @@ acpi_os_name_setup(char *str)
        *p = 0;
 
        return 1;
-               
+
 }
 
 __setup("acpi_os_name=", acpi_os_name_setup);
@@ -1108,16 +992,15 @@ __setup("acpi_os_name=", acpi_os_name_setup);
  * empty string disables _OSI
  * TBD additional string adds to _OSI
  */
-static int __init
-acpi_osi_setup(char *str)
+static int __init acpi_osi_setup(char *str)
 {
        if (str == NULL || *str == '\0') {
                printk(KERN_INFO PREFIX "_OSI method disabled\n");
                acpi_gbl_create_osi_method = FALSE;
-       } else
-       {
+       } else {
                /* TBD */
-               printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", str);
+               printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n",
+                      str);
        }
 
        return 1;
@@ -1126,8 +1009,7 @@ acpi_osi_setup(char *str)
 __setup("acpi_osi=", acpi_osi_setup);
 
 /* enable serialization to combat AE_ALREADY_EXISTS errors */
-static int __init
-acpi_serialize_setup(char *str)
+static int __init acpi_serialize_setup(char *str)
 {
        printk(KERN_INFO PREFIX "serialize enabled\n");
 
@@ -1147,8 +1029,7 @@ __setup("acpi_serialize", acpi_serialize_setup);
  * Run-time events on the same GPE this flag is available
  * to tell Linux to keep the wake-time GPEs enabled at run-time.
  */
-static int __init
-acpi_wake_gpes_always_on_setup(char *str)
+static int __init acpi_wake_gpes_always_on_setup(char *str)
 {
        printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
 
@@ -1159,8 +1040,7 @@ acpi_wake_gpes_always_on_setup(char *str)
 
 __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
 
-int __init
-acpi_hotkey_setup(char *str)
+static int __init acpi_hotkey_setup(char *str)
 {
        acpi_specific_hotkey_enabled = FALSE;
        return 1;
@@ -1174,5 +1054,132 @@ __setup("acpi_generic_hotkey", acpi_hotkey_setup);
  */
 unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
 
-
 EXPORT_SYMBOL(max_cstate);
+
+/*
+ * Acquire a spinlock.
+ *
+ * handle is a pointer to the spinlock_t.
+ * flags is *not* the result of save_flags - it is an ACPI-specific flag variable
+ *   that indicates whether we are at interrupt level.
+ */
+
+unsigned long acpi_os_acquire_lock(acpi_handle handle)
+{
+       unsigned long flags;
+       spin_lock_irqsave((spinlock_t *) handle, flags);
+       return flags;
+}
+
+/*
+ * Release a spinlock. See above.
+ */
+
+void acpi_os_release_lock(acpi_handle handle, unsigned long flags)
+{
+       spin_unlock_irqrestore((spinlock_t *) handle, flags);
+}
+
+#ifndef ACPI_USE_LOCAL_CACHE
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_create_cache
+ *
+ * PARAMETERS:  CacheName       - Ascii name for the cache
+ *              ObjectSize      - Size of each cached object
+ *              MaxDepth        - Maximum depth of the cache (in objects)
+ *              ReturnCache     - Where the new cache object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
+{
+       *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL);
+       return AE_OK;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_purge_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
+{
+       (void)kmem_cache_shrink(cache);
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_delete_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ *              cache object.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
+{
+       (void)kmem_cache_destroy(cache);
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_release_object
+ *
+ * PARAMETERS:  Cache       - Handle to cache object
+ *              Object      - The object to be released
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Release an object to the specified cache.  If cache is full,
+ *              the object is deleted.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
+{
+       kmem_cache_free(cache, object);
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_acquire_object
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *              ReturnObject    - Where the object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
+ *              the object is allocated.
+ *
+ ******************************************************************************/
+
+void *acpi_os_acquire_object(acpi_cache_t * cache)
+{
+       void *object = kmem_cache_alloc(cache, GFP_KERNEL);
+       WARN_ON(!object);
+       return object;
+}
+
+#endif
index bbdd286c660d581147efccba0c49a5d58ffde7c0..db24ee09cf11777a11e20e293c9fb85031366be8 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for all Linux ACPI interpreter subdirectories
 #
 
-obj-y := psargs.o    psparse.o  pstree.o   pswalk.o  \
+obj-y := psargs.o    psparse.o  psloop.o pstree.o   pswalk.o  \
         psopcode.o  psscope.o  psutils.o  psxface.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
index b7ac68cc9e1c71babe183cd6096e68ec7df9fb53..5858188f94a69912220474c7af6142e7ba494b53 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psargs")
+ACPI_MODULE_NAME("psargs")
 
 /* Local prototypes */
-
 static u32
-acpi_ps_get_next_package_length (
-       struct acpi_parse_state         *parser_state);
-
-static union acpi_parse_object *
-acpi_ps_get_next_field (
-       struct acpi_parse_state         *parser_state);
+acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
 
+static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
+                                                      *parser_state);
 
 /*******************************************************************************
  *
@@ -75,49 +70,43 @@ acpi_ps_get_next_field (
  ******************************************************************************/
 
 static u32
-acpi_ps_get_next_package_length (
-       struct acpi_parse_state         *parser_state)
+acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
 {
-       u32                             encoded_length;
-       u32                             length = 0;
+       u32 encoded_length;
+       u32 length = 0;
 
+       ACPI_FUNCTION_TRACE("ps_get_next_package_length");
 
-       ACPI_FUNCTION_TRACE ("ps_get_next_package_length");
-
-
-       encoded_length = (u32) ACPI_GET8 (parser_state->aml);
+       encoded_length = (u32) ACPI_GET8(parser_state->aml);
        parser_state->aml++;
 
-       switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
-       case 0: /* 1-byte encoding (bits 0-5) */
+       switch (encoded_length >> 6) {  /* bits 6-7 contain encoding scheme */
+       case 0:         /* 1-byte encoding (bits 0-5) */
 
                length = (encoded_length & 0x3F);
                break;
 
+       case 1:         /* 2-byte encoding (next byte + bits 0-3) */
 
-       case 1: /* 2-byte encoding (next byte + bits 0-3) */
-
-               length = ((ACPI_GET8 (parser_state->aml) << 04) |
-                                (encoded_length & 0x0F));
+               length = ((ACPI_GET8(parser_state->aml) << 04) |
+                         (encoded_length & 0x0F));
                parser_state->aml++;
                break;
 
+       case 2:         /* 3-byte encoding (next 2 bytes + bits 0-3) */
 
-       case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
-
-               length = ((ACPI_GET8 (parser_state->aml + 1) << 12) |
-                                 (ACPI_GET8 (parser_state->aml)    << 04) |
-                                 (encoded_length & 0x0F));
+               length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
+                         (ACPI_GET8(parser_state->aml) << 04) |
+                         (encoded_length & 0x0F));
                parser_state->aml += 2;
                break;
 
+       case 3:         /* 4-byte encoding (next 3 bytes + bits 0-3) */
 
-       case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
-
-               length = ((ACPI_GET8 (parser_state->aml + 2) << 20) |
-                                 (ACPI_GET8 (parser_state->aml + 1) << 12) |
-                                 (ACPI_GET8 (parser_state->aml)    << 04) |
-                                 (encoded_length & 0x0F));
+               length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
+                         (ACPI_GET8(parser_state->aml + 1) << 12) |
+                         (ACPI_GET8(parser_state->aml) << 04) |
+                         (encoded_length & 0x0F));
                parser_state->aml += 3;
                break;
 
@@ -127,10 +116,9 @@ acpi_ps_get_next_package_length (
                break;
        }
 
-       return_VALUE (length);
+       return_VALUE(length);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_package_end
@@ -144,25 +132,21 @@ acpi_ps_get_next_package_length (
  *
  ******************************************************************************/
 
-u8 *
-acpi_ps_get_next_package_end (
-       struct acpi_parse_state         *parser_state)
+u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
 {
-       u8                              *start = parser_state->aml;
-       acpi_native_uint                length;
-
-
-       ACPI_FUNCTION_TRACE ("ps_get_next_package_end");
+       u8 *start = parser_state->aml;
+       acpi_native_uint length;
 
+       ACPI_FUNCTION_TRACE("ps_get_next_package_end");
 
        /* Function below changes parser_state->Aml */
 
-       length = (acpi_native_uint) acpi_ps_get_next_package_length (parser_state);
+       length =
+           (acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
 
-       return_PTR (start + length); /* end of package */
+       return_PTR(start + length);     /* end of package */
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_namestring
@@ -178,20 +162,16 @@ acpi_ps_get_next_package_end (
  *
  ******************************************************************************/
 
-char *
-acpi_ps_get_next_namestring (
-       struct acpi_parse_state         *parser_state)
+char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
 {
-       u8                              *start = parser_state->aml;
-       u8                              *end = parser_state->aml;
-
-
-       ACPI_FUNCTION_TRACE ("ps_get_next_namestring");
+       u8 *start = parser_state->aml;
+       u8 *end = parser_state->aml;
 
+       ACPI_FUNCTION_TRACE("ps_get_next_namestring");
 
        /* Handle multiple prefix characters */
 
-       while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) {
+       while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
                /* Include prefix '\\' or '^' */
 
                end++;
@@ -199,7 +179,7 @@ acpi_ps_get_next_namestring (
 
        /* Decode the path */
 
-       switch (ACPI_GET8 (end)) {
+       switch (ACPI_GET8(end)) {
        case 0:
 
                /* null_name */
@@ -221,7 +201,7 @@ acpi_ps_get_next_namestring (
 
                /* Multiple name segments, 4 chars each */
 
-               end += 2 + ((acpi_size) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE);
+               end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE);
                break;
 
        default:
@@ -232,11 +212,10 @@ acpi_ps_get_next_namestring (
                break;
        }
 
-       parser_state->aml = (u8*) end;
-       return_PTR ((char *) start);
+       parser_state->aml = (u8 *) end;
+       return_PTR((char *)start);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_namepath
@@ -259,24 +238,20 @@ acpi_ps_get_next_namestring (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_get_next_namepath (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *arg,
-       u8                              method_call)
+acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
+                         struct acpi_parse_state *parser_state,
+                         union acpi_parse_object *arg, u8 method_call)
 {
-       char                            *path;
-       union acpi_parse_object         *name_op;
-       acpi_status                     status = AE_OK;
-       union acpi_operand_object       *method_desc;
-       struct acpi_namespace_node      *node;
-       union acpi_generic_state        scope_info;
+       char *path;
+       union acpi_parse_object *name_op;
+       acpi_status status = AE_OK;
+       union acpi_operand_object *method_desc;
+       struct acpi_namespace_node *node;
+       union acpi_generic_state scope_info;
 
+       ACPI_FUNCTION_TRACE("ps_get_next_namepath");
 
-       ACPI_FUNCTION_TRACE ("ps_get_next_namepath");
-
-
-       path = acpi_ps_get_next_namestring (parser_state);
+       path = acpi_ps_get_next_namestring(parser_state);
 
        /* Null path case is allowed */
 
@@ -296,49 +271,50 @@ acpi_ps_get_next_namepath (
                 * parent tree, but don't open a new scope -- we just want to lookup the
                 * object  (MUST BE mode EXECUTE to perform upsearch)
                 */
-               status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
-                                ACPI_IMODE_EXECUTE,
-                                ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                                NULL, &node);
-               if (ACPI_SUCCESS (status) && method_call) {
+               status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
+                                       ACPI_IMODE_EXECUTE,
+                                       ACPI_NS_SEARCH_PARENT |
+                                       ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
+               if (ACPI_SUCCESS(status) && method_call) {
                        if (node->type == ACPI_TYPE_METHOD) {
                                /* This name is actually a control method invocation */
 
-                               method_desc = acpi_ns_get_attached_object (node);
-                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                                       "Control Method - %p Desc %p Path=%p\n",
-                                       node, method_desc, path));
+                               method_desc = acpi_ns_get_attached_object(node);
+                               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                                 "Control Method - %p Desc %p Path=%p\n",
+                                                 node, method_desc, path));
 
-                               name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
+                               name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
                                if (!name_op) {
-                                       return_ACPI_STATUS (AE_NO_MEMORY);
+                                       return_ACPI_STATUS(AE_NO_MEMORY);
                                }
 
                                /* Change arg into a METHOD CALL and attach name to it */
 
-                               acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
+                               acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
                                name_op->common.value.name = path;
 
                                /* Point METHODCALL/NAME to the METHOD Node */
 
                                name_op->common.node = node;
-                               acpi_ps_append_arg (arg, name_op);
+                               acpi_ps_append_arg(arg, name_op);
 
                                if (!method_desc) {
-                                       ACPI_REPORT_ERROR ((
-                                               "ps_get_next_namepath: Control Method %p has no attached object\n",
-                                               node));
-                                       return_ACPI_STATUS (AE_AML_INTERNAL);
+                                       ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
+                                       return_ACPI_STATUS(AE_AML_INTERNAL);
                                }
 
-                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                                       "Control Method - %p Args %X\n",
-                                       node, method_desc->method.param_count));
+                               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                                 "Control Method - %p Args %X\n",
+                                                 node,
+                                                 method_desc->method.
+                                                 param_count));
 
                                /* Get the number of arguments to expect */
 
-                               walk_state->arg_count = method_desc->method.param_count;
-                               return_ACPI_STATUS (AE_OK);
+                               walk_state->arg_count =
+                                   method_desc->method.param_count;
+                               return_ACPI_STATUS(AE_OK);
                        }
 
                        /*
@@ -348,25 +324,26 @@ acpi_ps_get_next_namepath (
                         */
                }
 
-               if (ACPI_FAILURE (status)) {
+               if (ACPI_FAILURE(status)) {
                        /*
                         * 1) Any error other than NOT_FOUND is always severe
                         * 2) NOT_FOUND is only important if we are executing a method.
                         * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
                         */
-                       if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
-                               (status == AE_NOT_FOUND)                                                &&
-                               (walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) ||
-
-                               (status != AE_NOT_FOUND)) {
-                               ACPI_REPORT_NSERROR (path, status);
-
-                               acpi_os_printf ("search_node %p start_node %p return_node %p\n",
-                                       scope_info.scope.node, parser_state->start_node, node);
-
-
-                       }
-                       else {
+                       if ((((walk_state->
+                              parse_flags & ACPI_PARSE_MODE_MASK) ==
+                             ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND)
+                            && (walk_state->op->common.aml_opcode !=
+                                AML_COND_REF_OF_OP))
+                           || (status != AE_NOT_FOUND)) {
+                               ACPI_REPORT_NSERROR(path, status);
+
+                               acpi_os_printf
+                                   ("search_node %p start_node %p return_node %p\n",
+                                    scope_info.scope.node,
+                                    parser_state->start_node, node);
+
+                       } else {
                                /*
                                 * We got a NOT_FOUND during table load or we encountered
                                 * a cond_ref_of(x) where the target does not exist.
@@ -381,13 +358,12 @@ acpi_ps_get_next_namepath (
         * Regardless of success/failure above,
         * Just initialize the Op with the pathname.
         */
-       acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
+       acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
        arg->common.value.name = path;
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_simple_arg
@@ -403,87 +379,81 @@ acpi_ps_get_next_namepath (
  ******************************************************************************/
 
 void
-acpi_ps_get_next_simple_arg (
-       struct acpi_parse_state         *parser_state,
-       u32                             arg_type,
-       union acpi_parse_object         *arg)
+acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
+                           u32 arg_type, union acpi_parse_object *arg)
 {
 
-       ACPI_FUNCTION_TRACE_U32 ("ps_get_next_simple_arg", arg_type);
-
+       ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
 
        switch (arg_type) {
        case ARGP_BYTEDATA:
 
-               acpi_ps_init_op (arg, AML_BYTE_OP);
-               arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml);
+               acpi_ps_init_op(arg, AML_BYTE_OP);
+               arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
                parser_state->aml++;
                break;
 
-
        case ARGP_WORDDATA:
 
-               acpi_ps_init_op (arg, AML_WORD_OP);
+               acpi_ps_init_op(arg, AML_WORD_OP);
 
                /* Get 2 bytes from the AML stream */
 
-               ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml);
+               ACPI_MOVE_16_TO_32(&arg->common.value.integer,
+                                  parser_state->aml);
                parser_state->aml += 2;
                break;
 
-
        case ARGP_DWORDDATA:
 
-               acpi_ps_init_op (arg, AML_DWORD_OP);
+               acpi_ps_init_op(arg, AML_DWORD_OP);
 
                /* Get 4 bytes from the AML stream */
 
-               ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml);
+               ACPI_MOVE_32_TO_32(&arg->common.value.integer,
+                                  parser_state->aml);
                parser_state->aml += 4;
                break;
 
-
        case ARGP_QWORDDATA:
 
-               acpi_ps_init_op (arg, AML_QWORD_OP);
+               acpi_ps_init_op(arg, AML_QWORD_OP);
 
                /* Get 8 bytes from the AML stream */
 
-               ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml);
+               ACPI_MOVE_64_TO_64(&arg->common.value.integer,
+                                  parser_state->aml);
                parser_state->aml += 8;
                break;
 
-
        case ARGP_CHARLIST:
 
-               acpi_ps_init_op (arg, AML_STRING_OP);
-               arg->common.value.string = (char *) parser_state->aml;
+               acpi_ps_init_op(arg, AML_STRING_OP);
+               arg->common.value.string = (char *)parser_state->aml;
 
-               while (ACPI_GET8 (parser_state->aml) != '\0') {
+               while (ACPI_GET8(parser_state->aml) != '\0') {
                        parser_state->aml++;
                }
                parser_state->aml++;
                break;
 
-
        case ARGP_NAME:
        case ARGP_NAMESTRING:
 
-               acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
-               arg->common.value.name = acpi_ps_get_next_namestring (parser_state);
+               acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
+               arg->common.value.name =
+                   acpi_ps_get_next_namestring(parser_state);
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("Invalid arg_type %X\n", arg_type));
+               ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
                break;
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_field
@@ -496,24 +466,21 @@ acpi_ps_get_next_simple_arg (
  *
  ******************************************************************************/
 
-static union acpi_parse_object *
-acpi_ps_get_next_field (
-       struct acpi_parse_state         *parser_state)
+static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
+                                                      *parser_state)
 {
-       u32                             aml_offset = (u32)
-                         ACPI_PTR_DIFF (parser_state->aml,
-                                          parser_state->aml_start);
-       union acpi_parse_object         *field;
-       u16                             opcode;
-       u32                             name;
-
-
-       ACPI_FUNCTION_TRACE ("ps_get_next_field");
+       u32 aml_offset = (u32)
+           ACPI_PTR_DIFF(parser_state->aml,
+                         parser_state->aml_start);
+       union acpi_parse_object *field;
+       u16 opcode;
+       u32 name;
 
+       ACPI_FUNCTION_TRACE("ps_get_next_field");
 
        /* Determine field type */
 
-       switch (ACPI_GET8 (parser_state->aml)) {
+       switch (ACPI_GET8(parser_state->aml)) {
        default:
 
                opcode = AML_INT_NAMEDFIELD_OP;
@@ -534,9 +501,9 @@ acpi_ps_get_next_field (
 
        /* Allocate a new field op */
 
-       field = acpi_ps_alloc_op (opcode);
+       field = acpi_ps_alloc_op(opcode);
        if (!field) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        field->common.aml_offset = aml_offset;
@@ -548,33 +515,34 @@ acpi_ps_get_next_field (
 
                /* Get the 4-character name */
 
-               ACPI_MOVE_32_TO_32 (&name, parser_state->aml);
-               acpi_ps_set_name (field, name);
+               ACPI_MOVE_32_TO_32(&name, parser_state->aml);
+               acpi_ps_set_name(field, name);
                parser_state->aml += ACPI_NAME_SIZE;
 
                /* Get the length which is encoded as a package length */
 
-               field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+               field->common.value.size =
+                   acpi_ps_get_next_package_length(parser_state);
                break;
 
-
        case AML_INT_RESERVEDFIELD_OP:
 
                /* Get the length which is encoded as a package length */
 
-               field->common.value.size = acpi_ps_get_next_package_length (parser_state);
+               field->common.value.size =
+                   acpi_ps_get_next_package_length(parser_state);
                break;
 
-
        case AML_INT_ACCESSFIELD_OP:
 
                /*
                 * Get access_type and access_attrib and merge into the field Op
                 * access_type is first operand, access_attribute is second
                 */
-               field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8);
+               field->common.value.integer =
+                   (ACPI_GET8(parser_state->aml) << 8);
                parser_state->aml++;
-               field->common.value.integer |= ACPI_GET8 (parser_state->aml);
+               field->common.value.integer |= ACPI_GET8(parser_state->aml);
                parser_state->aml++;
                break;
 
@@ -584,10 +552,9 @@ acpi_ps_get_next_field (
                break;
        }
 
-       return_PTR (field);
+       return_PTR(field);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_next_arg
@@ -605,21 +572,17 @@ acpi_ps_get_next_field (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_get_next_arg (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_parse_state         *parser_state,
-       u32                             arg_type,
-       union acpi_parse_object         **return_arg)
+acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
+                    struct acpi_parse_state *parser_state,
+                    u32 arg_type, union acpi_parse_object **return_arg)
 {
-       union acpi_parse_object         *arg = NULL;
-       union acpi_parse_object         *prev = NULL;
-       union acpi_parse_object         *field;
-       u32                             subop;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_get_next_arg", parser_state);
+       union acpi_parse_object *arg = NULL;
+       union acpi_parse_object *prev = NULL;
+       union acpi_parse_object *field;
+       u32 subop;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
 
        switch (arg_type) {
        case ARGP_BYTEDATA:
@@ -631,37 +594,35 @@ acpi_ps_get_next_arg (
 
                /* Constants, strings, and namestrings are all the same size */
 
-               arg = acpi_ps_alloc_op (AML_BYTE_OP);
+               arg = acpi_ps_alloc_op(AML_BYTE_OP);
                if (!arg) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
-               acpi_ps_get_next_simple_arg (parser_state, arg_type, arg);
+               acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
                break;
 
-
        case ARGP_PKGLENGTH:
 
                /* Package length, nothing returned */
 
-               parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state);
+               parser_state->pkg_end =
+                   acpi_ps_get_next_package_end(parser_state);
                break;
 
-
        case ARGP_FIELDLIST:
 
                if (parser_state->aml < parser_state->pkg_end) {
                        /* Non-empty list */
 
                        while (parser_state->aml < parser_state->pkg_end) {
-                               field = acpi_ps_get_next_field (parser_state);
+                               field = acpi_ps_get_next_field(parser_state);
                                if (!field) {
-                                       return_ACPI_STATUS (AE_NO_MEMORY);
+                                       return_ACPI_STATUS(AE_NO_MEMORY);
                                }
 
                                if (prev) {
                                        prev->common.next = field;
-                               }
-                               else {
+                               } else {
                                        arg = field;
                                }
                                prev = field;
@@ -673,21 +634,21 @@ acpi_ps_get_next_arg (
                }
                break;
 
-
        case ARGP_BYTELIST:
 
                if (parser_state->aml < parser_state->pkg_end) {
                        /* Non-empty list */
 
-                       arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP);
+                       arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
                        if (!arg) {
-                               return_ACPI_STATUS (AE_NO_MEMORY);
+                               return_ACPI_STATUS(AE_NO_MEMORY);
                        }
 
                        /* Fill in bytelist data */
 
                        arg->common.value.size = (u32)
-                               ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
+                           ACPI_PTR_DIFF(parser_state->pkg_end,
+                                         parser_state->aml);
                        arg->named.data = parser_state->aml;
 
                        /* Skip to End of byte data */
@@ -696,32 +657,31 @@ acpi_ps_get_next_arg (
                }
                break;
 
-
        case ARGP_TARGET:
        case ARGP_SUPERNAME:
        case ARGP_SIMPLENAME:
 
-               subop = acpi_ps_peek_opcode (parser_state);
-               if (subop == 0                  ||
-                       acpi_ps_is_leading_char (subop) ||
-                       acpi_ps_is_prefix_char (subop)) {
+               subop = acpi_ps_peek_opcode(parser_state);
+               if (subop == 0 ||
+                   acpi_ps_is_leading_char(subop) ||
+                   acpi_ps_is_prefix_char(subop)) {
                        /* null_name or name_string */
 
-                       arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
+                       arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
                        if (!arg) {
-                               return_ACPI_STATUS (AE_NO_MEMORY);
+                               return_ACPI_STATUS(AE_NO_MEMORY);
                        }
 
-                       status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
-               }
-               else {
+                       status =
+                           acpi_ps_get_next_namepath(walk_state, parser_state,
+                                                     arg, 0);
+               } else {
                        /* Single complex argument, nothing returned */
 
                        walk_state->arg_count = 1;
                }
                break;
 
-
        case ARGP_DATAOBJ:
        case ARGP_TERMARG:
 
@@ -730,7 +690,6 @@ acpi_ps_get_next_arg (
                walk_state->arg_count = 1;
                break;
 
-
        case ARGP_DATAOBJLIST:
        case ARGP_TERMLIST:
        case ARGP_OBJLIST:
@@ -742,14 +701,13 @@ acpi_ps_get_next_arg (
                }
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("Invalid arg_type: %X\n", arg_type));
+               ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type));
                status = AE_AML_OPERAND_TYPE;
                break;
        }
 
        *return_arg = arg;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
new file mode 100644 (file)
index 0000000..088d339
--- /dev/null
@@ -0,0 +1,874 @@
+/******************************************************************************
+ *
+ * Module Name: psloop - Main AML parse loop
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+/*
+ * Parse the AML and build an operation tree as most interpreters,
+ * like Perl, do.  Parsing is done by hand rather than with a YACC
+ * generated parser to tightly constrain stack and dynamic memory
+ * usage.  At the same time, parsing is kept flexible and the code
+ * fairly compact by parsing based on a list of AML opcode
+ * templates in aml_op_info[]
+ */
+
+#include <acpi/acpi.h>
+#include <acpi/acparser.h>
+#include <acpi/acdispat.h>
+#include <acpi/amlcode.h>
+
+#define _COMPONENT          ACPI_PARSER
+ACPI_MODULE_NAME("psloop")
+
+static u32 acpi_gbl_depth = 0;
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_parse_loop
+ *
+ * PARAMETERS:  walk_state          - Current state
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ *              a tree of ops.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
+{
+       acpi_status status = AE_OK;
+       acpi_status status2;
+       union acpi_parse_object *op = NULL;     /* current op */
+       union acpi_parse_object *arg = NULL;
+       union acpi_parse_object *pre_op = NULL;
+       struct acpi_parse_state *parser_state;
+       u8 *aml_op_start = NULL;
+
+       ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state);
+
+       if (walk_state->descending_callback == NULL) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       parser_state = &walk_state->parser_state;
+       walk_state->arg_types = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+       if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
+               /* We are restarting a preempted control method */
+
+               if (acpi_ps_has_completed_scope(parser_state)) {
+                       /*
+                        * We must check if a predicate to an IF or WHILE statement
+                        * was just completed
+                        */
+                       if ((parser_state->scope->parse_scope.op) &&
+                           ((parser_state->scope->parse_scope.op->common.
+                             aml_opcode == AML_IF_OP)
+                            || (parser_state->scope->parse_scope.op->common.
+                                aml_opcode == AML_WHILE_OP))
+                           && (walk_state->control_state)
+                           && (walk_state->control_state->common.state ==
+                               ACPI_CONTROL_PREDICATE_EXECUTING)) {
+                               /*
+                                * A predicate was just completed, get the value of the
+                                * predicate and branch based on that value
+                                */
+                               walk_state->op = NULL;
+                               status =
+                                   acpi_ds_get_predicate_value(walk_state,
+                                                               ACPI_TO_POINTER
+                                                               (TRUE));
+                               if (ACPI_FAILURE(status)
+                                   && ((status & AE_CODE_MASK) !=
+                                       AE_CODE_CONTROL)) {
+                                       if (status == AE_AML_NO_RETURN_VALUE) {
+                                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                                 "Invoked method did not return a value, %s\n",
+                                                                 acpi_format_exception
+                                                                 (status)));
+
+                                       }
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "get_predicate Failed, %s\n",
+                                                         acpi_format_exception
+                                                         (status)));
+                                       return_ACPI_STATUS(status);
+                               }
+
+                               status =
+                                   acpi_ps_next_parse_state(walk_state, op,
+                                                            status);
+                       }
+
+                       acpi_ps_pop_scope(parser_state, &op,
+                                         &walk_state->arg_types,
+                                         &walk_state->arg_count);
+                       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                         "Popped scope, Op=%p\n", op));
+               } else if (walk_state->prev_op) {
+                       /* We were in the middle of an op */
+
+                       op = walk_state->prev_op;
+                       walk_state->arg_types = walk_state->prev_arg_types;
+               }
+       }
+#endif
+
+       /* Iterative parsing loop, while there is more AML to process: */
+
+       while ((parser_state->aml < parser_state->aml_end) || (op)) {
+               aml_op_start = parser_state->aml;
+               if (!op) {
+                       /* Get the next opcode from the AML stream */
+
+                       walk_state->aml_offset =
+                           (u32) ACPI_PTR_DIFF(parser_state->aml,
+                                               parser_state->aml_start);
+                       walk_state->opcode = acpi_ps_peek_opcode(parser_state);
+
+                       /*
+                        * First cut to determine what we have found:
+                        * 1) A valid AML opcode
+                        * 2) A name string
+                        * 3) An unknown/invalid opcode
+                        */
+                       walk_state->op_info =
+                           acpi_ps_get_opcode_info(walk_state->opcode);
+                       switch (walk_state->op_info->class) {
+                       case AML_CLASS_ASCII:
+                       case AML_CLASS_PREFIX:
+                               /*
+                                * Starts with a valid prefix or ASCII char, this is a name
+                                * string.  Convert the bare name string to a namepath.
+                                */
+                               walk_state->opcode = AML_INT_NAMEPATH_OP;
+                               walk_state->arg_types = ARGP_NAMESTRING;
+                               break;
+
+                       case AML_CLASS_UNKNOWN:
+
+                               /* The opcode is unrecognized.  Just skip unknown opcodes */
+
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
+                                                 walk_state->opcode,
+                                                 parser_state->aml,
+                                                 walk_state->aml_offset));
+
+                               ACPI_DUMP_BUFFER(parser_state->aml, 128);
+
+                               /* Assume one-byte bad opcode */
+
+                               parser_state->aml++;
+                               continue;
+
+                       default:
+
+                               /* Found opcode info, this is a normal opcode */
+
+                               parser_state->aml +=
+                                   acpi_ps_get_opcode_size(walk_state->opcode);
+                               walk_state->arg_types =
+                                   walk_state->op_info->parse_args;
+                               break;
+                       }
+
+                       /* Create Op structure and append to parent's argument list */
+
+                       if (walk_state->op_info->flags & AML_NAMED) {
+                               /* Allocate a new pre_op if necessary */
+
+                               if (!pre_op) {
+                                       pre_op =
+                                           acpi_ps_alloc_op(walk_state->
+                                                            opcode);
+                                       if (!pre_op) {
+                                               status = AE_NO_MEMORY;
+                                               goto close_this_op;
+                                       }
+                               }
+
+                               pre_op->common.value.arg = NULL;
+                               pre_op->common.aml_opcode = walk_state->opcode;
+
+                               /*
+                                * Get and append arguments until we find the node that contains
+                                * the name (the type ARGP_NAME).
+                                */
+                               while (GET_CURRENT_ARG_TYPE
+                                      (walk_state->arg_types)
+                                      &&
+                                      (GET_CURRENT_ARG_TYPE
+                                       (walk_state->arg_types) != ARGP_NAME)) {
+                                       status =
+                                           acpi_ps_get_next_arg(walk_state,
+                                                                parser_state,
+                                                                GET_CURRENT_ARG_TYPE
+                                                                (walk_state->
+                                                                 arg_types),
+                                                                &arg);
+                                       if (ACPI_FAILURE(status)) {
+                                               goto close_this_op;
+                                       }
+
+                                       acpi_ps_append_arg(pre_op, arg);
+                                       INCREMENT_ARG_LIST(walk_state->
+                                                          arg_types);
+                               }
+
+                               /*
+                                * Make sure that we found a NAME and didn't run out of
+                                * arguments
+                                */
+                               if (!GET_CURRENT_ARG_TYPE
+                                   (walk_state->arg_types)) {
+                                       status = AE_AML_NO_OPERAND;
+                                       goto close_this_op;
+                               }
+
+                               /* We know that this arg is a name, move to next arg */
+
+                               INCREMENT_ARG_LIST(walk_state->arg_types);
+
+                               /*
+                                * Find the object.  This will either insert the object into
+                                * the namespace or simply look it up
+                                */
+                               walk_state->op = NULL;
+
+                               status =
+                                   walk_state->descending_callback(walk_state,
+                                                                   &op);
+                               if (ACPI_FAILURE(status)) {
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "During name lookup/catalog, %s\n",
+                                                         acpi_format_exception
+                                                         (status)));
+                                       goto close_this_op;
+                               }
+
+                               if (!op) {
+                                       continue;
+                               }
+
+                               status =
+                                   acpi_ps_next_parse_state(walk_state, op,
+                                                            status);
+                               if (status == AE_CTRL_PENDING) {
+                                       status = AE_OK;
+                                       goto close_this_op;
+                               }
+
+                               if (ACPI_FAILURE(status)) {
+                                       goto close_this_op;
+                               }
+
+                               acpi_ps_append_arg(op,
+                                                  pre_op->common.value.arg);
+                               acpi_gbl_depth++;
+
+                               if (op->common.aml_opcode == AML_REGION_OP) {
+                                       /*
+                                        * Defer final parsing of an operation_region body,
+                                        * because we don't have enough info in the first pass
+                                        * to parse it correctly (i.e., there may be method
+                                        * calls within the term_arg elements of the body.)
+                                        *
+                                        * However, we must continue parsing because
+                                        * the opregion is not a standalone package --
+                                        * we don't know where the end is at this point.
+                                        *
+                                        * (Length is unknown until parse of the body complete)
+                                        */
+                                       op->named.data = aml_op_start;
+                                       op->named.length = 0;
+                               }
+                       } else {
+                               /* Not a named opcode, just allocate Op and append to parent */
+
+                               walk_state->op_info =
+                                   acpi_ps_get_opcode_info(walk_state->opcode);
+                               op = acpi_ps_alloc_op(walk_state->opcode);
+                               if (!op) {
+                                       status = AE_NO_MEMORY;
+                                       goto close_this_op;
+                               }
+
+                               if (walk_state->op_info->flags & AML_CREATE) {
+                                       /*
+                                        * Backup to beginning of create_xXXfield declaration
+                                        * body_length is unknown until we parse the body
+                                        */
+                                       op->named.data = aml_op_start;
+                                       op->named.length = 0;
+                               }
+
+                               acpi_ps_append_arg(acpi_ps_get_parent_scope
+                                                  (parser_state), op);
+
+                               if ((walk_state->descending_callback != NULL)) {
+                                       /*
+                                        * Find the object. This will either insert the object into
+                                        * the namespace or simply look it up
+                                        */
+                                       walk_state->op = op;
+
+                                       status =
+                                           walk_state->
+                                           descending_callback(walk_state,
+                                                               &op);
+                                       status =
+                                           acpi_ps_next_parse_state(walk_state,
+                                                                    op,
+                                                                    status);
+                                       if (status == AE_CTRL_PENDING) {
+                                               status = AE_OK;
+                                               goto close_this_op;
+                                       }
+
+                                       if (ACPI_FAILURE(status)) {
+                                               goto close_this_op;
+                                       }
+                               }
+                       }
+
+                       op->common.aml_offset = walk_state->aml_offset;
+
+                       if (walk_state->op_info) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                                 "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
+                                                 (u32) op->common.aml_opcode,
+                                                 walk_state->op_info->name, op,
+                                                 parser_state->aml,
+                                                 op->common.aml_offset));
+                       }
+               }
+
+               /*
+                * Start arg_count at zero because we don't know if there are
+                * any args yet
+                */
+               walk_state->arg_count = 0;
+
+               /* Are there any arguments that must be processed? */
+
+               if (walk_state->arg_types) {
+                       /* Get arguments */
+
+                       switch (op->common.aml_opcode) {
+                       case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
+                       case AML_WORD_OP:       /* AML_WORDDATA_ARG */
+                       case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+                       case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
+                       case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
+
+                               /* Fill in constant or string argument directly */
+
+                               acpi_ps_get_next_simple_arg(parser_state,
+                                                           GET_CURRENT_ARG_TYPE
+                                                           (walk_state->
+                                                            arg_types), op);
+                               break;
+
+                       case AML_INT_NAMEPATH_OP:       /* AML_NAMESTRING_ARG */
+
+                               status =
+                                   acpi_ps_get_next_namepath(walk_state,
+                                                             parser_state, op,
+                                                             1);
+                               if (ACPI_FAILURE(status)) {
+                                       goto close_this_op;
+                               }
+
+                               walk_state->arg_types = 0;
+                               break;
+
+                       default:
+                               /*
+                                * Op is not a constant or string, append each argument
+                                * to the Op
+                                */
+                               while (GET_CURRENT_ARG_TYPE
+                                      (walk_state->arg_types)
+                                      && !walk_state->arg_count) {
+                                       walk_state->aml_offset = (u32)
+                                           ACPI_PTR_DIFF(parser_state->aml,
+                                                         parser_state->
+                                                         aml_start);
+
+                                       status =
+                                           acpi_ps_get_next_arg(walk_state,
+                                                                parser_state,
+                                                                GET_CURRENT_ARG_TYPE
+                                                                (walk_state->
+                                                                 arg_types),
+                                                                &arg);
+                                       if (ACPI_FAILURE(status)) {
+                                               goto close_this_op;
+                                       }
+
+                                       if (arg) {
+                                               arg->common.aml_offset =
+                                                   walk_state->aml_offset;
+                                               acpi_ps_append_arg(op, arg);
+                                       }
+                                       INCREMENT_ARG_LIST(walk_state->
+                                                          arg_types);
+                               }
+
+                               /* Special processing for certain opcodes */
+
+                               /* TBD (remove): Temporary mechanism to disable this code if needed */
+
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+
+                               if ((walk_state->pass_number <=
+                                    ACPI_IMODE_LOAD_PASS1)
+                                   &&
+                                   ((walk_state->
+                                     parse_flags & ACPI_PARSE_DISASSEMBLE) ==
+                                    0)) {
+                                       /*
+                                        * We want to skip If/Else/While constructs during Pass1
+                                        * because we want to actually conditionally execute the
+                                        * code during Pass2.
+                                        *
+                                        * Except for disassembly, where we always want to
+                                        * walk the If/Else/While packages
+                                        */
+                                       switch (op->common.aml_opcode) {
+                                       case AML_IF_OP:
+                                       case AML_ELSE_OP:
+                                       case AML_WHILE_OP:
+
+                                               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                                                 "Pass1: Skipping an If/Else/While body\n"));
+
+                                               /* Skip body of if/else/while in pass 1 */
+
+                                               parser_state->aml =
+                                                   parser_state->pkg_end;
+                                               walk_state->arg_count = 0;
+                                               break;
+
+                                       default:
+                                               break;
+                                       }
+                               }
+#endif
+                               switch (op->common.aml_opcode) {
+                               case AML_METHOD_OP:
+
+                                       /*
+                                        * Skip parsing of control method
+                                        * because we don't have enough info in the first pass
+                                        * to parse it correctly.
+                                        *
+                                        * Save the length and address of the body
+                                        */
+                                       op->named.data = parser_state->aml;
+                                       op->named.length =
+                                           (u32) (parser_state->pkg_end -
+                                                  parser_state->aml);
+
+                                       /* Skip body of method */
+
+                                       parser_state->aml =
+                                           parser_state->pkg_end;
+                                       walk_state->arg_count = 0;
+                                       break;
+
+                               case AML_BUFFER_OP:
+                               case AML_PACKAGE_OP:
+                               case AML_VAR_PACKAGE_OP:
+
+                                       if ((op->common.parent) &&
+                                           (op->common.parent->common.
+                                            aml_opcode == AML_NAME_OP)
+                                           && (walk_state->pass_number <=
+                                               ACPI_IMODE_LOAD_PASS2)) {
+                                               /*
+                                                * Skip parsing of Buffers and Packages
+                                                * because we don't have enough info in the first pass
+                                                * to parse them correctly.
+                                                */
+                                               op->named.data = aml_op_start;
+                                               op->named.length =
+                                                   (u32) (parser_state->
+                                                          pkg_end -
+                                                          aml_op_start);
+
+                                               /* Skip body */
+
+                                               parser_state->aml =
+                                                   parser_state->pkg_end;
+                                               walk_state->arg_count = 0;
+                                       }
+                                       break;
+
+                               case AML_WHILE_OP:
+
+                                       if (walk_state->control_state) {
+                                               walk_state->control_state->
+                                                   control.package_end =
+                                                   parser_state->pkg_end;
+                                       }
+                                       break;
+
+                               default:
+
+                                       /* No action for all other opcodes */
+                                       break;
+                               }
+                               break;
+                       }
+               }
+
+               /* Check for arguments that need to be processed */
+
+               if (walk_state->arg_count) {
+                       /*
+                        * There are arguments (complex ones), push Op and
+                        * prepare for argument
+                        */
+                       status = acpi_ps_push_scope(parser_state, op,
+                                                   walk_state->arg_types,
+                                                   walk_state->arg_count);
+                       if (ACPI_FAILURE(status)) {
+                               goto close_this_op;
+                       }
+                       op = NULL;
+                       continue;
+               }
+
+               /*
+                * All arguments have been processed -- Op is complete,
+                * prepare for next
+                */
+               walk_state->op_info =
+                   acpi_ps_get_opcode_info(op->common.aml_opcode);
+               if (walk_state->op_info->flags & AML_NAMED) {
+                       if (acpi_gbl_depth) {
+                               acpi_gbl_depth--;
+                       }
+
+                       if (op->common.aml_opcode == AML_REGION_OP) {
+                               /*
+                                * Skip parsing of control method or opregion body,
+                                * because we don't have enough info in the first pass
+                                * to parse them correctly.
+                                *
+                                * Completed parsing an op_region declaration, we now
+                                * know the length.
+                                */
+                               op->named.length =
+                                   (u32) (parser_state->aml - op->named.data);
+                       }
+               }
+
+               if (walk_state->op_info->flags & AML_CREATE) {
+                       /*
+                        * Backup to beginning of create_xXXfield declaration (1 for
+                        * Opcode)
+                        *
+                        * body_length is unknown until we parse the body
+                        */
+                       op->named.length =
+                           (u32) (parser_state->aml - op->named.data);
+               }
+
+               /* This op complete, notify the dispatcher */
+
+               if (walk_state->ascending_callback != NULL) {
+                       walk_state->op = op;
+                       walk_state->opcode = op->common.aml_opcode;
+
+                       status = walk_state->ascending_callback(walk_state);
+                       status =
+                           acpi_ps_next_parse_state(walk_state, op, status);
+                       if (status == AE_CTRL_PENDING) {
+                               status = AE_OK;
+                               goto close_this_op;
+                       }
+               }
+
+             close_this_op:
+               /*
+                * Finished one argument of the containing scope
+                */
+               parser_state->scope->parse_scope.arg_count--;
+
+               /* Finished with pre_op */
+
+               if (pre_op) {
+                       acpi_ps_free_op(pre_op);
+                       pre_op = NULL;
+               }
+
+               /* Close this Op (will result in parse subtree deletion) */
+
+               status2 = acpi_ps_complete_this_op(walk_state, op);
+               if (ACPI_FAILURE(status2)) {
+                       return_ACPI_STATUS(status2);
+               }
+               op = NULL;
+
+               switch (status) {
+               case AE_OK:
+                       break;
+
+               case AE_CTRL_TRANSFER:
+
+                       /* We are about to transfer to a called method. */
+
+                       walk_state->prev_op = op;
+                       walk_state->prev_arg_types = walk_state->arg_types;
+                       return_ACPI_STATUS(status);
+
+               case AE_CTRL_END:
+
+                       acpi_ps_pop_scope(parser_state, &op,
+                                         &walk_state->arg_types,
+                                         &walk_state->arg_count);
+
+                       if (op) {
+                               walk_state->op = op;
+                               walk_state->op_info =
+                                   acpi_ps_get_opcode_info(op->common.
+                                                           aml_opcode);
+                               walk_state->opcode = op->common.aml_opcode;
+
+                               status =
+                                   walk_state->ascending_callback(walk_state);
+                               status =
+                                   acpi_ps_next_parse_state(walk_state, op,
+                                                            status);
+
+                               status2 =
+                                   acpi_ps_complete_this_op(walk_state, op);
+                               if (ACPI_FAILURE(status2)) {
+                                       return_ACPI_STATUS(status2);
+                               }
+                               op = NULL;
+                       }
+                       status = AE_OK;
+                       break;
+
+               case AE_CTRL_BREAK:
+               case AE_CTRL_CONTINUE:
+
+                       /* Pop off scopes until we find the While */
+
+                       while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
+                               acpi_ps_pop_scope(parser_state, &op,
+                                                 &walk_state->arg_types,
+                                                 &walk_state->arg_count);
+                       }
+
+                       /* Close this iteration of the While loop */
+
+                       walk_state->op = op;
+                       walk_state->op_info =
+                           acpi_ps_get_opcode_info(op->common.aml_opcode);
+                       walk_state->opcode = op->common.aml_opcode;
+
+                       status = walk_state->ascending_callback(walk_state);
+                       status =
+                           acpi_ps_next_parse_state(walk_state, op, status);
+
+                       status2 = acpi_ps_complete_this_op(walk_state, op);
+                       if (ACPI_FAILURE(status2)) {
+                               return_ACPI_STATUS(status2);
+                       }
+                       op = NULL;
+
+                       status = AE_OK;
+                       break;
+
+               case AE_CTRL_TERMINATE:
+
+                       status = AE_OK;
+
+                       /* Clean up */
+                       do {
+                               if (op) {
+                                       status2 =
+                                           acpi_ps_complete_this_op(walk_state,
+                                                                    op);
+                                       if (ACPI_FAILURE(status2)) {
+                                               return_ACPI_STATUS(status2);
+                                       }
+                               }
+                               acpi_ps_pop_scope(parser_state, &op,
+                                                 &walk_state->arg_types,
+                                                 &walk_state->arg_count);
+
+                       } while (op);
+
+                       return_ACPI_STATUS(status);
+
+               default:        /* All other non-AE_OK status */
+
+                       do {
+                               if (op) {
+                                       status2 =
+                                           acpi_ps_complete_this_op(walk_state,
+                                                                    op);
+                                       if (ACPI_FAILURE(status2)) {
+                                               return_ACPI_STATUS(status2);
+                                       }
+                               }
+                               acpi_ps_pop_scope(parser_state, &op,
+                                                 &walk_state->arg_types,
+                                                 &walk_state->arg_count);
+
+                       } while (op);
+
+                       /*
+                        * TBD: Cleanup parse ops on error
+                        */
+#if 0
+                       if (op == NULL) {
+                               acpi_ps_pop_scope(parser_state, &op,
+                                                 &walk_state->arg_types,
+                                                 &walk_state->arg_count);
+                       }
+#endif
+                       walk_state->prev_op = op;
+                       walk_state->prev_arg_types = walk_state->arg_types;
+                       return_ACPI_STATUS(status);
+               }
+
+               /* This scope complete? */
+
+               if (acpi_ps_has_completed_scope(parser_state)) {
+                       acpi_ps_pop_scope(parser_state, &op,
+                                         &walk_state->arg_types,
+                                         &walk_state->arg_count);
+                       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                         "Popped scope, Op=%p\n", op));
+               } else {
+                       op = NULL;
+               }
+
+       }                       /* while parser_state->Aml */
+
+       /*
+        * Complete the last Op (if not completed), and clear the scope stack.
+        * It is easily possible to end an AML "package" with an unbounded number
+        * of open scopes (such as when several ASL blocks are closed with
+        * sequential closing braces).  We want to terminate each one cleanly.
+        */
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
+                         op));
+       do {
+               if (op) {
+                       if (walk_state->ascending_callback != NULL) {
+                               walk_state->op = op;
+                               walk_state->op_info =
+                                   acpi_ps_get_opcode_info(op->common.
+                                                           aml_opcode);
+                               walk_state->opcode = op->common.aml_opcode;
+
+                               status =
+                                   walk_state->ascending_callback(walk_state);
+                               status =
+                                   acpi_ps_next_parse_state(walk_state, op,
+                                                            status);
+                               if (status == AE_CTRL_PENDING) {
+                                       status = AE_OK;
+                                       goto close_this_op;
+                               }
+
+                               if (status == AE_CTRL_TERMINATE) {
+                                       status = AE_OK;
+
+                                       /* Clean up */
+                                       do {
+                                               if (op) {
+                                                       status2 =
+                                                           acpi_ps_complete_this_op
+                                                           (walk_state, op);
+                                                       if (ACPI_FAILURE
+                                                           (status2)) {
+                                                               return_ACPI_STATUS
+                                                                   (status2);
+                                                       }
+                                               }
+
+                                               acpi_ps_pop_scope(parser_state,
+                                                                 &op,
+                                                                 &walk_state->
+                                                                 arg_types,
+                                                                 &walk_state->
+                                                                 arg_count);
+
+                                       } while (op);
+
+                                       return_ACPI_STATUS(status);
+                               }
+
+                               else if (ACPI_FAILURE(status)) {
+                                       /* First error is most important */
+
+                                       (void)
+                                           acpi_ps_complete_this_op(walk_state,
+                                                                    op);
+                                       return_ACPI_STATUS(status);
+                               }
+                       }
+
+                       status2 = acpi_ps_complete_this_op(walk_state, op);
+                       if (ACPI_FAILURE(status2)) {
+                               return_ACPI_STATUS(status2);
+                       }
+               }
+
+               acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types,
+                                 &walk_state->arg_count);
+
+       } while (op);
+
+       return_ACPI_STATUS(status);
+}
index 5744673568c0a3bbc8100de14179dea48d785be1..229ae86afe8beb8cd7150f8b1518ec54d8e663c4 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acopcode.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psopcode")
-
+ACPI_MODULE_NAME("psopcode")
 
 /*******************************************************************************
  *
@@ -62,7 +59,6 @@
  *              the operand type.
  *
  ******************************************************************************/
-
 /*
  * Summary of opcode types/flags
  *
        AML_CREATE_QWORD_FIELD_OP
 
  ******************************************************************************/
-
-
 /*
  * Master Opcode information table.  A summary of everything we know about each
  * opcode, all in one place.
  */
-const struct acpi_opcode_info     acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
-{
+const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
 /*! [Begin] no source code translation */
 /* Index           Name                 Parser Args               Interpreter Args                ObjectType                    Class                      Type                  Flags */
 
-/* 00 */ ACPI_OP ("Zero",               ARGP_ZERO_OP,              ARGI_ZERO_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
-/* 01 */ ACPI_OP ("One",                ARGP_ONE_OP,               ARGI_ONE_OP,                ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
-/* 02 */ ACPI_OP ("Alias",              ARGP_ALIAS_OP,             ARGI_ALIAS_OP,              ACPI_TYPE_LOCAL_ALIAS,       AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 03 */ ACPI_OP ("Name",               ARGP_NAME_OP,              ARGI_NAME_OP,               ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 04 */ ACPI_OP ("ByteConst",          ARGP_BYTE_OP,              ARGI_BYTE_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 05 */ ACPI_OP ("WordConst",          ARGP_WORD_OP,              ARGI_WORD_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 06 */ ACPI_OP ("DwordConst",         ARGP_DWORD_OP,             ARGI_DWORD_OP,              ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 07 */ ACPI_OP ("String",             ARGP_STRING_OP,            ARGI_STRING_OP,             ACPI_TYPE_STRING,            AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 08 */ ACPI_OP ("Scope",              ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_TYPE_LOCAL_SCOPE,       AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 09 */ ACPI_OP ("Buffer",             ARGP_BUFFER_OP,            ARGI_BUFFER_OP,             ACPI_TYPE_BUFFER,            AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
-/* 0A */ ACPI_OP ("Package",            ARGP_PACKAGE_OP,           ARGI_PACKAGE_OP,            ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
-/* 0B */ ACPI_OP ("Method",             ARGP_METHOD_OP,            ARGI_METHOD_OP,             ACPI_TYPE_METHOD,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 0C */ ACPI_OP ("Local0",             ARGP_LOCAL0,               ARGI_LOCAL0,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0D */ ACPI_OP ("Local1",             ARGP_LOCAL1,               ARGI_LOCAL1,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0E */ ACPI_OP ("Local2",             ARGP_LOCAL2,               ARGI_LOCAL2,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 0F */ ACPI_OP ("Local3",             ARGP_LOCAL3,               ARGI_LOCAL3,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 10 */ ACPI_OP ("Local4",             ARGP_LOCAL4,               ARGI_LOCAL4,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 11 */ ACPI_OP ("Local5",             ARGP_LOCAL5,               ARGI_LOCAL5,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 12 */ ACPI_OP ("Local6",             ARGP_LOCAL6,               ARGI_LOCAL6,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 13 */ ACPI_OP ("Local7",             ARGP_LOCAL7,               ARGI_LOCAL7,                ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LOCAL_VARIABLE,  0),
-/* 14 */ ACPI_OP ("Arg0",               ARGP_ARG0,                 ARGI_ARG0,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 15 */ ACPI_OP ("Arg1",               ARGP_ARG1,                 ARGI_ARG1,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 16 */ ACPI_OP ("Arg2",               ARGP_ARG2,                 ARGI_ARG2,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 17 */ ACPI_OP ("Arg3",               ARGP_ARG3,                 ARGI_ARG3,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 18 */ ACPI_OP ("Arg4",               ARGP_ARG4,                 ARGI_ARG4,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 19 */ ACPI_OP ("Arg5",               ARGP_ARG5,                 ARGI_ARG5,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1A */ ACPI_OP ("Arg6",               ARGP_ARG6,                 ARGI_ARG6,                  ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_METHOD_ARGUMENT, 0),
-/* 1B */ ACPI_OP ("Store",              ARGP_STORE_OP,             ARGI_STORE_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 1C */ ACPI_OP ("RefOf",              ARGP_REF_OF_OP,            ARGI_REF_OF_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R),
-/* 1D */ ACPI_OP ("Add",                ARGP_ADD_OP,               ARGI_ADD_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 1E */ ACPI_OP ("Concatenate",        ARGP_CONCAT_OP,            ARGI_CONCAT_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 1F */ ACPI_OP ("Subtract",           ARGP_SUBTRACT_OP,          ARGI_SUBTRACT_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 20 */ ACPI_OP ("Increment",          ARGP_INCREMENT_OP,         ARGI_INCREMENT_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 21 */ ACPI_OP ("Decrement",          ARGP_DECREMENT_OP,         ARGI_DECREMENT_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 22 */ ACPI_OP ("Multiply",           ARGP_MULTIPLY_OP,          ARGI_MULTIPLY_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 23 */ ACPI_OP ("Divide",             ARGP_DIVIDE_OP,            ARGI_DIVIDE_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_2T_1R,   AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
-/* 24 */ ACPI_OP ("ShiftLeft",          ARGP_SHIFT_LEFT_OP,        ARGI_SHIFT_LEFT_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 25 */ ACPI_OP ("ShiftRight",         ARGP_SHIFT_RIGHT_OP,       ARGI_SHIFT_RIGHT_OP,        ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 26 */ ACPI_OP ("And",                ARGP_BIT_AND_OP,           ARGI_BIT_AND_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 27 */ ACPI_OP ("NAnd",               ARGP_BIT_NAND_OP,          ARGI_BIT_NAND_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 28 */ ACPI_OP ("Or",                 ARGP_BIT_OR_OP,            ARGI_BIT_OR_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 29 */ ACPI_OP ("NOr",                ARGP_BIT_NOR_OP,           ARGI_BIT_NOR_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 2A */ ACPI_OP ("XOr",                ARGP_BIT_XOR_OP,           ARGI_BIT_XOR_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
-/* 2B */ ACPI_OP ("Not",                ARGP_BIT_NOT_OP,           ARGI_BIT_NOT_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2C */ ACPI_OP ("FindSetLeftBit",     ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP,  ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2D */ ACPI_OP ("FindSetRightBit",    ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 2E */ ACPI_OP ("DerefOf",            ARGP_DEREF_OF_OP,          ARGI_DEREF_OF_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R),
-/* 2F */ ACPI_OP ("Notify",             ARGP_NOTIFY_OP,            ARGI_NOTIFY_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_0R,   AML_FLAGS_EXEC_2A_0T_0R),
-/* 30 */ ACPI_OP ("SizeOf",             ARGP_SIZE_OF_OP,           ARGI_SIZE_OF_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
-/* 31 */ ACPI_OP ("Index",              ARGP_INDEX_OP,             ARGI_INDEX_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R),
-/* 32 */ ACPI_OP ("Match",              ARGP_MATCH_OP,             ARGI_MATCH_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_6A_0T_1R,   AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
-/* 33 */ ACPI_OP ("CreateDWordField",   ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 34 */ ACPI_OP ("CreateWordField",    ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP,  ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 35 */ ACPI_OP ("CreateByteField",    ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP,  ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 36 */ ACPI_OP ("CreateBitField",     ARGP_CREATE_BIT_FIELD_OP,  ARGI_CREATE_BIT_FIELD_OP,   ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 37 */ ACPI_OP ("ObjectType",         ARGP_TYPE_OP,              ARGI_TYPE_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
-/* 38 */ ACPI_OP ("LAnd",               ARGP_LAND_OP,              ARGI_LAND_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
-/* 39 */ ACPI_OP ("LOr",                ARGP_LOR_OP,               ARGI_LOR_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
-/* 3A */ ACPI_OP ("LNot",               ARGP_LNOT_OP,              ARGI_LNOT_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_1R,   AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
-/* 3B */ ACPI_OP ("LEqual",             ARGP_LEQUAL_OP,            ARGI_LEQUAL_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3C */ ACPI_OP ("LGreater",           ARGP_LGREATER_OP,          ARGI_LGREATER_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3D */ ACPI_OP ("LLess",              ARGP_LLESS_OP,             ARGI_LLESS_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
-/* 3E */ ACPI_OP ("If",                 ARGP_IF_OP,                ARGI_IF_OP,                 ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 3F */ ACPI_OP ("Else",               ARGP_ELSE_OP,              ARGI_ELSE_OP,               ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 40 */ ACPI_OP ("While",              ARGP_WHILE_OP,             ARGI_WHILE_OP,              ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 41 */ ACPI_OP ("Noop",               ARGP_NOOP_OP,              ARGI_NOOP_OP,               ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 42 */ ACPI_OP ("Return",             ARGP_RETURN_OP,            ARGI_RETURN_OP,             ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         AML_HAS_ARGS),
-/* 43 */ ACPI_OP ("Break",              ARGP_BREAK_OP,             ARGI_BREAK_OP,              ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 44 */ ACPI_OP ("BreakPoint",         ARGP_BREAK_POINT_OP,       ARGI_BREAK_POINT_OP,        ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 45 */ ACPI_OP ("Ones",               ARGP_ONES_OP,              ARGI_ONES_OP,               ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        AML_CONSTANT),
+/* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER,
+                        AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER,
+                        AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
+/* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP,
+                        ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_SIMPLE,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP,
+                        ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_CONSTANT),
+/* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP,
+                        ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_CONSTANT),
+/* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP,
+                        ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_CONSTANT),
+/* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP,
+                        ACPI_TYPE_STRING, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_CONSTANT),
+/* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
+                        ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_NO_OBJ,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP,
+                        ACPI_TYPE_BUFFER, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_OBJECT,
+                        AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP,
+                        ACPI_TYPE_PACKAGE, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_OBJECT,
+                        AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
+/* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP,
+                        ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_COMPLEX,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LOCAL_VARIABLE, 0),
+/* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_METHOD_ARGUMENT, 0),
+/* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R),
+/* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R),
+/* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_2T_1R,
+                        AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
+/* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
+/* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP,
+                        ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,
+                        ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
+/* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
+/* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R),
+/* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R,
+                        AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
+/* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,
+                        ARGI_CREATE_DWORD_FIELD_OP,
+                        ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_CREATE),
+/* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP,
+                        ARGI_CREATE_WORD_FIELD_OP,
+                        ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_CREATE),
+/* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP,
+                        ARGI_CREATE_BYTE_FIELD_OP,
+                        ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_CREATE),
+/* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP,
+                        ARGI_CREATE_BIT_FIELD_OP,
+                        ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_CREATE),
+/* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
+/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
+                        AML_CONSTANT),
+/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
+                        AML_CONSTANT),
+/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
+                        AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
+/* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
+/* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_CONTROL,
+                        AML_TYPE_CONTROL, AML_HAS_ARGS),
+/* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER,
+                        AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
 
 /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
 
-/* 46 */ ACPI_OP ("Mutex",              ARGP_MUTEX_OP,             ARGI_MUTEX_OP,              ACPI_TYPE_MUTEX,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 47 */ ACPI_OP ("Event",              ARGP_EVENT_OP,             ARGI_EVENT_OP,              ACPI_TYPE_EVENT,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 48 */ ACPI_OP ("CondRefOf",          ARGP_COND_REF_OF_OP,       ARGI_COND_REF_OF_OP,        ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 49 */ ACPI_OP ("CreateField",        ARGP_CREATE_FIELD_OP,      ARGI_CREATE_FIELD_OP,       ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
-/* 4A */ ACPI_OP ("Load",               ARGP_LOAD_OP,              ARGI_LOAD_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_0R,   AML_FLAGS_EXEC_1A_1T_0R),
-/* 4B */ ACPI_OP ("Stall",              ARGP_STALL_OP,             ARGI_STALL_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4C */ ACPI_OP ("Sleep",              ARGP_SLEEP_OP,             ARGI_SLEEP_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4D */ ACPI_OP ("Acquire",            ARGP_ACQUIRE_OP,           ARGI_ACQUIRE_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R),
-/* 4E */ ACPI_OP ("Signal",             ARGP_SIGNAL_OP,            ARGI_SIGNAL_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 4F */ ACPI_OP ("Wait",               ARGP_WAIT_OP,              ARGI_WAIT_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_0T_1R,   AML_FLAGS_EXEC_2A_0T_1R),
-/* 50 */ ACPI_OP ("Reset",              ARGP_RESET_OP,             ARGI_RESET_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 51 */ ACPI_OP ("Release",            ARGP_RELEASE_OP,           ARGI_RELEASE_OP,            ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 52 */ ACPI_OP ("FromBCD",            ARGP_FROM_BCD_OP,          ARGI_FROM_BCD_OP,           ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 53 */ ACPI_OP ("ToBCD",              ARGP_TO_BCD_OP,            ARGI_TO_BCD_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 54 */ ACPI_OP ("Unload",             ARGP_UNLOAD_OP,            ARGI_UNLOAD_OP,             ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_0T_0R,   AML_FLAGS_EXEC_1A_0T_0R),
-/* 55 */ ACPI_OP ("Revision",           ARGP_REVISION_OP,          ARGI_REVISION_OP,           ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        0),
-/* 56 */ ACPI_OP ("Debug",              ARGP_DEBUG_OP,             ARGI_DEBUG_OP,              ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_CONSTANT,        0),
-/* 57 */ ACPI_OP ("Fatal",              ARGP_FATAL_OP,             ARGI_FATAL_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_3A_0T_0R,   AML_FLAGS_EXEC_3A_0T_0R),
-/* 58 */ ACPI_OP ("OperationRegion",    ARGP_REGION_OP,            ARGI_REGION_OP,             ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_COMPLEX,   AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
-/* 59 */ ACPI_OP ("Field",              ARGP_FIELD_OP,             ARGI_FIELD_OP,              ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5A */ ACPI_OP ("Device",             ARGP_DEVICE_OP,            ARGI_DEVICE_OP,             ACPI_TYPE_DEVICE,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5B */ ACPI_OP ("Processor",          ARGP_PROCESSOR_OP,         ARGI_PROCESSOR_OP,          ACPI_TYPE_PROCESSOR,         AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5C */ ACPI_OP ("PowerResource",      ARGP_POWER_RES_OP,         ARGI_POWER_RES_OP,          ACPI_TYPE_POWER,             AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5D */ ACPI_OP ("ThermalZone",        ARGP_THERMAL_ZONE_OP,      ARGI_THERMAL_ZONE_OP,       ACPI_TYPE_THERMAL,           AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 5E */ ACPI_OP ("IndexField",         ARGP_INDEX_FIELD_OP,       ARGI_INDEX_FIELD_OP,        ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
-/* 5F */ ACPI_OP ("BankField",          ARGP_BANK_FIELD_OP,        ARGI_BANK_FIELD_OP,         ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_FIELD,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
+/* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+                        AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP,
+                        ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,
+                        AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_FIELD | AML_CREATE),
+/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
+                        AML_FLAGS_EXEC_1A_1T_0R),
+/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+                        AML_FLAGS_EXEC_1A_0T_0R),
+/* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+                        AML_FLAGS_EXEC_1A_0T_0R),
+/* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
+/* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
+                        AML_FLAGS_EXEC_2A_0T_1R),
+/* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
+                        AML_FLAGS_EXEC_1A_0T_0R),
+/* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
+/* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP,
+                        ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+                        AML_TYPE_CONSTANT, 0),
+/* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_CONSTANT, 0),
+/* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R,
+                        AML_FLAGS_EXEC_3A_0T_0R),
+/* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP,
+                        ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_COMPLEX,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED | AML_DEFER),
+/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_FIELD),
+/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
+                        ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_NO_OBJ,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP,
+                        ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_SIMPLE,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP,
+                        ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_SIMPLE,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP,
+                        ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_FIELD),
+/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_FIELD),
 
 /* Internal opcodes that map to invalid AML opcodes */
 
-/* 60 */ ACPI_OP ("LNotEqual",          ARGP_LNOTEQUAL_OP,         ARGI_LNOTEQUAL_OP,          ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 61 */ ACPI_OP ("LLessEqual",         ARGP_LLESSEQUAL_OP,        ARGI_LLESSEQUAL_OP,         ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 62 */ ACPI_OP ("LGreaterEqual",      ARGP_LGREATEREQUAL_OP,     ARGI_LGREATEREQUAL_OP,      ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_HAS_ARGS | AML_CONSTANT),
-/* 63 */ ACPI_OP ("-NamePath-",         ARGP_NAMEPATH_OP,          ARGI_NAMEPATH_OP,           ACPI_TYPE_LOCAL_REFERENCE,   AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_NSOBJECT | AML_NSNODE ),
-/* 64 */ ACPI_OP ("-MethodCall-",       ARGP_METHODCALL_OP,        ARGI_METHODCALL_OP,         ACPI_TYPE_METHOD,            AML_CLASS_METHOD_CALL,     AML_TYPE_METHOD_CALL,     AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
-/* 65 */ ACPI_OP ("-ByteList-",         ARGP_BYTELIST_OP,          ARGI_BYTELIST_OP,           ACPI_TYPE_ANY,               AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         0),
-/* 66 */ ACPI_OP ("-ReservedField-",    ARGP_RESERVEDFIELD_OP,     ARGI_RESERVEDFIELD_OP,      ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 67 */ ACPI_OP ("-NamedField-",       ARGP_NAMEDFIELD_OP,        ARGI_NAMEDFIELD_OP,         ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
-/* 68 */ ACPI_OP ("-AccessField-",      ARGP_ACCESSFIELD_OP,       ARGI_ACCESSFIELD_OP,        ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 69 */ ACPI_OP ("-StaticString",      ARGP_STATICSTRING_OP,      ARGI_STATICSTRING_OP,       ACPI_TYPE_ANY,               AML_CLASS_INTERNAL,        AML_TYPE_BOGUS,           0),
-/* 6A */ ACPI_OP ("-Return Value-",     ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_RETURN_VALUE,    AML_TYPE_RETURN,          AML_HAS_ARGS | AML_HAS_RETVAL),
-/* 6B */ ACPI_OP ("-UNKNOWN_OP-",       ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_INVALID,           AML_CLASS_UNKNOWN,         AML_TYPE_BOGUS,           AML_HAS_ARGS),
-/* 6C */ ACPI_OP ("-ASCII_ONLY-",       ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_ASCII,           AML_TYPE_BOGUS,           AML_HAS_ARGS),
-/* 6D */ ACPI_OP ("-PREFIX_ONLY-",      ARG_NONE,                  ARG_NONE,                   ACPI_TYPE_ANY,               AML_CLASS_PREFIX,          AML_TYPE_BOGUS,           AML_HAS_ARGS),
+/* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+                        AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+                        AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
+/* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP,
+                        ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_INTERNAL, AML_TYPE_BOGUS,
+                        AML_HAS_ARGS | AML_CONSTANT),
+/* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP,
+                        ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE),
+/* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP,
+                        ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL,
+                        AML_TYPE_METHOD_CALL,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
+/* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, 0),
+/* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP,
+                        ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
+                        AML_TYPE_BOGUS,
+                        AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
+/* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP,
+                        ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP,
+                        ARGI_STATICSTRING_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
+/* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+                        AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN,
+                        AML_HAS_ARGS | AML_HAS_RETVAL),
+/* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID,
+                        AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+                        AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
+/* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
+                        AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
 
 /* ACPI 2.0 opcodes */
 
-/* 6E */ ACPI_OP ("QwordConst",         ARGP_QWORD_OP,             ARGI_QWORD_OP,              ACPI_TYPE_INTEGER,           AML_CLASS_ARGUMENT,        AML_TYPE_LITERAL,         AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package /*Var*/",    ARGP_VAR_PACKAGE_OP,       ARGI_VAR_PACKAGE_OP,        ACPI_TYPE_PACKAGE,           AML_CLASS_CREATE,          AML_TYPE_CREATE_OBJECT,   AML_HAS_ARGS | AML_DEFER),
-/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,    ARGI_CONCAT_RES_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 71 */ ACPI_OP ("Mod",                ARGP_MOD_OP,               ARGI_MOD_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 72 */ ACPI_OP ("CreateQWordField",   ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,      AML_CLASS_CREATE,          AML_TYPE_CREATE_FIELD,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 73 */ ACPI_OP ("ToBuffer",           ARGP_TO_BUFFER_OP,         ARGI_TO_BUFFER_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 74 */ ACPI_OP ("ToDecimalString",    ARGP_TO_DEC_STR_OP,        ARGI_TO_DEC_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 75 */ ACPI_OP ("ToHexString",        ARGP_TO_HEX_STR_OP,        ARGI_TO_HEX_STR_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 76 */ ACPI_OP ("ToInteger",          ARGP_TO_INTEGER_OP,        ARGI_TO_INTEGER_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
-/* 77 */ ACPI_OP ("ToString",           ARGP_TO_STRING_OP,         ARGI_TO_STRING_OP,          ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_2A_1T_1R,   AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
-/* 78 */ ACPI_OP ("CopyObject",         ARGP_COPY_OP,              ARGI_COPY_OP,               ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_1A_1T_1R,   AML_FLAGS_EXEC_1A_1T_1R),
-/* 79 */ ACPI_OP ("Mid",                ARGP_MID_OP,               ARGI_MID_OP,                ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_3A_1T_1R,   AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
-/* 7A */ ACPI_OP ("Continue",           ARGP_CONTINUE_OP,          ARGI_CONTINUE_OP,           ACPI_TYPE_ANY,               AML_CLASS_CONTROL,         AML_TYPE_CONTROL,         0),
-/* 7B */ ACPI_OP ("LoadTable",          ARGP_LOAD_TABLE_OP,        ARGI_LOAD_TABLE_OP,         ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_6A_0T_1R,   AML_FLAGS_EXEC_6A_0T_1R),
-/* 7C */ ACPI_OP ("DataTableRegion",    ARGP_DATA_REGION_OP,       ARGI_DATA_REGION_OP,        ACPI_TYPE_REGION,            AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_SIMPLE,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
-/* 7D */ ACPI_OP ("[EvalSubTree]",      ARGP_SCOPE_OP,             ARGI_SCOPE_OP,              ACPI_TYPE_ANY,               AML_CLASS_NAMED_OBJECT,    AML_TYPE_NAMED_NO_OBJ,    AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
+/* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP,
+                        ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
+                        AML_TYPE_LITERAL, AML_CONSTANT),
+       /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP,
+                        ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE,
+                        AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT,
+                        AML_HAS_ARGS | AML_DEFER),
+/* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,
+                        ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,
+                        ARGI_CREATE_QWORD_FIELD_OP,
+                        ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
+                        AML_TYPE_CREATE_FIELD,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
+                        AML_DEFER | AML_CREATE),
+/* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP,
+                        ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R,
+                        AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
+/* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_2A_1T_1R,
+                        AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
+/* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R,
+                        AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
+/* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
+/* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
+                        AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
+/* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP,
+                        ARGI_DATA_REGION_OP, ACPI_TYPE_REGION,
+                        AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE | AML_NAMED),
+/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
+                        ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
+                        AML_TYPE_NAMED_NO_OBJ,
+                        AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
+                        AML_NSNODE),
 
 /* ACPI 3.0 opcodes */
 
-/* 7E */ ACPI_OP ("Timer",              ARGP_TIMER_OP,             ARGI_TIMER_OP,              ACPI_TYPE_ANY,               AML_CLASS_EXECUTE,         AML_TYPE_EXEC_0A_0T_1R,   AML_FLAGS_EXEC_0A_0T_1R)
+/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
+                        AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
+                        AML_FLAGS_EXEC_0A_0T_1R)
 
 /*! [End] no source code translation !*/
 };
@@ -338,73 +646,70 @@ const struct acpi_opcode_info     acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
  * This table is directly indexed by the opcodes, and returns an
  * index into the table above
  */
-static const u8 acpi_gbl_short_op_index[256] =
-{
+static const u8 acpi_gbl_short_op_index[256] = {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */     0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
-/* 0x08 */     0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
-/* 0x10 */     0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
-/* 0x18 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x20 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x28 */     _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
-/* 0x30 */     0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
-/* 0x38 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */     _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x48 */     _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x50 */     _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
-/* 0x58 */     _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
-/* 0x60 */     0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
-/* 0x68 */     0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
-/* 0x70 */     0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
-/* 0x78 */     0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
-/* 0x80 */     0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
-/* 0x88 */     0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
-/* 0x90 */     0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
-/* 0x98 */     0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
-/* 0xA0 */     0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
-/* 0xA8 */     0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB0 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xB8 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC0 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xC8 */     _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
-/* 0xD0 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xD8 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE0 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xE8 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF0 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0xF8 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
+/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
+/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
+/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
+/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
+/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
+/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
+/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
+/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
+/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
+/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
+/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
+/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
+/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
+/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
+/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
+/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
 };
 
 /*
  * This table is indexed by the second opcode of the extended opcode
  * pair.  It returns an index into the opcode table (acpi_gbl_aml_op_info)
  */
-static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
-{
+static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
 /*              0     1     2     3     4     5     6     7  */
 /*              8     9     A     B     C     D     E     F  */
-/* 0x00 */     _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x08 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x10 */     _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
-/* 0x18 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
-/* 0x20 */     0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
-/* 0x28 */     0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x30 */     0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
-/* 0x38 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x40 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x48 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x50 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x58 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x60 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x68 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x70 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x78 */     _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
-/* 0x80 */     0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
-/* 0x88 */     0x7C,
+/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
+/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
+/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
+/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
+/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
+/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+/* 0x88 */ 0x7C,
 };
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_opcode_info
@@ -418,48 +723,36 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
  *
  ******************************************************************************/
 
-const struct acpi_opcode_info *
-acpi_ps_get_opcode_info (
-       u16                             opcode)
+const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
-       ACPI_FUNCTION_NAME ("ps_get_opcode_info");
-
+       ACPI_FUNCTION_NAME("ps_get_opcode_info");
 
        /*
         * Detect normal 8-bit opcode or extended 16-bit opcode
         */
-       switch ((u8) (opcode >> 8)) {
-       case 0:
-
+       if (!(opcode & 0xFF00)) {
                /* Simple (8-bit) opcode: 0-255, can't index beyond table  */
 
-               return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
-
-       case AML_EXTOP:
-
-               /* Extended (16-bit, prefix+opcode) opcode */
-
-               if (((u8) opcode) <= MAX_EXTENDED_OPCODE) {
-                       return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
-               }
-
-               /* Else fall through to error case below */
-               /*lint -fallthrough */
+               return (&acpi_gbl_aml_op_info
+                       [acpi_gbl_short_op_index[(u8) opcode]]);
+       }
 
-       default:
+       if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
+           (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
+               /* Valid extended (16-bit) opcode */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown AML opcode [%4.4X]\n", opcode));
-               break;
+               return (&acpi_gbl_aml_op_info
+                       [acpi_gbl_long_op_index[(u8) opcode]]);
        }
 
+       /* Unknown AML opcode */
 
-       /* Default is "unknown opcode" */
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "Unknown AML opcode [%4.4X]\n", opcode));
 
-       return (&acpi_gbl_aml_op_info [_UNK]);
+       return (&acpi_gbl_aml_op_info[_UNK]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_opcode_name
@@ -473,16 +766,13 @@ acpi_ps_get_opcode_info (
  *
  ******************************************************************************/
 
-char *
-acpi_ps_get_opcode_name (
-       u16                             opcode)
+char *acpi_ps_get_opcode_name(u16 opcode)
 {
 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
 
-       const struct acpi_opcode_info   *op;
+       const struct acpi_opcode_info *op;
 
-
-       op = acpi_ps_get_opcode_info (opcode);
+       op = acpi_ps_get_opcode_info(opcode);
 
        /* Always guaranteed to return a valid pointer */
 
@@ -493,4 +783,3 @@ acpi_ps_get_opcode_name (
 
 #endif
 }
-
index bbfdc1a58c27aeaca93bd97acb85a1ef46846515..76d4d640d83cdebaa7362742258b2daac841e2d9 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 /*
  * Parse the AML and build an operation tree as most interpreters,
  * like Perl, do.  Parsing is done by hand rather than with a YACC
 #include <acpi/acinterp.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psparse")
-
-
-static u32                          acpi_gbl_depth = 0;
-
-/* Local prototypes */
-
-static void
-acpi_ps_complete_this_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
-static acpi_status
-acpi_ps_next_parse_state (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       acpi_status                     callback_status);
-
-static acpi_status
-acpi_ps_parse_loop (
-       struct acpi_walk_state          *walk_state);
-
+ACPI_MODULE_NAME("psparse")
 
 /*******************************************************************************
  *
@@ -93,10 +71,7 @@ acpi_ps_parse_loop (
  * DESCRIPTION: Get the size of the current opcode.
  *
  ******************************************************************************/
-
-u32
-acpi_ps_get_opcode_size (
-       u32                             opcode)
+u32 acpi_ps_get_opcode_size(u32 opcode)
 {
 
        /* Extended (2-byte) opcode if > 255 */
@@ -110,7 +85,6 @@ acpi_ps_get_opcode_size (
        return (1);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_peek_opcode
@@ -123,28 +97,24 @@ acpi_ps_get_opcode_size (
  *
  ******************************************************************************/
 
-u16
-acpi_ps_peek_opcode (
-       struct acpi_parse_state         *parser_state)
+u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
 {
-       u8                              *aml;
-       u16                             opcode;
-
+       u8 *aml;
+       u16 opcode;
 
        aml = parser_state->aml;
-       opcode = (u16) ACPI_GET8 (aml);
+       opcode = (u16) ACPI_GET8(aml);
 
-       if (opcode == AML_EXTOP) {
-               /* Extended opcode */
+       if (opcode == AML_EXTENDED_OP_PREFIX) {
+               /* Extended opcode, get the second opcode byte */
 
                aml++;
-               opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
+               opcode = (u16) ((opcode << 8) | ACPI_GET8(aml));
        }
 
        return (opcode);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_complete_this_op
@@ -152,47 +122,54 @@ acpi_ps_peek_opcode (
  * PARAMETERS:  walk_state      - Current State
  *              Op              - Op to complete
  *
- * RETURN:      None.
+ * RETURN:      Status
  *
  * DESCRIPTION: Perform any cleanup at the completion of an Op.
  *
  ******************************************************************************/
 
-static void
-acpi_ps_complete_this_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op)
+acpi_status
+acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
+                        union acpi_parse_object * op)
 {
-       union acpi_parse_object         *prev;
-       union acpi_parse_object         *next;
-       const struct acpi_opcode_info   *parent_info;
-       union acpi_parse_object         *replacement_op = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_complete_this_op", op);
+       union acpi_parse_object *prev;
+       union acpi_parse_object *next;
+       const struct acpi_opcode_info *parent_info;
+       union acpi_parse_object *replacement_op = NULL;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
 
        /* Check for null Op, can happen if AML code is corrupt */
 
        if (!op) {
-               return_VOID;
+               return_ACPI_STATUS(AE_OK);      /* OK for now */
        }
 
        /* Delete this op and the subtree below it if asked to */
 
-       if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
-                (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
-               return_VOID;
+       if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
+            ACPI_PARSE_DELETE_TREE)
+           || (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Make sure that we only delete this subtree */
 
        if (op->common.parent) {
+               prev = op->common.parent->common.value.arg;
+               if (!prev) {
+                       /* Nothing more to do */
+
+                       goto cleanup;
+               }
+
                /*
                 * Check if we need to replace the operator and its subtree
                 * with a return value op (placeholder op)
                 */
-               parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
+               parent_info =
+                   acpi_ps_get_opcode_info(op->common.parent->common.
+                                           aml_opcode);
 
                switch (parent_info->class) {
                case AML_CLASS_CONTROL:
@@ -204,9 +181,10 @@ acpi_ps_complete_this_op (
                         * These opcodes contain term_arg operands. The current
                         * op must be replaced by a placeholder return op
                         */
-                       replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+                       replacement_op =
+                           acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto cleanup;
+                               goto allocate_error;
                        }
                        break;
 
@@ -216,91 +194,117 @@ acpi_ps_complete_this_op (
                         * These opcodes contain term_arg operands. The current
                         * op must be replaced by a placeholder return op
                         */
-                       if ((op->common.parent->common.aml_opcode == AML_REGION_OP)      ||
-                               (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
-                               (op->common.parent->common.aml_opcode == AML_BUFFER_OP)      ||
-                               (op->common.parent->common.aml_opcode == AML_PACKAGE_OP)     ||
-                               (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
-                               replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+                       if ((op->common.parent->common.aml_opcode ==
+                            AML_REGION_OP)
+                           || (op->common.parent->common.aml_opcode ==
+                               AML_DATA_REGION_OP)
+                           || (op->common.parent->common.aml_opcode ==
+                               AML_BUFFER_OP)
+                           || (op->common.parent->common.aml_opcode ==
+                               AML_PACKAGE_OP)
+                           || (op->common.parent->common.aml_opcode ==
+                               AML_VAR_PACKAGE_OP)) {
+                               replacement_op =
+                                   acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                                if (!replacement_op) {
-                                       goto cleanup;
+                                       goto allocate_error;
                                }
-                       }
-
-                       if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-                               (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
-                               if ((op->common.aml_opcode == AML_BUFFER_OP) ||
-                                       (op->common.aml_opcode == AML_PACKAGE_OP) ||
-                                       (op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
-                                       replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
+                       } else
+                           if ((op->common.parent->common.aml_opcode ==
+                                AML_NAME_OP)
+                               && (walk_state->pass_number <=
+                                   ACPI_IMODE_LOAD_PASS2)) {
+                               if ((op->common.aml_opcode == AML_BUFFER_OP)
+                                   || (op->common.aml_opcode == AML_PACKAGE_OP)
+                                   || (op->common.aml_opcode ==
+                                       AML_VAR_PACKAGE_OP)) {
+                                       replacement_op =
+                                           acpi_ps_alloc_op(op->common.
+                                                            aml_opcode);
                                        if (!replacement_op) {
-                                               goto cleanup;
+                                               goto allocate_error;
                                        }
 
-                                       replacement_op->named.data = op->named.data;
-                                       replacement_op->named.length = op->named.length;
+                                       replacement_op->named.data =
+                                           op->named.data;
+                                       replacement_op->named.length =
+                                           op->named.length;
                                }
                        }
                        break;
 
                default:
-                       replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
+
+                       replacement_op =
+                           acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
                        if (!replacement_op) {
-                               goto cleanup;
+                               goto allocate_error;
                        }
                }
 
                /* We must unlink this op from the parent tree */
 
-               prev = op->common.parent->common.value.arg;
                if (prev == op) {
                        /* This op is the first in the list */
 
                        if (replacement_op) {
-                               replacement_op->common.parent       = op->common.parent;
-                               replacement_op->common.value.arg    = NULL;
-                               replacement_op->common.node         = op->common.node;
-                               op->common.parent->common.value.arg = replacement_op;
-                               replacement_op->common.next         = op->common.next;
-                       }
-                       else {
-                               op->common.parent->common.value.arg = op->common.next;
+                               replacement_op->common.parent =
+                                   op->common.parent;
+                               replacement_op->common.value.arg = NULL;
+                               replacement_op->common.node = op->common.node;
+                               op->common.parent->common.value.arg =
+                                   replacement_op;
+                               replacement_op->common.next = op->common.next;
+                       } else {
+                               op->common.parent->common.value.arg =
+                                   op->common.next;
                        }
                }
 
                /* Search the parent list */
 
-               else while (prev) {
-                       /* Traverse all siblings in the parent's argument list */
-
-                       next = prev->common.next;
-                       if (next == op) {
-                               if (replacement_op) {
-                                       replacement_op->common.parent   = op->common.parent;
-                                       replacement_op->common.value.arg = NULL;
-                                       replacement_op->common.node     = op->common.node;
-                                       prev->common.next               = replacement_op;
-                                       replacement_op->common.next     = op->common.next;
-                                       next = NULL;
-                               }
-                               else {
-                                       prev->common.next = op->common.next;
-                                       next = NULL;
+               else
+                       while (prev) {
+                               /* Traverse all siblings in the parent's argument list */
+
+                               next = prev->common.next;
+                               if (next == op) {
+                                       if (replacement_op) {
+                                               replacement_op->common.parent =
+                                                   op->common.parent;
+                                               replacement_op->common.value.
+                                                   arg = NULL;
+                                               replacement_op->common.node =
+                                                   op->common.node;
+                                               prev->common.next =
+                                                   replacement_op;
+                                               replacement_op->common.next =
+                                                   op->common.next;
+                                               next = NULL;
+                                       } else {
+                                               prev->common.next =
+                                                   op->common.next;
+                                               next = NULL;
+                                       }
                                }
+                               prev = next;
                        }
-                       prev = next;
-               }
        }
 
-
-cleanup:
+      cleanup:
 
        /* Now we can actually delete the subtree rooted at Op */
 
-       acpi_ps_delete_parse_tree (op);
-       return_VOID;
-}
+       acpi_ps_delete_parse_tree(op);
+       return_ACPI_STATUS(AE_OK);
 
+      allocate_error:
+
+       /* Always delete the subtree, even on error */
+
+       acpi_ps_delete_parse_tree(op);
+       return_ACPI_STATUS(AE_NO_MEMORY);
+}
 
 /*******************************************************************************
  *
@@ -317,18 +321,15 @@ cleanup:
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ps_next_parse_state (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       acpi_status                     callback_status)
+acpi_status
+acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op,
+                        acpi_status callback_status)
 {
-       struct acpi_parse_state         *parser_state = &walk_state->parser_state;
-       acpi_status                     status = AE_CTRL_PENDING;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_next_parse_state", op);
+       struct acpi_parse_state *parser_state = &walk_state->parser_state;
+       acpi_status status = AE_CTRL_PENDING;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
 
        switch (callback_status) {
        case AE_CTRL_TERMINATE:
@@ -341,7 +342,6 @@ acpi_ps_next_parse_state (
                status = AE_CTRL_TERMINATE;
                break;
 
-
        case AE_CTRL_BREAK:
 
                parser_state->aml = walk_state->aml_last_while;
@@ -351,7 +351,6 @@ acpi_ps_next_parse_state (
 
        case AE_CTRL_CONTINUE:
 
-
                parser_state->aml = walk_state->aml_last_while;
                status = AE_CTRL_CONTINUE;
                break;
@@ -375,10 +374,9 @@ acpi_ps_next_parse_state (
                 * Predicate of an IF was true, and we are at the matching ELSE.
                 * Just close out this package
                 */
-               parser_state->aml = acpi_ps_get_next_package_end (parser_state);
+               parser_state->aml = acpi_ps_get_next_package_end(parser_state);
                break;
 
-
        case AE_CTRL_FALSE:
 
                /*
@@ -396,7 +394,6 @@ acpi_ps_next_parse_state (
                status = AE_CTRL_END;
                break;
 
-
        case AE_CTRL_TRANSFER:
 
                /* A method call (invocation) -- transfer control */
@@ -404,14 +401,15 @@ acpi_ps_next_parse_state (
                status = AE_CTRL_TRANSFER;
                walk_state->prev_op = op;
                walk_state->method_call_op = op;
-               walk_state->method_call_node = (op->common.value.arg)->common.node;
+               walk_state->method_call_node =
+                   (op->common.value.arg)->common.node;
 
                /* Will return value (if any) be used by the caller? */
 
-               walk_state->return_used = acpi_ds_is_result_used (op, walk_state);
+               walk_state->return_used =
+                   acpi_ds_is_result_used(op, walk_state);
                break;
 
-
        default:
 
                status = callback_status;
@@ -421,667 +419,9 @@ acpi_ps_next_parse_state (
                break;
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_parse_loop
- *
- * PARAMETERS:  walk_state          - Current state
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- *              a tree of ops.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ps_parse_loop (
-       struct acpi_walk_state          *walk_state)
-{
-       acpi_status                     status = AE_OK;
-       union acpi_parse_object         *op = NULL;     /* current op */
-       union acpi_parse_object         *arg = NULL;
-       union acpi_parse_object         *pre_op = NULL;
-       struct acpi_parse_state         *parser_state;
-       u8                              *aml_op_start = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
-
-       if (walk_state->descending_callback == NULL) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       parser_state = &walk_state->parser_state;
-       walk_state->arg_types = 0;
-
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
-
-       if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
-               /* We are restarting a preempted control method */
-
-               if (acpi_ps_has_completed_scope (parser_state)) {
-                       /*
-                        * We must check if a predicate to an IF or WHILE statement
-                        * was just completed
-                        */
-                       if ((parser_state->scope->parse_scope.op) &&
-                          ((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
-                               (parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
-                               (walk_state->control_state) &&
-                               (walk_state->control_state->common.state ==
-                                       ACPI_CONTROL_PREDICATE_EXECUTING)) {
-                               /*
-                                * A predicate was just completed, get the value of the
-                                * predicate and branch based on that value
-                                */
-                               walk_state->op = NULL;
-                               status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
-                               if (ACPI_FAILURE (status) &&
-                                       ((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
-                                       if (status == AE_AML_NO_RETURN_VALUE) {
-                                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                                       "Invoked method did not return a value, %s\n",
-                                                       acpi_format_exception (status)));
-
-                                       }
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "get_predicate Failed, %s\n",
-                                               acpi_format_exception (status)));
-                                       return_ACPI_STATUS (status);
-                               }
-
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                       }
-
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-               }
-               else if (walk_state->prev_op) {
-                       /* We were in the middle of an op */
-
-                       op = walk_state->prev_op;
-                       walk_state->arg_types = walk_state->prev_arg_types;
-               }
-       }
-#endif
-
-       /* Iterative parsing loop, while there is more AML to process: */
-
-       while ((parser_state->aml < parser_state->aml_end) || (op)) {
-               aml_op_start = parser_state->aml;
-               if (!op) {
-                       /* Get the next opcode from the AML stream */
-
-                       walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
-                                         parser_state->aml_start);
-                       walk_state->opcode   = acpi_ps_peek_opcode (parser_state);
-
-                       /*
-                        * First cut to determine what we have found:
-                        * 1) A valid AML opcode
-                        * 2) A name string
-                        * 3) An unknown/invalid opcode
-                        */
-                       walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
-                       switch (walk_state->op_info->class) {
-                       case AML_CLASS_ASCII:
-                       case AML_CLASS_PREFIX:
-                               /*
-                                * Starts with a valid prefix or ASCII char, this is a name
-                                * string.  Convert the bare name string to a namepath.
-                                */
-                               walk_state->opcode = AML_INT_NAMEPATH_OP;
-                               walk_state->arg_types = ARGP_NAMESTRING;
-                               break;
-
-                       case AML_CLASS_UNKNOWN:
-
-                               /* The opcode is unrecognized.  Just skip unknown opcodes */
-
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
-                                       walk_state->opcode, parser_state->aml, walk_state->aml_offset));
-
-                               ACPI_DUMP_BUFFER (parser_state->aml, 128);
-
-                               /* Assume one-byte bad opcode */
-
-                               parser_state->aml++;
-                               continue;
-
-                       default:
-
-                               /* Found opcode info, this is a normal opcode */
-
-                               parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
-                               walk_state->arg_types = walk_state->op_info->parse_args;
-                               break;
-                       }
-
-                       /* Create Op structure and append to parent's argument list */
-
-                       if (walk_state->op_info->flags & AML_NAMED) {
-                               /* Allocate a new pre_op if necessary */
-
-                               if (!pre_op) {
-                                       pre_op = acpi_ps_alloc_op (walk_state->opcode);
-                                       if (!pre_op) {
-                                               status = AE_NO_MEMORY;
-                                               goto close_this_op;
-                                       }
-                               }
-
-                               pre_op->common.value.arg = NULL;
-                               pre_op->common.aml_opcode = walk_state->opcode;
-
-                               /*
-                                * Get and append arguments until we find the node that contains
-                                * the name (the type ARGP_NAME).
-                                */
-                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-                                         (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
-                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
-                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-
-                                       acpi_ps_append_arg (pre_op, arg);
-                                       INCREMENT_ARG_LIST (walk_state->arg_types);
-                               }
-
-                               /*
-                                * Make sure that we found a NAME and didn't run out of
-                                * arguments
-                                */
-                               if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
-                                       status = AE_AML_NO_OPERAND;
-                                       goto close_this_op;
-                               }
-
-                               /* We know that this arg is a name, move to next arg */
-
-                               INCREMENT_ARG_LIST (walk_state->arg_types);
-
-                               /*
-                                * Find the object.  This will either insert the object into
-                                * the namespace or simply look it up
-                                */
-                               walk_state->op = NULL;
-
-                               status = walk_state->descending_callback (walk_state, &op);
-                               if (ACPI_FAILURE (status)) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "During name lookup/catalog, %s\n",
-                                               acpi_format_exception (status)));
-                                       goto close_this_op;
-                               }
-
-                               if (!op) {
-                                       continue;
-                               }
-
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                               if (status == AE_CTRL_PENDING) {
-                                       status = AE_OK;
-                                       goto close_this_op;
-                               }
-
-                               if (ACPI_FAILURE (status)) {
-                                       goto close_this_op;
-                               }
-
-                               acpi_ps_append_arg (op, pre_op->common.value.arg);
-                               acpi_gbl_depth++;
-
-                               if (op->common.aml_opcode == AML_REGION_OP) {
-                                       /*
-                                        * Defer final parsing of an operation_region body,
-                                        * because we don't have enough info in the first pass
-                                        * to parse it correctly (i.e., there may be method
-                                        * calls within the term_arg elements of the body.)
-                                        *
-                                        * However, we must continue parsing because
-                                        * the opregion is not a standalone package --
-                                        * we don't know where the end is at this point.
-                                        *
-                                        * (Length is unknown until parse of the body complete)
-                                        */
-                                       op->named.data    = aml_op_start;
-                                       op->named.length  = 0;
-                               }
-                       }
-                       else {
-                               /* Not a named opcode, just allocate Op and append to parent */
-
-                               walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
-                               op = acpi_ps_alloc_op (walk_state->opcode);
-                               if (!op) {
-                                       status = AE_NO_MEMORY;
-                                       goto close_this_op;
-                               }
-
-                               if (walk_state->op_info->flags & AML_CREATE) {
-                                       /*
-                                        * Backup to beginning of create_xXXfield declaration
-                                        * body_length is unknown until we parse the body
-                                        */
-                                       op->named.data    = aml_op_start;
-                                       op->named.length  = 0;
-                               }
-
-                               acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
-
-                               if ((walk_state->descending_callback != NULL)) {
-                                       /*
-                                        * Find the object. This will either insert the object into
-                                        * the namespace or simply look it up
-                                        */
-                                       walk_state->op = op;
-
-                                       status = walk_state->descending_callback (walk_state, &op);
-                                       status = acpi_ps_next_parse_state (walk_state, op, status);
-                                       if (status == AE_CTRL_PENDING) {
-                                               status = AE_OK;
-                                               goto close_this_op;
-                                       }
-
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-                               }
-                       }
-
-                       op->common.aml_offset = walk_state->aml_offset;
-
-                       if (walk_state->op_info) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                                       "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
-                                        (u32) op->common.aml_opcode, walk_state->op_info->name,
-                                        op, parser_state->aml, op->common.aml_offset));
-                       }
-               }
-
-
-               /*
-                * Start arg_count at zero because we don't know if there are
-                * any args yet
-                */
-               walk_state->arg_count = 0;
-
-               /* Are there any arguments that must be processed? */
-
-               if (walk_state->arg_types) {
-                       /* Get arguments */
-
-                       switch (op->common.aml_opcode) {
-                       case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
-                       case AML_WORD_OP:       /* AML_WORDDATA_ARG */
-                       case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
-                       case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
-                       case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
-
-                               /* Fill in constant or string argument directly */
-
-                               acpi_ps_get_next_simple_arg (parser_state,
-                                       GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
-                               break;
-
-                       case AML_INT_NAMEPATH_OP:   /* AML_NAMESTRING_ARG */
-
-                               status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
-                               if (ACPI_FAILURE (status)) {
-                                       goto close_this_op;
-                               }
-
-                               walk_state->arg_types = 0;
-                               break;
-
-                       default:
-
-                               /*
-                                * Op is not a constant or string, append each argument
-                                * to the Op
-                                */
-                               while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
-                                               !walk_state->arg_count) {
-                                       walk_state->aml_offset = (u32)
-                                               ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
-
-                                       status = acpi_ps_get_next_arg (walk_state, parser_state,
-                                                        GET_CURRENT_ARG_TYPE (walk_state->arg_types),
-                                                        &arg);
-                                       if (ACPI_FAILURE (status)) {
-                                               goto close_this_op;
-                                       }
-
-                                       if (arg) {
-                                               arg->common.aml_offset = walk_state->aml_offset;
-                                               acpi_ps_append_arg (op, arg);
-                                       }
-                                       INCREMENT_ARG_LIST (walk_state->arg_types);
-                               }
-
-                               /* Special processing for certain opcodes */
-
-                               switch (op->common.aml_opcode) {
-                               case AML_METHOD_OP:
-
-                                       /*
-                                        * Skip parsing of control method
-                                        * because we don't have enough info in the first pass
-                                        * to parse it correctly.
-                                        *
-                                        * Save the length and address of the body
-                                        */
-                                       op->named.data   = parser_state->aml;
-                                       op->named.length = (u32) (parser_state->pkg_end -
-                                                          parser_state->aml);
-
-                                       /* Skip body of method */
-
-                                       parser_state->aml   = parser_state->pkg_end;
-                                       walk_state->arg_count = 0;
-                                       break;
-
-                               case AML_BUFFER_OP:
-                               case AML_PACKAGE_OP:
-                               case AML_VAR_PACKAGE_OP:
-
-                                       if ((op->common.parent) &&
-                                               (op->common.parent->common.aml_opcode == AML_NAME_OP) &&
-                                               (walk_state->descending_callback != acpi_ds_exec_begin_op)) {
-                                               /*
-                                                * Skip parsing of Buffers and Packages
-                                                * because we don't have enough info in the first pass
-                                                * to parse them correctly.
-                                                */
-                                               op->named.data   = aml_op_start;
-                                               op->named.length = (u32) (parser_state->pkg_end -
-                                                                  aml_op_start);
-
-                                               /* Skip body */
-
-                                               parser_state->aml   = parser_state->pkg_end;
-                                               walk_state->arg_count = 0;
-                                       }
-                                       break;
-
-                               case AML_WHILE_OP:
-
-                                       if (walk_state->control_state) {
-                                               walk_state->control_state->control.package_end =
-                                                       parser_state->pkg_end;
-                                       }
-                                       break;
-
-                               default:
-
-                                       /* No action for all other opcodes */
-                                       break;
-                               }
-                               break;
-                       }
-               }
-
-               /* Check for arguments that need to be processed */
-
-               if (walk_state->arg_count) {
-                       /*
-                        * There are arguments (complex ones), push Op and
-                        * prepare for argument
-                        */
-                       status = acpi_ps_push_scope (parser_state, op,
-                                        walk_state->arg_types, walk_state->arg_count);
-                       if (ACPI_FAILURE (status)) {
-                               goto close_this_op;
-                       }
-                       op = NULL;
-                       continue;
-               }
-
-               /*
-                * All arguments have been processed -- Op is complete,
-                * prepare for next
-                */
-               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-               if (walk_state->op_info->flags & AML_NAMED) {
-                       if (acpi_gbl_depth) {
-                               acpi_gbl_depth--;
-                       }
-
-                       if (op->common.aml_opcode == AML_REGION_OP) {
-                               /*
-                                * Skip parsing of control method or opregion body,
-                                * because we don't have enough info in the first pass
-                                * to parse them correctly.
-                                *
-                                * Completed parsing an op_region declaration, we now
-                                * know the length.
-                                */
-                               op->named.length = (u32) (parser_state->aml - op->named.data);
-                       }
-               }
-
-               if (walk_state->op_info->flags & AML_CREATE) {
-                       /*
-                        * Backup to beginning of create_xXXfield declaration (1 for
-                        * Opcode)
-                        *
-                        * body_length is unknown until we parse the body
-                        */
-                       op->named.length = (u32) (parser_state->aml - op->named.data);
-               }
-
-               /* This op complete, notify the dispatcher */
-
-               if (walk_state->ascending_callback != NULL) {
-                       walk_state->op    = op;
-                       walk_state->opcode = op->common.aml_opcode;
-
-                       status = walk_state->ascending_callback (walk_state);
-                       status = acpi_ps_next_parse_state (walk_state, op, status);
-                       if (status == AE_CTRL_PENDING) {
-                               status = AE_OK;
-                               goto close_this_op;
-                       }
-               }
-
-
-close_this_op:
-               /*
-                * Finished one argument of the containing scope
-                */
-               parser_state->scope->parse_scope.arg_count--;
-
-               /* Close this Op (will result in parse subtree deletion) */
-
-               acpi_ps_complete_this_op (walk_state, op);
-               op = NULL;
-               if (pre_op) {
-                       acpi_ps_free_op (pre_op);
-                       pre_op = NULL;
-               }
-
-               switch (status) {
-               case AE_OK:
-                       break;
-
-
-               case AE_CTRL_TRANSFER:
-
-                       /* We are about to transfer to a called method. */
-
-                       walk_state->prev_op = op;
-                       walk_state->prev_arg_types = walk_state->arg_types;
-                       return_ACPI_STATUS (status);
-
-
-               case AE_CTRL_END:
-
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-
-                       if (op) {
-                               walk_state->op    = op;
-                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                               walk_state->opcode = op->common.aml_opcode;
-
-                               status = walk_state->ascending_callback (walk_state);
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-
-                               acpi_ps_complete_this_op (walk_state, op);
-                               op = NULL;
-                       }
-                       status = AE_OK;
-                       break;
-
-
-               case AE_CTRL_BREAK:
-               case AE_CTRL_CONTINUE:
-
-                       /* Pop off scopes until we find the While */
-
-                       while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-                       }
-
-                       /* Close this iteration of the While loop */
-
-                       walk_state->op    = op;
-                       walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                       walk_state->opcode = op->common.aml_opcode;
-
-                       status = walk_state->ascending_callback (walk_state);
-                       status = acpi_ps_next_parse_state (walk_state, op, status);
-
-                       acpi_ps_complete_this_op (walk_state, op);
-                       op = NULL;
-
-                       status = AE_OK;
-                       break;
-
-
-               case AE_CTRL_TERMINATE:
-
-                       status = AE_OK;
-
-                       /* Clean up */
-                       do {
-                               if (op) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                               }
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                       } while (op);
-
-                       return_ACPI_STATUS (status);
-
-
-               default:  /* All other non-AE_OK status */
-
-                       do {
-                               if (op) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                               }
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                       } while (op);
-
-
-                       /*
-                        * TBD: Cleanup parse ops on error
-                        */
-#if 0
-                       if (op == NULL) {
-                               acpi_ps_pop_scope (parser_state, &op,
-                                       &walk_state->arg_types, &walk_state->arg_count);
-                       }
-#endif
-                       walk_state->prev_op = op;
-                       walk_state->prev_arg_types = walk_state->arg_types;
-                       return_ACPI_STATUS (status);
-               }
-
-               /* This scope complete? */
-
-               if (acpi_ps_has_completed_scope (parser_state)) {
-                       acpi_ps_pop_scope (parser_state, &op,
-                               &walk_state->arg_types, &walk_state->arg_count);
-                       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
-               }
-               else {
-                       op = NULL;
-               }
-
-       } /* while parser_state->Aml */
-
-
-       /*
-        * Complete the last Op (if not completed), and clear the scope stack.
-        * It is easily possible to end an AML "package" with an unbounded number
-        * of open scopes (such as when several ASL blocks are closed with
-        * sequential closing braces).  We want to terminate each one cleanly.
-        */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
-       do {
-               if (op) {
-                       if (walk_state->ascending_callback != NULL) {
-                               walk_state->op    = op;
-                               walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-                               walk_state->opcode = op->common.aml_opcode;
-
-                               status = walk_state->ascending_callback (walk_state);
-                               status = acpi_ps_next_parse_state (walk_state, op, status);
-                               if (status == AE_CTRL_PENDING) {
-                                       status = AE_OK;
-                                       goto close_this_op;
-                               }
-
-                               if (status == AE_CTRL_TERMINATE) {
-                                       status = AE_OK;
-
-                                       /* Clean up */
-                                       do {
-                                               if (op) {
-                                                       acpi_ps_complete_this_op (walk_state, op);
-                                               }
-
-                                               acpi_ps_pop_scope (parser_state, &op,
-                                                       &walk_state->arg_types, &walk_state->arg_count);
-
-                                       } while (op);
-
-                                       return_ACPI_STATUS (status);
-                               }
-
-                               else if (ACPI_FAILURE (status)) {
-                                       acpi_ps_complete_this_op (walk_state, op);
-                                       return_ACPI_STATUS (status);
-                               }
-                       }
-
-                       acpi_ps_complete_this_op (walk_state, op);
-               }
-
-               acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
-                       &walk_state->arg_count);
-
-       } while (op);
-
-       return_ACPI_STATUS (status);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_parse_aml
@@ -1095,34 +435,29 @@ close_this_op:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ps_parse_aml (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status;
-       acpi_status                     terminate_status;
-       struct acpi_thread_state        *thread;
-       struct acpi_thread_state        *prev_walk_list = acpi_gbl_current_walk_list;
-       struct acpi_walk_state          *previous_walk_state;
+       acpi_status status;
+       struct acpi_thread_state *thread;
+       struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
+       struct acpi_walk_state *previous_walk_state;
 
+       ACPI_FUNCTION_TRACE("ps_parse_aml");
 
-       ACPI_FUNCTION_TRACE ("ps_parse_aml");
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "Entered with walk_state=%p Aml=%p size=%X\n",
-               walk_state, walk_state->parser_state.aml,
-               walk_state->parser_state.aml_size));
-
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "Entered with walk_state=%p Aml=%p size=%X\n",
+                         walk_state, walk_state->parser_state.aml,
+                         walk_state->parser_state.aml_size));
 
        /* Create and initialize a new thread state */
 
-       thread = acpi_ut_create_thread_state ();
+       thread = acpi_ut_create_thread_state();
        if (!thread) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        walk_state->thread = thread;
-       acpi_ds_push_walk_state (walk_state, thread);
+       acpi_ds_push_walk_state(walk_state, thread);
 
        /*
         * This global allows the AML debugger to get a handle to the currently
@@ -1134,130 +469,136 @@ acpi_ps_parse_aml (
         * Execute the walk loop as long as there is a valid Walk State.  This
         * handles nested control method invocations without recursion.
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state));
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state));
 
        status = AE_OK;
        while (walk_state) {
-               if (ACPI_SUCCESS (status)) {
+               if (ACPI_SUCCESS(status)) {
                        /*
                         * The parse_loop executes AML until the method terminates
                         * or calls another method.
                         */
-                       status = acpi_ps_parse_loop (walk_state);
+                       status = acpi_ps_parse_loop(walk_state);
                }
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                       "Completed one call to walk loop, %s State=%p\n",
-                       acpi_format_exception (status), walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                 "Completed one call to walk loop, %s State=%p\n",
+                                 acpi_format_exception(status), walk_state));
 
                if (status == AE_CTRL_TRANSFER) {
                        /*
                         * A method call was detected.
                         * Transfer control to the called control method
                         */
-                       status = acpi_ds_call_control_method (thread, walk_state, NULL);
+                       status =
+                           acpi_ds_call_control_method(thread, walk_state,
+                                                       NULL);
 
                        /*
                         * If the transfer to the new method method call worked, a new walk
                         * state was created -- get it
                         */
-                       walk_state = acpi_ds_get_current_walk_state (thread);
+                       walk_state = acpi_ds_get_current_walk_state(thread);
                        continue;
-               }
-               else if (status == AE_CTRL_TERMINATE) {
+               } else if (status == AE_CTRL_TERMINATE) {
                        status = AE_OK;
-               }
-               else if ((status != AE_OK) && (walk_state->method_desc)) {
-                       ACPI_REPORT_METHOD_ERROR ("Method execution failed",
-                               walk_state->method_node, NULL, status);
+               } else if ((status != AE_OK) && (walk_state->method_desc)) {
+                       ACPI_REPORT_METHOD_ERROR("Method execution failed",
+                                                walk_state->method_node, NULL,
+                                                status);
+
+                       /* Ensure proper cleanup */
+
+                       walk_state->parse_flags |= ACPI_PARSE_EXECUTE;
 
                        /* Check for possible multi-thread reentrancy problem */
 
                        if ((status == AE_ALREADY_EXISTS) &&
-                               (!walk_state->method_desc->method.semaphore)) {
+                           (!walk_state->method_desc->method.semaphore)) {
                                /*
                                 * This method is marked not_serialized, but it tried to create
                                 * a named object, causing the second thread entrance to fail.
                                 * We will workaround this by marking the method permanently
                                 * as Serialized.
                                 */
-                               walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
+                               walk_state->method_desc->method.method_flags |=
+                                   AML_METHOD_SERIALIZED;
                                walk_state->method_desc->method.concurrency = 1;
                        }
                }
 
-               if (walk_state->method_desc) {
-                       /* Decrement the thread count on the method parse tree */
-
-                       if (walk_state->method_desc->method.thread_count) {
-                               walk_state->method_desc->method.thread_count--;
-                       }
-               }
-
                /* We are done with this walk, move on to the parent if any */
 
-               walk_state = acpi_ds_pop_walk_state (thread);
+               walk_state = acpi_ds_pop_walk_state(thread);
 
                /* Reset the current scope to the beginning of scope stack */
 
-               acpi_ds_scope_stack_clear (walk_state);
+               acpi_ds_scope_stack_clear(walk_state);
 
                /*
                 * If we just returned from the execution of a control method,
                 * there's lots of cleanup to do
                 */
-               if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
-                       terminate_status = acpi_ds_terminate_control_method (walk_state);
-                       if (ACPI_FAILURE (terminate_status)) {
-                               ACPI_REPORT_ERROR ((
-                                       "Could not terminate control method properly\n"));
+               if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
+                   ACPI_PARSE_EXECUTE) {
+                       if (walk_state->method_desc) {
+                               /* Decrement the thread count on the method parse tree */
 
-                               /* Ignore error and continue */
+                               walk_state->method_desc->method.thread_count--;
                        }
+
+                       acpi_ds_terminate_control_method(walk_state);
                }
 
                /* Delete this walk state and all linked control states */
 
-               acpi_ps_cleanup_scope (&walk_state->parser_state);
+               acpi_ps_cleanup_scope(&walk_state->parser_state);
 
                previous_walk_state = walk_state;
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-                       "return_value=%p, implicit_value=%p State=%p\n",
-                       walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
+               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                 "return_value=%p, implicit_value=%p State=%p\n",
+                                 walk_state->return_desc,
+                                 walk_state->implicit_return_obj, walk_state));
 
                /* Check if we have restarted a preempted walk */
 
-               walk_state = acpi_ds_get_current_walk_state (thread);
+               walk_state = acpi_ds_get_current_walk_state(thread);
                if (walk_state) {
-                       if (ACPI_SUCCESS (status)) {
+                       if (ACPI_SUCCESS(status)) {
                                /*
                                 * There is another walk state, restart it.
                                 * If the method return value is not used by the parent,
                                 * The object is deleted
                                 */
                                if (!previous_walk_state->return_desc) {
-                                       status = acpi_ds_restart_control_method (walk_state,
-                                                        previous_walk_state->implicit_return_obj);
-                               }
-                               else {
+                                       status =
+                                           acpi_ds_restart_control_method
+                                           (walk_state,
+                                            previous_walk_state->
+                                            implicit_return_obj);
+                               } else {
                                        /*
                                         * We have a valid return value, delete any implicit
                                         * return value.
                                         */
-                                       acpi_ds_clear_implicit_return (previous_walk_state);
+                                       acpi_ds_clear_implicit_return
+                                           (previous_walk_state);
 
-                                       status = acpi_ds_restart_control_method (walk_state,
-                                                        previous_walk_state->return_desc);
+                                       status =
+                                           acpi_ds_restart_control_method
+                                           (walk_state,
+                                            previous_walk_state->return_desc);
                                }
-                               if (ACPI_SUCCESS (status)) {
-                                       walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
+                               if (ACPI_SUCCESS(status)) {
+                                       walk_state->walk_type |=
+                                           ACPI_WALK_METHOD_RESTART;
                                }
-                       }
-                       else {
+                       } else {
                                /* On error, delete any return object */
 
-                               acpi_ut_remove_reference (previous_walk_state->return_desc);
+                               acpi_ut_remove_reference(previous_walk_state->
+                                                        return_desc);
                        }
                }
 
@@ -1268,37 +609,36 @@ acpi_ps_parse_aml (
                else if (previous_walk_state->caller_return_desc) {
                        if (previous_walk_state->implicit_return_obj) {
                                *(previous_walk_state->caller_return_desc) =
-                                       previous_walk_state->implicit_return_obj;
-                       }
-                       else {
-                                /* NULL if no return value */
+                                   previous_walk_state->implicit_return_obj;
+                       } else {
+                               /* NULL if no return value */
 
                                *(previous_walk_state->caller_return_desc) =
-                                       previous_walk_state->return_desc;
+                                   previous_walk_state->return_desc;
                        }
-               }
-               else {
+               } else {
                        if (previous_walk_state->return_desc) {
                                /* Caller doesn't want it, must delete it */
 
-                               acpi_ut_remove_reference (previous_walk_state->return_desc);
+                               acpi_ut_remove_reference(previous_walk_state->
+                                                        return_desc);
                        }
                        if (previous_walk_state->implicit_return_obj) {
                                /* Caller doesn't want it, must delete it */
 
-                               acpi_ut_remove_reference (previous_walk_state->implicit_return_obj);
+                               acpi_ut_remove_reference(previous_walk_state->
+                                                        implicit_return_obj);
                        }
                }
 
-               acpi_ds_delete_walk_state (previous_walk_state);
+               acpi_ds_delete_walk_state(previous_walk_state);
        }
 
        /* Normal exit */
 
-       acpi_ex_release_all_mutexes (thread);
-       acpi_ut_delete_generic_state (ACPI_CAST_PTR (union acpi_generic_state, thread));
+       acpi_ex_release_all_mutexes(thread);
+       acpi_ut_delete_generic_state(ACPI_CAST_PTR
+                                    (union acpi_generic_state, thread));
        acpi_gbl_current_walk_list = prev_walk_list;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 8dcd1b1e71312e2bbc85dade9c18d6e94137c7ed..1c953b6f1af16958fb7a7163e5fa0ac847650972 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psscope")
-
+ACPI_MODULE_NAME("psscope")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Get parent of current op being parsed
  *
  ******************************************************************************/
-
-union acpi_parse_object *
-acpi_ps_get_parent_scope (
-       struct acpi_parse_state         *parser_state)
+union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
+                                                 *parser_state)
 {
 
        return (parser_state->scope->parse_scope.op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_has_completed_scope
@@ -84,17 +79,14 @@ acpi_ps_get_parent_scope (
  *
  ******************************************************************************/
 
-u8
-acpi_ps_has_completed_scope (
-       struct acpi_parse_state         *parser_state)
+u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state)
 {
 
        return ((u8)
-                       ((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
-                        !parser_state->scope->parse_scope.arg_count)));
+               ((parser_state->aml >= parser_state->scope->parse_scope.arg_end
+                 || !parser_state->scope->parse_scope.arg_count)));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_init_scope
@@ -109,34 +101,30 @@ acpi_ps_has_completed_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_init_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *root_op)
+acpi_ps_init_scope(struct acpi_parse_state * parser_state,
+                  union acpi_parse_object * root_op)
 {
-       union acpi_generic_state        *scope;
+       union acpi_generic_state *scope;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op);
 
-       ACPI_FUNCTION_TRACE_PTR ("ps_init_scope", root_op);
-
-
-       scope = acpi_ut_create_generic_state ();
+       scope = acpi_ut_create_generic_state();
        if (!scope) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       scope->common.data_type     = ACPI_DESC_TYPE_STATE_RPSCOPE;
-       scope->parse_scope.op       = root_op;
+       scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
+       scope->parse_scope.op = root_op;
        scope->parse_scope.arg_count = ACPI_VAR_ARGS;
-       scope->parse_scope.arg_end  = parser_state->aml_end;
-       scope->parse_scope.pkg_end  = parser_state->aml_end;
+       scope->parse_scope.arg_end = parser_state->aml_end;
+       scope->parse_scope.pkg_end = parser_state->aml_end;
 
-       parser_state->scope         = scope;
-       parser_state->start_op      = root_op;
+       parser_state->scope = scope;
+       parser_state->start_op = root_op;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_push_scope
@@ -153,48 +141,42 @@ acpi_ps_init_scope (
  ******************************************************************************/
 
 acpi_status
-acpi_ps_push_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *op,
-       u32                             remaining_args,
-       u32                             arg_count)
+acpi_ps_push_scope(struct acpi_parse_state *parser_state,
+                  union acpi_parse_object *op,
+                  u32 remaining_args, u32 arg_count)
 {
-       union acpi_generic_state        *scope;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_push_scope", op);
+       union acpi_generic_state *scope;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op);
 
-       scope = acpi_ut_create_generic_state ();
+       scope = acpi_ut_create_generic_state();
        if (!scope) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       scope->common.data_type    = ACPI_DESC_TYPE_STATE_PSCOPE;
-       scope->parse_scope.op      = op;
+       scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
+       scope->parse_scope.op = op;
        scope->parse_scope.arg_list = remaining_args;
        scope->parse_scope.arg_count = arg_count;
        scope->parse_scope.pkg_end = parser_state->pkg_end;
 
        /* Push onto scope stack */
 
-       acpi_ut_push_generic_state (&parser_state->scope, scope);
+       acpi_ut_push_generic_state(&parser_state->scope, scope);
 
        if (arg_count == ACPI_VAR_ARGS) {
                /* Multiple arguments */
 
                scope->parse_scope.arg_end = parser_state->pkg_end;
-       }
-       else {
+       } else {
                /* Single argument */
 
-               scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
+               scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_pop_scope
@@ -212,48 +194,41 @@ acpi_ps_push_scope (
  ******************************************************************************/
 
 void
-acpi_ps_pop_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         **op,
-       u32                             *arg_list,
-       u32                             *arg_count)
+acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
+                 union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
 {
-       union acpi_generic_state        *scope = parser_state->scope;
-
-
-       ACPI_FUNCTION_TRACE ("ps_pop_scope");
+       union acpi_generic_state *scope = parser_state->scope;
 
+       ACPI_FUNCTION_TRACE("ps_pop_scope");
 
        /* Only pop the scope if there is in fact a next scope */
 
        if (scope->common.next) {
-               scope = acpi_ut_pop_generic_state (&parser_state->scope);
+               scope = acpi_ut_pop_generic_state(&parser_state->scope);
 
                /* return to parsing previous op */
 
-               *op                 = scope->parse_scope.op;
-               *arg_list           = scope->parse_scope.arg_list;
-               *arg_count          = scope->parse_scope.arg_count;
+               *op = scope->parse_scope.op;
+               *arg_list = scope->parse_scope.arg_list;
+               *arg_count = scope->parse_scope.arg_count;
                parser_state->pkg_end = scope->parse_scope.pkg_end;
 
                /* All done with this scope state structure */
 
-               acpi_ut_delete_generic_state (scope);
-       }
-       else {
+               acpi_ut_delete_generic_state(scope);
+       } else {
                /* empty parse stack, prepare to fetch next opcode */
 
-               *op       = NULL;
+               *op = NULL;
                *arg_list = 0;
                *arg_count = 0;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "Popped Op %p Args %X\n", *op, *arg_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "Popped Op %p Args %X\n", *op, *arg_count));
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_cleanup_scope
@@ -267,15 +242,11 @@ acpi_ps_pop_scope (
  *
  ******************************************************************************/
 
-void
-acpi_ps_cleanup_scope (
-       struct acpi_parse_state         *parser_state)
+void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state)
 {
-       union acpi_generic_state        *scope;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_cleanup_scope", parser_state);
+       union acpi_generic_state *scope;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state);
 
        if (!parser_state) {
                return_VOID;
@@ -284,10 +255,9 @@ acpi_ps_cleanup_scope (
        /* Delete anything on the scope stack */
 
        while (parser_state->scope) {
-               scope = acpi_ut_pop_generic_state (&parser_state->scope);
-               acpi_ut_delete_generic_state (scope);
+               scope = acpi_ut_pop_generic_state(&parser_state->scope);
+               acpi_ut_delete_generic_state(scope);
        }
 
        return_VOID;
 }
-
index d5aafe73fca0e7ca118761c1c0f7de2f133edeb6..f0e755884eea849fbe6dbd1c7690c41ddf13223c 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("pstree")
+ACPI_MODULE_NAME("pstree")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
-union acpi_parse_object *
-acpi_ps_get_child (
-       union acpi_parse_object         *op);
+union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_arg
@@ -71,21 +66,16 @@ acpi_ps_get_child (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_arg (
-       union acpi_parse_object         *op,
-       u32                             argn)
+union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
 {
-       union acpi_parse_object         *arg = NULL;
-       const struct acpi_opcode_info   *op_info;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_parse_object *arg = NULL;
+       const struct acpi_opcode_info *op_info;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Get the info structure for this opcode */
 
-       op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+       op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
                /* Invalid opcode or ASCII character */
 
@@ -111,7 +101,6 @@ acpi_ps_get_arg (
        return (arg);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_append_arg
@@ -126,16 +115,12 @@ acpi_ps_get_arg (
  ******************************************************************************/
 
 void
-acpi_ps_append_arg (
-       union acpi_parse_object         *op,
-       union acpi_parse_object         *arg)
+acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
 {
-       union acpi_parse_object         *prev_arg;
-       const struct acpi_opcode_info   *op_info;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_parse_object *prev_arg;
+       const struct acpi_opcode_info *op_info;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (!op) {
                return;
@@ -143,12 +128,11 @@ acpi_ps_append_arg (
 
        /* Get the info structure for this opcode */
 
-       op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
+       op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
        if (op_info->class == AML_CLASS_UNKNOWN) {
                /* Invalid opcode */
 
-               ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n",
-                       op->common.aml_opcode));
+               ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode));
                return;
        }
 
@@ -170,8 +154,7 @@ acpi_ps_append_arg (
                        prev_arg = prev_arg->common.next;
                }
                prev_arg->common.next = arg;
-       }
-       else {
+       } else {
                /* No argument list, this will be the first argument */
 
                op->common.value.arg = arg;
@@ -185,7 +168,6 @@ acpi_ps_append_arg (
        }
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -201,18 +183,14 @@ acpi_ps_append_arg (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_depth_next (
-       union acpi_parse_object         *origin,
-       union acpi_parse_object         *op)
+union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
+                                               union acpi_parse_object *op)
 {
-       union acpi_parse_object         *next = NULL;
-       union acpi_parse_object         *parent;
-       union acpi_parse_object         *arg;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_parse_object *next = NULL;
+       union acpi_parse_object *parent;
+       union acpi_parse_object *arg;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (!op) {
                return (NULL);
@@ -220,7 +198,7 @@ acpi_ps_get_depth_next (
 
        /* Look for an argument or child */
 
-       next = acpi_ps_get_arg (op, 0);
+       next = acpi_ps_get_arg(op, 0);
        if (next) {
                return (next);
        }
@@ -237,7 +215,7 @@ acpi_ps_get_depth_next (
        parent = op->common.parent;
 
        while (parent) {
-               arg = acpi_ps_get_arg (parent, 0);
+               arg = acpi_ps_get_arg(parent, 0);
                while (arg && (arg != origin) && (arg != op)) {
                        arg = arg->common.next;
                }
@@ -261,7 +239,6 @@ acpi_ps_get_depth_next (
        return (next);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -275,15 +252,11 @@ acpi_ps_get_depth_next (
  *
  ******************************************************************************/
 
-union acpi_parse_object *
-acpi_ps_get_child (
-       union acpi_parse_object         *op)
+union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
 {
-       union acpi_parse_object         *child = NULL;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_parse_object *child = NULL;
 
+       ACPI_FUNCTION_ENTRY();
 
        switch (op->common.aml_opcode) {
        case AML_SCOPE_OP:
@@ -292,10 +265,9 @@ acpi_ps_get_child (
        case AML_THERMAL_ZONE_OP:
        case AML_INT_METHODCALL_OP:
 
-               child = acpi_ps_get_arg (op, 0);
+               child = acpi_ps_get_arg(op, 0);
                break;
 
-
        case AML_BUFFER_OP:
        case AML_PACKAGE_OP:
        case AML_METHOD_OP:
@@ -303,24 +275,21 @@ acpi_ps_get_child (
        case AML_WHILE_OP:
        case AML_FIELD_OP:
 
-               child = acpi_ps_get_arg (op, 1);
+               child = acpi_ps_get_arg(op, 1);
                break;
 
-
        case AML_POWER_RES_OP:
        case AML_INDEX_FIELD_OP:
 
-               child = acpi_ps_get_arg (op, 2);
+               child = acpi_ps_get_arg(op, 2);
                break;
 
-
        case AML_PROCESSOR_OP:
        case AML_BANK_FIELD_OP:
 
-               child = acpi_ps_get_arg (op, 3);
+               child = acpi_ps_get_arg(op, 3);
                break;
 
-
        default:
                /* All others have no children */
                break;
@@ -330,5 +299,4 @@ acpi_ps_get_child (
 }
 #endif
 
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
index a10f88715d43b96dbf26187349686d0c85be9b7a..2075efbb4324c79259083a852a023f38d03f7cfa 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psutils")
-
+ACPI_MODULE_NAME("psutils")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Create a Scope and associated namepath op with the root name
  *
  ******************************************************************************/
-
-union acpi_parse_object *
-acpi_ps_create_scope_op (
-       void)
+union acpi_parse_object *acpi_ps_create_scope_op(void)
 {
-       union acpi_parse_object         *scope_op;
+       union acpi_parse_object *scope_op;
 
-
-       scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
+       scope_op = acpi_ps_alloc_op(AML_SCOPE_OP);
        if (!scope_op) {
                return (NULL);
        }
@@ -78,7 +72,6 @@ acpi_ps_create_scope_op (
        return (scope_op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_init_op
@@ -92,23 +85,19 @@ acpi_ps_create_scope_op (
  *
  ******************************************************************************/
 
-void
-acpi_ps_init_op (
-       union acpi_parse_object         *op,
-       u16                             opcode)
+void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
 {
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        op->common.data_type = ACPI_DESC_TYPE_PARSER;
        op->common.aml_opcode = opcode;
 
-       ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
-                       (acpi_ps_get_opcode_info (opcode))->name,
-                               sizeof (op->common.aml_op_name)));
+       ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
+                                             (acpi_ps_get_opcode_info
+                                              (opcode))->name,
+                                             sizeof(op->common.aml_op_name)));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_alloc_op
@@ -123,29 +112,23 @@ acpi_ps_init_op (
  *
  ******************************************************************************/
 
-union acpi_parse_object*
-acpi_ps_alloc_op (
-       u16                             opcode)
+union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
 {
-       union acpi_parse_object         *op;
-       const struct acpi_opcode_info   *op_info;
-       u8                              flags = ACPI_PARSEOP_GENERIC;
-
+       union acpi_parse_object *op;
+       const struct acpi_opcode_info *op_info;
+       u8 flags = ACPI_PARSEOP_GENERIC;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
-
-       op_info = acpi_ps_get_opcode_info (opcode);
+       op_info = acpi_ps_get_opcode_info(opcode);
 
        /* Determine type of parse_op required */
 
        if (op_info->flags & AML_DEFER) {
                flags = ACPI_PARSEOP_DEFERRED;
-       }
-       else if (op_info->flags & AML_NAMED) {
+       } else if (op_info->flags & AML_NAMED) {
                flags = ACPI_PARSEOP_NAMED;
-       }
-       else if (opcode == AML_INT_BYTELIST_OP) {
+       } else if (opcode == AML_INT_BYTELIST_OP) {
                flags = ACPI_PARSEOP_BYTELIST;
        }
 
@@ -154,25 +137,25 @@ acpi_ps_alloc_op (
        if (flags == ACPI_PARSEOP_GENERIC) {
                /* The generic op (default) is by far the most common (16 to 1) */
 
-               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE);
-       }
-       else {
+               op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
+               memset(op, 0, sizeof(struct acpi_parse_obj_common));
+       else {
                /* Extended parseop */
 
-               op = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_PSNODE_EXT);
+               op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
+               memset(op, 0, sizeof(struct acpi_parse_obj_named));
        }
 
        /* Initialize the Op */
 
        if (op) {
-               acpi_ps_init_op (op, opcode);
+               acpi_ps_init_op(op, opcode);
                op->common.flags = flags;
        }
 
        return (op);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_free_op
@@ -186,53 +169,22 @@ acpi_ps_alloc_op (
  *
  ******************************************************************************/
 
-void
-acpi_ps_free_op (
-       union acpi_parse_object         *op)
+void acpi_ps_free_op(union acpi_parse_object *op)
 {
-       ACPI_FUNCTION_NAME ("ps_free_op");
-
+       ACPI_FUNCTION_NAME("ps_free_op");
 
        if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n",
+                                 op));
        }
 
        if (op->common.flags & ACPI_PARSEOP_GENERIC) {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE, op);
-       }
-       else {
-               acpi_ut_release_to_cache (ACPI_MEM_LIST_PSNODE_EXT, op);
+               (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
+       } else {
+               (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
        }
 }
 
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_delete_parse_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Free all objects that are on the parse cache list.
- *
- ******************************************************************************/
-
-void
-acpi_ps_delete_parse_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ps_delete_parse_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE);
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_PSNODE_EXT);
-       return_VOID;
-}
-#endif
-
-
 /*******************************************************************************
  *
  * FUNCTION:    Utility functions
@@ -241,36 +193,27 @@ acpi_ps_delete_parse_cache (
  *
  ******************************************************************************/
 
-
 /*
  * Is "c" a namestring lead character?
  */
-u8
-acpi_ps_is_leading_char (
-       u32                             c)
+u8 acpi_ps_is_leading_char(u32 c)
 {
        return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
 }
 
-
 /*
  * Is "c" a namestring prefix character?
  */
-u8
-acpi_ps_is_prefix_char (
-       u32                             c)
+u8 acpi_ps_is_prefix_char(u32 c)
 {
        return ((u8) (c == '\\' || c == '^'));
 }
 
-
 /*
  * Get op's name (4-byte name segment) or 0 if unnamed
  */
 #ifdef ACPI_FUTURE_USAGE
-u32
-acpi_ps_get_name (
-       union acpi_parse_object         *op)
+u32 acpi_ps_get_name(union acpi_parse_object * op)
 {
 
        /* The "generic" object has no name associated with it */
@@ -283,16 +226,12 @@ acpi_ps_get_name (
 
        return (op->named.name);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*
  * Set op's name
  */
-void
-acpi_ps_set_name (
-       union acpi_parse_object         *op,
-       u32                             name)
+void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
 {
 
        /* The "generic" object has no name associated with it */
@@ -303,4 +242,3 @@ acpi_ps_set_name (
 
        op->named.name = name;
 }
-
index 9d20cb2ceb518768814a22473a8f7d3fa34bc4c5..08f2321b6ded21e923c35b8ed8f8d32d283361f8 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("pswalk")
-
+ACPI_MODULE_NAME("pswalk")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Delete a portion of or an entire parse tree.
  *
  ******************************************************************************/
-
-void
-acpi_ps_delete_parse_tree (
-       union acpi_parse_object         *subtree_root)
+void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
 {
-       union acpi_parse_object         *op = subtree_root;
-       union acpi_parse_object         *next = NULL;
-       union acpi_parse_object         *parent = NULL;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ps_delete_parse_tree", subtree_root);
+       union acpi_parse_object *op = subtree_root;
+       union acpi_parse_object *next = NULL;
+       union acpi_parse_object *parent = NULL;
 
+       ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root);
 
        /* Visit all nodes in the subtree */
 
@@ -81,7 +74,7 @@ acpi_ps_delete_parse_tree (
                if (op != parent) {
                        /* Look for an argument or child of the current op */
 
-                       next = acpi_ps_get_arg (op, 0);
+                       next = acpi_ps_get_arg(op, 0);
                        if (next) {
                                /* Still going downward in tree (Op is not completed yet) */
 
@@ -95,7 +88,7 @@ acpi_ps_delete_parse_tree (
                next = op->common.next;
                parent = op->common.parent;
 
-               acpi_ps_free_op (op);
+               acpi_ps_free_op(op);
 
                /* If we are back to the starting point, the walk is complete. */
 
@@ -104,8 +97,7 @@ acpi_ps_delete_parse_tree (
                }
                if (next) {
                        op = next;
-               }
-               else {
+               } else {
                        op = parent;
                }
        }
index dba893648e84b762cba90073ba1b5df05b29bd5f..4dcbd443160e64a90e62c8ca59412c59cf00e5b2 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acparser.h>
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
-#include <acpi/acnamesp.h>
-
 
 #define _COMPONENT          ACPI_PARSER
-        ACPI_MODULE_NAME    ("psxface")
+ACPI_MODULE_NAME("psxface")
+
+/* Local Prototypes */
+static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
 
+static void
+acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_psx_execute
+ * FUNCTION:    acpi_ps_execute_method
  *
  * PARAMETERS:  Info            - Method info block, contains:
  *                  Node            - Method Node to execute
+ *                  obj_desc        - Method object
  *                  Parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
@@ -67,6 +70,7 @@
  *                  parameter_type  - Type of Parameter list
  *                  return_object   - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
+ *                  pass_number     - Parse or execute pass
  *
  * RETURN:      Status
  *
  *
  ******************************************************************************/
 
-acpi_status
-acpi_psx_execute (
-       struct acpi_parameter_info      *info)
+acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
 {
-       acpi_status                     status;
-       union acpi_operand_object       *obj_desc;
-       u32                             i;
-       union acpi_parse_object         *op;
-       struct acpi_walk_state          *walk_state;
-
-
-       ACPI_FUNCTION_TRACE ("psx_execute");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ps_execute_method");
 
-       /* Validate the Node and get the attached object */
+       /* Validate the Info and method Node */
 
        if (!info || !info->node) {
-               return_ACPI_STATUS (AE_NULL_ENTRY);
-       }
-
-       obj_desc = acpi_ns_get_attached_object (info->node);
-       if (!obj_desc) {
-               return_ACPI_STATUS (AE_NULL_OBJECT);
+               return_ACPI_STATUS(AE_NULL_ENTRY);
        }
 
        /* Init for new method, wait on concurrency semaphore */
 
-       status = acpi_ds_begin_method_execution (info->node, obj_desc, NULL);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       if ((info->parameter_type == ACPI_PARAM_ARGS) &&
-               (info->parameters)) {
-               /*
-                * The caller "owns" the parameters, so give each one an extra
-                * reference
-                */
-               for (i = 0; info->parameters[i]; i++) {
-                       acpi_ut_add_reference (info->parameters[i]);
-               }
-       }
+       /*
+        * The caller "owns" the parameters, so give each one an extra
+        * reference
+        */
+       acpi_ps_update_parameter_list(info, REF_INCREMENT);
 
        /*
         * 1) Perform the first pass parse of the method to enter any
-        * named objects that it creates into the namespace
+        *    named objects that it creates into the namespace
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "**** Begin Method Parse **** Entry=%p obj=%p\n",
-               info->node, obj_desc));
-
-       /* Create and init a Root Node */
-
-       op = acpi_ps_create_scope_op ();
-       if (!op) {
-               status = AE_NO_MEMORY;
-               goto cleanup1;
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "**** Begin Method Parse **** Entry=%p obj=%p\n",
+                         info->node, info->obj_desc));
+
+       info->pass_number = 1;
+       status = acpi_ps_execute_pass(info);
+       if (ACPI_FAILURE(status)) {
+               goto cleanup;
        }
 
        /*
-        * Get a new owner_id for objects created by this method. Namespace
-        * objects (such as Operation Regions) can be created during the
-        * first pass parse.
+        * 2) Execute the method. Performs second pass parse simultaneously
         */
-       obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD);
+       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                         "**** Begin Method Execution **** Entry=%p obj=%p\n",
+                         info->node, info->obj_desc));
 
-       /* Create and initialize a new walk state */
+       info->pass_number = 3;
+       status = acpi_ps_execute_pass(info);
 
-       walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
-                          NULL, NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup2;
-       }
+      cleanup:
+       /* Take away the extra reference that we gave the parameters above */
 
-       status = acpi_ds_init_aml_walk (walk_state, op, info->node,
-                         obj_desc->method.aml_start,
-                         obj_desc->method.aml_length, NULL, 1);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup3;
-       }
+       acpi_ps_update_parameter_list(info, REF_DECREMENT);
 
-       /* Parse the AML */
+       /* Exit now if error above */
 
-       status = acpi_ps_parse_aml (walk_state);
-       acpi_ps_delete_parse_tree (op);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup1; /* Walk state is already deleted */
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
-        * 2) Execute the method.  Performs second pass parse simultaneously
+        * If the method has returned an object, signal this to the caller with
+        * a control exception code
         */
-       ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
-               "**** Begin Method Execution **** Entry=%p obj=%p\n",
-               info->node, obj_desc));
-
-       /* Create and init a Root Node */
+       if (info->return_object) {
+               ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
+                                 "Method returned obj_desc=%p\n",
+                                 info->return_object));
+               ACPI_DUMP_STACK_ENTRY(info->return_object);
 
-       op = acpi_ps_create_scope_op ();
-       if (!op) {
-               status = AE_NO_MEMORY;
-               goto cleanup1;
+               status = AE_CTRL_RETURN_VALUE;
        }
 
-       /* Init new op with the method name and pointer back to the NS node */
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_update_parameter_list
+ *
+ * PARAMETERS:  Info            - See struct acpi_parameter_info
+ *                                (Used: parameter_type and Parameters)
+ *              Action          - Add or Remove reference
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Update reference count on all method parameter objects
+ *
+ ******************************************************************************/
 
-       acpi_ps_set_name (op, info->node->name.integer);
-       op->common.node = info->node;
+static void
+acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
+{
+       acpi_native_uint i;
 
-       /* Create and initialize a new walk state */
+       if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
+               /* Update reference count for each parameter */
 
-       walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup2;
-       }
+               for (i = 0; info->parameters[i]; i++) {
+                       /* Ignore errors, just do them all */
 
-       status = acpi_ds_init_aml_walk (walk_state, op, info->node,
-                         obj_desc->method.aml_start,
-                         obj_desc->method.aml_length, info, 3);
-       if (ACPI_FAILURE (status)) {
-               goto cleanup3;
+                       (void)acpi_ut_update_object_reference(info->
+                                                             parameters[i],
+                                                             action);
+               }
        }
+}
 
-       /* The walk of the parse tree is where we actually execute the method */
-
-       status = acpi_ps_parse_aml (walk_state);
-       goto cleanup2; /* Walk state already deleted */
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_execute_pass
+ *
+ * PARAMETERS:  Info            - See struct acpi_parameter_info
+ *                                (Used: pass_number, Node, and obj_desc)
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Single AML pass: Parse or Execute a control method
+ *
+ ******************************************************************************/
 
+static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
+{
+       acpi_status status;
+       union acpi_parse_object *op;
+       struct acpi_walk_state *walk_state;
 
-cleanup3:
-       acpi_ds_delete_walk_state (walk_state);
+       ACPI_FUNCTION_TRACE("ps_execute_pass");
 
-cleanup2:
-       acpi_ps_delete_parse_tree (op);
+       /* Create and init a Root Node */
 
-cleanup1:
-       if ((info->parameter_type == ACPI_PARAM_ARGS) &&
-               (info->parameters)) {
-               /* Take away the extra reference that we gave the parameters above */
+       op = acpi_ps_create_scope_op();
+       if (!op) {
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
 
-               for (i = 0; info->parameters[i]; i++) {
-                       /* Ignore errors, just do them all */
+       /* Create and initialize a new walk state */
 
-                       (void) acpi_ut_update_object_reference (
-                                        info->parameters[i], REF_DECREMENT);
-               }
+       walk_state =
+           acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
+                                     NULL, NULL);
+       if (!walk_state) {
+               status = AE_NO_MEMORY;
+               goto cleanup;
        }
 
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ds_init_aml_walk(walk_state, op, info->node,
+                                      info->obj_desc->method.aml_start,
+                                      info->obj_desc->method.aml_length,
+                                      info->pass_number == 1 ? NULL : info,
+                                      info->pass_number);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               goto cleanup;
        }
 
-       /*
-        * If the method has returned an object, signal this to the caller with
-        * a control exception code
-        */
-       if (info->return_object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
-                       info->return_object));
-               ACPI_DUMP_STACK_ENTRY (info->return_object);
-
-               status = AE_CTRL_RETURN_VALUE;
-       }
+       /* Parse the AML */
 
-       return_ACPI_STATUS (status);
-}
+       status = acpi_ps_parse_aml(walk_state);
 
+       /* Walk state was deleted by parse_aml */
 
+      cleanup:
+       acpi_ps_delete_parse_tree(op);
+       return_ACPI_STATUS(status);
+}
index 5148f3c10b5cf268d56fd0562f59ab7c538937f0..2a718df769b546ee533e55dc96fa5e8cdd510625 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME               ("pci_bind")
+ACPI_MODULE_NAME("pci_bind")
 
 struct acpi_pci_data {
-       struct acpi_pci_id      id;
-       struct pci_bus          *bus;
-       struct pci_dev          *dev;
+       struct acpi_pci_id id;
+       struct pci_bus *bus;
+       struct pci_dev *dev;
 };
 
-
-void
-acpi_pci_data_handler (
-       acpi_handle             handle,
-       u32                     function,
-       void                    *context)
+static void acpi_pci_data_handler(acpi_handle handle, u32 function,
+                                 void *context)
 {
        ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
 
@@ -59,7 +54,6 @@ acpi_pci_data_handler (
        return_VOID;
 }
 
-
 /**
  * acpi_get_pci_id
  * ------------------
@@ -67,15 +61,12 @@ acpi_pci_data_handler (
  * to resolve PCI information for ACPI-PCI devices defined in the namespace.
  * This typically occurs when resolving PCI operation region information.
  */
-acpi_status
-acpi_get_pci_id (
-       acpi_handle             handle,
-       struct acpi_pci_id      *id)
+acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_device      *device = NULL;
-       struct acpi_pci_data    *data = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_device *device = NULL;
+       struct acpi_pci_data *data = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_get_pci_id");
 
@@ -84,52 +75,50 @@ acpi_get_pci_id (
 
        result = acpi_bus_get_device(handle, &device);
        if (result) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Invalid ACPI Bus context for device %s\n",
-                       acpi_device_bid(device)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI Bus context for device %s\n",
+                                 acpi_device_bid(device)));
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data);
+       status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
        if (ACPI_FAILURE(status) || !data) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Invalid ACPI-PCI context for device %s\n",
-                       acpi_device_bid(device)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI-PCI context for device %s\n",
+                                 acpi_device_bid(device)));
                return_ACPI_STATUS(status);
        }
 
        *id = data->id;
-       
+
        /*
-       id->segment = data->id.segment;
-       id->bus = data->id.bus;
-       id->device = data->id.device;
-       id->function = data->id.function;
-       */
+          id->segment = data->id.segment;
+          id->bus = data->id.bus;
+          id->device = data->id.device;
+          id->function = data->id.function;
+        */
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-               "Device %s has PCI address %02x:%02x:%02x.%02x\n", 
-               acpi_device_bid(device), id->segment, id->bus, 
-               id->device, id->function));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Device %s has PCI address %02x:%02x:%02x.%02x\n",
+                         acpi_device_bid(device), id->segment, id->bus,
+                         id->device, id->function));
 
        return_ACPI_STATUS(AE_OK);
 }
+
 EXPORT_SYMBOL(acpi_get_pci_id);
 
-       
-int
-acpi_pci_bind (
-       struct acpi_device      *device)
+int acpi_pci_bind(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_pci_data    *data = NULL;
-       struct acpi_pci_data    *pdata = NULL;
-       char                    *pathname = NULL;
-       struct acpi_buffer      buffer = {0, NULL};
-       acpi_handle             handle = NULL;
-       struct pci_dev          *dev;
-       struct pci_bus          *bus;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_pci_data *data = NULL;
+       struct acpi_pci_data *pdata = NULL;
+       char *pathname = NULL;
+       struct acpi_buffer buffer = { 0, NULL };
+       acpi_handle handle = NULL;
+       struct pci_dev *dev;
+       struct pci_bus *bus;
 
        ACPI_FUNCTION_TRACE("acpi_pci_bind");
 
@@ -137,34 +126,34 @@ acpi_pci_bind (
                return_VALUE(-EINVAL);
 
        pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-       if(!pathname)
+       if (!pathname)
                return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
 
        data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
-       if (!data){
-               kfree (pathname);
+       if (!data) {
+               kfree(pathname);
                return_VALUE(-ENOMEM);
        }
        memset(data, 0, sizeof(struct acpi_pci_data));
 
        acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", 
-               pathname));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
+                         pathname));
 
        /* 
         * Segment & Bus
         * -------------
         * These are obtained via the parent device's ACPI-PCI context.
         */
-       status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, 
-               (void**) &pdata);
+       status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
+                              (void **)&pdata);
        if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Invalid ACPI-PCI context for parent device %s\n",
-                       acpi_device_bid(device->parent)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI-PCI context for parent device %s\n",
+                                 acpi_device_bid(device->parent)));
                result = -ENODEV;
                goto end;
        }
@@ -181,8 +170,8 @@ acpi_pci_bind (
        data->id.function = device->pnp.bus_address & 0xFFFF;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n",
-               data->id.segment, data->id.bus, data->id.device, 
-               data->id.function));
+                         data->id.segment, data->id.bus, data->id.device,
+                         data->id.function));
 
        /*
         * TBD: Support slot devices (e.g. function=0xFFFF).
@@ -202,25 +191,25 @@ acpi_pci_bind (
        if (bus) {
                list_for_each_entry(dev, &bus->devices, bus_list) {
                        if (dev->devfn == PCI_DEVFN(data->id.device,
-                                               data->id.function)) {
+                                                   data->id.function)) {
                                data->dev = dev;
                                break;
                        }
                }
        }
        if (!data->dev) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                       "Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
-                       data->id.segment, data->id.bus, 
-                       data->id.device, data->id.function));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
+                                 data->id.segment, data->id.bus,
+                                 data->id.device, data->id.function));
                result = -ENODEV;
                goto end;
        }
        if (!data->dev->bus) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
-                       data->id.segment, data->id.bus, 
-                       data->id.device, data->id.function));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
+                                 data->id.segment, data->id.bus,
+                                 data->id.device, data->id.function));
                result = -ENODEV;
                goto end;
        }
@@ -232,10 +221,10 @@ acpi_pci_bind (
         * facilitate callbacks for all of its children.
         */
        if (data->dev->subordinate) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                       "Device %02x:%02x:%02x.%02x is a PCI bridge\n",
-                       data->id.segment, data->id.bus, 
-                       data->id.device, data->id.function));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Device %02x:%02x:%02x.%02x is a PCI bridge\n",
+                                 data->id.segment, data->id.bus,
+                                 data->id.device, data->id.function));
                data->bus = data->dev->subordinate;
                device->ops.bind = acpi_pci_bind;
                device->ops.unbind = acpi_pci_unbind;
@@ -249,8 +238,8 @@ acpi_pci_bind (
        status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to attach ACPI-PCI context to device %s\n",
-                       acpi_device_bid(device)));
+                                 "Unable to attach ACPI-PCI context to device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -267,15 +256,15 @@ acpi_pci_bind (
         */
        status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
        if (ACPI_SUCCESS(status)) {
-               if (data->bus)                              /* PCI-PCI bridge */
-                       acpi_pci_irq_add_prt(device->handle, data->id.segment, 
-                               data->bus->number);
-               else                                 /* non-bridge PCI device */
+               if (data->bus)  /* PCI-PCI bridge */
                        acpi_pci_irq_add_prt(device->handle, data->id.segment,
-                               data->id.bus);
+                                            data->bus->number);
+               else            /* non-bridge PCI device */
+                       acpi_pci_irq_add_prt(device->handle, data->id.segment,
+                                            data->id.bus);
        }
 
-end:
+      end:
        kfree(pathname);
        if (result)
                kfree(data);
@@ -283,22 +272,21 @@ end:
        return_VALUE(result);
 }
 
-int acpi_pci_unbind(
-       struct acpi_device      *device)
+int acpi_pci_unbind(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_pci_data    *data = NULL;
-       char                    *pathname = NULL;
-       struct acpi_buffer      buffer = {0, NULL};
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_pci_data *data = NULL;
+       char *pathname = NULL;
+       struct acpi_buffer buffer = { 0, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_pci_unbind");
 
        if (!device || !device->parent)
                return_VALUE(-EINVAL);
 
-       pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-       if(!pathname)
+       pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       if (!pathname)
                return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
 
@@ -306,14 +294,16 @@ int acpi_pci_unbind(
        buffer.pointer = pathname;
        acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
-               pathname));
+                         pathname));
        kfree(pathname);
 
-       status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data);
+       status =
+           acpi_get_data(device->handle, acpi_pci_data_handler,
+                         (void **)&data);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to get data from device %s\n",
-                       acpi_device_bid(device)));
+                                 "Unable to get data from device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -321,8 +311,8 @@ int acpi_pci_unbind(
        status = acpi_detach_data(device->handle, acpi_pci_data_handler);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to detach data from device %s\n",
-                       acpi_device_bid(device)));
+                                 "Unable to detach data from device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -331,39 +321,37 @@ int acpi_pci_unbind(
        }
        kfree(data);
 
-end:
+      end:
        return_VALUE(result);
 }
 
-int 
-acpi_pci_bind_root (
-       struct acpi_device      *device,
-       struct acpi_pci_id      *id,
-       struct pci_bus          *bus) 
+int
+acpi_pci_bind_root(struct acpi_device *device,
+                  struct acpi_pci_id *id, struct pci_bus *bus)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_pci_data    *data = NULL;
-       char                    *pathname = NULL;
-       struct acpi_buffer      buffer = {0, NULL};
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_pci_data *data = NULL;
+       char *pathname = NULL;
+       struct acpi_buffer buffer = { 0, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
 
        pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-       if(!pathname)
+       if (!pathname)
                return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
 
-       if (!device || !id || !bus){
+       if (!device || !id || !bus) {
                kfree(pathname);
                return_VALUE(-EINVAL);
        }
 
        data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
-       if (!data){
+       if (!data) {
                kfree(pathname);
                return_VALUE(-ENOMEM);
        }
@@ -377,18 +365,18 @@ acpi_pci_bind_root (
        acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to "
-               "%02x:%02x\n", pathname, id->segment, id->bus));
+                         "%02x:%02x\n", pathname, id->segment, id->bus));
 
        status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to attach ACPI-PCI context to device %s\n",
-                       pathname));
+                                 "Unable to attach ACPI-PCI context to device %s\n",
+                                 pathname));
                result = -ENODEV;
                goto end;
        }
 
-end:
+      end:
        kfree(pathname);
        if (result != 0)
                kfree(data);
index bb973d2109a11e7404f1d3fa788f1d0655038d5e..09567c2edcfb5225a67deb44d71cba7249915735 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME               ("pci_irq")
+ACPI_MODULE_NAME("pci_irq")
 
-static struct acpi_prt_list    acpi_prt;
+static struct acpi_prt_list acpi_prt;
 static DEFINE_SPINLOCK(acpi_prt_lock);
 
 /* --------------------------------------------------------------------------
                          PCI IRQ Routing Table (PRT) Support
    -------------------------------------------------------------------------- */
 
-static struct acpi_prt_entry *
-acpi_pci_irq_find_prt_entry (
-       int                     segment,
-       int                     bus,
-       int                     device,
-       int                     pin)
+static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
+                                                         int bus,
+                                                         int device, int pin)
 {
-       struct list_head        *node = NULL;
-       struct acpi_prt_entry   *entry = NULL;
+       struct list_head *node = NULL;
+       struct acpi_prt_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
 
@@ -72,10 +68,10 @@ acpi_pci_irq_find_prt_entry (
        spin_lock(&acpi_prt_lock);
        list_for_each(node, &acpi_prt.entries) {
                entry = list_entry(node, struct acpi_prt_entry, node);
-               if ((segment == entry->id.segment) 
-                       && (bus == entry->id.bus) 
-                       && (device == entry->id.device)
-                       && (pin == entry->pin)) {
+               if ((segment == entry->id.segment)
+                   && (bus == entry->id.bus)
+                   && (device == entry->id.device)
+                   && (pin == entry->pin)) {
                        spin_unlock(&acpi_prt_lock);
                        return_PTR(entry);
                }
@@ -85,15 +81,11 @@ acpi_pci_irq_find_prt_entry (
        return_PTR(NULL);
 }
 
-
 static int
-acpi_pci_irq_add_entry (
-       acpi_handle                     handle,
-       int                             segment,
-       int                             bus,
-       struct acpi_pci_routing_table   *prt)
+acpi_pci_irq_add_entry(acpi_handle handle,
+                      int segment, int bus, struct acpi_pci_routing_table *prt)
 {
-       struct acpi_prt_entry   *entry = NULL;
+       struct acpi_prt_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
 
@@ -139,9 +131,10 @@ acpi_pci_irq_add_entry (
                entry->link.index = prt->source_index;
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
-               "      %02X:%02X:%02X[%c] -> %s[%d]\n", 
-               entry->id.segment, entry->id.bus, entry->id.device, 
-               ('A' + entry->pin), prt->source, entry->link.index));
+                             "      %02X:%02X:%02X[%c] -> %s[%d]\n",
+                             entry->id.segment, entry->id.bus,
+                             entry->id.device, ('A' + entry->pin), prt->source,
+                             entry->link.index));
 
        spin_lock(&acpi_prt_lock);
        list_add_tail(&entry->node, &acpi_prt.entries);
@@ -151,38 +144,29 @@ acpi_pci_irq_add_entry (
        return_VALUE(0);
 }
 
-
 static void
-acpi_pci_irq_del_entry (
-       int                             segment,
-       int                             bus,
-       struct acpi_prt_entry           *entry)
+acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
 {
-       if (segment == entry->id.segment && bus == entry->id.bus){
+       if (segment == entry->id.segment && bus == entry->id.bus) {
                acpi_prt.count--;
                list_del(&entry->node);
                kfree(entry);
        }
 }
 
-
-int
-acpi_pci_irq_add_prt (
-       acpi_handle             handle,
-       int                     segment,
-       int                     bus)
+int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
 {
-       acpi_status                     status = AE_OK;
-       char                            *pathname = NULL;
-       struct acpi_buffer              buffer = {0, NULL};
-       struct acpi_pci_routing_table   *prt = NULL;
-       struct acpi_pci_routing_table   *entry = NULL;
-       static int                      first_time = 1;
+       acpi_status status = AE_OK;
+       char *pathname = NULL;
+       struct acpi_buffer buffer = { 0, NULL };
+       struct acpi_pci_routing_table *prt = NULL;
+       struct acpi_pci_routing_table *entry = NULL;
+       static int first_time = 1;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
 
-       pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
-       if(!pathname)
+       pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       if (!pathname)
                return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
 
@@ -202,7 +186,7 @@ acpi_pci_irq_add_prt (
        acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
 
        printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
-               pathname);
+              pathname);
 
        /* 
         * Evaluate this _PRT and add its entries to our global list (acpi_prt).
@@ -214,12 +198,12 @@ acpi_pci_irq_add_prt (
        status = acpi_get_irq_routing_table(handle, &buffer);
        if (status != AE_BUFFER_OVERFLOW) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-                       acpi_format_exception(status)));
+                                 acpi_format_exception(status)));
                return_VALUE(-ENODEV);
        }
 
        prt = kmalloc(buffer.length, GFP_KERNEL);
-       if (!prt){
+       if (!prt) {
                return_VALUE(-ENOMEM);
        }
        memset(prt, 0, buffer.length);
@@ -228,7 +212,7 @@ acpi_pci_irq_add_prt (
        status = acpi_get_irq_routing_table(handle, &buffer);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
-                       acpi_format_exception(status)));
+                                 acpi_format_exception(status)));
                kfree(buffer.pointer);
                return_VALUE(-ENODEV);
        }
@@ -238,7 +222,7 @@ acpi_pci_irq_add_prt (
        while (entry && (entry->length > 0)) {
                acpi_pci_irq_add_entry(handle, segment, bus, entry);
                entry = (struct acpi_pci_routing_table *)
-                       ((unsigned long) entry + entry->length);
+                   ((unsigned long)entry + entry->length);
        }
 
        kfree(prt);
@@ -246,18 +230,18 @@ acpi_pci_irq_add_prt (
        return_VALUE(0);
 }
 
-void
-acpi_pci_irq_del_prt (int segment, int bus)
+void acpi_pci_irq_del_prt(int segment, int bus)
 {
-       struct list_head        *node = NULL, *n = NULL;
-       struct acpi_prt_entry   *entry = NULL;
+       struct list_head *node = NULL, *n = NULL;
+       struct acpi_prt_entry *entry = NULL;
 
-       if (!acpi_prt.count)    {
+       if (!acpi_prt.count) {
                return;
        }
 
-       printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n",
-               segment, bus);
+       printk(KERN_DEBUG
+              "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment,
+              bus);
        spin_lock(&acpi_prt_lock);
        list_for_each_safe(node, n, &acpi_prt.entries) {
                entry = list_entry(node, struct acpi_prt_entry, node);
@@ -266,26 +250,27 @@ acpi_pci_irq_del_prt (int segment, int bus)
        }
        spin_unlock(&acpi_prt_lock);
 }
+
 /* --------------------------------------------------------------------------
                           PCI Interrupt Routing Support
    -------------------------------------------------------------------------- */
-typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);
+typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
 
 static int
 acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
-       int     *edge_level,
-       int     *active_high_low,
-       char    **link)
+                     int *edge_level, int *active_high_low, char **link)
 {
-       int     irq;
+       int irq;
 
        ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
 
        if (entry->link.handle) {
                irq = acpi_pci_link_allocate_irq(entry->link.handle,
-                       entry->link.index, edge_level, active_high_low, link);
+                                                entry->link.index, edge_level,
+                                                active_high_low, link);
                if (irq < 0) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                         "Invalid IRQ link routing entry\n"));
                        return_VALUE(-1);
                }
        } else {
@@ -300,11 +285,9 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
 
 static int
 acpi_pci_free_irq(struct acpi_prt_entry *entry,
-       int     *edge_level,
-       int     *active_high_low,
-       char    **link)
+                 int *edge_level, int *active_high_low, char **link)
 {
-       int     irq;
+       int irq;
 
        ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
        if (entry->link.handle) {
@@ -314,38 +297,36 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
        }
        return_VALUE(irq);
 }
+
 /*
  * acpi_pci_irq_lookup
  * success: return IRQ >= 0
  * failure: return -1
  */
 static int
-acpi_pci_irq_lookup (
-       struct pci_bus          *bus,
-       int                     device,
-       int                     pin,
-       int                     *edge_level,
-       int                     *active_high_low,
-       char                    **link,
-       irq_lookup_func         func)
+acpi_pci_irq_lookup(struct pci_bus *bus,
+                   int device,
+                   int pin,
+                   int *edge_level,
+                   int *active_high_low, char **link, irq_lookup_func func)
 {
-       struct acpi_prt_entry   *entry = NULL;
+       struct acpi_prt_entry *entry = NULL;
        int segment = pci_domain_nr(bus);
        int bus_nr = bus->number;
        int ret;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-               "Searching for PRT entry for %02x:%02x:%02x[%c]\n", 
-               segment, bus_nr, device, ('A' + pin)));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Searching for PRT entry for %02x:%02x:%02x[%c]\n",
+                         segment, bus_nr, device, ('A' + pin)));
 
-       entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); 
+       entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
        if (!entry) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n"));
                return_VALUE(-1);
        }
-       
+
        ret = func(entry, edge_level, active_high_low, link);
        return_VALUE(ret);
 }
@@ -356,17 +337,14 @@ acpi_pci_irq_lookup (
  * failure: return < 0
  */
 static int
-acpi_pci_irq_derive (
-       struct pci_dev          *dev,
-       int                     pin,
-       int                     *edge_level,
-       int                     *active_high_low,
-       char                    **link,
-       irq_lookup_func         func)
+acpi_pci_irq_derive(struct pci_dev *dev,
+                   int pin,
+                   int *edge_level,
+                   int *active_high_low, char **link, irq_lookup_func func)
 {
-       struct pci_dev          *bridge = dev;
-       int                     irq = -1;
-       u8                      bridge_pin = 0;
+       struct pci_dev *bridge = dev;
+       int irq = -1;
+       u8 bridge_pin = 0;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
 
@@ -383,28 +361,33 @@ acpi_pci_irq_derive (
 
                if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
                        /* PC card has the same IRQ as its cardbridge */
-                       pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, &bridge_pin);
+                       pci_read_config_byte(bridge, PCI_INTERRUPT_PIN,
+                                            &bridge_pin);
                        if (!bridge_pin) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                                       "No interrupt pin configured for device %s\n", pci_name(bridge)));
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "No interrupt pin configured for device %s\n",
+                                                 pci_name(bridge)));
                                return_VALUE(-1);
                        }
                        /* Pin is from 0 to 3 */
-                       bridge_pin --;
+                       bridge_pin--;
                        pin = bridge_pin;
                }
 
                irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
-                       pin, edge_level, active_high_low, link, func);
+                                         pin, edge_level, active_high_low,
+                                         link, func);
        }
 
        if (irq < 0) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to derive IRQ for device %s\n", pci_name(dev)));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Unable to derive IRQ for device %s\n",
+                                 pci_name(dev)));
                return_VALUE(-1);
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
-               irq, pci_name(dev), pci_name(bridge)));
+                         irq, pci_name(dev), pci_name(bridge)));
 
        return_VALUE(irq);
 }
@@ -415,30 +398,32 @@ acpi_pci_irq_derive (
  * failure: return < 0
  */
 
-int
-acpi_pci_irq_enable (
-       struct pci_dev          *dev)
+int acpi_pci_irq_enable(struct pci_dev *dev)
 {
-       int                     irq = 0;
-       u8                      pin = 0;
-       int                     edge_level = ACPI_LEVEL_SENSITIVE;
-       int                     active_high_low = ACPI_ACTIVE_LOW;
-       char                    *link = NULL;
+       int irq = 0;
+       u8 pin = 0;
+       int edge_level = ACPI_LEVEL_SENSITIVE;
+       int active_high_low = ACPI_ACTIVE_LOW;
+       char *link = NULL;
+       int rc;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
 
        if (!dev)
                return_VALUE(-EINVAL);
-       
+
        pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
        if (!pin) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev)));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "No interrupt pin configured for device %s\n",
+                                 pci_name(dev)));
                return_VALUE(0);
        }
        pin--;
 
        if (!dev->bus) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) 'bus' field\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid (NULL) 'bus' field\n"));
                return_VALUE(-ENODEV);
        }
 
@@ -446,69 +431,76 @@ acpi_pci_irq_enable (
         * First we check the PCI IRQ routing table (PRT) for an IRQ.  PRT
         * values override any BIOS-assigned IRQs set during boot.
         */
-       irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-               &edge_level, &active_high_low, &link, acpi_pci_allocate_irq);
+       irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
+                                 &edge_level, &active_high_low, &link,
+                                 acpi_pci_allocate_irq);
 
        /*
         * If no PRT entry was found, we'll try to derive an IRQ from the
         * device's parent bridge.
         */
        if (irq < 0)
-               irq = acpi_pci_irq_derive(dev, pin, &edge_level,
-                       &active_high_low, &link, acpi_pci_allocate_irq);
+               irq = acpi_pci_irq_derive(dev, pin, &edge_level,
+                                         &active_high_low, &link,
+                                         acpi_pci_allocate_irq);
+
        /*
         * No IRQ known to the ACPI subsystem - maybe the BIOS / 
         * driver reported one, then use it. Exit in any case.
         */
        if (irq < 0) {
                printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
-                       pci_name(dev), ('A' + pin));
+                      pci_name(dev), ('A' + pin));
                /* Interrupt Line values above 0xF are forbidden */
                if (dev->irq > 0 && (dev->irq <= 0xF)) {
                        printk(" - using IRQ %d\n", dev->irq);
-                       acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
+                       acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
+                                         ACPI_ACTIVE_LOW);
                        return_VALUE(0);
-               }
-               else {
+               } else {
                        printk("\n");
                        return_VALUE(0);
                }
-       }
+       }
 
-       dev->irq = acpi_register_gsi(irq, edge_level, active_high_low);
+       rc = acpi_register_gsi(irq, edge_level, active_high_low);
+       if (rc < 0) {
+               printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed "
+                      "to register GSI\n", pci_name(dev), ('A' + pin));
+               return_VALUE(rc);
+       }
+       dev->irq = rc;
 
        printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
-               pci_name(dev), 'A' + pin);
+              pci_name(dev), 'A' + pin);
 
        if (link)
                printk("Link [%s] -> ", link);
 
        printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
-               (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
-               (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high",
-               dev->irq);
+              (edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
+              (active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
 
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_pci_irq_enable);
 
+EXPORT_SYMBOL(acpi_pci_irq_enable);
 
 /* FIXME: implement x86/x86_64 version */
-void __attribute__((weak)) acpi_unregister_gsi(u32 i) {}
+void __attribute__ ((weak)) acpi_unregister_gsi(u32 i)
+{
+}
 
-void
-acpi_pci_irq_disable (
-       struct pci_dev          *dev)
+void acpi_pci_irq_disable(struct pci_dev *dev)
 {
-       int                     gsi = 0;
-       u8                      pin = 0;
-       int                     edge_level = ACPI_LEVEL_SENSITIVE;
-       int                     active_high_low = ACPI_ACTIVE_LOW;
+       int gsi = 0;
+       u8 pin = 0;
+       int edge_level = ACPI_LEVEL_SENSITIVE;
+       int active_high_low = ACPI_ACTIVE_LOW;
 
        ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
 
-       if (!dev)
+       if (!dev || !dev->bus)
                return_VOID;
 
        pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
@@ -516,21 +508,20 @@ acpi_pci_irq_disable (
                return_VOID;
        pin--;
 
-       if (!dev->bus)
-               return_VOID;
-
        /*
         * First we check the PCI IRQ routing table (PRT) for an IRQ.
         */
-       gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
-                       &edge_level, &active_high_low, NULL, acpi_pci_free_irq);
+       gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
+                                 &edge_level, &active_high_low, NULL,
+                                 acpi_pci_free_irq);
        /*
         * If no PRT entry was found, we'll try to derive an IRQ from the
         * device's parent bridge.
         */
        if (gsi < 0)
-               gsi = acpi_pci_irq_derive(dev, pin,
-                       &edge_level, &active_high_low, NULL, acpi_pci_free_irq);
+               gsi = acpi_pci_irq_derive(dev, pin,
+                                         &edge_level, &active_high_low, NULL,
+                                         acpi_pci_free_irq);
        if (gsi < 0)
                return_VOID;
 
index 834c2ceff1aa4ba1864e2dfff84667384a33a72a..82292b77e5c681b874334913078926106546bb2f 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME               ("pci_link")
-
+ACPI_MODULE_NAME("pci_link")
 #define ACPI_PCI_LINK_CLASS            "pci_irq_routing"
 #define ACPI_PCI_LINK_HID              "PNP0C0F"
 #define ACPI_PCI_LINK_DRIVER_NAME      "ACPI PCI Interrupt Link Driver"
 #define ACPI_PCI_LINK_DEVICE_NAME      "PCI Interrupt Link"
 #define ACPI_PCI_LINK_FILE_INFO                "info"
 #define ACPI_PCI_LINK_FILE_STATUS      "state"
-
 #define ACPI_PCI_LINK_MAX_POSSIBLE 16
-
-static int acpi_pci_link_add (struct acpi_device *device);
-static int acpi_pci_link_remove (struct acpi_device *device, int type);
+static int acpi_pci_link_add(struct acpi_device *device);
+static int acpi_pci_link_remove(struct acpi_device *device, int type);
 
 static struct acpi_driver acpi_pci_link_driver = {
-       .name =         ACPI_PCI_LINK_DRIVER_NAME,
-       .class =        ACPI_PCI_LINK_CLASS,
-       .ids =          ACPI_PCI_LINK_HID,
-       .ops =          {
-                               .add =    acpi_pci_link_add,
-                               .remove = acpi_pci_link_remove,
-                       },
+       .name = ACPI_PCI_LINK_DRIVER_NAME,
+       .class = ACPI_PCI_LINK_CLASS,
+       .ids = ACPI_PCI_LINK_HID,
+       .ops = {
+               .add = acpi_pci_link_add,
+               .remove = acpi_pci_link_remove,
+               },
 };
 
 /*
@@ -73,31 +69,30 @@ static struct acpi_driver acpi_pci_link_driver = {
  * later even the link is disable. Instead, we just repick the active irq
  */
 struct acpi_pci_link_irq {
-       u8                      active;                 /* Current IRQ */
-       u8                      edge_level;             /* All IRQs */
-       u8                      active_high_low;        /* All IRQs */
-       u8                      resource_type;
-       u8                      possible_count;
-       u8                      possible[ACPI_PCI_LINK_MAX_POSSIBLE];
-       u8                      initialized:1;
-       u8                      reserved:7;
+       u8 active;              /* Current IRQ */
+       u8 edge_level;          /* All IRQs */
+       u8 active_high_low;     /* All IRQs */
+       u8 resource_type;
+       u8 possible_count;
+       u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
+       u8 initialized:1;
+       u8 reserved:7;
 };
 
 struct acpi_pci_link {
-       struct list_head        node;
-       struct acpi_device      *device;
-       acpi_handle             handle;
+       struct list_head node;
+       struct acpi_device *device;
+       acpi_handle handle;
        struct acpi_pci_link_irq irq;
-       int                     refcnt;
+       int refcnt;
 };
 
 static struct {
-       int                     count;
-       struct list_head        entries;
-}                              acpi_link;
+       int count;
+       struct list_head entries;
+} acpi_link;
 DECLARE_MUTEX(acpi_link_lock);
 
-
 /* --------------------------------------------------------------------------
                             PCI Link Device Management
    -------------------------------------------------------------------------- */
@@ -106,12 +101,10 @@ DECLARE_MUTEX(acpi_link_lock);
  * set context (link) possible list from resource list
  */
 static acpi_status
-acpi_pci_link_check_possible (
-       struct acpi_resource    *resource,
-       void                    *context)
+acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
 {
-       struct acpi_pci_link    *link = (struct acpi_pci_link *) context;
-       u32                     i = 0;
+       struct acpi_pci_link *link = (struct acpi_pci_link *)context;
+       u32 i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible");
 
@@ -119,61 +112,68 @@ acpi_pci_link_check_possible (
        case ACPI_RSTYPE_START_DPF:
                return_ACPI_STATUS(AE_OK);
        case ACPI_RSTYPE_IRQ:
-       {
-               struct acpi_resource_irq *p = &resource->data.irq;
-               if (!p || !p->number_of_interrupts) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n"));
-                       return_ACPI_STATUS(AE_OK);
-               }
-               for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
-                       if (!p->interrupts[i]) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i]));
-                               continue;
+               {
+                       struct acpi_resource_irq *p = &resource->data.irq;
+                       if (!p || !p->number_of_interrupts) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                 "Blank IRQ resource\n"));
+                               return_ACPI_STATUS(AE_OK);
                        }
-                       link->irq.possible[i] = p->interrupts[i];
-                       link->irq.possible_count++;
+                       for (i = 0;
+                            (i < p->number_of_interrupts
+                             && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
+                               if (!p->interrupts[i]) {
+                                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                         "Invalid IRQ %d\n",
+                                                         p->interrupts[i]));
+                                       continue;
+                               }
+                               link->irq.possible[i] = p->interrupts[i];
+                               link->irq.possible_count++;
+                       }
+                       link->irq.edge_level = p->edge_level;
+                       link->irq.active_high_low = p->active_high_low;
+                       link->irq.resource_type = ACPI_RSTYPE_IRQ;
+                       break;
                }
-               link->irq.edge_level = p->edge_level;
-               link->irq.active_high_low = p->active_high_low;
-               link->irq.resource_type = ACPI_RSTYPE_IRQ;
-               break;
-       }
        case ACPI_RSTYPE_EXT_IRQ:
-       {
-               struct acpi_resource_ext_irq *p = &resource->data.extended_irq;
-               if (!p || !p->number_of_interrupts) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, 
-                               "Blank EXT IRQ resource\n"));
-                       return_ACPI_STATUS(AE_OK);
-               }
-               for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
-                       if (!p->interrupts[i]) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i]));
-                               continue;
+               {
+                       struct acpi_resource_ext_irq *p =
+                           &resource->data.extended_irq;
+                       if (!p || !p->number_of_interrupts) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                 "Blank EXT IRQ resource\n"));
+                               return_ACPI_STATUS(AE_OK);
+                       }
+                       for (i = 0;
+                            (i < p->number_of_interrupts
+                             && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
+                               if (!p->interrupts[i]) {
+                                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                         "Invalid IRQ %d\n",
+                                                         p->interrupts[i]));
+                                       continue;
+                               }
+                               link->irq.possible[i] = p->interrupts[i];
+                               link->irq.possible_count++;
                        }
-                       link->irq.possible[i] = p->interrupts[i];
-                       link->irq.possible_count++;
+                       link->irq.edge_level = p->edge_level;
+                       link->irq.active_high_low = p->active_high_low;
+                       link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ;
+                       break;
                }
-               link->irq.edge_level = p->edge_level;
-               link->irq.active_high_low = p->active_high_low;
-               link->irq.resource_type = ACPI_RSTYPE_EXT_IRQ;
-               break;
-       }
        default:
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Resource is not an IRQ entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Resource is not an IRQ entry\n"));
                return_ACPI_STATUS(AE_OK);
        }
 
        return_ACPI_STATUS(AE_CTRL_TERMINATE);
 }
 
-
-static int
-acpi_pci_link_get_possible (
-       struct acpi_pci_link    *link)
+static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
 {
-       acpi_status             status;
+       acpi_status status;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible");
 
@@ -181,62 +181,60 @@ acpi_pci_link_get_possible (
                return_VALUE(-EINVAL);
 
        status = acpi_walk_resources(link->handle, METHOD_NAME__PRS,
-                       acpi_pci_link_check_possible, link);
+                                    acpi_pci_link_check_possible, link);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n"));
                return_VALUE(-ENODEV);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-               "Found %d possible IRQs\n", link->irq.possible_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Found %d possible IRQs\n",
+                         link->irq.possible_count));
 
        return_VALUE(0);
 }
 
-
 static acpi_status
-acpi_pci_link_check_current (
-       struct acpi_resource    *resource,
-       void                    *context)
+acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
 {
-       int                     *irq = (int *) context;
+       int *irq = (int *)context;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_check_current");
 
        switch (resource->id) {
        case ACPI_RSTYPE_IRQ:
-       {
-               struct acpi_resource_irq *p = &resource->data.irq;
-               if (!p || !p->number_of_interrupts) {
-                       /*
-                        * IRQ descriptors may have no IRQ# bits set,
-                        * particularly those those w/ _STA disabled
-                        */
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                               "Blank IRQ resource\n")); 
-                       return_ACPI_STATUS(AE_OK);
+               {
+                       struct acpi_resource_irq *p = &resource->data.irq;
+                       if (!p || !p->number_of_interrupts) {
+                               /*
+                                * IRQ descriptors may have no IRQ# bits set,
+                                * particularly those those w/ _STA disabled
+                                */
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "Blank IRQ resource\n"));
+                               return_ACPI_STATUS(AE_OK);
+                       }
+                       *irq = p->interrupts[0];
+                       break;
                }
-               *irq = p->interrupts[0];
-               break;
-       }
        case ACPI_RSTYPE_EXT_IRQ:
-       {
-               struct acpi_resource_ext_irq *p = &resource->data.extended_irq;
-               if (!p || !p->number_of_interrupts) {
-                       /*
-                        * extended IRQ descriptors must
-                        * return at least 1 IRQ
-                        */
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
-                               "Blank EXT IRQ resource\n"));
-                       return_ACPI_STATUS(AE_OK);
+               {
+                       struct acpi_resource_ext_irq *p =
+                           &resource->data.extended_irq;
+                       if (!p || !p->number_of_interrupts) {
+                               /*
+                                * extended IRQ descriptors must
+                                * return at least 1 IRQ
+                                */
+                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                 "Blank EXT IRQ resource\n"));
+                               return_ACPI_STATUS(AE_OK);
+                       }
+                       *irq = p->interrupts[0];
+                       break;
                }
-               *irq = p->interrupts[0];
-               break;
-       }
        default:
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Resource isn't an IRQ\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n"));
                return_ACPI_STATUS(AE_OK);
        }
        return_ACPI_STATUS(AE_CTRL_TERMINATE);
@@ -249,13 +247,11 @@ acpi_pci_link_check_current (
  * 0 - success
  * !0 - failure
  */
-static int
-acpi_pci_link_get_current (
-       struct acpi_pci_link    *link)
+static int acpi_pci_link_get_current(struct acpi_pci_link *link)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       int                     irq = 0;
+       int result = 0;
+       acpi_status status = AE_OK;
+       int irq = 0;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_get_current");
 
@@ -269,7 +265,8 @@ acpi_pci_link_get_current (
                /* Query _STA, set link->device->status */
                result = acpi_bus_get_status(link->device);
                if (result) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unable to read status\n"));
                        goto end;
                }
 
@@ -284,7 +281,7 @@ acpi_pci_link_get_current (
         */
 
        status = acpi_walk_resources(link->handle, METHOD_NAME__CRS,
-                       acpi_pci_link_check_current, &irq);
+                                    acpi_pci_link_check_current, &irq);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n"));
                result = -ENODEV;
@@ -300,58 +297,61 @@ acpi_pci_link_get_current (
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active));
 
-end:
+      end:
        return_VALUE(result);
 }
 
-static int
-acpi_pci_link_set (
-       struct acpi_pci_link    *link,
-       int                     irq)
+static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
+       int result = 0;
+       acpi_status status = AE_OK;
        struct {
-               struct acpi_resource    res;
-               struct acpi_resource    end;
-       }    *resource;
-       struct acpi_buffer      buffer = {0, NULL};
+               struct acpi_resource res;
+               struct acpi_resource end;
+       } *resource;
+       struct acpi_buffer buffer = { 0, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_set");
 
        if (!link || !irq)
                return_VALUE(-EINVAL);
 
-       resource = kmalloc( sizeof(*resource)+1, GFP_KERNEL);
-       if(!resource)
+       resource = kmalloc(sizeof(*resource) + 1, GFP_KERNEL);
+       if (!resource)
                return_VALUE(-ENOMEM);
 
-       memset(resource, 0, sizeof(*resource)+1);
-       buffer.length = sizeof(*resource) +1;
+       memset(resource, 0, sizeof(*resource) + 1);
+       buffer.length = sizeof(*resource) + 1;
        buffer.pointer = resource;
 
-       switch(link->irq.resource_type) {
+       switch (link->irq.resource_type) {
        case ACPI_RSTYPE_IRQ:
                resource->res.id = ACPI_RSTYPE_IRQ;
                resource->res.length = sizeof(struct acpi_resource);
                resource->res.data.irq.edge_level = link->irq.edge_level;
-               resource->res.data.irq.active_high_low = link->irq.active_high_low;
+               resource->res.data.irq.active_high_low =
+                   link->irq.active_high_low;
                if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
-                       resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+                       resource->res.data.irq.shared_exclusive =
+                           ACPI_EXCLUSIVE;
                else
                        resource->res.data.irq.shared_exclusive = ACPI_SHARED;
                resource->res.data.irq.number_of_interrupts = 1;
                resource->res.data.irq.interrupts[0] = irq;
                break;
-          
+
        case ACPI_RSTYPE_EXT_IRQ:
                resource->res.id = ACPI_RSTYPE_EXT_IRQ;
                resource->res.length = sizeof(struct acpi_resource);
-               resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
-               resource->res.data.extended_irq.edge_level = link->irq.edge_level;
-               resource->res.data.extended_irq.active_high_low = link->irq.active_high_low;
+               resource->res.data.extended_irq.producer_consumer =
+                   ACPI_CONSUMER;
+               resource->res.data.extended_irq.edge_level =
+                   link->irq.edge_level;
+               resource->res.data.extended_irq.active_high_low =
+                   link->irq.active_high_low;
                if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
-                       resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
+                       resource->res.data.irq.shared_exclusive =
+                           ACPI_EXCLUSIVE;
                else
                        resource->res.data.irq.shared_exclusive = ACPI_SHARED;
                resource->res.data.extended_irq.number_of_interrupts = 1;
@@ -384,9 +384,9 @@ acpi_pci_link_set (
        }
        if (!link->device->status.enabled) {
                printk(KERN_WARNING PREFIX
-                       "%s [%s] disabled and referenced, BIOS bug.\n",
-                       acpi_device_name(link->device),
-                       acpi_device_bid(link->device));
+                      "%s [%s] disabled and referenced, BIOS bug.\n",
+                      acpi_device_name(link->device),
+                      acpi_device_bid(link->device));
        }
 
        /* Query _CRS, set link->irq.active */
@@ -404,22 +404,20 @@ acpi_pci_link_set (
                 * policy: when _CRS doesn't return what we just _SRS
                 * assume _SRS worked and override _CRS value.
                 */
-               printk(KERN_WARNING PREFIX 
-                       "%s [%s] BIOS reported IRQ %d, using IRQ %d\n",
-                       acpi_device_name(link->device),
-                       acpi_device_bid(link->device),
-                       link->irq.active, irq);
+               printk(KERN_WARNING PREFIX
+                      "%s [%s] BIOS reported IRQ %d, using IRQ %d\n",
+                      acpi_device_name(link->device),
+                      acpi_device_bid(link->device), link->irq.active, irq);
                link->irq.active = irq;
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active));
-       
-end:
+
+      end:
        kfree(resource);
        return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                             PCI Link IRQ Management
    -------------------------------------------------------------------------- */
@@ -469,8 +467,8 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
        PIRQ_PENALTY_ISA_ALWAYS,        /* IRQ0 timer */
        PIRQ_PENALTY_ISA_ALWAYS,        /* IRQ1 keyboard */
        PIRQ_PENALTY_ISA_ALWAYS,        /* IRQ2 cascade */
-       PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ3 serial */
-       PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ4 serial */
+       PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ3 serial */
+       PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ4 serial */
        PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ5 sometimes SoundBlaster */
        PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ6 */
        PIRQ_PENALTY_ISA_TYPICAL,       /* IRQ7 parallel, spurious */
@@ -482,15 +480,14 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
        PIRQ_PENALTY_ISA_USED,  /* IRQ13 fpe, sometimes */
        PIRQ_PENALTY_ISA_USED,  /* IRQ14 ide0 */
        PIRQ_PENALTY_ISA_USED,  /* IRQ15 ide1 */
-                       /* >IRQ15 */
+       /* >IRQ15 */
 };
 
-int __init
-acpi_irq_penalty_init(void)
+int __init acpi_irq_penalty_init(void)
 {
-       struct list_head        *node = NULL;
-       struct acpi_pci_link    *link = NULL;
-       int                     i = 0;
+       struct list_head *node = NULL;
+       struct acpi_pci_link *link = NULL;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_irq_penalty_init");
 
@@ -501,7 +498,8 @@ acpi_irq_penalty_init(void)
 
                link = list_entry(node, struct acpi_pci_link, node);
                if (!link) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid link context\n"));
                        continue;
                }
 
@@ -510,15 +508,20 @@ acpi_irq_penalty_init(void)
                 * useful for breaking ties.
                 */
                if (link->irq.possible_count) {
-                       int penalty = PIRQ_PENALTY_PCI_POSSIBLE / link->irq.possible_count;
+                       int penalty =
+                           PIRQ_PENALTY_PCI_POSSIBLE /
+                           link->irq.possible_count;
 
                        for (i = 0; i < link->irq.possible_count; i++) {
                                if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ)
-                                       acpi_irq_penalty[link->irq.possible[i]] += penalty;
+                                       acpi_irq_penalty[link->irq.
+                                                        possible[i]] +=
+                                           penalty;
                        }
 
                } else if (link->irq.active) {
-                       acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_POSSIBLE;
+                       acpi_irq_penalty[link->irq.active] +=
+                           PIRQ_PENALTY_PCI_POSSIBLE;
                }
        }
        /* Add a penalty for the SCI */
@@ -529,11 +532,10 @@ acpi_irq_penalty_init(void)
 
 static int acpi_irq_balance;   /* 0: static, 1: balance */
 
-static int acpi_pci_link_allocate(
-       struct acpi_pci_link    *link)
+static int acpi_pci_link_allocate(struct acpi_pci_link *link)
 {
-       int                     irq;
-       int                     i;
+       int irq;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");
 
@@ -557,7 +559,7 @@ static int acpi_pci_link_allocate(
        if (i == link->irq.possible_count) {
                if (acpi_strict)
                        printk(KERN_WARNING PREFIX "_CRS %d not found"
-                               " in _PRS\n", link->irq.active);
+                              " in _PRS\n", link->irq.active);
                link->irq.active = 0;
        }
 
@@ -576,23 +578,25 @@ static int acpi_pci_link_allocate(
                 * the use of IRQs 9, 10, 11, and >15.
                 */
                for (i = (link->irq.possible_count - 1); i >= 0; i--) {
-                       if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
+                       if (acpi_irq_penalty[irq] >
+                           acpi_irq_penalty[link->irq.possible[i]])
                                irq = link->irq.possible[i];
                }
        }
 
        /* Attempt to enable the link device at this IRQ. */
        if (acpi_pci_link_set(link, irq)) {
-               printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n"
-                               "Try pci=noacpi or acpi=off\n",
-                       acpi_device_name(link->device),
-                       acpi_device_bid(link->device));
+               printk(PREFIX
+                      "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n"
+                      "Try pci=noacpi or acpi=off\n",
+                      acpi_device_name(link->device),
+                      acpi_device_bid(link->device));
                return_VALUE(-ENODEV);
        } else {
                acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
-               printk(PREFIX "%s [%s] enabled at IRQ %d\n", 
-                       acpi_device_name(link->device),
-                       acpi_device_bid(link->device), link->irq.active);
+               printk(PREFIX "%s [%s] enabled at IRQ %d\n",
+                      acpi_device_name(link->device),
+                      acpi_device_bid(link->device), link->irq.active);
        }
 
        link->irq.initialized = 1;
@@ -607,16 +611,13 @@ static int acpi_pci_link_allocate(
  */
 
 int
-acpi_pci_link_allocate_irq (
-       acpi_handle             handle,
-       int                     index,
-       int                     *edge_level,
-       int                     *active_high_low,
-       char                    **name)
+acpi_pci_link_allocate_irq(acpi_handle handle,
+                          int index,
+                          int *edge_level, int *active_high_low, char **name)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
-       struct acpi_pci_link    *link = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
+       struct acpi_pci_link *link = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq");
 
@@ -626,7 +627,7 @@ acpi_pci_link_allocate_irq (
                return_VALUE(-1);
        }
 
-       link = (struct acpi_pci_link *) acpi_driver_data(device);
+       link = (struct acpi_pci_link *)acpi_driver_data(device);
        if (!link) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
                return_VALUE(-1);
@@ -643,20 +644,24 @@ acpi_pci_link_allocate_irq (
                up(&acpi_link_lock);
                return_VALUE(-1);
        }
-          
+
        if (!link->irq.active) {
                up(&acpi_link_lock);
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n"));
                return_VALUE(-1);
        }
-       link->refcnt ++;
+       link->refcnt++;
        up(&acpi_link_lock);
 
-       if (edge_level) *edge_level = link->irq.edge_level;
-       if (active_high_low) *active_high_low = link->irq.active_high_low;
-       if (name) *name = acpi_device_bid(link->device);
+       if (edge_level)
+               *edge_level = link->irq.edge_level;
+       if (active_high_low)
+               *active_high_low = link->irq.active_high_low;
+       if (name)
+               *name = acpi_device_bid(link->device);
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "Link %s is referenced\n", acpi_device_bid(link->device)));
+                         "Link %s is referenced\n",
+                         acpi_device_bid(link->device)));
        return_VALUE(link->irq.active);
 }
 
@@ -664,12 +669,11 @@ acpi_pci_link_allocate_irq (
  * We don't change link's irq information here.  After it is reenabled, we
  * continue use the info
  */
-int
-acpi_pci_link_free_irq(acpi_handle handle)
+int acpi_pci_link_free_irq(acpi_handle handle)
 {
-       struct acpi_device      *device = NULL;
-       struct acpi_pci_link    *link = NULL;
-       acpi_status             result;
+       struct acpi_device *device = NULL;
+       struct acpi_pci_link *link = NULL;
+       acpi_status result;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq");
 
@@ -679,7 +683,7 @@ acpi_pci_link_free_irq(acpi_handle handle)
                return_VALUE(-1);
        }
 
-       link = (struct acpi_pci_link *) acpi_driver_data(device);
+       link = (struct acpi_pci_link *)acpi_driver_data(device);
        if (!link) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
                return_VALUE(-1);
@@ -691,7 +695,6 @@ acpi_pci_link_free_irq(acpi_handle handle)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n"));
                return_VALUE(-1);
        }
-
 #ifdef FUTURE_USE
        /*
         * The Link reference count allows us to _DISable an unused link
@@ -702,10 +705,11 @@ acpi_pci_link_free_irq(acpi_handle handle)
         * to prevent duplicate acpi_pci_link_set()
         * which would harm some systems
         */
-       link->refcnt --;
+       link->refcnt--;
 #endif
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "Link %s is dereferenced\n", acpi_device_bid(link->device)));
+                         "Link %s is dereferenced\n",
+                         acpi_device_bid(link->device)));
 
        if (link->refcnt == 0) {
                acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
@@ -713,18 +717,17 @@ acpi_pci_link_free_irq(acpi_handle handle)
        up(&acpi_link_lock);
        return_VALUE(link->irq.active);
 }
+
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static int
-acpi_pci_link_add (
-       struct acpi_device *device)
+static int acpi_pci_link_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       struct acpi_pci_link    *link = NULL;
-       int                     i = 0;
-       int                     found = 0;
+       int result = 0;
+       struct acpi_pci_link *link = NULL;
+       int i = 0;
+       int found = 0;
 
        ACPI_FUNCTION_TRACE("acpi_pci_link_add");
 
@@ -751,13 +754,12 @@ acpi_pci_link_add (
        acpi_pci_link_get_current(link);
 
        printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device),
-               acpi_device_bid(device));
+              acpi_device_bid(device));
        for (i = 0; i < link->irq.possible_count; i++) {
                if (link->irq.active == link->irq.possible[i]) {
                        printk(" *%d", link->irq.possible[i]);
                        found = 1;
-               }
-               else
+               } else
                        printk(" %d", link->irq.possible[i]);
        }
 
@@ -766,7 +768,7 @@ acpi_pci_link_add (
        if (!found)
                printk(" *%d", link->irq.active);
 
-       if(!link->device->status.enabled)
+       if (!link->device->status.enabled)
                printk(", disabled.");
 
        printk("\n");
@@ -775,7 +777,7 @@ acpi_pci_link_add (
        list_add_tail(&link->node, &acpi_link.entries);
        acpi_link.count++;
 
-end:
+      end:
        /* disable all links -- to be activated on use */
        acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
        up(&acpi_link_lock);
@@ -786,9 +788,7 @@ end:
        return_VALUE(result);
 }
 
-static int
-acpi_pci_link_resume(
-       struct acpi_pci_link *link)
+static int acpi_pci_link_resume(struct acpi_pci_link *link)
 {
        ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
 
@@ -803,12 +803,10 @@ acpi_pci_link_resume(
  * after every device calls pci_disable_device in .resume.
  */
 int acpi_in_resume;
-static int
-irqrouter_resume(
-       struct sys_device *dev)
+static int irqrouter_resume(struct sys_device *dev)
 {
-       struct list_head        *node = NULL;
-       struct acpi_pci_link    *link = NULL;
+       struct list_head *node = NULL;
+       struct acpi_pci_link *link = NULL;
 
        ACPI_FUNCTION_TRACE("irqrouter_resume");
 
@@ -817,7 +815,7 @@ irqrouter_resume(
                link = list_entry(node, struct acpi_pci_link, node);
                if (!link) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Invalid link context\n"));
+                                         "Invalid link context\n"));
                        continue;
                }
                acpi_pci_link_resume(link);
@@ -826,11 +824,7 @@ irqrouter_resume(
        return_VALUE(0);
 }
 
-
-static int
-acpi_pci_link_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_pci_link_remove(struct acpi_device *device, int type)
 {
        struct acpi_pci_link *link = NULL;
 
@@ -839,7 +833,7 @@ acpi_pci_link_remove (
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       link = (struct acpi_pci_link *) acpi_driver_data(device);
+       link = (struct acpi_pci_link *)acpi_driver_data(device);
 
        down(&acpi_link_lock);
        list_del(&link->node);
@@ -861,14 +855,14 @@ static int __init acpi_irq_penalty_update(char *str, int used)
                int retval;
                int irq;
 
-               retval = get_option(&str,&irq);
+               retval = get_option(&str, &irq);
 
                if (!retval)
                        break;  /* no number found */
 
                if (irq < 0)
                        continue;
-               
+
                if (irq >= ACPI_MAX_IRQS)
                        continue;
 
@@ -907,6 +901,7 @@ static int __init acpi_irq_isa(char *str)
 {
        return acpi_irq_penalty_update(str, 1);
 }
+
 __setup("acpi_irq_isa=", acpi_irq_isa);
 
 /*
@@ -918,6 +913,7 @@ static int __init acpi_irq_pci(char *str)
 {
        return acpi_irq_penalty_update(str, 0);
 }
+
 __setup("acpi_irq_pci=", acpi_irq_pci);
 
 static int __init acpi_irq_nobalance_set(char *str)
@@ -925,6 +921,7 @@ static int __init acpi_irq_nobalance_set(char *str)
        acpi_irq_balance = 0;
        return 1;
 }
+
 __setup("acpi_irq_nobalance", acpi_irq_nobalance_set);
 
 int __init acpi_irq_balance_set(char *str)
@@ -932,22 +929,20 @@ int __init acpi_irq_balance_set(char *str)
        acpi_irq_balance = 1;
        return 1;
 }
-__setup("acpi_irq_balance", acpi_irq_balance_set);
 
+__setup("acpi_irq_balance", acpi_irq_balance_set);
 
 /* FIXME: we will remove this interface after all drivers call pci_disable_device */
 static struct sysdev_class irqrouter_sysdev_class = {
-        set_kset_name("irqrouter"),
-        .resume = irqrouter_resume,
+       set_kset_name("irqrouter"),
+       .resume = irqrouter_resume,
 };
 
-
 static struct sys_device device_irqrouter = {
-       .id     = 0,
-       .cls    = &irqrouter_sysdev_class,
+       .id = 0,
+       .cls = &irqrouter_sysdev_class,
 };
 
-
 static int __init irqrouter_init_sysfs(void)
 {
        int error;
@@ -962,12 +957,11 @@ static int __init irqrouter_init_sysfs(void)
                error = sysdev_register(&device_irqrouter);
 
        return_VALUE(error);
-}                                        
+}
 
 device_initcall(irqrouter_init_sysfs);
 
-
-static int __init acpi_pci_link_init (void)
+static int __init acpi_pci_link_init(void)
 {
        ACPI_FUNCTION_TRACE("acpi_pci_link_init");
 
index 5d2f77fcd50c7a2992a3f7957a1862ac33da1f8d..0fd9988c283d199f3a3d5d9a6f14369198d73474 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_PCI_COMPONENT
-ACPI_MODULE_NAME               ("pci_root")
-
+ACPI_MODULE_NAME("pci_root")
 #define ACPI_PCI_ROOT_CLASS            "pci_bridge"
 #define ACPI_PCI_ROOT_HID              "PNP0A03"
 #define ACPI_PCI_ROOT_DRIVER_NAME      "ACPI PCI Root Bridge Driver"
 #define ACPI_PCI_ROOT_DEVICE_NAME      "PCI Root Bridge"
-
-static int acpi_pci_root_add (struct acpi_device *device);
-static int acpi_pci_root_remove (struct acpi_device *device, int type);
-static int acpi_pci_root_start (struct acpi_device *device);
+static int acpi_pci_root_add(struct acpi_device *device);
+static int acpi_pci_root_remove(struct acpi_device *device, int type);
+static int acpi_pci_root_start(struct acpi_device *device);
 
 static struct acpi_driver acpi_pci_root_driver = {
-       .name =         ACPI_PCI_ROOT_DRIVER_NAME,
-       .class =        ACPI_PCI_ROOT_CLASS,
-       .ids =          ACPI_PCI_ROOT_HID,
-       .ops =          {
-                               .add =    acpi_pci_root_add,
-                               .remove = acpi_pci_root_remove,
-                               .start =  acpi_pci_root_start,
-                       },
+       .name = ACPI_PCI_ROOT_DRIVER_NAME,
+       .class = ACPI_PCI_ROOT_CLASS,
+       .ids = ACPI_PCI_ROOT_HID,
+       .ops = {
+               .add = acpi_pci_root_add,
+               .remove = acpi_pci_root_remove,
+               .start = acpi_pci_root_start,
+               },
 };
 
 struct acpi_pci_root {
-       struct list_head        node;
-       acpi_handle             handle;
-       struct acpi_pci_id      id;
-       struct pci_bus          *bus;
+       struct list_head node;
+       acpi_handle handle;
+       struct acpi_pci_id id;
+       struct pci_bus *bus;
 };
 
 static LIST_HEAD(acpi_pci_roots);
@@ -92,6 +89,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver)
 
        return n;
 }
+
 EXPORT_SYMBOL(acpi_pci_register_driver);
 
 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
@@ -115,10 +113,11 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
                driver->remove(root->handle);
        }
 }
+
 EXPORT_SYMBOL(acpi_pci_unregister_driver);
 
 static acpi_status
-get_root_bridge_busnr_callback (struct acpi_resource *resource, void *data)
+get_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
 {
        int *busnr = (int *)data;
        struct acpi_resource_address64 address;
@@ -129,20 +128,21 @@ get_root_bridge_busnr_callback (struct acpi_resource *resource, void *data)
                return AE_OK;
 
        acpi_resource_to_address64(resource, &address);
-       if ((address.address_length > 0) && 
-          (address.resource_type == ACPI_BUS_NUMBER_RANGE))
+       if ((address.address_length > 0) &&
+           (address.resource_type == ACPI_BUS_NUMBER_RANGE))
                *busnr = address.min_address_range;
 
        return AE_OK;
 }
 
-static acpi_status 
-try_get_root_bridge_busnr(acpi_handle handle, int *busnum)
+static acpi_status try_get_root_bridge_busnr(acpi_handle handle, int *busnum)
 {
        acpi_status status;
 
        *busnum = -1;
-       status = acpi_walk_resources(handle, METHOD_NAME__CRS, get_root_bridge_busnr_callback, busnum);
+       status =
+           acpi_walk_resources(handle, METHOD_NAME__CRS,
+                               get_root_bridge_busnr_callback, busnum);
        if (ACPI_FAILURE(status))
                return status;
        /* Check if we really get a bus number from _CRS */
@@ -151,16 +151,14 @@ try_get_root_bridge_busnr(acpi_handle handle, int *busnum)
        return AE_OK;
 }
 
-static int
-acpi_pci_root_add (
-       struct acpi_device      *device)
+static int acpi_pci_root_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       struct acpi_pci_root    *root = NULL;
-       struct acpi_pci_root    *tmp;
-       acpi_status             status = AE_OK;
-       unsigned long           value = 0;
-       acpi_handle             handle = NULL;
+       int result = 0;
+       struct acpi_pci_root *root = NULL;
+       struct acpi_pci_root *tmp;
+       acpi_status status = AE_OK;
+       unsigned long value = 0;
+       acpi_handle handle = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_pci_root_add");
 
@@ -188,15 +186,15 @@ acpi_pci_root_add (
         * -------
         * Obtained via _SEG, if exists, otherwise assumed to be zero (0).
         */
-       status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL, 
-               &value);
+       status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL,
+                                      &value);
        switch (status) {
        case AE_OK:
                root->id.segment = (u16) value;
                break;
        case AE_NOT_FOUND:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                       "Assuming segment 0 (no _SEG)\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Assuming segment 0 (no _SEG)\n"));
                root->id.segment = 0;
                break;
        default:
@@ -210,8 +208,8 @@ acpi_pci_root_add (
         * ---
         * Obtained via _BBN, if exists, otherwise assumed to be zero (0).
         */
-       status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL, 
-               &value);
+       status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL,
+                                      &value);
        switch (status) {
        case AE_OK:
                root->id.bus = (u16) value;
@@ -229,18 +227,19 @@ acpi_pci_root_add (
        /* Some systems have wrong _BBN */
        list_for_each_entry(tmp, &acpi_pci_roots, node) {
                if ((tmp->id.segment == root->id.segment)
-                               && (tmp->id.bus == root->id.bus)) {
+                   && (tmp->id.bus == root->id.bus)) {
                        int bus = 0;
                        acpi_status status;
 
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                               "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n"));
 
                        status = try_get_root_bridge_busnr(root->handle, &bus);
                        if (ACPI_FAILURE(status))
                                break;
                        if (bus != root->id.bus) {
-                               printk(KERN_INFO PREFIX "PCI _CRS %d overrides _BBN 0\n", bus);
+                               printk(KERN_INFO PREFIX
+                                      "PCI _CRS %d overrides _BBN 0\n", bus);
                                root->id.bus = bus;
                        }
                        break;
@@ -258,12 +257,12 @@ acpi_pci_root_add (
         * TBD: Need PCI interface for enumeration/configuration of roots.
         */
 
-       /* TBD: Locking */
-       list_add_tail(&root->node, &acpi_pci_roots);
+       /* TBD: Locking */
+       list_add_tail(&root->node, &acpi_pci_roots);
 
-       printk(KERN_INFO PREFIX "%s [%s] (%04x:%02x)\n", 
-               acpi_device_name(device), acpi_device_bid(device),
-               root->id.segment, root->id.bus);
+       printk(KERN_INFO PREFIX "%s [%s] (%04x:%02x)\n",
+              acpi_device_name(device), acpi_device_bid(device),
+              root->id.segment, root->id.bus);
 
        /*
         * Scan the Root Bridge
@@ -274,9 +273,9 @@ acpi_pci_root_add (
         */
        root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus);
        if (!root->bus) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Bus %04x:%02x not present in PCI namespace\n", 
-                       root->id.segment, root->id.bus));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Bus %04x:%02x not present in PCI namespace\n",
+                                 root->id.segment, root->id.bus));
                result = -ENODEV;
                goto end;
        }
@@ -298,9 +297,9 @@ acpi_pci_root_add (
        status = acpi_get_handle(root->handle, METHOD_NAME__PRT, &handle);
        if (ACPI_SUCCESS(status))
                result = acpi_pci_irq_add_prt(root->handle, root->id.segment,
-                       root->id.bus);
+                                             root->id.bus);
 
-end:
+      end:
        if (result) {
                if (!list_empty(&root->node))
                        list_del(&root->node);
@@ -310,11 +309,9 @@ end:
        return_VALUE(result);
 }
 
-static int
-acpi_pci_root_start (
-       struct acpi_device      *device)
+static int acpi_pci_root_start(struct acpi_device *device)
 {
-       struct acpi_pci_root    *root;
+       struct acpi_pci_root *root;
 
        ACPI_FUNCTION_TRACE("acpi_pci_root_start");
 
@@ -327,27 +324,23 @@ acpi_pci_root_start (
        return_VALUE(-ENODEV);
 }
 
-static int
-acpi_pci_root_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_pci_root_remove(struct acpi_device *device, int type)
 {
-       struct acpi_pci_root    *root = NULL;
+       struct acpi_pci_root *root = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_pci_root_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       root = (struct acpi_pci_root *) acpi_driver_data(device);
+       root = (struct acpi_pci_root *)acpi_driver_data(device);
 
        kfree(root);
 
        return_VALUE(0);
 }
 
-
-static int __init acpi_pci_root_init (void)
+static int __init acpi_pci_root_init(void)
 {
        ACPI_FUNCTION_TRACE("acpi_pci_root_init");
 
@@ -355,8 +348,8 @@ static int __init acpi_pci_root_init (void)
                return_VALUE(0);
 
        /* DEBUG:
-       acpi_dbg_layer = ACPI_PCI_COMPONENT;
-       acpi_dbg_level = 0xFFFFFFFF;
+          acpi_dbg_layer = ACPI_PCI_COMPONENT;
+          acpi_dbg_level = 0xFFFFFFFF;
         */
 
        if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
@@ -366,4 +359,3 @@ static int __init acpi_pci_root_init (void)
 }
 
 subsys_initcall(acpi_pci_root_init);
-
index 373a3a95bb4e1b6d642b4f0e49ac96e18c1b5031..62a5595ed8bc7551e7951b12dabb283662633b7f 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_POWER_COMPONENT
-ACPI_MODULE_NAME               ("acpi_power")
-
+ACPI_MODULE_NAME("acpi_power")
 #define ACPI_POWER_COMPONENT           0x00800000
 #define ACPI_POWER_CLASS               "power_resource"
 #define ACPI_POWER_DRIVER_NAME         "ACPI Power Resource Driver"
@@ -57,38 +55,36 @@ ACPI_MODULE_NAME            ("acpi_power")
 #define ACPI_POWER_RESOURCE_STATE_OFF  0x00
 #define ACPI_POWER_RESOURCE_STATE_ON   0x01
 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
-
-static int acpi_power_add (struct acpi_device *device);
-static int acpi_power_remove (struct acpi_device *device, int type);
+static int acpi_power_add(struct acpi_device *device);
+static int acpi_power_remove(struct acpi_device *device, int type);
 static int acpi_power_open_fs(struct inode *inode, struct file *file);
 
 static struct acpi_driver acpi_power_driver = {
-       .name =         ACPI_POWER_DRIVER_NAME,
-       .class =        ACPI_POWER_CLASS,
-       .ids =          ACPI_POWER_HID,
-       .ops =          {
-                               .add =          acpi_power_add,
-                               .remove =       acpi_power_remove,
-                       },
+       .name = ACPI_POWER_DRIVER_NAME,
+       .class = ACPI_POWER_CLASS,
+       .ids = ACPI_POWER_HID,
+       .ops = {
+               .add = acpi_power_add,
+               .remove = acpi_power_remove,
+               },
 };
 
-struct acpi_power_resource
-{
-       acpi_handle             handle;
-       acpi_bus_id             name;
-       u32                     system_level;
-       u32                     order;
-       int                     state;
-       int                     references;
+struct acpi_power_resource {
+       acpi_handle handle;
+       acpi_bus_id name;
+       u32 system_level;
+       u32 order;
+       int state;
+       int references;
 };
 
-static struct list_head                acpi_power_resource_list;
+static struct list_head acpi_power_resource_list;
 
 static struct file_operations acpi_power_fops = {
-       .open           = acpi_power_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_power_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 /* --------------------------------------------------------------------------
@@ -96,12 +92,11 @@ static struct file_operations acpi_power_fops = {
    -------------------------------------------------------------------------- */
 
 static int
-acpi_power_get_context (
-       acpi_handle             handle,
-       struct acpi_power_resource **resource)
+acpi_power_get_context(acpi_handle handle,
+                      struct acpi_power_resource **resource)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_power_get_context");
 
@@ -111,24 +106,21 @@ acpi_power_get_context (
        result = acpi_bus_get_device(handle, &device);
        if (result) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n",
-                       handle));
+                                 handle));
                return_VALUE(result);
        }
 
-       *resource = (struct acpi_power_resource *) acpi_driver_data(device);
+       *resource = (struct acpi_power_resource *)acpi_driver_data(device);
        if (!resource)
                return_VALUE(-ENODEV);
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_power_get_state (
-       struct acpi_power_resource *resource)
+static int acpi_power_get_state(struct acpi_power_resource *resource)
 {
-       acpi_status             status = AE_OK;
-       unsigned long           sta = 0;
+       acpi_status status = AE_OK;
+       unsigned long sta = 0;
 
        ACPI_FUNCTION_TRACE("acpi_power_get_state");
 
@@ -145,20 +137,16 @@ acpi_power_get_state (
                resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
-               resource->name, resource->state?"on":"off"));
+                         resource->name, resource->state ? "on" : "off"));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_power_get_list_state (
-       struct acpi_handle_list *list,
-       int                     *state)
+static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
 {
-       int                     result = 0;
+       int result = 0;
        struct acpi_power_resource *resource = NULL;
-       u32                     i = 0;
+       u32 i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_power_get_list_state");
 
@@ -167,7 +155,7 @@ acpi_power_get_list_state (
 
        /* The state of the list is 'on' IFF all resources are 'on'. */
 
-       for (i=0; i<list->count; i++) {
+       for (i = 0; i < list->count; i++) {
                result = acpi_power_get_context(list->handles[i], &resource);
                if (result)
                        return_VALUE(result);
@@ -182,19 +170,16 @@ acpi_power_get_list_state (
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
-               *state?"on":"off"));
+                         *state ? "on" : "off"));
 
        return_VALUE(result);
 }
 
-
-static int
-acpi_power_on (
-       acpi_handle             handle)
+static int acpi_power_on(acpi_handle handle)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_device *device = NULL;
        struct acpi_power_resource *resource = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_power_on");
@@ -205,10 +190,10 @@ acpi_power_on (
 
        resource->references++;
 
-       if ((resource->references > 1) 
-               || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
+       if ((resource->references > 1)
+           || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
-                       resource->name));
+                                 resource->name));
                return_VALUE(0);
        }
 
@@ -229,19 +214,16 @@ acpi_power_on (
        device->power.state = ACPI_STATE_D0;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
-               resource->name));
+                         resource->name));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_power_off_device (
-       acpi_handle             handle)
+static int acpi_power_off_device(acpi_handle handle)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_device *device = NULL;
        struct acpi_power_resource *resource = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_power_off_device");
@@ -254,15 +236,15 @@ acpi_power_off_device (
                resource->references--;
 
        if (resource->references) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                       "Resource [%s] is still in use, dereferencing\n",
-                       device->pnp.bus_id));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Resource [%s] is still in use, dereferencing\n",
+                                 device->pnp.bus_id));
                return_VALUE(0);
        }
 
        if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
-                       device->pnp.bus_id));
+                                 device->pnp.bus_id));
                return_VALUE(0);
        }
 
@@ -283,7 +265,7 @@ acpi_power_off_device (
        device->power.state = ACPI_STATE_D3;
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
-               resource->name));
+                         resource->name));
 
        return_VALUE(0);
 }
@@ -293,13 +275,13 @@ acpi_power_off_device (
  * 1. Power on the power resources required for the wakeup device 
  * 2. Enable _PSW (power state wake) for the device if present
  */
-int acpi_enable_wakeup_device_power (struct acpi_device *dev)
+int acpi_enable_wakeup_device_power(struct acpi_device *dev)
 {
-       union acpi_object               arg = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list arg_list = {1, &arg};
-       acpi_status                     status = AE_OK;
-       int                                     i;
-       int                                     ret = 0;
+       union acpi_object arg = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &arg };
+       acpi_status status = AE_OK;
+       int i;
+       int ret = 0;
 
        ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power");
        if (!dev || !dev->wakeup.flags.valid)
@@ -310,8 +292,8 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev)
        for (i = 0; i < dev->wakeup.resources.count; i++) {
                ret = acpi_power_on(dev->wakeup.resources.handles[i]);
                if (ret) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                               "Error transition power state\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Error transition power state\n"));
                        dev->wakeup.flags.valid = 0;
                        return_VALUE(-1);
                }
@@ -333,20 +315,20 @@ int acpi_enable_wakeup_device_power (struct acpi_device *dev)
  * 1. Disable _PSW (power state wake)
  * 2. Shutdown down the power resources
  */
-int acpi_disable_wakeup_device_power (struct acpi_device *dev)
+int acpi_disable_wakeup_device_power(struct acpi_device *dev)
 {
-       union acpi_object               arg = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list arg_list = {1, &arg};
-       acpi_status                     status = AE_OK;
-       int                                     i;
-       int                                     ret = 0;
+       union acpi_object arg = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &arg };
+       acpi_status status = AE_OK;
+       int i;
+       int ret = 0;
 
        ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power");
 
        if (!dev || !dev->wakeup.flags.valid)
                return_VALUE(-1);
 
-       arg.integer.value = 0;  
+       arg.integer.value = 0;
        /* Execute PSW */
        status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL);
        if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
@@ -359,8 +341,8 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev)
        for (i = 0; i < dev->wakeup.resources.count; i++) {
                ret = acpi_power_off_device(dev->wakeup.resources.handles[i]);
                if (ret) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                               "Error transition power state\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Error transition power state\n"));
                        dev->wakeup.flags.valid = 0;
                        return_VALUE(-1);
                }
@@ -373,14 +355,12 @@ int acpi_disable_wakeup_device_power (struct acpi_device *dev)
                              Device Power Management
    -------------------------------------------------------------------------- */
 
-int
-acpi_power_get_inferred_state (
-       struct acpi_device      *device)
+int acpi_power_get_inferred_state(struct acpi_device *device)
 {
-       int                     result = 0;
-       struct acpi_handle_list *list = NULL;
-       int                     list_state = 0;
-       int                     i = 0;
+       int result = 0;
+       struct acpi_handle_list *list = NULL;
+       int list_state = 0;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state");
 
@@ -393,7 +373,7 @@ acpi_power_get_inferred_state (
         * We know a device's inferred power state when all the resources
         * required for a given D-state are 'on'.
         */
-       for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) {
+       for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) {
                list = &device->power.states[i].resources;
                if (list->count < 1)
                        continue;
@@ -413,23 +393,20 @@ acpi_power_get_inferred_state (
        return_VALUE(0);
 }
 
-
-int
-acpi_power_transition (
-       struct acpi_device      *device,
-       int                     state)
+int acpi_power_transition(struct acpi_device *device, int state)
 {
-       int                     result = 0;
-       struct acpi_handle_list *cl = NULL;     /* Current Resources */
-       struct acpi_handle_list *tl = NULL;     /* Target Resources */
-       int                     i = 0;
+       int result = 0;
+       struct acpi_handle_list *cl = NULL;     /* Current Resources */
+       struct acpi_handle_list *tl = NULL;     /* Target Resources */
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_power_transition");
 
        if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
                return_VALUE(-EINVAL);
 
-       if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3))
+       if ((device->power.state < ACPI_STATE_D0)
+           || (device->power.state > ACPI_STATE_D3))
                return_VALUE(-ENODEV);
 
        cl = &device->power.states[device->power.state].resources;
@@ -448,7 +425,7 @@ acpi_power_transition (
         * First we reference all power resources required in the target list
         * (e.g. so the device doesn't lose power while transitioning).
         */
-       for (i=0; i<tl->count; i++) {
+       for (i = 0; i < tl->count; i++) {
                result = acpi_power_on(tl->handles[i]);
                if (result)
                        goto end;
@@ -457,7 +434,7 @@ acpi_power_transition (
        /*
         * Then we dereference all power resources used in the current list.
         */
-       for (i=0; i<cl->count; i++) {
+       for (i = 0; i < cl->count; i++) {
                result = acpi_power_off_device(cl->handles[i]);
                if (result)
                        goto end;
@@ -465,21 +442,20 @@ acpi_power_transition (
 
        /* We shouldn't change the state till all above operations succeed */
        device->power.state = state;
-end:
+      end:
        if (result)
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, 
-                       "Error transitioning device [%s] to D%d\n",
-                       device->pnp.bus_id, state));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Error transitioning device [%s] to D%d\n",
+                                 device->pnp.bus_id, state));
 
        return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_power_dir;
+static struct proc_dir_entry *acpi_power_dir;
 
 static int acpi_power_seq_show(struct seq_file *seq, void *offset)
 {
@@ -506,13 +482,12 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "system level:            S%d\n"
-                       "order:                   %d\n"
-                       "reference count:         %d\n",
-                       resource->system_level,
-                       resource->order,
-                       resource->references);
+                  "order:                   %d\n"
+                  "reference count:         %d\n",
+                  resource->system_level,
+                  resource->order, resource->references);
 
-end:
+      end:
        return_VALUE(0);
 }
 
@@ -521,11 +496,9 @@ static int acpi_power_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_power_seq_show, PDE(inode)->data);
 }
 
-static int
-acpi_power_add_fs (
-       struct acpi_device      *device)
+static int acpi_power_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_power_add_fs");
 
@@ -534,18 +507,18 @@ acpi_power_add_fs (
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_power_dir);
+                                                    acpi_power_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
        }
 
        /* 'status' [R] */
        entry = create_proc_entry(ACPI_POWER_FILE_STATUS,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_POWER_FILE_STATUS));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_POWER_FILE_STATUS));
        else {
                entry->proc_fops = &acpi_power_fops;
                entry->data = acpi_driver_data(device);
@@ -554,10 +527,7 @@ acpi_power_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_power_remove_fs (
-       struct acpi_device      *device)
+static int acpi_power_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
 
@@ -571,20 +541,17 @@ acpi_power_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                 Driver Interface
    -------------------------------------------------------------------------- */
 
-static int
-acpi_power_add (
-       struct acpi_device      *device)
+static int acpi_power_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
+       int result = 0;
+       acpi_status status = AE_OK;
        struct acpi_power_resource *resource = NULL;
-       union acpi_object       acpi_object;
-       struct acpi_buffer      buffer = {sizeof(acpi_object), &acpi_object};
+       union acpi_object acpi_object;
+       struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
 
        ACPI_FUNCTION_TRACE("acpi_power_add");
 
@@ -630,22 +597,18 @@ acpi_power_add (
        result = acpi_power_add_fs(device);
        if (result)
                goto end;
-       
+
        printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
-               acpi_device_bid(device), resource->state?"on":"off");
+              acpi_device_bid(device), resource->state ? "on" : "off");
 
-end:
+      end:
        if (result)
                kfree(resource);
-       
+
        return_VALUE(result);
 }
 
-
-static int
-acpi_power_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_power_remove(struct acpi_device *device, int type)
 {
        struct acpi_power_resource *resource = NULL;
 
@@ -654,7 +617,7 @@ acpi_power_remove (
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       resource = (struct acpi_power_resource *) acpi_driver_data(device);
+       resource = (struct acpi_power_resource *)acpi_driver_data(device);
 
        acpi_power_remove_fs(device);
 
@@ -663,10 +626,9 @@ acpi_power_remove (
        return_VALUE(0);
 }
 
-
-static int __init acpi_power_init (void)
+static int __init acpi_power_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_power_init");
 
@@ -689,4 +651,3 @@ static int __init acpi_power_init (void)
 }
 
 subsys_initcall(acpi_power_init);
-
index d56a439ac614f4931c6b86fab438396bf72dc4c9..4217925626423db1f39cc76880e95f700fb5d279 100644 (file)
@@ -58,7 +58,6 @@
 #include <acpi/acpi_drivers.h>
 #include <acpi/processor.h>
 
-
 #define ACPI_PROCESSOR_COMPONENT       0x01000000
 #define ACPI_PROCESSOR_CLASS           "processor"
 #define ACPI_PROCESSOR_DRIVER_NAME     "ACPI Processor Driver"
 #define ACPI_STA_PRESENT 0x00000001
 
 #define _COMPONENT             ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME               ("acpi_processor")
+ACPI_MODULE_NAME("acpi_processor")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_PROCESSOR_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-
-static int acpi_processor_add (struct acpi_device *device);
-static int acpi_processor_start (struct acpi_device *device);
-static int acpi_processor_remove (struct acpi_device *device, int type);
+static int acpi_processor_add(struct acpi_device *device);
+static int acpi_processor_start(struct acpi_device *device);
+static int acpi_processor_remove(struct acpi_device *device, int type);
 static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
-static void acpi_processor_notify ( acpi_handle        handle, u32 event, void *data);
+static void acpi_processor_notify(acpi_handle handle, u32 event, void *data);
 static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
 static int acpi_processor_handle_eject(struct acpi_processor *pr);
 
 static struct acpi_driver acpi_processor_driver = {
-       .name =         ACPI_PROCESSOR_DRIVER_NAME,
-       .class =        ACPI_PROCESSOR_CLASS,
-       .ids =          ACPI_PROCESSOR_HID,
-       .ops =          {
-                               .add =          acpi_processor_add,
-                               .remove =       acpi_processor_remove,
-                               .start  =       acpi_processor_start,
-                       },
+       .name = ACPI_PROCESSOR_DRIVER_NAME,
+       .class = ACPI_PROCESSOR_CLASS,
+       .ids = ACPI_PROCESSOR_HID,
+       .ops = {
+               .add = acpi_processor_add,
+               .remove = acpi_processor_remove,
+               .start = acpi_processor_start,
+               },
 };
 
 #define INSTALL_NOTIFY_HANDLER         1
 #define UNINSTALL_NOTIFY_HANDLER       2
 
-
 static struct file_operations acpi_processor_info_fops = {
-       .open           = acpi_processor_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_processor_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-
-struct acpi_processor  *processors[NR_CPUS];
+struct acpi_processor *processors[NR_CPUS];
 struct acpi_processor_errata errata;
 
-
 /* --------------------------------------------------------------------------
                                 Errata Handling
    -------------------------------------------------------------------------- */
 
-static int
-acpi_processor_errata_piix4 (
-       struct pci_dev          *dev)
+static int acpi_processor_errata_piix4(struct pci_dev *dev)
 {
-       u8                      rev = 0;
-       u8                      value1 = 0;
-       u8                      value2 = 0;
+       u8 rev = 0;
+       u8 value1 = 0;
+       u8 value2 = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4");
 
@@ -188,8 +181,8 @@ acpi_processor_errata_piix4 (
                 * DMA activity.
                 */
                dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                          PCI_DEVICE_ID_INTEL_82371AB,
-                           PCI_ANY_ID, PCI_ANY_ID, NULL);
+                                    PCI_DEVICE_ID_INTEL_82371AB,
+                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
                if (dev) {
                        errata.piix4.bmisx = pci_resource_start(dev, 4);
                        pci_dev_put(dev);
@@ -205,8 +198,8 @@ acpi_processor_errata_piix4 (
                 * devices won't operate well if fast DMA is disabled.
                 */
                dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                       PCI_DEVICE_ID_INTEL_82371AB_0,
-                       PCI_ANY_ID, PCI_ANY_ID, NULL);
+                                    PCI_DEVICE_ID_INTEL_82371AB_0,
+                                    PCI_ANY_ID, PCI_ANY_ID, NULL);
                if (dev) {
                        pci_read_config_byte(dev, 0x76, &value1);
                        pci_read_config_byte(dev, 0x77, &value2);
@@ -220,21 +213,18 @@ acpi_processor_errata_piix4 (
 
        if (errata.piix4.bmisx)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Bus master activity detection (BM-IDE) erratum enabled\n"));
+                                 "Bus master activity detection (BM-IDE) erratum enabled\n"));
        if (errata.piix4.fdma)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Type-F DMA livelock erratum (C3 disabled)\n"));
+                                 "Type-F DMA livelock erratum (C3 disabled)\n"));
 
        return_VALUE(0);
 }
 
-
-int
-acpi_processor_errata (
-       struct acpi_processor   *pr)
+static int acpi_processor_errata(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       struct pci_dev          *dev = NULL;
+       int result = 0;
+       struct pci_dev *dev = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_errata");
 
@@ -245,7 +235,8 @@ acpi_processor_errata (
         * PIIX4
         */
        dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-               PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID, PCI_ANY_ID, NULL);
+                            PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
+                            PCI_ANY_ID, NULL);
        if (dev) {
                result = acpi_processor_errata_piix4(dev);
                pci_dev_put(dev);
@@ -254,7 +245,6 @@ acpi_processor_errata (
        return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                               Common ACPI processor fucntions
    -------------------------------------------------------------------------- */
@@ -265,13 +255,13 @@ acpi_processor_errata (
  */
 
 int acpi_processor_set_pdc(struct acpi_processor *pr,
-                               struct acpi_object_list *pdc_in)
+                          struct acpi_object_list *pdc_in)
 {
-       acpi_status             status = AE_OK;
-       u32                     arg0_buf[3];
-       union acpi_object       arg0 = {ACPI_TYPE_BUFFER};
-       struct acpi_object_list no_object = {1, &arg0};
-       struct acpi_object_list *pdc;
+       acpi_status status = AE_OK;
+       u32 arg0_buf[3];
+       union acpi_object arg0 = { ACPI_TYPE_BUFFER };
+       struct acpi_object_list no_object = { 1, &arg0 };
+       struct acpi_object_list *pdc;
 
        ACPI_FUNCTION_TRACE("acpi_processor_set_pdc");
 
@@ -286,21 +276,21 @@ int acpi_processor_set_pdc(struct acpi_processor *pr,
        status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL);
 
        if ((ACPI_FAILURE(status)) && (pdc_in))
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Error evaluating _PDC, using legacy perf. control...\n"));
 
        return_VALUE(status);
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_processor_dir = NULL;
+static struct proc_dir_entry *acpi_processor_dir = NULL;
 
 static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *)seq->private;
+       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show");
 
@@ -308,40 +298,37 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
                goto end;
 
        seq_printf(seq, "processor id:            %d\n"
-                       "acpi id:                 %d\n"
-                       "bus mastering control:   %s\n"
-                       "power management:        %s\n"
-                       "throttling control:      %s\n"
-                       "limit interface:         %s\n",
-                       pr->id,
-                       pr->acpi_id,
-                       pr->flags.bm_control ? "yes" : "no",
-                       pr->flags.power ? "yes" : "no",
-                       pr->flags.throttling ? "yes" : "no",
-                       pr->flags.limit ? "yes" : "no");
-
-end:
+                  "acpi id:                 %d\n"
+                  "bus mastering control:   %s\n"
+                  "power management:        %s\n"
+                  "throttling control:      %s\n"
+                  "limit interface:         %s\n",
+                  pr->id,
+                  pr->acpi_id,
+                  pr->flags.bm_control ? "yes" : "no",
+                  pr->flags.power ? "yes" : "no",
+                  pr->flags.throttling ? "yes" : "no",
+                  pr->flags.limit ? "yes" : "no");
+
+      end:
        return_VALUE(0);
 }
 
 static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_processor_info_seq_show,
-                                               PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
-
-static int
-acpi_processor_add_fs (
-       struct acpi_device      *device)
+static int acpi_processor_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_add_fs");
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_processor_dir);
+                                                    acpi_processor_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
        }
@@ -349,11 +336,11 @@ acpi_processor_add_fs (
 
        /* 'info' [R] */
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_PROCESSOR_FILE_INFO));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_PROCESSOR_FILE_INFO));
        else {
                entry->proc_fops = &acpi_processor_info_fops;
                entry->data = acpi_driver_data(device);
@@ -362,11 +349,12 @@ acpi_processor_add_fs (
 
        /* 'throttling' [R/W] */
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_PROCESSOR_FILE_THROTTLING));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_PROCESSOR_FILE_THROTTLING));
        else {
                entry->proc_fops = &acpi_processor_throttling_fops;
                entry->proc_fops->write = acpi_processor_write_throttling;
@@ -376,11 +364,12 @@ acpi_processor_add_fs (
 
        /* 'limit' [R/W] */
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_PROCESSOR_FILE_LIMIT));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_PROCESSOR_FILE_LIMIT));
        else {
                entry->proc_fops = &acpi_processor_limit_fops;
                entry->proc_fops->write = acpi_processor_write_limit;
@@ -391,18 +380,17 @@ acpi_processor_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_processor_remove_fs (
-       struct acpi_device      *device)
+static int acpi_processor_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_remove_fs");
 
        if (acpi_device_dir(device)) {
-               remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,acpi_device_dir(device));
+               remove_proc_entry(ACPI_PROCESSOR_FILE_INFO,
+                                 acpi_device_dir(device));
                remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
-                       acpi_device_dir(device));
-               remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,acpi_device_dir(device));
+                                 acpi_device_dir(device));
+               remove_proc_entry(ACPI_PROCESSOR_FILE_LIMIT,
+                                 acpi_device_dir(device));
                remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
                acpi_device_dir(device) = NULL;
        }
@@ -446,15 +434,13 @@ static u8 convert_acpiid_to_cpu(u8 acpi_id)
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static int
-acpi_processor_get_info (
-       struct acpi_processor   *pr)
+static int acpi_processor_get_info(struct acpi_processor *pr)
 {
-       acpi_status             status = 0;
-       union acpi_object       object = {0};
-       struct acpi_buffer      buffer = {sizeof(union acpi_object), &object};
-       u8                      cpu_index;
-       static int              cpu0_initialized;
+       acpi_status status = 0;
+       union acpi_object object = { 0 };
+       struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
+       u8 cpu_index;
+       static int cpu0_initialized;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_info");
 
@@ -473,11 +459,10 @@ acpi_processor_get_info (
        if (acpi_fadt.V1_pm2_cnt_blk && acpi_fadt.pm2_cnt_len) {
                pr->flags.bm_control = 1;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Bus mastering arbitration control present\n"));
-       }
-       else
+                                 "Bus mastering arbitration control present\n"));
+       } else
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "No bus mastering arbitration control\n"));
+                                 "No bus mastering arbitration control\n"));
 
        /*
         * Evalute the processor object.  Note that it is common on SMP to
@@ -487,50 +472,51 @@ acpi_processor_get_info (
        status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error evaluating processor object\n"));
+                                 "Error evaluating processor object\n"));
                return_VALUE(-ENODEV);
        }
 
        /*
         * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
-        *      >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
+        *      >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c
         */
        pr->acpi_id = object.processor.proc_id;
 
        cpu_index = convert_acpiid_to_cpu(pr->acpi_id);
 
-       /* Handle UP system running SMP kernel, with no LAPIC in MADT */
-       if ( !cpu0_initialized && (cpu_index == 0xff) &&
-                       (num_online_cpus() == 1)) {
-               cpu_index = 0;
-       }
-
-       cpu0_initialized = 1;
-
-       pr->id = cpu_index;
-
-       /*
-        *  Extra Processor objects may be enumerated on MP systems with
-        *  less than the max # of CPUs. They should be ignored _iff
-        *  they are physically not present.
-        */
-       if (cpu_index >=  NR_CPUS) {
-               if (ACPI_FAILURE(acpi_processor_hotadd_init(pr->handle, &pr->id))) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error getting cpuindex for acpiid 0x%x\n",
-                               pr->acpi_id));
-                       return_VALUE(-ENODEV);
-               }
-       }
+       /* Handle UP system running SMP kernel, with no LAPIC in MADT */
+       if (!cpu0_initialized && (cpu_index == 0xff) &&
+           (num_online_cpus() == 1)) {
+               cpu_index = 0;
+       }
+
+       cpu0_initialized = 1;
+
+       pr->id = cpu_index;
+
+       /*
+        *  Extra Processor objects may be enumerated on MP systems with
+        *  less than the max # of CPUs. They should be ignored _iff
+        *  they are physically not present.
+        */
+       if (cpu_index >= NR_CPUS) {
+               if (ACPI_FAILURE
+                   (acpi_processor_hotadd_init(pr->handle, &pr->id))) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Error getting cpuindex for acpiid 0x%x\n",
+                                         pr->acpi_id));
+                       return_VALUE(-ENODEV);
+               }
+       }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
-               pr->acpi_id));
+                         pr->acpi_id));
 
        if (!object.processor.pblk_address)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n"));
        else if (object.processor.pblk_length != 6)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n",
-                       object.processor.pblk_length));
+                                 object.processor.pblk_length));
        else {
                pr->throttling.address = object.processor.pblk_address;
                pr->throttling.duty_offset = acpi_fadt.duty_offset;
@@ -557,13 +543,11 @@ acpi_processor_get_info (
        return_VALUE(0);
 }
 
-static int
-acpi_processor_start(
-       struct acpi_device      *device)
+static int acpi_processor_start(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_processor   *pr;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_processor *pr;
 
        ACPI_FUNCTION_TRACE("acpi_processor_start");
 
@@ -584,36 +568,30 @@ acpi_processor_start(
                goto end;
 
        status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
-               acpi_processor_notify, pr);
+                                            acpi_processor_notify, pr);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing device notify handler\n"));
+                                 "Error installing device notify handler\n"));
        }
 
        acpi_processor_power_init(pr, device);
 
        if (pr->flags.throttling) {
                printk(KERN_INFO PREFIX "%s [%s] (supports",
-                       acpi_device_name(device), acpi_device_bid(device));
+                      acpi_device_name(device), acpi_device_bid(device));
                printk(" %d throttling states", pr->throttling.state_count);
                printk(")\n");
        }
 
-end:
+      end:
 
        return_VALUE(result);
 }
 
-
-
-static void
-acpi_processor_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_processor *pr = (struct acpi_processor *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_notify");
 
@@ -627,7 +605,7 @@ acpi_processor_notify (
        case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
                acpi_processor_ppc_has_changed(pr);
                acpi_bus_generate_event(device, event,
-                       pr->performance_platform_limit);
+                                       pr->performance_platform_limit);
                break;
        case ACPI_PROCESSOR_NOTIFY_POWER:
                acpi_processor_cst_has_changed(pr);
@@ -635,19 +613,16 @@ acpi_processor_notify (
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-
-static int
-acpi_processor_add (
-       struct acpi_device      *device)
+static int acpi_processor_add(struct acpi_device *device)
 {
-       struct acpi_processor   *pr = NULL;
+       struct acpi_processor *pr = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_add");
 
@@ -667,21 +642,17 @@ acpi_processor_add (
        return_VALUE(0);
 }
 
-
-static int
-acpi_processor_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_processor_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_processor   *pr = NULL;
+       acpi_status status = AE_OK;
+       struct acpi_processor *pr = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       pr = (struct acpi_processor *) acpi_driver_data(device);
+       pr = (struct acpi_processor *)acpi_driver_data(device);
 
        if (pr->id >= NR_CPUS) {
                kfree(pr);
@@ -696,10 +667,10 @@ acpi_processor_remove (
        acpi_processor_power_exit(pr, device);
 
        status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
-               acpi_processor_notify);
+                                           acpi_processor_notify);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
        }
 
        acpi_processor_remove_fs(device);
@@ -718,33 +689,28 @@ acpi_processor_remove (
 
 static int is_processor_present(acpi_handle handle);
 
-static int
-is_processor_present(
-       acpi_handle handle)
+static int is_processor_present(acpi_handle handle)
 {
-       acpi_status             status;
-       unsigned long           sta = 0;
+       acpi_status status;
+       unsigned long sta = 0;
 
        ACPI_FUNCTION_TRACE("is_processor_present");
 
        status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
        if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Processor Device is not present\n"));
+                                 "Processor Device is not present\n"));
                return_VALUE(0);
        }
        return_VALUE(1);
 }
 
-
 static
-int acpi_processor_device_add(
-       acpi_handle     handle,
-       struct acpi_device **device)
+int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
 {
-       acpi_handle             phandle;
-       struct acpi_device      *pdev;
-       struct acpi_processor   *pr;
+       acpi_handle phandle;
+       struct acpi_device *pdev;
+       struct acpi_processor *pr;
 
        ACPI_FUNCTION_TRACE("acpi_processor_device_add");
 
@@ -766,21 +732,17 @@ int acpi_processor_device_add(
        if (!pr)
                return_VALUE(-ENODEV);
 
-       if ((pr->id >=0) && (pr->id < NR_CPUS)) {
+       if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
                kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE);
        }
        return_VALUE(0);
 }
 
-
 static void
-acpi_processor_hotplug_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_processor   *pr;
-       struct acpi_device      *device = NULL;
+       struct acpi_processor *pr;
+       struct acpi_device *device = NULL;
        int result;
 
        ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify");
@@ -789,8 +751,8 @@ acpi_processor_hotplug_notify (
        case ACPI_NOTIFY_BUS_CHECK:
        case ACPI_NOTIFY_DEVICE_CHECK:
                printk("Processor driver received %s event\n",
-                       (event==ACPI_NOTIFY_BUS_CHECK)?
-                       "ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
+                      (event == ACPI_NOTIFY_BUS_CHECK) ?
+                      "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
 
                if (!is_processor_present(handle))
                        break;
@@ -799,14 +761,14 @@ acpi_processor_hotplug_notify (
                        result = acpi_processor_device_add(handle, &device);
                        if (result)
                                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                       "Unable to add the device\n"));
+                                                 "Unable to add the device\n"));
                        break;
                }
 
                pr = acpi_driver_data(device);
                if (!pr) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Driver data is NULL\n"));
+                                         "Driver data is NULL\n"));
                        break;
                }
 
@@ -816,24 +778,27 @@ acpi_processor_hotplug_notify (
                }
 
                result = acpi_processor_start(device);
-               if ((!result) && ((pr->id >=0) && (pr->id < NR_CPUS))) {
+               if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
                        kobject_hotplug(&device->kobj, KOBJ_ONLINE);
                } else {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Device [%s] failed to start\n",
-                               acpi_device_bid(device)));
+                                         "Device [%s] failed to start\n",
+                                         acpi_device_bid(device)));
                }
-       break;
+               break;
        case ACPI_NOTIFY_EJECT_REQUEST:
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,"received ACPI_NOTIFY_EJECT_REQUEST\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "received ACPI_NOTIFY_EJECT_REQUEST\n"));
 
                if (acpi_bus_get_device(handle, &device)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Device don't exist, dropping EJECT\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Device don't exist, dropping EJECT\n"));
                        break;
                }
                pr = acpi_driver_data(device);
                if (!pr) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Driver data is NULL, dropping EJECT\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Driver data is NULL, dropping EJECT\n"));
                        return_VOID;
                }
 
@@ -842,7 +807,7 @@ acpi_processor_hotplug_notify (
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
@@ -851,45 +816,39 @@ acpi_processor_hotplug_notify (
 
 static acpi_status
 processor_walk_namespace_cb(acpi_handle handle,
-       u32 lvl,
-       void *context,
-       void **rv)
+                           u32 lvl, void *context, void **rv)
 {
-       acpi_status                     status;
+       acpi_status status;
        int *action = context;
-       acpi_object_type        type = 0;
+       acpi_object_type type = 0;
 
        status = acpi_get_type(handle, &type);
        if (ACPI_FAILURE(status))
-               return(AE_OK);
+               return (AE_OK);
 
        if (type != ACPI_TYPE_PROCESSOR)
-               return(AE_OK);
+               return (AE_OK);
 
-       switch(*action) {
+       switch (*action) {
        case INSTALL_NOTIFY_HANDLER:
                acpi_install_notify_handler(handle,
-                       ACPI_SYSTEM_NOTIFY,
-                       acpi_processor_hotplug_notify,
-                       NULL);
+                                           ACPI_SYSTEM_NOTIFY,
+                                           acpi_processor_hotplug_notify,
+                                           NULL);
                break;
        case UNINSTALL_NOTIFY_HANDLER:
                acpi_remove_notify_handler(handle,
-                       ACPI_SYSTEM_NOTIFY,
-                       acpi_processor_hotplug_notify);
+                                          ACPI_SYSTEM_NOTIFY,
+                                          acpi_processor_hotplug_notify);
                break;
        default:
                break;
        }
 
-       return(AE_OK);
+       return (AE_OK);
 }
 
-
-static acpi_status
-acpi_processor_hotadd_init(
-       acpi_handle             handle,
-       int                     *p_cpu)
+static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init");
 
@@ -908,57 +867,47 @@ acpi_processor_hotadd_init(
        return_VALUE(AE_OK);
 }
 
-
-static int
-acpi_processor_handle_eject(struct acpi_processor *pr)
+static int acpi_processor_handle_eject(struct acpi_processor *pr)
 {
        if (cpu_online(pr->id)) {
-               return(-EINVAL);
+               return (-EINVAL);
        }
        arch_unregister_cpu(pr->id);
        acpi_unmap_lsapic(pr->id);
-       return(0);
+       return (0);
 }
 #else
-static acpi_status
-acpi_processor_hotadd_init(
-       acpi_handle             handle,
-       int                     *p_cpu)
+static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu)
 {
        return AE_ERROR;
 }
-static int
-acpi_processor_handle_eject(struct acpi_processor *pr)
+static int acpi_processor_handle_eject(struct acpi_processor *pr)
 {
-       return(-EINVAL);
+       return (-EINVAL);
 }
 #endif
 
-
 static
 void acpi_processor_install_hotplug_notify(void)
 {
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
        int action = INSTALL_NOTIFY_HANDLER;
        acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
-                                    ACPI_ROOT_OBJECT,
-                                    ACPI_UINT32_MAX,
-                                    processor_walk_namespace_cb,
-                                    &action, NULL);
+                           ACPI_ROOT_OBJECT,
+                           ACPI_UINT32_MAX,
+                           processor_walk_namespace_cb, &action, NULL);
 #endif
 }
 
-
 static
 void acpi_processor_uninstall_hotplug_notify(void)
 {
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
        int action = UNINSTALL_NOTIFY_HANDLER;
        acpi_walk_namespace(ACPI_TYPE_PROCESSOR,
-                                    ACPI_ROOT_OBJECT,
-                                    ACPI_UINT32_MAX,
-                                    processor_walk_namespace_cb,
-                                    &action, NULL);
+                           ACPI_ROOT_OBJECT,
+                           ACPI_UINT32_MAX,
+                           processor_walk_namespace_cb, &action, NULL);
 #endif
 }
 
@@ -968,10 +917,9 @@ void acpi_processor_uninstall_hotplug_notify(void)
  * ACPI, but needs symbols from this driver
  */
 
-static int __init
-acpi_processor_init (void)
+static int __init acpi_processor_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_init");
 
@@ -998,9 +946,7 @@ acpi_processor_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_processor_exit (void)
+static void __exit acpi_processor_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_exit");
 
@@ -1017,7 +963,6 @@ acpi_processor_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_processor_init);
 module_exit(acpi_processor_exit);
 
index 2c04740c6543f54ea6d0c35a51d00d11e479b76b..26a3a4016115364467b5feff71415c7e88f4d016 100644 (file)
 #define ACPI_PROCESSOR_CLASS            "processor"
 #define ACPI_PROCESSOR_DRIVER_NAME      "ACPI Processor Driver"
 #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME                ("acpi_processor")
-
+ACPI_MODULE_NAME("acpi_processor")
 #define ACPI_PROCESSOR_FILE_POWER      "power"
-
 #define US_TO_PM_TIMER_TICKS(t)                ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
 #define C2_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
 #define C3_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-
-static void (*pm_idle_save)(void);
+static void (*pm_idle_save) (void);
 module_param(max_cstate, uint, 0644);
 
 static unsigned int nocst = 0;
@@ -69,7 +66,8 @@ module_param(nocst, uint, 0000);
  * 100 HZ: 0x0000000F: 4 jiffies = 40ms
  * reduce history for more aggressive entry into C3
  */
-static unsigned int bm_history = (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
+static unsigned int bm_history =
+    (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
 module_param(bm_history, uint, 0644);
 /* --------------------------------------------------------------------------
                                 Power Management
@@ -87,34 +85,36 @@ static int set_max_cstate(struct dmi_system_id *id)
                return 0;
 
        printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate."
-               " Override with \"processor.max_cstate=%d\"\n", id->ident,
-               (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1);
+              " Override with \"processor.max_cstate=%d\"\n", id->ident,
+              (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1);
 
        max_cstate = (long)id->driver_data;
 
        return 0;
 }
 
-
 static struct dmi_system_id __initdata processor_power_dmi_table[] = {
-       { set_max_cstate, "IBM ThinkPad R40e", {
-         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
-         DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1},
-       { set_max_cstate, "Medion 41700", {
-         DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
-         DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1},
-       { set_max_cstate, "Clevo 5600D", {
-         DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
-         DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") },
-         (void*)2},
+       {set_max_cstate, "IBM ThinkPad R40e", {
+                                              DMI_MATCH(DMI_BIOS_VENDOR,
+                                                        "IBM"),
+                                              DMI_MATCH(DMI_BIOS_VERSION,
+                                                        "1SET60WW")},
+        (void *)1},
+       {set_max_cstate, "Medion 41700", {
+                                         DMI_MATCH(DMI_BIOS_VENDOR,
+                                                   "Phoenix Technologies LTD"),
+                                         DMI_MATCH(DMI_BIOS_VERSION,
+                                                   "R01-A1J")}, (void *)1},
+       {set_max_cstate, "Clevo 5600D", {
+                                        DMI_MATCH(DMI_BIOS_VENDOR,
+                                                  "Phoenix Technologies LTD"),
+                                        DMI_MATCH(DMI_BIOS_VERSION,
+                                                  "SHE845M0.86C.0013.D.0302131307")},
+        (void *)2},
        {},
 };
 
-
-static inline u32
-ticks_elapsed (
-       u32                     t1,
-       u32                     t2)
+static inline u32 ticks_elapsed(u32 t1, u32 t2)
 {
        if (t2 >= t1)
                return (t2 - t1);
@@ -124,13 +124,11 @@ ticks_elapsed (
                return ((0xFFFFFFFF - t1) + t2);
 }
 
-
 static void
-acpi_processor_power_activate (
-       struct acpi_processor   *pr,
-       struct acpi_processor_cx  *new)
+acpi_processor_power_activate(struct acpi_processor *pr,
+                             struct acpi_processor_cx *new)
 {
-       struct acpi_processor_cx  *old;
+       struct acpi_processor_cx *old;
 
        if (!pr || !new)
                return;
@@ -139,7 +137,7 @@ acpi_processor_power_activate (
 
        if (old)
                old->promotion.count = 0;
-       new->demotion.count = 0;
+       new->demotion.count = 0;
 
        /* Cleanup from old state. */
        if (old) {
@@ -147,7 +145,8 @@ acpi_processor_power_activate (
                case ACPI_STATE_C3:
                        /* Disable bus master reload */
                        if (new->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK);
+                               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0,
+                                                 ACPI_MTX_DO_NOT_LOCK);
                        break;
                }
        }
@@ -157,7 +156,8 @@ acpi_processor_power_activate (
        case ACPI_STATE_C3:
                /* Enable bus master reload */
                if (old->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK);
+                       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1,
+                                         ACPI_MTX_DO_NOT_LOCK);
                break;
        }
 
@@ -166,17 +166,15 @@ acpi_processor_power_activate (
        return;
 }
 
+static atomic_t c3_cpu_count;
 
-static atomic_t        c3_cpu_count;
-
-
-static void acpi_processor_idle (void)
+static void acpi_processor_idle(void)
 {
-       struct acpi_processor   *pr = NULL;
+       struct acpi_processor *pr = NULL;
        struct acpi_processor_cx *cx = NULL;
        struct acpi_processor_cx *next_state = NULL;
-       int                     sleep_ticks = 0;
-       u32                     t1, t2 = 0;
+       int sleep_ticks = 0;
+       u32 t1, t2 = 0;
 
        pr = processors[raw_smp_processor_id()];
        if (!pr)
@@ -208,8 +206,8 @@ static void acpi_processor_idle (void)
         * for demotion.
         */
        if (pr->flags.bm_check) {
-               u32             bm_status = 0;
-               unsigned long   diff = jiffies - pr->power.bm_check_timestamp;
+               u32 bm_status = 0;
+               unsigned long diff = jiffies - pr->power.bm_check_timestamp;
 
                if (diff > 32)
                        diff = 32;
@@ -223,11 +221,11 @@ static void acpi_processor_idle (void)
                }
 
                acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS,
-                       &bm_status, ACPI_MTX_DO_NOT_LOCK);
+                                 &bm_status, ACPI_MTX_DO_NOT_LOCK);
                if (bm_status) {
                        pr->power.bm_activity++;
                        acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS,
-                               1, ACPI_MTX_DO_NOT_LOCK);
+                                         1, ACPI_MTX_DO_NOT_LOCK);
                }
                /*
                 * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
@@ -236,7 +234,7 @@ static void acpi_processor_idle (void)
                 */
                else if (errata.piix4.bmisx) {
                        if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01)
-                               || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
+                           || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
                                pr->power.bm_activity++;
                }
 
@@ -281,7 +279,7 @@ static void acpi_processor_idle (void)
                else
                        safe_halt();
                /*
-                 * TBD: Can't get time duration while in C1, as resumes
+                * TBD: Can't get time duration while in C1, as resumes
                 *      go to an ISR rather than here.  Need to instrument
                 *      base interrupt handler.
                 */
@@ -300,26 +298,27 @@ static void acpi_processor_idle (void)
                /* Re-enable interrupts */
                local_irq_enable();
                /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
+               sleep_ticks =
+                   ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
                break;
 
        case ACPI_STATE_C3:
-               
+
                if (pr->flags.bm_check) {
                        if (atomic_inc_return(&c3_cpu_count) ==
-                                       num_online_cpus()) {
+                           num_online_cpus()) {
                                /*
                                 * All CPUs are trying to go to C3
                                 * Disable bus master arbitration
                                 */
                                acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1,
-                                       ACPI_MTX_DO_NOT_LOCK);
+                                                 ACPI_MTX_DO_NOT_LOCK);
                        }
                } else {
                        /* SMP with no shared cache... Invalidate cache  */
                        ACPI_FLUSH_CPU_CACHE();
                }
-               
+
                /* Get start time (ticks) */
                t1 = inl(acpi_fadt.xpm_tmr_blk.address);
                /* Invoke C3 */
@@ -331,13 +330,15 @@ static void acpi_processor_idle (void)
                if (pr->flags.bm_check) {
                        /* Enable bus master arbitration */
                        atomic_dec(&c3_cpu_count);
-                       acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK);
+                       acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0,
+                                         ACPI_MTX_DO_NOT_LOCK);
                }
 
                /* Re-enable interrupts */
                local_irq_enable();
                /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
+               sleep_ticks =
+                   ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
                break;
 
        default:
@@ -359,15 +360,18 @@ static void acpi_processor_idle (void)
            ((cx->promotion.state - pr->power.states) <= max_cstate)) {
                if (sleep_ticks > cx->promotion.threshold.ticks) {
                        cx->promotion.count++;
-                       cx->demotion.count = 0;
-                       if (cx->promotion.count >= cx->promotion.threshold.count) {
+                       cx->demotion.count = 0;
+                       if (cx->promotion.count >=
+                           cx->promotion.threshold.count) {
                                if (pr->flags.bm_check) {
-                                       if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) {
-                                               next_state = cx->promotion.state;
+                                       if (!
+                                           (pr->power.bm_activity & cx->
+                                            promotion.threshold.bm)) {
+                                               next_state =
+                                                   cx->promotion.state;
                                                goto end;
                                        }
-                               }
-                               else {
+                               } else {
                                        next_state = cx->promotion.state;
                                        goto end;
                                }
@@ -392,7 +396,7 @@ static void acpi_processor_idle (void)
                }
        }
 
-end:
+      end:
        /*
         * Demote if current state exceeds max_cstate
         */
@@ -412,7 +416,7 @@ end:
 
        return;
 
- easy_out:
     easy_out:
        /* do C1 instead of busy loop */
        if (pm_idle_save)
                pm_idle_save();
@@ -421,10 +425,7 @@ end:
        return;
 }
 
-
-static int
-acpi_processor_set_power_policy (
-       struct acpi_processor   *pr)
+static int acpi_processor_set_power_policy(struct acpi_processor *pr)
 {
        unsigned int i;
        unsigned int state_is_set = 0;
@@ -432,7 +433,7 @@ acpi_processor_set_power_policy (
        struct acpi_processor_cx *higher = NULL;
        struct acpi_processor_cx *cx;
 
-       ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy");
+       ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy");
 
        if (!pr)
                return_VALUE(-EINVAL);
@@ -447,7 +448,7 @@ acpi_processor_set_power_policy (
         */
 
        /* startup state */
-       for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
+       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
                cx = &pr->power.states[i];
                if (!cx->valid)
                        continue;
@@ -456,13 +457,13 @@ acpi_processor_set_power_policy (
                        pr->power.state = cx;
                state_is_set++;
                break;
-       }
+       }
 
        if (!state_is_set)
                return_VALUE(-ENODEV);
 
        /* demotion */
-       for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
+       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
                cx = &pr->power.states[i];
                if (!cx->valid)
                        continue;
@@ -485,7 +486,7 @@ acpi_processor_set_power_policy (
                        continue;
 
                if (higher) {
-                       cx->promotion.state  = higher;
+                       cx->promotion.state = higher;
                        cx->promotion.threshold.ticks = cx->latency_ticks;
                        if (cx->type >= ACPI_STATE_C2)
                                cx->promotion.threshold.count = 4;
@@ -498,11 +499,10 @@ acpi_processor_set_power_policy (
                higher = cx;
        }
 
-       return_VALUE(0);
+       return_VALUE(0);
 }
 
-
-static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr)
+static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 {
        int i;
 
@@ -543,15 +543,14 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr)
        return_VALUE(0);
 }
 
-
-static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr)
+static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr)
 {
        int i;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
 
        for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
-               memset(&(pr->power.states[i]), 0, 
+               memset(&(pr->power.states[i]), 0,
                       sizeof(struct acpi_processor_cx));
 
        /* if info is obtained from pblk/fadt, type equals state */
@@ -567,14 +566,13 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr)
        return_VALUE(0);
 }
 
-
-static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
+static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
 {
-       acpi_status             status = 0;
-       acpi_integer            count;
-       int                     i;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *cst;
+       acpi_status status = 0;
+       acpi_integer count;
+       int i;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *cst;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst");
 
@@ -583,20 +581,21 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
 
        pr->power.count = 0;
        for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
-               memset(&(pr->power.states[i]), 0, 
+               memset(&(pr->power.states[i]), 0,
                       sizeof(struct acpi_processor_cx));
 
        status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n"));
                return_VALUE(-ENODEV);
-       }
+       }
 
-       cst = (union acpi_object *) buffer.pointer;
+       cst = (union acpi_object *)buffer.pointer;
 
        /* There must be at least 2 elements */
        if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "not enough elements in _CST\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "not enough elements in _CST\n"));
                status = -EFAULT;
                goto end;
        }
@@ -605,15 +604,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
 
        /* Validate number of power states. */
        if (count < 1 || count != cst->package.count - 1) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "count given by _CST is not valid\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "count given by _CST is not valid\n"));
                status = -EFAULT;
                goto end;
        }
 
        /* We support up to ACPI_PROCESSOR_MAX_POWER. */
        if (count > ACPI_PROCESSOR_MAX_POWER) {
-               printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER);
-               printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
+               printk(KERN_WARNING
+                      "Limiting number of power states to max (%d)\n",
+                      ACPI_PROCESSOR_MAX_POWER);
+               printk(KERN_WARNING
+                      "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
                count = ACPI_PROCESSOR_MAX_POWER;
        }
 
@@ -628,29 +631,29 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
 
                memset(&cx, 0, sizeof(cx));
 
-               element = (union acpi_object *) &(cst->package.elements[i]);
+               element = (union acpi_object *)&(cst->package.elements[i]);
                if (element->type != ACPI_TYPE_PACKAGE)
                        continue;
 
                if (element->package.count != 4)
                        continue;
 
-               obj = (union acpi_object *) &(element->package.elements[0]);
+               obj = (union acpi_object *)&(element->package.elements[0]);
 
                if (obj->type != ACPI_TYPE_BUFFER)
                        continue;
 
-               reg = (struct acpi_power_register *) obj->buffer.pointer;
+               reg = (struct acpi_power_register *)obj->buffer.pointer;
 
                if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO &&
-                       (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
+                   (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
                        continue;
 
                cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
-                       0 : reg->address;
+                   0 : reg->address;
 
                /* There should be an easy way to extract an integer... */
-               obj = (union acpi_object *) &(element->package.elements[1]);
+               obj = (union acpi_object *)&(element->package.elements[1]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
@@ -660,17 +663,16 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
                    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
                        continue;
 
-               if ((cx.type < ACPI_STATE_C1) ||
-                   (cx.type > ACPI_STATE_C3))
+               if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3))
                        continue;
 
-               obj = (union acpi_object *) &(element->package.elements[2]);
+               obj = (union acpi_object *)&(element->package.elements[2]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
                cx.latency = obj->integer.value;
 
-               obj = (union acpi_object *) &(element->package.elements[3]);
+               obj = (union acpi_object *)&(element->package.elements[3]);
                if (obj->type != ACPI_TYPE_INTEGER)
                        continue;
 
@@ -680,19 +682,19 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
                memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx));
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n",
+                         pr->power.count));
 
        /* Validate number of power states discovered */
        if (pr->power.count < 2)
                status = -ENODEV;
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        return_VALUE(status);
 }
 
-
 static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2");
@@ -706,8 +708,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
         */
        else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "latency too large [%d]\n",
-                                 cx->latency));
+                                 "latency too large [%d]\n", cx->latency));
                return_VOID;
        }
 
@@ -721,10 +722,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
        return_VOID;
 }
 
-
-static void acpi_processor_power_verify_c3(
-       struct acpi_processor *pr,
-       struct acpi_processor_cx *cx)
+static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
+                                          struct acpi_processor_cx *cx)
 {
        static int bm_check_flag;
 
@@ -739,8 +738,7 @@ static void acpi_processor_power_verify_c3(
         */
        else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "latency too large [%d]\n",
-                                 cx->latency));
+                                 "latency too large [%d]\n", cx->latency));
                return_VOID;
        }
 
@@ -753,7 +751,7 @@ static void acpi_processor_power_verify_c3(
         */
        else if (errata.piix4.fdma) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "C3 not supported on PIIX4 with Type-F DMA\n"));
+                                 "C3 not supported on PIIX4 with Type-F DMA\n"));
                return_VOID;
        }
 
@@ -770,7 +768,7 @@ static void acpi_processor_power_verify_c3(
                /* bus mastering control is necessary */
                if (!pr->flags.bm_control) {
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "C3 support requires bus mastering control\n"));
+                                         "C3 support requires bus mastering control\n"));
                        return_VOID;
                }
        } else {
@@ -780,12 +778,12 @@ static void acpi_processor_power_verify_c3(
                 */
                if (acpi_fadt.wb_invd != 1) {
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                         "Cache invalidation should work properly"
-                         " for C3 to be enabled on SMP systems\n"));
+                                         "Cache invalidation should work properly"
+                                         " for C3 to be enabled on SMP systems\n"));
                        return_VOID;
                }
                acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD,
-                               0, ACPI_MTX_DO_NOT_LOCK);
+                                 0, ACPI_MTX_DO_NOT_LOCK);
        }
 
        /*
@@ -800,13 +798,12 @@ static void acpi_processor_power_verify_c3(
        return_VOID;
 }
 
-
 static int acpi_processor_power_verify(struct acpi_processor *pr)
 {
        unsigned int i;
        unsigned int working = 0;
 
-       for (i=1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
+       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
                struct acpi_processor_cx *cx = &pr->power.states[i];
 
                switch (cx->type) {
@@ -830,8 +827,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
        return (working);
 }
 
-static int acpi_processor_get_power_info (
-       struct acpi_processor   *pr)
+static int acpi_processor_get_power_info(struct acpi_processor *pr)
 {
        unsigned int i;
        int result;
@@ -874,16 +870,16 @@ static int acpi_processor_get_power_info (
        return_VALUE(0);
 }
 
-int acpi_processor_cst_has_changed (struct acpi_processor *pr)
+int acpi_processor_cst_has_changed(struct acpi_processor *pr)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed");
 
        if (!pr)
-               return_VALUE(-EINVAL);
+               return_VALUE(-EINVAL);
 
-       if ( nocst) {
+       if (nocst) {
                return_VALUE(-ENODEV);
        }
 
@@ -892,7 +888,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr)
 
        /* Fall back to the default idle loop */
        pm_idle = pm_idle_save;
-       synchronize_sched();  /* Relies on interrupts forcing exit from idle. */
+       synchronize_sched();    /* Relies on interrupts forcing exit from idle. */
 
        pr->flags.power = 0;
        result = acpi_processor_get_power_info(pr);
@@ -906,8 +902,8 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr)
 
 static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *)seq->private;
-       unsigned int            i;
+       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
+       unsigned int i;
 
        ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show");
 
@@ -915,17 +911,17 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
                goto end;
 
        seq_printf(seq, "active state:            C%zd\n"
-                       "max_cstate:              C%d\n"
-                       "bus master activity:     %08x\n",
-                       pr->power.state ? pr->power.state - pr->power.states : 0,
-                       max_cstate,
-                       (unsigned)pr->power.bm_activity);
+                  "max_cstate:              C%d\n"
+                  "bus master activity:     %08x\n",
+                  pr->power.state ? pr->power.state - pr->power.states : 0,
+                  max_cstate, (unsigned)pr->power.bm_activity);
 
        seq_puts(seq, "states:\n");
 
        for (i = 1; i <= pr->power.count; i++) {
                seq_printf(seq, "   %cC%d:                  ",
-                       (&pr->power.states[i] == pr->power.state?'*':' '), i);
+                          (&pr->power.states[i] ==
+                           pr->power.state ? '*' : ' '), i);
 
                if (!pr->power.states[i].valid) {
                        seq_puts(seq, "<not supported>\n");
@@ -949,45 +945,46 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
 
                if (pr->power.states[i].promotion.state)
                        seq_printf(seq, "promotion[C%zd] ",
-                               (pr->power.states[i].promotion.state -
-                                pr->power.states));
+                                  (pr->power.states[i].promotion.state -
+                                   pr->power.states));
                else
                        seq_puts(seq, "promotion[--] ");
 
                if (pr->power.states[i].demotion.state)
                        seq_printf(seq, "demotion[C%zd] ",
-                               (pr->power.states[i].demotion.state -
-                                pr->power.states));
+                                  (pr->power.states[i].demotion.state -
+                                   pr->power.states));
                else
                        seq_puts(seq, "demotion[--] ");
 
                seq_printf(seq, "latency[%03d] usage[%08d]\n",
-                       pr->power.states[i].latency,
-                       pr->power.states[i].usage);
+                          pr->power.states[i].latency,
+                          pr->power.states[i].usage);
        }
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_processor_power_seq_show,
-                                               PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
 static struct file_operations acpi_processor_power_fops = {
-       .open           = acpi_processor_power_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_processor_power_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device)
+int acpi_processor_power_init(struct acpi_processor *pr,
+                             struct acpi_device *device)
 {
-       acpi_status             status = 0;
-       static int              first_run = 0;
-       struct proc_dir_entry   *entry = NULL;
+       acpi_status status = 0;
+       static int first_run = 0;
+       struct proc_dir_entry *entry = NULL;
        unsigned int i;
 
        ACPI_FUNCTION_TRACE("acpi_processor_power_init");
@@ -995,7 +992,9 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
        if (!first_run) {
                dmi_check_system(processor_power_dmi_table);
                if (max_cstate < ACPI_C_STATES_MAX)
-                       printk(KERN_NOTICE "ACPI: processor limited to max C-state %d\n", max_cstate);
+                       printk(KERN_NOTICE
+                              "ACPI: processor limited to max C-state %d\n",
+                              max_cstate);
                first_run++;
        }
 
@@ -1003,7 +1002,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
                return_VALUE(-EINVAL);
 
        if (acpi_fadt.cst_cnt && !nocst) {
-               status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8);
+               status =
+                   acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8);
                if (ACPI_FAILURE(status)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                          "Notifying BIOS of _CST ability failed\n"));
@@ -1023,7 +1023,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
                printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id);
                for (i = 1; i <= pr->power.count; i++)
                        if (pr->power.states[i].valid)
-                               printk(" C%d[C%d]", i, pr->power.states[i].type);
+                               printk(" C%d[C%d]", i,
+                                      pr->power.states[i].type);
                printk(")\n");
 
                if (pr->id == 0) {
@@ -1034,11 +1035,11 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
 
        /* 'power' [R] */
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_PROCESSOR_FILE_POWER));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_PROCESSOR_FILE_POWER));
        else {
                entry->proc_fops = &acpi_processor_power_fops;
                entry->data = acpi_driver_data(device);
@@ -1050,14 +1051,16 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
        return_VALUE(0);
 }
 
-int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device)
+int acpi_processor_power_exit(struct acpi_processor *pr,
+                             struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_power_exit");
 
        pr->flags.power_setup_done = 0;
 
        if (acpi_device_dir(device))
-               remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,acpi_device_dir(device));
+               remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
+                                 acpi_device_dir(device));
 
        /* Unregister the idle handler when processor #0 is removed. */
        if (pr->id == 0) {
index 1f0d6256302fc61afee4a9b631b710ab2a07d395..22c7bb66c2005c4956a241c7a31a566d9ae6b073 100644 (file)
@@ -26,7 +26,6 @@
  *
  */
 
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/processor.h>
 
-
 #define ACPI_PROCESSOR_COMPONENT       0x01000000
 #define ACPI_PROCESSOR_CLASS           "processor"
 #define ACPI_PROCESSOR_DRIVER_NAME     "ACPI Processor Driver"
 #define ACPI_PROCESSOR_FILE_PERFORMANCE        "performance"
 #define _COMPONENT             ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME               ("acpi_processor")
-
+ACPI_MODULE_NAME("acpi_processor")
 
 static DECLARE_MUTEX(performance_sem);
 
@@ -69,8 +66,7 @@ static DECLARE_MUTEX(performance_sem);
 static int acpi_processor_ppc_status = 0;
 
 static int acpi_processor_ppc_notifier(struct notifier_block *nb,
-       unsigned long event,
-       void *data)
+                                      unsigned long event, void *data)
 {
        struct cpufreq_policy *policy = data;
        struct acpi_processor *pr;
@@ -85,7 +81,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
        if (!pr || !pr->performance)
                goto out;
 
-       ppc = (unsigned int) pr->performance_platform_limit;
+       ppc = (unsigned int)pr->performance_platform_limit;
        if (!ppc)
                goto out;
 
@@ -93,26 +89,23 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
                goto out;
 
        cpufreq_verify_within_limits(policy, 0,
-               pr->performance->states[ppc].core_frequency * 1000);
+                                    pr->performance->states[ppc].
+                                    core_frequency * 1000);
 
- out:
     out:
        up(&performance_sem);
 
        return 0;
 }
 
-
 static struct notifier_block acpi_ppc_notifier_block = {
        .notifier_call = acpi_processor_ppc_notifier,
 };
 
-
-static int
-acpi_processor_get_platform_limit (
-       struct acpi_processor*  pr)
+static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
 {
-       acpi_status             status = 0;
-       unsigned long           ppc = 0;
+       acpi_status status = 0;
+       unsigned long ppc = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit");
 
@@ -128,19 +121,17 @@ acpi_processor_get_platform_limit (
        if (status != AE_NOT_FOUND)
                acpi_processor_ppc_status |= PPC_IN_USE;
 
-       if(ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+       if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n"));
                return_VALUE(-ENODEV);
        }
 
-       pr->performance_platform_limit = (int) ppc;
+       pr->performance_platform_limit = (int)ppc;
 
        return_VALUE(0);
 }
 
-
-int acpi_processor_ppc_has_changed(
-       struct acpi_processor *pr)
+int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
 {
        int ret = acpi_processor_get_platform_limit(pr);
        if (ret < 0)
@@ -149,44 +140,44 @@ int acpi_processor_ppc_has_changed(
                return cpufreq_update_policy(pr->id);
 }
 
-
-void acpi_processor_ppc_init(void) {
-       if (!cpufreq_register_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER))
+void acpi_processor_ppc_init(void)
+{
+       if (!cpufreq_register_notifier
+           (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER))
                acpi_processor_ppc_status |= PPC_REGISTERED;
        else
-               printk(KERN_DEBUG "Warning: Processor Platform Limit not supported.\n");
+               printk(KERN_DEBUG
+                      "Warning: Processor Platform Limit not supported.\n");
 }
 
-
-void acpi_processor_ppc_exit(void) {
+void acpi_processor_ppc_exit(void)
+{
        if (acpi_processor_ppc_status & PPC_REGISTERED)
-               cpufreq_unregister_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER);
+               cpufreq_unregister_notifier(&acpi_ppc_notifier_block,
+                                           CPUFREQ_POLICY_NOTIFIER);
 
        acpi_processor_ppc_status &= ~PPC_REGISTERED;
 }
 
-
-static int
-acpi_processor_get_performance_control (
-       struct acpi_processor *pr)
+static int acpi_processor_get_performance_control(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *pct = NULL;
-       union acpi_object       obj = {0};
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *pct = NULL;
+       union acpi_object obj = { 0 };
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control");
 
        status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
-       if(ACPI_FAILURE(status)) {
+       if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n"));
                return_VALUE(-ENODEV);
        }
 
-       pct = (union acpi_object *) buffer.pointer;
+       pct = (union acpi_object *)buffer.pointer;
        if (!pct || (pct->type != ACPI_TYPE_PACKAGE)
-               || (pct->package.count != 2)) {
+           || (pct->package.count != 2)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n"));
                result = -EFAULT;
                goto end;
@@ -199,15 +190,15 @@ acpi_processor_get_performance_control (
        obj = pct->package.elements[0];
 
        if ((obj.type != ACPI_TYPE_BUFFER)
-               || (obj.buffer.length < sizeof(struct acpi_pct_register))
-               || (obj.buffer.pointer == NULL)) {
+           || (obj.buffer.length < sizeof(struct acpi_pct_register))
+           || (obj.buffer.pointer == NULL)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Invalid _PCT data (control_register)\n"));
+                                 "Invalid _PCT data (control_register)\n"));
                result = -EFAULT;
                goto end;
        }
-       memcpy(&pr->performance->control_register, obj.buffer.pointer, sizeof(struct acpi_pct_register));
-
+       memcpy(&pr->performance->control_register, obj.buffer.pointer,
+              sizeof(struct acpi_pct_register));
 
        /*
         * status_register
@@ -216,44 +207,42 @@ acpi_processor_get_performance_control (
        obj = pct->package.elements[1];
 
        if ((obj.type != ACPI_TYPE_BUFFER)
-               || (obj.buffer.length < sizeof(struct acpi_pct_register))
-               || (obj.buffer.pointer == NULL)) {
+           || (obj.buffer.length < sizeof(struct acpi_pct_register))
+           || (obj.buffer.pointer == NULL)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Invalid _PCT data (status_register)\n"));
+                                 "Invalid _PCT data (status_register)\n"));
                result = -EFAULT;
                goto end;
        }
 
-       memcpy(&pr->performance->status_register, obj.buffer.pointer, sizeof(struct acpi_pct_register));
+       memcpy(&pr->performance->status_register, obj.buffer.pointer,
+              sizeof(struct acpi_pct_register));
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        return_VALUE(result);
 }
 
-
-static int
-acpi_processor_get_performance_states (
-       struct acpi_processor   *pr)
+static int acpi_processor_get_performance_states(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       struct acpi_buffer      format = {sizeof("NNNNNN"), "NNNNNN"};
-       struct acpi_buffer      state = {0, NULL};
-       union acpi_object       *pss = NULL;
-       int                     i;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_buffer format = { sizeof("NNNNNN"), "NNNNNN" };
+       struct acpi_buffer state = { 0, NULL };
+       union acpi_object *pss = NULL;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states");
 
        status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
-       if(ACPI_FAILURE(status)) {
+       if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n"));
                return_VALUE(-ENODEV);
        }
 
-       pss = (union acpi_object *) buffer.pointer;
+       pss = (union acpi_object *)buffer.pointer;
        if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n"));
                result = -EFAULT;
@@ -261,10 +250,12 @@ acpi_processor_get_performance_states (
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n",
-               pss->package.count));
+                         pss->package.count));
 
        pr->performance->state_count = pss->package.count;
-       pr->performance->states = kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, GFP_KERNEL);
+       pr->performance->states =
+           kmalloc(sizeof(struct acpi_processor_px) * pss->package.count,
+                   GFP_KERNEL);
        if (!pr->performance->states) {
                result = -ENOMEM;
                goto end;
@@ -280,46 +271,44 @@ acpi_processor_get_performance_states (
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i));
 
                status = acpi_extract_package(&(pss->package.elements[i]),
-                       &format, &state);
+                                             &format, &state);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid _PSS data\n"));
                        result = -EFAULT;
                        kfree(pr->performance->states);
                        goto end;
                }
 
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n",
-                       i,
-                       (u32) px->core_frequency,
-                       (u32) px->power,
-                       (u32) px->transition_latency,
-                       (u32) px->bus_master_latency,
-                       (u32) px->control,
-                       (u32) px->status));
+                                 "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n",
+                                 i,
+                                 (u32) px->core_frequency,
+                                 (u32) px->power,
+                                 (u32) px->transition_latency,
+                                 (u32) px->bus_master_latency,
+                                 (u32) px->control, (u32) px->status));
 
                if (!px->core_frequency) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data: freq is zero\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid _PSS data: freq is zero\n"));
                        result = -EFAULT;
                        kfree(pr->performance->states);
                        goto end;
                }
        }
 
-end:
+      end:
        acpi_os_free(buffer.pointer);
 
        return_VALUE(result);
 }
 
-
-static int
-acpi_processor_get_performance_info (
-       struct acpi_processor   *pr)
+static int acpi_processor_get_performance_info(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       acpi_handle             handle = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       acpi_handle handle = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info");
 
@@ -331,7 +320,7 @@ acpi_processor_get_performance_info (
        status = acpi_get_handle(pr->handle, "_PCT", &handle);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "ACPI-based processor performance control unavailable\n"));
+                                 "ACPI-based processor performance control unavailable\n"));
                return_VALUE(-ENODEV);
        }
 
@@ -350,10 +339,10 @@ acpi_processor_get_performance_info (
        return_VALUE(0);
 }
 
-
-int acpi_processor_notify_smm(struct module *calling_module) {
-       acpi_status             status;
-       static int              is_done = 0;
+int acpi_processor_notify_smm(struct module *calling_module)
+{
+       acpi_status status;
+       static int is_done = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_notify_smm");
 
@@ -371,8 +360,7 @@ int acpi_processor_notify_smm(struct module *calling_module) {
        if (is_done > 0) {
                module_put(calling_module);
                return_VALUE(0);
-       }
-       else if (is_done < 0) {
+       } else if (is_done < 0) {
                module_put(calling_module);
                return_VALUE(is_done);
        }
@@ -380,28 +368,30 @@ int acpi_processor_notify_smm(struct module *calling_module) {
        is_done = -EIO;
 
        /* Can't write pstate_cnt to smi_cmd if either value is zero */
-       if ((!acpi_fadt.smi_cmd) ||
-           (!acpi_fadt.pstate_cnt)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "No SMI port or pstate_cnt\n"));
+       if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n"));
                module_put(calling_module);
                return_VALUE(0);
        }
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n",
+                         acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
 
        /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use
         * it anyway, so we need to support it... */
        if (acpi_fadt_is_v1) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Using v1.0 FADT reserved value for pstate_cnt\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Using v1.0 FADT reserved value for pstate_cnt\n"));
        }
 
-       status = acpi_os_write_port (acpi_fadt.smi_cmd,
-                                    (u32) acpi_fadt.pstate_cnt, 8);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_os_write_port(acpi_fadt.smi_cmd,
+                                   (u32) acpi_fadt.pstate_cnt, 8);
+       if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "Failed to write pstate_cnt [0x%x] to "
-                                 "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd));
+                                 "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt,
+                                 acpi_fadt.smi_cmd));
                module_put(calling_module);
                return_VALUE(status);
        }
@@ -415,24 +405,24 @@ int acpi_processor_notify_smm(struct module *calling_module) {
 
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_processor_notify_smm);
 
+EXPORT_SYMBOL(acpi_processor_notify_smm);
 
 #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
 /* /proc/acpi/processor/../performance interface (DEPRECATED) */
 
 static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_processor_perf_fops = {
-       .open           = acpi_processor_perf_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_processor_perf_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *)seq->private;
-       int                     i;
+       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show");
 
@@ -445,42 +435,40 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "state count:             %d\n"
-                       "active state:            P%d\n",
-                       pr->performance->state_count,
-                       pr->performance->state);
+                  "active state:            P%d\n",
+                  pr->performance->state_count, pr->performance->state);
 
        seq_puts(seq, "states:\n");
        for (i = 0; i < pr->performance->state_count; i++)
-               seq_printf(seq, "   %cP%d:                  %d MHz, %d mW, %d uS\n",
-                       (i == pr->performance->state?'*':' '), i,
-                       (u32) pr->performance->states[i].core_frequency,
-                       (u32) pr->performance->states[i].power,
-                       (u32) pr->performance->states[i].transition_latency);
-
-end:
+               seq_printf(seq,
+                          "   %cP%d:                  %d MHz, %d mW, %d uS\n",
+                          (i == pr->performance->state ? '*' : ' '), i,
+                          (u32) pr->performance->states[i].core_frequency,
+                          (u32) pr->performance->states[i].power,
+                          (u32) pr->performance->states[i].transition_latency);
+
+      end:
        return_VALUE(0);
 }
 
 static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_processor_perf_seq_show,
-                                               PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
 static ssize_t
-acpi_processor_write_performance (
-        struct file            *file,
-        const char             __user *buffer,
-        size_t                 count,
-        loff_t                 *data)
+acpi_processor_write_performance(struct file *file,
+                                const char __user * buffer,
+                                size_t count, loff_t * data)
 {
-       int                     result = 0;
-       struct seq_file         *m = (struct seq_file *) file->private_data;
-       struct acpi_processor   *pr = (struct acpi_processor *) m->private;
+       int result = 0;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_processor *pr = (struct acpi_processor *)m->private;
        struct acpi_processor_performance *perf;
-       char                    state_string[12] = {'\0'};
-       unsigned int            new_state = 0;
-       struct cpufreq_policy   policy;
+       char state_string[12] = { '\0' };
+       unsigned int new_state = 0;
+       struct cpufreq_policy policy;
 
        ACPI_FUNCTION_TRACE("acpi_processor_write_performance");
 
@@ -513,12 +501,10 @@ acpi_processor_write_performance (
        return_VALUE(count);
 }
 
-static void
-acpi_cpufreq_add_file (
-       struct acpi_processor *pr)
+static void acpi_cpufreq_add_file(struct acpi_processor *pr)
 {
-       struct proc_dir_entry   *entry = NULL;
-       struct acpi_device      *device = NULL;
+       struct proc_dir_entry *entry = NULL;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
 
@@ -527,11 +513,12 @@ acpi_cpufreq_add_file (
 
        /* add file 'performance' [R/W] */
        entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
-                 S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_PROCESSOR_FILE_PERFORMANCE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_PROCESSOR_FILE_PERFORMANCE));
        else {
                entry->proc_fops = &acpi_processor_perf_fops;
                entry->proc_fops->write = acpi_processor_write_performance;
@@ -541,11 +528,9 @@ acpi_cpufreq_add_file (
        return_VOID;
 }
 
-static void
-acpi_cpufreq_remove_file (
-       struct acpi_processor *pr)
+static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
 {
-       struct acpi_device      *device = NULL;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile");
 
@@ -554,21 +539,25 @@ acpi_cpufreq_remove_file (
 
        /* remove file 'performance' */
        remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
-                 acpi_device_dir(device));
+                         acpi_device_dir(device));
 
        return_VOID;
 }
 
 #else
-static void acpi_cpufreq_add_file (struct acpi_processor *pr) { return; }
-static void acpi_cpufreq_remove_file (struct acpi_processor *pr) { return; }
-#endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
-
+static void acpi_cpufreq_add_file(struct acpi_processor *pr)
+{
+       return;
+}
+static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
+{
+       return;
+}
+#endif                         /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
 
 int
-acpi_processor_register_performance (
-       struct acpi_processor_performance * performance,
-       unsigned int cpu)
+acpi_processor_register_performance(struct acpi_processor_performance
+                                   *performance, unsigned int cpu)
 {
        struct acpi_processor *pr;
 
@@ -603,13 +592,12 @@ acpi_processor_register_performance (
        up(&performance_sem);
        return_VALUE(0);
 }
-EXPORT_SYMBOL(acpi_processor_register_performance);
 
+EXPORT_SYMBOL(acpi_processor_register_performance);
 
 void
-acpi_processor_unregister_performance (
-       struct acpi_processor_performance * performance,
-       unsigned int cpu)
+acpi_processor_unregister_performance(struct acpi_processor_performance
+                                     *performance, unsigned int cpu)
 {
        struct acpi_processor *pr;
 
@@ -632,4 +620,5 @@ acpi_processor_unregister_performance (
 
        return_VOID;
 }
+
 EXPORT_SYMBOL(acpi_processor_unregister_performance);
index 12bd980a12e940ea8f1d38fec8332dc6ab095015..37528c3b64b02baeb0aafbae96f2775495177453 100644 (file)
 #define ACPI_PROCESSOR_CLASS            "processor"
 #define ACPI_PROCESSOR_DRIVER_NAME      "ACPI Processor Driver"
 #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME                ("acpi_processor")
-
+ACPI_MODULE_NAME("acpi_processor")
 
 /* --------------------------------------------------------------------------
                                  Limit Interface
    -------------------------------------------------------------------------- */
-
-static int
-acpi_processor_apply_limit (
-       struct acpi_processor*  pr)
+static int acpi_processor_apply_limit(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       u16                     px = 0;
-       u16                     tx = 0;
+       int result = 0;
+       u16 px = 0;
+       u16 tx = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_apply_limit");
 
@@ -80,19 +76,17 @@ acpi_processor_apply_limit (
        pr->limit.state.px = px;
        pr->limit.state.tx = tx;
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d] limit set to (P%d:T%d)\n",
-               pr->id,
-               pr->limit.state.px,
-               pr->limit.state.tx));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Processor [%d] limit set to (P%d:T%d)\n", pr->id,
+                         pr->limit.state.px, pr->limit.state.tx));
 
-end:
+      end:
        if (result)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n"));
 
        return_VALUE(result);
 }
 
-
 #ifdef CONFIG_CPU_FREQ
 
 /* If a passive cooling situation is detected, primarily CPUfreq is used, as it
@@ -104,7 +98,6 @@ end:
 static unsigned int cpufreq_thermal_reduction_pctg[NR_CPUS];
 static unsigned int acpi_thermal_cpufreq_is_init = 0;
 
-
 static int cpu_has_cpufreq(unsigned int cpu)
 {
        struct cpufreq_policy policy;
@@ -115,7 +108,6 @@ static int cpu_has_cpufreq(unsigned int cpu)
        return 0;
 }
 
-
 static int acpi_thermal_cpufreq_increase(unsigned int cpu)
 {
        if (!cpu_has_cpufreq(cpu))
@@ -130,7 +122,6 @@ static int acpi_thermal_cpufreq_increase(unsigned int cpu)
        return -ERANGE;
 }
 
-
 static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
 {
        if (!cpu_has_cpufreq(cpu))
@@ -145,11 +136,8 @@ static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
        return -ERANGE;
 }
 
-
-static int acpi_thermal_cpufreq_notifier(
-       struct notifier_block *nb,
-       unsigned long event,
-       void *data)
+static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb,
+                                        unsigned long event, void *data)
 {
        struct cpufreq_policy *policy = data;
        unsigned long max_freq = 0;
@@ -157,68 +145,74 @@ static int acpi_thermal_cpufreq_notifier(
        if (event != CPUFREQ_ADJUST)
                goto out;
 
-       max_freq = (policy->cpuinfo.max_freq * (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100;
+       max_freq =
+           (policy->cpuinfo.max_freq *
+            (100 - cpufreq_thermal_reduction_pctg[policy->cpu])) / 100;
 
        cpufreq_verify_within_limits(policy, 0, max_freq);
 
- out:
     out:
        return 0;
 }
 
-
 static struct notifier_block acpi_thermal_cpufreq_notifier_block = {
        .notifier_call = acpi_thermal_cpufreq_notifier,
 };
 
-
-void acpi_thermal_cpufreq_init(void) {
+void acpi_thermal_cpufreq_init(void)
+{
        int i;
 
-       for (i=0; i<NR_CPUS; i++)
+       for (i = 0; i < NR_CPUS; i++)
                cpufreq_thermal_reduction_pctg[i] = 0;
 
-       i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, CPUFREQ_POLICY_NOTIFIER);
+       i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block,
+                                     CPUFREQ_POLICY_NOTIFIER);
        if (!i)
                acpi_thermal_cpufreq_is_init = 1;
 }
 
-void acpi_thermal_cpufreq_exit(void) {
+void acpi_thermal_cpufreq_exit(void)
+{
        if (acpi_thermal_cpufreq_is_init)
-               cpufreq_unregister_notifier(&acpi_thermal_cpufreq_notifier_block, CPUFREQ_POLICY_NOTIFIER);
+               cpufreq_unregister_notifier
+                   (&acpi_thermal_cpufreq_notifier_block,
+                    CPUFREQ_POLICY_NOTIFIER);
 
        acpi_thermal_cpufreq_is_init = 0;
 }
 
-#else /* ! CONFIG_CPU_FREQ */
-
-static int acpi_thermal_cpufreq_increase(unsigned int cpu) { return -ENODEV; }
-static int acpi_thermal_cpufreq_decrease(unsigned int cpu) { return -ENODEV; }
+#else                          /* ! CONFIG_CPU_FREQ */
 
+static int acpi_thermal_cpufreq_increase(unsigned int cpu)
+{
+       return -ENODEV;
+}
+static int acpi_thermal_cpufreq_decrease(unsigned int cpu)
+{
+       return -ENODEV;
+}
 
 #endif
 
-
-int
-acpi_processor_set_thermal_limit (
-       acpi_handle             handle,
-       int                     type)
+int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
 {
-       int                     result = 0;
-       struct acpi_processor   *pr = NULL;
-       struct acpi_device      *device = NULL;
-       int                     tx = 0;
+       int result = 0;
+       struct acpi_processor *pr = NULL;
+       struct acpi_device *device = NULL;
+       int tx = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit");
 
        if ((type < ACPI_PROCESSOR_LIMIT_NONE)
-               || (type > ACPI_PROCESSOR_LIMIT_DECREMENT))
+           || (type > ACPI_PROCESSOR_LIMIT_DECREMENT))
                return_VALUE(-EINVAL);
 
        result = acpi_bus_get_device(handle, &device);
        if (result)
                return_VALUE(result);
 
-       pr = (struct acpi_processor *) acpi_driver_data(device);
+       pr = (struct acpi_processor *)acpi_driver_data(device);
        if (!pr)
                return_VALUE(-ENODEV);
 
@@ -250,12 +244,12 @@ acpi_processor_set_thermal_limit (
                        goto end;
                else if (result == -ERANGE)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "At maximum performance state\n"));
+                                         "At maximum performance state\n"));
 
                if (pr->flags.throttling) {
                        if (tx == (pr->throttling.state_count - 1))
                                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "At maximum throttling state\n"));
+                                                 "At maximum throttling state\n"));
                        else
                                tx++;
                }
@@ -267,7 +261,7 @@ acpi_processor_set_thermal_limit (
                if (pr->flags.throttling) {
                        if (tx == 0)
                                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "At minimum throttling state\n"));
+                                                 "At minimum throttling state\n"));
                        else {
                                tx--;
                                goto end;
@@ -277,12 +271,12 @@ acpi_processor_set_thermal_limit (
                result = acpi_thermal_cpufreq_decrease(pr->id);
                if (result == -ERANGE)
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "At minimum performance state\n"));
+                                         "At minimum performance state\n"));
 
                break;
        }
 
-end:
+      end:
        if (pr->flags.throttling) {
                pr->limit.thermal.px = 0;
                pr->limit.thermal.tx = tx;
@@ -293,18 +287,14 @@ end:
                                          "Unable to set thermal limit\n"));
 
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n",
-                                 pr->limit.thermal.px,
-                                 pr->limit.thermal.tx));
+                                 pr->limit.thermal.px, pr->limit.thermal.tx));
        } else
                result = 0;
 
        return_VALUE(result);
 }
 
-
-int
-acpi_processor_get_limit_info (
-       struct acpi_processor   *pr)
+int acpi_processor_get_limit_info(struct acpi_processor *pr)
 {
        ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info");
 
@@ -317,12 +307,11 @@ acpi_processor_get_limit_info (
        return_VALUE(0);
 }
 
-
 /* /proc interface */
 
 static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *)seq->private;
+       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show");
 
@@ -335,34 +324,32 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "active limit:            P%d:T%d\n"
-                       "user limit:              P%d:T%d\n"
-                       "thermal limit:           P%d:T%d\n",
-                       pr->limit.state.px, pr->limit.state.tx,
-                       pr->limit.user.px, pr->limit.user.tx,
-                       pr->limit.thermal.px, pr->limit.thermal.tx);
+                  "user limit:              P%d:T%d\n"
+                  "thermal limit:           P%d:T%d\n",
+                  pr->limit.state.px, pr->limit.state.tx,
+                  pr->limit.user.px, pr->limit.user.tx,
+                  pr->limit.thermal.px, pr->limit.thermal.tx);
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_processor_limit_seq_show,
-                                               PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
-ssize_t acpi_processor_write_limit (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data)
+ssize_t acpi_processor_write_limit(struct file * file,
+                                  const char __user * buffer,
+                                  size_t count, loff_t * data)
 {
-       int                     result = 0;
-        struct seq_file        *m = (struct seq_file *)file->private_data;
-       struct acpi_processor   *pr = (struct acpi_processor *)m->private;
-       char                    limit_string[25] = {'\0'};
-       int                     px = 0;
-       int                     tx = 0;
+       int result = 0;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_processor *pr = (struct acpi_processor *)m->private;
+       char limit_string[25] = { '\0' };
+       int px = 0;
+       int tx = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_write_limit");
 
@@ -396,11 +383,9 @@ ssize_t acpi_processor_write_limit (
        return_VALUE(count);
 }
 
-
 struct file_operations acpi_processor_limit_fops = {
-       .open           = acpi_processor_limit_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_processor_limit_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
-
index be9f569d39d33f73784e507322cffbed40c3e114..74a52d4e79ae936d8ee30aa19ae6e23279e45c4b 100644 (file)
 #define ACPI_PROCESSOR_CLASS            "processor"
 #define ACPI_PROCESSOR_DRIVER_NAME      "ACPI Processor Driver"
 #define _COMPONENT              ACPI_PROCESSOR_COMPONENT
-ACPI_MODULE_NAME                ("acpi_processor")
-
+ACPI_MODULE_NAME("acpi_processor")
 
 /* --------------------------------------------------------------------------
                               Throttling Control
    -------------------------------------------------------------------------- */
-
-static int
-acpi_processor_get_throttling (
-       struct acpi_processor   *pr)
+static int acpi_processor_get_throttling(struct acpi_processor *pr)
 {
-       int                     state = 0;
-       u32                     value = 0;
-       u32                     duty_mask = 0;
-       u32                     duty_value = 0;
+       int state = 0;
+       u32 value = 0;
+       u32 duty_mask = 0;
+       u32 duty_value = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_throttling");
 
@@ -86,7 +82,7 @@ acpi_processor_get_throttling (
                duty_value >>= pr->throttling.duty_offset;
 
                if (duty_value)
-                       state = pr->throttling.state_count-duty_value;
+                       state = pr->throttling.state_count - duty_value;
        }
 
        pr->throttling.state = state;
@@ -94,20 +90,17 @@ acpi_processor_get_throttling (
        local_irq_enable();
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "Throttling state is T%d (%d%% throttling applied)\n",
-               state, pr->throttling.states[state].performance));
+                         "Throttling state is T%d (%d%% throttling applied)\n",
+                         state, pr->throttling.states[state].performance));
 
        return_VALUE(0);
 }
 
-
-int acpi_processor_set_throttling (
-       struct acpi_processor   *pr,
-       int                     state)
+int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
 {
-       u32                     value = 0;
-       u32                     duty_mask = 0;
-       u32                     duty_value = 0;
+       u32 value = 0;
+       u32 duty_mask = 0;
+       u32 duty_value = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_set_throttling");
 
@@ -168,28 +161,26 @@ int acpi_processor_set_throttling (
        local_irq_enable();
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "Throttling state set to T%d (%d%%)\n", state,
-               (pr->throttling.states[state].performance?pr->throttling.states[state].performance/10:0)));
+                         "Throttling state set to T%d (%d%%)\n", state,
+                         (pr->throttling.states[state].performance ? pr->
+                          throttling.states[state].performance / 10 : 0)));
 
        return_VALUE(0);
 }
 
-
-int
-acpi_processor_get_throttling_info (
-       struct acpi_processor   *pr)
+int acpi_processor_get_throttling_info(struct acpi_processor *pr)
 {
-       int                     result = 0;
-       int                     step = 0;
-       int                     i = 0;
+       int result = 0;
+       int step = 0;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info");
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-               "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
-               pr->throttling.address,
-               pr->throttling.duty_offset,
-               pr->throttling.duty_width));
+                         "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
+                         pr->throttling.address,
+                         pr->throttling.duty_offset,
+                         pr->throttling.duty_width));
 
        if (!pr)
                return_VALUE(-EINVAL);
@@ -199,14 +190,12 @@ acpi_processor_get_throttling_info (
        if (!pr->throttling.address) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n"));
                return_VALUE(0);
-       }
-       else if (!pr->throttling.duty_width) {
+       } else if (!pr->throttling.duty_width) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n"));
                return_VALUE(0);
        }
        /* TBD: Support duty_cycle values that span bit 4. */
-       else if ((pr->throttling.duty_offset
-               + pr->throttling.duty_width) > 4) {
+       else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n"));
                return_VALUE(0);
        }
@@ -218,7 +207,7 @@ acpi_processor_get_throttling_info (
         */
        if (errata.piix4.throttle) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Throttling not supported on PIIX4 A- or B-step\n"));
+                                 "Throttling not supported on PIIX4 A- or B-step\n"));
                return_VALUE(0);
        }
 
@@ -232,13 +221,13 @@ acpi_processor_get_throttling_info (
 
        step = (1000 / pr->throttling.state_count);
 
-       for (i=0; i<pr->throttling.state_count; i++) {
+       for (i = 0; i < pr->throttling.state_count; i++) {
                pr->throttling.states[i].performance = step * i;
                pr->throttling.states[i].power = step * i;
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n",
-               pr->throttling.state_count));
+                         pr->throttling.state_count));
 
        pr->flags.throttling = 1;
 
@@ -253,28 +242,29 @@ acpi_processor_get_throttling_info (
                goto end;
 
        if (pr->throttling.state) {
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabling throttling (was T%d)\n",
-                       pr->throttling.state));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Disabling throttling (was T%d)\n",
+                                 pr->throttling.state));
                result = acpi_processor_set_throttling(pr, 0);
                if (result)
                        goto end;
        }
 
-end:
+      end:
        if (result)
                pr->flags.throttling = 0;
 
        return_VALUE(result);
 }
 
-
 /* proc interface */
 
-static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset)
+static int acpi_processor_throttling_seq_show(struct seq_file *seq,
+                                             void *offset)
 {
-       struct acpi_processor   *pr = (struct acpi_processor *)seq->private;
-       int                     i = 0;
-       int                     result = 0;
+       struct acpi_processor *pr = (struct acpi_processor *)seq->private;
+       int i = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show");
 
@@ -289,41 +279,41 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset
        result = acpi_processor_get_throttling(pr);
 
        if (result) {
-               seq_puts(seq, "Could not determine current throttling state.\n");
+               seq_puts(seq,
+                        "Could not determine current throttling state.\n");
                goto end;
        }
 
        seq_printf(seq, "state count:             %d\n"
-                       "active state:            T%d\n",
-                       pr->throttling.state_count,
-                       pr->throttling.state);
+                  "active state:            T%d\n",
+                  pr->throttling.state_count, pr->throttling.state);
 
        seq_puts(seq, "states:\n");
        for (i = 0; i < pr->throttling.state_count; i++)
                seq_printf(seq, "   %cT%d:                  %02d%%\n",
-                       (i == pr->throttling.state?'*':' '), i,
-                       (pr->throttling.states[i].performance?pr->throttling.states[i].performance/10:0));
+                          (i == pr->throttling.state ? '*' : ' '), i,
+                          (pr->throttling.states[i].performance ? pr->
+                           throttling.states[i].performance / 10 : 0));
 
-end:
+      end:
        return_VALUE(0);
 }
 
-static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file)
+static int acpi_processor_throttling_open_fs(struct inode *inode,
+                                            struct file *file)
 {
        return single_open(file, acpi_processor_throttling_seq_show,
-                                               PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
-ssize_t acpi_processor_write_throttling (
-        struct file            *file,
-        const char             __user *buffer,
-        size_t                 count,
-        loff_t                 *data)
+ssize_t acpi_processor_write_throttling(struct file * file,
+                                       const char __user * buffer,
+                                       size_t count, loff_t * data)
 {
-       int                     result = 0;
-        struct seq_file        *m = (struct seq_file *)file->private_data;
-       struct acpi_processor   *pr = (struct acpi_processor *)m->private;
-       char                    state_string[12] = {'\0'};
+       int result = 0;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_processor *pr = (struct acpi_processor *)m->private;
+       char state_string[12] = { '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_processor_write_throttling");
 
@@ -336,7 +326,8 @@ ssize_t acpi_processor_write_throttling (
        state_string[count] = '\0';
 
        result = acpi_processor_set_throttling(pr,
-               simple_strtoul(state_string, NULL, 0));
+                                              simple_strtoul(state_string,
+                                                             NULL, 0));
        if (result)
                return_VALUE(result);
 
@@ -344,8 +335,8 @@ ssize_t acpi_processor_write_throttling (
 }
 
 struct file_operations acpi_processor_throttling_fops = {
-       .open           = acpi_processor_throttling_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_processor_throttling_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
index 55d264771c4805ac9e2b2da2acc18789f47ed04c..23b54baa0cb2ebd6e451fff26967ba79b2b00eba 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsaddr")
+ACPI_MODULE_NAME("rsaddr")
+
+/* Local prototypes */
+static void
+acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags);
+
+static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource);
+
+static void
+acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags);
+
+static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource);
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_rs_decode_general_flags
+ *
+ * PARAMETERS:  Resource            - Address resource data struct
+ *              Flags               - Actual flag byte
+ *
+ * RETURN:      Decoded flag bits in resource struct
+ *
+ * DESCRIPTION: Decode a general flag byte to an address resource struct
+ *
+ ******************************************************************************/
+
+static void
+acpi_rs_decode_general_flags(union acpi_resource_data *resource, u8 flags)
+{
+       ACPI_FUNCTION_ENTRY();
+
+       /* Producer / Consumer - flag bit[0] */
+
+       resource->address.producer_consumer = (u32) (flags & 0x01);
+
+       /* Decode (_DEC) - flag bit[1] */
 
+       resource->address.decode = (u32) ((flags >> 1) & 0x01);
+
+       /* Min Address Fixed (_MIF) - flag bit[2] */
+
+       resource->address.min_address_fixed = (u32) ((flags >> 2) & 0x01);
+
+       /* Max Address Fixed (_MAF) - flag bit[3] */
+
+       resource->address.max_address_fixed = (u32) ((flags >> 3) & 0x01);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_rs_encode_general_flags
+ *
+ * PARAMETERS:  Resource            - Address resource data struct
+ *
+ * RETURN:      Encoded general flag byte
+ *
+ * DESCRIPTION: Construct a general flag byte from an address resource struct
+ *
+ ******************************************************************************/
+
+static u8 acpi_rs_encode_general_flags(union acpi_resource_data *resource)
+{
+       u8 flags;
+
+       ACPI_FUNCTION_ENTRY();
+
+       /* Producer / Consumer - flag bit[0] */
+
+       flags = (u8) (resource->address.producer_consumer & 0x01);
+
+       /* Decode (_DEC) - flag bit[1] */
+
+       flags |= (u8) ((resource->address.decode & 0x01) << 1);
+
+       /* Min Address Fixed (_MIF) - flag bit[2] */
+
+       flags |= (u8) ((resource->address.min_address_fixed & 0x01) << 2);
+
+       /* Max Address Fixed (_MAF) - flag bit[3] */
+
+       flags |= (u8) ((resource->address.max_address_fixed & 0x01) << 3);
+
+       return (flags);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_rs_decode_specific_flags
+ *
+ * PARAMETERS:  Resource            - Address resource data struct
+ *              Flags               - Actual flag byte
+ *
+ * RETURN:      Decoded flag bits in attribute struct
+ *
+ * DESCRIPTION: Decode a type-specific flag byte to an attribute struct.
+ *              Type-specific flags are only defined for the Memory and IO
+ *              resource types.
+ *
+ ******************************************************************************/
+
+static void
+acpi_rs_decode_specific_flags(union acpi_resource_data *resource, u8 flags)
+{
+       ACPI_FUNCTION_ENTRY();
+
+       if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
+               /* Write Status (_RW) - flag bit[0] */
+
+               resource->address.attribute.memory.read_write_attribute =
+                   (u16) (flags & 0x01);
+
+               /* Memory Attributes (_MEM) - flag bits[2:1] */
+
+               resource->address.attribute.memory.cache_attribute =
+                   (u16) ((flags >> 1) & 0x03);
+       } else if (resource->address.resource_type == ACPI_IO_RANGE) {
+               /* Ranges (_RNG) - flag bits[1:0] */
+
+               resource->address.attribute.io.range_attribute =
+                   (u16) (flags & 0x03);
+
+               /* Translations (_TTP and _TRS) - flag bits[5:4] */
+
+               resource->address.attribute.io.translation_attribute =
+                   (u16) ((flags >> 4) & 0x03);
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_rs_encode_specific_flags
+ *
+ * PARAMETERS:  Resource            - Address resource data struct
+ *
+ * RETURN:      Encoded type-specific flag byte
+ *
+ * DESCRIPTION: Construct a type-specific flag byte from an attribute struct.
+ *              Type-specific flags are only defined for the Memory and IO
+ *              resource types.
+ *
+ ******************************************************************************/
+
+static u8 acpi_rs_encode_specific_flags(union acpi_resource_data *resource)
+{
+       u8 flags = 0;
+
+       ACPI_FUNCTION_ENTRY();
+
+       if (resource->address.resource_type == ACPI_MEMORY_RANGE) {
+               /* Write Status (_RW) - flag bit[0] */
+
+               flags = (u8)
+                   (resource->address.attribute.memory.
+                    read_write_attribute & 0x01);
+
+               /* Memory Attributes (_MEM) - flag bits[2:1] */
+
+               flags |= (u8)
+                   ((resource->address.attribute.memory.
+                     cache_attribute & 0x03) << 1);
+       } else if (resource->address.resource_type == ACPI_IO_RANGE) {
+               /* Ranges (_RNG) - flag bits[1:0] */
+
+               flags = (u8)
+                   (resource->address.attribute.io.range_attribute & 0x03);
+
+               /* Translations (_TTP and _TRS) - flag bits[5:4] */
+
+               flags |= (u8)
+                   ((resource->address.attribute.io.
+                     translation_attribute & 0x03) << 4);
+       }
+
+       return (flags);
+}
 
 /*******************************************************************************
  *
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address16_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_address16_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size)
 {
-       u32                             index;
-       u16                             temp16;
-       u8                              temp8;
-       u8                              *temp_ptr;
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_address16);
-
+       u32 index;
+       u16 temp16;
+       u8 temp8;
+       u8 *temp_ptr;
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16);
 
-       ACPI_FUNCTION_TRACE ("rs_address16_resource");
+       ACPI_FUNCTION_TRACE("rs_address16_resource");
 
-
-       /* Point past the Descriptor to get the number of bytes consumed */
+       /* Get the Descriptor Length field */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        /* Validate minimum descriptor length */
 
        if (temp16 < 13) {
-               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
        }
 
        *bytes_consumed = temp16 + 3;
@@ -112,7 +280,7 @@ acpi_rs_address16_resource (
        /* Values 0-2 and 0xC0-0xFF are valid */
 
        if ((temp8 > 2) && (temp8 < 0xC0)) {
-               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address16.resource_type = temp8;
@@ -120,73 +288,41 @@ acpi_rs_address16_resource (
        /* Get the General Flags (Byte4) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       /* Producer / Consumer */
-
-       output_struct->data.address16.producer_consumer = temp8 & 0x01;
-
-       /* Decode */
-
-       output_struct->data.address16.decode = (temp8 >> 1) & 0x01;
-
-       /* Min Address Fixed */
-
-       output_struct->data.address16.min_address_fixed = (temp8 >> 2) & 0x01;
-
-       /* Max Address Fixed */
-
-       output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
+       acpi_rs_decode_general_flags(&output_struct->data, *buffer);
 
        /* Get the Type Specific Flags (Byte5) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) {
-               output_struct->data.address16.attribute.memory.read_write_attribute =
-                               (u16) (temp8 & 0x01);
-               output_struct->data.address16.attribute.memory.cache_attribute =
-                               (u16) ((temp8 >> 1) & 0x03);
-       }
-       else {
-               if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) {
-                       output_struct->data.address16.attribute.io.range_attribute =
-                               (u16) (temp8 & 0x03);
-                       output_struct->data.address16.attribute.io.translation_attribute =
-                               (u16) ((temp8 >> 4) & 0x03);
-               }
-               else {
-                       /* BUS_NUMBER_RANGE == Address16.Data->resource_type */
-                       /* Nothing needs to be filled in */
-               }
-       }
+       acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
 
        /* Get Granularity (Bytes 6-7) */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
+       ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer);
 
        /* Get min_address_range (Bytes 8-9) */
 
        buffer += 2;
-       ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
+       ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range,
+                          buffer);
 
        /* Get max_address_range (Bytes 10-11) */
 
        buffer += 2;
-       ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
+       ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range,
+                          buffer);
 
        /* Get address_translation_offset (Bytes 12-13) */
 
        buffer += 2;
-       ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset,
-               buffer);
+       ACPI_MOVE_16_TO_32(&output_struct->data.address16.
+                          address_translation_offset, buffer);
 
        /* Get address_length (Bytes 14-15) */
 
        buffer += 2;
-       ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
+       ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length,
+                          buffer);
 
        /* Resource Source Index (if present) */
 
@@ -205,8 +341,8 @@ acpi_rs_address16_resource (
        if (*bytes_consumed > (16 + 1)) {
                /* Dereference the Index */
 
-               temp8 = *buffer;
-               output_struct->data.address16.resource_source.index = (u32) temp8;
+               output_struct->data.address16.resource_source.index =
+                   (u32) * buffer;
 
                /* Point to the String */
 
@@ -215,28 +351,27 @@ acpi_rs_address16_resource (
                /* Point the String pointer to the end of this structure */
 
                output_struct->data.address16.resource_source.string_ptr =
-                               (char *)((u8 * )output_struct + struct_size);
+                   (char *)((u8 *) output_struct + struct_size);
 
                temp_ptr = (u8 *)
-                       output_struct->data.address16.resource_source.string_ptr;
+                   output_struct->data.address16.resource_source.string_ptr;
 
-               /* Copy the string into the buffer */
+               /* Copy the resource_source string into the buffer */
 
                index = 0;
-
-               while (0x00 != *buffer) {
+               while (*buffer) {
                        *temp_ptr = *buffer;
 
-                       temp_ptr += 1;
-                       buffer += 1;
-                       index += 1;
+                       temp_ptr++;
+                       buffer++;
+                       index++;
                }
 
-               /* Add the terminating null */
-
-               *temp_ptr = 0x00;
+               /* Add the terminating null and set the string length */
 
-               output_struct->data.address16.resource_source.string_length = index + 1;
+               *temp_ptr = 0;
+               output_struct->data.address16.resource_source.string_length =
+                   index + 1;
 
                /*
                 * In order for the struct_size to fall on a 32-bit boundary,
@@ -244,10 +379,9 @@ acpi_rs_address16_resource (
                 * struct_size to the next 32-bit boundary.
                 */
                temp8 = (u8) (index + 1);
-               struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
-       }
-       else {
-               output_struct->data.address16.resource_source.index = 0x00;
+               struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
+       } else {
+               output_struct->data.address16.resource_source.index = 0;
                output_struct->data.address16.resource_source.string_length = 0;
                output_struct->data.address16.resource_source.string_ptr = NULL;
        }
@@ -259,10 +393,9 @@ acpi_rs_address16_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_address16_stream
@@ -280,24 +413,18 @@ acpi_rs_address16_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address16_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_address16_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u8                              *length_field;
-       u8                              temp8;
-       char                            *temp_pointer = NULL;
-       acpi_size                       actual_bytes;
-
-
-       ACPI_FUNCTION_TRACE ("rs_address16_stream");
+       u8 *buffer = *output_buffer;
+       u8 *length_field;
+       acpi_size actual_bytes;
 
+       ACPI_FUNCTION_TRACE("rs_address16_stream");
 
-       /* The descriptor field is static */
+       /* Set the Descriptor Type field */
 
-       *buffer = 0x88;
+       *buffer = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
        buffer += 1;
 
        /* Save a pointer to the Length field - to be filled in later */
@@ -307,98 +434,74 @@ acpi_rs_address16_stream (
 
        /* Set the Resource Type (Memory, Io, bus_number) */
 
-       temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
-       *buffer = temp8;
+       *buffer = (u8) (linked_list->data.address16.resource_type & 0x03);
        buffer += 1;
 
        /* Set the general flags */
 
-       temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01);
-
-       temp8 |= (linked_list->data.address16.decode & 0x01) << 1;
-       temp8 |= (linked_list->data.address16.min_address_fixed & 0x01) << 2;
-       temp8 |= (linked_list->data.address16.max_address_fixed & 0x01) << 3;
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_general_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the type specific flags */
 
-       temp8 = 0;
-
-       if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address16.attribute.memory.read_write_attribute &
-                        0x01);
-
-               temp8 |=
-                       (linked_list->data.address16.attribute.memory.cache_attribute &
-                        0x03) << 1;
-       }
-       else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address16.attribute.io.range_attribute &
-                        0x03);
-               temp8 |=
-                       (linked_list->data.address16.attribute.io.translation_attribute &
-                        0x03) << 4;
-       }
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the address space granularity */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
+       ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity);
        buffer += 2;
 
        /* Set the address range minimum */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
+       ACPI_MOVE_32_TO_16(buffer,
+                          &linked_list->data.address16.min_address_range);
        buffer += 2;
 
        /* Set the address range maximum */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
+       ACPI_MOVE_32_TO_16(buffer,
+                          &linked_list->data.address16.max_address_range);
        buffer += 2;
 
        /* Set the address translation offset */
 
-       ACPI_MOVE_32_TO_16 (buffer,
-               &linked_list->data.address16.address_translation_offset);
+       ACPI_MOVE_32_TO_16(buffer,
+                          &linked_list->data.address16.
+                          address_translation_offset);
        buffer += 2;
 
        /* Set the address length */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
+       ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length);
        buffer += 2;
 
        /* Resource Source Index and Resource Source are optional */
 
-       if (0 != linked_list->data.address16.resource_source.string_length) {
-               temp8 = (u8) linked_list->data.address16.resource_source.index;
-
-               *buffer = temp8;
+       if (linked_list->data.address16.resource_source.string_length) {
+               *buffer =
+                   (u8) linked_list->data.address16.resource_source.index;
                buffer += 1;
 
-               temp_pointer = (char *) buffer;
-
-               /* Copy the string */
+               /* Copy the resource_source string */
 
-               ACPI_STRCPY (temp_pointer,
-                               linked_list->data.address16.resource_source.string_ptr);
+               ACPI_STRCPY((char *)buffer,
+                           linked_list->data.address16.resource_source.
+                           string_ptr);
 
                /*
-                * Buffer needs to be set to the length of the sting + one for the
+                * Buffer needs to be set to the length of the string + one for the
                 * terminating null
                 */
-               buffer += (acpi_size)(ACPI_STRLEN (
-                                linked_list->data.address16.resource_source.string_ptr) + 1);
+               buffer +=
+                   (acpi_size) (ACPI_STRLEN
+                                (linked_list->data.address16.resource_source.
+                                 string_ptr) + 1);
        }
 
        /* Return the number of bytes consumed in this operation */
 
-       actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
+       actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer);
        *bytes_consumed = actual_bytes;
 
        /*
@@ -406,11 +509,10 @@ acpi_rs_address16_stream (
         * minus the header size (3 bytes)
         */
        actual_bytes -= 3;
-       ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes);
-       return_ACPI_STATUS (AE_OK);
+       ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_address32_resource
@@ -433,36 +535,30 @@ acpi_rs_address16_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address32_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_address32_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer;
-       struct acpi_resource            *output_struct= (void *) *output_buffer;
-       u16                             temp16;
-       u8                              temp8;
-       u8                              *temp_ptr;
-       acpi_size                       struct_size;
-       u32                             index;
-
-
-       ACPI_FUNCTION_TRACE ("rs_address32_resource");
+       u16 temp16;
+       u8 temp8;
+       u8 *temp_ptr;
+       u32 index;
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32);
 
+       ACPI_FUNCTION_TRACE("rs_address32_resource");
 
-       buffer = byte_stream_buffer;
-       struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
-
-       /* Point past the Descriptor to get the number of bytes consumed */
+       /* Get the Descriptor Length field */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        /* Validate minimum descriptor length */
 
        if (temp16 < 23) {
-               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
        }
 
        *bytes_consumed = temp16 + 3;
@@ -476,7 +572,7 @@ acpi_rs_address32_resource (
        /* Values 0-2 and 0xC0-0xFF are valid */
 
        if ((temp8 > 2) && (temp8 < 0xC0)) {
-               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address32.resource_type = temp8;
@@ -484,74 +580,41 @@ acpi_rs_address32_resource (
        /* Get the General Flags (Byte4) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       /* Producer / Consumer */
-
-       output_struct->data.address32.producer_consumer = temp8 & 0x01;
-
-       /* Decode */
-
-       output_struct->data.address32.decode = (temp8 >> 1) & 0x01;
-
-       /* Min Address Fixed */
-
-       output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01;
-
-       /* Max Address Fixed */
-
-       output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01;
+       acpi_rs_decode_general_flags(&output_struct->data, *buffer);
 
        /* Get the Type Specific Flags (Byte5) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) {
-               output_struct->data.address32.attribute.memory.read_write_attribute =
-                               (u16) (temp8 & 0x01);
-
-               output_struct->data.address32.attribute.memory.cache_attribute =
-                               (u16) ((temp8 >> 1) & 0x03);
-       }
-       else {
-               if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) {
-                       output_struct->data.address32.attribute.io.range_attribute =
-                               (u16) (temp8 & 0x03);
-                       output_struct->data.address32.attribute.io.translation_attribute =
-                               (u16) ((temp8 >> 4) & 0x03);
-               }
-               else {
-                       /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */
-                       /* Nothing needs to be filled in */
-               }
-       }
+       acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
 
        /* Get Granularity (Bytes 6-9) */
 
        buffer += 1;
-       ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer);
 
        /* Get min_address_range (Bytes 10-13) */
 
        buffer += 4;
-       ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range,
+                          buffer);
 
        /* Get max_address_range (Bytes 14-17) */
 
        buffer += 4;
-       ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range,
+                          buffer);
 
        /* Get address_translation_offset (Bytes 18-21) */
 
        buffer += 4;
-       ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset,
-               buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.address32.
+                          address_translation_offset, buffer);
 
        /* Get address_length (Bytes 22-25) */
 
        buffer += 4;
-       ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length,
+                          buffer);
 
        /* Resource Source Index (if present) */
 
@@ -568,9 +631,8 @@ acpi_rs_address32_resource (
        if (*bytes_consumed > (26 + 1)) {
                /* Dereference the Index */
 
-               temp8 = *buffer;
                output_struct->data.address32.resource_source.index =
-                               (u32) temp8;
+                   (u32) * buffer;
 
                /* Point to the String */
 
@@ -579,26 +641,27 @@ acpi_rs_address32_resource (
                /* Point the String pointer to the end of this structure */
 
                output_struct->data.address32.resource_source.string_ptr =
-                               (char *)((u8 *)output_struct + struct_size);
+                   (char *)((u8 *) output_struct + struct_size);
 
                temp_ptr = (u8 *)
-                       output_struct->data.address32.resource_source.string_ptr;
+                   output_struct->data.address32.resource_source.string_ptr;
 
-               /* Copy the string into the buffer */
+               /* Copy the resource_source string into the buffer */
 
                index = 0;
-               while (0x00 != *buffer) {
+               while (*buffer) {
                        *temp_ptr = *buffer;
 
-                       temp_ptr += 1;
-                       buffer += 1;
-                       index += 1;
+                       temp_ptr++;
+                       buffer++;
+                       index++;
                }
 
-               /* Add the terminating null */
+               /* Add the terminating null and set the string length */
 
-               *temp_ptr = 0x00;
-               output_struct->data.address32.resource_source.string_length = index + 1;
+               *temp_ptr = 0;
+               output_struct->data.address32.resource_source.string_length =
+                   index + 1;
 
                /*
                 * In order for the struct_size to fall on a 32-bit boundary,
@@ -606,10 +669,9 @@ acpi_rs_address32_resource (
                 * struct_size to the next 32-bit boundary.
                 */
                temp8 = (u8) (index + 1);
-               struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
-       }
-       else {
-               output_struct->data.address32.resource_source.index = 0x00;
+               struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
+       } else {
+               output_struct->data.address32.resource_source.index = 0;
                output_struct->data.address32.resource_source.string_length = 0;
                output_struct->data.address32.resource_source.string_ptr = NULL;
        }
@@ -621,10 +683,9 @@ acpi_rs_address32_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_address32_stream
@@ -642,136 +703,105 @@ acpi_rs_address32_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address32_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_address32_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer;
-       u16                             *length_field;
-       u8                              temp8;
-       char                            *temp_pointer;
-
-
-       ACPI_FUNCTION_TRACE ("rs_address32_stream");
+       u8 *buffer;
+       u16 *length_field;
 
+       ACPI_FUNCTION_TRACE("rs_address32_stream");
 
        buffer = *output_buffer;
 
-       /* The descriptor field is static */
+       /* Set the Descriptor Type field */
 
-       *buffer = 0x87;
+       *buffer = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
        buffer += 1;
 
-       /* Set a pointer to the Length field - to be filled in later */
+       /* Save a pointer to the Length field - to be filled in later */
 
-       length_field = ACPI_CAST_PTR (u16, buffer);
+       length_field = ACPI_CAST_PTR(u16, buffer);
        buffer += 2;
 
        /* Set the Resource Type (Memory, Io, bus_number) */
 
-       temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
-
-       *buffer = temp8;
+       *buffer = (u8) (linked_list->data.address32.resource_type & 0x03);
        buffer += 1;
 
        /* Set the general flags */
 
-       temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
-       temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
-       temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
-       temp8 |= (linked_list->data.address32.max_address_fixed & 0x01) << 3;
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_general_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the type specific flags */
 
-       temp8 = 0;
-
-       if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address32.attribute.memory.read_write_attribute &
-                       0x01);
-
-               temp8 |=
-                       (linked_list->data.address32.attribute.memory.cache_attribute &
-                        0x03) << 1;
-       }
-       else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address32.attribute.io.range_attribute &
-                        0x03);
-               temp8 |=
-                       (linked_list->data.address32.attribute.io.translation_attribute &
-                        0x03) << 4;
-       }
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the address space granularity */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
+       ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity);
        buffer += 4;
 
        /* Set the address range minimum */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.address32.min_address_range);
        buffer += 4;
 
        /* Set the address range maximum */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.address32.max_address_range);
        buffer += 4;
 
        /* Set the address translation offset */
 
-       ACPI_MOVE_32_TO_32 (buffer,
-               &linked_list->data.address32.address_translation_offset);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.address32.
+                          address_translation_offset);
        buffer += 4;
 
        /* Set the address length */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
+       ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length);
        buffer += 4;
 
        /* Resource Source Index and Resource Source are optional */
 
-       if (0 != linked_list->data.address32.resource_source.string_length) {
-               temp8 = (u8) linked_list->data.address32.resource_source.index;
-
-               *buffer = temp8;
+       if (linked_list->data.address32.resource_source.string_length) {
+               *buffer =
+                   (u8) linked_list->data.address32.resource_source.index;
                buffer += 1;
 
-               temp_pointer = (char *) buffer;
-
-               /* Copy the string */
+               /* Copy the resource_source string */
 
-               ACPI_STRCPY (temp_pointer,
-                       linked_list->data.address32.resource_source.string_ptr);
+               ACPI_STRCPY((char *)buffer,
+                           linked_list->data.address32.resource_source.
+                           string_ptr);
 
                /*
-                * Buffer needs to be set to the length of the sting + one for the
+                * Buffer needs to be set to the length of the string + one for the
                 *  terminating null
                 */
-               buffer += (acpi_size)(ACPI_STRLEN (
-                                linked_list->data.address32.resource_source.string_ptr) + 1);
+               buffer +=
+                   (acpi_size) (ACPI_STRLEN
+                                (linked_list->data.address32.resource_source.
+                                 string_ptr) + 1);
        }
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
 
        /*
         * Set the length field to the number of bytes consumed
-        *  minus the header size (3 bytes)
+        * minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_address64_resource
@@ -794,38 +824,35 @@ acpi_rs_address32_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address64_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_address64_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16;
-       u8                              temp8;
-       u8                              resource_type;
-       u8                              *temp_ptr;
-       acpi_size                       struct_size;
-       u32                             index;
-
+       u16 temp16;
+       u8 temp8;
+       u8 resource_type;
+       u8 *temp_ptr;
+       u32 index;
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64);
 
-       ACPI_FUNCTION_TRACE ("rs_address64_resource");
+       ACPI_FUNCTION_TRACE("rs_address64_resource");
 
+       /* Get the Descriptor Type */
 
-       buffer = byte_stream_buffer;
-       struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
        resource_type = *buffer;
 
-       /* Point past the Descriptor to get the number of bytes consumed */
+       /* Get the Descriptor Length field */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        /* Validate minimum descriptor length */
 
        if (temp16 < 43) {
-               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
        }
 
        *bytes_consumed = temp16 + 3;
@@ -839,7 +866,7 @@ acpi_rs_address64_resource (
        /* Values 0-2 and 0xC0-0xFF are valid */
 
        if ((temp8 > 2) && (temp8 < 0xC0)) {
-               return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+               return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
        }
 
        output_struct->data.address64.resource_type = temp8;
@@ -847,48 +874,12 @@ acpi_rs_address64_resource (
        /* Get the General Flags (Byte4) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       /* Producer / Consumer */
-
-       output_struct->data.address64.producer_consumer = temp8 & 0x01;
-
-       /* Decode */
-
-       output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
-
-       /* Min Address Fixed */
-
-       output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
-
-       /* Max Address Fixed */
-
-       output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
+       acpi_rs_decode_general_flags(&output_struct->data, *buffer);
 
        /* Get the Type Specific Flags (Byte5) */
 
        buffer += 1;
-       temp8 = *buffer;
-
-       if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) {
-               output_struct->data.address64.attribute.memory.read_write_attribute =
-                               (u16) (temp8 & 0x01);
-
-               output_struct->data.address64.attribute.memory.cache_attribute =
-                               (u16) ((temp8 >> 1) & 0x03);
-       }
-       else {
-               if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) {
-                       output_struct->data.address64.attribute.io.range_attribute =
-                               (u16) (temp8 & 0x03);
-                       output_struct->data.address64.attribute.io.translation_attribute =
-                               (u16) ((temp8 >> 4) & 0x03);
-               }
-               else {
-                       /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */
-                       /* Nothing needs to be filled in */
-               }
-       }
+       acpi_rs_decode_specific_flags(&output_struct->data, *buffer);
 
        if (resource_type == ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE) {
                /* Move past revision_id and Reserved byte */
@@ -899,30 +890,33 @@ acpi_rs_address64_resource (
        /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
 
        buffer += 1;
-       ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
+       ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer);
 
        /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
 
        buffer += 8;
-       ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
+       ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range,
+                          buffer);
 
        /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
 
        buffer += 8;
-       ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
+       ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range,
+                          buffer);
 
        /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
 
        buffer += 8;
-       ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset,
-               buffer);
+       ACPI_MOVE_64_TO_64(&output_struct->data.address64.
+                          address_translation_offset, buffer);
 
        /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
 
        buffer += 8;
-       ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
+       ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length,
+                          buffer);
 
-       output_struct->data.address64.resource_source.index = 0x00;
+       output_struct->data.address64.resource_source.index = 0;
        output_struct->data.address64.resource_source.string_length = 0;
        output_struct->data.address64.resource_source.string_ptr = NULL;
 
@@ -930,11 +924,9 @@ acpi_rs_address64_resource (
                /* Get type_specific_attribute (Bytes 48-55) */
 
                buffer += 8;
-               ACPI_MOVE_64_TO_64 (
-                       &output_struct->data.address64.type_specific_attributes,
-                       buffer);
-       }
-       else {
+               ACPI_MOVE_64_TO_64(&output_struct->data.address64.
+                                  type_specific_attributes, buffer);
+       } else {
                output_struct->data.address64.type_specific_attributes = 0;
 
                /* Resource Source Index (if present) */
@@ -954,9 +946,8 @@ acpi_rs_address64_resource (
                if (*bytes_consumed > (46 + 1)) {
                        /* Dereference the Index */
 
-                       temp8 = *buffer;
                        output_struct->data.address64.resource_source.index =
-                                       (u32) temp8;
+                           (u32) * buffer;
 
                        /* Point to the String */
 
@@ -964,29 +955,31 @@ acpi_rs_address64_resource (
 
                        /* Point the String pointer to the end of this structure */
 
-                       output_struct->data.address64.resource_source.string_ptr =
-                                       (char *)((u8 *)output_struct + struct_size);
+                       output_struct->data.address64.resource_source.
+                           string_ptr =
+                           (char *)((u8 *) output_struct + struct_size);
 
                        temp_ptr = (u8 *)
-                               output_struct->data.address64.resource_source.string_ptr;
+                           output_struct->data.address64.resource_source.
+                           string_ptr;
 
-                       /* Copy the string into the buffer */
+                       /* Copy the resource_source string into the buffer */
 
                        index = 0;
-                       while (0x00 != *buffer) {
+                       while (*buffer) {
                                *temp_ptr = *buffer;
 
-                               temp_ptr += 1;
-                               buffer += 1;
-                               index += 1;
+                               temp_ptr++;
+                               buffer++;
+                               index++;
                        }
 
                        /*
-                        * Add the terminating null
+                        * Add the terminating null and set the string length
                         */
-                       *temp_ptr = 0x00;
-                       output_struct->data.address64.resource_source.string_length =
-                               index + 1;
+                       *temp_ptr = 0;
+                       output_struct->data.address64.resource_source.
+                           string_length = index + 1;
 
                        /*
                         * In order for the struct_size to fall on a 32-bit boundary,
@@ -994,7 +987,7 @@ acpi_rs_address64_resource (
                         * struct_size to the next 32-bit boundary.
                         */
                        temp8 = (u8) (index + 1);
-                       struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
+                       struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
                }
        }
 
@@ -1005,10 +998,9 @@ acpi_rs_address64_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_address64_stream
@@ -1026,132 +1018,101 @@ acpi_rs_address64_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_address64_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_address64_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer;
-       u16                             *length_field;
-       u8                              temp8;
-       char                            *temp_pointer;
-
-
-       ACPI_FUNCTION_TRACE ("rs_address64_stream");
+       u8 *buffer;
+       u16 *length_field;
 
+       ACPI_FUNCTION_TRACE("rs_address64_stream");
 
        buffer = *output_buffer;
 
-       /* The descriptor field is static */
+       /* Set the Descriptor Type field */
 
-       *buffer = 0x8A;
+       *buffer = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
        buffer += 1;
 
-       /* Set a pointer to the Length field - to be filled in later */
+       /* Save a pointer to the Length field - to be filled in later */
 
-       length_field = ACPI_CAST_PTR (u16, buffer);
+       length_field = ACPI_CAST_PTR(u16, buffer);
        buffer += 2;
 
        /* Set the Resource Type (Memory, Io, bus_number) */
 
-       temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
-
-       *buffer = temp8;
+       *buffer = (u8) (linked_list->data.address64.resource_type & 0x03);
        buffer += 1;
 
        /* Set the general flags */
 
-       temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
-       temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
-       temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
-       temp8 |= (linked_list->data.address64.max_address_fixed & 0x01) << 3;
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_general_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the type specific flags */
 
-       temp8 = 0;
-
-       if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address64.attribute.memory.read_write_attribute &
-                       0x01);
-
-               temp8 |=
-                       (linked_list->data.address64.attribute.memory.cache_attribute &
-                        0x03) << 1;
-       }
-       else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
-               temp8 = (u8)
-                       (linked_list->data.address64.attribute.io.range_attribute &
-                        0x03);
-               temp8 |=
-                       (linked_list->data.address64.attribute.io.range_attribute &
-                        0x03) << 4;
-       }
-
-       *buffer = temp8;
+       *buffer = acpi_rs_encode_specific_flags(&linked_list->data);
        buffer += 1;
 
        /* Set the address space granularity */
 
-       ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
+       ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity);
        buffer += 8;
 
        /* Set the address range minimum */
 
-       ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
+       ACPI_MOVE_64_TO_64(buffer,
+                          &linked_list->data.address64.min_address_range);
        buffer += 8;
 
        /* Set the address range maximum */
 
-       ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
+       ACPI_MOVE_64_TO_64(buffer,
+                          &linked_list->data.address64.max_address_range);
        buffer += 8;
 
        /* Set the address translation offset */
 
-       ACPI_MOVE_64_TO_64 (buffer,
-               &linked_list->data.address64.address_translation_offset);
+       ACPI_MOVE_64_TO_64(buffer,
+                          &linked_list->data.address64.
+                          address_translation_offset);
        buffer += 8;
 
        /* Set the address length */
 
-       ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
+       ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length);
        buffer += 8;
 
        /* Resource Source Index and Resource Source are optional */
 
-       if (0 != linked_list->data.address64.resource_source.string_length) {
-               temp8 = (u8) linked_list->data.address64.resource_source.index;
-
-               *buffer = temp8;
+       if (linked_list->data.address64.resource_source.string_length) {
+               *buffer =
+                   (u8) linked_list->data.address64.resource_source.index;
                buffer += 1;
 
-               temp_pointer = (char *) buffer;
+               /* Copy the resource_source string */
 
-               /* Copy the string */
-
-               ACPI_STRCPY (temp_pointer,
-                       linked_list->data.address64.resource_source.string_ptr);
+               ACPI_STRCPY((char *)buffer,
+                           linked_list->data.address64.resource_source.
+                           string_ptr);
 
                /*
-                * Buffer needs to be set to the length of the sting + one for the
+                * Buffer needs to be set to the length of the string + one for the
                 * terminating null
                 */
-               buffer += (acpi_size)(ACPI_STRLEN (
-                                linked_list->data.address64.resource_source.string_ptr) + 1);
+               buffer +=
+                   (acpi_size) (ACPI_STRLEN
+                                (linked_list->data.address64.resource_source.
+                                 string_ptr) + 1);
        }
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
 
        /*
         * Set the length field to the number of bytes consumed
         * minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index 98176f2fcb5d878442808affed0d4486e8e97fe7..378f58390fc14935fff3f9fa4e519e6d2293e143 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rscalc")
-
+ACPI_MODULE_NAME("rscalc")
 
 /*******************************************************************************
  *
  *              the resource data.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_get_byte_stream_length (
-       struct acpi_resource            *linked_list,
-       acpi_size                       *size_needed)
+acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list,
+                              acpi_size * size_needed)
 {
-       acpi_size                       byte_stream_size_needed = 0;
-       acpi_size                       segment_size;
-       u8                              done = FALSE;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_byte_stream_length");
+       acpi_size byte_stream_size_needed = 0;
+       acpi_size segment_size;
+       u8 done = FALSE;
 
+       ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
 
        while (!done) {
                /* Init the variable that will hold the size to add to the total. */
@@ -145,11 +139,11 @@ acpi_rs_get_byte_stream_length (
                         */
                        if (linked_list->data.vendor_specific.length > 7) {
                                segment_size = 3;
-                       }
-                       else {
+                       } else {
                                segment_size = 1;
                        }
-                       segment_size += linked_list->data.vendor_specific.length;
+                       segment_size +=
+                           linked_list->data.vendor_specific.length;
                        break;
 
                case ACPI_RSTYPE_END_TAG:
@@ -194,9 +188,11 @@ acpi_rs_get_byte_stream_length (
                         */
                        segment_size = 16;
 
-                       if (linked_list->data.address16.resource_source.string_ptr) {
+                       if (linked_list->data.address16.resource_source.
+                           string_ptr) {
                                segment_size +=
-                                       linked_list->data.address16.resource_source.string_length;
+                                   linked_list->data.address16.resource_source.
+                                   string_length;
                                segment_size++;
                        }
                        break;
@@ -211,9 +207,11 @@ acpi_rs_get_byte_stream_length (
                         */
                        segment_size = 26;
 
-                       if (linked_list->data.address32.resource_source.string_ptr) {
+                       if (linked_list->data.address32.resource_source.
+                           string_ptr) {
                                segment_size +=
-                                       linked_list->data.address32.resource_source.string_length;
+                                   linked_list->data.address32.resource_source.
+                                   string_length;
                                segment_size++;
                        }
                        break;
@@ -227,9 +225,11 @@ acpi_rs_get_byte_stream_length (
                         */
                        segment_size = 46;
 
-                       if (linked_list->data.address64.resource_source.string_ptr) {
+                       if (linked_list->data.address64.resource_source.
+                           string_ptr) {
                                segment_size +=
-                                       linked_list->data.address64.resource_source.string_length;
+                                   linked_list->data.address64.resource_source.
+                                   string_length;
                                segment_size++;
                        }
                        break;
@@ -244,11 +244,14 @@ acpi_rs_get_byte_stream_length (
                         * Resource Source + 1 for the null.
                         */
                        segment_size = 9 + (((acpi_size)
-                               linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
+                                            linked_list->data.extended_irq.
+                                            number_of_interrupts - 1) * 4);
 
-                       if (linked_list->data.extended_irq.resource_source.string_ptr) {
+                       if (linked_list->data.extended_irq.resource_source.
+                           string_ptr) {
                                segment_size +=
-                                       linked_list->data.extended_irq.resource_source.string_length;
+                                   linked_list->data.extended_irq.
+                                   resource_source.string_length;
                                segment_size++;
                        }
                        break;
@@ -257,9 +260,9 @@ acpi_rs_get_byte_stream_length (
 
                        /* If we get here, everything is out of sync, exit with error */
 
-                       return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+                       return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
 
-               } /* switch (linked_list->Id) */
+               }               /* switch (linked_list->Id) */
 
                /* Update the total */
 
@@ -267,17 +270,16 @@ acpi_rs_get_byte_stream_length (
 
                /* Point to the next object */
 
-               linked_list = ACPI_PTR_ADD (struct acpi_resource,
-                                 linked_list, linked_list->length);
+               linked_list = ACPI_PTR_ADD(struct acpi_resource,
+                                          linked_list, linked_list->length);
        }
 
        /* This is the data the caller needs */
 
        *size_needed = byte_stream_size_needed;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_get_list_length
@@ -297,32 +299,28 @@ acpi_rs_get_byte_stream_length (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_list_length (
-       u8                              *byte_stream_buffer,
-       u32                             byte_stream_buffer_length,
-       acpi_size                       *size_needed)
+acpi_rs_get_list_length(u8 * byte_stream_buffer,
+                       u32 byte_stream_buffer_length, acpi_size * size_needed)
 {
-       u32                             buffer_size = 0;
-       u32                             bytes_parsed = 0;
-       u8                              number_of_interrupts = 0;
-       u8                              number_of_channels = 0;
-       u8                              resource_type;
-       u32                             structure_size;
-       u32                             bytes_consumed;
-       u8                              *buffer;
-       u8                              temp8;
-       u16                             temp16;
-       u8                              index;
-       u8                              additional_bytes;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_list_length");
-
+       u32 buffer_size = 0;
+       u32 bytes_parsed = 0;
+       u8 number_of_interrupts = 0;
+       u8 number_of_channels = 0;
+       u8 resource_type;
+       u32 structure_size;
+       u32 bytes_consumed;
+       u8 *buffer;
+       u8 temp8;
+       u16 temp16;
+       u8 index;
+       u8 additional_bytes;
+
+       ACPI_FUNCTION_TRACE("rs_get_list_length");
 
        while (bytes_parsed < byte_stream_buffer_length) {
                /* The next byte in the stream is the resource type */
 
-               resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
+               resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
 
                switch (resource_type) {
                case ACPI_RDESC_TYPE_MEMORY_24:
@@ -331,10 +329,10 @@ acpi_rs_get_list_length (
                         */
                        bytes_consumed = 12;
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
                        break;
 
-
                case ACPI_RDESC_TYPE_LARGE_VENDOR:
                        /*
                         * Vendor Defined Resource
@@ -342,38 +340,39 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
                        ++buffer;
 
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
                        bytes_consumed = temp16 + 3;
 
                        /* Ensure a 32-bit boundary for the structure */
 
-                       temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16);
+                       temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16);
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
-                                          (temp16 * sizeof (u8));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
+                           (temp16 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_MEMORY_32:
                        /*
                         * 32-Bit Memory Range Resource
                         */
                        bytes_consumed = 20;
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
                        break;
 
-
                case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
                        /*
                         * 32-Bit Fixed Memory Resource
                         */
                        bytes_consumed = 12;
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct
+                                                acpi_resource_fixed_mem32);
                        break;
 
-
                case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
                        /*
                         * 64-Bit Address Resource
@@ -381,13 +380,14 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
 
                        ++buffer;
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        bytes_consumed = temp16 + 3;
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct
+                                                acpi_resource_address64);
                        break;
 
-
                case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
                        /*
                         * 64-Bit Address Resource
@@ -395,7 +395,7 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
 
                        ++buffer;
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        bytes_consumed = temp16 + 3;
 
@@ -409,20 +409,19 @@ acpi_rs_get_list_length (
                         */
                        if (43 < temp16) {
                                temp8 = (u8) (temp16 - 44);
-                       }
-                       else {
+                       } else {
                                temp8 = 0;
                        }
 
                        /* Ensure a 64-bit boundary for the structure */
 
-                       temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8);
+                       temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8);
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) +
-                                          (temp8 * sizeof (u8));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)
+                           + (temp8 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
                        /*
                         * 32-Bit Address Resource
@@ -430,7 +429,7 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
 
                        ++buffer;
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        bytes_consumed = temp16 + 3;
 
@@ -444,20 +443,19 @@ acpi_rs_get_list_length (
                         */
                        if (23 < temp16) {
                                temp8 = (u8) (temp16 - 24);
-                       }
-                       else {
+                       } else {
                                temp8 = 0;
                        }
 
                        /* Ensure a 32-bit boundary for the structure */
 
-                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
+                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) +
-                                          (temp8 * sizeof (u8));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)
+                           + (temp8 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
                        /*
                         * 16-Bit Address Resource
@@ -465,7 +463,7 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
 
                        ++buffer;
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        bytes_consumed = temp16 + 3;
 
@@ -479,20 +477,19 @@ acpi_rs_get_list_length (
                         */
                        if (13 < temp16) {
                                temp8 = (u8) (temp16 - 14);
-                       }
-                       else {
+                       } else {
                                temp8 = 0;
                        }
 
                        /* Ensure a 32-bit boundary for the structure */
 
-                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
+                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) +
-                                          (temp8 * sizeof (u8));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)
+                           + (temp8 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
                        /*
                         * Extended IRQ
@@ -500,7 +497,7 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
 
                        ++buffer;
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        bytes_consumed = temp16 + 3;
 
@@ -527,21 +524,20 @@ acpi_rs_get_list_length (
                         */
                        if (9 + additional_bytes < temp16) {
                                temp8 = (u8) (temp16 - (9 + additional_bytes));
-                       }
-                       else {
+                       } else {
                                temp8 = 0;
                        }
 
                        /* Ensure a 32-bit boundary for the structure */
 
-                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
+                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) +
-                                          (additional_bytes * sizeof (u8)) +
-                                          (temp8 * sizeof (u8));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) +
+                           (additional_bytes * sizeof(u8)) +
+                           (temp8 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_IRQ_FORMAT:
                        /*
                         * IRQ Resource.
@@ -550,10 +546,9 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
                        temp8 = *buffer;
 
-                       if(temp8 & 0x01) {
+                       if (temp8 & 0x01) {
                                bytes_consumed = 4;
-                       }
-                       else {
+                       } else {
                                bytes_consumed = 3;
                        }
 
@@ -563,7 +558,7 @@ acpi_rs_get_list_length (
 
                        /* Look at the number of bits set */
 
-                       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+                       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                        for (index = 0; index < 16; index++) {
                                if (temp16 & 0x1) {
@@ -573,11 +568,11 @@ acpi_rs_get_list_length (
                                temp16 >>= 1;
                        }
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io) +
-                                          (number_of_interrupts * sizeof (u32));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) +
+                           (number_of_interrupts * sizeof(u32));
                        break;
 
-
                case ACPI_RDESC_TYPE_DMA_FORMAT:
                        /*
                         * DMA Resource
@@ -593,19 +588,19 @@ acpi_rs_get_list_length (
 
                        temp8 = *buffer;
 
-                       for(index = 0; index < 8; index++) {
-                               if(temp8 & 0x1) {
+                       for (index = 0; index < 8; index++) {
+                               if (temp8 & 0x1) {
                                        ++number_of_channels;
                                }
 
                                temp8 >>= 1;
                        }
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma) +
-                                          (number_of_channels * sizeof (u32));
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) +
+                           (number_of_channels * sizeof(u32));
                        break;
 
-
                case ACPI_RDESC_TYPE_START_DEPENDENT:
                        /*
                         * Start Dependent Functions Resource
@@ -614,17 +609,17 @@ acpi_rs_get_list_length (
                        buffer = byte_stream_buffer;
                        temp8 = *buffer;
 
-                       if(temp8 & 0x01) {
+                       if (temp8 & 0x01) {
                                bytes_consumed = 2;
-                       }
-                       else {
+                       } else {
                                bytes_consumed = 1;
                        }
 
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct
+                                                acpi_resource_start_dpf);
                        break;
 
-
                case ACPI_RDESC_TYPE_END_DEPENDENT:
                        /*
                         * End Dependent Functions Resource
@@ -633,25 +628,24 @@ acpi_rs_get_list_length (
                        structure_size = ACPI_RESOURCE_LENGTH;
                        break;
 
-
                case ACPI_RDESC_TYPE_IO_PORT:
                        /*
                         * IO Port Resource
                         */
                        bytes_consumed = 8;
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
                        break;
 
-
                case ACPI_RDESC_TYPE_FIXED_IO_PORT:
                        /*
                         * Fixed IO Port Resource
                         */
                        bytes_consumed = 4;
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
                        break;
 
-
                case ACPI_RDESC_TYPE_SMALL_VENDOR:
                        /*
                         * Vendor Specific Resource
@@ -664,12 +658,12 @@ acpi_rs_get_list_length (
 
                        /* Ensure a 32-bit boundary for the structure */
 
-                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
-                       structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
-                                          (temp8 * sizeof (u8));
+                       temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
+                       structure_size =
+                           ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
+                           (temp8 * sizeof(u8));
                        break;
 
-
                case ACPI_RDESC_TYPE_END_TAG:
                        /*
                         * End Tag
@@ -679,18 +673,17 @@ acpi_rs_get_list_length (
                        byte_stream_buffer_length = bytes_parsed;
                        break;
 
-
                default:
                        /*
                         * If we get here, everything is out of sync,
                         * exit with an error
                         */
-                       return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+                       return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
                }
 
                /* Update the return value and counter */
 
-               buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size);
+               buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size);
                bytes_parsed += bytes_consumed;
 
                /* Set the byte stream to point to the next resource */
@@ -701,10 +694,9 @@ acpi_rs_get_list_length (
        /* This is the data the caller needs */
 
        *size_needed = buffer_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_get_pci_routing_table_length
@@ -723,22 +715,19 @@ acpi_rs_get_list_length (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_pci_routing_table_length (
-       union acpi_operand_object       *package_object,
-       acpi_size                       *buffer_size_needed)
+acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
+                                    acpi_size * buffer_size_needed)
 {
-       u32                             number_of_elements;
-       acpi_size                       temp_size_needed = 0;
-       union acpi_operand_object       **top_object_list;
-       u32                             index;
-       union acpi_operand_object       *package_element;
-       union acpi_operand_object       **sub_object_list;
-       u8                              name_found;
-       u32                             table_index;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_pci_routing_table_length");
+       u32 number_of_elements;
+       acpi_size temp_size_needed = 0;
+       union acpi_operand_object **top_object_list;
+       u32 index;
+       union acpi_operand_object *package_element;
+       union acpi_operand_object **sub_object_list;
+       u8 name_found;
+       u32 table_index;
 
+       ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length");
 
        number_of_elements = package_object->package.count;
 
@@ -769,53 +758,51 @@ acpi_rs_get_pci_routing_table_length (
 
                name_found = FALSE;
 
-               for (table_index = 0; table_index < 4 && !name_found; table_index++) {
+               for (table_index = 0; table_index < 4 && !name_found;
+                    table_index++) {
                        if ((ACPI_TYPE_STRING ==
-                                       ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
-
-                               ((ACPI_TYPE_LOCAL_REFERENCE ==
-                                       ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
-
-                                       ((*sub_object_list)->reference.opcode ==
-                                               AML_INT_NAMEPATH_OP))) {
+                            ACPI_GET_OBJECT_TYPE(*sub_object_list))
+                           ||
+                           ((ACPI_TYPE_LOCAL_REFERENCE ==
+                             ACPI_GET_OBJECT_TYPE(*sub_object_list))
+                            && ((*sub_object_list)->reference.opcode ==
+                                AML_INT_NAMEPATH_OP))) {
                                name_found = TRUE;
-                       }
-                       else {
+                       } else {
                                /* Look at the next element */
 
                                sub_object_list++;
                        }
                }
 
-               temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4);
+               temp_size_needed += (sizeof(struct acpi_pci_routing_table) - 4);
 
                /* Was a String type found? */
 
                if (name_found) {
-                       if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
+                       if (ACPI_GET_OBJECT_TYPE(*sub_object_list) ==
+                           ACPI_TYPE_STRING) {
                                /*
                                 * The length String.Length field does not include the
                                 * terminating NULL, add 1
                                 */
                                temp_size_needed += ((acpi_size)
-                                       (*sub_object_list)->string.length + 1);
+                                                    (*sub_object_list)->string.
+                                                    length + 1);
+                       } else {
+                               temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
                        }
-                       else {
-                               temp_size_needed += acpi_ns_get_pathname_length (
-                                                  (*sub_object_list)->reference.node);
-                       }
-               }
-               else {
+               } else {
                        /*
                         * If no name was found, then this is a NULL, which is
                         * translated as a u32 zero.
                         */
-                       temp_size_needed += sizeof (u32);
+                       temp_size_needed += sizeof(u32);
                }
 
                /* Round up the size since each element must be aligned */
 
-               temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed);
+               temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed);
 
                /* Point to the next union acpi_operand_object */
 
@@ -826,6 +813,7 @@ acpi_rs_get_pci_routing_table_length (
         * Adding an extra element to the end of the list, essentially a
         * NULL terminator
         */
-       *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table);
-       return_ACPI_STATUS (AE_OK);
+       *buffer_size_needed =
+           temp_size_needed + sizeof(struct acpi_pci_routing_table);
+       return_ACPI_STATUS(AE_OK);
 }
index 8e0eae0d50bb58eb71a9cf03890a1e79749038db..0911526b7ad883d1dda18fc1b545c0c3f847c166 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 #include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rscreate")
-
+ACPI_MODULE_NAME("rscreate")
 
 /*******************************************************************************
  *
  *              of device resources.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_create_resource_list (
-       union acpi_operand_object       *byte_stream_buffer,
-       struct acpi_buffer              *output_buffer)
+acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
+                            struct acpi_buffer *output_buffer)
 {
 
-       acpi_status                     status;
-       u8                              *byte_stream_start;
-       acpi_size                       list_size_needed = 0;
-       u32                             byte_stream_buffer_length;
+       acpi_status status;
+       u8 *byte_stream_start;
+       acpi_size list_size_needed = 0;
+       u32 byte_stream_buffer_length;
 
+       ACPI_FUNCTION_TRACE("rs_create_resource_list");
 
-       ACPI_FUNCTION_TRACE ("rs_create_resource_list");
-
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
-               byte_stream_buffer));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
+                         byte_stream_buffer));
 
        /* Params already validated, so we don't re-validate here */
 
@@ -96,36 +90,39 @@ acpi_rs_create_resource_list (
         * Pass the byte_stream_buffer into a module that can calculate
         * the buffer size needed for the linked list
         */
-       status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length,
-                        &list_size_needed);
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
-               status, (u32) list_size_needed));
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_rs_get_list_length(byte_stream_start,
+                                   byte_stream_buffer_length,
+                                   &list_size_needed);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
+                         status, (u32) list_size_needed));
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (output_buffer, list_size_needed);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_initialize_buffer(output_buffer, list_size_needed);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Do the conversion */
 
-       status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length,
-                         output_buffer->pointer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_rs_byte_stream_to_list(byte_stream_start,
+                                       byte_stream_buffer_length,
+                                       output_buffer->pointer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n",
-                       output_buffer->pointer, (u32) output_buffer->length));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+                         output_buffer->pointer, (u32) output_buffer->length));
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_create_pci_routing_table
@@ -148,44 +145,41 @@ acpi_rs_create_resource_list (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_create_pci_routing_table (
-       union acpi_operand_object       *package_object,
-       struct acpi_buffer              *output_buffer)
+acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
+                                struct acpi_buffer *output_buffer)
 {
-       u8                              *buffer;
-       union acpi_operand_object       **top_object_list;
-       union acpi_operand_object       **sub_object_list;
-       union acpi_operand_object       *obj_desc;
-       acpi_size                       buffer_size_needed = 0;
-       u32                             number_of_elements;
-       u32                             index;
-       struct acpi_pci_routing_table   *user_prt;
-       struct acpi_namespace_node      *node;
-       acpi_status                     status;
-       struct acpi_buffer              path_buffer;
-
-
-       ACPI_FUNCTION_TRACE ("rs_create_pci_routing_table");
-
+       u8 *buffer;
+       union acpi_operand_object **top_object_list;
+       union acpi_operand_object **sub_object_list;
+       union acpi_operand_object *obj_desc;
+       acpi_size buffer_size_needed = 0;
+       u32 number_of_elements;
+       u32 index;
+       struct acpi_pci_routing_table *user_prt;
+       struct acpi_namespace_node *node;
+       acpi_status status;
+       struct acpi_buffer path_buffer;
+
+       ACPI_FUNCTION_TRACE("rs_create_pci_routing_table");
 
        /* Params already validated, so we don't re-validate here */
 
        /* Get the required buffer length */
 
-       status = acpi_rs_get_pci_routing_table_length (package_object,
-                        &buffer_size_needed);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_rs_get_pci_routing_table_length(package_object,
+                                                     &buffer_size_needed);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "buffer_size_needed = %X\n",
-               (u32) buffer_size_needed));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n",
+                         (u32) buffer_size_needed));
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -193,10 +187,10 @@ acpi_rs_create_pci_routing_table (
         * should be a package that in turn contains an
         * acpi_integer Address, a u8 Pin, a Name and a u8 source_index.
         */
-       top_object_list  = package_object->package.elements;
+       top_object_list = package_object->package.elements;
        number_of_elements = package_object->package.count;
-       buffer           = output_buffer->pointer;
-       user_prt         = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
+       buffer = output_buffer->pointer;
+       user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
 
        for (index = 0; index < number_of_elements; index++) {
                /*
@@ -206,31 +200,34 @@ acpi_rs_create_pci_routing_table (
                 * be zero because we cleared the return buffer earlier
                 */
                buffer += user_prt->length;
-               user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
+               user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
 
                /*
                 * Fill in the Length field with the information we have at this point.
                 * The minus four is to subtract the size of the u8 Source[4] member
                 * because it is added below.
                 */
-               user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4);
+               user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
 
                /* Each element of the top-level package must also be a package */
 
-               if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(PRT[%X]) Need sub-package, found %s\n",
-                               index, acpi_ut_get_object_type_name (*top_object_list)));
-                       return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+               if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X]) Need sub-package, found %s\n",
+                                         index,
+                                         acpi_ut_get_object_type_name
+                                         (*top_object_list)));
+                       return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
                /* Each sub-package must be of length 4 */
 
                if ((*top_object_list)->package.count != 4) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(PRT[%X]) Need package of length 4, found length %d\n",
-                               index, (*top_object_list)->package.count));
-                       return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X]) Need package of length 4, found length %d\n",
+                                         index,
+                                         (*top_object_list)->package.count));
+                       return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT);
                }
 
                /*
@@ -243,40 +240,43 @@ acpi_rs_create_pci_routing_table (
                /* 1) First subobject: Dereference the PRT.Address */
 
                obj_desc = sub_object_list[0];
-               if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+               if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                        user_prt->address = obj_desc->integer.value;
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(PRT[%X].Address) Need Integer, found %s\n",
-                               index, acpi_ut_get_object_type_name (obj_desc)));
-                       return_ACPI_STATUS (AE_BAD_DATA);
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X].Address) Need Integer, found %s\n",
+                                         index,
+                                         acpi_ut_get_object_type_name
+                                         (obj_desc)));
+                       return_ACPI_STATUS(AE_BAD_DATA);
                }
 
                /* 2) Second subobject: Dereference the PRT.Pin */
 
                obj_desc = sub_object_list[1];
-               if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+               if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                        user_prt->pin = (u32) obj_desc->integer.value;
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(PRT[%X].Pin) Need Integer, found %s\n",
-                               index, acpi_ut_get_object_type_name (obj_desc)));
-                       return_ACPI_STATUS (AE_BAD_DATA);
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X].Pin) Need Integer, found %s\n",
+                                         index,
+                                         acpi_ut_get_object_type_name
+                                         (obj_desc)));
+                       return_ACPI_STATUS(AE_BAD_DATA);
                }
 
                /* 3) Third subobject: Dereference the PRT.source_name */
 
                obj_desc = sub_object_list[2];
-               switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+               switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                case ACPI_TYPE_LOCAL_REFERENCE:
 
                        if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "(PRT[%X].Source) Need name, found reference op %X\n",
-                                       index, obj_desc->reference.opcode));
-                               return_ACPI_STATUS (AE_BAD_DATA);
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "(PRT[%X].Source) Need name, found reference op %X\n",
+                                                 index,
+                                                 obj_desc->reference.opcode));
+                               return_ACPI_STATUS(AE_BAD_DATA);
                        }
 
                        node = obj_desc->reference.node;
@@ -284,21 +284,23 @@ acpi_rs_create_pci_routing_table (
                        /* Use *remaining* length of the buffer as max for pathname */
 
                        path_buffer.length = output_buffer->length -
-                                          (u32) ((u8 *) user_prt->source -
-                                          (u8 *) output_buffer->pointer);
+                           (u32) ((u8 *) user_prt->source -
+                                  (u8 *) output_buffer->pointer);
                        path_buffer.pointer = user_prt->source;
 
-                       status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
+                       status =
+                           acpi_ns_handle_to_pathname((acpi_handle) node,
+                                                      &path_buffer);
 
                        /* +1 to include null terminator */
 
-                       user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1;
+                       user_prt->length +=
+                           (u32) ACPI_STRLEN(user_prt->source) + 1;
                        break;
 
-
                case ACPI_TYPE_STRING:
 
-                       ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
+                       ACPI_STRCPY(user_prt->source, obj_desc->string.pointer);
 
                        /*
                         * Add to the Length field the length of the string
@@ -307,7 +309,6 @@ acpi_rs_create_pci_routing_table (
                        user_prt->length += obj_desc->string.length + 1;
                        break;
 
-
                case ACPI_TYPE_INTEGER:
                        /*
                         * If this is a number, then the Source Name is NULL, since the
@@ -315,33 +316,36 @@ acpi_rs_create_pci_routing_table (
                         *
                         * Add to the Length field the length of the u32 NULL
                         */
-                       user_prt->length += sizeof (u32);
+                       user_prt->length += sizeof(u32);
                        break;
 
-
                default:
 
-                  ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                          "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
-                               index, acpi_ut_get_object_type_name (obj_desc)));
-                  return_ACPI_STATUS (AE_BAD_DATA);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
+                                         index,
+                                         acpi_ut_get_object_type_name
+                                         (obj_desc)));
+                       return_ACPI_STATUS(AE_BAD_DATA);
                }
 
                /* Now align the current length */
 
-               user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length);
+               user_prt->length =
+                   (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length);
 
                /* 4) Fourth subobject: Dereference the PRT.source_index */
 
                obj_desc = sub_object_list[3];
-               if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+               if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                        user_prt->source_index = (u32) obj_desc->integer.value;
-               }
-               else {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "(PRT[%X].source_index) Need Integer, found %s\n",
-                               index, acpi_ut_get_object_type_name (obj_desc)));
-                       return_ACPI_STATUS (AE_BAD_DATA);
+               } else {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "(PRT[%X].source_index) Need Integer, found %s\n",
+                                         index,
+                                         acpi_ut_get_object_type_name
+                                         (obj_desc)));
+                       return_ACPI_STATUS(AE_BAD_DATA);
                }
 
                /* Point to the next union acpi_operand_object in the top level package */
@@ -349,12 +353,11 @@ acpi_rs_create_pci_routing_table (
                top_object_list++;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n",
-                       output_buffer->pointer, (u32) output_buffer->length));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+                         output_buffer->pointer, (u32) output_buffer->length));
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_create_byte_stream
@@ -374,19 +377,16 @@ acpi_rs_create_pci_routing_table (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_create_byte_stream (
-       struct acpi_resource            *linked_list_buffer,
-       struct acpi_buffer              *output_buffer)
+acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
+                          struct acpi_buffer *output_buffer)
 {
-       acpi_status                     status;
-       acpi_size                       byte_stream_size_needed = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_create_byte_stream");
+       acpi_status status;
+       acpi_size byte_stream_size_needed = 0;
 
+       ACPI_FUNCTION_TRACE("rs_create_byte_stream");
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "linked_list_buffer = %p\n",
-               linked_list_buffer));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
+                         linked_list_buffer));
 
        /*
         * Params already validated, so we don't re-validate here
@@ -394,32 +394,35 @@ acpi_rs_create_byte_stream (
         * Pass the linked_list_buffer into a module that calculates
         * the buffer size needed for the byte stream.
         */
-       status = acpi_rs_get_byte_stream_length (linked_list_buffer,
-                        &byte_stream_size_needed);
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n",
-               (u32) byte_stream_size_needed, acpi_format_exception (status)));
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_rs_get_byte_stream_length(linked_list_buffer,
+                                               &byte_stream_size_needed);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n",
+                         (u32) byte_stream_size_needed,
+                         acpi_format_exception(status)));
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Do the conversion */
 
-       status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed,
-                         output_buffer->pointer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_rs_list_to_byte_stream(linked_list_buffer,
+                                       byte_stream_size_needed,
+                                       output_buffer->pointer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n",
-                       output_buffer->pointer, (u32) output_buffer->length));
-       return_ACPI_STATUS (AE_OK);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
+                         output_buffer->pointer, (u32) output_buffer->length));
+       return_ACPI_STATUS(AE_OK);
 }
-
index 1935dab2ab5164b2bdf09ea1d26235eb0fb8d0f4..75bd34d1783f6495660d6d595c2ca2f24d6ead51 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsdump")
+ACPI_MODULE_NAME("rsdump")
 
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /* Local prototypes */
+static void acpi_rs_dump_irq(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_irq (
-       union acpi_resource_data        *data);
-
-static void
-acpi_rs_dump_address16 (
-       union acpi_resource_data        *data);
-
-static void
-acpi_rs_dump_address32 (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_address16(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_address64 (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_address32(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_dma (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_address64(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_io (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_dma(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_extended_irq (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_io(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_fixed_io (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_extended_irq(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_fixed_memory32 (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_fixed_io(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_memory24 (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_memory32 (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_memory24(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_start_depend_fns (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_memory32(union acpi_resource_data *data);
 
-static void
-acpi_rs_dump_vendor_specific (
-       union acpi_resource_data        *data);
+static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data);
 
+static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data);
 
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_irq
@@ -116,39 +87,37 @@ acpi_rs_dump_vendor_specific (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_irq (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_irq(union acpi_resource_data *data)
 {
-       struct acpi_resource_irq        *irq_data = (struct acpi_resource_irq *) data;
-       u8                              index = 0;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data;
+       u8 index = 0;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("IRQ Resource\n");
+       acpi_os_printf("IRQ Resource\n");
 
-       acpi_os_printf ("  %s Triggered\n",
-               ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
+       acpi_os_printf("  %s Triggered\n",
+                      ACPI_LEVEL_SENSITIVE ==
+                      irq_data->edge_level ? "Level" : "Edge");
 
-       acpi_os_printf ("  Active %s\n",
-               ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
+       acpi_os_printf("  Active %s\n",
+                      ACPI_ACTIVE_LOW ==
+                      irq_data->active_high_low ? "Low" : "High");
 
-       acpi_os_printf ("  %s\n",
-               ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
+       acpi_os_printf("  %s\n",
+                      ACPI_SHARED ==
+                      irq_data->shared_exclusive ? "Shared" : "Exclusive");
 
-       acpi_os_printf ("  %X Interrupts ( ", irq_data->number_of_interrupts);
+       acpi_os_printf("  %X Interrupts ( ", irq_data->number_of_interrupts);
 
        for (index = 0; index < irq_data->number_of_interrupts; index++) {
-               acpi_os_printf ("%X ", irq_data->interrupts[index]);
+               acpi_os_printf("%X ", irq_data->interrupts[index]);
        }
 
-       acpi_os_printf (")\n");
+       acpi_os_printf(")\n");
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_dma
@@ -161,75 +130,69 @@ acpi_rs_dump_irq (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_dma (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_dma(union acpi_resource_data *data)
 {
-       struct acpi_resource_dma        *dma_data = (struct acpi_resource_dma *) data;
-       u8                              index = 0;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data;
+       u8 index = 0;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("DMA Resource\n");
+       acpi_os_printf("DMA Resource\n");
 
        switch (dma_data->type) {
        case ACPI_COMPATIBILITY:
-               acpi_os_printf ("  Compatibility mode\n");
+               acpi_os_printf("  Compatibility mode\n");
                break;
 
        case ACPI_TYPE_A:
-               acpi_os_printf ("  Type A\n");
+               acpi_os_printf("  Type A\n");
                break;
 
        case ACPI_TYPE_B:
-               acpi_os_printf ("  Type B\n");
+               acpi_os_printf("  Type B\n");
                break;
 
        case ACPI_TYPE_F:
-               acpi_os_printf ("  Type F\n");
+               acpi_os_printf("  Type F\n");
                break;
 
        default:
-               acpi_os_printf ("  Invalid DMA type\n");
+               acpi_os_printf("  Invalid DMA type\n");
                break;
        }
 
-       acpi_os_printf ("  %sBus Master\n",
-               ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
-
+       acpi_os_printf("  %sBus Master\n",
+                      ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
 
        switch (dma_data->transfer) {
        case ACPI_TRANSFER_8:
-               acpi_os_printf ("  8-bit only transfer\n");
+               acpi_os_printf("  8-bit only transfer\n");
                break;
 
        case ACPI_TRANSFER_8_16:
-               acpi_os_printf ("  8 and 16-bit transfer\n");
+               acpi_os_printf("  8 and 16-bit transfer\n");
                break;
 
        case ACPI_TRANSFER_16:
-               acpi_os_printf ("  16 bit only transfer\n");
+               acpi_os_printf("  16 bit only transfer\n");
                break;
 
        default:
-               acpi_os_printf ("  Invalid transfer preference\n");
+               acpi_os_printf("  Invalid transfer preference\n");
                break;
        }
 
-       acpi_os_printf ("  Number of Channels: %X ( ",
-               dma_data->number_of_channels);
+       acpi_os_printf("  Number of Channels: %X ( ",
+                      dma_data->number_of_channels);
 
        for (index = 0; index < dma_data->number_of_channels; index++) {
-               acpi_os_printf ("%X ", dma_data->channels[index]);
+               acpi_os_printf("%X ", dma_data->channels[index]);
        }
 
-       acpi_os_printf (")\n");
+       acpi_os_printf(")\n");
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_start_depend_fns
@@ -242,58 +205,54 @@ acpi_rs_dump_dma (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_start_depend_fns (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data)
 {
-       struct acpi_resource_start_dpf *sdf_data = (struct acpi_resource_start_dpf *) data;
-
+       struct acpi_resource_start_dpf *sdf_data =
+           (struct acpi_resource_start_dpf *)data;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
-
-       acpi_os_printf ("Start Dependent Functions Resource\n");
+       acpi_os_printf("Start Dependent Functions Resource\n");
 
        switch (sdf_data->compatibility_priority) {
        case ACPI_GOOD_CONFIGURATION:
-               acpi_os_printf ("  Good configuration\n");
+               acpi_os_printf("  Good configuration\n");
                break;
 
        case ACPI_ACCEPTABLE_CONFIGURATION:
-               acpi_os_printf ("  Acceptable configuration\n");
+               acpi_os_printf("  Acceptable configuration\n");
                break;
 
        case ACPI_SUB_OPTIMAL_CONFIGURATION:
-               acpi_os_printf ("  Sub-optimal configuration\n");
+               acpi_os_printf("  Sub-optimal configuration\n");
                break;
 
        default:
-               acpi_os_printf ("  Invalid compatibility priority\n");
+               acpi_os_printf("  Invalid compatibility priority\n");
                break;
        }
 
-       switch(sdf_data->performance_robustness) {
+       switch (sdf_data->performance_robustness) {
        case ACPI_GOOD_CONFIGURATION:
-               acpi_os_printf ("  Good configuration\n");
+               acpi_os_printf("  Good configuration\n");
                break;
 
        case ACPI_ACCEPTABLE_CONFIGURATION:
-               acpi_os_printf ("  Acceptable configuration\n");
+               acpi_os_printf("  Acceptable configuration\n");
                break;
 
        case ACPI_SUB_OPTIMAL_CONFIGURATION:
-               acpi_os_printf ("  Sub-optimal configuration\n");
+               acpi_os_printf("  Sub-optimal configuration\n");
                break;
 
        default:
-               acpi_os_printf ("  Invalid performance robustness preference\n");
+               acpi_os_printf("  Invalid performance robustness preference\n");
                break;
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_io
@@ -306,33 +265,30 @@ acpi_rs_dump_start_depend_fns (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_io (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_io(union acpi_resource_data *data)
 {
-       struct acpi_resource_io         *io_data = (struct acpi_resource_io *) data;
-
+       struct acpi_resource_io *io_data = (struct acpi_resource_io *)data;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       acpi_os_printf("Io Resource\n");
 
-       acpi_os_printf ("Io Resource\n");
+       acpi_os_printf("  %d bit decode\n",
+                      ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
 
-       acpi_os_printf ("  %d bit decode\n",
-               ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
+       acpi_os_printf("  Range minimum base: %08X\n",
+                      io_data->min_base_address);
 
-       acpi_os_printf ("  Range minimum base: %08X\n", io_data->min_base_address);
+       acpi_os_printf("  Range maximum base: %08X\n",
+                      io_data->max_base_address);
 
-       acpi_os_printf ("  Range maximum base: %08X\n", io_data->max_base_address);
+       acpi_os_printf("  Alignment: %08X\n", io_data->alignment);
 
-       acpi_os_printf ("  Alignment: %08X\n", io_data->alignment);
-
-       acpi_os_printf ("  Range Length: %08X\n", io_data->range_length);
+       acpi_os_printf("  Range Length: %08X\n", io_data->range_length);
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_fixed_io
@@ -345,25 +301,22 @@ acpi_rs_dump_io (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_fixed_io (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_fixed_io(union acpi_resource_data *data)
 {
-       struct acpi_resource_fixed_io   *fixed_io_data = (struct acpi_resource_fixed_io *) data;
-
+       struct acpi_resource_fixed_io *fixed_io_data =
+           (struct acpi_resource_fixed_io *)data;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       acpi_os_printf("Fixed Io Resource\n");
+       acpi_os_printf("  Range base address: %08X",
+                      fixed_io_data->base_address);
 
-       acpi_os_printf ("Fixed Io Resource\n");
-       acpi_os_printf ("  Range base address: %08X", fixed_io_data->base_address);
-
-       acpi_os_printf ("  Range length: %08X", fixed_io_data->range_length);
+       acpi_os_printf("  Range length: %08X", fixed_io_data->range_length);
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_vendor_specific
@@ -376,30 +329,26 @@ acpi_rs_dump_fixed_io (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_vendor_specific (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data)
 {
-       struct acpi_resource_vendor     *vendor_data = (struct acpi_resource_vendor *) data;
-       u16                             index = 0;
-
+       struct acpi_resource_vendor *vendor_data =
+           (struct acpi_resource_vendor *)data;
+       u16 index = 0;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       acpi_os_printf("Vendor Specific Resource\n");
 
-       acpi_os_printf ("Vendor Specific Resource\n");
-
-       acpi_os_printf ("  Length: %08X\n", vendor_data->length);
+       acpi_os_printf("  Length: %08X\n", vendor_data->length);
 
        for (index = 0; index < vendor_data->length; index++) {
-               acpi_os_printf ("  Byte %X: %08X\n",
-                       index, vendor_data->reserved[index]);
+               acpi_os_printf("  Byte %X: %08X\n",
+                              index, vendor_data->reserved[index]);
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_memory24
@@ -412,37 +361,33 @@ acpi_rs_dump_vendor_specific (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_memory24 (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_memory24(union acpi_resource_data *data)
 {
-       struct acpi_resource_mem24      *memory24_data = (struct acpi_resource_mem24 *) data;
-
+       struct acpi_resource_mem24 *memory24_data =
+           (struct acpi_resource_mem24 *)data;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       acpi_os_printf("24-Bit Memory Range Resource\n");
 
-       acpi_os_printf ("24-Bit Memory Range Resource\n");
+       acpi_os_printf("  Read%s\n",
+                      ACPI_READ_WRITE_MEMORY ==
+                      memory24_data->read_write_attribute ?
+                      "/Write" : " only");
 
-       acpi_os_printf ("  Read%s\n",
-               ACPI_READ_WRITE_MEMORY ==
-                       memory24_data->read_write_attribute ?
-                       "/Write" : " only");
+       acpi_os_printf("  Range minimum base: %08X\n",
+                      memory24_data->min_base_address);
 
-       acpi_os_printf ("  Range minimum base: %08X\n",
-               memory24_data->min_base_address);
+       acpi_os_printf("  Range maximum base: %08X\n",
+                      memory24_data->max_base_address);
 
-       acpi_os_printf ("  Range maximum base: %08X\n",
-               memory24_data->max_base_address);
+       acpi_os_printf("  Alignment: %08X\n", memory24_data->alignment);
 
-       acpi_os_printf ("  Alignment: %08X\n", memory24_data->alignment);
-
-       acpi_os_printf ("  Range length: %08X\n", memory24_data->range_length);
+       acpi_os_printf("  Range length: %08X\n", memory24_data->range_length);
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_memory32
@@ -455,37 +400,33 @@ acpi_rs_dump_memory24 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_memory32 (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_memory32(union acpi_resource_data *data)
 {
-       struct acpi_resource_mem32      *memory32_data = (struct acpi_resource_mem32 *) data;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_mem32 *memory32_data =
+           (struct acpi_resource_mem32 *)data;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("32-Bit Memory Range Resource\n");
+       acpi_os_printf("32-Bit Memory Range Resource\n");
 
-       acpi_os_printf ("  Read%s\n",
-               ACPI_READ_WRITE_MEMORY ==
-                       memory32_data->read_write_attribute ?
-                       "/Write" : " only");
+       acpi_os_printf("  Read%s\n",
+                      ACPI_READ_WRITE_MEMORY ==
+                      memory32_data->read_write_attribute ?
+                      "/Write" : " only");
 
-       acpi_os_printf ("  Range minimum base: %08X\n",
-               memory32_data->min_base_address);
+       acpi_os_printf("  Range minimum base: %08X\n",
+                      memory32_data->min_base_address);
 
-       acpi_os_printf ("  Range maximum base: %08X\n",
-               memory32_data->max_base_address);
+       acpi_os_printf("  Range maximum base: %08X\n",
+                      memory32_data->max_base_address);
 
-       acpi_os_printf ("  Alignment: %08X\n", memory32_data->alignment);
+       acpi_os_printf("  Alignment: %08X\n", memory32_data->alignment);
 
-       acpi_os_printf ("  Range length: %08X\n", memory32_data->range_length);
+       acpi_os_printf("  Range length: %08X\n", memory32_data->range_length);
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_fixed_memory32
@@ -498,33 +439,29 @@ acpi_rs_dump_memory32 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_fixed_memory32 (
-       union acpi_resource_data            *data)
+static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data)
 {
-       struct acpi_resource_fixed_mem32    *fixed_memory32_data =
-                          (struct acpi_resource_fixed_mem32 *) data;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_fixed_mem32 *fixed_memory32_data =
+           (struct acpi_resource_fixed_mem32 *)data;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
+       acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
 
-       acpi_os_printf ("  Read%s\n",
-               ACPI_READ_WRITE_MEMORY ==
-                       fixed_memory32_data->read_write_attribute ? "/Write" : " Only");
+       acpi_os_printf("  Read%s\n",
+                      ACPI_READ_WRITE_MEMORY ==
+                      fixed_memory32_data->
+                      read_write_attribute ? "/Write" : " Only");
 
-       acpi_os_printf ("  Range base address: %08X\n",
-               fixed_memory32_data->range_base_address);
+       acpi_os_printf("  Range base address: %08X\n",
+                      fixed_memory32_data->range_base_address);
 
-       acpi_os_printf ("  Range length: %08X\n",
-               fixed_memory32_data->range_length);
+       acpi_os_printf("  Range length: %08X\n",
+                      fixed_memory32_data->range_length);
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_address16
@@ -537,134 +474,136 @@ acpi_rs_dump_fixed_memory32 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_address16 (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_address16(union acpi_resource_data *data)
 {
-       struct acpi_resource_address16 *address16_data = (struct acpi_resource_address16 *) data;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_address16 *address16_data =
+           (struct acpi_resource_address16 *)data;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("16-Bit Address Space Resource\n");
-       acpi_os_printf ("  Resource Type: ");
+       acpi_os_printf("16-Bit Address Space Resource\n");
+       acpi_os_printf("  Resource Type: ");
 
        switch (address16_data->resource_type) {
        case ACPI_MEMORY_RANGE:
 
-               acpi_os_printf ("Memory Range\n");
+               acpi_os_printf("Memory Range\n");
 
                switch (address16_data->attribute.memory.cache_attribute) {
                case ACPI_NON_CACHEABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Noncacheable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Noncacheable memory\n");
                        break;
 
                case ACPI_CACHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Cacheable memory\n");
+                       acpi_os_printf("  Type Specific: Cacheable memory\n");
                        break;
 
                case ACPI_WRITE_COMBINING_MEMORY:
-                       acpi_os_printf ("  Type Specific: Write-combining memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Write-combining memory\n");
                        break;
 
                case ACPI_PREFETCHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Prefetchable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Prefetchable memory\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid cache attribute\n");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid cache attribute\n");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: Read%s\n",
-                       ACPI_READ_WRITE_MEMORY ==
-                               address16_data->attribute.memory.read_write_attribute ?
-                               "/Write" : " Only");
+               acpi_os_printf("  Type Specific: Read%s\n",
+                              ACPI_READ_WRITE_MEMORY ==
+                              address16_data->attribute.memory.
+                              read_write_attribute ? "/Write" : " Only");
                break;
 
        case ACPI_IO_RANGE:
 
-               acpi_os_printf ("I/O Range\n");
+               acpi_os_printf("I/O Range\n");
 
                switch (address16_data->attribute.io.range_attribute) {
                case ACPI_NON_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: Non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: Non-ISA Io Addresses\n");
                        break;
 
                case ACPI_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: ISA Io Addresses\n");
+                       acpi_os_printf("  Type Specific: ISA Io Addresses\n");
                        break;
 
                case ACPI_ENTIRE_RANGE:
-                       acpi_os_printf ("  Type Specific: ISA and non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: ISA and non-ISA Io Addresses\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid range attribute\n");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid range attribute\n");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: %s Translation\n",
-                       ACPI_SPARSE_TRANSLATION ==
-                               address16_data->attribute.io.translation_attribute ?
-                               "Sparse" : "Dense");
+               acpi_os_printf("  Type Specific: %s Translation\n",
+                              ACPI_SPARSE_TRANSLATION ==
+                              address16_data->attribute.io.
+                              translation_attribute ? "Sparse" : "Dense");
                break;
 
        case ACPI_BUS_NUMBER_RANGE:
 
-               acpi_os_printf ("Bus Number Range\n");
+               acpi_os_printf("Bus Number Range\n");
                break;
 
        default:
 
-               acpi_os_printf ("0x%2.2X\n", address16_data->resource_type);
+               acpi_os_printf("0x%2.2X\n", address16_data->resource_type);
                break;
        }
 
-       acpi_os_printf ("  Resource %s\n",
-               ACPI_CONSUMER == address16_data->producer_consumer ?
-                       "Consumer" : "Producer");
+       acpi_os_printf("  Resource %s\n",
+                      ACPI_CONSUMER == address16_data->producer_consumer ?
+                      "Consumer" : "Producer");
 
-       acpi_os_printf ("  %s decode\n",
-               ACPI_SUB_DECODE == address16_data->decode ?
-                       "Subtractive" : "Positive");
+       acpi_os_printf("  %s decode\n",
+                      ACPI_SUB_DECODE == address16_data->decode ?
+                      "Subtractive" : "Positive");
 
-       acpi_os_printf ("  Min address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
-                       "" : "not");
+       acpi_os_printf("  Min address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
+                      "" : "not");
 
-       acpi_os_printf ("  Max address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
-                       "" : "not");
+       acpi_os_printf("  Max address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
+                      "" : "not");
 
-       acpi_os_printf ("  Granularity: %08X\n",
-               address16_data->granularity);
+       acpi_os_printf("  Granularity: %08X\n", address16_data->granularity);
 
-       acpi_os_printf ("  Address range min: %08X\n",
-               address16_data->min_address_range);
+       acpi_os_printf("  Address range min: %08X\n",
+                      address16_data->min_address_range);
 
-       acpi_os_printf ("  Address range max: %08X\n",
-               address16_data->max_address_range);
+       acpi_os_printf("  Address range max: %08X\n",
+                      address16_data->max_address_range);
 
-       acpi_os_printf ("  Address translation offset: %08X\n",
-               address16_data->address_translation_offset);
+       acpi_os_printf("  Address translation offset: %08X\n",
+                      address16_data->address_translation_offset);
 
-       acpi_os_printf ("  Address Length: %08X\n",
-               address16_data->address_length);
+       acpi_os_printf("  Address Length: %08X\n",
+                      address16_data->address_length);
 
        if (0xFF != address16_data->resource_source.index) {
-               acpi_os_printf ("  Resource Source Index: %X\n",
-                       address16_data->resource_source.index);
+               acpi_os_printf("  Resource Source Index: %X\n",
+                              address16_data->resource_source.index);
 
-               acpi_os_printf ("  Resource Source: %s\n",
-                       address16_data->resource_source.string_ptr);
+               acpi_os_printf("  Resource Source: %s\n",
+                              address16_data->resource_source.string_ptr);
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_address32
@@ -677,134 +616,136 @@ acpi_rs_dump_address16 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_address32 (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_address32(union acpi_resource_data *data)
 {
-       struct acpi_resource_address32 *address32_data = (struct acpi_resource_address32 *) data;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_address32 *address32_data =
+           (struct acpi_resource_address32 *)data;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("32-Bit Address Space Resource\n");
+       acpi_os_printf("32-Bit Address Space Resource\n");
 
        switch (address32_data->resource_type) {
        case ACPI_MEMORY_RANGE:
 
-               acpi_os_printf ("  Resource Type: Memory Range\n");
+               acpi_os_printf("  Resource Type: Memory Range\n");
 
                switch (address32_data->attribute.memory.cache_attribute) {
                case ACPI_NON_CACHEABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Noncacheable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Noncacheable memory\n");
                        break;
 
                case ACPI_CACHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Cacheable memory\n");
+                       acpi_os_printf("  Type Specific: Cacheable memory\n");
                        break;
 
                case ACPI_WRITE_COMBINING_MEMORY:
-                       acpi_os_printf ("  Type Specific: Write-combining memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Write-combining memory\n");
                        break;
 
                case ACPI_PREFETCHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Prefetchable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Prefetchable memory\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid cache attribute\n");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid cache attribute\n");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: Read%s\n",
-                       ACPI_READ_WRITE_MEMORY ==
-                               address32_data->attribute.memory.read_write_attribute ?
-                               "/Write" : " Only");
+               acpi_os_printf("  Type Specific: Read%s\n",
+                              ACPI_READ_WRITE_MEMORY ==
+                              address32_data->attribute.memory.
+                              read_write_attribute ? "/Write" : " Only");
                break;
 
        case ACPI_IO_RANGE:
 
-               acpi_os_printf ("  Resource Type: Io Range\n");
+               acpi_os_printf("  Resource Type: Io Range\n");
 
                switch (address32_data->attribute.io.range_attribute) {
                case ACPI_NON_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: Non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: Non-ISA Io Addresses\n");
                        break;
 
                case ACPI_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: ISA Io Addresses\n");
+                       acpi_os_printf("  Type Specific: ISA Io Addresses\n");
                        break;
 
                case ACPI_ENTIRE_RANGE:
-                       acpi_os_printf ("  Type Specific: ISA and non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: ISA and non-ISA Io Addresses\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid Range attribute");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid Range attribute");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: %s Translation\n",
-                       ACPI_SPARSE_TRANSLATION ==
-                               address32_data->attribute.io.translation_attribute ?
-                               "Sparse" : "Dense");
+               acpi_os_printf("  Type Specific: %s Translation\n",
+                              ACPI_SPARSE_TRANSLATION ==
+                              address32_data->attribute.io.
+                              translation_attribute ? "Sparse" : "Dense");
                break;
 
        case ACPI_BUS_NUMBER_RANGE:
 
-               acpi_os_printf ("  Resource Type: Bus Number Range\n");
+               acpi_os_printf("  Resource Type: Bus Number Range\n");
                break;
 
        default:
 
-               acpi_os_printf ("  Resource Type: 0x%2.2X\n",
-                       address32_data->resource_type);
+               acpi_os_printf("  Resource Type: 0x%2.2X\n",
+                              address32_data->resource_type);
                break;
        }
 
-       acpi_os_printf ("  Resource %s\n",
-               ACPI_CONSUMER == address32_data->producer_consumer ?
-                       "Consumer" : "Producer");
+       acpi_os_printf("  Resource %s\n",
+                      ACPI_CONSUMER == address32_data->producer_consumer ?
+                      "Consumer" : "Producer");
 
-       acpi_os_printf ("  %s decode\n",
-               ACPI_SUB_DECODE == address32_data->decode ?
-                       "Subtractive" : "Positive");
+       acpi_os_printf("  %s decode\n",
+                      ACPI_SUB_DECODE == address32_data->decode ?
+                      "Subtractive" : "Positive");
 
-       acpi_os_printf ("  Min address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
-                       "" : "not ");
+       acpi_os_printf("  Min address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
+                      "" : "not ");
 
-       acpi_os_printf ("  Max address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
-                       "" : "not ");
+       acpi_os_printf("  Max address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
+                      "" : "not ");
 
-       acpi_os_printf ("  Granularity: %08X\n",
-               address32_data->granularity);
+       acpi_os_printf("  Granularity: %08X\n", address32_data->granularity);
 
-       acpi_os_printf ("  Address range min: %08X\n",
-               address32_data->min_address_range);
+       acpi_os_printf("  Address range min: %08X\n",
+                      address32_data->min_address_range);
 
-       acpi_os_printf ("  Address range max: %08X\n",
-               address32_data->max_address_range);
+       acpi_os_printf("  Address range max: %08X\n",
+                      address32_data->max_address_range);
 
-       acpi_os_printf ("  Address translation offset: %08X\n",
-               address32_data->address_translation_offset);
+       acpi_os_printf("  Address translation offset: %08X\n",
+                      address32_data->address_translation_offset);
 
-       acpi_os_printf ("  Address Length: %08X\n",
-               address32_data->address_length);
+       acpi_os_printf("  Address Length: %08X\n",
+                      address32_data->address_length);
 
-       if(0xFF != address32_data->resource_source.index) {
-               acpi_os_printf ("  Resource Source Index: %X\n",
-                       address32_data->resource_source.index);
+       if (0xFF != address32_data->resource_source.index) {
+               acpi_os_printf("  Resource Source Index: %X\n",
+                              address32_data->resource_source.index);
 
-               acpi_os_printf ("  Resource Source: %s\n",
-                       address32_data->resource_source.string_ptr);
+               acpi_os_printf("  Resource Source: %s\n",
+                              address32_data->resource_source.string_ptr);
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_address64
@@ -817,137 +758,142 @@ acpi_rs_dump_address32 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_address64 (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_address64(union acpi_resource_data *data)
 {
-       struct acpi_resource_address64 *address64_data = (struct acpi_resource_address64 *) data;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_address64 *address64_data =
+           (struct acpi_resource_address64 *)data;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("64-Bit Address Space Resource\n");
+       acpi_os_printf("64-Bit Address Space Resource\n");
 
        switch (address64_data->resource_type) {
        case ACPI_MEMORY_RANGE:
 
-               acpi_os_printf ("  Resource Type: Memory Range\n");
+               acpi_os_printf("  Resource Type: Memory Range\n");
 
                switch (address64_data->attribute.memory.cache_attribute) {
                case ACPI_NON_CACHEABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Noncacheable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Noncacheable memory\n");
                        break;
 
                case ACPI_CACHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Cacheable memory\n");
+                       acpi_os_printf("  Type Specific: Cacheable memory\n");
                        break;
 
                case ACPI_WRITE_COMBINING_MEMORY:
-                       acpi_os_printf ("  Type Specific: Write-combining memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Write-combining memory\n");
                        break;
 
                case ACPI_PREFETCHABLE_MEMORY:
-                       acpi_os_printf ("  Type Specific: Prefetchable memory\n");
+                       acpi_os_printf
+                           ("  Type Specific: Prefetchable memory\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid cache attribute\n");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid cache attribute\n");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: Read%s\n",
-                       ACPI_READ_WRITE_MEMORY ==
-                               address64_data->attribute.memory.read_write_attribute ?
-                               "/Write" : " Only");
+               acpi_os_printf("  Type Specific: Read%s\n",
+                              ACPI_READ_WRITE_MEMORY ==
+                              address64_data->attribute.memory.
+                              read_write_attribute ? "/Write" : " Only");
                break;
 
        case ACPI_IO_RANGE:
 
-               acpi_os_printf ("  Resource Type: Io Range\n");
+               acpi_os_printf("  Resource Type: Io Range\n");
 
                switch (address64_data->attribute.io.range_attribute) {
                case ACPI_NON_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: Non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: Non-ISA Io Addresses\n");
                        break;
 
                case ACPI_ISA_ONLY_RANGES:
-                       acpi_os_printf ("  Type Specific: ISA Io Addresses\n");
+                       acpi_os_printf("  Type Specific: ISA Io Addresses\n");
                        break;
 
                case ACPI_ENTIRE_RANGE:
-                       acpi_os_printf ("  Type Specific: ISA and non-ISA Io Addresses\n");
+                       acpi_os_printf
+                           ("  Type Specific: ISA and non-ISA Io Addresses\n");
                        break;
 
                default:
-                       acpi_os_printf ("  Type Specific: Invalid Range attribute");
+                       acpi_os_printf
+                           ("  Type Specific: Invalid Range attribute");
                        break;
                }
 
-               acpi_os_printf ("  Type Specific: %s Translation\n",
-                       ACPI_SPARSE_TRANSLATION ==
-                               address64_data->attribute.io.translation_attribute ?
-                               "Sparse" : "Dense");
+               acpi_os_printf("  Type Specific: %s Translation\n",
+                              ACPI_SPARSE_TRANSLATION ==
+                              address64_data->attribute.io.
+                              translation_attribute ? "Sparse" : "Dense");
                break;
 
        case ACPI_BUS_NUMBER_RANGE:
 
-               acpi_os_printf ("  Resource Type: Bus Number Range\n");
+               acpi_os_printf("  Resource Type: Bus Number Range\n");
                break;
 
        default:
 
-               acpi_os_printf ("  Resource Type: 0x%2.2X\n",
-                       address64_data->resource_type);
+               acpi_os_printf("  Resource Type: 0x%2.2X\n",
+                              address64_data->resource_type);
                break;
        }
 
-       acpi_os_printf ("  Resource %s\n",
-               ACPI_CONSUMER == address64_data->producer_consumer ?
-                       "Consumer" : "Producer");
+       acpi_os_printf("  Resource %s\n",
+                      ACPI_CONSUMER == address64_data->producer_consumer ?
+                      "Consumer" : "Producer");
 
-       acpi_os_printf ("  %s decode\n",
-               ACPI_SUB_DECODE == address64_data->decode ?
-                       "Subtractive" : "Positive");
+       acpi_os_printf("  %s decode\n",
+                      ACPI_SUB_DECODE == address64_data->decode ?
+                      "Subtractive" : "Positive");
 
-       acpi_os_printf ("  Min address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
-                       "" : "not ");
+       acpi_os_printf("  Min address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
+                      "" : "not ");
 
-       acpi_os_printf ("  Max address is %s fixed\n",
-               ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
-                       "" : "not ");
+       acpi_os_printf("  Max address is %s fixed\n",
+                      ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
+                      "" : "not ");
 
-       acpi_os_printf ("  Granularity: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->granularity));
+       acpi_os_printf("  Granularity: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->granularity));
 
-       acpi_os_printf ("  Address range min: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->min_address_range));
+       acpi_os_printf("  Address range min: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->min_address_range));
 
-       acpi_os_printf ("  Address range max: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->max_address_range));
+       acpi_os_printf("  Address range max: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->max_address_range));
 
-       acpi_os_printf ("  Address translation offset: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->address_translation_offset));
+       acpi_os_printf("  Address translation offset: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->
+                                         address_translation_offset));
 
-       acpi_os_printf ("  Address Length: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->address_length));
+       acpi_os_printf("  Address Length: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->address_length));
 
-       acpi_os_printf ("  Type Specific Attributes: %8.8X%8.8X\n",
-               ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes));
+       acpi_os_printf("  Type Specific Attributes: %8.8X%8.8X\n",
+                      ACPI_FORMAT_UINT64(address64_data->
+                                         type_specific_attributes));
 
        if (0xFF != address64_data->resource_source.index) {
-               acpi_os_printf ("  Resource Source Index: %X\n",
-                       address64_data->resource_source.index);
+               acpi_os_printf("  Resource Source Index: %X\n",
+                              address64_data->resource_source.index);
 
-               acpi_os_printf ("  Resource Source: %s\n",
-                       address64_data->resource_source.string_ptr);
+               acpi_os_printf("  Resource Source: %s\n",
+                              address64_data->resource_source.string_ptr);
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_extended_irq
@@ -960,55 +906,52 @@ acpi_rs_dump_address64 (
  *
  ******************************************************************************/
 
-static void
-acpi_rs_dump_extended_irq (
-       union acpi_resource_data        *data)
+static void acpi_rs_dump_extended_irq(union acpi_resource_data *data)
 {
-       struct acpi_resource_ext_irq    *ext_irq_data = (struct acpi_resource_ext_irq *) data;
-       u8                              index = 0;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       struct acpi_resource_ext_irq *ext_irq_data =
+           (struct acpi_resource_ext_irq *)data;
+       u8 index = 0;
 
+       ACPI_FUNCTION_ENTRY();
 
-       acpi_os_printf ("Extended IRQ Resource\n");
+       acpi_os_printf("Extended IRQ Resource\n");
 
-       acpi_os_printf ("  Resource %s\n",
-               ACPI_CONSUMER == ext_irq_data->producer_consumer ?
-                       "Consumer" : "Producer");
+       acpi_os_printf("  Resource %s\n",
+                      ACPI_CONSUMER == ext_irq_data->producer_consumer ?
+                      "Consumer" : "Producer");
 
-       acpi_os_printf ("  %s\n",
-               ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
-                       "Level" : "Edge");
+       acpi_os_printf("  %s\n",
+                      ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
+                      "Level" : "Edge");
 
-       acpi_os_printf ("  Active %s\n",
-               ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
-                       "low" : "high");
+       acpi_os_printf("  Active %s\n",
+                      ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
+                      "low" : "high");
 
-       acpi_os_printf ("  %s\n",
-               ACPI_SHARED == ext_irq_data->shared_exclusive ?
-                       "Shared" : "Exclusive");
+       acpi_os_printf("  %s\n",
+                      ACPI_SHARED == ext_irq_data->shared_exclusive ?
+                      "Shared" : "Exclusive");
 
-       acpi_os_printf ("  Interrupts : %X ( ", ext_irq_data->number_of_interrupts);
+       acpi_os_printf("  Interrupts : %X ( ",
+                      ext_irq_data->number_of_interrupts);
 
        for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
-               acpi_os_printf ("%X ", ext_irq_data->interrupts[index]);
+               acpi_os_printf("%X ", ext_irq_data->interrupts[index]);
        }
 
-       acpi_os_printf (")\n");
+       acpi_os_printf(")\n");
 
-       if(0xFF != ext_irq_data->resource_source.index) {
-               acpi_os_printf ("  Resource Source Index: %X",
-                       ext_irq_data->resource_source.index);
+       if (0xFF != ext_irq_data->resource_source.index) {
+               acpi_os_printf("  Resource Source Index: %X",
+                              ext_irq_data->resource_source.index);
 
-               acpi_os_printf ("  Resource Source: %s",
-                       ext_irq_data->resource_source.string_ptr);
+               acpi_os_printf("  Resource Source: %s",
+                              ext_irq_data->resource_source.string_ptr);
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dump_resource_list
@@ -1021,92 +964,91 @@ acpi_rs_dump_extended_irq (
  *
  ******************************************************************************/
 
-void
-acpi_rs_dump_resource_list (
-       struct acpi_resource        *resource)
+void acpi_rs_dump_resource_list(struct acpi_resource *resource)
 {
-       u8                          count = 0;
-       u8                          done = FALSE;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       u8 count = 0;
+       u8 done = FALSE;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
                while (!done) {
-                       acpi_os_printf ("Resource structure %X.\n", count++);
+                       acpi_os_printf("Resource structure %X.\n", count++);
 
                        switch (resource->id) {
                        case ACPI_RSTYPE_IRQ:
-                               acpi_rs_dump_irq (&resource->data);
+                               acpi_rs_dump_irq(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_DMA:
-                               acpi_rs_dump_dma (&resource->data);
+                               acpi_rs_dump_dma(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_START_DPF:
-                               acpi_rs_dump_start_depend_fns (&resource->data);
+                               acpi_rs_dump_start_depend_fns(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_END_DPF:
-                               acpi_os_printf ("end_dependent_functions Resource\n");
-                               /* acpi_rs_dump_end_dependent_functions (Resource->Data);*/
+                               acpi_os_printf
+                                   ("end_dependent_functions Resource\n");
+                               /* acpi_rs_dump_end_dependent_functions (Resource->Data); */
                                break;
 
                        case ACPI_RSTYPE_IO:
-                               acpi_rs_dump_io (&resource->data);
+                               acpi_rs_dump_io(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_FIXED_IO:
-                               acpi_rs_dump_fixed_io (&resource->data);
+                               acpi_rs_dump_fixed_io(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_VENDOR:
-                               acpi_rs_dump_vendor_specific (&resource->data);
+                               acpi_rs_dump_vendor_specific(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_END_TAG:
-                               /*rs_dump_end_tag (Resource->Data);*/
-                               acpi_os_printf ("end_tag Resource\n");
+                               /*rs_dump_end_tag (Resource->Data); */
+                               acpi_os_printf("end_tag Resource\n");
                                done = TRUE;
                                break;
 
                        case ACPI_RSTYPE_MEM24:
-                               acpi_rs_dump_memory24 (&resource->data);
+                               acpi_rs_dump_memory24(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_MEM32:
-                               acpi_rs_dump_memory32 (&resource->data);
+                               acpi_rs_dump_memory32(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_FIXED_MEM32:
-                               acpi_rs_dump_fixed_memory32 (&resource->data);
+                               acpi_rs_dump_fixed_memory32(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_ADDRESS16:
-                               acpi_rs_dump_address16 (&resource->data);
+                               acpi_rs_dump_address16(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_ADDRESS32:
-                               acpi_rs_dump_address32 (&resource->data);
+                               acpi_rs_dump_address32(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_ADDRESS64:
-                               acpi_rs_dump_address64 (&resource->data);
+                               acpi_rs_dump_address64(&resource->data);
                                break;
 
                        case ACPI_RSTYPE_EXT_IRQ:
-                               acpi_rs_dump_extended_irq (&resource->data);
+                               acpi_rs_dump_extended_irq(&resource->data);
                                break;
 
                        default:
-                               acpi_os_printf ("Invalid resource type\n");
+                               acpi_os_printf("Invalid resource type\n");
                                break;
 
                        }
 
-                       resource = ACPI_PTR_ADD (struct acpi_resource, resource, resource->length);
+                       resource =
+                           ACPI_PTR_ADD(struct acpi_resource, resource,
+                                        resource->length);
                }
        }
 
@@ -1125,36 +1067,38 @@ acpi_rs_dump_resource_list (
  *
  ******************************************************************************/
 
-void
-acpi_rs_dump_irq_list (
-       u8                              *route_table)
+void acpi_rs_dump_irq_list(u8 * route_table)
 {
-       u8                              *buffer = route_table;
-       u8                              count = 0;
-       u8                              done = FALSE;
-       struct acpi_pci_routing_table   *prt_element;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       u8 *buffer = route_table;
+       u8 count = 0;
+       u8 done = FALSE;
+       struct acpi_pci_routing_table *prt_element;
 
+       ACPI_FUNCTION_ENTRY();
 
        if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
-               prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
+               prt_element =
+                   ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
 
                while (!done) {
-                       acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
+                       acpi_os_printf("PCI IRQ Routing Table structure %X.\n",
+                                      count++);
 
-                       acpi_os_printf ("  Address: %8.8X%8.8X\n",
-                               ACPI_FORMAT_UINT64 (prt_element->address));
+                       acpi_os_printf("  Address: %8.8X%8.8X\n",
+                                      ACPI_FORMAT_UINT64(prt_element->
+                                                         address));
 
-                       acpi_os_printf ("  Pin: %X\n", prt_element->pin);
+                       acpi_os_printf("  Pin: %X\n", prt_element->pin);
 
-                       acpi_os_printf ("  Source: %s\n", prt_element->source);
+                       acpi_os_printf("  Source: %s\n", prt_element->source);
 
-                       acpi_os_printf ("  source_index: %X\n", prt_element->source_index);
+                       acpi_os_printf("  source_index: %X\n",
+                                      prt_element->source_index);
 
                        buffer += prt_element->length;
-                       prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
+                       prt_element =
+                           ACPI_CAST_PTR(struct acpi_pci_routing_table,
+                                         buffer);
                        if (0 == prt_element->length) {
                                done = TRUE;
                        }
@@ -1165,4 +1109,3 @@ acpi_rs_dump_irq_list (
 }
 
 #endif
-
index 23a4d149fac88d4b62534636e64a439ce55f3a08..d53bbe89e8514dfd17ad6fe3fe8084366698e02c 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsio")
-
+ACPI_MODULE_NAME("rsio")
 
 /*******************************************************************************
  *
  *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_io_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_io_resource(u8 * byte_stream_buffer,
+                   acpi_size * bytes_consumed,
+                   u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_io);
-
-
-       ACPI_FUNCTION_TRACE ("rs_io_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
 
+       ACPI_FUNCTION_TRACE("rs_io_resource");
 
        /* The number of bytes consumed are Constant */
 
@@ -104,14 +96,14 @@ acpi_rs_io_resource (
        /* Check min_base Address */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        output_struct->data.io.min_base_address = temp16;
 
        /* Check max_base Address */
 
        buffer += 2;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        output_struct->data.io.max_base_address = temp16;
 
@@ -136,10 +128,9 @@ acpi_rs_io_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_fixed_io_resource
@@ -162,22 +153,18 @@ acpi_rs_io_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_fixed_io_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
+                         acpi_size * bytes_consumed,
+                         u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_fixed_io);
-
-
-       ACPI_FUNCTION_TRACE ("rs_fixed_io_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
 
+       ACPI_FUNCTION_TRACE("rs_fixed_io_resource");
 
        /* The number of bytes consumed are Constant */
 
@@ -188,7 +175,7 @@ acpi_rs_fixed_io_resource (
        /* Check Range Base Address */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        output_struct->data.fixed_io.base_address = temp16;
 
@@ -206,10 +193,9 @@ acpi_rs_fixed_io_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_io_stream
@@ -227,18 +213,14 @@ acpi_rs_fixed_io_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_io_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_io_stream(struct acpi_resource *linked_list,
+                 u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_io_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_io_stream");
 
        /* The descriptor field is static */
 
@@ -256,14 +238,14 @@ acpi_rs_io_stream (
 
        temp16 = (u16) linked_list->data.io.min_base_address;
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the Range maximum base address */
 
        temp16 = (u16) linked_list->data.io.max_base_address;
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the base alignment */
@@ -282,11 +264,10 @@ acpi_rs_io_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_fixed_io_stream
@@ -304,18 +285,14 @@ acpi_rs_io_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_fixed_io_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
+                       u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_fixed_io_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
 
        /* The descriptor field is static */
 
@@ -327,7 +304,7 @@ acpi_rs_fixed_io_stream (
 
        temp16 = (u16) linked_list->data.fixed_io.base_address;
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the range length */
@@ -339,11 +316,10 @@ acpi_rs_fixed_io_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dma_resource
@@ -366,23 +342,18 @@ acpi_rs_fixed_io_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_dma_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_dma_resource(u8 * byte_stream_buffer,
+                    acpi_size * bytes_consumed,
+                    u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u8                              temp8 = 0;
-       u8                              index;
-       u8                              i;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_dma);
-
-
-       ACPI_FUNCTION_TRACE ("rs_dma_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u8 temp8 = 0;
+       u8 index;
+       u8 i;
+       acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
 
+       ACPI_FUNCTION_TRACE("rs_dma_resource");
 
        /* The number of bytes consumed are Constant */
 
@@ -422,9 +393,9 @@ acpi_rs_dma_resource (
        output_struct->data.dma.transfer = temp8 & 0x03;
 
        if (0x03 == output_struct->data.dma.transfer) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Invalid DMA.Transfer preference (3)\n"));
-               return_ACPI_STATUS (AE_BAD_DATA);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid DMA.Transfer preference (3)\n"));
+               return_ACPI_STATUS(AE_BAD_DATA);
        }
 
        /* Get bus master preference (Bit[2]) */
@@ -442,10 +413,9 @@ acpi_rs_dma_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_dma_stream
@@ -463,19 +433,15 @@ acpi_rs_dma_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_dma_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_dma_stream(struct acpi_resource *linked_list,
+                  u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              index;
-
-
-       ACPI_FUNCTION_TRACE ("rs_dma_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 index;
 
+       ACPI_FUNCTION_TRACE("rs_dma_stream");
 
        /* The descriptor field is static */
 
@@ -486,8 +452,7 @@ acpi_rs_dma_stream (
        /* Loop through all of the Channels and set the mask bits */
 
        for (index = 0;
-                index < linked_list->data.dma.number_of_channels;
-                index++) {
+            index < linked_list->data.dma.number_of_channels; index++) {
                temp16 = (u16) linked_list->data.dma.channels[index];
                temp8 |= 0x1 << temp16;
        }
@@ -506,7 +471,6 @@ acpi_rs_dma_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
-
index 8a2b630be45bc5b7a3aca1b926bccd58e6ed5f91..56043fee96cb8885f3a6d25ebf96b55206481545 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsirq")
-
+ACPI_MODULE_NAME("rsirq")
 
 /*******************************************************************************
  *
  *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_irq_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_irq_resource(u8 * byte_stream_buffer,
+                    acpi_size * bytes_consumed,
+                    u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              index;
-       u8                              i;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_irq);
-
-
-       ACPI_FUNCTION_TRACE ("rs_irq_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 index;
+       u8 i;
+       acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq);
 
+       ACPI_FUNCTION_TRACE("rs_irq_resource");
 
        /*
         * The number of bytes consumed are contained in the descriptor
@@ -101,7 +93,7 @@ acpi_rs_irq_resource (
        /* Point to the 16-bits of Bytes 1 and 2 */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        output_struct->data.irq.number_of_interrupts = 0;
 
@@ -132,14 +124,18 @@ acpi_rs_irq_resource (
                /* Check for HE, LL interrupts */
 
                switch (temp8 & 0x09) {
-               case 0x01: /* HE */
-                       output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE;
-                       output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH;
+               case 0x01:      /* HE */
+                       output_struct->data.irq.edge_level =
+                           ACPI_EDGE_SENSITIVE;
+                       output_struct->data.irq.active_high_low =
+                           ACPI_ACTIVE_HIGH;
                        break;
 
-               case 0x08: /* LL */
-                       output_struct->data.irq.edge_level = ACPI_LEVEL_SENSITIVE;
-                       output_struct->data.irq.active_high_low = ACPI_ACTIVE_LOW;
+               case 0x08:      /* LL */
+                       output_struct->data.irq.edge_level =
+                           ACPI_LEVEL_SENSITIVE;
+                       output_struct->data.irq.active_high_low =
+                           ACPI_ACTIVE_LOW;
                        break;
 
                default:
@@ -148,17 +144,16 @@ acpi_rs_irq_resource (
                         * are allowed (ACPI spec, section "IRQ Format")
                         * so 0x00 and 0x09 are illegal.
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Invalid interrupt polarity/trigger in resource list, %X\n",
-                               temp8));
-                       return_ACPI_STATUS (AE_BAD_DATA);
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid interrupt polarity/trigger in resource list, %X\n",
+                                         temp8));
+                       return_ACPI_STATUS(AE_BAD_DATA);
                }
 
                /* Check for sharable */
 
                output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01;
-       }
-       else {
+       } else {
                /*
                 * Assume Edge Sensitive, Active High, Non-Sharable
                 * per ACPI Specification
@@ -175,10 +170,9 @@ acpi_rs_irq_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_irq_stream
@@ -196,32 +190,27 @@ acpi_rs_irq_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_irq_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_irq_stream(struct acpi_resource *linked_list,
+                  u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              index;
-       u8                              IRqinfo_byte_needed;
-
-
-       ACPI_FUNCTION_TRACE ("rs_irq_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 index;
+       u8 IRqinfo_byte_needed;
 
+       ACPI_FUNCTION_TRACE("rs_irq_stream");
 
        /*
         * The descriptor field is set based upon whether a third byte is
         * needed to contain the IRQ Information.
         */
        if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
-               ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
-               ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
+           ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
+           ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
                *buffer = 0x22;
                IRqinfo_byte_needed = FALSE;
-       }
-       else {
+       } else {
                *buffer = 0x23;
                IRqinfo_byte_needed = TRUE;
        }
@@ -231,14 +220,13 @@ acpi_rs_irq_stream (
 
        /* Loop through all of the interrupts and set the mask bits */
 
-       for(index = 0;
-               index < linked_list->data.irq.number_of_interrupts;
-               index++) {
+       for (index = 0;
+            index < linked_list->data.irq.number_of_interrupts; index++) {
                temp8 = (u8) linked_list->data.irq.interrupts[index];
                temp16 |= 0x1 << temp8;
        }
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the IRQ Info byte if needed. */
@@ -246,13 +234,12 @@ acpi_rs_irq_stream (
        if (IRqinfo_byte_needed) {
                temp8 = 0;
                temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
-                                0x01) << 4);
+                              0x01) << 4);
 
                if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
-                       ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
+                   ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
                        temp8 |= 0x08;
-               }
-               else {
+               } else {
                        temp8 |= 0x01;
                }
 
@@ -262,11 +249,10 @@ acpi_rs_irq_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_extended_irq_resource
@@ -289,34 +275,30 @@ acpi_rs_irq_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_extended_irq_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
+                             acpi_size * bytes_consumed,
+                             u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              *temp_ptr;
-       u8                              index;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_ext_irq);
-
-
-       ACPI_FUNCTION_TRACE ("rs_extended_irq_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 *temp_ptr;
+       u8 index;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq);
 
+       ACPI_FUNCTION_TRACE("rs_extended_irq_resource");
 
-       /* Point past the Descriptor to get the number of bytes consumed */
+       /* Get the Descriptor Length field */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        /* Validate minimum descriptor length */
 
        if (temp16 < 6) {
-               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
        }
 
        *bytes_consumed = temp16 + 3;
@@ -338,7 +320,7 @@ acpi_rs_extended_irq_resource (
         * - Edge/Level are defined opposite in the table vs the headers
         */
        output_struct->data.extended_irq.edge_level =
-               (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
+           (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
 
        /* Check Interrupt Polarity */
 
@@ -356,7 +338,7 @@ acpi_rs_extended_irq_resource (
        /* Must have at least one IRQ */
 
        if (temp8 < 1) {
-               return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+               return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
        }
 
        output_struct->data.extended_irq.number_of_interrupts = temp8;
@@ -374,8 +356,8 @@ acpi_rs_extended_irq_resource (
        /* Cycle through every IRQ in the table */
 
        for (index = 0; index < temp8; index++) {
-               ACPI_MOVE_32_TO_32 (
-                       &output_struct->data.extended_irq.interrupts[index], buffer);
+               ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq.
+                                  interrupts[index], buffer);
 
                /* Point to the next IRQ */
 
@@ -393,12 +375,13 @@ acpi_rs_extended_irq_resource (
         * we add 1 to the length.
         */
        if (*bytes_consumed >
-               ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) +
-               (5 + 1)) {
+           ((acpi_size) output_struct->data.extended_irq.number_of_interrupts *
+            4) + (5 + 1)) {
                /* Dereference the Index */
 
                temp8 = *buffer;
-               output_struct->data.extended_irq.resource_source.index = (u32) temp8;
+               output_struct->data.extended_irq.resource_source.index =
+                   (u32) temp8;
 
                /* Point to the String */
 
@@ -407,15 +390,15 @@ acpi_rs_extended_irq_resource (
                /* Point the String pointer to the end of this structure. */
 
                output_struct->data.extended_irq.resource_source.string_ptr =
-                               (char *)((char *) output_struct + struct_size);
+                   (char *)((char *)output_struct + struct_size);
 
                temp_ptr = (u8 *)
-                       output_struct->data.extended_irq.resource_source.string_ptr;
+                   output_struct->data.extended_irq.resource_source.string_ptr;
 
                /* Copy the string into the buffer */
 
                index = 0;
-               while (0x00 != *buffer) {
+               while (*buffer) {
                        *temp_ptr = *buffer;
 
                        temp_ptr += 1;
@@ -425,8 +408,9 @@ acpi_rs_extended_irq_resource (
 
                /* Add the terminating null */
 
-               *temp_ptr = 0x00;
-               output_struct->data.extended_irq.resource_source.string_length = index + 1;
+               *temp_ptr = 0;
+               output_struct->data.extended_irq.resource_source.string_length =
+                   index + 1;
 
                /*
                 * In order for the struct_size to fall on a 32-bit boundary,
@@ -434,12 +418,13 @@ acpi_rs_extended_irq_resource (
                 * struct_size to the next 32-bit boundary.
                 */
                temp8 = (u8) (index + 1);
-               struct_size += ACPI_ROUND_UP_to_32_bITS (temp8);
-       }
-       else {
-               output_struct->data.extended_irq.resource_source.index = 0x00;
-               output_struct->data.extended_irq.resource_source.string_length = 0;
-               output_struct->data.extended_irq.resource_source.string_ptr = NULL;
+               struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
+       } else {
+               output_struct->data.extended_irq.resource_source.index = 0;
+               output_struct->data.extended_irq.resource_source.string_length =
+                   0;
+               output_struct->data.extended_irq.resource_source.string_ptr =
+                   NULL;
        }
 
        /* Set the Length parameter */
@@ -449,10 +434,9 @@ acpi_rs_extended_irq_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_extended_irq_stream
@@ -470,35 +454,31 @@ acpi_rs_extended_irq_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_extended_irq_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
+                           u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             *length_field;
-       u8                              temp8 = 0;
-       u8                              index;
-       char                            *temp_pointer = NULL;
-
-
-       ACPI_FUNCTION_TRACE ("rs_extended_irq_stream");
+       u8 *buffer = *output_buffer;
+       u16 *length_field;
+       u8 temp8 = 0;
+       u8 index;
 
+       ACPI_FUNCTION_TRACE("rs_extended_irq_stream");
 
-       /* The descriptor field is static */
+       /* Set the Descriptor Type field */
 
-       *buffer = 0x89;
+       *buffer = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
        buffer += 1;
 
-       /* Set a pointer to the Length field - to be filled in later */
+       /* Save a pointer to the Length field - to be filled in later */
 
-       length_field = ACPI_CAST_PTR (u16, buffer);
+       length_field = ACPI_CAST_PTR(u16, buffer);
        buffer += 2;
 
        /* Set the Interrupt vector flags */
 
-       temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01);
-       temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
+       temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01);
+       temp8 |=
+           ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
 
        /*
         * Set the Interrupt Mode
@@ -527,43 +507,46 @@ acpi_rs_extended_irq_stream (
        *buffer = temp8;
        buffer += 1;
 
-       for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts;
-                index++) {
-               ACPI_MOVE_32_TO_32 (buffer,
-                                 &linked_list->data.extended_irq.interrupts[index]);
+       for (index = 0;
+            index < linked_list->data.extended_irq.number_of_interrupts;
+            index++) {
+               ACPI_MOVE_32_TO_32(buffer,
+                                  &linked_list->data.extended_irq.
+                                  interrupts[index]);
                buffer += 4;
        }
 
        /* Resource Source Index and Resource Source are optional */
 
        if (0 != linked_list->data.extended_irq.resource_source.string_length) {
-               *buffer = (u8) linked_list->data.extended_irq.resource_source.index;
+               *buffer =
+                   (u8) linked_list->data.extended_irq.resource_source.index;
                buffer += 1;
 
-               temp_pointer = (char *) buffer;
-
                /* Copy the string */
 
-               ACPI_STRCPY (temp_pointer,
-                       linked_list->data.extended_irq.resource_source.string_ptr);
+               ACPI_STRCPY((char *)buffer,
+                           linked_list->data.extended_irq.resource_source.
+                           string_ptr);
 
                /*
-                * Buffer needs to be set to the length of the sting + one for the
+                * Buffer needs to be set to the length of the string + one for the
                 * terminating null
                 */
-               buffer += (acpi_size) (ACPI_STRLEN (
-                       linked_list->data.extended_irq.resource_source.string_ptr) + 1);
+               buffer +=
+                   (acpi_size) (ACPI_STRLEN
+                                (linked_list->data.extended_irq.
+                                 resource_source.string_ptr) + 1);
        }
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
 
        /*
         * Set the length field to the number of bytes consumed
         * minus the header size (3 bytes)
         */
        *length_field = (u16) (*bytes_consumed - 3);
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index db7bcb4e60e32f7e09a1c7625b25b5a387b80e6f..103eb31c284e5070d63fcc99bd111bf1e6c9b606 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rslist")
-
+ACPI_MODULE_NAME("rslist")
 
 /*******************************************************************************
  *
  *              a resource descriptor.
  *
  ******************************************************************************/
-
-u8
-acpi_rs_get_resource_type (
-       u8                              resource_start_byte)
+u8 acpi_rs_get_resource_type(u8 resource_start_byte)
 {
 
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        /* Determine if this is a small or large resource */
 
@@ -79,14 +73,12 @@ acpi_rs_get_resource_type (
 
                return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
 
-
        case ACPI_RDESC_TYPE_LARGE:
 
                /* Large Resource Type -- All bits are valid */
 
                return (resource_start_byte);
 
-
        default:
                /* Invalid type */
                break;
@@ -95,7 +87,6 @@ acpi_rs_get_resource_type (
        return (0xFF);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_byte_stream_to_list
@@ -113,176 +104,189 @@ acpi_rs_get_resource_type (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_byte_stream_to_list (
-       u8                              *byte_stream_buffer,
-       u32                             byte_stream_buffer_length,
-       u8                              *output_buffer)
+acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
+                           u32 byte_stream_buffer_length, u8 * output_buffer)
 {
-       acpi_status                     status;
-       acpi_size                       bytes_parsed = 0;
-       u8                              resource_type = 0;
-       acpi_size                       bytes_consumed = 0;
-       u8                              *buffer = output_buffer;
-       acpi_size                       structure_size = 0;
-       u8                              end_tag_processed = FALSE;
-       struct acpi_resource            *resource;
-
-       ACPI_FUNCTION_TRACE ("rs_byte_stream_to_list");
-
-
-       while (bytes_parsed < byte_stream_buffer_length &&
-                       !end_tag_processed) {
+       acpi_status status;
+       acpi_size bytes_parsed = 0;
+       u8 resource_type = 0;
+       acpi_size bytes_consumed = 0;
+       u8 *buffer = output_buffer;
+       acpi_size structure_size = 0;
+       u8 end_tag_processed = FALSE;
+       struct acpi_resource *resource;
+
+       ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
+
+       while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) {
                /* The next byte in the stream is the resource type */
 
-               resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
+               resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
 
                switch (resource_type) {
                case ACPI_RDESC_TYPE_MEMORY_24:
                        /*
                         * 24-Bit Memory Resource
                         */
-                       status = acpi_rs_memory24_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_memory24_resource(byte_stream_buffer,
+                                                          &bytes_consumed,
+                                                          &buffer,
+                                                          &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_LARGE_VENDOR:
                        /*
                         * Vendor Defined Resource
                         */
-                       status = acpi_rs_vendor_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_vendor_resource(byte_stream_buffer,
+                                                        &bytes_consumed,
+                                                        &buffer,
+                                                        &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_MEMORY_32:
                        /*
                         * 32-Bit Memory Range Resource
                         */
-                       status = acpi_rs_memory32_range_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status =
+                           acpi_rs_memory32_range_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
                        /*
                         * 32-Bit Fixed Memory Resource
                         */
-                       status = acpi_rs_fixed_memory32_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status =
+                           acpi_rs_fixed_memory32_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
                case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
                        /*
                         * 64-Bit Address Resource
                         */
-                       status = acpi_rs_address64_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_address64_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
                        /*
                         * 32-Bit Address Resource
                         */
-                       status = acpi_rs_address32_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_address32_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
                        /*
                         * 16-Bit Address Resource
                         */
-                       status = acpi_rs_address16_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_address16_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
                        /*
                         * Extended IRQ
                         */
-                       status = acpi_rs_extended_irq_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status =
+                           acpi_rs_extended_irq_resource(byte_stream_buffer,
+                                                         &bytes_consumed,
+                                                         &buffer,
+                                                         &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_IRQ_FORMAT:
                        /*
                         * IRQ Resource
                         */
-                       status = acpi_rs_irq_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_irq_resource(byte_stream_buffer,
+                                                     &bytes_consumed, &buffer,
+                                                     &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_DMA_FORMAT:
                        /*
                         * DMA Resource
                         */
-                       status = acpi_rs_dma_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_dma_resource(byte_stream_buffer,
+                                                     &bytes_consumed, &buffer,
+                                                     &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_START_DEPENDENT:
                        /*
                         * Start Dependent Functions Resource
                         */
-                       status = acpi_rs_start_depend_fns_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status =
+                           acpi_rs_start_depend_fns_resource
+                           (byte_stream_buffer, &bytes_consumed, &buffer,
+                            &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_END_DEPENDENT:
                        /*
                         * End Dependent Functions Resource
                         */
-                       status = acpi_rs_end_depend_fns_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status =
+                           acpi_rs_end_depend_fns_resource(byte_stream_buffer,
+                                                           &bytes_consumed,
+                                                           &buffer,
+                                                           &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_IO_PORT:
                        /*
                         * IO Port Resource
                         */
-                       status = acpi_rs_io_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_io_resource(byte_stream_buffer,
+                                                    &bytes_consumed, &buffer,
+                                                    &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_FIXED_IO_PORT:
                        /*
                         * Fixed IO Port Resource
                         */
-                       status = acpi_rs_fixed_io_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_fixed_io_resource(byte_stream_buffer,
+                                                          &bytes_consumed,
+                                                          &buffer,
+                                                          &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_SMALL_VENDOR:
                        /*
                         * Vendor Specific Resource
                         */
-                       status = acpi_rs_vendor_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_vendor_resource(byte_stream_buffer,
+                                                        &bytes_consumed,
+                                                        &buffer,
+                                                        &structure_size);
                        break;
 
-
                case ACPI_RDESC_TYPE_END_TAG:
                        /*
                         * End Tag
                         */
                        end_tag_processed = TRUE;
-                       status = acpi_rs_end_tag_resource (byte_stream_buffer,
-                                        &bytes_consumed, &buffer, &structure_size);
+                       status = acpi_rs_end_tag_resource(byte_stream_buffer,
+                                                         &bytes_consumed,
+                                                         &buffer,
+                                                         &structure_size);
                        break;
 
-
                default:
                        /*
                         * Invalid/Unknown resource type
@@ -291,8 +295,8 @@ acpi_rs_byte_stream_to_list (
                        break;
                }
 
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Update the return value and counter */
@@ -305,21 +309,21 @@ acpi_rs_byte_stream_to_list (
 
                /* Set the Buffer to the next structure */
 
-               resource = ACPI_CAST_PTR (struct acpi_resource, buffer);
-               resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length);
-               buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size);
+               resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
+               resource->length =
+                   (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
+               buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
        }
 
        /* Check the reason for exiting the while loop */
 
        if (!end_tag_processed) {
-               return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+               return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_list_to_byte_stream
@@ -342,19 +346,16 @@ acpi_rs_byte_stream_to_list (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_list_to_byte_stream (
-       struct acpi_resource            *linked_list,
-       acpi_size                       byte_stream_size_needed,
-       u8                              *output_buffer)
+acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
+                           acpi_size byte_stream_size_needed,
+                           u8 * output_buffer)
 {
-       acpi_status                     status;
-       u8                              *buffer = output_buffer;
-       acpi_size                       bytes_consumed = 0;
-       u8                              done = FALSE;
-
-
-       ACPI_FUNCTION_TRACE ("rs_list_to_byte_stream");
+       acpi_status status;
+       u8 *buffer = output_buffer;
+       acpi_size bytes_consumed = 0;
+       u8 done = FALSE;
 
+       ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
 
        while (!done) {
                switch (linked_list->id) {
@@ -362,58 +363,72 @@ acpi_rs_list_to_byte_stream (
                        /*
                         * IRQ Resource
                         */
-                       status = acpi_rs_irq_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_irq_stream(linked_list, &buffer,
+                                              &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_DMA:
                        /*
                         * DMA Resource
                         */
-                       status = acpi_rs_dma_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_dma_stream(linked_list, &buffer,
+                                              &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_START_DPF:
                        /*
                         * Start Dependent Functions Resource
                         */
-                       status = acpi_rs_start_depend_fns_stream (linked_list,
-                                         &buffer, &bytes_consumed);
+                       status = acpi_rs_start_depend_fns_stream(linked_list,
+                                                                &buffer,
+                                                                &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_END_DPF:
                        /*
                         * End Dependent Functions Resource
                         */
-                       status = acpi_rs_end_depend_fns_stream (linked_list,
-                                         &buffer, &bytes_consumed);
+                       status = acpi_rs_end_depend_fns_stream(linked_list,
+                                                              &buffer,
+                                                              &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_IO:
                        /*
                         * IO Port Resource
                         */
-                       status = acpi_rs_io_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_io_stream(linked_list, &buffer,
+                                             &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_FIXED_IO:
                        /*
                         * Fixed IO Port Resource
                         */
-                       status = acpi_rs_fixed_io_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_fixed_io_stream(linked_list, &buffer,
+                                                   &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_VENDOR:
                        /*
                         * Vendor Defined Resource
                         */
-                       status = acpi_rs_vendor_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_vendor_stream(linked_list, &buffer,
+                                                 &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_END_TAG:
                        /*
                         * End Tag
                         */
-                       status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_end_tag_stream(linked_list, &buffer,
+                                                  &bytes_consumed);
 
                        /* An End Tag indicates the end of the Resource Template */
 
@@ -424,55 +439,60 @@ acpi_rs_list_to_byte_stream (
                        /*
                         * 24-Bit Memory Resource
                         */
-                       status = acpi_rs_memory24_stream (linked_list, &buffer, &bytes_consumed);
+                       status =
+                           acpi_rs_memory24_stream(linked_list, &buffer,
+                                                   &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_MEM32:
                        /*
                         * 32-Bit Memory Range Resource
                         */
-                       status = acpi_rs_memory32_range_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status =
+                           acpi_rs_memory32_range_stream(linked_list, &buffer,
+                                                         &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_FIXED_MEM32:
                        /*
                         * 32-Bit Fixed Memory Resource
                         */
-                       status = acpi_rs_fixed_memory32_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status =
+                           acpi_rs_fixed_memory32_stream(linked_list, &buffer,
+                                                         &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_ADDRESS16:
                        /*
                         * 16-Bit Address Descriptor Resource
                         */
-                       status = acpi_rs_address16_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status = acpi_rs_address16_stream(linked_list, &buffer,
+                                                         &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_ADDRESS32:
                        /*
                         * 32-Bit Address Descriptor Resource
                         */
-                       status = acpi_rs_address32_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status = acpi_rs_address32_stream(linked_list, &buffer,
+                                                         &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_ADDRESS64:
                        /*
                         * 64-Bit Address Descriptor Resource
                         */
-                       status = acpi_rs_address64_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status = acpi_rs_address64_stream(linked_list, &buffer,
+                                                         &bytes_consumed);
                        break;
 
                case ACPI_RSTYPE_EXT_IRQ:
                        /*
                         * Extended IRQ Resource
                         */
-                       status = acpi_rs_extended_irq_stream (linked_list, &buffer,
-                                        &bytes_consumed);
+                       status =
+                           acpi_rs_extended_irq_stream(linked_list, &buffer,
+                                                       &bytes_consumed);
                        break;
 
                default:
@@ -480,15 +500,15 @@ acpi_rs_list_to_byte_stream (
                         * If we get here, everything is out of sync,
                         * so exit with an error
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Invalid descriptor type (%X) in resource list\n",
-                               linked_list->id));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid descriptor type (%X) in resource list\n",
+                                         linked_list->id));
                        status = AE_BAD_DATA;
                        break;
                }
 
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
 
                /* Set the Buffer to point to the open byte */
@@ -497,10 +517,9 @@ acpi_rs_list_to_byte_stream (
 
                /* Point to the next object */
 
-               linked_list = ACPI_PTR_ADD (struct acpi_resource,
-                                 linked_list, linked_list->length);
+               linked_list = ACPI_PTR_ADD(struct acpi_resource,
+                                          linked_list, linked_list->length);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index 91d0207f01ac76dd204fa3f6efe38a1fdb272c86..daba1a1ed46db522d747241567db8685e385e497 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsmemory")
-
+ACPI_MODULE_NAME("rsmemory")
 
 /*******************************************************************************
  *
  *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_memory24_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_memory24_resource(u8 * byte_stream_buffer,
+                         acpi_size * bytes_consumed,
+                         u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_mem24);
-
-
-       ACPI_FUNCTION_TRACE ("rs_memory24_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
 
+       ACPI_FUNCTION_TRACE("rs_memory24_resource");
 
        /* Point past the Descriptor to get the number of bytes consumed */
 
        buffer += 1;
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        buffer += 2;
        *bytes_consumed = (acpi_size) temp16 + 3;
        output_struct->id = ACPI_RSTYPE_MEM24;
@@ -105,25 +98,25 @@ acpi_rs_memory24_resource (
 
        /* Get min_base_address (Bytes 4-5) */
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        buffer += 2;
        output_struct->data.memory24.min_base_address = temp16;
 
        /* Get max_base_address (Bytes 6-7) */
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        buffer += 2;
        output_struct->data.memory24.max_base_address = temp16;
 
        /* Get Alignment (Bytes 8-9) */
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        buffer += 2;
        output_struct->data.memory24.alignment = temp16;
 
        /* Get range_length (Bytes 10-11) */
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        output_struct->data.memory24.range_length = temp16;
 
        /* Set the Length parameter */
@@ -133,10 +126,9 @@ acpi_rs_memory24_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_memory24_stream
@@ -154,18 +146,14 @@ acpi_rs_memory24_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_memory24_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_memory24_stream(struct acpi_resource *linked_list,
+                       u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_memory24_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_memory24_stream");
 
        /* The descriptor field is static */
 
@@ -175,7 +163,7 @@ acpi_rs_memory24_stream (
        /* The length field is static */
 
        temp16 = 0x09;
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the Information Byte */
@@ -186,31 +174,32 @@ acpi_rs_memory24_stream (
 
        /* Set the Range minimum base address */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address);
+       ACPI_MOVE_32_TO_16(buffer,
+                          &linked_list->data.memory24.min_base_address);
        buffer += 2;
 
        /* Set the Range maximum base address */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address);
+       ACPI_MOVE_32_TO_16(buffer,
+                          &linked_list->data.memory24.max_base_address);
        buffer += 2;
 
        /* Set the base alignment */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment);
+       ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment);
        buffer += 2;
 
        /* Set the range length */
 
-       ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length);
+       ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length);
        buffer += 2;
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_memory32_range_resource
@@ -233,28 +222,24 @@ acpi_rs_memory24_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_memory32_range_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_mem32);
-
-
-       ACPI_FUNCTION_TRACE ("rs_memory32_range_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
 
+       ACPI_FUNCTION_TRACE("rs_memory32_range_resource");
 
        /* Point past the Descriptor to get the number of bytes consumed */
 
        buffer += 1;
 
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
        buffer += 2;
        *bytes_consumed = (acpi_size) temp16 + 3;
 
@@ -279,22 +264,24 @@ acpi_rs_memory32_range_resource (
 
        /* Get min_base_address (Bytes 4-7) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address,
+                          buffer);
        buffer += 4;
 
        /* Get max_base_address (Bytes 8-11) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address,
+                          buffer);
        buffer += 4;
 
        /* Get Alignment (Bytes 12-15) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer);
        buffer += 4;
 
        /* Get range_length (Bytes 16-19) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer);
 
        /* Set the Length parameter */
 
@@ -303,10 +290,9 @@ acpi_rs_memory32_range_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_fixed_memory32_resource
@@ -329,27 +315,23 @@ acpi_rs_memory32_range_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_fixed_memory32_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_fixed_mem32);
-
-
-       ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32);
 
+       ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource");
 
        /* Point past the Descriptor to get the number of bytes consumed */
 
        buffer += 1;
-       ACPI_MOVE_16_TO_16 (&temp16, buffer);
+       ACPI_MOVE_16_TO_16(&temp16, buffer);
 
        buffer += 2;
        *bytes_consumed = (acpi_size) temp16 + 3;
@@ -364,13 +346,14 @@ acpi_rs_fixed_memory32_resource (
 
        /* Get range_base_address (Bytes 4-7) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address,
-               buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.
+                          range_base_address, buffer);
        buffer += 4;
 
        /* Get range_length (Bytes 8-11) */
 
-       ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer);
+       ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length,
+                          buffer);
 
        /* Set the Length parameter */
 
@@ -379,10 +362,9 @@ acpi_rs_fixed_memory32_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_memory32_range_stream
@@ -400,18 +382,14 @@ acpi_rs_fixed_memory32_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_memory32_range_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_memory32_range_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
 
        /* The descriptor field is static */
 
@@ -422,7 +400,7 @@ acpi_rs_memory32_range_stream (
 
        temp16 = 0x11;
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the Information Byte */
@@ -433,31 +411,32 @@ acpi_rs_memory32_range_stream (
 
        /* Set the Range minimum base address */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.memory32.min_base_address);
        buffer += 4;
 
        /* Set the Range maximum base address */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.memory32.max_base_address);
        buffer += 4;
 
        /* Set the base alignment */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment);
+       ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment);
        buffer += 4;
 
        /* Set the range length */
 
-       ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length);
+       ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length);
        buffer += 4;
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_fixed_memory32_stream
@@ -475,18 +454,14 @@ acpi_rs_memory32_range_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_fixed_memory32_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
 
        /* The descriptor field is static */
 
@@ -497,30 +472,31 @@ acpi_rs_fixed_memory32_stream (
 
        temp16 = 0x09;
 
-       ACPI_MOVE_16_TO_16 (buffer, &temp16);
+       ACPI_MOVE_16_TO_16(buffer, &temp16);
        buffer += 2;
 
        /* Set the Information Byte */
 
-       temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
+       temp8 =
+           (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
        *buffer = temp8;
        buffer += 1;
 
        /* Set the Range base address */
 
-       ACPI_MOVE_32_TO_32 (buffer,
-               &linked_list->data.fixed_memory32.range_base_address);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.fixed_memory32.
+                          range_base_address);
        buffer += 4;
 
        /* Set the range length */
 
-       ACPI_MOVE_32_TO_32 (buffer,
-               &linked_list->data.fixed_memory32.range_length);
+       ACPI_MOVE_32_TO_32(buffer,
+                          &linked_list->data.fixed_memory32.range_length);
        buffer += 4;
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
-
index a1f1741f0d83cb336a38c331b451774153d1e8d8..7a8a34e757f506a2c4d758b206bec6458b7c54bc 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsmisc")
-
+ACPI_MODULE_NAME("rsmisc")
 
 /*******************************************************************************
  *
  *              number of bytes consumed from the byte stream.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_end_tag_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
+                        acpi_size * bytes_consumed,
+                        u8 ** output_buffer, acpi_size * structure_size)
 {
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       acpi_size                       struct_size = ACPI_RESOURCE_LENGTH;
-
-
-       ACPI_FUNCTION_TRACE ("rs_end_tag_resource");
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       acpi_size struct_size = ACPI_RESOURCE_LENGTH;
 
+       ACPI_FUNCTION_TRACE("rs_end_tag_resource");
 
        /* The number of bytes consumed is static */
 
@@ -99,10 +92,9 @@ acpi_rs_end_tag_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_end_tag_stream
@@ -120,17 +112,13 @@ acpi_rs_end_tag_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_end_tag_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
+                      u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_end_tag_stream");
+       u8 *buffer = *output_buffer;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_end_tag_stream");
 
        /* The descriptor field is static */
 
@@ -148,11 +136,10 @@ acpi_rs_end_tag_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_vendor_resource
@@ -175,23 +162,19 @@ acpi_rs_end_tag_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_vendor_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_vendor_resource(u8 * byte_stream_buffer,
+                       acpi_size * bytes_consumed,
+                       u8 ** output_buffer, acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              index;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_vendor);
-
-
-       ACPI_FUNCTION_TRACE ("rs_vendor_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 index;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
 
+       ACPI_FUNCTION_TRACE("rs_vendor_resource");
 
        /* Dereference the Descriptor to find if this is a large or small item. */
 
@@ -204,7 +187,7 @@ acpi_rs_vendor_resource (
 
                /* Dereference */
 
-               ACPI_MOVE_16_TO_16 (&temp16, buffer);
+               ACPI_MOVE_16_TO_16(&temp16, buffer);
 
                /* Calculate bytes consumed */
 
@@ -213,11 +196,10 @@ acpi_rs_vendor_resource (
                /* Point to the first vendor byte */
 
                buffer += 2;
-       }
-       else {
+       } else {
                /* Small Item, dereference the size */
 
-               temp16 = (u8)(*buffer & 0x07);
+               temp16 = (u8) (*buffer & 0x07);
 
                /* Calculate bytes consumed */
 
@@ -241,7 +223,7 @@ acpi_rs_vendor_resource (
         * calculate the length of the vendor string and expand the
         * struct_size to the next 32-bit boundary.
         */
-       struct_size += ACPI_ROUND_UP_to_32_bITS (temp16);
+       struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
 
        /* Set the Length parameter */
 
@@ -250,10 +232,9 @@ acpi_rs_vendor_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_vendor_stream
@@ -271,23 +252,19 @@ acpi_rs_vendor_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_vendor_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_vendor_stream(struct acpi_resource *linked_list,
+                     u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u16                             temp16 = 0;
-       u8                              temp8 = 0;
-       u8                              index;
-
-
-       ACPI_FUNCTION_TRACE ("rs_vendor_stream");
+       u8 *buffer = *output_buffer;
+       u16 temp16 = 0;
+       u8 temp8 = 0;
+       u8 index;
 
+       ACPI_FUNCTION_TRACE("rs_vendor_stream");
 
        /* Dereference the length to find if this is a large or small item. */
 
-       if(linked_list->data.vendor_specific.length > 7) {
+       if (linked_list->data.vendor_specific.length > 7) {
                /* Large Item, Set the descriptor field and length bytes */
 
                *buffer = 0x84;
@@ -295,10 +272,9 @@ acpi_rs_vendor_stream (
 
                temp16 = (u16) linked_list->data.vendor_specific.length;
 
-               ACPI_MOVE_16_TO_16 (buffer, &temp16);
+               ACPI_MOVE_16_TO_16(buffer, &temp16);
                buffer += 2;
-       }
-       else {
+       } else {
                /* Small Item, Set the descriptor field */
 
                temp8 = 0x70;
@@ -310,7 +286,8 @@ acpi_rs_vendor_stream (
 
        /* Loop through all of the Vendor Specific fields */
 
-       for (index = 0; index < linked_list->data.vendor_specific.length; index++) {
+       for (index = 0; index < linked_list->data.vendor_specific.length;
+            index++) {
                temp8 = linked_list->data.vendor_specific.reserved[index];
 
                *buffer = temp8;
@@ -319,11 +296,10 @@ acpi_rs_vendor_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_start_depend_fns_resource
@@ -346,21 +322,18 @@ acpi_rs_vendor_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_start_depend_fns_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
+                                 acpi_size * bytes_consumed,
+                                 u8 ** output_buffer,
+                                 acpi_size * structure_size)
 {
-       u8                              *buffer = byte_stream_buffer;
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       u8                              temp8 = 0;
-       acpi_size                       struct_size = ACPI_SIZEOF_RESOURCE (
-                         struct acpi_resource_start_dpf);
-
-
-       ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource");
+       u8 *buffer = byte_stream_buffer;
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       u8 temp8 = 0;
+       acpi_size struct_size =
+           ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
 
+       ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
 
        /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
 
@@ -378,26 +351,27 @@ acpi_rs_start_depend_fns_resource (
 
                /* Check Compatibility priority */
 
-               output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
+               output_struct->data.start_dpf.compatibility_priority =
+                   temp8 & 0x03;
 
                if (3 == output_struct->data.start_dpf.compatibility_priority) {
-                       return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
+                       return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
                }
 
                /* Check Performance/Robustness preference */
 
-               output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
+               output_struct->data.start_dpf.performance_robustness =
+                   (temp8 >> 2) & 0x03;
 
                if (3 == output_struct->data.start_dpf.performance_robustness) {
-                       return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
+                       return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
                }
-       }
-       else {
+       } else {
                output_struct->data.start_dpf.compatibility_priority =
-                       ACPI_ACCEPTABLE_CONFIGURATION;
+                   ACPI_ACCEPTABLE_CONFIGURATION;
 
                output_struct->data.start_dpf.performance_robustness =
-                       ACPI_ACCEPTABLE_CONFIGURATION;
+                   ACPI_ACCEPTABLE_CONFIGURATION;
        }
 
        /* Set the Length parameter */
@@ -407,10 +381,9 @@ acpi_rs_start_depend_fns_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_end_depend_fns_resource
@@ -433,18 +406,14 @@ acpi_rs_start_depend_fns_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_end_depend_fns_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size)
+acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer, acpi_size * structure_size)
 {
-       struct acpi_resource            *output_struct = (void *) *output_buffer;
-       acpi_size                       struct_size = ACPI_RESOURCE_LENGTH;
-
-
-       ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource");
+       struct acpi_resource *output_struct = (void *)*output_buffer;
+       acpi_size struct_size = ACPI_RESOURCE_LENGTH;
 
+       ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
 
        /* The number of bytes consumed is static */
 
@@ -461,10 +430,9 @@ acpi_rs_end_depend_fns_resource (
        /* Return the final size of the structure */
 
        *structure_size = struct_size;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_start_depend_fns_stream
@@ -483,39 +451,35 @@ acpi_rs_end_depend_fns_resource (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_start_depend_fns_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
+                               u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-       u8                              temp8 = 0;
-
-
-       ACPI_FUNCTION_TRACE ("rs_start_depend_fns_stream");
+       u8 *buffer = *output_buffer;
+       u8 temp8 = 0;
 
+       ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
 
        /*
         * The descriptor field is set based upon whether a byte is needed
         * to contain Priority data.
         */
        if (ACPI_ACCEPTABLE_CONFIGURATION ==
-                       linked_list->data.start_dpf.compatibility_priority &&
-               ACPI_ACCEPTABLE_CONFIGURATION ==
-                       linked_list->data.start_dpf.performance_robustness) {
+           linked_list->data.start_dpf.compatibility_priority &&
+           ACPI_ACCEPTABLE_CONFIGURATION ==
+           linked_list->data.start_dpf.performance_robustness) {
                *buffer = 0x30;
-       }
-       else {
+       } else {
                *buffer = 0x31;
                buffer += 1;
 
                /* Set the Priority Byte Definition */
 
                temp8 = 0;
-               temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness &
-                                  0x03) << 2);
-               temp8 |= (linked_list->data.start_dpf.compatibility_priority &
-                                  0x03);
+               temp8 =
+                   (u8) ((linked_list->data.start_dpf.
+                          performance_robustness & 0x03) << 2);
+               temp8 |=
+                   (linked_list->data.start_dpf.compatibility_priority & 0x03);
                *buffer = temp8;
        }
 
@@ -523,11 +487,10 @@ acpi_rs_start_depend_fns_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_end_depend_fns_stream
@@ -545,16 +508,12 @@ acpi_rs_start_depend_fns_stream (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_end_depend_fns_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed)
+acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed)
 {
-       u8                              *buffer = *output_buffer;
-
-
-       ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream");
+       u8 *buffer = *output_buffer;
 
+       ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
 
        /* The descriptor field is static */
 
@@ -563,7 +522,6 @@ acpi_rs_end_depend_fns_stream (
 
        /* Return the number of bytes consumed in this operation */
 
-       *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
-       return_ACPI_STATUS (AE_OK);
+       *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
+       return_ACPI_STATUS(AE_OK);
 }
-
index 700cf7d65d76f12b69dc8c6bc15585e8d993b38d..4446778eaf7927df16f9b29a49fb2a6395871086 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acresrc.h>
 
-
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsutils")
-
+ACPI_MODULE_NAME("rsutils")
 
 /*******************************************************************************
  *
  *              and the contents of the callers buffer is undefined.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_rs_get_prt_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_prt_method_data");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("rs_get_prt_method_data");
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT,
-                        ACPI_BTYPE_PACKAGE, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT,
+                                        ACPI_BTYPE_PACKAGE, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Create a resource linked list from the byte stream buffer that comes
         * back from the _CRS method execution.
         */
-       status = acpi_rs_create_pci_routing_table (obj_desc, ret_buffer);
+       status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer);
 
        /* On exit, we must delete the object returned by evaluate_object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_get_crs_method_data
@@ -123,25 +114,21 @@ acpi_rs_get_prt_method_data (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_crs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_crs_method_data");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("rs_get_crs_method_data");
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS,
-                        ACPI_BTYPE_BUFFER, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS,
+                                        ACPI_BTYPE_BUFFER, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -149,15 +136,14 @@ acpi_rs_get_crs_method_data (
         * byte stream buffer that comes back from the _CRS method
         * execution.
         */
-       status = acpi_rs_create_resource_list (obj_desc, ret_buffer);
+       status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
 
        /* on exit, we must delete the object returned by evaluate_object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_rs_get_prs_method_data
@@ -178,25 +164,21 @@ acpi_rs_get_crs_method_data (
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_rs_get_prs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_prs_method_data");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("rs_get_prs_method_data");
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS,
-                        ACPI_BTYPE_BUFFER, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS,
+                                        ACPI_BTYPE_BUFFER, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -204,15 +186,14 @@ acpi_rs_get_prs_method_data (
         * byte stream buffer that comes back from the _CRS method
         * execution.
         */
-       status = acpi_rs_create_resource_list (obj_desc, ret_buffer);
+       status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
 
        /* on exit, we must delete the object returned by evaluate_object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -234,25 +215,22 @@ acpi_rs_get_prs_method_data (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_method_data (
-       acpi_handle                     handle,
-       char                            *path,
-       struct acpi_buffer              *ret_buffer)
+acpi_rs_get_method_data(acpi_handle handle,
+                       char *path, struct acpi_buffer *ret_buffer)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("rs_get_method_data");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("rs_get_method_data");
 
        /* Parameters guaranteed valid by caller */
 
        /* Execute the method, no parameters */
 
-       status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -260,12 +238,12 @@ acpi_rs_get_method_data (
         * byte stream buffer that comes back from the method
         * execution.
         */
-       status = acpi_rs_create_resource_list (obj_desc, ret_buffer);
+       status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
 
        /* On exit, we must delete the object returned by evaluate_object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -287,18 +265,14 @@ acpi_rs_get_method_data (
  ******************************************************************************/
 
 acpi_status
-acpi_rs_set_srs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *in_buffer)
+acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
 {
-       struct acpi_parameter_info      info;
-       union acpi_operand_object       *params[2];
-       acpi_status                     status;
-       struct acpi_buffer              buffer;
-
-
-       ACPI_FUNCTION_TRACE ("rs_set_srs_method_data");
+       struct acpi_parameter_info info;
+       union acpi_operand_object *params[2];
+       acpi_status status;
+       struct acpi_buffer buffer;
 
+       ACPI_FUNCTION_TRACE("rs_set_srs_method_data");
 
        /* Parameters guaranteed valid by caller */
 
@@ -310,24 +284,24 @@ acpi_rs_set_srs_method_data (
         * Convert the linked list into a byte stream
         */
        buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_rs_create_byte_stream (in_buffer->pointer, &buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Init the param object */
 
-       params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+       params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
        if (!params[0]) {
-               acpi_os_free (buffer.pointer);
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               acpi_os_free(buffer.pointer);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Set up the parameter object */
 
-       params[0]->buffer.length  = (u32) buffer.length;
+       params[0]->buffer.length = (u32) buffer.length;
        params[0]->buffer.pointer = buffer.pointer;
-       params[0]->common.flags   = AOPOBJ_DATA_VALID;
+       params[0]->common.flags = AOPOBJ_DATA_VALID;
        params[1] = NULL;
 
        info.node = handle;
@@ -336,18 +310,17 @@ acpi_rs_set_srs_method_data (
 
        /* Execute the method, no return value */
 
-       status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
+       if (ACPI_SUCCESS(status)) {
                /* Delete any return object (especially if implicit_return is enabled) */
 
                if (info.return_object) {
-                       acpi_ut_remove_reference (info.return_object);
+                       acpi_ut_remove_reference(info.return_object);
                }
        }
 
        /* Clean up and return the status from acpi_ns_evaluate_relative */
 
-       acpi_ut_remove_reference (params[0]);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(params[0]);
+       return_ACPI_STATUS(status);
 }
-
index 83c944b8b097477a113356f2c8d02011fdb9ecc9..ee5a5c509199a59785b9ecb853f4eaf4eeb9b0dc 100644 (file)
 #include <acpi/acresrc.h>
 
 #define _COMPONENT          ACPI_RESOURCES
-        ACPI_MODULE_NAME    ("rsxface")
+ACPI_MODULE_NAME("rsxface")
 
 /* Local macros for 16,32-bit to 64-bit conversion */
-
 #define ACPI_COPY_FIELD(out, in, field)  ((out)->field = (in)->field)
 #define ACPI_COPY_ADDRESS(out, in)                      \
        ACPI_COPY_FIELD(out, in, resource_type);             \
@@ -65,8 +64,6 @@
        ACPI_COPY_FIELD(out, in, address_translation_offset); \
        ACPI_COPY_FIELD(out, in, address_length);            \
        ACPI_COPY_FIELD(out, in, resource_source);
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_irq_routing_table
  *              the object indicated by the passed device_handle.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_get_irq_routing_table (
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_get_irq_routing_table(acpi_handle device_handle,
+                          struct acpi_buffer *ret_buffer)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_irq_routing_table ");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table ");
 
        /*
         * Must have a valid handle and buffer, So we have to have a handle
@@ -108,19 +101,18 @@ acpi_get_irq_routing_table (
         * we'll be returning the needed buffer size, so keep going.
         */
        if (!device_handle) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (ret_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_buffer(ret_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_prt_method_data (device_handle, ret_buffer);
-       return_ACPI_STATUS (status);
+       status = acpi_rs_get_prt_method_data(device_handle, ret_buffer);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_current_resources
@@ -146,15 +138,12 @@ acpi_get_irq_routing_table (
  ******************************************************************************/
 
 acpi_status
-acpi_get_current_resources (
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_get_current_resources(acpi_handle device_handle,
+                          struct acpi_buffer *ret_buffer)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_current_resources");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_current_resources");
 
        /*
         * Must have a valid handle and buffer, So we have to have a handle
@@ -163,19 +152,19 @@ acpi_get_current_resources (
         * we'll be returning the needed buffer size, so keep going.
         */
        if (!device_handle) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (ret_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_buffer(ret_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_crs_method_data (device_handle, ret_buffer);
-       return_ACPI_STATUS (status);
+       status = acpi_rs_get_crs_method_data(device_handle, ret_buffer);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_current_resources);
 
+EXPORT_SYMBOL(acpi_get_current_resources);
 
 /*******************************************************************************
  *
@@ -200,15 +189,12 @@ EXPORT_SYMBOL(acpi_get_current_resources);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_possible_resources (
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *ret_buffer)
+acpi_get_possible_resources(acpi_handle device_handle,
+                           struct acpi_buffer *ret_buffer)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_possible_resources");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_possible_resources");
 
        /*
         * Must have a valid handle and buffer, So we have to have a handle
@@ -217,20 +203,20 @@ acpi_get_possible_resources (
         * we'll be returning the needed buffer size, so keep going.
         */
        if (!device_handle) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (ret_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_buffer(ret_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_rs_get_prs_method_data (device_handle, ret_buffer);
-       return_ACPI_STATUS (status);
+       status = acpi_rs_get_prs_method_data(device_handle, ret_buffer);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_possible_resources);
-#endif  /*  ACPI_FUTURE_USAGE  */
 
+EXPORT_SYMBOL(acpi_get_possible_resources);
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -252,37 +238,33 @@ EXPORT_SYMBOL(acpi_get_possible_resources);
  ******************************************************************************/
 
 acpi_status
-acpi_walk_resources (
-       acpi_handle                             device_handle,
-       char                                    *path,
-       ACPI_WALK_RESOURCE_CALLBACK     user_function,
-       void                                    *context)
+acpi_walk_resources(acpi_handle device_handle,
+                   char *path,
+                   ACPI_WALK_RESOURCE_CALLBACK user_function, void *context)
 {
-       acpi_status                         status;
-       struct acpi_buffer                  buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       struct acpi_resource                *resource;
-       struct acpi_resource                *buffer_end;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_walk_resources");
+       acpi_status status;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_resource *resource;
+       struct acpi_resource *buffer_end;
 
+       ACPI_FUNCTION_TRACE("acpi_walk_resources");
 
        if (!device_handle ||
-               (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) &&
-                ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+           (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) &&
+            ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_rs_get_method_data (device_handle, path, &buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_rs_get_method_data(device_handle, path, &buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Setup pointers */
 
-       resource  = (struct acpi_resource *) buffer.pointer;
-       buffer_end = ACPI_CAST_PTR (struct acpi_resource,
-                         ((u8 *) buffer.pointer + buffer.length));
+       resource = (struct acpi_resource *)buffer.pointer;
+       buffer_end = ACPI_CAST_PTR(struct acpi_resource,
+                                  ((u8 *) buffer.pointer + buffer.length));
 
        /* Walk the resource list */
 
@@ -291,7 +273,7 @@ acpi_walk_resources (
                        break;
                }
 
-               status = user_function (resource, context);
+               status = user_function(resource, context);
 
                switch (status) {
                case AE_OK:
@@ -318,7 +300,7 @@ acpi_walk_resources (
 
                /* Get the next resource descriptor */
 
-               resource = ACPI_NEXT_RESOURCE (resource);
+               resource = ACPI_NEXT_RESOURCE(resource);
 
                /* Check for end-of-buffer */
 
@@ -327,13 +309,13 @@ acpi_walk_resources (
                }
        }
 
-cleanup:
+      cleanup:
 
-       acpi_os_free (buffer.pointer);
-       return_ACPI_STATUS (status);
+       acpi_os_free(buffer.pointer);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_walk_resources);
 
+EXPORT_SYMBOL(acpi_walk_resources);
 
 /*******************************************************************************
  *
@@ -354,30 +336,25 @@ EXPORT_SYMBOL(acpi_walk_resources);
  ******************************************************************************/
 
 acpi_status
-acpi_set_current_resources (
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *in_buffer)
+acpi_set_current_resources(acpi_handle device_handle,
+                          struct acpi_buffer *in_buffer)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_set_current_resources");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_set_current_resources");
 
        /* Must have a valid handle and buffer */
 
-       if ((!device_handle)      ||
-               (!in_buffer)          ||
-               (!in_buffer->pointer) ||
-               (!in_buffer->length)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((!device_handle) ||
+           (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_rs_set_srs_method_data (device_handle, in_buffer);
-       return_ACPI_STATUS (status);
+       status = acpi_rs_set_srs_method_data(device_handle, in_buffer);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_set_current_resources);
 
+EXPORT_SYMBOL(acpi_set_current_resources);
 
 /******************************************************************************
  *
@@ -398,41 +375,38 @@ EXPORT_SYMBOL(acpi_set_current_resources);
  ******************************************************************************/
 
 acpi_status
-acpi_resource_to_address64 (
-       struct acpi_resource                *resource,
-       struct acpi_resource_address64      *out)
+acpi_resource_to_address64(struct acpi_resource *resource,
+                          struct acpi_resource_address64 *out)
 {
-       struct acpi_resource_address16      *address16;
-       struct acpi_resource_address32      *address32;
-
+       struct acpi_resource_address16 *address16;
+       struct acpi_resource_address32 *address32;
 
        switch (resource->id) {
        case ACPI_RSTYPE_ADDRESS16:
 
-               address16 = (struct acpi_resource_address16 *) &resource->data;
-               ACPI_COPY_ADDRESS (out, address16);
+               address16 = (struct acpi_resource_address16 *)&resource->data;
+               ACPI_COPY_ADDRESS(out, address16);
                break;
 
-
        case ACPI_RSTYPE_ADDRESS32:
 
-               address32 = (struct acpi_resource_address32 *) &resource->data;
-               ACPI_COPY_ADDRESS (out, address32);
+               address32 = (struct acpi_resource_address32 *)&resource->data;
+               ACPI_COPY_ADDRESS(out, address32);
                break;
 
-
        case ACPI_RSTYPE_ADDRESS64:
 
                /* Simple copy for 64 bit source */
 
-               ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64));
+               ACPI_MEMCPY(out, &resource->data,
+                           sizeof(struct acpi_resource_address64));
                break;
 
-
        default:
                return (AE_BAD_PARAMETER);
        }
 
        return (AE_OK);
 }
+
 EXPORT_SYMBOL(acpi_resource_to_address64);
index cbcda30c172dd1876b4f5928c59d20ae0c610132..c6db591479de3e02504d40ac8e0cee2d2bebdeab 100644 (file)
@@ -9,14 +9,10 @@
 #include <acpi/acpi_drivers.h>
 #include <acpi/acinterp.h>     /* for acpi_ex_eisa_id_to_string() */
 
-
 #define _COMPONENT             ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME               ("scan")
-
+ACPI_MODULE_NAME("scan")
 #define STRUCT_TO_INT(s)       (*((int*)&s))
-
-extern struct acpi_device              *acpi_root;
-
+extern struct acpi_device *acpi_root;
 
 #define ACPI_BUS_CLASS                 "system_bus"
 #define ACPI_BUS_HID                   "ACPI_BUS"
@@ -27,13 +23,11 @@ static LIST_HEAD(acpi_device_list);
 DEFINE_SPINLOCK(acpi_device_lock);
 LIST_HEAD(acpi_wakeup_device_list);
 
-static int
-acpi_bus_trim(struct acpi_device       *start,
-               int rmdevice);
+static int acpi_bus_trim(struct acpi_device *start, int rmdevice);
 
-static void acpi_device_release(struct kobject * kobj)
+static void acpi_device_release(struct kobject *kobj)
 {
-       struct acpi_device * dev = container_of(kobj,struct acpi_device,kobj);
+       struct acpi_device *dev = container_of(kobj, struct acpi_device, kobj);
        if (dev->pnp.cid_list)
                kfree(dev->pnp.cid_list);
        kfree(dev);
@@ -41,34 +35,34 @@ static void acpi_device_release(struct kobject * kobj)
 
 struct acpi_device_attribute {
        struct attribute attr;
-       ssize_t (*show)(struct acpi_device *, char *);
-       ssize_t (*store)(struct acpi_device *, const char *, size_t);
+        ssize_t(*show) (struct acpi_device *, char *);
+        ssize_t(*store) (struct acpi_device *, const char *, size_t);
 };
 
 typedef void acpi_device_sysfs_files(struct kobject *,
-                               const struct attribute *);
+                                    const struct attribute *);
 
 static void setup_sys_fs_device_files(struct acpi_device *dev,
-               acpi_device_sysfs_files *func);
+                                     acpi_device_sysfs_files * func);
 
 #define create_sysfs_device_files(dev) \
        setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_create_file)
 #define remove_sysfs_device_files(dev) \
        setup_sys_fs_device_files(dev, (acpi_device_sysfs_files *)&sysfs_remove_file)
 
-
 #define to_acpi_device(n) container_of(n, struct acpi_device, kobj)
 #define to_handle_attr(n) container_of(n, struct acpi_device_attribute, attr);
 
 static ssize_t acpi_device_attr_show(struct kobject *kobj,
-               struct attribute *attr, char *buf)
+                                    struct attribute *attr, char *buf)
 {
        struct acpi_device *device = to_acpi_device(kobj);
        struct acpi_device_attribute *attribute = to_handle_attr(attr);
        return attribute->show ? attribute->show(device, buf) : -EIO;
 }
 static ssize_t acpi_device_attr_store(struct kobject *kobj,
-               struct attribute *attr, const char *buf, size_t len)
+                                     struct attribute *attr, const char *buf,
+                                     size_t len)
 {
        struct acpi_device *device = to_acpi_device(kobj);
        struct acpi_device_attribute *attribute = to_handle_attr(attr);
@@ -76,13 +70,13 @@ static ssize_t acpi_device_attr_store(struct kobject *kobj,
 }
 
 static struct sysfs_ops acpi_device_sysfs_ops = {
-       .show   = acpi_device_attr_show,
-       .store  = acpi_device_attr_store,
+       .show = acpi_device_attr_show,
+       .store = acpi_device_attr_store,
 };
 
 static struct kobj_type ktype_acpi_ns = {
-       .sysfs_ops      = &acpi_device_sysfs_ops,
-       .release        = acpi_device_release,
+       .sysfs_ops = &acpi_device_sysfs_ops,
+       .release = acpi_device_release,
 };
 
 static int namespace_hotplug(struct kset *kset, struct kobject *kobj,
@@ -110,16 +104,16 @@ static struct kset_hotplug_ops namespace_hotplug_ops = {
 };
 
 static struct kset acpi_namespace_kset = {
-       .kobj           = { 
-               .name = "namespace",
-       },
+       .kobj = {
+                .name = "namespace",
+                },
        .subsys = &acpi_subsys,
-       .ktype  = &ktype_acpi_ns,
+       .ktype = &ktype_acpi_ns,
        .hotplug_ops = &namespace_hotplug_ops,
 };
 
-
-static void acpi_device_register(struct acpi_device * device, struct acpi_device * parent)
+static void acpi_device_register(struct acpi_device *device,
+                                struct acpi_device *parent)
 {
        /*
         * Linkage
@@ -134,14 +128,14 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device
        spin_lock(&acpi_device_lock);
        if (device->parent) {
                list_add_tail(&device->node, &device->parent->children);
-               list_add_tail(&device->g_list,&device->parent->g_list);
+               list_add_tail(&device->g_list, &device->parent->g_list);
        } else
-               list_add_tail(&device->g_list,&acpi_device_list);
+               list_add_tail(&device->g_list, &acpi_device_list);
        if (device->wakeup.flags.valid)
-               list_add_tail(&device->wakeup_list,&acpi_wakeup_device_list);
+               list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);
        spin_unlock(&acpi_device_lock);
 
-       strlcpy(device->kobj.name,device->pnp.bus_id,KOBJ_NAME_LEN);
+       strlcpy(device->kobj.name, device->pnp.bus_id, KOBJ_NAME_LEN);
        if (parent)
                device->kobj.parent = &parent->kobj;
        device->kobj.ktype = &ktype_acpi_ns;
@@ -150,10 +144,7 @@ static void acpi_device_register(struct acpi_device * device, struct acpi_device
        create_sysfs_device_files(device);
 }
 
-static int
-acpi_device_unregister (
-       struct acpi_device      *device, 
-       int                     type)
+static int acpi_device_unregister(struct acpi_device *device, int type)
 {
        spin_lock(&acpi_device_lock);
        if (device->parent) {
@@ -172,11 +163,7 @@ acpi_device_unregister (
        return 0;
 }
 
-void
-acpi_bus_data_handler (
-       acpi_handle             handle,
-       u32                     function,
-       void                    *context)
+void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
 {
        ACPI_FUNCTION_TRACE("acpi_bus_data_handler");
 
@@ -185,13 +172,11 @@ acpi_bus_data_handler (
        return_VOID;
 }
 
-static int
-acpi_bus_get_power_flags (
-       struct acpi_device      *device)
+static int acpi_bus_get_power_flags(struct acpi_device *device)
 {
-       acpi_status             status = 0;
-       acpi_handle             handle = NULL;
-       u32                     i = 0;
+       acpi_status status = 0;
+       acpi_handle handle = NULL;
+       u32 i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags");
 
@@ -210,11 +195,11 @@ acpi_bus_get_power_flags (
         */
        for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) {
                struct acpi_device_power_state *ps = &device->power.states[i];
-               char            object_name[5] = {'_','P','R','0'+i,'\0'};
+               char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' };
 
                /* Evaluate "_PRx" to se if power resources are referenced */
                acpi_evaluate_reference(device->handle, object_name, NULL,
-                       &ps->resources);
+                                       &ps->resources);
                if (ps->resources.count) {
                        device->power.flags.power_resources = 1;
                        ps->flags.valid = 1;
@@ -232,7 +217,7 @@ acpi_bus_get_power_flags (
                if (ps->resources.count || ps->flags.explicit_set)
                        ps->flags.valid = 1;
 
-               ps->power = -1;         /* Unknown - driver assigned */
+               ps->power = -1; /* Unknown - driver assigned */
                ps->latency = -1;       /* Unknown - driver assigned */
        }
 
@@ -249,13 +234,10 @@ acpi_bus_get_power_flags (
        return_VALUE(0);
 }
 
-int
-acpi_match_ids (
-       struct acpi_device      *device,
-       char                    *ids)
+int acpi_match_ids(struct acpi_device *device, char *ids)
 {
        int error = 0;
-       struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
        if (device->flags.hardware_id)
                if (strstr(ids, device->pnp.hardware_id))
@@ -266,27 +248,25 @@ acpi_match_ids (
                int i;
 
                /* compare multiple _CID entries against driver ids */
-               for (i = 0; i < cid_list->count; i++)
-               {
+               for (i = 0; i < cid_list->count; i++) {
                        if (strstr(ids, cid_list->id[i].value))
                                goto Done;
                }
        }
        error = -ENOENT;
 
- Done:
     Done:
        if (buffer.pointer)
                acpi_os_free(buffer.pointer);
        return error;
 }
 
 static acpi_status
-acpi_bus_extract_wakeup_device_power_package (
-       struct acpi_device      *device,
-       union acpi_object       *package)
+acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device,
+                                            union acpi_object *package)
 {
-       int      i = 0;
-       union acpi_object       *element = NULL;
+       int i = 0;
+       union acpi_object *element = NULL;
 
        if (!device || !package || (package->package.count < 2))
                return AE_BAD_PARAMETER;
@@ -296,14 +276,17 @@ acpi_bus_extract_wakeup_device_power_package (
                return AE_BAD_PARAMETER;
        if (element->type == ACPI_TYPE_PACKAGE) {
                if ((element->package.count < 2) ||
-                       (element->package.elements[0].type != ACPI_TYPE_LOCAL_REFERENCE) ||
-                       (element->package.elements[1].type != ACPI_TYPE_INTEGER))
+                   (element->package.elements[0].type !=
+                    ACPI_TYPE_LOCAL_REFERENCE)
+                   || (element->package.elements[1].type != ACPI_TYPE_INTEGER))
                        return AE_BAD_DATA;
-               device->wakeup.gpe_device = element->package.elements[0].reference.handle;
-               device->wakeup.gpe_number = (u32)element->package.elements[1].integer.value;
-       }else if (element->type == ACPI_TYPE_INTEGER) {
+               device->wakeup.gpe_device =
+                   element->package.elements[0].reference.handle;
+               device->wakeup.gpe_number =
+                   (u32) element->package.elements[1].integer.value;
+       } else if (element->type == ACPI_TYPE_INTEGER) {
                device->wakeup.gpe_number = element->integer.value;
-       }else
+       } else
                return AE_BAD_DATA;
 
        element = &(package->package.elements[1]);
@@ -316,9 +299,9 @@ acpi_bus_extract_wakeup_device_power_package (
                return AE_NO_MEMORY;
        }
        device->wakeup.resources.count = package->package.count - 2;
-       for (i=0; i < device->wakeup.resources.count; i++) {
+       for (i = 0; i < device->wakeup.resources.count; i++) {
                element = &(package->package.elements[i + 2]);
-               if (element->type != ACPI_TYPE_ANY ) {
+               if (element->type != ACPI_TYPE_ANY) {
                        return AE_BAD_DATA;
                }
 
@@ -328,13 +311,11 @@ acpi_bus_extract_wakeup_device_power_package (
        return AE_OK;
 }
 
-static int
-acpi_bus_get_wakeup_device_flags (
-       struct acpi_device      *device)
+static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
 {
-       acpi_status     status = 0;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *package = NULL;
+       acpi_status status = 0;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *package = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags");
 
@@ -345,21 +326,22 @@ acpi_bus_get_wakeup_device_flags (
                goto end;
        }
 
-       package = (union acpi_object *) buffer.pointer;
+       package = (union acpi_object *)buffer.pointer;
        status = acpi_bus_extract_wakeup_device_power_package(device, package);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _PRW package\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Error extracting _PRW package\n"));
                goto end;
        }
 
        acpi_os_free(buffer.pointer);
 
        device->wakeup.flags.valid = 1;
-       /* Power button, Lid switch always enable wakeup*/
+       /* Power button, Lid switch always enable wakeup */
        if (!acpi_match_ids(device, "PNP0C0D,PNP0C0C,PNP0C0E"))
                device->wakeup.flags.run_wake = 1;
 
-end:
+      end:
        if (ACPI_FAILURE(status))
                device->flags.wake_capable = 0;
        return_VALUE(0);
@@ -368,8 +350,8 @@ end:
 /* --------------------------------------------------------------------------
                ACPI hotplug sysfs device file support
    -------------------------------------------------------------------------- */
-static ssize_t acpi_eject_store(struct acpi_device *device, 
-               const char *buf, size_t count);
+static ssize_t acpi_eject_store(struct acpi_device *device,
+                               const char *buf, size_t count);
 
 #define ACPI_DEVICE_ATTR(_name,_mode,_show,_store) \
 static struct acpi_device_attribute acpi_device_attr_##_name = \
@@ -383,12 +365,11 @@ ACPI_DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store);
  * @func:      function pointer to create or destroy the device file
  */
 static void
-setup_sys_fs_device_files (
-       struct acpi_device *dev,
-       acpi_device_sysfs_files *func)
+setup_sys_fs_device_files(struct acpi_device *dev,
+                         acpi_device_sysfs_files * func)
 {
-       acpi_status             status;
-       acpi_handle             temp = NULL;
+       acpi_status status;
+       acpi_handle temp = NULL;
 
        /*
         * If device has _EJ0, 'eject' file is created that is used to trigger
@@ -396,11 +377,10 @@ setup_sys_fs_device_files (
         */
        status = acpi_get_handle(dev->handle, "_EJ0", &temp);
        if (ACPI_SUCCESS(status))
-               (*(func))(&dev->kobj,&acpi_device_attr_eject.attr);
+               (*(func)) (&dev->kobj, &acpi_device_attr_eject.attr);
 }
 
-static int
-acpi_eject_operation(acpi_handle handle, int lockable)
+static int acpi_eject_operation(acpi_handle handle, int lockable)
 {
        struct acpi_object_list arg_list;
        union acpi_object arg;
@@ -429,27 +409,25 @@ acpi_eject_operation(acpi_handle handle, int lockable)
 
        status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
        if (ACPI_FAILURE(status)) {
-               return(-ENODEV);
+               return (-ENODEV);
        }
 
-       return(0);
+       return (0);
 }
 
-
 static ssize_t
 acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)
 {
-       int     result;
-       int     ret = count;
-       int     islockable;
-       acpi_status     status;
-       acpi_handle     handle;
-       acpi_object_type        type = 0;
+       int result;
+       int ret = count;
+       int islockable;
+       acpi_status status;
+       acpi_handle handle;
+       acpi_object_type type = 0;
 
        if ((!count) || (buf[0] != '1')) {
                return -EINVAL;
        }
-
 #ifndef FORCE_EJECT
        if (device->driver == NULL) {
                ret = -ENODEV;
@@ -457,7 +435,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)
        }
 #endif
        status = acpi_get_type(device->handle, &type);
-       if (ACPI_FAILURE(status) || (!device->flags.ejectable) ) {
+       if (ACPI_FAILURE(status) || (!device->flags.ejectable)) {
                ret = -ENODEV;
                goto err;
        }
@@ -476,18 +454,15 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count)
        if (result) {
                ret = -EBUSY;
        }
-err:
+      err:
        return ret;
 }
 
-
 /* --------------------------------------------------------------------------
                               Performance Management
    -------------------------------------------------------------------------- */
 
-static int
-acpi_bus_get_perf_flags (
-       struct acpi_device      *device)
+static int acpi_bus_get_perf_flags(struct acpi_device *device)
 {
        device->performance.state = ACPI_STATE_UNKNOWN;
        return 0;
@@ -500,7 +475,6 @@ acpi_bus_get_perf_flags (
 static LIST_HEAD(acpi_bus_drivers);
 static DECLARE_MUTEX(acpi_bus_drivers_lock);
 
-
 /**
  * acpi_bus_match 
  * --------------
@@ -508,16 +482,13 @@ static DECLARE_MUTEX(acpi_bus_drivers_lock);
  * matches the specified driver's criteria.
  */
 static int
-acpi_bus_match (
-       struct acpi_device      *device,
-       struct acpi_driver      *driver)
+acpi_bus_match(struct acpi_device *device, struct acpi_driver *driver)
 {
        if (driver && driver->ops.match)
                return driver->ops.match(device, driver);
        return acpi_match_ids(device, driver->ids);
 }
 
-
 /**
  * acpi_bus_driver_init 
  * --------------------
@@ -525,11 +496,9 @@ acpi_bus_match (
  * driver is bound to a device.  Invokes the driver's add() and start() ops.
  */
 static int
-acpi_bus_driver_init (
-       struct acpi_device      *device, 
-       struct acpi_driver      *driver)
+acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_bus_driver_init");
 
@@ -553,13 +522,12 @@ acpi_bus_driver_init (
         * upon possible configuration and currently allocated resources.
         */
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Driver successfully bound to device\n"));
        return_VALUE(0);
 }
 
-int
-acpi_start_single_object (
-               struct acpi_device *device)
+static int acpi_start_single_object(struct acpi_device *device)
 {
        int result = 0;
        struct acpi_driver *driver;
@@ -578,16 +546,17 @@ acpi_start_single_object (
        return_VALUE(result);
 }
 
-static int acpi_driver_attach(struct acpi_driver * drv)
+static int acpi_driver_attach(struct acpi_driver *drv)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
        int count = 0;
 
        ACPI_FUNCTION_TRACE("acpi_driver_attach");
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_device_list) {
-               struct acpi_device * dev = container_of(node, struct acpi_device, g_list);
+               struct acpi_device *dev =
+                   container_of(node, struct acpi_device, g_list);
 
                if (dev->driver || !dev->status.present)
                        continue;
@@ -598,7 +567,8 @@ static int acpi_driver_attach(struct acpi_driver * drv)
                                acpi_start_single_object(dev);
                                atomic_inc(&drv->references);
                                count++;
-                               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n",
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "Found driver [%s] for device [%s]\n",
                                                  drv->name, dev->pnp.bus_id));
                        }
                }
@@ -608,20 +578,21 @@ static int acpi_driver_attach(struct acpi_driver * drv)
        return_VALUE(count);
 }
 
-static int acpi_driver_detach(struct acpi_driver * drv)
+static int acpi_driver_detach(struct acpi_driver *drv)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_driver_detach");
 
        spin_lock(&acpi_device_lock);
-       list_for_each_safe(node,next,&acpi_device_list) {
-               struct acpi_device * dev = container_of(node,struct acpi_device,g_list);
+       list_for_each_safe(node, next, &acpi_device_list) {
+               struct acpi_device *dev =
+                   container_of(node, struct acpi_device, g_list);
 
                if (dev->driver == drv) {
                        spin_unlock(&acpi_device_lock);
                        if (drv->ops.remove)
-                               drv->ops.remove(dev,ACPI_BUS_REMOVAL_NORMAL);
+                               drv->ops.remove(dev, ACPI_BUS_REMOVAL_NORMAL);
                        spin_lock(&acpi_device_lock);
                        dev->driver = NULL;
                        dev->driver_data = NULL;
@@ -640,9 +611,7 @@ static int acpi_driver_detach(struct acpi_driver * drv)
  * number of devices that were claimed by the driver, or a negative
  * error status for failure.
  */
-int
-acpi_bus_register_driver (
-       struct acpi_driver      *driver)
+int acpi_bus_register_driver(struct acpi_driver *driver)
 {
        int count;
 
@@ -661,8 +630,8 @@ acpi_bus_register_driver (
 
        return_VALUE(count);
 }
-EXPORT_SYMBOL(acpi_bus_register_driver);
 
+EXPORT_SYMBOL(acpi_bus_register_driver);
 
 /**
  * acpi_bus_unregister_driver 
@@ -670,9 +639,7 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
  * Unregisters a driver with the ACPI bus.  Searches the namespace for all
  * devices that match the driver's criteria and unbinds.
  */
-int
-acpi_bus_unregister_driver (
-       struct acpi_driver      *driver)
+int acpi_bus_unregister_driver(struct acpi_driver *driver)
 {
        int error = 0;
 
@@ -685,11 +652,12 @@ acpi_bus_unregister_driver (
                        spin_lock(&acpi_device_lock);
                        list_del_init(&driver->node);
                        spin_unlock(&acpi_device_lock);
-               } 
-       } else 
+               }
+       } else
                error = -EINVAL;
        return_VALUE(error);
 }
+
 EXPORT_SYMBOL(acpi_bus_unregister_driver);
 
 /**
@@ -698,18 +666,17 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver);
  * Parses the list of registered drivers looking for a driver applicable for
  * the specified device.
  */
-static int
-acpi_bus_find_driver (
-       struct acpi_device      *device)
+static int acpi_bus_find_driver(struct acpi_device *device)
 {
-       int                     result = 0;
-       struct list_head        * node, *next;
+       int result = 0;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
 
        spin_lock(&acpi_device_lock);
-       list_for_each_safe(node,next,&acpi_bus_drivers) {
-               struct acpi_driver * driver = container_of(node,struct acpi_driver,node);
+       list_for_each_safe(node, next, &acpi_bus_drivers) {
+               struct acpi_driver *driver =
+                   container_of(node, struct acpi_driver, node);
 
                atomic_inc(&driver->references);
                spin_unlock(&acpi_device_lock);
@@ -723,21 +690,18 @@ acpi_bus_find_driver (
        }
        spin_unlock(&acpi_device_lock);
 
- Done:
     Done:
        return_VALUE(result);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Device Enumeration
    -------------------------------------------------------------------------- */
 
-static int 
-acpi_bus_get_flags (
-       struct acpi_device      *device)
+static int acpi_bus_get_flags(struct acpi_device *device)
 {
-       acpi_status             status = AE_OK;
-       acpi_handle             temp = NULL;
+       acpi_status status = AE_OK;
+       acpi_handle temp = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_bus_get_flags");
 
@@ -788,11 +752,12 @@ acpi_bus_get_flags (
        return_VALUE(0);
 }
 
-static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handle, int type)
+static void acpi_device_get_busid(struct acpi_device *device,
+                                 acpi_handle handle, int type)
 {
-       char                    bus_id[5] = {'?',0};
-       struct acpi_buffer      buffer = {sizeof(bus_id), bus_id};
-       int                     i = 0;
+       char bus_id[5] = { '?', 0 };
+       struct acpi_buffer buffer = { sizeof(bus_id), bus_id };
+       int i = 0;
 
        /*
         * Bus ID
@@ -824,21 +789,22 @@ static void acpi_device_get_busid(struct acpi_device * device, acpi_handle handl
        }
 }
 
-static void acpi_device_set_id(struct acpi_device * device, struct acpi_device * parent,
-                              acpi_handle handle, int type)
+static void acpi_device_set_id(struct acpi_device *device,
+                              struct acpi_device *parent, acpi_handle handle,
+                              int type)
 {
-       struct acpi_device_info *info;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       char                    *hid = NULL;
-       char                    *uid = NULL;
+       struct acpi_device_info *info;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       char *hid = NULL;
+       char *uid = NULL;
        struct acpi_compatible_id_list *cid_list = NULL;
-       acpi_status             status;
+       acpi_status status;
 
        switch (type) {
        case ACPI_BUS_TYPE_DEVICE:
                status = acpi_get_object_info(handle, &buffer);
                if (ACPI_FAILURE(status)) {
-                       printk("%s: Error reading device info\n",__FUNCTION__);
+                       printk("%s: Error reading device info\n", __FUNCTION__);
                        return;
                }
 
@@ -904,7 +870,7 @@ static void acpi_device_set_id(struct acpi_device * device, struct acpi_device *
        acpi_os_free(buffer.pointer);
 }
 
-static int acpi_device_set_context(struct acpi_device * device, int type)
+static int acpi_device_set_context(struct acpi_device *device, int type)
 {
        acpi_status status = AE_OK;
        int result = 0;
@@ -916,10 +882,10 @@ static int acpi_device_set_context(struct acpi_device * device, int type)
         * to be careful with fixed-feature devices as they all attach to the
         * root object.
         */
-       if (type != ACPI_BUS_TYPE_POWER_BUTTON && 
+       if (type != ACPI_BUS_TYPE_POWER_BUTTON &&
            type != ACPI_BUS_TYPE_SLEEP_BUTTON) {
                status = acpi_attach_data(device->handle,
-                       acpi_bus_data_handler, device);
+                                         acpi_bus_data_handler, device);
 
                if (ACPI_FAILURE(status)) {
                        printk("Error attaching device data\n");
@@ -929,12 +895,13 @@ static int acpi_device_set_context(struct acpi_device * device, int type)
        return result;
 }
 
-static void acpi_device_get_debug_info(struct acpi_device * device, acpi_handle handle, int type)
+static void acpi_device_get_debug_info(struct acpi_device *device,
+                                      acpi_handle handle, int type)
 {
 #ifdef CONFIG_ACPI_DEBUG_OUTPUT
-       char            *type_string = NULL;
-       char            name[80] = {'?','\0'};
-       struct acpi_buffer      buffer = {sizeof(name), name};
+       char *type_string = NULL;
+       char name[80] = { '?', '\0' };
+       struct acpi_buffer buffer = { sizeof(name), name };
 
        switch (type) {
        case ACPI_BUS_TYPE_DEVICE:
@@ -968,18 +935,14 @@ static void acpi_device_get_debug_info(struct acpi_device * device, acpi_handle
        }
 
        printk(KERN_DEBUG "Found %s %s [%p]\n", type_string, name, handle);
-#endif /*CONFIG_ACPI_DEBUG_OUTPUT*/
+#endif                         /*CONFIG_ACPI_DEBUG_OUTPUT */
 }
 
-
-static int
-acpi_bus_remove (
-       struct acpi_device *dev,
-       int rmdevice)
+static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
 {
-       int                     result = 0;
-       struct acpi_driver      *driver;
-       
+       int result = 0;
+       struct acpi_driver *driver;
+
        ACPI_FUNCTION_TRACE("acpi_bus_remove");
 
        if (!dev)
@@ -1012,22 +975,18 @@ acpi_bus_remove (
                if ((dev->parent) && (dev->parent->ops.unbind))
                        dev->parent->ops.unbind(dev);
        }
-       
+
        acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
 
        return_VALUE(0);
 }
 
-
 static int
-acpi_add_single_object (
-       struct acpi_device      **child,
-       struct acpi_device      *parent,
-       acpi_handle             handle,
-       int                     type)
+acpi_add_single_object(struct acpi_device **child,
+                      struct acpi_device *parent, acpi_handle handle, int type)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_add_single_object");
 
@@ -1044,7 +1003,7 @@ acpi_add_single_object (
        device->handle = handle;
        device->parent = parent;
 
-       acpi_device_get_busid(device,handle,type);
+       acpi_device_get_busid(device, handle, type);
 
        /*
         * Flags
@@ -1092,7 +1051,7 @@ acpi_add_single_object (
         * Hardware ID, Unique ID, & Bus Address
         * -------------------------------------
         */
-       acpi_device_set_id(device,parent,handle,type);
+       acpi_device_set_id(device, parent, handle, type);
 
        /*
         * Power Management
@@ -1104,7 +1063,7 @@ acpi_add_single_object (
                        goto end;
        }
 
-       /*
+       /*
         * Wakeup device management
         *-----------------------
         */
@@ -1124,12 +1083,12 @@ acpi_add_single_object (
                        goto end;
        }
 
-       if ((result = acpi_device_set_context(device,type)))
+       if ((result = acpi_device_set_context(device, type)))
                goto end;
 
-       acpi_device_get_debug_info(device,handle,type);
+       acpi_device_get_debug_info(device, handle, type);
 
-       acpi_device_register(device,parent);
+       acpi_device_register(device, parent);
 
        /*
         * Bind _ADR-Based Devices
@@ -1154,7 +1113,7 @@ acpi_add_single_object (
         */
        result = acpi_bus_find_driver(device);
 
-end:
+      end:
        if (!result)
                *child = device;
        else {
@@ -1166,17 +1125,15 @@ end:
        return_VALUE(result);
 }
 
-
-static int acpi_bus_scan (struct acpi_device   *start,
-               struct acpi_bus_ops *ops)
+static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_device      *parent = NULL;
-       struct acpi_device      *child = NULL;
-       acpi_handle             phandle = NULL;
-       acpi_handle             chandle = NULL;
-       acpi_object_type        type = 0;
-       u32                     level = 1;
+       acpi_status status = AE_OK;
+       struct acpi_device *parent = NULL;
+       struct acpi_device *child = NULL;
+       acpi_handle phandle = NULL;
+       acpi_handle chandle = NULL;
+       acpi_object_type type = 0;
+       u32 level = 1;
 
        ACPI_FUNCTION_TRACE("acpi_bus_scan");
 
@@ -1185,7 +1142,7 @@ static int acpi_bus_scan (struct acpi_device      *start,
 
        parent = start;
        phandle = start->handle;
-       
+
        /*
         * Parse through the ACPI namespace, identify all 'devices', and
         * create a new 'struct acpi_device' for each.
@@ -1193,7 +1150,7 @@ static int acpi_bus_scan (struct acpi_device      *start,
        while ((level > 0) && parent) {
 
                status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,
-                       chandle, &chandle);
+                                             chandle, &chandle);
 
                /*
                 * If this scope is exhausted then move our way back up.
@@ -1243,12 +1200,12 @@ static int acpi_bus_scan (struct acpi_device    *start,
 
                if (ops->acpi_op_add)
                        status = acpi_add_single_object(&child, parent,
-                                       chandle, type);
-                else
+                                                       chandle, type);
+               else
                        status = acpi_bus_get_device(chandle, &child);
 
-                if (ACPI_FAILURE(status))
-                        continue;
+               if (ACPI_FAILURE(status))
+                       continue;
 
                if (ops->acpi_op_start) {
                        status = acpi_start_single_object(child);
@@ -1264,7 +1221,7 @@ static int acpi_bus_scan (struct acpi_device      *start,
                 * which will be enumerated when the parent is inserted).
                 *
                 * TBD: Need notifications and other detection mechanisms
-                *      in place before we can fully implement this.
+                *      in place before we can fully implement this.
                 */
                if (child->status.present) {
                        status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
@@ -1282,11 +1239,8 @@ static int acpi_bus_scan (struct acpi_device     *start,
 }
 
 int
-acpi_bus_add (
-       struct acpi_device      **child,
-       struct acpi_device      *parent,
-       acpi_handle             handle,
-       int                     type)
+acpi_bus_add(struct acpi_device **child,
+            struct acpi_device *parent, acpi_handle handle, int type)
 {
        int result;
        struct acpi_bus_ops ops;
@@ -1301,11 +1255,10 @@ acpi_bus_add (
        }
        return_VALUE(result);
 }
+
 EXPORT_SYMBOL(acpi_bus_add);
 
-int
-acpi_bus_start (
-       struct acpi_device *device)
+int acpi_bus_start(struct acpi_device *device)
 {
        int result;
        struct acpi_bus_ops ops;
@@ -1323,26 +1276,25 @@ acpi_bus_start (
        }
        return_VALUE(result);
 }
+
 EXPORT_SYMBOL(acpi_bus_start);
 
-static int
-acpi_bus_trim(struct acpi_device       *start,
-               int rmdevice)
+static int acpi_bus_trim(struct acpi_device *start, int rmdevice)
 {
-       acpi_status             status;
-       struct acpi_device      *parent, *child;
-       acpi_handle             phandle, chandle;
-       acpi_object_type        type;
-       u32                     level = 1;
-       int                     err = 0;
-
-       parent  = start;
+       acpi_status status;
+       struct acpi_device *parent, *child;
+       acpi_handle phandle, chandle;
+       acpi_object_type type;
+       u32 level = 1;
+       int err = 0;
+
+       parent = start;
        phandle = start->handle;
        child = chandle = NULL;
 
        while ((level > 0) && parent && (!err)) {
                status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,
-                       chandle, &chandle);
+                                             chandle, &chandle);
 
                /*
                 * If this scope is exhausted then move our way back up.
@@ -1381,12 +1333,10 @@ acpi_bus_trim(struct acpi_device        *start,
        return err;
 }
 
-static int
-acpi_bus_scan_fixed (
-       struct acpi_device      *root)
+static int acpi_bus_scan_fixed(struct acpi_device *root)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
 
@@ -1398,14 +1348,16 @@ acpi_bus_scan_fixed (
         */
        if (acpi_fadt.pwr_button == 0) {
                result = acpi_add_single_object(&device, acpi_root,
-                       NULL, ACPI_BUS_TYPE_POWER_BUTTON);
+                                               NULL,
+                                               ACPI_BUS_TYPE_POWER_BUTTON);
                if (!result)
                        result = acpi_start_single_object(device);
        }
 
        if (acpi_fadt.sleep_button == 0) {
                result = acpi_add_single_object(&device, acpi_root,
-                       NULL, ACPI_BUS_TYPE_SLEEP_BUTTON);
+                                               NULL,
+                                               ACPI_BUS_TYPE_SLEEP_BUTTON);
                if (!result)
                        result = acpi_start_single_object(device);
        }
@@ -1413,7 +1365,6 @@ acpi_bus_scan_fixed (
        return_VALUE(result);
 }
 
-
 static int __init acpi_scan_init(void)
 {
        int result;
@@ -1430,7 +1381,7 @@ static int __init acpi_scan_init(void)
         * Create the root device in the bus's device tree
         */
        result = acpi_add_single_object(&acpi_root, NULL, ACPI_ROOT_OBJECT,
-               ACPI_BUS_TYPE_SYSTEM);
+                                       ACPI_BUS_TYPE_SYSTEM);
        if (result)
                goto Done;
 
@@ -1450,7 +1401,7 @@ static int __init acpi_scan_init(void)
        if (result)
                acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
 
- Done:
     Done:
        return_VALUE(result);
 }
 
index f93d2ee54800517590d28f2d77767124962eb89f..a5f947de879bc62a52ade449c729cf5ffe5b69c5 100644 (file)
@@ -95,4 +95,4 @@ static int acpi_poweroff_init(void)
 
 late_initcall(acpi_poweroff_init);
 
-#endif /* CONFIG_PM */
+#endif                         /* CONFIG_PM */
index 1be99f0996d6b4515630ec8b4e2cedf62c006f07..09a603f3523ec148df72d54d629ef4712fdbe8c6 100644 (file)
 
 #include "sleep.h"
 
-#ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP
-#define ACPI_SYSTEM_FILE_SLEEP         "sleep"
-#endif
-
-#define ACPI_SYSTEM_FILE_ALARM         "alarm"
-#define ACPI_SYSTEM_FILE_WAKEUP_DEVICE   "wakeup"
-
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("sleep")
-
+ACPI_MODULE_NAME("sleep")
 #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP
-
 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
 {
-       int                     i;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show");
 
        for (i = 0; i <= ACPI_STATE_S5; i++) {
                if (sleep_states[i]) {
-                       seq_printf(seq,"S%d ", i);
+                       seq_printf(seq, "S%d ", i);
                        if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f)
                                seq_printf(seq, "S4bios ");
                }
@@ -50,24 +41,21 @@ static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file)
 }
 
 static ssize_t
-acpi_system_write_sleep (
-       struct file             *file,
-       const char __user       *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_write_sleep(struct file *file,
+                       const char __user * buffer, size_t count, loff_t * ppos)
 {
-       char    str[12];
-       u32     state = 0;
-       int     error = 0;
+       char str[12];
+       u32 state = 0;
+       int error = 0;
 
        if (count > sizeof(str) - 1)
                goto Done;
-       memset(str,0,sizeof(str));
+       memset(str, 0, sizeof(str));
        if (copy_from_user(str, buffer, count))
                return -EFAULT;
 
        /* Check for S4 bios request */
-       if (!strcmp(str,"4b")) {
+       if (!strcmp(str, "4b")) {
                error = acpi_suspend(4);
                goto Done;
        }
@@ -79,17 +67,17 @@ acpi_system_write_sleep (
        }
 #endif
        error = acpi_suspend(state);
- Done:
     Done:
        return error ? error : count;
 }
-#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
+#endif                         /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
 
 static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
 {
-       u32                     sec, min, hr;
-       u32                     day, mo, yr;
-       unsigned char           rtc_control = 0;
-       unsigned long           flags;
+       u32 sec, min, hr;
+       u32 day, mo, yr;
+       unsigned char rtc_control = 0;
+       unsigned long flags;
 
        ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show");
 
@@ -105,13 +93,14 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
                /* ACPI spec: only low 6 its should be cared */
                day = CMOS_READ(acpi_gbl_FADT->day_alrm) & 0x3F;
        else
-               day =  CMOS_READ(RTC_DAY_OF_MONTH);
+               day = CMOS_READ(RTC_DAY_OF_MONTH);
        if (acpi_gbl_FADT->mon_alrm)
                mo = CMOS_READ(acpi_gbl_FADT->mon_alrm);
        else
                mo = CMOS_READ(RTC_MONTH);
        if (acpi_gbl_FADT->century)
-               yr = CMOS_READ(acpi_gbl_FADT->century) * 100 + CMOS_READ(RTC_YEAR);
+               yr = CMOS_READ(acpi_gbl_FADT->century) * 100 +
+                   CMOS_READ(RTC_YEAR);
        else
                yr = CMOS_READ(RTC_YEAR);
 
@@ -126,33 +115,33 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
                BCD_TO_BIN(yr);
        }
 
-       /* we're trusting the FADT (see above)*/
+       /* we're trusting the FADT (see above) */
        if (!acpi_gbl_FADT->century)
-       /* If we're not trusting the FADT, we should at least make it
-        * right for _this_ century... ehm, what is _this_ century?
-        *
-        * TBD:
-        *  ASAP: find piece of code in the kernel, e.g. star tracker driver,
-        *        which we can trust to determine the century correctly. Atom
-        *        watch driver would be nice, too...
-        *
-        *  if that has not happened, change for first release in 2050:
-        *        if (yr<50)
-        *                yr += 2100;
-        *        else
-        *                yr += 2000;   // current line of code
-        *
-        *  if that has not happened either, please do on 2099/12/31:23:59:59
-        *        s/2000/2100
-        *
-        */
+               /* If we're not trusting the FADT, we should at least make it
+                * right for _this_ century... ehm, what is _this_ century?
+                *
+                * TBD:
+                *  ASAP: find piece of code in the kernel, e.g. star tracker driver,
+                *        which we can trust to determine the century correctly. Atom
+                *        watch driver would be nice, too...
+                *
+                *  if that has not happened, change for first release in 2050:
+                *        if (yr<50)
+                *                yr += 2100;
+                *        else
+                *                yr += 2000;   // current line of code
+                *
+                *  if that has not happened either, please do on 2099/12/31:23:59:59
+                *        s/2000/2100
+                *
+                */
                yr += 2000;
 
-       seq_printf(seq,"%4.4u-", yr);
-       (mo > 12)  ? seq_puts(seq, "**-")  : seq_printf(seq, "%2.2u-", mo);
-       (day > 31) ? seq_puts(seq, "** ")  : seq_printf(seq, "%2.2u ", day);
-       (hr > 23)  ? seq_puts(seq, "**:")  : seq_printf(seq, "%2.2u:", hr);
-       (min > 59) ? seq_puts(seq, "**:")  : seq_printf(seq, "%2.2u:", min);
+       seq_printf(seq, "%4.4u-", yr);
+       (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo);
+       (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day);
+       (hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr);
+       (min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min);
        (sec > 59) ? seq_puts(seq, "**\n") : seq_printf(seq, "%2.2u\n", sec);
 
        return 0;
@@ -163,15 +152,11 @@ static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data);
 }
 
-
-static int
-get_date_field (
-       char                    **p,
-       u32                     *value)
+static int get_date_field(char **p, u32 * value)
 {
-       char                    *next = NULL;
-       char                    *string_end = NULL;
-       int                     result = -EINVAL;
+       char *next = NULL;
+       char *string_end = NULL;
+       int result = -EINVAL;
 
        /*
         * Try to find delimeter, only to insert null.  The end of the
@@ -193,26 +178,22 @@ get_date_field (
        return result;
 }
 
-
 static ssize_t
-acpi_system_write_alarm (
-       struct file             *file,
-       const char __user       *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_write_alarm(struct file *file,
+                       const char __user * buffer, size_t count, loff_t * ppos)
 {
-       int                     result = 0;
-       char                    alarm_string[30] = {'\0'};
-       char                    *p = alarm_string;
-       u32                     sec, min, hr, day, mo, yr;
-       int                     adjust = 0;
-       unsigned char           rtc_control = 0;
+       int result = 0;
+       char alarm_string[30] = { '\0' };
+       char *p = alarm_string;
+       u32 sec, min, hr, day, mo, yr;
+       int adjust = 0;
+       unsigned char rtc_control = 0;
 
        ACPI_FUNCTION_TRACE("acpi_system_write_alarm");
 
        if (count > sizeof(alarm_string) - 1)
                return_VALUE(-EINVAL);
-       
+
        if (copy_from_user(alarm_string, buffer, count))
                return_VALUE(-EFAULT);
 
@@ -271,10 +252,10 @@ acpi_system_write_alarm (
        }
 
        if (adjust) {
-               yr  += CMOS_READ(RTC_YEAR);
-               mo  += CMOS_READ(RTC_MONTH);
+               yr += CMOS_READ(RTC_YEAR);
+               mo += CMOS_READ(RTC_MONTH);
                day += CMOS_READ(RTC_DAY_OF_MONTH);
-               hr  += CMOS_READ(RTC_HOURS);
+               hr += CMOS_READ(RTC_HOURS);
                min += CMOS_READ(RTC_MINUTES);
                sec += CMOS_READ(RTC_SECONDS);
        }
@@ -343,7 +324,7 @@ acpi_system_write_alarm (
        if (acpi_gbl_FADT->mon_alrm)
                CMOS_WRITE(mo, acpi_gbl_FADT->mon_alrm);
        if (acpi_gbl_FADT->century)
-               CMOS_WRITE(yr/100, acpi_gbl_FADT->century);
+               CMOS_WRITE(yr / 100, acpi_gbl_FADT->century);
        /* enable the rtc alarm interrupt */
        rtc_control |= RTC_AIE;
        CMOS_WRITE(rtc_control, RTC_CONTROL);
@@ -357,35 +338,33 @@ acpi_system_write_alarm (
        *ppos += count;
 
        result = 0;
-end:
+      end:
        return_VALUE(result ? result : count);
 }
 
-extern struct list_head        acpi_wakeup_device_list;
+extern struct list_head acpi_wakeup_device_list;
 extern spinlock_t acpi_device_lock;
 
 static int
 acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        seq_printf(seq, "Device Sleep state     Status\n");
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, struct acpi_device, wakeup_list);
+               struct acpi_device *dev =
+                   container_of(node, struct acpi_device, wakeup_list);
 
                if (!dev->wakeup.flags.valid)
                        continue;
                spin_unlock(&acpi_device_lock);
-               if (dev->wakeup.flags.run_wake)
-                       seq_printf(seq, "%4s    %4d             %8s\n",
-                               dev->pnp.bus_id, (u32) dev->wakeup.sleep_state,
-                               dev->wakeup.state.enabled ? "*enabled" : "*disabled");
-               else
-                       seq_printf(seq, "%4s    %4d             %8s\n",
-                               dev->pnp.bus_id, (u32) dev->wakeup.sleep_state,
-                               dev->wakeup.state.enabled ? "enabled" : "disabled");
+               seq_printf(seq, "%4s    %4d             %s%8s\n",
+                          dev->pnp.bus_id,
+                          (u32) dev->wakeup.sleep_state,
+                          dev->wakeup.flags.run_wake ? "*" : "",
+                          dev->wakeup.state.enabled ? "enabled" : "disabled");
                spin_lock(&acpi_device_lock);
        }
        spin_unlock(&acpi_device_lock);
@@ -393,19 +372,18 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 }
 
 static ssize_t
-acpi_system_write_wakeup_device (
-       struct file             *file,
-       const char __user       *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_write_wakeup_device(struct file *file,
+                               const char __user * buffer,
+                               size_t count, loff_t * ppos)
 {
-       struct list_head * node, * next;
-       char            strbuf[5];
-       char            str[5] = "";
-       int             len = count;
+       struct list_head *node, *next;
+       char strbuf[5];
+       char str[5] = "";
+       int len = count;
        struct acpi_device *found_dev = NULL;
 
-       if (len > 4) len = 4;
+       if (len > 4)
+               len = 4;
 
        if (copy_from_user(strbuf, buffer, len))
                return -EFAULT;
@@ -414,28 +392,36 @@ acpi_system_write_wakeup_device (
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, struct acpi_device, wakeup_list);
+               struct acpi_device *dev =
+                   container_of(node, struct acpi_device, wakeup_list);
                if (!dev->wakeup.flags.valid)
                        continue;
 
                if (!strncmp(dev->pnp.bus_id, str, 4)) {
-                       dev->wakeup.state.enabled = dev->wakeup.state.enabled ? 0:1;
+                       dev->wakeup.state.enabled =
+                           dev->wakeup.state.enabled ? 0 : 1;
                        found_dev = dev;
                        break;
                }
        }
        if (found_dev) {
                list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-                       struct acpi_device * dev = container_of(node,
-                               struct acpi_device, wakeup_list);
+                       struct acpi_device *dev = container_of(node,
+                                                              struct
+                                                              acpi_device,
+                                                              wakeup_list);
 
                        if ((dev != found_dev) &&
-                               (dev->wakeup.gpe_number == found_dev->wakeup.gpe_number) &&
-                               (dev->wakeup.gpe_device == found_dev->wakeup.gpe_device)) {
-                               printk(KERN_WARNING "ACPI: '%s' and '%s' have the same GPE, "
-                                       "can't disable/enable one seperately\n",
-                                       dev->pnp.bus_id, found_dev->pnp.bus_id);
-                               dev->wakeup.state.enabled = found_dev->wakeup.state.enabled;
+                           (dev->wakeup.gpe_number ==
+                            found_dev->wakeup.gpe_number)
+                           && (dev->wakeup.gpe_device ==
+                               found_dev->wakeup.gpe_device)) {
+                               printk(KERN_WARNING
+                                      "ACPI: '%s' and '%s' have the same GPE, "
+                                      "can't disable/enable one seperately\n",
+                                      dev->pnp.bus_id, found_dev->pnp.bus_id);
+                               dev->wakeup.state.enabled =
+                                   found_dev->wakeup.state.enabled;
                        }
                }
        }
@@ -446,37 +432,37 @@ acpi_system_write_wakeup_device (
 static int
 acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file)
 {
-       return single_open(file, acpi_system_wakeup_device_seq_show, PDE(inode)->data);
+       return single_open(file, acpi_system_wakeup_device_seq_show,
+                          PDE(inode)->data);
 }
 
 static struct file_operations acpi_system_wakeup_device_fops = {
-       .open           = acpi_system_wakeup_device_open_fs,
-       .read           = seq_read,
-       .write          = acpi_system_write_wakeup_device,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_system_wakeup_device_open_fs,
+       .read = seq_read,
+       .write = acpi_system_write_wakeup_device,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP
 static struct file_operations acpi_system_sleep_fops = {
-       .open           = acpi_system_sleep_open_fs,
-       .read           = seq_read,
-       .write          = acpi_system_write_sleep,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_system_sleep_open_fs,
+       .read = seq_read,
+       .write = acpi_system_write_sleep,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
-#endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
+#endif                         /* CONFIG_ACPI_SLEEP_PROC_SLEEP */
 
 static struct file_operations acpi_system_alarm_fops = {
-       .open           = acpi_system_alarm_open_fs,
-       .read           = seq_read,
-       .write          = acpi_system_write_alarm,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_system_alarm_open_fs,
+       .read = seq_read,
+       .write = acpi_system_write_alarm,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-
-static u32 rtc_handler(void * context)
+static u32 rtc_handler(void *context)
 {
        acpi_clear_event(ACPI_EVENT_RTC);
        acpi_disable_event(ACPI_EVENT_RTC, 0);
@@ -486,28 +472,31 @@ static u32 rtc_handler(void * context)
 
 static int acpi_sleep_proc_init(void)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        if (acpi_disabled)
                return 0;
+
 #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP
-       /* 'sleep' [R/W]*/
-       entry = create_proc_entry(ACPI_SYSTEM_FILE_SLEEP,
-                                 S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir);
+       /* 'sleep' [R/W] */
+       entry =
+           create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
+                             acpi_root_dir);
        if (entry)
                entry->proc_fops = &acpi_system_sleep_fops;
 #endif
 
        /* 'alarm' [R/W] */
-       entry = create_proc_entry(ACPI_SYSTEM_FILE_ALARM,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir);
+       entry =
+           create_proc_entry("alarm", S_IFREG | S_IRUGO | S_IWUSR,
+                             acpi_root_dir);
        if (entry)
                entry->proc_fops = &acpi_system_alarm_fops;
 
-       /* 'wakeup device' [R/W]*/
-       entry = create_proc_entry(ACPI_SYSTEM_FILE_WAKEUP_DEVICE,
-                                 S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir);
+       /* 'wakeup device' [R/W] */
+       entry =
+           create_proc_entry("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
+                             acpi_root_dir);
        if (entry)
                entry->proc_fops = &acpi_system_wakeup_device_fops;
 
index d9b199969d5d5f044277174fda48a1b8beceacad..4134ed43d026537e1886b288081ae33a09b046e6 100644 (file)
@@ -12,9 +12,9 @@
 #include "sleep.h"
 
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("wakeup_devices")
+ACPI_MODULE_NAME("wakeup_devices")
 
-extern struct list_head        acpi_wakeup_device_list;
+extern struct list_head acpi_wakeup_device_list;
 extern spinlock_t acpi_device_lock;
 
 #ifdef CONFIG_ACPI_SLEEP
@@ -25,22 +25,21 @@ extern spinlock_t acpi_device_lock;
  * is higher than requested sleep level
  */
 
-void
-acpi_enable_wakeup_device_prep(
-       u8              sleep_state)
+void acpi_enable_wakeup_device_prep(u8 sleep_state)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_prep");
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, 
-                       struct acpi_device, wakeup_list);
-               
-               if (!dev->wakeup.flags.valid || 
-                       !dev->wakeup.state.enabled ||
-                       (sleep_state > (u32) dev->wakeup.sleep_state))
+               struct acpi_device *dev = container_of(node,
+                                                      struct acpi_device,
+                                                      wakeup_list);
+
+               if (!dev->wakeup.flags.valid ||
+                   !dev->wakeup.state.enabled ||
+                   (sleep_state > (u32) dev->wakeup.sleep_state))
                        continue;
 
                spin_unlock(&acpi_device_lock);
@@ -55,11 +54,9 @@ acpi_enable_wakeup_device_prep(
  *     @sleep_state:   ACPI state
  * Enable all wakup devices's GPE
  */
-void
-acpi_enable_wakeup_device(
-       u8              sleep_state)
+void acpi_enable_wakeup_device(u8 sleep_state)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        /* 
         * Caution: this routine must be invoked when interrupt is disabled 
@@ -68,33 +65,35 @@ acpi_enable_wakeup_device(
        ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device");
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, 
-                       struct acpi_device, wakeup_list);
+               struct acpi_device *dev = container_of(node,
+                                                      struct acpi_device,
+                                                      wakeup_list);
 
                /* If users want to disable run-wake GPE,
                 * we only disable it for wake and leave it for runtime
                 */
                if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) {
                        spin_unlock(&acpi_device_lock);
-                       acpi_set_gpe_type(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_GPE_TYPE_RUNTIME);
+                       acpi_set_gpe_type(dev->wakeup.gpe_device,
+                                         dev->wakeup.gpe_number,
+                                         ACPI_GPE_TYPE_RUNTIME);
                        /* Re-enable it, since set_gpe_type will disable it */
-                       acpi_enable_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_ISR);
+                       acpi_enable_gpe(dev->wakeup.gpe_device,
+                                       dev->wakeup.gpe_number, ACPI_ISR);
                        spin_lock(&acpi_device_lock);
                        continue;
                }
 
                if (!dev->wakeup.flags.valid ||
-                       !dev->wakeup.state.enabled ||
-                       (sleep_state > (u32) dev->wakeup.sleep_state))
+                   !dev->wakeup.state.enabled ||
+                   (sleep_state > (u32) dev->wakeup.sleep_state))
                        continue;
 
                spin_unlock(&acpi_device_lock);
                /* run-wake GPE has been enabled */
                if (!dev->wakeup.flags.run_wake)
-                       acpi_enable_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_ISR);
+                       acpi_enable_gpe(dev->wakeup.gpe_device,
+                                       dev->wakeup.gpe_number, ACPI_ISR);
                dev->wakeup.state.active = 1;
                spin_lock(&acpi_device_lock);
        }
@@ -106,43 +105,43 @@ acpi_enable_wakeup_device(
  *     @sleep_state:   ACPI state
  * Disable all wakup devices's GPE and wakeup capability
  */
-void
-acpi_disable_wakeup_device (
-       u8              sleep_state)
+void acpi_disable_wakeup_device(u8 sleep_state)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device");
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, 
-                       struct acpi_device, wakeup_list);
+               struct acpi_device *dev = container_of(node,
+                                                      struct acpi_device,
+                                                      wakeup_list);
 
                if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) {
                        spin_unlock(&acpi_device_lock);
-                       acpi_set_gpe_type(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
+                       acpi_set_gpe_type(dev->wakeup.gpe_device,
+                                         dev->wakeup.gpe_number,
+                                         ACPI_GPE_TYPE_WAKE_RUN);
                        /* Re-enable it, since set_gpe_type will disable it */
-                       acpi_enable_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_NOT_ISR);
+                       acpi_enable_gpe(dev->wakeup.gpe_device,
+                                       dev->wakeup.gpe_number, ACPI_NOT_ISR);
                        spin_lock(&acpi_device_lock);
                        continue;
                }
 
-               if (!dev->wakeup.flags.valid || 
-                       !dev->wakeup.state.active ||
-                       (sleep_state > (u32) dev->wakeup.sleep_state))
+               if (!dev->wakeup.flags.valid ||
+                   !dev->wakeup.state.active ||
+                   (sleep_state > (u32) dev->wakeup.sleep_state))
                        continue;
 
                spin_unlock(&acpi_device_lock);
                acpi_disable_wakeup_device_power(dev);
                /* Never disable run-wake GPE */
                if (!dev->wakeup.flags.run_wake) {
-                       acpi_disable_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_NOT_ISR);
-                       acpi_clear_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_NOT_ISR);
+                       acpi_disable_gpe(dev->wakeup.gpe_device,
+                                        dev->wakeup.gpe_number, ACPI_NOT_ISR);
+                       acpi_clear_gpe(dev->wakeup.gpe_device,
+                                      dev->wakeup.gpe_number, ACPI_NOT_ISR);
                }
                dev->wakeup.state.active = 0;
                spin_lock(&acpi_device_lock);
@@ -152,7 +151,7 @@ acpi_disable_wakeup_device (
 
 static int __init acpi_wakeup_device_init(void)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        if (acpi_disabled)
                return 0;
@@ -160,16 +159,18 @@ static int __init acpi_wakeup_device_init(void)
 
        spin_lock(&acpi_device_lock);
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node, 
-                       struct acpi_device, wakeup_list);
-               
+               struct acpi_device *dev = container_of(node,
+                                                      struct acpi_device,
+                                                      wakeup_list);
+
                /* In case user doesn't load button driver */
                if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) {
                        spin_unlock(&acpi_device_lock);
-                       acpi_set_gpe_type(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
-                       acpi_enable_gpe(dev->wakeup.gpe_device, 
-                               dev->wakeup.gpe_number, ACPI_NOT_ISR);
+                       acpi_set_gpe_type(dev->wakeup.gpe_device,
+                                         dev->wakeup.gpe_number,
+                                         ACPI_GPE_TYPE_WAKE_RUN);
+                       acpi_enable_gpe(dev->wakeup.gpe_device,
+                                       dev->wakeup.gpe_number, ACPI_NOT_ISR);
                        dev->wakeup.state.enabled = 1;
                        spin_lock(&acpi_device_lock);
                }
@@ -193,17 +194,19 @@ late_initcall(acpi_wakeup_device_init);
  */
 void acpi_wakeup_gpe_poweroff_prepare(void)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
 
        list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-               struct acpi_device * dev = container_of(node,
-                       struct acpi_device, wakeup_list);
+               struct acpi_device *dev = container_of(node,
+                                                      struct acpi_device,
+                                                      wakeup_list);
 
                /* The GPE can wakeup system from S5, don't touch it */
-               if ((u32)dev->wakeup.sleep_state == ACPI_STATE_S5)
+               if ((u32) dev->wakeup.sleep_state == ACPI_STATE_S5)
                        continue;
                /* acpi_set_gpe_type will automatically disable GPE */
                acpi_set_gpe_type(dev->wakeup.gpe_device,
-                       dev->wakeup.gpe_number, ACPI_GPE_TYPE_RUNTIME);
+                                 dev->wakeup.gpe_number,
+                                 ACPI_GPE_TYPE_RUNTIME);
        }
 }
index 8925a6ca5f87561707f00b7fd8d2219d1f317b71..e4308c7a6743ba54766cac05669db2e9fd2e8c64 100644 (file)
 
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_SYSTEM_COMPONENT
-ACPI_MODULE_NAME               ("acpi_system")
-
+ACPI_MODULE_NAME("acpi_system")
 #define ACPI_SYSTEM_CLASS              "system"
 #define ACPI_SYSTEM_DRIVER_NAME                "ACPI System Driver"
 #define ACPI_SYSTEM_DEVICE_NAME                "System"
@@ -41,15 +39,13 @@ ACPI_MODULE_NAME            ("acpi_system")
 #define ACPI_SYSTEM_FILE_EVENT         "event"
 #define ACPI_SYSTEM_FILE_DSDT          "dsdt"
 #define ACPI_SYSTEM_FILE_FADT          "fadt"
-
-extern FADT_DESCRIPTOR         acpi_fadt;
+extern FADT_DESCRIPTOR acpi_fadt;
 
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static int
-acpi_system_read_info (struct seq_file *seq, void *offset)
+static int acpi_system_read_info(struct seq_file *seq, void *offset)
 {
        ACPI_FUNCTION_TRACE("acpi_system_read_info");
 
@@ -63,28 +59,26 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file)
 }
 
 static struct file_operations acpi_system_info_ops = {
-       .open           = acpi_system_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_system_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*);
+static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t,
+                                    loff_t *);
 
 static struct file_operations acpi_system_dsdt_ops = {
-       .read =                 acpi_system_read_dsdt,
+       .read = acpi_system_read_dsdt,
 };
 
 static ssize_t
-acpi_system_read_dsdt (
-       struct file             *file,
-       char                    __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_read_dsdt(struct file *file,
+                     char __user * buffer, size_t count, loff_t * ppos)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_buffer      dsdt = {ACPI_ALLOCATE_BUFFER, NULL};
-       ssize_t                 res;
+       acpi_status status = AE_OK;
+       struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
+       ssize_t res;
 
        ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
 
@@ -99,23 +93,20 @@ acpi_system_read_dsdt (
        return_VALUE(res);
 }
 
-
-static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*);
+static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t,
+                                    loff_t *);
 
 static struct file_operations acpi_system_fadt_ops = {
-       .read =                 acpi_system_read_fadt,
+       .read = acpi_system_read_fadt,
 };
 
 static ssize_t
-acpi_system_read_fadt (
-       struct file             *file,
-       char                    __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_system_read_fadt(struct file *file,
+                     char __user * buffer, size_t count, loff_t * ppos)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_buffer      fadt = {ACPI_ALLOCATE_BUFFER, NULL};
-       ssize_t                 res;
+       acpi_status status = AE_OK;
+       struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL };
+       ssize_t res;
 
        ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
 
@@ -130,12 +121,11 @@ acpi_system_read_fadt (
        return_VALUE(res);
 }
 
-
-static int __init acpi_system_init (void)
+static int __init acpi_system_init(void)
 {
-       struct proc_dir_entry   *entry;
+       struct proc_dir_entry *entry;
        int error = 0;
-       char * name;
+       char *name;
 
        ACPI_FUNCTION_TRACE("acpi_system_init");
 
@@ -144,8 +134,7 @@ static int __init acpi_system_init (void)
 
        /* 'info' [R] */
        name = ACPI_SYSTEM_FILE_INFO;
-       entry = create_proc_entry(name,
-               S_IRUGO, acpi_root_dir);
+       entry = create_proc_entry(name, S_IRUGO, acpi_root_dir);
        if (!entry)
                goto Error;
        else {
@@ -157,7 +146,7 @@ static int __init acpi_system_init (void)
        entry = create_proc_entry(name, S_IRUSR, acpi_root_dir);
        if (entry)
                entry->proc_fops = &acpi_system_dsdt_ops;
-       else 
+       else
                goto Error;
 
        /* 'fadt' [R] */
@@ -168,12 +157,12 @@ static int __init acpi_system_init (void)
        else
                goto Error;
 
- Done:
     Done:
        return_VALUE(error);
 
- Error:
-       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                        "Unable to create '%s' proc fs entry\n", name));
     Error:
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                         "Unable to create '%s' proc fs entry\n", name));
 
        remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir);
        remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir);
@@ -183,5 +172,4 @@ static int __init acpi_system_init (void)
        goto Done;
 }
 
-
 subsys_initcall(acpi_system_init);
index fb64bd5d2e18c9bc42c0cbb56c5739dbbca955b6..a2bf25b05e1c08156d77571505e162c51fbc7075 100644 (file)
 #define ACPI_MAX_TABLES                256
 
 static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
-       [ACPI_TABLE_UNKNOWN]    = "????",
-       [ACPI_APIC]             = "APIC",
-       [ACPI_BOOT]             = "BOOT",
-       [ACPI_DBGP]             = "DBGP",
-       [ACPI_DSDT]             = "DSDT",
-       [ACPI_ECDT]             = "ECDT",
-       [ACPI_ETDT]             = "ETDT",
-       [ACPI_FADT]             = "FACP",
-       [ACPI_FACS]             = "FACS",
-       [ACPI_OEMX]             = "OEM",
-       [ACPI_PSDT]             = "PSDT",
-       [ACPI_SBST]             = "SBST",
-       [ACPI_SLIT]             = "SLIT",
-       [ACPI_SPCR]             = "SPCR",
-       [ACPI_SRAT]             = "SRAT",
-       [ACPI_SSDT]             = "SSDT",
-       [ACPI_SPMI]             = "SPMI",
-       [ACPI_HPET]             = "HPET",
-       [ACPI_MCFG]             = "MCFG",
+       [ACPI_TABLE_UNKNOWN] = "????",
+       [ACPI_APIC] = "APIC",
+       [ACPI_BOOT] = "BOOT",
+       [ACPI_DBGP] = "DBGP",
+       [ACPI_DSDT] = "DSDT",
+       [ACPI_ECDT] = "ECDT",
+       [ACPI_ETDT] = "ETDT",
+       [ACPI_FADT] = "FACP",
+       [ACPI_FACS] = "FACS",
+       [ACPI_OEMX] = "OEM",
+       [ACPI_PSDT] = "PSDT",
+       [ACPI_SBST] = "SBST",
+       [ACPI_SLIT] = "SLIT",
+       [ACPI_SPCR] = "SPCR",
+       [ACPI_SRAT] = "SRAT",
+       [ACPI_SSDT] = "SSDT",
+       [ACPI_SPMI] = "SPMI",
+       [ACPI_HPET] = "HPET",
+       [ACPI_MCFG] = "MCFG",
 };
 
 static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
@@ -66,52 +66,44 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
 
 /* System Description Table (RSDT/XSDT) */
 struct acpi_table_sdt {
-       unsigned long           pa;
-       enum acpi_table_id      id;
-       unsigned long           size;
+       unsigned long pa;
+       enum acpi_table_id id;
+       unsigned long size;
 } __attribute__ ((packed));
 
-static unsigned long           sdt_pa;         /* Physical Address */
-static unsigned long           sdt_count;      /* Table count */
+static unsigned long sdt_pa;   /* Physical Address */
+static unsigned long sdt_count;        /* Table count */
 
-static struct acpi_table_sdt   sdt_entry[ACPI_MAX_TABLES];
+static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES];
 
-void
-acpi_table_print (
-       struct acpi_table_header *header,
-       unsigned long           phys_addr)
+void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr)
 {
-       char                    *name = NULL;
+       char *name = NULL;
 
        if (!header)
                return;
 
        /* Some table signatures aren't good table names */
 
-       if (!strncmp((char *) &header->signature,
-               acpi_table_signatures[ACPI_APIC],
-               sizeof(header->signature))) {
+       if (!strncmp((char *)&header->signature,
+                    acpi_table_signatures[ACPI_APIC],
+                    sizeof(header->signature))) {
                name = "MADT";
-       }
-       else if (!strncmp((char *) &header->signature,
-               acpi_table_signatures[ACPI_FADT],
-               sizeof(header->signature))) {
+       } else if (!strncmp((char *)&header->signature,
+                           acpi_table_signatures[ACPI_FADT],
+                           sizeof(header->signature))) {
                name = "FADT";
-       }
-       else
+       } else
                name = header->signature;
 
-       printk(KERN_DEBUG PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n",
-               name, header->revision, header->oem_id,
-               header->oem_table_id, header->oem_revision,
-               header->asl_compiler_id, header->asl_compiler_revision,
-               (void *) phys_addr);
+       printk(KERN_DEBUG PREFIX
+              "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", name,
+              header->revision, header->oem_id, header->oem_table_id,
+              header->oem_revision, header->asl_compiler_id,
+              header->asl_compiler_revision, (void *)phys_addr);
 }
 
-
-void
-acpi_table_print_madt_entry (
-       acpi_table_entry_header *header)
+void acpi_table_print_madt_entry(acpi_table_entry_header * header)
 {
        if (!header)
                return;
@@ -119,113 +111,127 @@ acpi_table_print_madt_entry (
        switch (header->type) {
 
        case ACPI_MADT_LAPIC:
-       {
-               struct acpi_table_lapic *p =
-                       (struct acpi_table_lapic*) header;
-               printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
-                       p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled");
-       }
+               {
+                       struct acpi_table_lapic *p =
+                           (struct acpi_table_lapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+                              p->acpi_id, p->id,
+                              p->flags.enabled ? "enabled" : "disabled");
+               }
                break;
 
        case ACPI_MADT_IOAPIC:
-       {
-               struct acpi_table_ioapic *p =
-                       (struct acpi_table_ioapic*) header;
-               printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
-                       p->id, p->address, p->global_irq_base);
-       }
+               {
+                       struct acpi_table_ioapic *p =
+                           (struct acpi_table_ioapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
+                              p->id, p->address, p->global_irq_base);
+               }
                break;
 
        case ACPI_MADT_INT_SRC_OVR:
-       {
-               struct acpi_table_int_src_ovr *p =
-                       (struct acpi_table_int_src_ovr*) header;
-               printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
-                       p->bus, p->bus_irq, p->global_irq,
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger]);
-               if(p->flags.reserved)
-                       printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
-                               p->flags.reserved);
+               {
+                       struct acpi_table_int_src_ovr *p =
+                           (struct acpi_table_int_src_ovr *)header;
+                       printk(KERN_INFO PREFIX
+                              "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
+                              p->bus, p->bus_irq, p->global_irq,
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger]);
+                       if (p->flags.reserved)
+                               printk(KERN_INFO PREFIX
+                                      "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
+                                      p->flags.reserved);
 
-       }
+               }
                break;
 
        case ACPI_MADT_NMI_SRC:
-       {
-               struct acpi_table_nmi_src *p =
-                       (struct acpi_table_nmi_src*) header;
-               printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n",
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger], p->global_irq);
-       }
+               {
+                       struct acpi_table_nmi_src *p =
+                           (struct acpi_table_nmi_src *)header;
+                       printk(KERN_INFO PREFIX
+                              "NMI_SRC (%s %s global_irq %d)\n",
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->global_irq);
+               }
                break;
 
        case ACPI_MADT_LAPIC_NMI:
-       {
-               struct acpi_table_lapic_nmi *p =
-                       (struct acpi_table_lapic_nmi*) header;
-               printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
-                       p->acpi_id,
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger], p->lint);
-       }
+               {
+                       struct acpi_table_lapic_nmi *p =
+                           (struct acpi_table_lapic_nmi *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
+                              p->acpi_id,
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->lint);
+               }
                break;
 
        case ACPI_MADT_LAPIC_ADDR_OVR:
-       {
-               struct acpi_table_lapic_addr_ovr *p =
-                       (struct acpi_table_lapic_addr_ovr*) header;
-               printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n",
-                       (void *) (unsigned long) p->address);
-       }
+               {
+                       struct acpi_table_lapic_addr_ovr *p =
+                           (struct acpi_table_lapic_addr_ovr *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC_ADDR_OVR (address[%p])\n",
+                              (void *)(unsigned long)p->address);
+               }
                break;
 
        case ACPI_MADT_IOSAPIC:
-       {
-               struct acpi_table_iosapic *p =
-                       (struct acpi_table_iosapic*) header;
-               printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
-                       p->id, (void *) (unsigned long) p->address, p->global_irq_base);
-       }
+               {
+                       struct acpi_table_iosapic *p =
+                           (struct acpi_table_iosapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
+                              p->id, (void *)(unsigned long)p->address,
+                              p->global_irq_base);
+               }
                break;
 
        case ACPI_MADT_LSAPIC:
-       {
-               struct acpi_table_lsapic *p =
-                       (struct acpi_table_lsapic*) header;
-               printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
-                       p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled");
-       }
+               {
+                       struct acpi_table_lsapic *p =
+                           (struct acpi_table_lsapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
+                              p->acpi_id, p->id, p->eid,
+                              p->flags.enabled ? "enabled" : "disabled");
+               }
                break;
 
        case ACPI_MADT_PLAT_INT_SRC:
-       {
-               struct acpi_table_plat_int_src *p =
-                       (struct acpi_table_plat_int_src*) header;
-               printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger],
-                       p->type, p->id, p->eid, p->iosapic_vector, p->global_irq);
-       }
+               {
+                       struct acpi_table_plat_int_src *p =
+                           (struct acpi_table_plat_int_src *)header;
+                       printk(KERN_INFO PREFIX
+                              "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->type, p->id, p->eid, p->iosapic_vector,
+                              p->global_irq);
+               }
                break;
 
        default:
-               printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n",
-                       header->type);
+               printk(KERN_WARNING PREFIX
+                      "Found unsupported MADT entry (type = 0x%x)\n",
+                      header->type);
                break;
        }
 }
 
-
 static int
-acpi_table_compute_checksum (
-       void                    *table_pointer,
-       unsigned long           length)
+acpi_table_compute_checksum(void *table_pointer, unsigned long length)
 {
-       u8                      *p = (u8 *) table_pointer;
-       unsigned long           remains = length;
-       unsigned long           sum = 0;
+       u8 *p = (u8 *) table_pointer;
+       unsigned long remains = length;
+       unsigned long sum = 0;
 
        if (!p || !length)
                return -EINVAL;
@@ -241,9 +247,8 @@ acpi_table_compute_checksum (
  * for acpi_blacklisted(), acpi_table_get_sdt()
  */
 int __init
-acpi_get_table_header_early (
-       enum acpi_table_id      id,
-       struct acpi_table_header **header)
+acpi_get_table_header_early(enum acpi_table_id id,
+                           struct acpi_table_header **header)
 {
        unsigned int i;
        enum acpi_table_id temp_id;
@@ -260,7 +265,7 @@ acpi_get_table_header_early (
                if (sdt_entry[i].id != temp_id)
                        continue;
                *header = (void *)
-                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+                   __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
                if (!*header) {
                        printk(KERN_WARNING PREFIX "Unable to map %s\n",
                               acpi_table_signatures[temp_id]);
@@ -277,14 +282,17 @@ acpi_get_table_header_early (
 
        /* Map the DSDT header via the pointer in the FADT */
        if (id == ACPI_DSDT) {
-               struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header;
+               struct fadt_descriptor_rev2 *fadt =
+                   (struct fadt_descriptor_rev2 *)*header;
 
                if (fadt->revision == 3 && fadt->Xdsdt) {
-                       *header = (void *) __acpi_map_table(fadt->Xdsdt,
-                                       sizeof(struct acpi_table_header));
+                       *header = (void *)__acpi_map_table(fadt->Xdsdt,
+                                                          sizeof(struct
+                                                                 acpi_table_header));
                } else if (fadt->V1_dsdt) {
-                       *header = (void *) __acpi_map_table(fadt->V1_dsdt,
-                                       sizeof(struct acpi_table_header));
+                       *header = (void *)__acpi_map_table(fadt->V1_dsdt,
+                                                          sizeof(struct
+                                                                 acpi_table_header));
                } else
                        *header = NULL;
 
@@ -296,21 +304,19 @@ acpi_get_table_header_early (
 
        return 0;
 }
-        
 
 int __init
-acpi_table_parse_madt_family (
-       enum acpi_table_id      id,
-       unsigned long           madt_size,
-       int                     entry_id,
-       acpi_madt_entry_handler handler,
-       unsigned int            max_entries)
+acpi_table_parse_madt_family(enum acpi_table_id id,
+                            unsigned long madt_size,
+                            int entry_id,
+                            acpi_madt_entry_handler handler,
+                            unsigned int max_entries)
 {
-       void                    *madt = NULL;
-       acpi_table_entry_header *entry;
-       unsigned int            count = 0;
-       unsigned long           madt_end;
-       unsigned int            i;
+       void *madt = NULL;
+       acpi_table_entry_header *entry;
+       unsigned int count = 0;
+       unsigned long madt_end;
+       unsigned int i;
 
        if (!handler)
                return -EINVAL;
@@ -321,7 +327,7 @@ acpi_table_parse_madt_family (
                if (sdt_entry[i].id != id)
                        continue;
                madt = (void *)
-                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+                   __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
                if (!madt) {
                        printk(KERN_WARNING PREFIX "Unable to map %s\n",
                               acpi_table_signatures[id]);
@@ -336,21 +342,22 @@ acpi_table_parse_madt_family (
                return -ENODEV;
        }
 
-       madt_end = (unsigned long) madt + sdt_entry[i].size;
+       madt_end = (unsigned long)madt + sdt_entry[i].size;
 
        /* Parse all entries looking for a match. */
 
        entry = (acpi_table_entry_header *)
-               ((unsigned long) madt + madt_size);
+           ((unsigned long)madt + madt_size);
 
-       while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
-               if (entry->type == entry_id &&
-                   (!max_entries || count++ < max_entries))
+       while (((unsigned long)entry) + sizeof(acpi_table_entry_header) <
+              madt_end) {
+               if (entry->type == entry_id
+                   && (!max_entries || count++ < max_entries))
                        if (handler(entry, madt_end))
                                return -EINVAL;
 
                entry = (acpi_table_entry_header *)
-                       ((unsigned long) entry + entry->length);
+                   ((unsigned long)entry + entry->length);
        }
        if (max_entries && count > max_entries) {
                printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
@@ -361,25 +368,19 @@ acpi_table_parse_madt_family (
        return count;
 }
 
-
 int __init
-acpi_table_parse_madt (
-       enum acpi_madt_entry_id id,
-       acpi_madt_entry_handler handler,
-       unsigned int max_entries)
+acpi_table_parse_madt(enum acpi_madt_entry_id id,
+                     acpi_madt_entry_handler handler, unsigned int max_entries)
 {
-       return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
-                                           id, handler, max_entries);
+       return acpi_table_parse_madt_family(ACPI_APIC,
+                                           sizeof(struct acpi_table_madt), id,
+                                           handler, max_entries);
 }
 
-
-int __init
-acpi_table_parse (
-       enum acpi_table_id      id,
-       acpi_table_handler      handler)
+int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
 {
-       int                     count = 0;
-       unsigned int            i = 0;
+       int count = 0;
+       unsigned int i = 0;
 
        if (!handler)
                return -EINVAL;
@@ -392,20 +393,18 @@ acpi_table_parse (
                        handler(sdt_entry[i].pa, sdt_entry[i].size);
 
                else
-                       printk(KERN_WARNING PREFIX "%d duplicate %s table ignored.\n",
-                               count, acpi_table_signatures[id]);
+                       printk(KERN_WARNING PREFIX
+                              "%d duplicate %s table ignored.\n", count,
+                              acpi_table_signatures[id]);
        }
 
        return count;
 }
 
-
-static int __init
-acpi_table_get_sdt (
-       struct acpi_table_rsdp  *rsdp)
+static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
 {
        struct acpi_table_header *header = NULL;
-       unsigned int            i, id = 0;
+       unsigned int i, id = 0;
 
        if (!rsdp)
                return -EINVAL;
@@ -413,24 +412,25 @@ acpi_table_get_sdt (
        /* First check XSDT (but only on ACPI 2.0-compatible systems) */
 
        if ((rsdp->revision >= 2) &&
-               (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) {
-                       
-               struct acpi_table_xsdt  *mapped_xsdt = NULL;
+           (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
+
+               struct acpi_table_xsdt *mapped_xsdt = NULL;
 
-               sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
+               sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+                   __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
 
                if (!header) {
-                       printk(KERN_WARNING PREFIX "Unable to map XSDT header\n");
+                       printk(KERN_WARNING PREFIX
+                              "Unable to map XSDT header\n");
                        return -ENODEV;
                }
 
                /* remap in the entire table before processing */
                mapped_xsdt = (struct acpi_table_xsdt *)
-                       __acpi_map_table(sdt_pa, header->length);
+                   __acpi_map_table(sdt_pa, header->length);
                if (!mapped_xsdt) {
                        printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
                        return -ENODEV;
@@ -438,7 +438,8 @@ acpi_table_get_sdt (
                header = &mapped_xsdt->header;
 
                if (strncmp(header->signature, "XSDT", 4)) {
-                       printk(KERN_WARNING PREFIX "XSDT signature incorrect\n");
+                       printk(KERN_WARNING PREFIX
+                              "XSDT signature incorrect\n");
                        return -ENODEV;
                }
 
@@ -447,36 +448,39 @@ acpi_table_get_sdt (
                        return -ENODEV;
                }
 
-               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3;
+               sdt_count =
+                   (header->length - sizeof(struct acpi_table_header)) >> 3;
                if (sdt_count > ACPI_MAX_TABLES) {
-                       printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
-                               (sdt_count - ACPI_MAX_TABLES));
+                       printk(KERN_WARNING PREFIX
+                              "Truncated %lu XSDT entries\n",
+                              (sdt_count - ACPI_MAX_TABLES));
                        sdt_count = ACPI_MAX_TABLES;
                }
 
                for (i = 0; i < sdt_count; i++)
-                       sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
+                       sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
        }
 
        /* Then check RSDT */
 
        else if (rsdp->rsdt_address) {
 
-               struct acpi_table_rsdt  *mapped_rsdt = NULL;
+               struct acpi_table_rsdt *mapped_rsdt = NULL;
 
                sdt_pa = rsdp->rsdt_address;
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+                   __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
                if (!header) {
-                       printk(KERN_WARNING PREFIX "Unable to map RSDT header\n");
+                       printk(KERN_WARNING PREFIX
+                              "Unable to map RSDT header\n");
                        return -ENODEV;
                }
 
                /* remap in the entire table before processing */
                mapped_rsdt = (struct acpi_table_rsdt *)
-                       __acpi_map_table(sdt_pa, header->length);
+                   __acpi_map_table(sdt_pa, header->length);
                if (!mapped_rsdt) {
                        printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
                        return -ENODEV;
@@ -484,7 +488,8 @@ acpi_table_get_sdt (
                header = &mapped_rsdt->header;
 
                if (strncmp(header->signature, "RSDT", 4)) {
-                       printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
+                       printk(KERN_WARNING PREFIX
+                              "RSDT signature incorrect\n");
                        return -ENODEV;
                }
 
@@ -493,19 +498,22 @@ acpi_table_get_sdt (
                        return -ENODEV;
                }
 
-               sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2;
+               sdt_count =
+                   (header->length - sizeof(struct acpi_table_header)) >> 2;
                if (sdt_count > ACPI_MAX_TABLES) {
-                       printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n",
-                               (sdt_count - ACPI_MAX_TABLES));
+                       printk(KERN_WARNING PREFIX
+                              "Truncated %lu RSDT entries\n",
+                              (sdt_count - ACPI_MAX_TABLES));
                        sdt_count = ACPI_MAX_TABLES;
                }
 
                for (i = 0; i < sdt_count; i++)
-                       sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
+                       sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
        }
 
        else {
-               printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+               printk(KERN_WARNING PREFIX
+                      "No System Description Table (RSDT/XSDT) specified in RSDP\n");
                return -ENODEV;
        }
 
@@ -515,18 +523,17 @@ acpi_table_get_sdt (
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_entry[i].pa,
-                               sizeof(struct acpi_table_header));
+                   __acpi_map_table(sdt_entry[i].pa,
+                                    sizeof(struct acpi_table_header));
                if (!header)
                        continue;
 
                /* remap in the entire table before processing */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_entry[i].pa,
-                               header->length);
+                   __acpi_map_table(sdt_entry[i].pa, header->length);
                if (!header)
                        continue;
-                      
+
                acpi_table_print(header, sdt_entry[i].pa);
 
                if (acpi_table_compute_checksum(header, header->length)) {
@@ -537,9 +544,9 @@ acpi_table_get_sdt (
                sdt_entry[i].size = header->length;
 
                for (id = 0; id < ACPI_TABLE_COUNT; id++) {
-                       if (!strncmp((char *) &header->signature,
-                               acpi_table_signatures[id],
-                               sizeof(header->signature))) {
+                       if (!strncmp((char *)&header->signature,
+                                    acpi_table_signatures[id],
+                                    sizeof(header->signature))) {
                                sdt_entry[i].id = id;
                        }
                }
@@ -551,7 +558,7 @@ acpi_table_get_sdt (
         * against. Unfortunately, we don't know the phys_addr, so just
         * print 0. Maybe no one will notice.
         */
-       if(!acpi_get_table_header_early(ACPI_DSDT, &header))
+       if (!acpi_get_table_header_early(ACPI_DSDT, &header))
                acpi_table_print(header, 0);
 
        return 0;
@@ -566,12 +573,11 @@ acpi_table_get_sdt (
  * result: sdt_entry[] is initialized
  */
 
-int __init
-acpi_table_init (void)
+int __init acpi_table_init(void)
 {
-       struct acpi_table_rsdp  *rsdp = NULL;
-       unsigned long           rsdp_phys = 0;
-       int                     result = 0;
+       struct acpi_table_rsdp *rsdp = NULL;
+       unsigned long rsdp_phys = 0;
+       int result = 0;
 
        /* Locate and map the Root System Description Table (RSDP) */
 
@@ -581,19 +587,25 @@ acpi_table_init (void)
                return -ENODEV;
        }
 
-       rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys);
+       rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys);
        if (!rsdp) {
                printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
                return -ENODEV;
        }
 
-       printk(KERN_DEBUG PREFIX "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
-               rsdp->revision, rsdp->oem_id, (void *) rsdp_phys);
+       printk(KERN_DEBUG PREFIX
+              "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
+              rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
 
        if (rsdp->revision < 2)
-               result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp));
+               result =
+                   acpi_table_compute_checksum(rsdp,
+                                               sizeof(struct acpi_table_rsdp));
        else
-               result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length);
+               result =
+                   acpi_table_compute_checksum(rsdp,
+                                               ((struct acpi20_table_rsdp *)
+                                                rsdp)->length);
 
        if (result) {
                printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
index 92e0c31539bec52af192cc7ba940d5d5f99bcccf..a03939399fa9e309c7ef63ada9c01b90a0d4e2ad 100644 (file)
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbconvrt")
+ACPI_MODULE_NAME("tbconvrt")
 
 /* Local prototypes */
-
 static void
-acpi_tb_init_generic_address (
-       struct acpi_generic_address     *new_gas_struct,
-       u8                              register_bit_width,
-       acpi_physical_address           address);
+acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
+                            u8 register_bit_width,
+                            acpi_physical_address address);
 
 static void
-acpi_tb_convert_fadt1 (
-       struct fadt_descriptor_rev2    *local_fadt,
-       struct fadt_descriptor_rev1    *original_fadt);
+acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
+                     struct fadt_descriptor_rev1 *original_fadt);
 
 static void
-acpi_tb_convert_fadt2 (
-       struct fadt_descriptor_rev2    *local_fadt,
-       struct fadt_descriptor_rev2    *original_fadt);
-
+acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
+                     struct fadt_descriptor_rev2 *original_fadt);
 
 u8 acpi_fadt_is_v1;
 EXPORT_SYMBOL(acpi_fadt_is_v1);
@@ -87,21 +81,19 @@ EXPORT_SYMBOL(acpi_fadt_is_v1);
  ******************************************************************************/
 
 u32
-acpi_tb_get_table_count (
-       struct rsdp_descriptor          *RSDP,
-       struct acpi_table_header        *RSDT)
+acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
+                       struct acpi_table_header *RSDT)
 {
-       u32                             pointer_size;
+       u32 pointer_size;
 
+       ACPI_FUNCTION_ENTRY();
 
-       ACPI_FUNCTION_ENTRY ();
+       /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
 
-
-       if (RSDP->revision < 2) {
-               pointer_size = sizeof (u32);
-       }
-       else {
-               pointer_size = sizeof (u64);
+       if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+               pointer_size = sizeof(u32);
+       } else {
+               pointer_size = sizeof(u64);
        }
 
        /*
@@ -110,10 +102,10 @@ acpi_tb_get_table_count (
         * pointers contained within the RSDT/XSDT.  The size of the pointers
         * is architecture-dependent.
         */
-       return ((RSDT->length - sizeof (struct acpi_table_header)) / pointer_size);
+       return ((RSDT->length -
+                sizeof(struct acpi_table_header)) / pointer_size);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_convert_to_xsdt
@@ -126,64 +118,65 @@ acpi_tb_get_table_count (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_convert_to_xsdt (
-       struct acpi_table_desc          *table_info)
+acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info)
 {
-       acpi_size                       table_size;
-       u32                             i;
-       XSDT_DESCRIPTOR         *new_table;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_size table_size;
+       u32 i;
+       XSDT_DESCRIPTOR *new_table;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Compute size of the converted XSDT */
 
-       table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof (u64)) +
-                         sizeof (struct acpi_table_header);
+       table_size = ((acpi_size) acpi_gbl_rsdt_table_count * sizeof(u64)) +
+           sizeof(struct acpi_table_header);
 
        /* Allocate an XSDT */
 
-       new_table = ACPI_MEM_CALLOCATE (table_size);
+       new_table = ACPI_MEM_CALLOCATE(table_size);
        if (!new_table) {
                return (AE_NO_MEMORY);
        }
 
        /* Copy the header and set the length */
 
-       ACPI_MEMCPY (new_table, table_info->pointer, sizeof (struct acpi_table_header));
+       ACPI_MEMCPY(new_table, table_info->pointer,
+                   sizeof(struct acpi_table_header));
        new_table->length = (u32) table_size;
 
        /* Copy the table pointers */
 
        for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
-               if (acpi_gbl_RSDP->revision < 2) {
-                       ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
-                               (ACPI_CAST_PTR (struct rsdt_descriptor_rev1,
-                                       table_info->pointer))->table_offset_entry[i]);
-               }
-               else {
+               /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */
+
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+                       ACPI_STORE_ADDRESS(new_table->table_offset_entry[i],
+                                          (ACPI_CAST_PTR
+                                           (struct rsdt_descriptor_rev1,
+                                            table_info->pointer))->
+                                          table_offset_entry[i]);
+               } else {
                        new_table->table_offset_entry[i] =
-                               (ACPI_CAST_PTR (XSDT_DESCRIPTOR,
-                                       table_info->pointer))->table_offset_entry[i];
+                           (ACPI_CAST_PTR(XSDT_DESCRIPTOR,
+                                          table_info->pointer))->
+                           table_offset_entry[i];
                }
        }
 
        /* Delete the original table (either mapped or in a buffer) */
 
-       acpi_tb_delete_single_table (table_info);
+       acpi_tb_delete_single_table(table_info);
 
        /* Point the table descriptor to the new table */
 
-       table_info->pointer     = ACPI_CAST_PTR (struct acpi_table_header, new_table);
-       table_info->length      = table_size;
-       table_info->allocation  = ACPI_MEM_ALLOCATED;
+       table_info->pointer =
+           ACPI_CAST_PTR(struct acpi_table_header, new_table);
+       table_info->length = table_size;
+       table_info->allocation = ACPI_MEM_ALLOCATED;
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_init_generic_address
@@ -199,21 +192,19 @@ acpi_tb_convert_to_xsdt (
  ******************************************************************************/
 
 static void
-acpi_tb_init_generic_address (
-       struct acpi_generic_address     *new_gas_struct,
-       u8                              register_bit_width,
-       acpi_physical_address           address)
+acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct,
+                            u8 register_bit_width,
+                            acpi_physical_address address)
 {
 
-       ACPI_STORE_ADDRESS (new_gas_struct->address, address);
+       ACPI_STORE_ADDRESS(new_gas_struct->address, address);
 
        new_gas_struct->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
        new_gas_struct->register_bit_width = register_bit_width;
        new_gas_struct->register_bit_offset = 0;
-       new_gas_struct->access_width    = 0;
+       new_gas_struct->access_width = 0;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_convert_fadt1
@@ -228,9 +219,8 @@ acpi_tb_init_generic_address (
  ******************************************************************************/
 
 static void
-acpi_tb_convert_fadt1 (
-       struct fadt_descriptor_rev2    *local_fadt,
-       struct fadt_descriptor_rev1    *original_fadt)
+acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt,
+                     struct fadt_descriptor_rev1 *original_fadt)
 {
 
        /* ACPI 1.0 FACS */
@@ -243,12 +233,14 @@ acpi_tb_convert_fadt1 (
         * The 2.0 table is an extension of the 1.0 table, so the entire 1.0
         * table can be copied first, then expand some fields to 64 bits.
         */
-       ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev1));
+       ACPI_MEMCPY(local_fadt, original_fadt,
+                   sizeof(struct fadt_descriptor_rev1));
 
        /* Convert table pointers to 64-bit fields */
 
-       ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl, local_fadt->V1_firmware_ctrl);
-       ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
+       ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl,
+                          local_fadt->V1_firmware_ctrl);
+       ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt);
 
        /*
         * System Interrupt Model isn't used in ACPI 2.0
@@ -283,17 +275,17 @@ acpi_tb_convert_fadt1 (
         * It primarily adds the FADT reset mechanism.
         */
        if ((original_fadt->revision == 2) &&
-               (original_fadt->length == sizeof (struct fadt_descriptor_rev2_minus))) {
+           (original_fadt->length ==
+            sizeof(struct fadt_descriptor_rev2_minus))) {
                /*
                 * Grab the entire generic address struct, plus the 1-byte reset value
                 * that immediately follows.
                 */
-               ACPI_MEMCPY (&local_fadt->reset_register,
-                       &(ACPI_CAST_PTR (struct fadt_descriptor_rev2_minus,
-                               original_fadt))->reset_register,
-                       sizeof (struct acpi_generic_address) + 1);
-       }
-       else {
+               ACPI_MEMCPY(&local_fadt->reset_register,
+                           &(ACPI_CAST_PTR(struct fadt_descriptor_rev2_minus,
+                                           original_fadt))->reset_register,
+                           sizeof(struct acpi_generic_address) + 1);
+       } else {
                /*
                 * Since there isn't any equivalence in 1.0 and since it is highly
                 * likely that a 1.0 system has legacy support.
@@ -304,43 +296,60 @@ acpi_tb_convert_fadt1 (
        /*
         * Convert the V1.0 block addresses to V2.0 GAS structures
         */
-       acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk, local_fadt->pm1_evt_len,
-                         (acpi_physical_address)   local_fadt->V1_pm1a_evt_blk);
-       acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk, local_fadt->pm1_evt_len,
-                         (acpi_physical_address)   local_fadt->V1_pm1b_evt_blk);
-       acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk, local_fadt->pm1_cnt_len,
-                         (acpi_physical_address)   local_fadt->V1_pm1a_cnt_blk);
-       acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk, local_fadt->pm1_cnt_len,
-                         (acpi_physical_address)   local_fadt->V1_pm1b_cnt_blk);
-       acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk, local_fadt->pm2_cnt_len,
-                         (acpi_physical_address)   local_fadt->V1_pm2_cnt_blk);
-       acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk, local_fadt->pm_tm_len,
-                         (acpi_physical_address)   local_fadt->V1_pm_tmr_blk);
-       acpi_tb_init_generic_address (&local_fadt->xgpe0_blk, 0,
-                         (acpi_physical_address)   local_fadt->V1_gpe0_blk);
-       acpi_tb_init_generic_address (&local_fadt->xgpe1_blk, 0,
-                         (acpi_physical_address)   local_fadt->V1_gpe1_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk,
+                                    local_fadt->pm1_evt_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm1a_evt_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk,
+                                    local_fadt->pm1_evt_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm1b_evt_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk,
+                                    local_fadt->pm1_cnt_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm1a_cnt_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk,
+                                    local_fadt->pm1_cnt_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm1b_cnt_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk,
+                                    local_fadt->pm2_cnt_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm2_cnt_blk);
+       acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk,
+                                    local_fadt->pm_tm_len,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_pm_tmr_blk);
+       acpi_tb_init_generic_address(&local_fadt->xgpe0_blk, 0,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_gpe0_blk);
+       acpi_tb_init_generic_address(&local_fadt->xgpe1_blk, 0,
+                                    (acpi_physical_address) local_fadt->
+                                    V1_gpe1_blk);
 
        /* Create separate GAS structs for the PM1 Enable registers */
 
-       acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
-                (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
-                (acpi_physical_address)
-                       (local_fadt->xpm1a_evt_blk.address +
-                       ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
+       acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
+                                    (u8) ACPI_DIV_2(acpi_gbl_FADT->
+                                                    pm1_evt_len),
+                                    (acpi_physical_address)
+                                    (local_fadt->xpm1a_evt_blk.address +
+                                     ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len)));
 
        /* PM1B is optional; leave null if not present */
 
        if (local_fadt->xpm1b_evt_blk.address) {
-               acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
-                        (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
-                        (acpi_physical_address)
-                               (local_fadt->xpm1b_evt_blk.address +
-                               ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
+               acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
+                                            (u8) ACPI_DIV_2(acpi_gbl_FADT->
+                                                            pm1_evt_len),
+                                            (acpi_physical_address)
+                                            (local_fadt->xpm1b_evt_blk.
+                                             address +
+                                             ACPI_DIV_2(acpi_gbl_FADT->
+                                                        pm1_evt_len)));
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_convert_fadt2
@@ -356,14 +365,14 @@ acpi_tb_convert_fadt1 (
  ******************************************************************************/
 
 static void
-acpi_tb_convert_fadt2 (
-       struct fadt_descriptor_rev2    *local_fadt,
-       struct fadt_descriptor_rev2    *original_fadt)
+acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt,
+                     struct fadt_descriptor_rev2 *original_fadt)
 {
 
        /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */
 
-       ACPI_MEMCPY (local_fadt, original_fadt, sizeof (struct fadt_descriptor_rev2));
+       ACPI_MEMCPY(local_fadt, original_fadt,
+                   sizeof(struct fadt_descriptor_rev2));
 
        /*
         * "X" fields are optional extensions to the original V1.0 fields, so
@@ -371,86 +380,99 @@ acpi_tb_convert_fadt2 (
         * is zero.
         */
        if (!(local_fadt->xfirmware_ctrl)) {
-               ACPI_STORE_ADDRESS (local_fadt->xfirmware_ctrl,
-                       local_fadt->V1_firmware_ctrl);
+               ACPI_STORE_ADDRESS(local_fadt->xfirmware_ctrl,
+                                  local_fadt->V1_firmware_ctrl);
        }
 
        if (!(local_fadt->Xdsdt)) {
-               ACPI_STORE_ADDRESS (local_fadt->Xdsdt, local_fadt->V1_dsdt);
+               ACPI_STORE_ADDRESS(local_fadt->Xdsdt, local_fadt->V1_dsdt);
        }
 
        if (!(local_fadt->xpm1a_evt_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm1a_evt_blk,
-                       local_fadt->pm1_evt_len,
-                       (acpi_physical_address) local_fadt->V1_pm1a_evt_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm1a_evt_blk,
+                                            local_fadt->pm1_evt_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm1a_evt_blk);
        }
 
        if (!(local_fadt->xpm1b_evt_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm1b_evt_blk,
-                       local_fadt->pm1_evt_len,
-                       (acpi_physical_address) local_fadt->V1_pm1b_evt_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm1b_evt_blk,
+                                            local_fadt->pm1_evt_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm1b_evt_blk);
        }
 
        if (!(local_fadt->xpm1a_cnt_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm1a_cnt_blk,
-                       local_fadt->pm1_cnt_len,
-                       (acpi_physical_address) local_fadt->V1_pm1a_cnt_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm1a_cnt_blk,
+                                            local_fadt->pm1_cnt_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm1a_cnt_blk);
        }
 
        if (!(local_fadt->xpm1b_cnt_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm1b_cnt_blk,
-                       local_fadt->pm1_cnt_len,
-                       (acpi_physical_address) local_fadt->V1_pm1b_cnt_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm1b_cnt_blk,
+                                            local_fadt->pm1_cnt_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm1b_cnt_blk);
        }
 
        if (!(local_fadt->xpm2_cnt_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm2_cnt_blk,
-                       local_fadt->pm2_cnt_len,
-                       (acpi_physical_address) local_fadt->V1_pm2_cnt_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm2_cnt_blk,
+                                            local_fadt->pm2_cnt_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm2_cnt_blk);
        }
 
        if (!(local_fadt->xpm_tmr_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xpm_tmr_blk,
-                       local_fadt->pm_tm_len,
-                       (acpi_physical_address) local_fadt->V1_pm_tmr_blk);
+               acpi_tb_init_generic_address(&local_fadt->xpm_tmr_blk,
+                                            local_fadt->pm_tm_len,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_pm_tmr_blk);
        }
 
        if (!(local_fadt->xgpe0_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xgpe0_blk,
-                       0, (acpi_physical_address) local_fadt->V1_gpe0_blk);
+               acpi_tb_init_generic_address(&local_fadt->xgpe0_blk,
+                                            0,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_gpe0_blk);
        }
 
        if (!(local_fadt->xgpe1_blk.address)) {
-               acpi_tb_init_generic_address (&local_fadt->xgpe1_blk,
-                       0, (acpi_physical_address) local_fadt->V1_gpe1_blk);
+               acpi_tb_init_generic_address(&local_fadt->xgpe1_blk,
+                                            0,
+                                            (acpi_physical_address)
+                                            local_fadt->V1_gpe1_blk);
        }
 
        /* Create separate GAS structs for the PM1 Enable registers */
 
-       acpi_tb_init_generic_address (&acpi_gbl_xpm1a_enable,
-               (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
-               (acpi_physical_address)
-                       (local_fadt->xpm1a_evt_blk.address +
-                       ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
+       acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable,
+                                    (u8) ACPI_DIV_2(acpi_gbl_FADT->
+                                                    pm1_evt_len),
+                                    (acpi_physical_address)
+                                    (local_fadt->xpm1a_evt_blk.address +
+                                     ACPI_DIV_2(acpi_gbl_FADT->pm1_evt_len)));
 
        acpi_gbl_xpm1a_enable.address_space_id =
-               local_fadt->xpm1a_evt_blk.address_space_id;
+           local_fadt->xpm1a_evt_blk.address_space_id;
 
        /* PM1B is optional; leave null if not present */
 
        if (local_fadt->xpm1b_evt_blk.address) {
-               acpi_tb_init_generic_address (&acpi_gbl_xpm1b_enable,
-                       (u8) ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len),
-                       (acpi_physical_address)
-                               (local_fadt->xpm1b_evt_blk.address +
-                               ACPI_DIV_2 (acpi_gbl_FADT->pm1_evt_len)));
+               acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable,
+                                            (u8) ACPI_DIV_2(acpi_gbl_FADT->
+                                                            pm1_evt_len),
+                                            (acpi_physical_address)
+                                            (local_fadt->xpm1b_evt_blk.
+                                             address +
+                                             ACPI_DIV_2(acpi_gbl_FADT->
+                                                        pm1_evt_len)));
 
                acpi_gbl_xpm1b_enable.address_space_id =
-                       local_fadt->xpm1b_evt_blk.address_space_id;
+                   local_fadt->xpm1b_evt_blk.address_space_id;
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_convert_table_fadt
@@ -467,83 +489,76 @@ acpi_tb_convert_fadt2 (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_convert_table_fadt (
-       void)
+acpi_status acpi_tb_convert_table_fadt(void)
 {
-       struct fadt_descriptor_rev2    *local_fadt;
-       struct acpi_table_desc         *table_desc;
-
-
-       ACPI_FUNCTION_TRACE ("tb_convert_table_fadt");
+       struct fadt_descriptor_rev2 *local_fadt;
+       struct acpi_table_desc *table_desc;
 
+       ACPI_FUNCTION_TRACE("tb_convert_table_fadt");
 
        /*
         * acpi_gbl_FADT is valid. Validate the FADT length. The table must be
         * at least as long as the version 1.0 FADT
         */
-       if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev1)) {
-               ACPI_REPORT_ERROR (("FADT is invalid, too short: 0x%X\n",
-                       acpi_gbl_FADT->length));
-               return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+       if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev1)) {
+               ACPI_REPORT_ERROR(("FADT is invalid, too short: 0x%X\n",
+                                  acpi_gbl_FADT->length));
+               return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
        }
 
        /* Allocate buffer for the ACPI 2.0(+) FADT */
 
-       local_fadt = ACPI_MEM_CALLOCATE (sizeof (struct fadt_descriptor_rev2));
+       local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2));
        if (!local_fadt) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) {
-               if (acpi_gbl_FADT->length < sizeof (struct fadt_descriptor_rev2)) {
+               if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) {
                        /* Length is too short to be a V2.0 table */
 
-                       ACPI_REPORT_WARNING ((
-                               "Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n",
-                               acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
+                       ACPI_REPORT_WARNING(("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", acpi_gbl_FADT->length, acpi_gbl_FADT->revision));
 
-                       acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
-               }
-               else {
+                       acpi_tb_convert_fadt1(local_fadt,
+                                             (void *)acpi_gbl_FADT);
+               else {
                        /* Valid V2.0 table */
 
-                       acpi_tb_convert_fadt2 (local_fadt, acpi_gbl_FADT);
+                       acpi_tb_convert_fadt2(local_fadt, acpi_gbl_FADT);
                }
-       }
-       else {
+       } else {
                /* Valid V1.0 table */
 
-               acpi_tb_convert_fadt1 (local_fadt, (void *) acpi_gbl_FADT);
+               acpi_tb_convert_fadt1(local_fadt, (void *)acpi_gbl_FADT);
        }
 
        /* Global FADT pointer will point to the new common V2.0 FADT */
 
        acpi_gbl_FADT = local_fadt;
-       acpi_gbl_FADT->length = sizeof (FADT_DESCRIPTOR);
+       acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR);
 
        /* Free the original table */
 
        table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next;
-       acpi_tb_delete_single_table (table_desc);
+       acpi_tb_delete_single_table(table_desc);
 
        /* Install the new table */
 
-       table_desc->pointer     = ACPI_CAST_PTR (struct acpi_table_header, acpi_gbl_FADT);
-       table_desc->allocation  = ACPI_MEM_ALLOCATED;
-       table_desc->length      = sizeof (struct fadt_descriptor_rev2);
+       table_desc->pointer =
+           ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT);
+       table_desc->allocation = ACPI_MEM_ALLOCATED;
+       table_desc->length = sizeof(struct fadt_descriptor_rev2);
 
        /* Dump the entire FADT */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
-               "Hex dump of common internal FADT, size %d (%X)\n",
-               acpi_gbl_FADT->length, acpi_gbl_FADT->length));
-       ACPI_DUMP_BUFFER ((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length);
+       ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+                         "Hex dump of common internal FADT, size %d (%X)\n",
+                         acpi_gbl_FADT->length, acpi_gbl_FADT->length));
+       ACPI_DUMP_BUFFER((u8 *) (acpi_gbl_FADT), acpi_gbl_FADT->length);
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_build_common_facs
@@ -557,26 +572,21 @@ acpi_tb_convert_table_fadt (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_build_common_facs (
-       struct acpi_table_desc          *table_info)
+acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info)
 {
 
-       ACPI_FUNCTION_TRACE ("tb_build_common_facs");
-
+       ACPI_FUNCTION_TRACE("tb_build_common_facs");
 
        /* Absolute minimum length is 24, but the ACPI spec says 64 */
 
        if (acpi_gbl_FACS->length < 24) {
-               ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n",
-                       acpi_gbl_FACS->length));
-               return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+               ACPI_REPORT_ERROR(("Invalid FACS table length: 0x%X\n",
+                                  acpi_gbl_FACS->length));
+               return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH);
        }
 
        if (acpi_gbl_FACS->length < 64) {
-               ACPI_REPORT_WARNING ((
-                       "FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n",
-                       acpi_gbl_FACS->length));
+               ACPI_REPORT_WARNING(("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", acpi_gbl_FACS->length));
        }
 
        /* Copy fields to the new FACS */
@@ -584,22 +594,22 @@ acpi_tb_build_common_facs (
        acpi_gbl_common_fACS.global_lock = &(acpi_gbl_FACS->global_lock);
 
        if ((acpi_gbl_RSDP->revision < 2) ||
-               (acpi_gbl_FACS->length < 32) ||
-               (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
+           (acpi_gbl_FACS->length < 32) ||
+           (!(acpi_gbl_FACS->xfirmware_waking_vector))) {
                /* ACPI 1.0 FACS or short table or optional X_ field is zero */
 
-               acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR (u64,
-                               &(acpi_gbl_FACS->firmware_waking_vector));
+               acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64,
+                                                                           &
+                                                                           (acpi_gbl_FACS->
+                                                                            firmware_waking_vector));
                acpi_gbl_common_fACS.vector_width = 32;
-       }
-       else {
+       } else {
                /* ACPI 2.0 FACS with valid X_ field */
 
-               acpi_gbl_common_fACS.firmware_waking_vector = &acpi_gbl_FACS->xfirmware_waking_vector;
+               acpi_gbl_common_fACS.firmware_waking_vector =
+                   &acpi_gbl_FACS->xfirmware_waking_vector;
                acpi_gbl_common_fACS.vector_width = 64;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
-
index 4ab2aadc6133c3a18b58574c458c8fced517085b..6acd5aeb093efe9ebf7f31fdc71bf998a75493bc 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbget")
+ACPI_MODULE_NAME("tbget")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_tb_get_this_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info);
+acpi_tb_get_this_table(struct acpi_pointer *address,
+                      struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info);
 
 static acpi_status
-acpi_tb_table_override (
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info);
-
+acpi_tb_table_override(struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info);
 
 /*******************************************************************************
  *
@@ -78,37 +72,34 @@ acpi_tb_table_override (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_get_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_desc          *table_info)
+acpi_tb_get_table(struct acpi_pointer *address,
+                 struct acpi_table_desc *table_info)
 {
-       acpi_status                     status;
-       struct acpi_table_header        header;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_table");
+       acpi_status status;
+       struct acpi_table_header header;
 
+       ACPI_FUNCTION_TRACE("tb_get_table");
 
        /* Get the header in order to get signature and table size */
 
-       status = acpi_tb_get_table_header (address, &header);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_header(address, &header);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the entire table */
 
-       status = acpi_tb_get_table_body (address, &header, table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not get ACPI table (size %X), %s\n",
-                       header.length, acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_body(address, &header, table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not get ACPI table (size %X), %s\n",
+                                  header.length,
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_table_header
@@ -127,16 +118,13 @@ acpi_tb_get_table (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_get_table_header (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *return_header)
+acpi_tb_get_table_header(struct acpi_pointer *address,
+                        struct acpi_table_header *return_header)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_table_header        *header = NULL;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_table_header");
+       acpi_status status = AE_OK;
+       struct acpi_table_header *header = NULL;
 
+       ACPI_FUNCTION_TRACE("tb_get_table_header");
 
        /*
         * Flags contains the current processor mode (Virtual or Physical
@@ -148,46 +136,42 @@ acpi_tb_get_table_header (
 
                /* Pointer matches processor mode, copy the header */
 
-               ACPI_MEMCPY (return_header, address->pointer.logical,
-                       sizeof (struct acpi_table_header));
+               ACPI_MEMCPY(return_header, address->pointer.logical,
+                           sizeof(struct acpi_table_header));
                break;
 
-
        case ACPI_LOGMODE_PHYSPTR:
 
-               /* Create a logical address for the physical pointer*/
+               /* Create a logical address for the physical pointer */
 
-               status = acpi_os_map_memory (address->pointer.physical,
-                                sizeof (struct acpi_table_header), (void *) &header);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "Could not map memory at %8.8X%8.8X for length %X\n",
-                               ACPI_FORMAT_UINT64 (address->pointer.physical),
-                               sizeof (struct acpi_table_header)));
-                       return_ACPI_STATUS (status);
+               status = acpi_os_map_memory(address->pointer.physical,
+                                           sizeof(struct acpi_table_header),
+                                           (void *)&header);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64(address->pointer.physical), sizeof(struct acpi_table_header)));
+                       return_ACPI_STATUS(status);
                }
 
                /* Copy header and delete mapping */
 
-               ACPI_MEMCPY (return_header, header, sizeof (struct acpi_table_header));
-               acpi_os_unmap_memory (header, sizeof (struct acpi_table_header));
+               ACPI_MEMCPY(return_header, header,
+                           sizeof(struct acpi_table_header));
+               acpi_os_unmap_memory(header, sizeof(struct acpi_table_header));
                break;
 
-
        default:
 
-               ACPI_REPORT_ERROR (("Invalid address flags %X\n",
-                       address->pointer_type));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_REPORT_ERROR(("Invalid address flags %X\n",
+                                  address->pointer_type));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n",
-               return_header->signature));
+       ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Table Signature: [%4.4s]\n",
+                         return_header->signature));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_table_body
@@ -209,37 +193,33 @@ acpi_tb_get_table_header (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_get_table_body (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info)
+acpi_tb_get_table_body(struct acpi_pointer *address,
+                      struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_table_body");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("tb_get_table_body");
 
        if (!table_info || !address) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Attempt table override. */
 
-       status = acpi_tb_table_override (header, table_info);
-       if (ACPI_SUCCESS (status)) {
+       status = acpi_tb_table_override(header, table_info);
+       if (ACPI_SUCCESS(status)) {
                /* Table was overridden by the host OS */
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* No override, get the original table */
 
-       status = acpi_tb_get_this_table (address, header, table_info);
-       return_ACPI_STATUS (status);
+       status = acpi_tb_get_this_table(address, header, table_info);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_table_override
@@ -255,61 +235,57 @@ acpi_tb_get_table_body (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_table_override (
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info)
+acpi_tb_table_override(struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info)
 {
-       struct acpi_table_header        *new_table;
-       acpi_status                     status;
-       struct acpi_pointer             address;
-
-
-       ACPI_FUNCTION_TRACE ("tb_table_override");
+       struct acpi_table_header *new_table;
+       acpi_status status;
+       struct acpi_pointer address;
 
+       ACPI_FUNCTION_TRACE("tb_table_override");
 
        /*
         * The OSL will examine the header and decide whether to override this
         * table.  If it decides to override, a table will be returned in new_table,
         * which we will then copy.
         */
-       status = acpi_os_table_override (header, &new_table);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_os_table_override(header, &new_table);
+       if (ACPI_FAILURE(status)) {
                /* Some severe error from the OSL, but we basically ignore it */
 
-               ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+               ACPI_REPORT_ERROR(("Could not override ACPI table, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        if (!new_table) {
                /* No table override */
 
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        /*
         * We have a new table to override the old one.  Get a copy of
         * the new one.  We know that the new table has a logical pointer.
         */
-       address.pointer_type    = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
+       address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
        address.pointer.logical = new_table;
 
-       status = acpi_tb_get_this_table (&address, new_table, table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not copy override ACPI table, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_this_table(&address, new_table, table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not copy override ACPI table, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /* Copy the table info */
 
-       ACPI_REPORT_INFO (("Table [%4.4s] replaced by host OS\n",
-               table_info->pointer->signature));
+       ACPI_REPORT_INFO(("Table [%4.4s] replaced by host OS\n",
+                         table_info->pointer->signature));
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_this_table
@@ -329,18 +305,15 @@ acpi_tb_table_override (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_get_this_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info)
+acpi_tb_get_this_table(struct acpi_pointer *address,
+                      struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info)
 {
-       struct acpi_table_header        *full_table = NULL;
-       u8                              allocation;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_this_table");
+       struct acpi_table_header *full_table = NULL;
+       u8 allocation;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("tb_get_this_table");
 
        /*
         * Flags contains the current processor mode (Virtual or Physical
@@ -352,38 +325,33 @@ acpi_tb_get_this_table (
 
                /* Pointer matches processor mode, copy the table to a new buffer */
 
-               full_table = ACPI_MEM_ALLOCATE (header->length);
+               full_table = ACPI_MEM_ALLOCATE(header->length);
                if (!full_table) {
-                       ACPI_REPORT_ERROR ((
-                               "Could not allocate table memory for [%4.4s] length %X\n",
-                               header->signature, header->length));
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       ACPI_REPORT_ERROR(("Could not allocate table memory for [%4.4s] length %X\n", header->signature, header->length));
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                /* Copy the entire table (including header) to the local buffer */
 
-               ACPI_MEMCPY (full_table, address->pointer.logical, header->length);
+               ACPI_MEMCPY(full_table, address->pointer.logical,
+                           header->length);
 
                /* Save allocation type */
 
                allocation = ACPI_MEM_ALLOCATED;
                break;
 
-
        case ACPI_LOGMODE_PHYSPTR:
 
                /*
                 * Just map the table's physical memory
                 * into our address space.
                 */
-               status = acpi_os_map_memory (address->pointer.physical,
-                                (acpi_size) header->length, (void *) &full_table);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_REPORT_ERROR ((
-                               "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n",
-                               header->signature,
-                               ACPI_FORMAT_UINT64 (address->pointer.physical),
-                               header->length));
+               status = acpi_os_map_memory(address->pointer.physical,
+                                           (acpi_size) header->length,
+                                           (void *)&full_table);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_REPORT_ERROR(("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", header->signature, ACPI_FORMAT_UINT64(address->pointer.physical), header->length));
                        return (status);
                }
 
@@ -392,12 +360,11 @@ acpi_tb_get_this_table (
                allocation = ACPI_MEM_MAPPED;
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid address flags %X\n",
-                       address->pointer_type));
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid address flags %X\n",
+                                 address->pointer_type));
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -405,10 +372,10 @@ acpi_tb_get_this_table (
         * even the ones whose signature we don't recognize
         */
        if (table_info->type != ACPI_TABLE_FACS) {
-               status = acpi_tb_verify_table_checksum (full_table);
+               status = acpi_tb_verify_table_checksum(full_table);
 
 #if (!ACPI_CHECKSUM_ABORT)
-               if (ACPI_FAILURE (status)) {
+               if (ACPI_FAILURE(status)) {
                        /* Ignore the error if configuration says so */
 
                        status = AE_OK;
@@ -418,19 +385,19 @@ acpi_tb_get_this_table (
 
        /* Return values */
 
-       table_info->pointer     = full_table;
-       table_info->length      = (acpi_size) header->length;
-       table_info->allocation  = allocation;
+       table_info->pointer = full_table;
+       table_info->length = (acpi_size) header->length;
+       table_info->allocation = allocation;
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
-               full_table->signature,
-               ACPI_FORMAT_UINT64 (address->pointer.physical), full_table));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Found table [%4.4s] at %8.8X%8.8X, mapped/copied to %p\n",
+                         full_table->signature,
+                         ACPI_FORMAT_UINT64(address->pointer.physical),
+                         full_table));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_table_ptr
@@ -447,24 +414,20 @@ acpi_tb_get_this_table (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_get_table_ptr (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_table_header        **table_ptr_loc)
+acpi_tb_get_table_ptr(acpi_table_type table_type,
+                     u32 instance, struct acpi_table_header **table_ptr_loc)
 {
-       struct acpi_table_desc          *table_desc;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_table_ptr");
+       struct acpi_table_desc *table_desc;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("tb_get_table_ptr");
 
        if (!acpi_gbl_DSDT) {
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        if (table_type > ACPI_TABLE_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -476,15 +439,16 @@ acpi_tb_get_table_ptr (
 
                *table_ptr_loc = NULL;
                if (acpi_gbl_table_lists[table_type].next) {
-                       *table_ptr_loc = acpi_gbl_table_lists[table_type].next->pointer;
+                       *table_ptr_loc =
+                           acpi_gbl_table_lists[table_type].next->pointer;
                }
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Check for instance out of range */
 
        if (instance > acpi_gbl_table_lists[table_type].count) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Walk the list to get the desired table
@@ -503,6 +467,5 @@ acpi_tb_get_table_ptr (
 
        *table_ptr_loc = table_desc->pointer;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-
index eea5b8cb5ebb1a7d1c0fe72106110548c0217cf4..8d72343537e74719e3592a66db22a27212b9245c 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbgetall")
+ACPI_MODULE_NAME("tbgetall")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_tb_get_primary_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_desc          *table_info);
+acpi_tb_get_primary_table(struct acpi_pointer *address,
+                         struct acpi_table_desc *table_info);
 
 static acpi_status
-acpi_tb_get_secondary_table (
-       struct acpi_pointer             *address,
-       acpi_string                     signature,
-       struct acpi_table_desc          *table_info);
-
+acpi_tb_get_secondary_table(struct acpi_pointer *address,
+                           acpi_string signature,
+                           struct acpi_table_desc *table_info);
 
 /*******************************************************************************
  *
@@ -77,58 +71,54 @@ acpi_tb_get_secondary_table (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_get_primary_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_desc          *table_info)
+acpi_tb_get_primary_table(struct acpi_pointer *address,
+                         struct acpi_table_desc *table_info)
 {
-       acpi_status                     status;
-       struct acpi_table_header        header;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_primary_table");
+       acpi_status status;
+       struct acpi_table_header header;
 
+       ACPI_FUNCTION_TRACE("tb_get_primary_table");
 
        /* Ignore a NULL address in the RSDT */
 
        if (!address->pointer.value) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Get the header in order to get signature and table size */
 
-       status = acpi_tb_get_table_header (address, &header);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_header(address, &header);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Clear the table_info */
 
-       ACPI_MEMSET (table_info, 0, sizeof (struct acpi_table_desc));
+       ACPI_MEMSET(table_info, 0, sizeof(struct acpi_table_desc));
 
        /*
         * Check the table signature and make sure it is recognized.
         * Also checks the header checksum
         */
        table_info->pointer = &header;
-       status = acpi_tb_recognize_table (table_info, ACPI_TABLE_PRIMARY);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_recognize_table(table_info, ACPI_TABLE_PRIMARY);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the entire table */
 
-       status = acpi_tb_get_table_body (address, &header, table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_body(address, &header, table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Install the table */
 
-       status = acpi_tb_install_table (table_info);
-       return_ACPI_STATUS (status);
+       status = acpi_tb_install_table(table_info);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_secondary_table
@@ -143,32 +133,27 @@ acpi_tb_get_primary_table (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_get_secondary_table (
-       struct acpi_pointer             *address,
-       acpi_string                     signature,
-       struct acpi_table_desc          *table_info)
+acpi_tb_get_secondary_table(struct acpi_pointer *address,
+                           acpi_string signature,
+                           struct acpi_table_desc *table_info)
 {
-       acpi_status                     status;
-       struct acpi_table_header        header;
-
-
-       ACPI_FUNCTION_TRACE_STR ("tb_get_secondary_table", signature);
+       acpi_status status;
+       struct acpi_table_header header;
 
+       ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature);
 
        /* Get the header in order to match the signature */
 
-       status = acpi_tb_get_table_header (address, &header);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_header(address, &header);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Signature must match request */
 
-       if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) {
-               ACPI_REPORT_ERROR ((
-                       "Incorrect table signature - wanted [%s] found [%4.4s]\n",
-                       signature, header.signature));
-               return_ACPI_STATUS (AE_BAD_SIGNATURE);
+       if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) {
+               ACPI_REPORT_ERROR(("Incorrect table signature - wanted [%s] found [%4.4s]\n", signature, header.signature));
+               return_ACPI_STATUS(AE_BAD_SIGNATURE);
        }
 
        /*
@@ -176,25 +161,24 @@ acpi_tb_get_secondary_table (
         * Also checks the header checksum
         */
        table_info->pointer = &header;
-       status = acpi_tb_recognize_table (table_info, ACPI_TABLE_SECONDARY);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_recognize_table(table_info, ACPI_TABLE_SECONDARY);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the entire table */
 
-       status = acpi_tb_get_table_body (address, &header, table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_body(address, &header, table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Install the table */
 
-       status = acpi_tb_install_table (table_info);
-       return_ACPI_STATUS (status);
+       status = acpi_tb_install_table(table_info);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_required_tables
@@ -214,23 +198,19 @@ acpi_tb_get_secondary_table (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_get_required_tables (
-       void)
+acpi_status acpi_tb_get_required_tables(void)
 {
-       acpi_status                     status = AE_OK;
-       u32                             i;
-       struct acpi_table_desc          table_info;
-       struct acpi_pointer             address;
-
+       acpi_status status = AE_OK;
+       u32 i;
+       struct acpi_table_desc table_info;
+       struct acpi_pointer address;
 
-       ACPI_FUNCTION_TRACE ("tb_get_required_tables");
+       ACPI_FUNCTION_TRACE("tb_get_required_tables");
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
-               acpi_gbl_rsdt_table_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
+                         acpi_gbl_rsdt_table_count));
 
-
-       address.pointer_type  = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
+       address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
 
        /*
         * Loop through all table pointers found in RSDT.
@@ -243,84 +223,79 @@ acpi_tb_get_required_tables (
        for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
                /* Get the table address from the common internal XSDT */
 
-               address.pointer.value =
-                                 acpi_gbl_XSDT->table_offset_entry[i];
+               address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i];
 
                /*
                 * Get the tables needed by this subsystem (FADT and any SSDTs).
                 * NOTE: All other tables are completely ignored at this time.
                 */
-               status = acpi_tb_get_primary_table (&address, &table_info);
+               status = acpi_tb_get_primary_table(&address, &table_info);
                if ((status != AE_OK) && (status != AE_TABLE_NOT_SUPPORTED)) {
-                       ACPI_REPORT_WARNING (("%s, while getting table at %8.8X%8.8X\n",
-                               acpi_format_exception (status),
-                               ACPI_FORMAT_UINT64 (address.pointer.value)));
+                       ACPI_REPORT_WARNING(("%s, while getting table at %8.8X%8.8X\n", acpi_format_exception(status), ACPI_FORMAT_UINT64(address.pointer.value)));
                }
        }
 
        /* We must have a FADT to continue */
 
        if (!acpi_gbl_FADT) {
-               ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n"));
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               ACPI_REPORT_ERROR(("No FADT present in RSDT/XSDT\n"));
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        /*
         * Convert the FADT to a common format.  This allows earlier revisions of
         * the table to coexist with newer versions, using common access code.
         */
-       status = acpi_tb_convert_table_fadt ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                       "Could not convert FADT to internal common format\n"));
-               return_ACPI_STATUS (status);
+       status = acpi_tb_convert_table_fadt();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not convert FADT to internal common format\n"));
+               return_ACPI_STATUS(status);
        }
 
        /* Get the FACS (Pointed to by the FADT) */
 
        address.pointer.value = acpi_gbl_FADT->xfirmware_ctrl;
 
-       status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_secondary_table(&address, FACS_SIG, &table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not get/install the FACS, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Create the common FACS pointer table
         * (Contains pointers to the original table)
         */
-       status = acpi_tb_build_common_facs (&table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_build_common_facs(&table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get/install the DSDT (Pointed to by the FADT) */
 
        address.pointer.value = acpi_gbl_FADT->Xdsdt;
 
-       status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not get/install the DSDT\n"));
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_secondary_table(&address, DSDT_SIG, &table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not get/install the DSDT\n"));
+               return_ACPI_STATUS(status);
        }
 
        /* Set Integer Width (32/64) based upon DSDT revision */
 
-       acpi_ut_set_integer_width (acpi_gbl_DSDT->revision);
+       acpi_ut_set_integer_width(acpi_gbl_DSDT->revision);
 
        /* Dump the entire DSDT */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
-               "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
-               acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width));
-       ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length);
+       ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+                         "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
+                         acpi_gbl_DSDT->length, acpi_gbl_DSDT->length,
+                         acpi_gbl_integer_bit_width));
+       ACPI_DUMP_BUFFER((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length);
 
        /* Always delete the RSDP mapping, we are done with it */
 
-       acpi_tb_delete_tables_by_type (ACPI_TABLE_RSDP);
-       return_ACPI_STATUS (status);
+       acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP);
+       return_ACPI_STATUS(status);
 }
-
-
index 629b64c8193da1858a69b54f68a64f07f22ab528..10db8484e462ce269f1d4c2f11820000f4318cad 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbinstal")
+ACPI_MODULE_NAME("tbinstal")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_tb_match_signature (
-       char                            *signature,
-       struct acpi_table_desc          *table_info,
-       u8                              search_type);
-
+acpi_tb_match_signature(char *signature,
+                       struct acpi_table_desc *table_info, u8 search_type);
 
 /*******************************************************************************
  *
@@ -74,16 +68,12 @@ acpi_tb_match_signature (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_match_signature (
-       char                            *signature,
-       struct acpi_table_desc          *table_info,
-       u8                              search_type)
+acpi_tb_match_signature(char *signature,
+                       struct acpi_table_desc *table_info, u8 search_type)
 {
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_TRACE ("tb_match_signature");
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE("tb_match_signature");
 
        /* Search for a signature match among the known table types */
 
@@ -92,30 +82,30 @@ acpi_tb_match_signature (
                        continue;
                }
 
-               if (!ACPI_STRNCMP (signature, acpi_gbl_table_data[i].signature,
-                                  acpi_gbl_table_data[i].sig_length)) {
+               if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature,
+                                 acpi_gbl_table_data[i].sig_length)) {
                        /* Found a signature match, return index if requested */
 
                        if (table_info) {
                                table_info->type = (u8) i;
                        }
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                               "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
-                               (char *) acpi_gbl_table_data[i].signature));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
+                                         (char *)acpi_gbl_table_data[i].
+                                         signature));
 
-                       return_ACPI_STATUS (AE_OK);
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
-               (char *) signature));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
+                         (char *)signature));
 
-       return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+       return_ACPI_STATUS(AE_TABLE_NOT_SUPPORTED);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_install_table
@@ -124,46 +114,52 @@ acpi_tb_match_signature (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Load and validate all tables other than the RSDT.  The RSDT must
- *              already be loaded and validated.
- *              Install the table into the global data structs.
+ * DESCRIPTION: Install the table into the global data structures.
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_install_table (
-       struct acpi_table_desc          *table_info)
+acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info)
 {
-       acpi_status                     status;
-
-       ACPI_FUNCTION_TRACE ("tb_install_table");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("tb_install_table");
 
        /* Lock tables while installing */
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
-                       table_info->pointer->signature, acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not acquire table mutex, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
+       }
+
+       /*
+        * Ignore a table that is already installed. For example, some BIOS
+        * ASL code will repeatedly attempt to load the same SSDT.
+        */
+       status = acpi_tb_is_table_installed(table_info);
+       if (ACPI_FAILURE(status)) {
+               goto unlock_and_exit;
        }
 
        /* Install the table into the global data structure */
 
-       status = acpi_tb_init_table_descriptor (table_info->type, table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
-                       table_info->pointer->signature, acpi_format_exception (status)));
+       status = acpi_tb_init_table_descriptor(table_info->type, table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Could not install table [%4.4s], %s\n",
+                                  table_info->pointer->signature,
+                                  acpi_format_exception(status)));
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
-               acpi_gbl_table_data[table_info->type].name, table_info->pointer));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s located at %p\n",
+                         acpi_gbl_table_data[table_info->type].name,
+                         table_info->pointer));
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_recognize_table
@@ -186,22 +182,18 @@ acpi_tb_install_table (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_recognize_table (
-       struct acpi_table_desc          *table_info,
-       u8                              search_type)
+acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type)
 {
-       struct acpi_table_header        *table_header;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("tb_recognize_table");
+       struct acpi_table_header *table_header;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("tb_recognize_table");
 
        /* Ensure that we have a valid table pointer */
 
-       table_header = (struct acpi_table_header *) table_info->pointer;
+       table_header = (struct acpi_table_header *)table_info->pointer;
        if (!table_header) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /*
@@ -212,25 +204,24 @@ acpi_tb_recognize_table (
         * This can be any one of many valid ACPI tables, it just isn't one of
         * the tables that is consumed by the core subsystem
         */
-       status = acpi_tb_match_signature (table_header->signature,
-                        table_info, search_type);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_match_signature(table_header->signature,
+                                        table_info, search_type);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       status = acpi_tb_validate_table_header (table_header);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_validate_table_header(table_header);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Return the table type and length via the info struct */
 
        table_info->length = (acpi_size) table_header->length;
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_init_table_descriptor
@@ -245,22 +236,27 @@ acpi_tb_recognize_table (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_init_table_descriptor (
-       acpi_table_type                 table_type,
-       struct acpi_table_desc          *table_info)
+acpi_tb_init_table_descriptor(acpi_table_type table_type,
+                             struct acpi_table_desc *table_info)
 {
-       struct acpi_table_list          *list_head;
-       struct acpi_table_desc          *table_desc;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("tb_init_table_descriptor", table_type);
+       struct acpi_table_list *list_head;
+       struct acpi_table_desc *table_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type);
 
        /* Allocate a descriptor for this table */
 
-       table_desc = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc));
+       table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc));
        if (!table_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
+       }
+
+       /* Get a new owner ID for the table */
+
+       status = acpi_ut_allocate_owner_id(&table_desc->owner_id);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Install the table into the global data structure */
@@ -272,14 +268,14 @@ acpi_tb_init_table_descriptor (
         * includes most ACPI tables such as the DSDT.  2) Multiple instances of
         * the table are allowed.  This includes SSDT and PSDTs.
         */
-       if (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags)) {
+       if (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags)) {
                /*
                 * Only one table allowed, and a table has alread been installed
                 * at this location, so return an error.
                 */
                if (list_head->next) {
-                       ACPI_MEM_FREE (table_desc);
-                       return_ACPI_STATUS (AE_ALREADY_EXISTS);
+                       ACPI_MEM_FREE(table_desc);
+                       return_ACPI_STATUS(AE_ALREADY_EXISTS);
                }
 
                table_desc->next = list_head->next;
@@ -290,8 +286,7 @@ acpi_tb_init_table_descriptor (
                }
 
                list_head->count++;
-       }
-       else {
+       } else {
                /*
                 * Link the new table in to the list of tables of this type.
                 * Insert at the end of the list, order IS IMPORTANT.
@@ -302,8 +297,7 @@ acpi_tb_init_table_descriptor (
 
                if (!list_head->next) {
                        list_head->next = table_desc;
-               }
-               else {
+               } else {
                        table_desc->next = list_head->next;
 
                        while (table_desc->next->next) {
@@ -318,15 +312,14 @@ acpi_tb_init_table_descriptor (
 
        /* Finish initialization of the table descriptor */
 
-       table_desc->type                = (u8) table_type;
-       table_desc->pointer             = table_info->pointer;
-       table_desc->length              = table_info->length;
-       table_desc->allocation          = table_info->allocation;
-       table_desc->aml_start           = (u8 *) (table_desc->pointer + 1),
-       table_desc->aml_length          = (u32) (table_desc->length -
-                        (u32) sizeof (struct acpi_table_header));
-       table_desc->table_id            = acpi_ut_allocate_owner_id (
-                        ACPI_OWNER_TYPE_TABLE);
+       table_desc->type = (u8) table_type;
+       table_desc->pointer = table_info->pointer;
+       table_desc->length = table_info->length;
+       table_desc->allocation = table_info->allocation;
+       table_desc->aml_start = (u8 *) (table_desc->pointer + 1),
+           table_desc->aml_length = (u32) (table_desc->length -
+                                           (u32) sizeof(struct
+                                                        acpi_table_header));
        table_desc->loaded_into_namespace = FALSE;
 
        /*
@@ -334,18 +327,18 @@ acpi_tb_init_table_descriptor (
         * newly installed table
         */
        if (acpi_gbl_table_data[table_type].global_ptr) {
-               *(acpi_gbl_table_data[table_type].global_ptr) = table_info->pointer;
+               *(acpi_gbl_table_data[table_type].global_ptr) =
+                   table_info->pointer;
        }
 
        /* Return Data */
 
-       table_info->table_id        = table_desc->table_id;
-       table_info->installed_desc  = table_desc;
+       table_info->owner_id = table_desc->owner_id;
+       table_info->installed_desc = table_desc;
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_delete_all_tables
@@ -358,23 +351,19 @@ acpi_tb_init_table_descriptor (
  *
  ******************************************************************************/
 
-void
-acpi_tb_delete_all_tables (
-       void)
+void acpi_tb_delete_all_tables(void)
 {
-       acpi_table_type                 type;
-
+       acpi_table_type type;
 
        /*
         * Free memory allocated for ACPI tables
         * Memory can either be mapped or allocated
         */
        for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) {
-               acpi_tb_delete_tables_by_type (type);
+               acpi_tb_delete_tables_by_type(type);
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_delete_tables_by_type
@@ -388,23 +377,19 @@ acpi_tb_delete_all_tables (
  *
  ******************************************************************************/
 
-void
-acpi_tb_delete_tables_by_type (
-       acpi_table_type                 type)
+void acpi_tb_delete_tables_by_type(acpi_table_type type)
 {
-       struct acpi_table_desc          *table_desc;
-       u32                             count;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("tb_delete_tables_by_type", type);
+       struct acpi_table_desc *table_desc;
+       u32 count;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type);
 
        if (type > ACPI_TABLE_MAX) {
                return_VOID;
        }
 
-       if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_TABLES))) {
+       if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_TABLES))) {
                return;
        }
 
@@ -442,21 +427,20 @@ acpi_tb_delete_tables_by_type (
         * 1) Get the head of the list
         */
        table_desc = acpi_gbl_table_lists[type].next;
-       count     = acpi_gbl_table_lists[type].count;
+       count = acpi_gbl_table_lists[type].count;
 
        /*
         * 2) Walk the entire list, deleting both the allocated tables
         *    and the table descriptors
         */
        for (i = 0; i < count; i++) {
-               table_desc = acpi_tb_uninstall_table (table_desc);
+               table_desc = acpi_tb_uninstall_table(table_desc);
        }
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
+       (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_delete_single_table
@@ -470,15 +454,12 @@ acpi_tb_delete_tables_by_type (
  *
  ******************************************************************************/
 
-void
-acpi_tb_delete_single_table (
-       struct acpi_table_desc          *table_desc)
+void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc)
 {
 
        /* Must have a valid table descriptor and pointer */
 
-       if ((!table_desc) ||
-                (!table_desc->pointer)) {
+       if ((!table_desc) || (!table_desc->pointer)) {
                return;
        }
 
@@ -490,12 +471,12 @@ acpi_tb_delete_single_table (
 
        case ACPI_MEM_ALLOCATED:
 
-               ACPI_MEM_FREE (table_desc->pointer);
+               ACPI_MEM_FREE(table_desc->pointer);
                break;
 
        case ACPI_MEM_MAPPED:
 
-               acpi_os_unmap_memory (table_desc->pointer, table_desc->length);
+               acpi_os_unmap_memory(table_desc->pointer, table_desc->length);
                break;
 
        default:
@@ -503,7 +484,6 @@ acpi_tb_delete_single_table (
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_uninstall_table
@@ -518,26 +498,22 @@ acpi_tb_delete_single_table (
  *
  ******************************************************************************/
 
-struct acpi_table_desc *
-acpi_tb_uninstall_table (
-       struct acpi_table_desc          *table_desc)
+struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
+                                               *table_desc)
 {
-       struct acpi_table_desc          *next_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("tb_uninstall_table", table_desc);
+       struct acpi_table_desc *next_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc);
 
        if (!table_desc) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        /* Unlink the descriptor from the doubly linked list */
 
        if (table_desc->prev) {
                table_desc->prev->next = table_desc->next;
-       }
-       else {
+       } else {
                /* Is first on list, update list head */
 
                acpi_gbl_table_lists[table_desc->type].next = table_desc->next;
@@ -549,16 +525,14 @@ acpi_tb_uninstall_table (
 
        /* Free the memory allocated for the table itself */
 
-       acpi_tb_delete_single_table (table_desc);
+       acpi_tb_delete_single_table(table_desc);
 
        /* Free the table descriptor */
 
        next_desc = table_desc->next;
-       ACPI_MEM_FREE (table_desc);
+       ACPI_MEM_FREE(table_desc);
 
        /* Return pointer to the next descriptor */
 
-       return_PTR (next_desc);
+       return_PTR(next_desc);
 }
-
-
index b7ffe39c3626197d81d8baa515d07555910ec45d..ad0252c2f7dbd34d8a242f4bdf882a1c9203ce8d 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbrsdt")
-
+ACPI_MODULE_NAME("tbrsdt")
 
 /*******************************************************************************
  *
  * DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
  *
  ******************************************************************************/
-
-acpi_status
-acpi_tb_verify_rsdp (
-       struct acpi_pointer             *address)
+acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address)
 {
-       struct acpi_table_desc          table_info;
-       acpi_status                     status;
-       struct rsdp_descriptor          *rsdp;
-
-
-       ACPI_FUNCTION_TRACE ("tb_verify_rsdp");
+       struct acpi_table_desc table_info;
+       acpi_status status;
+       struct rsdp_descriptor *rsdp;
 
+       ACPI_FUNCTION_TRACE("tb_verify_rsdp");
 
        switch (address->pointer_type) {
        case ACPI_LOGICAL_POINTER:
@@ -84,73 +76,53 @@ acpi_tb_verify_rsdp (
                /*
                 * Obtain access to the RSDP structure
                 */
-               status = acpi_os_map_memory (address->pointer.physical,
-                                sizeof (struct rsdp_descriptor),
-                                                  (void *) &rsdp);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_os_map_memory(address->pointer.physical,
+                                           sizeof(struct rsdp_descriptor),
+                                           (void *)&rsdp);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
                break;
 
        default:
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       /*
-        *  The signature and checksum must both be correct
-        */
-       if (ACPI_STRNCMP ((char *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
-               /* Nope, BAD Signature */
+       /* Verify RSDP signature and checksum */
 
-               status = AE_BAD_SIGNATURE;
+       status = acpi_tb_validate_rsdp(rsdp);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       /* Check the standard checksum */
-
-       if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
-               status = AE_BAD_CHECKSUM;
-               goto cleanup;
-       }
-
-       /* Check extended checksum if table version >= 2 */
-
-       if (rsdp->revision >= 2) {
-               if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
-                       status = AE_BAD_CHECKSUM;
-                       goto cleanup;
-               }
-       }
-
        /* The RSDP supplied is OK */
 
-       table_info.pointer     = ACPI_CAST_PTR (struct acpi_table_header, rsdp);
-       table_info.length      = sizeof (struct rsdp_descriptor);
-       table_info.allocation  = ACPI_MEM_MAPPED;
+       table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp);
+       table_info.length = sizeof(struct rsdp_descriptor);
+       table_info.allocation = ACPI_MEM_MAPPED;
 
        /* Save the table pointers and allocation info */
 
-       status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Save the RSDP in a global for easy access */
 
-       acpi_gbl_RSDP = ACPI_CAST_PTR (struct rsdp_descriptor, table_info.pointer);
-       return_ACPI_STATUS (status);
-
+       acpi_gbl_RSDP =
+           ACPI_CAST_PTR(struct rsdp_descriptor, table_info.pointer);
+       return_ACPI_STATUS(status);
 
        /* Error exit */
-cleanup:
+      cleanup:
 
        if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) {
-               acpi_os_unmap_memory (rsdp, sizeof (struct rsdp_descriptor));
+               acpi_os_unmap_memory(rsdp, sizeof(struct rsdp_descriptor));
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_rsdt_address
@@ -159,35 +131,35 @@ cleanup:
  *
  * RETURN:      None, Address
  *
- * DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
- *              version of the RSDP
+ * DESCRIPTION: Extract the address of either the RSDT or XSDT, depending on the
+ *              version of the RSDP and whether the XSDT pointer is valid
  *
  ******************************************************************************/
 
-void
-acpi_tb_get_rsdt_address (
-       struct acpi_pointer             *out_address)
+void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address)
 {
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       out_address->pointer_type =
+           acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
 
-       out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
+       /* Use XSDT if it is present */
 
-       /*
-        * For RSDP revision 0 or 1, we use the RSDT.
-        * For RSDP revision 2 (and above), we use the XSDT
-        */
-       if (acpi_gbl_RSDP->revision < 2) {
-               out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
-       }
-       else {
+       if ((acpi_gbl_RSDP->revision >= 2) &&
+           acpi_gbl_RSDP->xsdt_physical_address) {
                out_address->pointer.value =
-                       acpi_gbl_RSDP->xsdt_physical_address;
+                   acpi_gbl_RSDP->xsdt_physical_address;
+               acpi_gbl_root_table_type = ACPI_TABLE_TYPE_XSDT;
+       } else {
+               /* No XSDT, use the RSDT */
+
+               out_address->pointer.value =
+                   acpi_gbl_RSDP->rsdt_physical_address;
+               acpi_gbl_root_table_type = ACPI_TABLE_TYPE_RSDT;
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_validate_rsdt
@@ -200,50 +172,43 @@ acpi_tb_get_rsdt_address (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_validate_rsdt (
-       struct acpi_table_header        *table_ptr)
+acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr)
 {
-       int                             no_match;
-
-
-       ACPI_FUNCTION_NAME ("tb_validate_rsdt");
+       int no_match;
 
+       ACPI_FUNCTION_NAME("tb_validate_rsdt");
 
        /*
-        * For RSDP revision 0 or 1, we use the RSDT.
-        * For RSDP revision 2 and above, we use the XSDT
+        * Search for appropriate signature, RSDT or XSDT
         */
-       if (acpi_gbl_RSDP->revision < 2) {
-               no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
-                                 sizeof (RSDT_SIG) -1);
-       }
-       else {
-               no_match = ACPI_STRNCMP ((char *) table_ptr, XSDT_SIG,
-                                 sizeof (XSDT_SIG) -1);
+       if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+               no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG,
+                                       sizeof(RSDT_SIG) - 1);
+       } else {
+               no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG,
+                                       sizeof(XSDT_SIG) - 1);
        }
 
        if (no_match) {
                /* Invalid RSDT or XSDT signature */
 
-               ACPI_REPORT_ERROR ((
-                       "Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
+               ACPI_REPORT_ERROR(("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
 
-               ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
+               ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20);
 
-               ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
-                       "RSDT/XSDT signature at %X (%p) is invalid\n",
-                       acpi_gbl_RSDP->rsdt_physical_address,
-                       (void *) (acpi_native_uint) acpi_gbl_RSDP->rsdt_physical_address));
+               ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR,
+                                     "RSDT/XSDT signature at %X (%p) is invalid\n",
+                                     acpi_gbl_RSDP->rsdt_physical_address,
+                                     (void *)(acpi_native_uint) acpi_gbl_RSDP->
+                                     rsdt_physical_address));
 
-               if (acpi_gbl_RSDP->revision < 2) {
-                       ACPI_REPORT_ERROR (("Looking for RSDT (RSDP->Rev < 2)\n"))
-               }
-               else {
-                       ACPI_REPORT_ERROR (("Looking for XSDT (RSDP->Rev >= 2)\n"))
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+                       ACPI_REPORT_ERROR(("Looking for RSDT\n"))
+               } else {
+                       ACPI_REPORT_ERROR(("Looking for XSDT\n"))
                }
 
-               ACPI_DUMP_BUFFER ((char *) table_ptr, 48);
+               ACPI_DUMP_BUFFER((char *)table_ptr, 48);
 
                return (AE_BAD_SIGNATURE);
        }
@@ -251,7 +216,6 @@ acpi_tb_validate_rsdt (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_get_table_rsdt
@@ -264,66 +228,61 @@ acpi_tb_validate_rsdt (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_tb_get_table_rsdt (
-       void)
+acpi_status acpi_tb_get_table_rsdt(void)
 {
-       struct acpi_table_desc          table_info;
-       acpi_status                     status;
-       struct acpi_pointer             address;
-
-
-       ACPI_FUNCTION_TRACE ("tb_get_table_rsdt");
+       struct acpi_table_desc table_info;
+       acpi_status status;
+       struct acpi_pointer address;
 
+       ACPI_FUNCTION_TRACE("tb_get_table_rsdt");
 
        /* Get the RSDT/XSDT via the RSDP */
 
-       acpi_tb_get_rsdt_address (&address);
+       acpi_tb_get_rsdt_address(&address);
 
        table_info.type = ACPI_TABLE_XSDT;
-       status = acpi_tb_get_table (&address, &table_info);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_tb_get_table(&address, &table_info);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Could not get the RSDT/XSDT, %s\n",
+                                 acpi_format_exception(status)));
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
-               acpi_gbl_RSDP,
-               ACPI_FORMAT_UINT64 (address.pointer.value)));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
+                         acpi_gbl_RSDP,
+                         ACPI_FORMAT_UINT64(address.pointer.value)));
 
        /* Check the RSDT or XSDT signature */
 
-       status = acpi_tb_validate_rsdt (table_info.pointer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_validate_rsdt(table_info.pointer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the number of tables defined in the RSDT or XSDT */
 
-       acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP,
-                         table_info.pointer);
+       acpi_gbl_rsdt_table_count = acpi_tb_get_table_count(acpi_gbl_RSDP,
+                                                           table_info.pointer);
 
        /* Convert and/or copy to an XSDT structure */
 
-       status = acpi_tb_convert_to_xsdt (&table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_convert_to_xsdt(&table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Save the table pointers and allocation info */
 
-       status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       acpi_gbl_XSDT = ACPI_CAST_PTR (XSDT_DESCRIPTOR, table_info.pointer);
+       acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
-       return_ACPI_STATUS (status);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
+       return_ACPI_STATUS(status);
 }
-
-
index e69d01d443d22773e84ce75965619cc45598fff0..4b2fbb592f4933cf8b8138efe64f558c194a96fe 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbutils")
+ACPI_MODULE_NAME("tbutils")
 
 /* Local prototypes */
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 acpi_status
-acpi_tb_handle_to_object (
-       u16                             table_id,
-       struct acpi_table_desc          **table_desc);
+acpi_tb_handle_to_object(u16 table_id, struct acpi_table_desc **table_desc);
 #endif
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_is_table_installed
+ *
+ * PARAMETERS:  new_table_desc      - Descriptor for new table being installed
+ *
+ * RETURN:      Status - AE_ALREADY_EXISTS if the table is already installed
+ *
+ * DESCRIPTION: Determine if an ACPI table is already installed
+ *
+ * MUTEX:       Table data structures should be locked
+ *
+ ******************************************************************************/
+
+acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc)
+{
+       struct acpi_table_desc *table_desc;
+
+       ACPI_FUNCTION_TRACE("tb_is_table_installed");
+
+       /* Get the list descriptor and first table descriptor */
+
+       table_desc = acpi_gbl_table_lists[new_table_desc->type].next;
+
+       /* Examine all installed tables of this type */
+
+       while (table_desc) {
+               /*
+                * If the table lengths match, perform a full bytewise compare. This
+                * means that we will allow tables with duplicate oem_table_id(s), as
+                * long as the tables are different in some way.
+                *
+                * Checking if the table has been loaded into the namespace means that
+                * we don't check for duplicate tables during the initial installation
+                * of tables within the RSDT/XSDT.
+                */
+               if ((table_desc->loaded_into_namespace) &&
+                   (table_desc->pointer->length ==
+                    new_table_desc->pointer->length)
+                   &&
+                   (!ACPI_MEMCMP
+                    ((const char *)table_desc->pointer,
+                     (const char *)new_table_desc->pointer,
+                     (acpi_size) new_table_desc->pointer->length))) {
+                       /* Match: this table is already installed */
+
+                       ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+                                         "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n",
+                                         new_table_desc->pointer->signature,
+                                         new_table_desc->pointer->revision,
+                                         new_table_desc->pointer->
+                                         oem_table_id));
+
+                       new_table_desc->owner_id = table_desc->owner_id;
+                       new_table_desc->installed_desc = table_desc;
+
+                       return_ACPI_STATUS(AE_ALREADY_EXISTS);
+               }
+
+               /* Get next table on the list */
+
+               table_desc = table_desc->next;
+       }
+
+       return_ACPI_STATUS(AE_OK);
+}
 
 /*******************************************************************************
  *
@@ -80,57 +141,55 @@ acpi_tb_handle_to_object (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_validate_table_header (
-       struct acpi_table_header        *table_header)
+acpi_tb_validate_table_header(struct acpi_table_header *table_header)
 {
-       acpi_name                       signature;
-
-
-       ACPI_FUNCTION_NAME ("tb_validate_table_header");
+       acpi_name signature;
 
+       ACPI_FUNCTION_NAME("tb_validate_table_header");
 
        /* Verify that this is a valid address */
 
-       if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Cannot read table header at %p\n", table_header));
+       if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Cannot read table header at %p\n",
+                                 table_header));
 
                return (AE_BAD_ADDRESS);
        }
 
        /* Ensure that the signature is 4 ASCII characters */
 
-       ACPI_MOVE_32_TO_32 (&signature, table_header->signature);
-       if (!acpi_ut_valid_acpi_name (signature)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Table signature at %p [%p] has invalid characters\n",
-                       table_header, &signature));
+       ACPI_MOVE_32_TO_32(&signature, table_header->signature);
+       if (!acpi_ut_valid_acpi_name(signature)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Table signature at %p [%p] has invalid characters\n",
+                                 table_header, &signature));
 
-               ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
-                       (char *) &signature));
+               ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n",
+                                    (char *)&signature));
 
-               ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
+               ACPI_DUMP_BUFFER(table_header,
+                                sizeof(struct acpi_table_header));
                return (AE_BAD_SIGNATURE);
        }
 
        /* Validate the table length */
 
-       if (table_header->length < sizeof (struct acpi_table_header)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Invalid length in table header %p name %4.4s\n",
-                       table_header, (char *) &signature));
+       if (table_header->length < sizeof(struct acpi_table_header)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid length in table header %p name %4.4s\n",
+                                 table_header, (char *)&signature));
 
-               ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
-                       (u32) table_header->length));
+               ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length));
 
-               ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header));
+               ACPI_DUMP_BUFFER(table_header,
+                                sizeof(struct acpi_table_header));
                return (AE_BAD_HEADER);
        }
 
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_verify_table_checksum
@@ -145,37 +204,31 @@ acpi_tb_validate_table_header (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_verify_table_checksum (
-       struct acpi_table_header        *table_header)
+acpi_tb_verify_table_checksum(struct acpi_table_header * table_header)
 {
-       u8                              checksum;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("tb_verify_table_checksum");
+       u8 checksum;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("tb_verify_table_checksum");
 
        /* Compute the checksum on the table */
 
-       checksum = acpi_tb_checksum (table_header, table_header->length);
+       checksum =
+           acpi_tb_generate_checksum(table_header, table_header->length);
 
        /* Return the appropriate exception */
 
        if (checksum) {
-               ACPI_REPORT_WARNING ((
-                       "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
-                       table_header->signature, (u32) table_header->checksum,
-                       (u32) checksum));
+               ACPI_REPORT_WARNING(("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", table_header->signature, (u32) table_header->checksum, (u32) checksum));
 
                status = AE_BAD_CHECKSUM;
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
- * FUNCTION:    acpi_tb_checksum
+ * FUNCTION:    acpi_tb_generate_checksum
  *
  * PARAMETERS:  Buffer              - Buffer to checksum
  *              Length              - Size of the buffer
@@ -186,15 +239,11 @@ acpi_tb_verify_table_checksum (
  *
  ******************************************************************************/
 
-u8
-acpi_tb_checksum (
-       void                            *buffer,
-       u32                             length)
+u8 acpi_tb_generate_checksum(void *buffer, u32 length)
 {
-       const u8                        *limit;
-       const u8                        *rover;
-       u8                              sum = 0;
-
+       const u8 *limit;
+       const u8 *rover;
+       u8 sum = 0;
 
        if (buffer && length) {
                /*  Buffer and Length are valid   */
@@ -208,7 +257,6 @@ acpi_tb_checksum (
        return (sum);
 }
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 /*******************************************************************************
  *
@@ -224,16 +272,13 @@ acpi_tb_checksum (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_handle_to_object (
-       u16                             table_id,
-       struct acpi_table_desc          **return_table_desc)
+acpi_tb_handle_to_object(u16 table_id,
+                        struct acpi_table_desc ** return_table_desc)
 {
-       u32                             i;
-       struct acpi_table_desc          *table_desc;
-
-
-       ACPI_FUNCTION_NAME ("tb_handle_to_object");
+       u32 i;
+       struct acpi_table_desc *table_desc;
 
+       ACPI_FUNCTION_NAME("tb_handle_to_object");
 
        for (i = 0; i < ACPI_TABLE_MAX; i++) {
                table_desc = acpi_gbl_table_lists[i].next;
@@ -247,9 +292,8 @@ acpi_tb_handle_to_object (
                }
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id));
+       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n",
+                         table_id));
        return (AE_BAD_PARAMETER);
 }
 #endif
-
-
index 0c0b9085dbeb954843881f6bd865f85118191585..3f96a4909aadfb5683942c0a9b0ac661d3bc9eaa 100644 (file)
 #include <acpi/acnamesp.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbxface")
-
+ACPI_MODULE_NAME("tbxface")
 
 /*******************************************************************************
  *
  *              provided RSDT
  *
  ******************************************************************************/
-
-acpi_status
-acpi_load_tables (
-       void)
+acpi_status acpi_load_tables(void)
 {
-       struct acpi_pointer             rsdp_address;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_load_tables");
+       struct acpi_pointer rsdp_address;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_load_tables");
 
        /* Get the RSDP */
 
-       status = acpi_os_get_root_pointer (ACPI_LOGICAL_ADDRESSING,
-                         &rsdp_address);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("acpi_load_tables: Could not get RSDP, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_os_get_root_pointer(ACPI_LOGICAL_ADDRESSING,
+                                         &rsdp_address);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("acpi_load_tables: Could not get RSDP, %s\n",
+                                  acpi_format_exception(status)));
                goto error_exit;
        }
 
@@ -91,54 +84,47 @@ acpi_load_tables (
 
        acpi_gbl_table_flags = rsdp_address.pointer_type;
 
-       status = acpi_tb_verify_rsdp (&rsdp_address);
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("acpi_load_tables: RSDP Failed validation: %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_tb_verify_rsdp(&rsdp_address);
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("acpi_load_tables: RSDP Failed validation: %s\n", acpi_format_exception(status)));
                goto error_exit;
        }
 
        /* Get the RSDT via the RSDP */
 
-       status = acpi_tb_get_table_rsdt ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("acpi_load_tables: Could not load RSDT: %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_tb_get_table_rsdt();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("acpi_load_tables: Could not load RSDT: %s\n", acpi_format_exception(status)));
                goto error_exit;
        }
 
        /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
 
-       status = acpi_tb_get_required_tables ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR ((
-                       "acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_tb_get_required_tables();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n", acpi_format_exception(status)));
                goto error_exit;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
 
        /* Load the namespace from the tables */
 
-       status = acpi_ns_load_namespace ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("acpi_load_tables: Could not load namespace: %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_ns_load_namespace();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("acpi_load_tables: Could not load namespace: %s\n", acpi_format_exception(status)));
                goto error_exit;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 
+      error_exit:
+       ACPI_REPORT_ERROR(("acpi_load_tables: Could not load tables: %s\n",
+                          acpi_format_exception(status)));
 
-error_exit:
-       ACPI_REPORT_ERROR (("acpi_load_tables: Could not load tables: %s\n",
-                         acpi_format_exception (status)));
-
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -156,40 +142,49 @@ error_exit:
  *
  ******************************************************************************/
 
-acpi_status
-acpi_load_table (
-       struct acpi_table_header        *table_ptr)
+acpi_status acpi_load_table(struct acpi_table_header *table_ptr)
 {
-       acpi_status                     status;
-       struct acpi_table_desc          table_info;
-       struct acpi_pointer             address;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_load_table");
+       acpi_status status;
+       struct acpi_table_desc table_info;
+       struct acpi_pointer address;
 
+       ACPI_FUNCTION_TRACE("acpi_load_table");
 
        if (!table_ptr) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Copy the table to a local buffer */
 
-       address.pointer_type    = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
+       address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
        address.pointer.logical = table_ptr;
 
-       status = acpi_tb_get_table_body (&address, table_ptr, &table_info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_body(&address, table_ptr, &table_info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
+
+       /* Check signature for a valid table type */
+
+       status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Install the new table into the local data structures */
 
-       status = acpi_tb_install_table (&table_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_install_table(&table_info);
+       if (ACPI_FAILURE(status)) {
+               if (status == AE_ALREADY_EXISTS) {
+                       /* Table already exists, no error */
+
+                       status = AE_OK;
+               }
+
                /* Free table allocated by acpi_tb_get_table_body */
 
-               acpi_tb_delete_single_table (&table_info);
-               return_ACPI_STATUS (status);
+               acpi_tb_delete_single_table(&table_info);
+               return_ACPI_STATUS(status);
        }
 
        /* Convert the table to common format if necessary */
@@ -197,31 +192,32 @@ acpi_load_table (
        switch (table_info.type) {
        case ACPI_TABLE_FADT:
 
-               status = acpi_tb_convert_table_fadt ();
+               status = acpi_tb_convert_table_fadt();
                break;
 
        case ACPI_TABLE_FACS:
 
-               status = acpi_tb_build_common_facs (&table_info);
+               status = acpi_tb_build_common_facs(&table_info);
                break;
 
        default:
                /* Load table into namespace if it contains executable AML */
 
-               status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
+               status =
+                   acpi_ns_load_table(table_info.installed_desc,
+                                      acpi_gbl_root_node);
                break;
        }
 
-       if (ACPI_FAILURE (status)) {
+       if (ACPI_FAILURE(status)) {
                /* Uninstall table and free the buffer */
 
-               (void) acpi_tb_uninstall_table (table_info.installed_desc);
+               (void)acpi_tb_uninstall_table(table_info.installed_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_unload_table
@@ -234,20 +230,16 @@ acpi_load_table (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_unload_table (
-       acpi_table_type                 table_type)
+acpi_status acpi_unload_table(acpi_table_type table_type)
 {
-       struct acpi_table_desc          *table_desc;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_unload_table");
+       struct acpi_table_desc *table_desc;
 
+       ACPI_FUNCTION_TRACE("acpi_unload_table");
 
        /* Parameter validation */
 
        if (table_type > ACPI_TABLE_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Find all tables of the requested type */
@@ -260,18 +252,17 @@ acpi_unload_table (
                 * "Scope" operator.  Thus, we need to track ownership by an ID, not
                 * simply a position within the hierarchy
                 */
-               acpi_ns_delete_namespace_by_owner (table_desc->table_id);
-
+               acpi_ns_delete_namespace_by_owner(table_desc->owner_id);
+               acpi_ut_release_owner_id(&table_desc->owner_id);
                table_desc = table_desc->next;
        }
 
        /* Delete (or unmap) all tables of this type */
 
-       acpi_tb_delete_tables_by_type (table_type);
-       return_ACPI_STATUS (AE_OK);
+       acpi_tb_delete_tables_by_type(table_type);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_table_header
@@ -294,54 +285,49 @@ acpi_unload_table (
  ******************************************************************************/
 
 acpi_status
-acpi_get_table_header (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_table_header        *out_table_header)
+acpi_get_table_header(acpi_table_type table_type,
+                     u32 instance, struct acpi_table_header *out_table_header)
 {
-       struct acpi_table_header        *tbl_ptr;
-       acpi_status                     status;
+       struct acpi_table_header *tbl_ptr;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_get_table_header");
 
-       ACPI_FUNCTION_TRACE ("acpi_get_table_header");
-
-
-       if ((instance == 0)                 ||
-               (table_type == ACPI_TABLE_RSDP) ||
-               (!out_table_header)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((instance == 0) ||
+           (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Check the table type and instance */
 
-       if ((table_type > ACPI_TABLE_MAX)   ||
-               (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) &&
-                instance > 1)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((table_type > ACPI_TABLE_MAX) ||
+           (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
+            instance > 1)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get a pointer to the entire table */
 
-       status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* The function will return a NULL pointer if the table is not loaded */
 
        if (tbl_ptr == NULL) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Copy the header to the caller's buffer */
 
-       ACPI_MEMCPY ((void *) out_table_header, (void *) tbl_ptr,
-               sizeof (struct acpi_table_header));
+       ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr,
+                   sizeof(struct acpi_table_header));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-#endif  /*  ACPI_FUTURE_USAGE  */
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -367,43 +353,39 @@ acpi_get_table_header (
  ******************************************************************************/
 
 acpi_status
-acpi_get_table (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_buffer              *ret_buffer)
+acpi_get_table(acpi_table_type table_type,
+              u32 instance, struct acpi_buffer *ret_buffer)
 {
-       struct acpi_table_header        *tbl_ptr;
-       acpi_status                     status;
-       acpi_size                       table_length;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_table");
+       struct acpi_table_header *tbl_ptr;
+       acpi_status status;
+       acpi_size table_length;
 
+       ACPI_FUNCTION_TRACE("acpi_get_table");
 
        /* Parameter validation */
 
        if (instance == 0) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer (ret_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_buffer(ret_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Check the table type and instance */
 
-       if ((table_type > ACPI_TABLE_MAX)   ||
-               (ACPI_IS_SINGLE_TABLE (acpi_gbl_table_data[table_type].flags) &&
-                instance > 1)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((table_type > ACPI_TABLE_MAX) ||
+           (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) &&
+            instance > 1)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Get a pointer to the entire table */
 
-       status = acpi_tb_get_table_ptr (table_type, instance, &tbl_ptr);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_tb_get_table_ptr(table_type, instance, &tbl_ptr);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -411,7 +393,7 @@ acpi_get_table (
         * table is not loaded.
         */
        if (tbl_ptr == NULL) {
-               return_ACPI_STATUS (AE_NOT_EXIST);
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        /* Get the table length */
@@ -419,23 +401,22 @@ acpi_get_table (
        if (table_type == ACPI_TABLE_RSDP) {
                /* RSD PTR is the only "table" without a header */
 
-               table_length = sizeof (struct rsdp_descriptor);
-       }
-       else {
+               table_length = sizeof(struct rsdp_descriptor);
+       } else {
                table_length = (acpi_size) tbl_ptr->length;
        }
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (ret_buffer, table_length);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_initialize_buffer(ret_buffer, table_length);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Copy the table to the buffer */
 
-       ACPI_MEMCPY ((void *) ret_buffer->pointer, (void *) tbl_ptr, table_length);
-       return_ACPI_STATUS (AE_OK);
+       ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_get_table);
 
+EXPORT_SYMBOL(acpi_get_table);
index dc3c3f6a9f621d5c93cf39bfa39ae6c4ee101399..3b8a7e063e8a14c5d5122d306dfcef19d61d8c94 100644 (file)
 #include <acpi/acpi.h>
 #include <acpi/actables.h>
 
-
 #define _COMPONENT          ACPI_TABLES
-        ACPI_MODULE_NAME    ("tbxfroot")
+ACPI_MODULE_NAME("tbxfroot")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_tb_find_rsdp (
-       struct acpi_table_desc          *table_info,
-       u32                             flags);
+acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags);
 
-static u8 *
-acpi_tb_scan_memory_for_rsdp (
-       u8                              *start_address,
-       u32                             length);
+static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length);
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_validate_rsdp
+ *
+ * PARAMETERS:  Rsdp        - Pointer to unvalidated RSDP
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validate the RSDP (ptr)
+ *
+ ******************************************************************************/
+
+acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp)
+{
+       ACPI_FUNCTION_ENTRY();
+
+       /*
+        *  The signature and checksum must both be correct
+        */
+       if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) {
+               /* Nope, BAD Signature */
+
+               return (AE_BAD_SIGNATURE);
+       }
+
+       /* Check the standard checksum */
+
+       if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
+               return (AE_BAD_CHECKSUM);
+       }
+
+       /* Check extended checksum if table version >= 2 */
+
+       if ((rsdp->revision >= 2) &&
+           (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) !=
+            0)) {
+               return (AE_BAD_CHECKSUM);
+       }
+
+       return (AE_OK);
+}
 
 /*******************************************************************************
  *
@@ -80,28 +114,24 @@ acpi_tb_scan_memory_for_rsdp (
  ******************************************************************************/
 
 acpi_status
-acpi_tb_find_table (
-       char                            *signature,
-       char                            *oem_id,
-       char                            *oem_table_id,
-       struct acpi_table_header        **table_ptr)
+acpi_tb_find_table(char *signature,
+                  char *oem_id,
+                  char *oem_table_id, struct acpi_table_header ** table_ptr)
 {
-       acpi_status                     status;
-       struct acpi_table_header        *table;
-
-
-       ACPI_FUNCTION_TRACE ("tb_find_table");
+       acpi_status status;
+       struct acpi_table_header *table;
 
+       ACPI_FUNCTION_TRACE("tb_find_table");
 
        /* Validate string lengths */
 
-       if ((ACPI_STRLEN (signature)  > ACPI_NAME_SIZE) ||
-               (ACPI_STRLEN (oem_id)     > sizeof (table->oem_id)) ||
-               (ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) {
-               return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+       if ((ACPI_STRLEN(signature) > ACPI_NAME_SIZE) ||
+           (ACPI_STRLEN(oem_id) > sizeof(table->oem_id)) ||
+           (ACPI_STRLEN(oem_table_id) > sizeof(table->oem_table_id))) {
+               return_ACPI_STATUS(AE_AML_STRING_LIMIT);
        }
 
-       if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) {
+       if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) {
                /*
                 * The DSDT pointer is contained in the FADT, not the RSDT.
                 * This code should suffice, because the only code that would perform
@@ -110,40 +140,36 @@ acpi_tb_find_table (
                 * If this becomes insufficient, the FADT will have to be found first.
                 */
                if (!acpi_gbl_DSDT) {
-                       return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+                       return_ACPI_STATUS(AE_NO_ACPI_TABLES);
                }
                table = acpi_gbl_DSDT;
-       }
-       else {
+       } else {
                /* Find the table */
 
-               status = acpi_get_firmware_table (signature, 1,
-                                ACPI_LOGICAL_ADDRESSING, &table);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_get_firmware_table(signature, 1,
+                                                ACPI_LOGICAL_ADDRESSING,
+                                                &table);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Check oem_id and oem_table_id */
 
-       if ((oem_id[0] && ACPI_STRNCMP (
-                          oem_id, table->oem_id,
-                          sizeof (table->oem_id))) ||
-
-               (oem_table_id[0] && ACPI_STRNCMP (
-                                  oem_table_id, table->oem_table_id,
-                                  sizeof (table->oem_table_id)))) {
-               return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
+       if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id,
+                                      sizeof(table->oem_id))) ||
+           (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id,
+                                            sizeof(table->oem_table_id)))) {
+               return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND);
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
-               table->signature));
+       ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "Found table [%4.4s]\n",
+                         table->signature));
 
        *table_ptr = table;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_firmware_table
@@ -164,34 +190,28 @@ acpi_tb_find_table (
  ******************************************************************************/
 
 acpi_status
-acpi_get_firmware_table (
-       acpi_string                     signature,
-       u32                             instance,
-       u32                             flags,
-       struct acpi_table_header        **table_pointer)
+acpi_get_firmware_table(acpi_string signature,
+                       u32 instance,
+                       u32 flags, struct acpi_table_header **table_pointer)
 {
-       acpi_status                     status;
-       struct acpi_pointer             address;
-       struct acpi_table_header        *header = NULL;
-       struct acpi_table_desc          *table_info = NULL;
-       struct acpi_table_desc          *rsdt_info;
-       u32                             table_count;
-       u32                             i;
-       u32                             j;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_firmware_table");
+       acpi_status status;
+       struct acpi_pointer address;
+       struct acpi_table_header *header = NULL;
+       struct acpi_table_desc *table_info = NULL;
+       struct acpi_table_desc *rsdt_info;
+       u32 table_count;
+       u32 i;
+       u32 j;
 
+       ACPI_FUNCTION_TRACE("acpi_get_firmware_table");
 
        /*
         * Ensure that at least the table manager is initialized.  We don't
         * require that the entire ACPI subsystem is up for this interface.
         * If we have a buffer, we must have a length too
         */
-       if ((instance == 0)     ||
-               (!signature)        ||
-               (!table_pointer)) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+       if ((instance == 0) || (!signature) || (!table_pointer)) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Ensure that we have a RSDP */
@@ -199,48 +219,41 @@ acpi_get_firmware_table (
        if (!acpi_gbl_RSDP) {
                /* Get the RSDP */
 
-               status = acpi_os_get_root_pointer (flags, &address);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
-                       return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               status = acpi_os_get_root_pointer(flags, &address);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "RSDP not found\n"));
+                       return_ACPI_STATUS(AE_NO_ACPI_TABLES);
                }
 
                /* Map and validate the RSDP */
 
                if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
-                       status = acpi_os_map_memory (address.pointer.physical,
-                                        sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status = acpi_os_map_memory(address.pointer.physical,
+                                                   sizeof(struct
+                                                          rsdp_descriptor),
+                                                   (void *)&acpi_gbl_RSDP);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
-               }
-               else {
+               } else {
                        acpi_gbl_RSDP = address.pointer.logical;
                }
 
-               /* The signature and checksum must both be correct */
-
-               if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
-                               sizeof (RSDP_SIG)-1) != 0) {
-                       /* Nope, BAD Signature */
+               /* The RDSP signature and checksum must both be correct */
 
-                       return_ACPI_STATUS (AE_BAD_SIGNATURE);
-               }
-
-               if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
-                       /* Nope, BAD Checksum */
-
-                       return_ACPI_STATUS (AE_BAD_CHECKSUM);
+               status = acpi_tb_validate_rsdp(acpi_gbl_RSDP);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Get the RSDT address via the RSDP */
 
-       acpi_tb_get_rsdt_address (&address);
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
-               acpi_gbl_RSDP,
-               ACPI_FORMAT_UINT64 (address.pointer.value)));
+       acpi_tb_get_rsdt_address(&address);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
+                         acpi_gbl_RSDP,
+                         ACPI_FORMAT_UINT64(address.pointer.value)));
 
        /* Insert processor_mode flags */
 
@@ -248,30 +261,30 @@ acpi_get_firmware_table (
 
        /* Get and validate the RSDT */
 
-       rsdt_info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc));
+       rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc));
        if (!rsdt_info) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       status = acpi_tb_get_table (&address, rsdt_info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_get_table(&address, rsdt_info);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
-       status = acpi_tb_validate_rsdt (rsdt_info->pointer);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_tb_validate_rsdt(rsdt_info->pointer);
+       if (ACPI_FAILURE(status)) {
                goto cleanup;
        }
 
        /* Allocate a scratch table header and table descriptor */
 
-       header = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_header));
+       header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header));
        if (!header) {
                status = AE_NO_MEMORY;
                goto cleanup;
        }
 
-       table_info = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_desc));
+       table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc));
        if (!table_info) {
                status = AE_NO_MEMORY;
                goto cleanup;
@@ -279,7 +292,8 @@ acpi_get_firmware_table (
 
        /* Get the number of table pointers within the RSDT */
 
-       table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_info->pointer);
+       table_count =
+           acpi_tb_get_table_count(acpi_gbl_RSDP, rsdt_info->pointer);
        address.pointer_type = acpi_gbl_table_flags | flags;
 
        /*
@@ -287,35 +301,42 @@ acpi_get_firmware_table (
         * requested table
         */
        for (i = 0, j = 0; i < table_count; i++) {
-               /* Get the next table pointer, handle RSDT vs. XSDT */
-
-               if (acpi_gbl_RSDP->revision < 2) {
-                       address.pointer.value = (ACPI_CAST_PTR (
-                               RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
-               }
-               else {
-                       address.pointer.value = (ACPI_CAST_PTR (
-                               XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
+               /*
+                * Get the next table pointer, handle RSDT vs. XSDT
+                * RSDT pointers are 32 bits, XSDT pointers are 64 bits
+                */
+               if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {
+                       address.pointer.value =
+                           (ACPI_CAST_PTR
+                            (RSDT_DESCRIPTOR,
+                             rsdt_info->pointer))->table_offset_entry[i];
+               } else {
+                       address.pointer.value =
+                           (ACPI_CAST_PTR
+                            (XSDT_DESCRIPTOR,
+                             rsdt_info->pointer))->table_offset_entry[i];
                }
 
                /* Get the table header */
 
-               status = acpi_tb_get_table_header (&address, header);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_tb_get_table_header(&address, header);
+               if (ACPI_FAILURE(status)) {
                        goto cleanup;
                }
 
                /* Compare table signatures and table instance */
 
-               if (!ACPI_STRNCMP (header->signature, signature, ACPI_NAME_SIZE)) {
+               if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) {
                        /* An instance of the table was found */
 
                        j++;
                        if (j >= instance) {
                                /* Found the correct instance, get the entire table */
 
-                               status = acpi_tb_get_table_body (&address, header, table_info);
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_tb_get_table_body(&address, header,
+                                                          table_info);
+                               if (ACPI_FAILURE(status)) {
                                        goto cleanup;
                                }
 
@@ -329,22 +350,23 @@ acpi_get_firmware_table (
 
        status = AE_NOT_EXIST;
 
-
-cleanup:
-       acpi_os_unmap_memory (rsdt_info->pointer,
-               (acpi_size) rsdt_info->pointer->length);
-       ACPI_MEM_FREE (rsdt_info);
+      cleanup:
+       if (rsdt_info->pointer) {
+               acpi_os_unmap_memory(rsdt_info->pointer,
+                                    (acpi_size) rsdt_info->pointer->length);
+       }
+       ACPI_MEM_FREE(rsdt_info);
 
        if (header) {
-               ACPI_MEM_FREE (header);
+               ACPI_MEM_FREE(header);
        }
        if (table_info) {
-               ACPI_MEM_FREE (table_info);
+               ACPI_MEM_FREE(table_info);
        }
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_get_firmware_table);
 
+EXPORT_SYMBOL(acpi_get_firmware_table);
 
 /* TBD: Move to a new file */
 
@@ -363,35 +385,29 @@ EXPORT_SYMBOL(acpi_get_firmware_table);
  *
  ******************************************************************************/
 
-acpi_status
-acpi_find_root_pointer (
-       u32                             flags,
-       struct acpi_pointer             *rsdp_address)
+acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address)
 {
-       struct acpi_table_desc          table_info;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_find_root_pointer");
+       struct acpi_table_desc table_info;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_find_root_pointer");
 
        /* Get the RSDP */
 
-       status = acpi_tb_find_rsdp (&table_info, flags);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "RSDP structure not found, %s Flags=%X\n",
-                       acpi_format_exception (status), flags));
+       status = acpi_tb_find_rsdp(&table_info, flags);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "RSDP structure not found, %s Flags=%X\n",
+                                 acpi_format_exception(status), flags));
 
-               return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+               return_ACPI_STATUS(AE_NO_ACPI_TABLES);
        }
 
        rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER;
        rsdp_address->pointer.physical = table_info.physical_address;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_scan_memory_for_rsdp
@@ -405,68 +421,45 @@ acpi_find_root_pointer (
  *
  ******************************************************************************/
 
-static u8 *
-acpi_tb_scan_memory_for_rsdp (
-       u8                              *start_address,
-       u32                             length)
+static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length)
 {
-       u8                              *mem_rover;
-       u8                              *end_address;
-       u8                              checksum;
-
-
-       ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
+       acpi_status status;
+       u8 *mem_rover;
+       u8 *end_address;
 
+       ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp");
 
        end_address = start_address + length;
 
        /* Search from given start address for the requested length */
 
        for (mem_rover = start_address; mem_rover < end_address;
-                mem_rover += ACPI_RSDP_SCAN_STEP) {
-               /* The signature and checksum must both be correct */
-
-               if (ACPI_STRNCMP ((char *) mem_rover,
-                               RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
-                       /* No signature match, keep looking */
-
-                       continue;
-               }
-
-               /* Signature matches, check the appropriate checksum */
-
-               if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
-                       /* ACPI version 1.0 */
-
-                       checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
-               }
-               else {
-                       /* Post ACPI 1.0, use extended_checksum */
-
-                       checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
+            mem_rover += ACPI_RSDP_SCAN_STEP) {
+               /* The RSDP signature and checksum must both be correct */
+
+               status =
+                   acpi_tb_validate_rsdp(ACPI_CAST_PTR
+                                         (struct rsdp_descriptor, mem_rover));
+               if (ACPI_SUCCESS(status)) {
+                       /* Sig and checksum valid, we have found a real RSDP */
+
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "RSDP located at physical address %p\n",
+                                         mem_rover));
+                       return_PTR(mem_rover);
                }
 
-               if (checksum == 0) {
-                       /* Checksum valid, we have found a valid RSDP */
-
-                       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                               "RSDP located at physical address %p\n", mem_rover));
-                       return_PTR (mem_rover);
-               }
-
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                       "Found an RSDP at physical address %p, but it has a bad checksum\n",
-                       mem_rover));
+               /* No sig match or bad checksum, keep searching */
        }
 
        /* Searched entire block, no RSDP was found */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Searched entire block, no valid RSDP was found.\n"));
-       return_PTR (NULL);
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Searched entire block from %p, valid RSDP was not found\n",
+                         start_address));
+       return_PTR(NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_find_rsdp
@@ -490,18 +483,14 @@ acpi_tb_scan_memory_for_rsdp (
  ******************************************************************************/
 
 static acpi_status
-acpi_tb_find_rsdp (
-       struct acpi_table_desc          *table_info,
-       u32                             flags)
+acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags)
 {
-       u8                              *table_ptr;
-       u8                              *mem_rover;
-       u32                             physical_address;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("tb_find_rsdp");
+       u8 *table_ptr;
+       u8 *mem_rover;
+       u32 physical_address;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("tb_find_rsdp");
 
        /*
         * Scan supports either logical addressing or physical addressing
@@ -509,23 +498,25 @@ acpi_tb_find_rsdp (
        if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
                /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
 
-               status = acpi_os_map_memory (
-                                (acpi_physical_address) ACPI_EBDA_PTR_LOCATION,
-                                ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr);
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not map memory at %8.8X for length %X\n",
-                               ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
-
-                       return_ACPI_STATUS (status);
+               status = acpi_os_map_memory((acpi_physical_address)
+                                           ACPI_EBDA_PTR_LOCATION,
+                                           ACPI_EBDA_PTR_LENGTH,
+                                           (void *)&table_ptr);
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not map memory at %8.8X for length %X\n",
+                                         ACPI_EBDA_PTR_LOCATION,
+                                         ACPI_EBDA_PTR_LENGTH));
+
+                       return_ACPI_STATUS(status);
                }
 
-               ACPI_MOVE_16_TO_32 (&physical_address, table_ptr);
+               ACPI_MOVE_16_TO_32(&physical_address, table_ptr);
 
                /* Convert segment part to physical address */
 
                physical_address <<= 4;
-               acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH);
+               acpi_os_unmap_memory(table_ptr, ACPI_EBDA_PTR_LENGTH);
 
                /* EBDA present? */
 
@@ -534,59 +525,67 @@ acpi_tb_find_rsdp (
                         * 1b) Search EBDA paragraphs (EBDa is required to be a
                         *     minimum of 1_k length)
                         */
-                       status = acpi_os_map_memory (
-                                        (acpi_physical_address) physical_address,
-                                        ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr);
-                       if (ACPI_FAILURE (status)) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Could not map memory at %8.8X for length %X\n",
-                                       physical_address, ACPI_EBDA_WINDOW_SIZE));
-
-                               return_ACPI_STATUS (status);
+                       status = acpi_os_map_memory((acpi_physical_address)
+                                                   physical_address,
+                                                   ACPI_EBDA_WINDOW_SIZE,
+                                                   (void *)&table_ptr);
+                       if (ACPI_FAILURE(status)) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Could not map memory at %8.8X for length %X\n",
+                                                 physical_address,
+                                                 ACPI_EBDA_WINDOW_SIZE));
+
+                               return_ACPI_STATUS(status);
                        }
 
-                       mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
-                                         ACPI_EBDA_WINDOW_SIZE);
-                       acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
+                       mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr,
+                                                                ACPI_EBDA_WINDOW_SIZE);
+                       acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
 
                        if (mem_rover) {
-                               /* Found it, return the physical address */
+                               /* Return the physical address */
 
-                               physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
+                               physical_address +=
+                                   ACPI_PTR_DIFF(mem_rover, table_ptr);
 
                                table_info->physical_address =
-                                       (acpi_physical_address) physical_address;
-                               return_ACPI_STATUS (AE_OK);
+                                   (acpi_physical_address) physical_address;
+                               return_ACPI_STATUS(AE_OK);
                        }
                }
 
                /*
                 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
                 */
-               status = acpi_os_map_memory (
-                                (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE,
-                                ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr);
-
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Could not map memory at %8.8X for length %X\n",
-                               ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
-
-                       return_ACPI_STATUS (status);
+               status = acpi_os_map_memory((acpi_physical_address)
+                                           ACPI_HI_RSDP_WINDOW_BASE,
+                                           ACPI_HI_RSDP_WINDOW_SIZE,
+                                           (void *)&table_ptr);
+
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Could not map memory at %8.8X for length %X\n",
+                                         ACPI_HI_RSDP_WINDOW_BASE,
+                                         ACPI_HI_RSDP_WINDOW_SIZE));
+
+                       return_ACPI_STATUS(status);
                }
 
-               mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
-               acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
+               mem_rover =
+                   acpi_tb_scan_memory_for_rsdp(table_ptr,
+                                                ACPI_HI_RSDP_WINDOW_SIZE);
+               acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
 
                if (mem_rover) {
-                       /* Found it, return the physical address */
+                       /* Return the physical address */
 
                        physical_address =
-                               ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
+                           ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover,
+                                                                    table_ptr);
 
                        table_info->physical_address =
-                               (acpi_physical_address) physical_address;
-                       return_ACPI_STATUS (AE_OK);
+                           (acpi_physical_address) physical_address;
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
@@ -596,8 +595,8 @@ acpi_tb_find_rsdp (
        else {
                /* 1a) Get the location of the EBDA */
 
-               ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION);
-               physical_address <<= 4;     /* Convert segment to physical address */
+               ACPI_MOVE_16_TO_32(&physical_address, ACPI_EBDA_PTR_LOCATION);
+               physical_address <<= 4; /* Convert segment to physical address */
 
                /* EBDA present? */
 
@@ -606,34 +605,38 @@ acpi_tb_find_rsdp (
                         * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
                         *     1_k length)
                         */
-                       mem_rover = acpi_tb_scan_memory_for_rsdp (
-                                         ACPI_PHYSADDR_TO_PTR (physical_address),
-                                         ACPI_EBDA_WINDOW_SIZE);
+                       mem_rover =
+                           acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR
+                                                        (physical_address),
+                                                        ACPI_EBDA_WINDOW_SIZE);
                        if (mem_rover) {
-                               /* Found it, return the physical address */
+                               /* Return the physical address */
 
-                               table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
-                               return_ACPI_STATUS (AE_OK);
+                               table_info->physical_address =
+                                   ACPI_TO_INTEGER(mem_rover);
+                               return_ACPI_STATUS(AE_OK);
                        }
                }
 
                /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
 
-               mem_rover = acpi_tb_scan_memory_for_rsdp (
-                                 ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
-                                 ACPI_HI_RSDP_WINDOW_SIZE);
+               mem_rover =
+                   acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR
+                                                (ACPI_HI_RSDP_WINDOW_BASE),
+                                                ACPI_HI_RSDP_WINDOW_SIZE);
                if (mem_rover) {
                        /* Found it, return the physical address */
 
-                       table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
-                       return_ACPI_STATUS (AE_OK);
+                       table_info->physical_address =
+                           ACPI_TO_INTEGER(mem_rover);
+                       return_ACPI_STATUS(AE_OK);
                }
        }
 
-       /* RSDP signature was not found */
+       /* A valid RSDP was not found */
 
-       return_ACPI_STATUS (AE_NOT_FOUND);
+       ACPI_REPORT_ERROR(("No valid RSDP was found\n"));
+       return_ACPI_STATUS(AE_NOT_FOUND);
 }
 
 #endif
-
index 79c3a686bc44217d2b9cd078bff1a89444659e2d..a24847c08f7f43d47cc28b33440e5d8d1bd04268 100644 (file)
@@ -70,9 +70,9 @@
 #define CELSIUS_TO_KELVIN(t)   ((t+273)*10)
 
 #define _COMPONENT             ACPI_THERMAL_COMPONENT
-ACPI_MODULE_NAME               ("acpi_thermal")
+ACPI_MODULE_NAME("acpi_thermal")
 
-MODULE_AUTHOR("Paul Diefenbaugh");
+    MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
@@ -80,143 +80,145 @@ static int tzp;
 module_param(tzp, int, 0);
 MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
 
-
-static int acpi_thermal_add (struct acpi_device *device);
-static int acpi_thermal_remove (struct acpi_device *device, int type);
+static int acpi_thermal_add(struct acpi_device *device);
+static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_trip_points (struct file*,const char __user *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_trip_points(struct file *,
+                                             const char __user *, size_t,
+                                             loff_t *);
 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char __user *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_cooling_mode(struct file *,
+                                              const char __user *, size_t,
+                                              loff_t *);
 static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_polling(struct file*,const char __user *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_polling(struct file *, const char __user *,
+                                         size_t, loff_t *);
 
 static struct acpi_driver acpi_thermal_driver = {
-       .name =         ACPI_THERMAL_DRIVER_NAME,
-       .class =        ACPI_THERMAL_CLASS,
-       .ids =          ACPI_THERMAL_HID,
-       .ops =          {
-                               .add =          acpi_thermal_add,
-                               .remove =       acpi_thermal_remove,
-                       },
+       .name = ACPI_THERMAL_DRIVER_NAME,
+       .class = ACPI_THERMAL_CLASS,
+       .ids = ACPI_THERMAL_HID,
+       .ops = {
+               .add = acpi_thermal_add,
+               .remove = acpi_thermal_remove,
+               },
 };
 
 struct acpi_thermal_state {
-       u8                      critical:1;
-       u8                      hot:1;
-       u8                      passive:1;
-       u8                      active:1;
-       u8                      reserved:4;
-       int                     active_index;
+       u8 critical:1;
+       u8 hot:1;
+       u8 passive:1;
+       u8 active:1;
+       u8 reserved:4;
+       int active_index;
 };
 
 struct acpi_thermal_state_flags {
-       u8                      valid:1;
-       u8                      enabled:1;
-       u8                      reserved:6;
+       u8 valid:1;
+       u8 enabled:1;
+       u8 reserved:6;
 };
 
 struct acpi_thermal_critical {
        struct acpi_thermal_state_flags flags;
-       unsigned long           temperature;
+       unsigned long temperature;
 };
 
 struct acpi_thermal_hot {
        struct acpi_thermal_state_flags flags;
-       unsigned long           temperature;
+       unsigned long temperature;
 };
 
 struct acpi_thermal_passive {
        struct acpi_thermal_state_flags flags;
-       unsigned long           temperature;
-       unsigned long           tc1;
-       unsigned long           tc2;
-       unsigned long           tsp;
-       struct acpi_handle_list devices;
+       unsigned long temperature;
+       unsigned long tc1;
+       unsigned long tc2;
+       unsigned long tsp;
+       struct acpi_handle_list devices;
 };
 
 struct acpi_thermal_active {
        struct acpi_thermal_state_flags flags;
-       unsigned long           temperature;
-       struct acpi_handle_list devices;
+       unsigned long temperature;
+       struct acpi_handle_list devices;
 };
 
 struct acpi_thermal_trips {
        struct acpi_thermal_critical critical;
-       struct acpi_thermal_hot hot;
+       struct acpi_thermal_hot hot;
        struct acpi_thermal_passive passive;
        struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE];
 };
 
 struct acpi_thermal_flags {
-       u8                      cooling_mode:1;         /* _SCP */
-       u8                      devices:1;              /* _TZD */
-       u8                      reserved:6;
+       u8 cooling_mode:1;      /* _SCP */
+       u8 devices:1;           /* _TZD */
+       u8 reserved:6;
 };
 
 struct acpi_thermal {
-       acpi_handle             handle;
-       acpi_bus_id             name;
-       unsigned long           temperature;
-       unsigned long           last_temperature;
-       unsigned long           polling_frequency;
-       u8                      cooling_mode;
-       volatile u8             zombie;
+       acpi_handle handle;
+       acpi_bus_id name;
+       unsigned long temperature;
+       unsigned long last_temperature;
+       unsigned long polling_frequency;
+       u8 cooling_mode;
+       volatile u8 zombie;
        struct acpi_thermal_flags flags;
        struct acpi_thermal_state state;
        struct acpi_thermal_trips trips;
-       struct acpi_handle_list devices;
-       struct timer_list       timer;
+       struct acpi_handle_list devices;
+       struct timer_list timer;
 };
 
 static struct file_operations acpi_thermal_state_fops = {
-       .open           = acpi_thermal_state_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_thermal_state_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static struct file_operations acpi_thermal_temp_fops = {
-       .open           = acpi_thermal_temp_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_thermal_temp_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static struct file_operations acpi_thermal_trip_fops = {
-       .open           = acpi_thermal_trip_open_fs,
-       .read           = seq_read,
-       .write          = acpi_thermal_write_trip_points,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_thermal_trip_open_fs,
+       .read = seq_read,
+       .write = acpi_thermal_write_trip_points,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static struct file_operations acpi_thermal_cooling_fops = {
-       .open           = acpi_thermal_cooling_open_fs,
-       .read           = seq_read,
-       .write          = acpi_thermal_write_cooling_mode,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_thermal_cooling_open_fs,
+       .read = seq_read,
+       .write = acpi_thermal_write_cooling_mode,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static struct file_operations acpi_thermal_polling_fops = {
-       .open           = acpi_thermal_polling_open_fs,
-       .read           = seq_read,
-       .write          = acpi_thermal_write_polling,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_thermal_polling_open_fs,
+       .read = seq_read,
+       .write = acpi_thermal_write_polling,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 /* --------------------------------------------------------------------------
                              Thermal Zone Management
    -------------------------------------------------------------------------- */
 
-static int
-acpi_thermal_get_temperature (
-       struct acpi_thermal *tz)
+static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
 {
-       acpi_status             status = AE_OK;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature");
 
@@ -225,41 +227,39 @@ acpi_thermal_get_temperature (
 
        tz->last_temperature = tz->temperature;
 
-       status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
+       status =
+           acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", tz->temperature));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n",
+                         tz->temperature));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_get_polling_frequency (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
 {
-       acpi_status             status = AE_OK;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency");
 
        if (!tz)
                return_VALUE(-EINVAL);
 
-       status = acpi_evaluate_integer(tz->handle, "_TZP", NULL, &tz->polling_frequency);
+       status =
+           acpi_evaluate_integer(tz->handle, "_TZP", NULL,
+                                 &tz->polling_frequency);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", tz->polling_frequency));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n",
+                         tz->polling_frequency));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_set_polling (
-       struct acpi_thermal     *tz,
-       int                     seconds)
+static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds)
 {
        ACPI_FUNCTION_TRACE("acpi_thermal_set_polling");
 
@@ -268,21 +268,19 @@ acpi_thermal_set_polling (
 
        tz->polling_frequency = seconds * 10;   /* Convert value to deci-seconds */
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency set to %lu seconds\n", tz->polling_frequency));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                         "Polling frequency set to %lu seconds\n",
+                         tz->polling_frequency));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_set_cooling_mode (
-       struct acpi_thermal     *tz,
-       int                     mode)
+static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
 {
-       acpi_status             status = AE_OK;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list arg_list = {1, &arg0};
-       acpi_handle             handle = NULL;
+       acpi_status status = AE_OK;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list arg_list = { 1, &arg0 };
+       acpi_handle handle = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode");
 
@@ -303,19 +301,16 @@ acpi_thermal_set_cooling_mode (
 
        tz->cooling_mode = mode;
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", 
-               mode?"passive":"active"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n",
+                         mode ? "passive" : "active"));
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_get_trip_points (
-       struct acpi_thermal *tz)
+static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 {
-       acpi_status             status = AE_OK;
-       int                     i = 0;
+       acpi_status status = AE_OK;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points");
 
@@ -324,111 +319,128 @@ acpi_thermal_get_trip_points (
 
        /* Critical Shutdown (required) */
 
-       status = acpi_evaluate_integer(tz->handle, "_CRT", NULL, 
-               &tz->trips.critical.temperature);
+       status = acpi_evaluate_integer(tz->handle, "_CRT", NULL,
+                                      &tz->trips.critical.temperature);
        if (ACPI_FAILURE(status)) {
                tz->trips.critical.flags.valid = 0;
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n"));
                return_VALUE(-ENODEV);
-       }
-       else {
+       } else {
                tz->trips.critical.flags.valid = 1;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found critical threshold [%lu]\n", tz->trips.critical.temperature));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "Found critical threshold [%lu]\n",
+                                 tz->trips.critical.temperature));
        }
 
        /* Critical Sleep (optional) */
 
-       status = acpi_evaluate_integer(tz->handle, "_HOT", NULL, &tz->trips.hot.temperature);
+       status =
+           acpi_evaluate_integer(tz->handle, "_HOT", NULL,
+                                 &tz->trips.hot.temperature);
        if (ACPI_FAILURE(status)) {
                tz->trips.hot.flags.valid = 0;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No hot threshold\n"));
-       }
-       else {
+       } else {
                tz->trips.hot.flags.valid = 1;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%lu]\n", tz->trips.hot.temperature));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%lu]\n",
+                                 tz->trips.hot.temperature));
        }
 
        /* Passive: Processors (optional) */
 
-       status = acpi_evaluate_integer(tz->handle, "_PSV", NULL, &tz->trips.passive.temperature);
+       status =
+           acpi_evaluate_integer(tz->handle, "_PSV", NULL,
+                                 &tz->trips.passive.temperature);
        if (ACPI_FAILURE(status)) {
                tz->trips.passive.flags.valid = 0;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n"));
-       }
-       else {
+       } else {
                tz->trips.passive.flags.valid = 1;
 
-               status = acpi_evaluate_integer(tz->handle, "_TC1", NULL, &tz->trips.passive.tc1);
+               status =
+                   acpi_evaluate_integer(tz->handle, "_TC1", NULL,
+                                         &tz->trips.passive.tc1);
                if (ACPI_FAILURE(status))
                        tz->trips.passive.flags.valid = 0;
 
-               status = acpi_evaluate_integer(tz->handle, "_TC2", NULL, &tz->trips.passive.tc2);
+               status =
+                   acpi_evaluate_integer(tz->handle, "_TC2", NULL,
+                                         &tz->trips.passive.tc2);
                if (ACPI_FAILURE(status))
                        tz->trips.passive.flags.valid = 0;
 
-               status = acpi_evaluate_integer(tz->handle, "_TSP", NULL, &tz->trips.passive.tsp);
+               status =
+                   acpi_evaluate_integer(tz->handle, "_TSP", NULL,
+                                         &tz->trips.passive.tsp);
                if (ACPI_FAILURE(status))
                        tz->trips.passive.flags.valid = 0;
 
-               status = acpi_evaluate_reference(tz->handle, "_PSL", NULL, &tz->trips.passive.devices);
+               status =
+                   acpi_evaluate_reference(tz->handle, "_PSL", NULL,
+                                           &tz->trips.passive.devices);
                if (ACPI_FAILURE(status))
                        tz->trips.passive.flags.valid = 0;
 
                if (!tz->trips.passive.flags.valid)
-                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid passive threshold\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                         "Invalid passive threshold\n"));
                else
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", tz->trips.passive.temperature));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Found passive threshold [%lu]\n",
+                                         tz->trips.passive.temperature));
        }
 
        /* Active: Fans, etc. (optional) */
 
-       for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++) {
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
 
-               char name[5] = {'_','A','C',('0'+i),'\0'};
+               char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
 
-               status = acpi_evaluate_integer(tz->handle, name, NULL, &tz->trips.active[i].temperature);
+               status =
+                   acpi_evaluate_integer(tz->handle, name, NULL,
+                                         &tz->trips.active[i].temperature);
                if (ACPI_FAILURE(status))
                        break;
 
                name[2] = 'L';
-               status = acpi_evaluate_reference(tz->handle, name, NULL, &tz->trips.active[i].devices);
+               status =
+                   acpi_evaluate_reference(tz->handle, name, NULL,
+                                           &tz->trips.active[i].devices);
                if (ACPI_SUCCESS(status)) {
                        tz->trips.active[i].flags.valid = 1;
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found active threshold [%d]:[%lu]\n", i, tz->trips.active[i].temperature));
-               }
-               else
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid active threshold [%d]\n", i));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Found active threshold [%d]:[%lu]\n",
+                                         i, tz->trips.active[i].temperature));
+               } else
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid active threshold [%d]\n",
+                                         i));
        }
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_get_devices (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_get_devices(struct acpi_thermal *tz)
 {
-       acpi_status             status = AE_OK;
+       acpi_status status = AE_OK;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_get_devices");
 
        if (!tz)
                return_VALUE(-EINVAL);
 
-       status = acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices);
+       status =
+           acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices);
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_call_usermode (
-       char                    *path)
+static int acpi_thermal_call_usermode(char *path)
 {
-       char                    *argv[2] = {NULL, NULL};
-       char                    *envp[3] = {NULL, NULL, NULL};
+       char *argv[2] = { NULL, NULL };
+       char *envp[3] = { NULL, NULL, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode");
 
@@ -440,19 +452,16 @@ acpi_thermal_call_usermode (
        /* minimal command environment */
        envp[0] = "HOME=/";
        envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
-       
+
        call_usermodehelper(argv[0], argv, envp, 0);
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_critical (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_critical(struct acpi_thermal *tz)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_critical");
 
@@ -462,29 +471,28 @@ acpi_thermal_critical (
        if (tz->temperature >= tz->trips.critical.temperature) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n"));
                tz->trips.critical.flags.enabled = 1;
-       }
-       else if (tz->trips.critical.flags.enabled)
+       } else if (tz->trips.critical.flags.enabled)
                tz->trips.critical.flags.enabled = 0;
 
        result = acpi_bus_get_device(tz->handle, &device);
        if (result)
                return_VALUE(result);
 
-       printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", KELVIN_TO_CELSIUS(tz->temperature));
-       acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL, tz->trips.critical.flags.enabled);
+       printk(KERN_EMERG
+              "Critical temperature reached (%ld C), shutting down.\n",
+              KELVIN_TO_CELSIUS(tz->temperature));
+       acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_CRITICAL,
+                               tz->trips.critical.flags.enabled);
 
        acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF);
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_hot (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_hot(struct acpi_thermal *tz)
 {
-       int                     result = 0;
-       struct acpi_device      *device = NULL;
+       int result = 0;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_hot");
 
@@ -494,30 +502,27 @@ acpi_thermal_hot (
        if (tz->temperature >= tz->trips.hot.temperature) {
                ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n"));
                tz->trips.hot.flags.enabled = 1;
-       }
-       else if (tz->trips.hot.flags.enabled)
+       } else if (tz->trips.hot.flags.enabled)
                tz->trips.hot.flags.enabled = 0;
 
        result = acpi_bus_get_device(tz->handle, &device);
        if (result)
                return_VALUE(result);
 
-       acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, tz->trips.hot.flags.enabled);
+       acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT,
+                               tz->trips.hot.flags.enabled);
 
        /* TBD: Call user-mode "sleep(S4)" function */
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_passive (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_passive(struct acpi_thermal *tz)
 {
-       int                     result = 0;
+       int result = 0;
        struct acpi_thermal_passive *passive = NULL;
-       int                     trend = 0;
-       int                     i = 0;
+       int trend = 0;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_passive");
 
@@ -534,25 +539,29 @@ acpi_thermal_passive (
         * accordingly.  Note that we assume symmetry.
         */
        if (tz->temperature >= passive->temperature) {
-               trend = (passive->tc1 * (tz->temperature - tz->last_temperature)) + (passive->tc2 * (tz->temperature - passive->temperature));
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                       "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", 
-                       trend, passive->tc1, tz->temperature, 
-                       tz->last_temperature, passive->tc2, 
-                       tz->temperature, passive->temperature));
+               trend =
+                   (passive->tc1 * (tz->temperature - tz->last_temperature)) +
+                   (passive->tc2 * (tz->temperature - passive->temperature));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n",
+                                 trend, passive->tc1, tz->temperature,
+                                 tz->last_temperature, passive->tc2,
+                                 tz->temperature, passive->temperature));
                tz->trips.passive.flags.enabled = 1;
                /* Heating up? */
                if (trend > 0)
-                       for (i=0; i<passive->devices.count; i++)
-                               acpi_processor_set_thermal_limit(
-                                       passive->devices.handles[i], 
-                                       ACPI_PROCESSOR_LIMIT_INCREMENT);
+                       for (i = 0; i < passive->devices.count; i++)
+                               acpi_processor_set_thermal_limit(passive->
+                                                                devices.
+                                                                handles[i],
+                                                                ACPI_PROCESSOR_LIMIT_INCREMENT);
                /* Cooling off? */
                else if (trend < 0)
-                       for (i=0; i<passive->devices.count; i++)
-                               acpi_processor_set_thermal_limit(
-                                       passive->devices.handles[i], 
-                                       ACPI_PROCESSOR_LIMIT_DECREMENT);
+                       for (i = 0; i < passive->devices.count; i++)
+                               acpi_processor_set_thermal_limit(passive->
+                                                                devices.
+                                                                handles[i],
+                                                                ACPI_PROCESSOR_LIMIT_DECREMENT);
        }
 
        /*
@@ -563,37 +572,35 @@ acpi_thermal_passive (
         * assume symmetry.
         */
        else if (tz->trips.passive.flags.enabled) {
-               for (i=0; i<passive->devices.count; i++)
-                       result = acpi_processor_set_thermal_limit(
-                               passive->devices.handles[i], 
-                               ACPI_PROCESSOR_LIMIT_DECREMENT);
+               for (i = 0; i < passive->devices.count; i++)
+                       result =
+                           acpi_processor_set_thermal_limit(passive->devices.
+                                                            handles[i],
+                                                            ACPI_PROCESSOR_LIMIT_DECREMENT);
                if (result == 1) {
                        tz->trips.passive.flags.enabled = 0;
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, 
-                               "Disabling passive cooling (zone is cool)\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Disabling passive cooling (zone is cool)\n"));
                }
        }
 
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_active (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_active(struct acpi_thermal *tz)
 {
-       int                     result = 0;
+       int result = 0;
        struct acpi_thermal_active *active = NULL;
-       int                     i = 0;
-       int                     j = 0;
-       unsigned long           maxtemp = 0;
+       int i = 0;
+       int j = 0;
+       unsigned long maxtemp = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_active");
 
        if (!tz)
                return_VALUE(-EINVAL);
 
-       for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++) {
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
 
                active = &(tz->trips.active[i]);
                if (!active || !active->flags.valid)
@@ -607,16 +614,27 @@ acpi_thermal_active (
                 */
                if (tz->temperature >= active->temperature) {
                        if (active->temperature > maxtemp)
-                               tz->state.active_index = i, maxtemp = active->temperature;
+                               tz->state.active_index = i, maxtemp =
+                                   active->temperature;
                        if (!active->flags.enabled) {
                                for (j = 0; j < active->devices.count; j++) {
-                                       result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D0);
+                                       result =
+                                           acpi_bus_set_power(active->devices.
+                                                              handles[j],
+                                                              ACPI_STATE_D0);
                                        if (result) {
-                                               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to turn cooling device [%p] 'on'\n", active->devices.handles[j]));
+                                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                                 "Unable to turn cooling device [%p] 'on'\n",
+                                                                 active->
+                                                                 devices.
+                                                                 handles[j]));
                                                continue;
                                        }
                                        active->flags.enabled = 1;
-                                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling device [%p] now 'on'\n", active->devices.handles[j]));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                         "Cooling device [%p] now 'on'\n",
+                                                         active->devices.
+                                                         handles[j]));
                                }
                        }
                }
@@ -628,13 +646,21 @@ acpi_thermal_active (
                 */
                else if (active->flags.enabled) {
                        for (j = 0; j < active->devices.count; j++) {
-                               result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3);
+                               result =
+                                   acpi_bus_set_power(active->devices.
+                                                      handles[j],
+                                                      ACPI_STATE_D3);
                                if (result) {
-                                       ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to turn cooling device [%p] 'off'\n", active->devices.handles[j]));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                         "Unable to turn cooling device [%p] 'off'\n",
+                                                         active->devices.
+                                                         handles[j]));
                                        continue;
                                }
                                active->flags.enabled = 0;
-                               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling device [%p] now 'off'\n", active->devices.handles[j]));
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "Cooling device [%p] now 'off'\n",
+                                                 active->devices.handles[j]));
                        }
                }
        }
@@ -642,28 +668,22 @@ acpi_thermal_active (
        return_VALUE(0);
 }
 
+static void acpi_thermal_check(void *context);
 
-static void acpi_thermal_check (void *context);
-
-static void
-acpi_thermal_run (
-       unsigned long           data)
+static void acpi_thermal_run(unsigned long data)
 {
        struct acpi_thermal *tz = (struct acpi_thermal *)data;
        if (!tz->zombie)
-               acpi_os_queue_for_execution(OSD_PRIORITY_GPE,  
-                       acpi_thermal_check, (void *) data);
+               acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
+                                           acpi_thermal_check, (void *)data);
 }
 
-
-static void
-acpi_thermal_check (
-       void                    *data)
+static void acpi_thermal_check(void *data)
 {
-       int                     result = 0;
-       struct acpi_thermal     *tz = (struct acpi_thermal *) data;
-       unsigned long           sleep_time = 0;
-       int                     i = 0;
+       int result = 0;
+       struct acpi_thermal *tz = (struct acpi_thermal *)data;
+       unsigned long sleep_time = 0;
+       int i = 0;
        struct acpi_thermal_state state;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_check");
@@ -678,9 +698,9 @@ acpi_thermal_check (
        result = acpi_thermal_get_temperature(tz);
        if (result)
                return_VOID;
-       
+
        memset(&tz->state, 0, sizeof(tz->state));
-       
+
        /*
         * Check Trip Points
         * -----------------
@@ -690,14 +710,18 @@ acpi_thermal_check (
         * individual policy decides when it is exited (e.g. hysteresis).
         */
        if (tz->trips.critical.flags.valid)
-               state.critical |= (tz->temperature >= tz->trips.critical.temperature);
+               state.critical |=
+                   (tz->temperature >= tz->trips.critical.temperature);
        if (tz->trips.hot.flags.valid)
                state.hot |= (tz->temperature >= tz->trips.hot.temperature);
        if (tz->trips.passive.flags.valid)
-               state.passive |= (tz->temperature >= tz->trips.passive.temperature);
-       for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
+               state.passive |=
+                   (tz->temperature >= tz->trips.passive.temperature);
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
                if (tz->trips.active[i].flags.valid)
-                       state.active |= (tz->temperature >= tz->trips.active[i].temperature);
+                       state.active |=
+                           (tz->temperature >=
+                            tz->trips.active[i].temperature);
 
        /*
         * Invoke Policy
@@ -726,7 +750,7 @@ acpi_thermal_check (
                tz->state.hot = 1;
        if (tz->trips.passive.flags.enabled)
                tz->state.passive = 1;
-       for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++)
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
                if (tz->trips.active[i].flags.enabled)
                        tz->state.active = 1;
 
@@ -744,8 +768,8 @@ acpi_thermal_check (
        else if (tz->polling_frequency > 0)
                sleep_time = tz->polling_frequency * 100;
 
-       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", 
-               tz->name, tz->temperature, sleep_time));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n",
+                         tz->name, tz->temperature, sleep_time));
 
        /*
         * Schedule Next Poll
@@ -754,12 +778,11 @@ acpi_thermal_check (
        if (!sleep_time) {
                if (timer_pending(&(tz->timer)))
                        del_timer(&(tz->timer));
-       }
-       else {
+       } else {
                if (timer_pending(&(tz->timer)))
                        mod_timer(&(tz->timer), (HZ * sleep_time) / 1000);
                else {
-                       tz->timer.data = (unsigned long) tz;
+                       tz->timer.data = (unsigned long)tz;
                        tz->timer.function = acpi_thermal_run;
                        tz->timer.expires = jiffies + (HZ * sleep_time) / 1000;
                        add_timer(&(tz->timer));
@@ -769,16 +792,15 @@ acpi_thermal_check (
        return_VOID;
 }
 
-
 /* --------------------------------------------------------------------------
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_thermal_dir;
+static struct proc_dir_entry *acpi_thermal_dir;
 
 static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_thermal     *tz = (struct acpi_thermal *)seq->private;
+       struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show");
 
@@ -787,7 +809,8 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
 
        seq_puts(seq, "state:                   ");
 
-       if (!tz->state.critical && !tz->state.hot && !tz->state.passive && !tz->state.active)
+       if (!tz->state.critical && !tz->state.hot && !tz->state.passive
+           && !tz->state.active)
                seq_puts(seq, "ok\n");
        else {
                if (tz->state.critical)
@@ -801,7 +824,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
                seq_puts(seq, "\n");
        }
 
-end:
+      end:
        return_VALUE(0);
 }
 
@@ -810,11 +833,10 @@ static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data);
 }
 
-
 static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
 {
-       int                     result = 0;
-       struct acpi_thermal     *tz = (struct acpi_thermal *)seq->private;
+       int result = 0;
+       struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show");
 
@@ -825,10 +847,10 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
        if (result)
                goto end;
 
-       seq_printf(seq, "temperature:             %ld C\n", 
-               KELVIN_TO_CELSIUS(tz->temperature));
+       seq_printf(seq, "temperature:             %ld C\n",
+                  KELVIN_TO_CELSIUS(tz->temperature));
 
-end:
+      end:
        return_VALUE(0);
 }
 
@@ -837,12 +859,11 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
        return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data);
 }
 
-
 static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_thermal     *tz = (struct acpi_thermal *)seq->private;
-       int                     i = 0;
-       int                     j = 0;
+       struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
+       int i = 0;
+       int j = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show");
 
@@ -851,21 +872,22 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
 
        if (tz->trips.critical.flags.valid)
                seq_printf(seq, "critical (S5):           %ld C\n",
-                       KELVIN_TO_CELSIUS(tz->trips.critical.temperature));
+                          KELVIN_TO_CELSIUS(tz->trips.critical.temperature));
 
        if (tz->trips.hot.flags.valid)
                seq_printf(seq, "hot (S4):                %ld C\n",
-                       KELVIN_TO_CELSIUS(tz->trips.hot.temperature));
+                          KELVIN_TO_CELSIUS(tz->trips.hot.temperature));
 
        if (tz->trips.passive.flags.valid) {
-               seq_printf(seq, "passive:                 %ld C: tc1=%lu tc2=%lu tsp=%lu devices=",
-                       KELVIN_TO_CELSIUS(tz->trips.passive.temperature),
-                       tz->trips.passive.tc1,
-                       tz->trips.passive.tc2, 
-                       tz->trips.passive.tsp);
-               for (j=0; j<tz->trips.passive.devices.count; j++) {
-
-                       seq_printf(seq, "0x%p ", tz->trips.passive.devices.handles[j]);
+               seq_printf(seq,
+                          "passive:                 %ld C: tc1=%lu tc2=%lu tsp=%lu devices=",
+                          KELVIN_TO_CELSIUS(tz->trips.passive.temperature),
+                          tz->trips.passive.tc1, tz->trips.passive.tc2,
+                          tz->trips.passive.tsp);
+               for (j = 0; j < tz->trips.passive.devices.count; j++) {
+
+                       seq_printf(seq, "0x%p ",
+                                  tz->trips.passive.devices.handles[j]);
                }
                seq_puts(seq, "\n");
        }
@@ -874,14 +896,15 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
                if (!(tz->trips.active[i].flags.valid))
                        break;
                seq_printf(seq, "active[%d]:               %ld C: devices=",
-                       i, KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
-               for (j = 0; j < tz->trips.active[i].devices.count; j++) 
+                          i,
+                          KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
+               for (j = 0; j < tz->trips.active[i].devices.count; j++)
                        seq_printf(seq, "0x%p ",
-                               tz->trips.active[i].devices.handles[j]);
+                                  tz->trips.active[i].devices.handles[j]);
                seq_puts(seq, "\n");
        }
 
-end:
+      end:
        return_VALUE(0);
 }
 
@@ -891,30 +914,28 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
 }
 
 static ssize_t
-acpi_thermal_write_trip_points (
-        struct file            *file,
-        const char             __user *buffer,
-        size_t                 count,
-        loff_t                 *ppos)
+acpi_thermal_write_trip_points(struct file *file,
+                              const char __user * buffer,
+                              size_t count, loff_t * ppos)
 {
-       struct seq_file         *m = (struct seq_file *)file->private_data;
-       struct acpi_thermal     *tz = (struct acpi_thermal *)m->private;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_thermal *tz = (struct acpi_thermal *)m->private;
 
-       char                    *limit_string; 
-       int                     num, critical, hot, passive;
-       int                     *active; 
-       int                     i = 0;
+       char *limit_string;
+       int num, critical, hot, passive;
+       int *active;
+       int i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points");
 
        limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
-       if(!limit_string)
+       if (!limit_string)
                return_VALUE(-ENOMEM);
 
        memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
 
-       active = kmalloc(ACPI_THERMAL_MAX_ACTIVE *sizeof(int), GFP_KERNEL);
-       if(!active)
+       active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
+       if (!active)
                return_VALUE(-ENOMEM);
 
        if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
@@ -922,20 +943,21 @@ acpi_thermal_write_trip_points (
                count = -EINVAL;
                goto end;
        }
-       
+
        if (copy_from_user(limit_string, buffer, count)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n"));
                count = -EFAULT;
                goto end;
        }
-       
+
        limit_string[count] = '\0';
 
        num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
-                               &critical, &hot, &passive,
-                               &active[0], &active[1], &active[2], &active[3], &active[4],
-                               &active[5], &active[6], &active[7], &active[8], &active[9]);
-       if(!(num >=5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) {
+                    &critical, &hot, &passive,
+                    &active[0], &active[1], &active[2], &active[3], &active[4],
+                    &active[5], &active[6], &active[7], &active[8],
+                    &active[9]);
+       if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n"));
                count = -EINVAL;
                goto end;
@@ -949,17 +971,16 @@ acpi_thermal_write_trip_points (
                        break;
                tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]);
        }
-       
-end:
+
+      end:
        kfree(active);
        kfree(limit_string);
        return_VALUE(count);
 }
 
-
 static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_thermal     *tz = (struct acpi_thermal *)seq->private;
+       struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show");
 
@@ -970,33 +991,31 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
                seq_puts(seq, "<setting not supported>\n");
        }
 
-       if ( tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL )
+       if (tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL)
                seq_printf(seq, "cooling mode:  critical\n");
        else
                seq_printf(seq, "cooling mode:  %s\n",
-                       tz->cooling_mode?"passive":"active");
+                          tz->cooling_mode ? "passive" : "active");
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_thermal_cooling_seq_show,
-                                                       PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
 static ssize_t
-acpi_thermal_write_cooling_mode (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_thermal_write_cooling_mode(struct file *file,
+                               const char __user * buffer,
+                               size_t count, loff_t * ppos)
 {
-       struct seq_file         *m = (struct seq_file *)file->private_data;
-       struct acpi_thermal     *tz = (struct acpi_thermal *)m->private;
-       int                     result = 0;
-       char                    mode_string[12] = {'\0'};
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_thermal *tz = (struct acpi_thermal *)m->private;
+       int result = 0;
+       char mode_string[12] = { '\0' };
 
        ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode");
 
@@ -1008,11 +1027,12 @@ acpi_thermal_write_cooling_mode (
 
        if (copy_from_user(mode_string, buffer, count))
                return_VALUE(-EFAULT);
-       
+
        mode_string[count] = '\0';
-       
-       result = acpi_thermal_set_cooling_mode(tz, 
-               simple_strtoul(mode_string, NULL, 0));
+
+       result = acpi_thermal_set_cooling_mode(tz,
+                                              simple_strtoul(mode_string, NULL,
+                                                             0));
        if (result)
                return_VALUE(result);
 
@@ -1021,10 +1041,9 @@ acpi_thermal_write_cooling_mode (
        return_VALUE(count);
 }
 
-
 static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_thermal     *tz = (struct acpi_thermal *)seq->private;
+       struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show");
 
@@ -1037,43 +1056,41 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "polling frequency:       %lu seconds\n",
-               (tz->polling_frequency / 10));
+                  (tz->polling_frequency / 10));
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_thermal_polling_seq_show,
-                                                       PDE(inode)->data);
+                          PDE(inode)->data);
 }
 
 static ssize_t
-acpi_thermal_write_polling (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *ppos)
+acpi_thermal_write_polling(struct file *file,
+                          const char __user * buffer,
+                          size_t count, loff_t * ppos)
 {
-       struct seq_file         *m = (struct seq_file *)file->private_data;
-       struct acpi_thermal     *tz = (struct acpi_thermal *)m->private;
-       int                     result = 0;
-       char                    polling_string[12] = {'\0'};
-       int                     seconds = 0;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_thermal *tz = (struct acpi_thermal *)m->private;
+       int result = 0;
+       char polling_string[12] = { '\0' };
+       int seconds = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_write_polling");
 
        if (!tz || (count > sizeof(polling_string) - 1))
                return_VALUE(-EINVAL);
-       
+
        if (copy_from_user(polling_string, buffer, count))
                return_VALUE(-EFAULT);
-       
+
        polling_string[count] = '\0';
 
        seconds = simple_strtoul(polling_string, NULL, 0);
-       
+
        result = acpi_thermal_set_polling(tz, seconds);
        if (result)
                return_VALUE(result);
@@ -1083,18 +1100,15 @@ acpi_thermal_write_polling (
        return_VALUE(count);
 }
 
-
-static int
-acpi_thermal_add_fs (
-       struct acpi_device      *device)
+static int acpi_thermal_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_add_fs");
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                       acpi_thermal_dir);
+                                                    acpi_thermal_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                acpi_device_dir(device)->owner = THIS_MODULE;
@@ -1102,11 +1116,11 @@ acpi_thermal_add_fs (
 
        /* 'state' [R] */
        entry = create_proc_entry(ACPI_THERMAL_FILE_STATE,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_THERMAL_FILE_STATE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_THERMAL_FILE_STATE));
        else {
                entry->proc_fops = &acpi_thermal_state_fops;
                entry->data = acpi_driver_data(device);
@@ -1115,11 +1129,11 @@ acpi_thermal_add_fs (
 
        /* 'temperature' [R] */
        entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
-               S_IRUGO, acpi_device_dir(device));
+                                 S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_THERMAL_FILE_TEMPERATURE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_THERMAL_FILE_TEMPERATURE));
        else {
                entry->proc_fops = &acpi_thermal_temp_fops;
                entry->data = acpi_driver_data(device);
@@ -1128,11 +1142,12 @@ acpi_thermal_add_fs (
 
        /* 'trip_points' [R/W] */
        entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_THERMAL_FILE_TRIP_POINTS));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_THERMAL_FILE_TRIP_POINTS));
        else {
                entry->proc_fops = &acpi_thermal_trip_fops;
                entry->data = acpi_driver_data(device);
@@ -1141,11 +1156,12 @@ acpi_thermal_add_fs (
 
        /* 'cooling_mode' [R/W] */
        entry = create_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_THERMAL_FILE_COOLING_MODE));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_THERMAL_FILE_COOLING_MODE));
        else {
                entry->proc_fops = &acpi_thermal_cooling_fops;
                entry->data = acpi_driver_data(device);
@@ -1154,11 +1170,12 @@ acpi_thermal_add_fs (
 
        /* 'polling_frequency' [R/W] */
        entry = create_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
-               S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+                                 S_IFREG | S_IRUGO | S_IWUSR,
+                                 acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create '%s' fs entry\n",
-                       ACPI_THERMAL_FILE_POLLING_FREQ));
+                                 "Unable to create '%s' fs entry\n",
+                                 ACPI_THERMAL_FILE_POLLING_FREQ));
        else {
                entry->proc_fops = &acpi_thermal_polling_fops;
                entry->data = acpi_driver_data(device);
@@ -1168,10 +1185,7 @@ acpi_thermal_add_fs (
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_remove_fs (
-       struct acpi_device      *device)
+static int acpi_thermal_remove_fs(struct acpi_device *device)
 {
        ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
 
@@ -1193,19 +1207,14 @@ acpi_thermal_remove_fs (
        return_VALUE(0);
 }
 
-
 /* --------------------------------------------------------------------------
                                  Driver Interface
    -------------------------------------------------------------------------- */
 
-static void
-acpi_thermal_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_thermal     *tz = (struct acpi_thermal *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_thermal *tz = (struct acpi_thermal *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_notify");
 
@@ -1231,19 +1240,16 @@ acpi_thermal_notify (
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-
-static int
-acpi_thermal_get_info (
-       struct acpi_thermal     *tz)
+static int acpi_thermal_get_info(struct acpi_thermal *tz)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_get_info");
 
@@ -1262,20 +1268,24 @@ acpi_thermal_get_info (
 
        /* Set the cooling mode [_SCP] to active cooling (default) */
        result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
-       if (!result) 
+       if (!result)
                tz->flags.cooling_mode = 1;
-       else { 
+       else {
                /* Oh,we have not _SCP method.
-                  Generally show cooling_mode by _ACx, _PSV,spec 12.2*/
+                  Generally show cooling_mode by _ACx, _PSV,spec 12.2 */
                tz->flags.cooling_mode = 0;
-               if ( tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
-                       if ( tz->trips.passive.temperature > tz->trips.active[0].temperature )
+               if (tz->trips.active[0].flags.valid
+                   && tz->trips.passive.flags.valid) {
+                       if (tz->trips.passive.temperature >
+                           tz->trips.active[0].temperature)
                                tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
-                       else 
+                       else
                                tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
-               } else if ( !tz->trips.active[0].flags.valid && tz->trips.passive.flags.valid ) {
+               } else if (!tz->trips.active[0].flags.valid
+                          && tz->trips.passive.flags.valid) {
                        tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE;
-               } else if ( tz->trips.active[0].flags.valid && !tz->trips.passive.flags.valid ) {
+               } else if (tz->trips.active[0].flags.valid
+                          && !tz->trips.passive.flags.valid) {
                        tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE;
                } else {
                        /* _ACx and _PSV are optional, but _CRT is required */
@@ -1297,14 +1307,11 @@ acpi_thermal_get_info (
        return_VALUE(0);
 }
 
-
-static int
-acpi_thermal_add (
-       struct acpi_device              *device)
+static int acpi_thermal_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = AE_OK;
-       struct acpi_thermal     *tz = NULL;
+       int result = 0;
+       acpi_status status = AE_OK;
+       struct acpi_thermal *tz = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_add");
 
@@ -1335,19 +1342,20 @@ acpi_thermal_add (
        acpi_thermal_check(tz);
 
        status = acpi_install_notify_handler(tz->handle,
-               ACPI_DEVICE_NOTIFY, acpi_thermal_notify, tz);
+                                            ACPI_DEVICE_NOTIFY,
+                                            acpi_thermal_notify, tz);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                result = -ENODEV;
                goto end;
        }
 
        printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n",
-               acpi_device_name(device), acpi_device_bid(device),
-               KELVIN_TO_CELSIUS(tz->temperature));
+              acpi_device_name(device), acpi_device_bid(device),
+              KELVIN_TO_CELSIUS(tz->temperature));
 
-end:
+      end:
        if (result) {
                acpi_thermal_remove_fs(device);
                kfree(tz);
@@ -1356,21 +1364,17 @@ end:
        return_VALUE(result);
 }
 
-
-static int
-acpi_thermal_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_thermal_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = AE_OK;
-       struct acpi_thermal     *tz = NULL;
+       acpi_status status = AE_OK;
+       struct acpi_thermal *tz = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       tz = (struct acpi_thermal *) acpi_driver_data(device);
+       tz = (struct acpi_thermal *)acpi_driver_data(device);
 
        /* avoid timer adding new defer task */
        tz->zombie = 1;
@@ -1382,19 +1386,19 @@ acpi_thermal_remove (
        del_timer_sync(&(tz->timer));
 
        status = acpi_remove_notify_handler(tz->handle,
-               ACPI_DEVICE_NOTIFY, acpi_thermal_notify);
+                                           ACPI_DEVICE_NOTIFY,
+                                           acpi_thermal_notify);
        if (ACPI_FAILURE(status))
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
 
        /* Terminate policy */
-       if (tz->trips.passive.flags.valid
-               && tz->trips.passive.flags.enabled) {
+       if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) {
                tz->trips.passive.flags.enabled = 0;
                acpi_thermal_passive(tz);
        }
        if (tz->trips.active[0].flags.valid
-               && tz->trips.active[0].flags.enabled) {
+           && tz->trips.active[0].flags.enabled) {
                tz->trips.active[0].flags.enabled = 0;
                acpi_thermal_active(tz);
        }
@@ -1405,11 +1409,9 @@ acpi_thermal_remove (
        return_VALUE(0);
 }
 
-
-static int __init
-acpi_thermal_init (void)
+static int __init acpi_thermal_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_thermal_init");
 
@@ -1427,9 +1429,7 @@ acpi_thermal_init (void)
        return_VALUE(0);
 }
 
-
-static void __exit
-acpi_thermal_exit (void)
+static void __exit acpi_thermal_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_thermal_exit");
 
@@ -1440,6 +1440,5 @@ acpi_thermal_exit (void)
        return_VOID;
 }
 
-
 module_init(acpi_thermal_init);
 module_exit(acpi_thermal_exit);
index 73b1d8aeae9d33ca1a69b82f6483d4cf39049a0f..7fe0b7ae973397b8920b624887dce1462f7e6b4b 100644 (file)
@@ -100,8 +100,7 @@ MODULE_LICENSE("GPL");
 /* utility
  */
 
-static __inline__ void
-_set_bit(u32* word, u32 mask, int value)
+static __inline__ void _set_bit(u32 * word, u32 mask, int value)
 {
        *word = (*word & ~mask) | (mask * value);
 }
@@ -109,35 +108,32 @@ _set_bit(u32* word, u32 mask, int value)
 /* acpi interface wrappers
  */
 
-static int
-is_valid_acpi_path(const char* methodName)
+static int is_valid_acpi_path(const char *methodName)
 {
        acpi_handle handle;
        acpi_status status;
 
-       status = acpi_get_handle(NULL, (char*)methodName, &handle);
+       status = acpi_get_handle(NULL, (char *)methodName, &handle);
        return !ACPI_FAILURE(status);
 }
 
-static int
-write_acpi_int(const char* methodName, int val)
+static int write_acpi_int(const char *methodName, int val)
 {
        struct acpi_object_list params;
        union acpi_object in_objs[1];
        acpi_status status;
 
-       params.count = sizeof(in_objs)/sizeof(in_objs[0]);
+       params.count = sizeof(in_objs) / sizeof(in_objs[0]);
        params.pointer = in_objs;
        in_objs[0].type = ACPI_TYPE_INTEGER;
        in_objs[0].integer.value = val;
 
-       status = acpi_evaluate_object(NULL, (char*)methodName, &params, NULL);
+       status = acpi_evaluate_object(NULL, (char *)methodName, &params, NULL);
        return (status == AE_OK);
 }
 
 #if 0
-static int
-read_acpi_int(const char* methodName, int* pVal)
+static int read_acpi_int(const char *methodName, int *pVal)
 {
        struct acpi_buffer results;
        union acpi_object out_objs[1];
@@ -146,25 +142,24 @@ read_acpi_int(const char* methodName, int* pVal)
        results.length = sizeof(out_objs);
        results.pointer = out_objs;
 
-       status = acpi_evaluate_object(0, (char*)methodName, 0, &results);
+       status = acpi_evaluate_object(0, (char *)methodName, 0, &results);
        *pVal = out_objs[0].integer.value;
 
        return (status == AE_OK) && (out_objs[0].type == ACPI_TYPE_INTEGER);
 }
 #endif
 
-static const char*             method_hci /*= 0*/;
+static const char *method_hci /*= 0*/ ;
 
 /* Perform a raw HCI call.  Here we don't care about input or output buffer
  * format.
  */
-static acpi_status
-hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
+static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
 {
        struct acpi_object_list params;
        union acpi_object in_objs[HCI_WORDS];
        struct acpi_buffer results;
-       union acpi_object out_objs[HCI_WORDS+1];
+       union acpi_object out_objs[HCI_WORDS + 1];
        acpi_status status;
        int i;
 
@@ -178,8 +173,8 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
        results.length = sizeof(out_objs);
        results.pointer = out_objs;
 
-       status = acpi_evaluate_object(NULL, (char*)method_hci, &params,
-               &results);
+       status = acpi_evaluate_object(NULL, (char *)method_hci, &params,
+                                     &results);
        if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
                for (i = 0; i < out_objs->package.count; ++i) {
                        out[i] = out_objs->package.elements[i].integer.value;
@@ -195,8 +190,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
  * may be useful (such as "not supported").
  */
 
-static acpi_status
-hci_write1(u32 reg, u32 in1, u32* result)
+static acpi_status hci_write1(u32 reg, u32 in1, u32 * result)
 {
        u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 };
        u32 out[HCI_WORDS];
@@ -205,8 +199,7 @@ hci_write1(u32 reg, u32 in1, u32* result)
        return status;
 }
 
-static acpi_status
-hci_read1(u32 reg, u32* out1, u32* result)
+static acpi_status hci_read1(u32 reg, u32 * out1, u32 * result)
 {
        u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 };
        u32 out[HCI_WORDS];
@@ -216,26 +209,25 @@ hci_read1(u32 reg, u32* out1, u32* result)
        return status;
 }
 
-static struct proc_dir_entry*  toshiba_proc_dir /*= 0*/;
-static int                     force_fan;
-static int                     last_key_event;
-static int                     key_event_valid;
+static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ;
+static int force_fan;
+static int last_key_event;
+static int key_event_valid;
 
-typedef struct _ProcItem
-{
-       const char* name;
-       char* (*read_func)(char*);
-       unsigned long (*write_func)(const char*, unsigned long);
+typedef struct _ProcItem {
+       const char *name;
+       char *(*read_func) (char *);
+       unsigned long (*write_func) (const char *, unsigned long);
 } ProcItem;
 
 /* proc file handlers
  */
 
 static int
-dispatch_read(char* page, char** start, off_t off, int count, int* eof,
-       ProcItem* item)
+dispatch_read(char *page, char **start, off_t off, int count, int *eof,
+             ProcItem * item)
 {
-       charp = page;
+       char *p = page;
        int len;
 
        if (off == 0)
@@ -243,33 +235,35 @@ dispatch_read(char* page, char** start, off_t off, int count, int* eof,
 
        /* ISSUE: I don't understand this code */
        len = (p - page);
-       if (len <= off+count) *eof = 1;
+       if (len <= off + count)
+               *eof = 1;
        *start = page + off;
        len -= off;
-       if (len>count) len = count;
-       if (len<0) len = 0;
+       if (len > count)
+               len = count;
+       if (len < 0)
+               len = 0;
        return len;
 }
 
 static int
-dispatch_write(struct filefile, const char __user * buffer,
-       unsigned long count, ProcItem* item)
+dispatch_write(struct file *file, const char __user * buffer,
+              unsigned long count, ProcItem * item)
 {
        int result;
-       chartmp_buffer;
+       char *tmp_buffer;
 
        /* Arg buffer points to userspace memory, which can't be accessed
         * directly.  Since we're making a copy, zero-terminate the
         * destination so that sscanf can be used on it safely.
         */
        tmp_buffer = kmalloc(count + 1, GFP_KERNEL);
-       if(!tmp_buffer)
+       if (!tmp_buffer)
                return -ENOMEM;
 
        if (copy_from_user(tmp_buffer, buffer, count)) {
                result = -EFAULT;
-       }
-       else {
+       } else {
                tmp_buffer[count] = 0;
                result = item->write_func(tmp_buffer, count);
        }
@@ -277,8 +271,7 @@ dispatch_write(struct file* file, const char __user * buffer,
        return result;
 }
 
-static char*
-read_lcd(char* p)
+static char *read_lcd(char *p)
 {
        u32 hci_result;
        u32 value;
@@ -288,7 +281,7 @@ read_lcd(char* p)
                value = value >> HCI_LCD_BRIGHTNESS_SHIFT;
                p += sprintf(p, "brightness:              %d\n", value);
                p += sprintf(p, "brightness_levels:       %d\n",
-                       HCI_LCD_BRIGHTNESS_LEVELS);
+                            HCI_LCD_BRIGHTNESS_LEVELS);
        } else {
                printk(MY_ERR "Error reading LCD brightness\n");
        }
@@ -296,14 +289,13 @@ read_lcd(char* p)
        return p;
 }
 
-static unsigned long
-write_lcd(const char* buffer, unsigned long count)
+static unsigned long write_lcd(const char *buffer, unsigned long count)
 {
        int value;
        u32 hci_result;
 
        if (sscanf(buffer, " brightness : %i", &value) == 1 &&
-                       value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) {
+           value >= 0 && value < HCI_LCD_BRIGHTNESS_LEVELS) {
                value = value << HCI_LCD_BRIGHTNESS_SHIFT;
                hci_write1(HCI_LCD_BRIGHTNESS, value, &hci_result);
                if (hci_result != HCI_SUCCESS)
@@ -315,8 +307,7 @@ write_lcd(const char* buffer, unsigned long count)
        return count;
 }
 
-static char*
-read_video(char* p)
+static char *read_video(char *p)
 {
        u32 hci_result;
        u32 value;
@@ -325,7 +316,7 @@ read_video(char* p)
        if (hci_result == HCI_SUCCESS) {
                int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
                int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
-               int is_tv  = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0;
+               int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0;
                p += sprintf(p, "lcd_out:                 %d\n", is_lcd);
                p += sprintf(p, "crt_out:                 %d\n", is_crt);
                p += sprintf(p, "tv_out:                  %d\n", is_tv);
@@ -336,8 +327,7 @@ read_video(char* p)
        return p;
 }
 
-static unsigned long
-write_video(const char* buffer, unsigned long count)
+static unsigned long write_video(const char *buffer, unsigned long count)
 {
        int value;
        int remain = count;
@@ -363,7 +353,7 @@ write_video(const char* buffer, unsigned long count)
                        ++buffer;
                        --remain;
                }
-               while (remain && *(buffer-1) != ';');
+               while (remain && *(buffer - 1) != ';');
        }
 
        hci_read1(HCI_VIDEO_OUT, &video_out, &hci_result);
@@ -386,8 +376,7 @@ write_video(const char* buffer, unsigned long count)
        return count;
 }
 
-static char*
-read_fan(char* p)
+static char *read_fan(char *p)
 {
        u32 hci_result;
        u32 value;
@@ -403,14 +392,13 @@ read_fan(char* p)
        return p;
 }
 
-static unsigned long
-write_fan(const char* buffer, unsigned long count)
+static unsigned long write_fan(const char *buffer, unsigned long count)
 {
        int value;
        u32 hci_result;
 
        if (sscanf(buffer, " force_on : %i", &value) == 1 &&
-                       value >= 0 && value <= 1) {
+           value >= 0 && value <= 1) {
                hci_write1(HCI_FAN, value, &hci_result);
                if (hci_result != HCI_SUCCESS)
                        return -EFAULT;
@@ -423,8 +411,7 @@ write_fan(const char* buffer, unsigned long count)
        return count;
 }
 
-static char*
-read_keys(char* p)
+static char *read_keys(char *p)
 {
        u32 hci_result;
        u32 value;
@@ -451,17 +438,15 @@ read_keys(char* p)
        p += sprintf(p, "hotkey_ready:            %d\n", key_event_valid);
        p += sprintf(p, "hotkey:                  0x%04x\n", last_key_event);
 
-end:
+      end:
        return p;
 }
 
-static unsigned long
-write_keys(const char* buffer, unsigned long count)
+static unsigned long write_keys(const char *buffer, unsigned long count)
 {
        int value;
 
-       if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 &&
-                       value == 0) {
+       if (sscanf(buffer, " hotkey_ready : %i", &value) == 1 && value == 0) {
                key_event_valid = 0;
        } else {
                return -EINVAL;
@@ -470,12 +455,11 @@ write_keys(const char* buffer, unsigned long count)
        return count;
 }
 
-static char*
-read_version(char* p)
+static char *read_version(char *p)
 {
        p += sprintf(p, "driver:                  %s\n", TOSHIBA_ACPI_VERSION);
        p += sprintf(p, "proc_interface:          %d\n",
-               PROC_INTERFACE_VERSION);
+                    PROC_INTERFACE_VERSION);
        return p;
 }
 
@@ -484,48 +468,45 @@ read_version(char* p)
 
 #define PROC_TOSHIBA           "toshiba"
 
-static ProcItem proc_items[] =
-{
-       { "lcd"         , read_lcd      , write_lcd     },
-       { "video"       , read_video    , write_video   },
-       { "fan"         , read_fan      , write_fan     },
-       { "keys"        , read_keys     , write_keys    },
-       { "version"     , read_version  , NULL          },
-       { NULL }
+static ProcItem proc_items[] = {
+       {"lcd", read_lcd, write_lcd},
+       {"video", read_video, write_video},
+       {"fan", read_fan, write_fan},
+       {"keys", read_keys, write_keys},
+       {"version", read_version, NULL},
+       {NULL}
 };
 
-static acpi_status __init
-add_device(void)
+static acpi_status __init add_device(void)
 {
-       struct proc_dir_entryproc;
-       ProcItemitem;
+       struct proc_dir_entry *proc;
+       ProcItem *item;
 
-       for (item = proc_items; item->name; ++item)
-       {
+       for (item = proc_items; item->name; ++item) {
                proc = create_proc_read_entry(item->name,
-                       S_IFREG | S_IRUGO | S_IWUSR,
-                       toshiba_proc_dir, (read_proc_t*)dispatch_read, item);
+                                             S_IFREG | S_IRUGO | S_IWUSR,
+                                             toshiba_proc_dir,
+                                             (read_proc_t *) dispatch_read,
+                                             item);
                if (proc)
                        proc->owner = THIS_MODULE;
                if (proc && item->write_func)
-                       proc->write_proc = (write_proc_t*)dispatch_write;
+                       proc->write_proc = (write_proc_t *) dispatch_write;
        }
 
        return AE_OK;
 }
 
-static acpi_status __exit
-remove_device(void)
+static acpi_status __exit remove_device(void)
 {
-       ProcItemitem;
+       ProcItem *item;
 
        for (item = proc_items; item->name; ++item)
                remove_proc_entry(item->name, toshiba_proc_dir);
        return AE_OK;
 }
 
-static int __init
-toshiba_acpi_init(void)
+static int __init toshiba_acpi_init(void)
 {
        acpi_status status = AE_OK;
        u32 hci_result;
@@ -533,9 +514,9 @@ toshiba_acpi_init(void)
        if (acpi_disabled)
                return -ENODEV;
 
-       if (!acpi_specific_hotkey_enabled){
+       if (!acpi_specific_hotkey_enabled) {
                printk(MY_INFO "Using generic hotkey driver\n");
-               return -ENODEV; 
+               return -ENODEV;
        }
        /* simple device detection: look for HCI method */
        if (is_valid_acpi_path(METHOD_HCI_1))
@@ -546,7 +527,7 @@ toshiba_acpi_init(void)
                return -ENODEV;
 
        printk(MY_INFO "Toshiba Laptop ACPI Extras version %s\n",
-               TOSHIBA_ACPI_VERSION);
+              TOSHIBA_ACPI_VERSION);
        printk(MY_INFO "    HCI method: %s\n", method_hci);
 
        force_fan = 0;
@@ -568,8 +549,7 @@ toshiba_acpi_init(void)
        return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
 }
 
-static void __exit
-toshiba_acpi_exit(void)
+static void __exit toshiba_acpi_exit(void)
 {
        remove_device();
 
index 939c447dd52a9d8f4f8842d481f67e98c99f9c40..e87108b7338ade83486c66bf142a90a487b5f825 100644 (file)
@@ -3,6 +3,6 @@
 #
 
 obj-y := utalloc.o  utdebug.o   uteval.o    utinit.o  utmisc.o    utxface.o \
-        utcopy.o   utdelete.o  utglobal.o  utmath.o  utobject.o
+        utcopy.o   utdelete.o  utglobal.o  utmath.o  utobject.o utstate.o utmutex.o utobject.o utcache.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
index c4e7f989a2bdce3762faa502d4f5887bf492d9d4..068450b36475a8b9b3552594bfcfbbf1409f87b0 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Module Name: utalloc - local cache and memory allocation routines
+ * Module Name: utalloc - local memory allocation routines
  *
  *****************************************************************************/
 
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utalloc")
+ACPI_MODULE_NAME("utalloc")
 
 /* Local prototypes */
-
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
-static struct acpi_debug_mem_block *
-acpi_ut_find_allocation (
-       u32                             list_id,
-       void                            *allocation);
+static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
 
 static acpi_status
-acpi_ut_track_allocation (
-       u32                             list_id,
-       struct acpi_debug_mem_block     *address,
-       acpi_size                       size,
-       u8                              alloc_type,
-       u32                             component,
-       char                            *module,
-       u32                             line);
+acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
+                        acpi_size size,
+                        u8 alloc_type, u32 component, char *module, u32 line);
 
 static acpi_status
-acpi_ut_remove_allocation (
-       u32                             list_id,
-       struct acpi_debug_mem_block     *address,
-       u32                             component,
-       char                            *module,
-       u32                             line);
-#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
+                         u32 component, char *module, u32 line);
+#endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+static acpi_status
+acpi_ut_create_list(char *list_name,
+                   u16 object_size, struct acpi_memory_list **return_cache);
+#endif
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_release_to_cache
+ * FUNCTION:    acpi_ut_create_caches
  *
- * PARAMETERS:  list_id             - Memory list/cache ID
- *              Object              - The object to be released
+ * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Release an object to the specified cache.  If cache is full,
- *              the object is deleted.
+ * DESCRIPTION: Create all local caches
  *
  ******************************************************************************/
 
-void
-acpi_ut_release_to_cache (
-       u32                             list_id,
-       void                            *object)
+acpi_status acpi_ut_create_caches(void)
 {
-       struct acpi_memory_list         *cache_info;
-
+       acpi_status status;
 
-       ACPI_FUNCTION_ENTRY ();
-
-
-       cache_info = &acpi_gbl_memory_lists[list_id];
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
-       /* If walk cache is full, just free this wallkstate object */
+       /* Memory allocation lists */
 
-       if (cache_info->cache_depth >= cache_info->max_cache_depth) {
-               ACPI_MEM_FREE (object);
-               ACPI_MEM_TRACKING (cache_info->total_freed++);
+       status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-       /* Otherwise put this object back into the cache */
-
-       else {
-               if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
-                       return;
-               }
-
-               /* Mark the object as cached */
-
-               ACPI_MEMSET (object, 0xCA, cache_info->object_size);
-               ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED);
-
-               /* Put the object at the head of the cache list */
-
-               * (ACPI_CAST_INDIRECT_PTR (char,
-                       &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
-               cache_info->list_head = object;
-               cache_info->cache_depth++;
-
-               (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
+       status =
+           acpi_ut_create_list("Acpi-Namespace",
+                               sizeof(struct acpi_namespace_node),
+                               &acpi_gbl_ns_node_list);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
-
-#else
-
-       /* Object cache is disabled; just free the object */
-
-       ACPI_MEM_FREE (object);
-       ACPI_MEM_TRACKING (cache_info->total_freed++);
 #endif
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_acquire_from_cache
- *
- * PARAMETERS:  list_id             - Memory list ID
- *
- * RETURN:      A requested object.  NULL if the object could not be
- *              allocated.
- *
- * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
- *              the object is allocated.
- *
- ******************************************************************************/
-
-void *
-acpi_ut_acquire_from_cache (
-       u32                             list_id)
-{
-       struct acpi_memory_list         *cache_info;
-       void                            *object;
 
+       /* Object Caches, for frequently used objects */
 
-       ACPI_FUNCTION_NAME ("ut_acquire_from_cache");
-
-
-       cache_info = &acpi_gbl_memory_lists[list_id];
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-
-       if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) {
-               return (NULL);
+       status =
+           acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state),
+                                ACPI_MAX_STATE_CACHE_DEPTH,
+                                &acpi_gbl_state_cache);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-       ACPI_MEM_TRACKING (cache_info->cache_requests++);
-
-       /* Check the cache first */
-
-       if (cache_info->list_head) {
-               /* There is an object available, use it */
-
-               object = cache_info->list_head;
-               cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) object)[cache_info->link_offset])));
-
-               ACPI_MEM_TRACKING (cache_info->cache_hits++);
-               cache_info->cache_depth--;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
-                       object, acpi_gbl_memory_lists[list_id].list_name));
-#endif
-
-               if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
-                       return (NULL);
-               }
-
-               /* Clear (zero) the previously used Object */
-
-               ACPI_MEMSET (object, 0, cache_info->object_size);
+       status =
+           acpi_os_create_cache("acpi_parse",
+                                sizeof(struct acpi_parse_obj_common),
+                                ACPI_MAX_PARSE_CACHE_DEPTH,
+                                &acpi_gbl_ps_node_cache);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-       else {
-               /* The cache is empty, create a new object */
-
-               /* Avoid deadlock with ACPI_MEM_CALLOCATE */
-
-               if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) {
-                       return (NULL);
-               }
-
-               object = ACPI_MEM_CALLOCATE (cache_info->object_size);
-               ACPI_MEM_TRACKING (cache_info->total_allocated++);
+       status =
+           acpi_os_create_cache("acpi_parse_ext",
+                                sizeof(struct acpi_parse_obj_named),
+                                ACPI_MAX_EXTPARSE_CACHE_DEPTH,
+                                &acpi_gbl_ps_node_ext_cache);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-#else
-
-       /* Object cache is disabled; just allocate the object */
-
-       object = ACPI_MEM_CALLOCATE (cache_info->object_size);
-       ACPI_MEM_TRACKING (cache_info->total_allocated++);
-#endif
+       status =
+           acpi_os_create_cache("acpi_operand",
+                                sizeof(union acpi_operand_object),
+                                ACPI_MAX_OBJECT_CACHE_DEPTH,
+                                &acpi_gbl_operand_cache);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
 
-       return (object);
+       return (AE_OK);
 }
 
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ut_delete_generic_cache
+ * FUNCTION:    acpi_ut_delete_caches
  *
- * PARAMETERS:  list_id         - Memory list ID
+ * PARAMETERS:  None
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Free all objects within the requested cache.
+ * DESCRIPTION: Purge and delete all local caches
  *
  ******************************************************************************/
 
-void
-acpi_ut_delete_generic_cache (
-       u32                             list_id)
+acpi_status acpi_ut_delete_caches(void)
 {
-       struct acpi_memory_list         *cache_info;
-       char                            *next;
-
 
-       ACPI_FUNCTION_ENTRY ();
+       (void)acpi_os_delete_cache(acpi_gbl_state_cache);
+       acpi_gbl_state_cache = NULL;
 
+       (void)acpi_os_delete_cache(acpi_gbl_operand_cache);
+       acpi_gbl_operand_cache = NULL;
 
-       cache_info = &acpi_gbl_memory_lists[list_id];
-       while (cache_info->list_head) {
-               /* Delete one cached state object */
+       (void)acpi_os_delete_cache(acpi_gbl_ps_node_cache);
+       acpi_gbl_ps_node_cache = NULL;
 
-               next = *(ACPI_CAST_INDIRECT_PTR (char,
-                                &(((char *) cache_info->list_head)[cache_info->link_offset])));
-               ACPI_MEM_FREE (cache_info->list_head);
+       (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache);
+       acpi_gbl_ps_node_ext_cache = NULL;
 
-               cache_info->list_head = next;
-               cache_info->cache_depth--;
-       }
+       return (AE_OK);
 }
-#endif
-
 
 /*******************************************************************************
  *
@@ -280,9 +182,7 @@ acpi_ut_delete_generic_cache (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ut_validate_buffer (
-       struct acpi_buffer              *buffer)
+acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
 {
 
        /* Obviously, the structure pointer must be valid */
@@ -293,9 +193,9 @@ acpi_ut_validate_buffer (
 
        /* Special semantics for the length */
 
-       if ((buffer->length == ACPI_NO_BUFFER)              ||
-               (buffer->length == ACPI_ALLOCATE_BUFFER)        ||
-               (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) {
+       if ((buffer->length == ACPI_NO_BUFFER) ||
+           (buffer->length == ACPI_ALLOCATE_BUFFER) ||
+           (buffer->length == ACPI_ALLOCATE_LOCAL_BUFFER)) {
                return (AE_OK);
        }
 
@@ -308,7 +208,6 @@ acpi_ut_validate_buffer (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_initialize_buffer
@@ -324,12 +223,10 @@ acpi_ut_validate_buffer (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_initialize_buffer (
-       struct acpi_buffer              *buffer,
-       acpi_size                       required_length)
+acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
+                         acpi_size required_length)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
        switch (buffer->length) {
        case ACPI_NO_BUFFER:
@@ -339,33 +236,30 @@ acpi_ut_initialize_buffer (
                status = AE_BUFFER_OVERFLOW;
                break;
 
-
        case ACPI_ALLOCATE_BUFFER:
 
                /* Allocate a new buffer */
 
-               buffer->pointer = acpi_os_allocate (required_length);
+               buffer->pointer = acpi_os_allocate(required_length);
                if (!buffer->pointer) {
                        return (AE_NO_MEMORY);
                }
 
                /* Clear the buffer */
 
-               ACPI_MEMSET (buffer->pointer, 0, required_length);
+               ACPI_MEMSET(buffer->pointer, 0, required_length);
                break;
 
-
        case ACPI_ALLOCATE_LOCAL_BUFFER:
 
                /* Allocate a new buffer with local interface to allow tracking */
 
-               buffer->pointer = ACPI_MEM_CALLOCATE (required_length);
+               buffer->pointer = ACPI_MEM_CALLOCATE(required_length);
                if (!buffer->pointer) {
                        return (AE_NO_MEMORY);
                }
                break;
 
-
        default:
 
                /* Existing buffer: Validate the size of the buffer */
@@ -377,7 +271,7 @@ acpi_ut_initialize_buffer (
 
                /* Clear the buffer */
 
-               ACPI_MEMSET (buffer->pointer, 0, required_length);
+               ACPI_MEMSET(buffer->pointer, 0, required_length);
                break;
        }
 
@@ -385,7 +279,6 @@ acpi_ut_initialize_buffer (
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_allocate
@@ -401,41 +294,34 @@ acpi_ut_initialize_buffer (
  *
  ******************************************************************************/
 
-void *
-acpi_ut_allocate (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
 {
-       void                            *allocation;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_allocate", size);
+       void *allocation;
 
+       ACPI_FUNCTION_TRACE_U32("ut_allocate", size);
 
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR (module, line, component,
-                               ("ut_allocate: Attempt to allocate zero bytes\n"));
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_allocate: Attempt to allocate zero bytes\n"));
                size = 1;
        }
 
-       allocation = acpi_os_allocate (size);
+       allocation = acpi_os_allocate(size);
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR (module, line, component,
-                               ("ut_allocate: Could not allocate size %X\n", (u32) size));
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_allocate: Could not allocate size %X\n",
+                                   (u32) size));
 
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
-       return_PTR (allocation);
+       return_PTR(allocation);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_callocate
@@ -451,43 +337,36 @@ acpi_ut_allocate (
  *
  ******************************************************************************/
 
-void *
-acpi_ut_callocate (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
 {
-       void                            *allocation;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_callocate", size);
+       void *allocation;
 
+       ACPI_FUNCTION_TRACE_U32("ut_callocate", size);
 
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR (module, line, component,
-                               ("ut_callocate: Attempt to allocate zero bytes\n"));
-               return_PTR (NULL);
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_callocate: Attempt to allocate zero bytes\n"));
+               return_PTR(NULL);
        }
 
-       allocation = acpi_os_allocate (size);
+       allocation = acpi_os_allocate(size);
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR (module, line, component,
-                               ("ut_callocate: Could not allocate size %X\n", (u32) size));
-               return_PTR (NULL);
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_callocate: Could not allocate size %X\n",
+                                   (u32) size));
+               return_PTR(NULL);
        }
 
        /* Clear the memory block */
 
-       ACPI_MEMSET (allocation, 0, size);
-       return_PTR (allocation);
+       ACPI_MEMSET(allocation, 0, size);
+       return_PTR(allocation);
 }
 
-
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 /*
  * These procedures are used for tracking memory leaks in the subsystem, and
@@ -500,6 +379,39 @@ acpi_ut_callocate (
  * occurs in the body of acpi_ut_free.
  */
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_list
+ *
+ * PARAMETERS:  cache_name      - Ascii name for the cache
+ *              object_size     - Size of each cached object
+ *              return_cache    - Where the new cache object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a local memory list for tracking purposed
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ut_create_list(char *list_name,
+                   u16 object_size, struct acpi_memory_list **return_cache)
+{
+       struct acpi_memory_list *cache;
+
+       cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
+       if (!cache) {
+               return (AE_NO_MEMORY);
+       }
+
+       ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+
+       cache->list_name = list_name;
+       cache->object_size = object_size;
+
+       *return_cache = cache;
+       return (AE_OK);
+}
 
 /*******************************************************************************
  *
@@ -516,37 +428,33 @@ acpi_ut_callocate (
  *
  ******************************************************************************/
 
-void *
-acpi_ut_allocate_and_track (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+void *acpi_ut_allocate_and_track(acpi_size size,
+                                u32 component, char *module, u32 line)
 {
-       struct acpi_debug_mem_block     *allocation;
-       acpi_status                     status;
-
+       struct acpi_debug_mem_block *allocation;
+       acpi_status status;
 
-       allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header),
-                         component, module, line);
+       allocation =
+           acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
+                            component, module, line);
        if (!allocation) {
                return (NULL);
        }
 
-       status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
-                         ACPI_MEM_MALLOC, component, module, line);
-       if (ACPI_FAILURE (status)) {
-               acpi_os_free (allocation);
+       status = acpi_ut_track_allocation(allocation, size,
+                                         ACPI_MEM_MALLOC, component, module,
+                                         line);
+       if (ACPI_FAILURE(status)) {
+               acpi_os_free(allocation);
                return (NULL);
        }
 
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size;
+       acpi_gbl_global_list->total_allocated++;
+       acpi_gbl_global_list->current_total_size += (u32) size;
 
-       return ((void *) &allocation->user_space);
+       return ((void *)&allocation->user_space);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_callocate_and_track
@@ -562,41 +470,38 @@ acpi_ut_allocate_and_track (
  *
  ******************************************************************************/
 
-void *
-acpi_ut_callocate_and_track (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+void *acpi_ut_callocate_and_track(acpi_size size,
+                                 u32 component, char *module, u32 line)
 {
-       struct acpi_debug_mem_block     *allocation;
-       acpi_status                     status;
-
+       struct acpi_debug_mem_block *allocation;
+       acpi_status status;
 
-       allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header),
-                         component, module, line);
+       allocation =
+           acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
+                             component, module, line);
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR (module, line, component,
-                               ("ut_callocate: Could not allocate size %X\n", (u32) size));
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_callocate: Could not allocate size %X\n",
+                                   (u32) size));
                return (NULL);
        }
 
-       status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size,
-                          ACPI_MEM_CALLOC, component, module, line);
-       if (ACPI_FAILURE (status)) {
-               acpi_os_free (allocation);
+       status = acpi_ut_track_allocation(allocation, size,
+                                         ACPI_MEM_CALLOC, component, module,
+                                         line);
+       if (ACPI_FAILURE(status)) {
+               acpi_os_free(allocation);
                return (NULL);
        }
 
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size;
+       acpi_gbl_global_list->total_allocated++;
+       acpi_gbl_global_list->current_total_size += (u32) size;
 
-       return ((void *) &allocation->user_space);
+       return ((void *)&allocation->user_space);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_free_and_track
@@ -613,53 +518,46 @@ acpi_ut_callocate_and_track (
  ******************************************************************************/
 
 void
-acpi_ut_free_and_track (
-       void                            *allocation,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
 {
-       struct acpi_debug_mem_block     *debug_block;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_free", allocation);
+       struct acpi_debug_mem_block *debug_block;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
 
        if (NULL == allocation) {
-               _ACPI_REPORT_ERROR (module, line, component,
-                       ("acpi_ut_free: Attempt to delete a NULL address\n"));
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("acpi_ut_free: Attempt to delete a NULL address\n"));
 
                return_VOID;
        }
 
-       debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block,
-                         (((char *) allocation) - sizeof (struct acpi_debug_mem_header)));
+       debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
+                                   (((char *)allocation) -
+                                    sizeof(struct acpi_debug_mem_header)));
 
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size;
+       acpi_gbl_global_list->total_freed++;
+       acpi_gbl_global_list->current_total_size -= debug_block->size;
 
-       status = acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block,
-                         component, module, line);
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
-                       acpi_format_exception (status)));
+       status = acpi_ut_remove_allocation(debug_block,
+                                          component, module, line);
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n",
+                                 acpi_format_exception(status)));
        }
 
-       acpi_os_free (debug_block);
+       acpi_os_free(debug_block);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_find_allocation
  *
- * PARAMETERS:  list_id                 - Memory list to search
- *              Allocation              - Address of allocated memory
+ * PARAMETERS:  Allocation              - Address of allocated memory
  *
  * RETURN:      A list element if found; NULL otherwise.
  *
@@ -667,22 +565,13 @@ acpi_ut_free_and_track (
  *
  ******************************************************************************/
 
-static struct acpi_debug_mem_block *
-acpi_ut_find_allocation (
-       u32                             list_id,
-       void                            *allocation)
+static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation)
 {
-       struct acpi_debug_mem_block     *element;
-
+       struct acpi_debug_mem_block *element;
 
-       ACPI_FUNCTION_ENTRY ();
-
-
-       if (list_id > ACPI_MEM_LIST_MAX) {
-               return (NULL);
-       }
+       ACPI_FUNCTION_ENTRY();
 
-       element = acpi_gbl_memory_lists[list_id].list_head;
+       element = acpi_gbl_global_list->list_head;
 
        /* Search for the address. */
 
@@ -697,13 +586,11 @@ acpi_ut_find_allocation (
        return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_track_allocation
  *
- * PARAMETERS:  list_id             - Memory list to search
- *              Allocation          - Address of allocated memory
+ * PARAMETERS:  Allocation          - Address of allocated memory
  *              Size                - Size of the allocation
  *              alloc_type          - MEM_MALLOC or MEM_CALLOC
  *              Component           - Component type of caller
@@ -717,64 +604,51 @@ acpi_ut_find_allocation (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_track_allocation (
-       u32                             list_id,
-       struct acpi_debug_mem_block     *allocation,
-       acpi_size                       size,
-       u8                              alloc_type,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
+                        acpi_size size,
+                        u8 alloc_type, u32 component, char *module, u32 line)
 {
-       struct acpi_memory_list         *mem_list;
-       struct acpi_debug_mem_block     *element;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation);
+       struct acpi_memory_list *mem_list;
+       struct acpi_debug_mem_block *element;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation);
 
-       if (list_id > ACPI_MEM_LIST_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       mem_list = &acpi_gbl_memory_lists[list_id];
-       status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       mem_list = acpi_gbl_global_list;
+       status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Search list for this address to make sure it is not already on the list.
         * This will catch several kinds of problems.
         */
-
-       element = acpi_ut_find_allocation (list_id, allocation);
+       element = acpi_ut_find_allocation(allocation);
        if (element) {
-               ACPI_REPORT_ERROR ((
-                       "ut_track_allocation: Allocation already present in list! (%p)\n",
-                       allocation));
+               ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation));
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n",
-                       element, allocation));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n",
+                                 element, allocation));
 
                goto unlock_and_exit;
        }
 
        /* Fill in the instance data. */
 
-       allocation->size      = (u32) size;
+       allocation->size = (u32) size;
        allocation->alloc_type = alloc_type;
        allocation->component = component;
-       allocation->line      = line;
+       allocation->line = line;
 
-       ACPI_STRNCPY (allocation->module, module, ACPI_MAX_MODULE_NAME);
-       allocation->module[ACPI_MAX_MODULE_NAME-1] = 0;
+       ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
+       allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
 
        /* Insert at list head */
 
        if (mem_list->list_head) {
-               ((struct acpi_debug_mem_block *)(mem_list->list_head))->previous = allocation;
+               ((struct acpi_debug_mem_block *)(mem_list->list_head))->
+                   previous = allocation;
        }
 
        allocation->next = mem_list->list_head;
@@ -782,19 +656,16 @@ acpi_ut_track_allocation (
 
        mem_list->list_head = allocation;
 
-
-unlock_and_exit:
-       status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
-       return_ACPI_STATUS (status);
+      unlock_and_exit:
+       status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_remove_allocation
  *
- * PARAMETERS:  list_id             - Memory list to search
- *              Allocation          - Address of allocated memory
+ * PARAMETERS:  Allocation          - Address of allocated memory
  *              Component           - Component type of caller
  *              Module              - Source file name of caller
  *              Line                - Line number of caller
@@ -806,45 +677,34 @@ unlock_and_exit:
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_remove_allocation (
-       u32                             list_id,
-       struct acpi_debug_mem_block     *allocation,
-       u32                             component,
-       char                            *module,
-       u32                             line)
+acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
+                         u32 component, char *module, u32 line)
 {
-       struct acpi_memory_list         *mem_list;
-       acpi_status                     status;
-
+       struct acpi_memory_list *mem_list;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ut_remove_allocation");
+       ACPI_FUNCTION_TRACE("ut_remove_allocation");
 
-
-       if (list_id > ACPI_MEM_LIST_MAX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       mem_list = &acpi_gbl_memory_lists[list_id];
+       mem_list = acpi_gbl_global_list;
        if (NULL == mem_list->list_head) {
                /* No allocations! */
 
-               _ACPI_REPORT_ERROR (module, line, component,
-                       ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
+               _ACPI_REPORT_ERROR(module, line, component,
+                                  ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
-       status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Unlink */
 
        if (allocation->previous) {
                (allocation->previous)->next = allocation->next;
-       }
-       else {
+       } else {
                mem_list->list_head = allocation->next;
        }
 
@@ -854,16 +714,15 @@ acpi_ut_remove_allocation (
 
        /* Mark the segment as deleted */
 
-       ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
+       ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
-               allocation->size));
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
+                         allocation->size));
 
-       status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
-       return_ACPI_STATUS (status);
+       status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_dump_allocation_info
@@ -877,15 +736,13 @@ acpi_ut_remove_allocation (
  ******************************************************************************/
 
 #ifdef ACPI_FUTURE_USAGE
-void
-acpi_ut_dump_allocation_info (
-       void)
+void acpi_ut_dump_allocation_info(void)
 {
 /*
        struct acpi_memory_list         *mem_list;
 */
 
-       ACPI_FUNCTION_TRACE ("ut_dump_allocation_info");
+       ACPI_FUNCTION_TRACE("ut_dump_allocation_info");
 
 /*
        ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
@@ -898,7 +755,6 @@ acpi_ut_dump_allocation_info (
                          mem_list->max_concurrent_count,
                          ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
 
-
        ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
                          ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
                          running_object_count,
@@ -909,7 +765,6 @@ acpi_ut_dump_allocation_info (
                          running_alloc_count,
                          ROUND_UP_TO_1K (running_alloc_size)));
 
-
        ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
                          ("%30s: %4d (%3d Kb)\n", "Current Nodes",
                          acpi_gbl_current_node_count,
@@ -923,8 +778,7 @@ acpi_ut_dump_allocation_info (
 */
        return_VOID;
 }
-#endif  /*  ACPI_FUTURE_USAGE  */
-
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*******************************************************************************
  *
@@ -939,84 +793,87 @@ acpi_ut_dump_allocation_info (
  *
  ******************************************************************************/
 
-void
-acpi_ut_dump_allocations (
-       u32                             component,
-       char                            *module)
+void acpi_ut_dump_allocations(u32 component, char *module)
 {
-       struct acpi_debug_mem_block     *element;
-       union acpi_descriptor           *descriptor;
-       u32                             num_outstanding = 0;
-
-
-       ACPI_FUNCTION_TRACE ("ut_dump_allocations");
+       struct acpi_debug_mem_block *element;
+       union acpi_descriptor *descriptor;
+       u32 num_outstanding = 0;
 
+       ACPI_FUNCTION_TRACE("ut_dump_allocations");
 
        /*
         * Walk the allocation list.
         */
-       if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_MEMORY))) {
+       if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
                return;
        }
 
-       element = acpi_gbl_memory_lists[0].list_head;
+       element = acpi_gbl_global_list->list_head;
        while (element) {
                if ((element->component & component) &&
-                       ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) {
+                   ((module == NULL)
+                    || (0 == ACPI_STRCMP(module, element->module)))) {
                        /* Ignore allocated objects that are in a cache */
 
-                       descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space);
+                       descriptor =
+                           ACPI_CAST_PTR(union acpi_descriptor,
+                                         &element->user_space);
                        if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
-                               acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ",
-                                       descriptor, element->size, element->module,
-                                       element->line, acpi_ut_get_descriptor_name (descriptor));
+                               acpi_os_printf("%p Len %04X %9.9s-%d [%s] ",
+                                              descriptor, element->size,
+                                              element->module, element->line,
+                                              acpi_ut_get_descriptor_name
+                                              (descriptor));
 
                                /* Most of the elements will be Operand objects. */
 
-                               switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) {
+                               switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) {
                                case ACPI_DESC_TYPE_OPERAND:
-                                       acpi_os_printf ("%12.12s R%hd",
-                                               acpi_ut_get_type_name (descriptor->object.common.type),
-                                               descriptor->object.common.reference_count);
+                                       acpi_os_printf("%12.12s R%hd",
+                                                      acpi_ut_get_type_name
+                                                      (descriptor->object.
+                                                       common.type),
+                                                      descriptor->object.
+                                                      common.reference_count);
                                        break;
 
                                case ACPI_DESC_TYPE_PARSER:
-                                       acpi_os_printf ("aml_opcode %04hX",
-                                               descriptor->op.asl.aml_opcode);
+                                       acpi_os_printf("aml_opcode %04hX",
+                                                      descriptor->op.asl.
+                                                      aml_opcode);
                                        break;
 
                                case ACPI_DESC_TYPE_NAMED:
-                                       acpi_os_printf ("%4.4s",
-                                               acpi_ut_get_node_name (&descriptor->node));
+                                       acpi_os_printf("%4.4s",
+                                                      acpi_ut_get_node_name
+                                                      (&descriptor->node));
                                        break;
 
                                default:
                                        break;
                                }
 
-                               acpi_os_printf ( "\n");
+                               acpi_os_printf("\n");
                                num_outstanding++;
                        }
                }
                element = element->next;
        }
 
-       (void) acpi_ut_release_mutex (ACPI_MTX_MEMORY);
+       (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
 
        /* Print summary */
 
        if (!num_outstanding) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "No outstanding allocations.\n"));
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "%d(%X) Outstanding allocations\n",
-                       num_outstanding, num_outstanding));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No outstanding allocations.\n"));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%d(%X) Outstanding allocations\n",
+                                 num_outstanding, num_outstanding));
        }
 
        return_VOID;
 }
 
-#endif  /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
-
+#endif                         /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
new file mode 100644 (file)
index 0000000..93d4868
--- /dev/null
@@ -0,0 +1,305 @@
+/******************************************************************************
+ *
+ * Module Name: utcache - local cache allocation routines
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+
+#define _COMPONENT          ACPI_UTILITIES
+ACPI_MODULE_NAME("utcache")
+
+#ifdef ACPI_USE_LOCAL_CACHE
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_create_cache
+ *
+ * PARAMETERS:  cache_name      - Ascii name for the cache
+ *              object_size     - Size of each cached object
+ *              max_depth       - Maximum depth of the cache (in objects)
+ *              return_cache    - Where the new cache object is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a cache object
+ *
+ ******************************************************************************/
+acpi_status
+acpi_os_create_cache(char *cache_name,
+                    u16 object_size,
+                    u16 max_depth, struct acpi_memory_list **return_cache)
+{
+       struct acpi_memory_list *cache;
+
+       ACPI_FUNCTION_ENTRY();
+
+       if (!cache_name || !return_cache || (object_size < 16)) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /* Create the cache object */
+
+       cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
+       if (!cache) {
+               return (AE_NO_MEMORY);
+       }
+
+       /* Populate the cache object and return it */
+
+       ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+       cache->link_offset = 8;
+       cache->list_name = cache_name;
+       cache->object_size = object_size;
+       cache->max_depth = max_depth;
+
+       *return_cache = cache;
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_purge_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
+{
+       char *next;
+
+       ACPI_FUNCTION_ENTRY();
+
+       if (!cache) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /* Walk the list of objects in this cache */
+
+       while (cache->list_head) {
+               /* Delete and unlink one cached state object */
+
+               next = *(ACPI_CAST_INDIRECT_PTR(char,
+                                               &(((char *)cache->
+                                                  list_head)[cache->
+                                                             link_offset])));
+               ACPI_MEM_FREE(cache->list_head);
+
+               cache->list_head = next;
+               cache->current_depth--;
+       }
+
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_delete_cache
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Free all objects within the requested cache and delete the
+ *              cache object.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_ENTRY();
+
+       /* Purge all objects in the cache */
+
+       status = acpi_os_purge_cache(cache);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       /* Now we can delete the cache object */
+
+       acpi_os_free(cache);
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_release_object
+ *
+ * PARAMETERS:  Cache       - Handle to cache object
+ *              Object      - The object to be released
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Release an object to the specified cache.  If cache is full,
+ *              the object is deleted.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_os_release_object(struct acpi_memory_list * cache, void *object)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_ENTRY();
+
+       if (!cache || !object) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /* If cache is full, just free this object */
+
+       if (cache->current_depth >= cache->max_depth) {
+               ACPI_MEM_FREE(object);
+               ACPI_MEM_TRACKING(cache->total_freed++);
+       }
+
+       /* Otherwise put this object back into the cache */
+
+       else {
+               status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+
+               /* Mark the object as cached */
+
+               ACPI_MEMSET(object, 0xCA, cache->object_size);
+               ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
+
+               /* Put the object at the head of the cache list */
+
+               *(ACPI_CAST_INDIRECT_PTR(char,
+                                        &(((char *)object)[cache->
+                                                           link_offset]))) =
+                   cache->list_head;
+               cache->list_head = object;
+               cache->current_depth++;
+
+               (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
+       }
+
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_os_acquire_object
+ *
+ * PARAMETERS:  Cache           - Handle to cache object
+ *
+ * RETURN:      the acquired object.  NULL on error
+ *
+ * DESCRIPTION: Get an object from the specified cache.  If cache is empty,
+ *              the object is allocated.
+ *
+ ******************************************************************************/
+
+void *acpi_os_acquire_object(struct acpi_memory_list *cache)
+{
+       acpi_status status;
+       void *object;
+
+       ACPI_FUNCTION_NAME("os_acquire_object");
+
+       if (!cache) {
+               return (NULL);
+       }
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
+       if (ACPI_FAILURE(status)) {
+               return (NULL);
+       }
+
+       ACPI_MEM_TRACKING(cache->requests++);
+
+       /* Check the cache first */
+
+       if (cache->list_head) {
+               /* There is an object available, use it */
+
+               object = cache->list_head;
+               cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char,
+                                                           &(((char *)
+                                                              object)[cache->
+                                                                      link_offset])));
+
+               cache->current_depth--;
+
+               ACPI_MEM_TRACKING(cache->hits++);
+               ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                   "Object %p from %s cache\n",
+                                                   object, cache->list_name)));
+
+               status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
+               if (ACPI_FAILURE(status)) {
+                       return (NULL);
+               }
+
+               /* Clear (zero) the previously used Object */
+
+               ACPI_MEMSET(object, 0, cache->object_size);
+       } else {
+               /* The cache is empty, create a new object */
+
+               ACPI_MEM_TRACKING(cache->total_allocated++);
+
+               /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+
+               status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
+               if (ACPI_FAILURE(status)) {
+                       return (NULL);
+               }
+
+               object = ACPI_MEM_CALLOCATE(cache->object_size);
+               if (!object) {
+                       return (NULL);
+               }
+       }
+
+       return (object);
+}
+#endif                         /* ACPI_USE_LOCAL_CACHE */
index 11e88495716255ab203daf17c72e29b9d96a40b4..5442b32de61156a70a852e7a31d67360746d6b57 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utcopy")
+ACPI_MODULE_NAME("utcopy")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ut_copy_isimple_to_esimple (
-       union acpi_operand_object       *internal_object,
-       union acpi_object               *external_object,
-       u8                              *data_space,
-       acpi_size                       *buffer_space_used);
+acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
+                               union acpi_object *external_object,
+                               u8 * data_space, acpi_size * buffer_space_used);
 
 static acpi_status
-acpi_ut_copy_ielement_to_ielement (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context);
+acpi_ut_copy_ielement_to_ielement(u8 object_type,
+                                 union acpi_operand_object *source_object,
+                                 union acpi_generic_state *state,
+                                 void *context);
 
 static acpi_status
-acpi_ut_copy_ipackage_to_epackage (
-       union acpi_operand_object       *internal_object,
-       u8                              *buffer,
-       acpi_size                       *space_used);
+acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
+                                 u8 * buffer, acpi_size * space_used);
 
 static acpi_status
-acpi_ut_copy_esimple_to_isimple(
-       union acpi_object               *user_obj,
-       union acpi_operand_object       **return_obj);
+acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
+                               union acpi_operand_object **return_obj);
 
 static acpi_status
-acpi_ut_copy_simple_object (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc);
+acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
+                          union acpi_operand_object *dest_desc);
 
 static acpi_status
-acpi_ut_copy_ielement_to_eelement (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context);
+acpi_ut_copy_ielement_to_eelement(u8 object_type,
+                                 union acpi_operand_object *source_object,
+                                 union acpi_generic_state *state,
+                                 void *context);
 
 static acpi_status
-acpi_ut_copy_ipackage_to_ipackage (
-       union acpi_operand_object       *source_obj,
-       union acpi_operand_object       *dest_obj,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
+                                 union acpi_operand_object *dest_obj,
+                                 struct acpi_walk_state *walk_state);
 
 /*******************************************************************************
  *
@@ -116,17 +103,13 @@ acpi_ut_copy_ipackage_to_ipackage (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_isimple_to_esimple (
-       union acpi_operand_object       *internal_object,
-       union acpi_object               *external_object,
-       u8                              *data_space,
-       acpi_size                       *buffer_space_used)
+acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
+                               union acpi_object *external_object,
+                               u8 * data_space, acpi_size * buffer_space_used)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_isimple_to_esimple");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple");
 
        *buffer_space_used = 0;
 
@@ -135,54 +118,54 @@ acpi_ut_copy_isimple_to_esimple (
         * package element)
         */
        if (!internal_object) {
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Always clear the external object */
 
-       ACPI_MEMSET (external_object, 0, sizeof (union acpi_object));
+       ACPI_MEMSET(external_object, 0, sizeof(union acpi_object));
 
        /*
         * In general, the external object will be the same type as
         * the internal object
         */
-       external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
+       external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
 
        /* However, only a limited number of external types are supported */
 
-       switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
+       switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
        case ACPI_TYPE_STRING:
 
-               external_object->string.pointer = (char *) data_space;
+               external_object->string.pointer = (char *)data_space;
                external_object->string.length = internal_object->string.length;
-               *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
-                                  (acpi_size) internal_object->string.length + 1);
-
-               ACPI_MEMCPY ((void *) data_space,
-                       (void *) internal_object->string.pointer,
-                       (acpi_size) internal_object->string.length + 1);
+               *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
+                                                                 internal_object->
+                                                                 string.
+                                                                 length + 1);
+
+               ACPI_MEMCPY((void *)data_space,
+                           (void *)internal_object->string.pointer,
+                           (acpi_size) internal_object->string.length + 1);
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
                external_object->buffer.pointer = data_space;
                external_object->buffer.length = internal_object->buffer.length;
-               *buffer_space_used = ACPI_ROUND_UP_TO_NATIVE_WORD (
-                                  internal_object->string.length);
+               *buffer_space_used =
+                   ACPI_ROUND_UP_TO_NATIVE_WORD(internal_object->string.
+                                                length);
 
-               ACPI_MEMCPY ((void *) data_space,
-                       (void *) internal_object->buffer.pointer,
-                       internal_object->buffer.length);
+               ACPI_MEMCPY((void *)data_space,
+                           (void *)internal_object->buffer.pointer,
+                           internal_object->buffer.length);
                break;
 
-
        case ACPI_TYPE_INTEGER:
 
                external_object->integer.value = internal_object->integer.value;
                break;
 
-
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                /*
@@ -199,41 +182,41 @@ acpi_ut_copy_isimple_to_esimple (
                         * to object containing a handle to an ACPI named object.
                         */
                        external_object->type = ACPI_TYPE_ANY;
-                       external_object->reference.handle = internal_object->reference.node;
+                       external_object->reference.handle =
+                           internal_object->reference.node;
                        break;
                }
                break;
 
-
        case ACPI_TYPE_PROCESSOR:
 
-               external_object->processor.proc_id    = internal_object->processor.proc_id;
-               external_object->processor.pblk_address = internal_object->processor.address;
-               external_object->processor.pblk_length = internal_object->processor.length;
+               external_object->processor.proc_id =
+                   internal_object->processor.proc_id;
+               external_object->processor.pblk_address =
+                   internal_object->processor.address;
+               external_object->processor.pblk_length =
+                   internal_object->processor.length;
                break;
 
-
        case ACPI_TYPE_POWER:
 
                external_object->power_resource.system_level =
-                                  internal_object->power_resource.system_level;
+                   internal_object->power_resource.system_level;
 
                external_object->power_resource.resource_order =
-                                  internal_object->power_resource.resource_order;
+                   internal_object->power_resource.resource_order;
                break;
 
-
        default:
                /*
                 * There is no corresponding external object type
                 */
-               return_ACPI_STATUS (AE_SUPPORT);
+               return_ACPI_STATUS(AE_SUPPORT);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_ielement_to_eelement
@@ -247,25 +230,23 @@ acpi_ut_copy_isimple_to_esimple (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_ielement_to_eelement (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context)
+acpi_ut_copy_ielement_to_eelement(u8 object_type,
+                                 union acpi_operand_object *source_object,
+                                 union acpi_generic_state *state,
+                                 void *context)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_pkg_info            *info = (struct acpi_pkg_info *) context;
-       acpi_size                       object_space;
-       u32                             this_index;
-       union acpi_object               *target_object;
+       acpi_status status = AE_OK;
+       struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
+       acpi_size object_space;
+       u32 this_index;
+       union acpi_object *target_object;
 
+       ACPI_FUNCTION_ENTRY();
 
-       ACPI_FUNCTION_ENTRY ();
-
-
-       this_index   = state->pkg.index;
+       this_index = state->pkg.index;
        target_object = (union acpi_object *)
-               &((union acpi_object *)(state->pkg.dest_object))->package.elements[this_index];
+           &((union acpi_object *)(state->pkg.dest_object))->package.
+           elements[this_index];
 
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
@@ -273,23 +254,24 @@ acpi_ut_copy_ielement_to_eelement (
                /*
                 * This is a simple or null object
                 */
-               status = acpi_ut_copy_isimple_to_esimple (source_object,
-                                 target_object, info->free_space, &object_space);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ut_copy_isimple_to_esimple(source_object,
+                                                        target_object,
+                                                        info->free_space,
+                                                        &object_space);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
                break;
 
-
        case ACPI_COPY_TYPE_PACKAGE:
 
                /*
                 * Build the package object
                 */
-               target_object->type             = ACPI_TYPE_PACKAGE;
-               target_object->package.count    = source_object->package.count;
+               target_object->type = ACPI_TYPE_PACKAGE;
+               target_object->package.count = source_object->package.count;
                target_object->package.elements =
-                       ACPI_CAST_PTR (union acpi_object, info->free_space);
+                   ACPI_CAST_PTR(union acpi_object, info->free_space);
 
                /*
                 * Pass the new package object back to the package walk routine
@@ -300,22 +282,22 @@ acpi_ut_copy_ielement_to_eelement (
                 * Save space for the array of objects (Package elements)
                 * update the buffer length counter
                 */
-               object_space = ACPI_ROUND_UP_TO_NATIVE_WORD (
-                                  (acpi_size) target_object->package.count *
-                                  sizeof (union acpi_object));
+               object_space = ACPI_ROUND_UP_TO_NATIVE_WORD((acpi_size)
+                                                           target_object->
+                                                           package.count *
+                                                           sizeof(union
+                                                                  acpi_object));
                break;
 
-
        default:
                return (AE_BAD_PARAMETER);
        }
 
-       info->free_space  += object_space;
-       info->length      += object_space;
+       info->free_space += object_space;
+       info->length += object_space;
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_ipackage_to_epackage
@@ -336,55 +318,51 @@ acpi_ut_copy_ielement_to_eelement (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_ipackage_to_epackage (
-       union acpi_operand_object       *internal_object,
-       u8                              *buffer,
-       acpi_size                       *space_used)
+acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
+                                 u8 * buffer, acpi_size * space_used)
 {
-       union acpi_object               *external_object;
-       acpi_status                     status;
-       struct acpi_pkg_info            info;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_epackage");
+       union acpi_object *external_object;
+       acpi_status status;
+       struct acpi_pkg_info info;
 
+       ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage");
 
        /*
         * First package at head of the buffer
         */
-       external_object = ACPI_CAST_PTR (union acpi_object, buffer);
+       external_object = ACPI_CAST_PTR(union acpi_object, buffer);
 
        /*
         * Free space begins right after the first package
         */
-       info.length      = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
-       info.free_space  = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (
-                          sizeof (union acpi_object));
+       info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
+       info.free_space =
+           buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
        info.object_space = 0;
        info.num_packages = 1;
 
-       external_object->type            = ACPI_GET_OBJECT_TYPE (internal_object);
-       external_object->package.count   = internal_object->package.count;
-       external_object->package.elements = ACPI_CAST_PTR (union acpi_object,
-                         info.free_space);
+       external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
+       external_object->package.count = internal_object->package.count;
+       external_object->package.elements = ACPI_CAST_PTR(union acpi_object,
+                                                         info.free_space);
 
        /*
         * Leave room for an array of ACPI_OBJECTS in the buffer
         * and move the free space past it
         */
-       info.length    += (acpi_size) external_object->package.count *
-                        ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
+       info.length += (acpi_size) external_object->package.count *
+           ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
        info.free_space += external_object->package.count *
-                        ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object));
+           ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object));
 
-       status = acpi_ut_walk_package_tree (internal_object, external_object,
-                        acpi_ut_copy_ielement_to_eelement, &info);
+       status = acpi_ut_walk_package_tree(internal_object, external_object,
+                                          acpi_ut_copy_ielement_to_eelement,
+                                          &info);
 
        *space_used = info.length;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_iobject_to_eobject
@@ -400,44 +378,45 @@ acpi_ut_copy_ipackage_to_epackage (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_copy_iobject_to_eobject (
-       union acpi_operand_object       *internal_object,
-       struct acpi_buffer              *ret_buffer)
+acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
+                               struct acpi_buffer *ret_buffer)
 {
-       acpi_status                     status;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject");
 
-       ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_eobject");
-
-
-       if (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE) {
+       if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
                /*
                 * Package object:  Copy all subobjects (including
                 * nested packages)
                 */
-               status = acpi_ut_copy_ipackage_to_epackage (internal_object,
-                                 ret_buffer->pointer, &ret_buffer->length);
-       }
-       else {
+               status = acpi_ut_copy_ipackage_to_epackage(internal_object,
+                                                          ret_buffer->pointer,
+                                                          &ret_buffer->length);
+       else {
                /*
                 * Build a simple object (no nested objects)
                 */
-               status = acpi_ut_copy_isimple_to_esimple (internal_object,
-                                (union acpi_object *) ret_buffer->pointer,
-                                ((u8 *) ret_buffer->pointer +
-                                ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object))),
-                                &ret_buffer->length);
+               status = acpi_ut_copy_isimple_to_esimple(internal_object,
+                                                        (union acpi_object *)
+                                                        ret_buffer->pointer,
+                                                        ((u8 *) ret_buffer->
+                                                         pointer +
+                                                         ACPI_ROUND_UP_TO_NATIVE_WORD
+                                                         (sizeof
+                                                          (union
+                                                           acpi_object))),
+                                                        &ret_buffer->length);
                /*
                 * build simple does not include the object size in the length
                 * so we add it in here
                 */
-               ret_buffer->length += sizeof (union acpi_object);
+               ret_buffer->length += sizeof(union acpi_object);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_esimple_to_isimple
@@ -455,15 +434,12 @@ acpi_ut_copy_iobject_to_eobject (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_esimple_to_isimple (
-       union acpi_object               *external_object,
-       union acpi_operand_object       **ret_internal_object)
+acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
+                               union acpi_operand_object **ret_internal_object)
 {
-       union acpi_operand_object       *internal_object;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_esimple_to_isimple");
+       union acpi_operand_object *internal_object;
 
+       ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple");
 
        /*
         * Simple types supported are: String, Buffer, Integer
@@ -473,58 +449,57 @@ acpi_ut_copy_esimple_to_isimple (
        case ACPI_TYPE_BUFFER:
        case ACPI_TYPE_INTEGER:
 
-               internal_object = acpi_ut_create_internal_object (
-                                  (u8) external_object->type);
+               internal_object = acpi_ut_create_internal_object((u8)
+                                                                external_object->
+                                                                type);
                if (!internal_object) {
-                       return_ACPI_STATUS (AE_NO_MEMORY);
+                       return_ACPI_STATUS(AE_NO_MEMORY);
                }
                break;
 
        default:
                /* All other types are not supported */
 
-               return_ACPI_STATUS (AE_SUPPORT);
+               return_ACPI_STATUS(AE_SUPPORT);
        }
 
-
        /* Must COPY string and buffer contents */
 
        switch (external_object->type) {
        case ACPI_TYPE_STRING:
 
                internal_object->string.pointer =
-                       ACPI_MEM_CALLOCATE ((acpi_size) external_object->string.length + 1);
+                   ACPI_MEM_CALLOCATE((acpi_size) external_object->string.
+                                      length + 1);
                if (!internal_object->string.pointer) {
                        goto error_exit;
                }
 
-               ACPI_MEMCPY (internal_object->string.pointer,
-                                 external_object->string.pointer,
-                                 external_object->string.length);
+               ACPI_MEMCPY(internal_object->string.pointer,
+                           external_object->string.pointer,
+                           external_object->string.length);
 
                internal_object->string.length = external_object->string.length;
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
                internal_object->buffer.pointer =
-                       ACPI_MEM_CALLOCATE (external_object->buffer.length);
+                   ACPI_MEM_CALLOCATE(external_object->buffer.length);
                if (!internal_object->buffer.pointer) {
                        goto error_exit;
                }
 
-               ACPI_MEMCPY (internal_object->buffer.pointer,
-                                 external_object->buffer.pointer,
-                                 external_object->buffer.length);
+               ACPI_MEMCPY(internal_object->buffer.pointer,
+                           external_object->buffer.pointer,
+                           external_object->buffer.length);
 
                internal_object->buffer.length = external_object->buffer.length;
                break;
 
-
        case ACPI_TYPE_INTEGER:
 
-               internal_object->integer.value  = external_object->integer.value;
+               internal_object->integer.value = external_object->integer.value;
                break;
 
        default:
@@ -533,15 +508,13 @@ acpi_ut_copy_esimple_to_isimple (
        }
 
        *ret_internal_object = internal_object;
-       return_ACPI_STATUS (AE_OK);
-
+       return_ACPI_STATUS(AE_OK);
 
-error_exit:
-       acpi_ut_remove_reference (internal_object);
-       return_ACPI_STATUS (AE_NO_MEMORY);
+      error_exit:
+       acpi_ut_remove_reference(internal_object);
+       return_ACPI_STATUS(AE_NO_MEMORY);
 }
 
-
 #ifdef ACPI_FUTURE_IMPLEMENTATION
 /* Code to convert packages that are parameters to control methods */
 
@@ -565,22 +538,18 @@ error_exit:
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_epackage_to_ipackage (
-       union acpi_operand_object       *internal_object,
-       u8                              *buffer,
-       u32                             *space_used)
+acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object,
+                                 u8 * buffer, u32 * space_used)
 {
-       u8                              *free_space;
-       union acpi_object               *external_object;
-       u32                             length = 0;
-       u32                             this_index;
-       u32                             object_space = 0;
-       union acpi_operand_object       *this_internal_obj;
-       union acpi_object               *this_external_obj;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_epackage_to_ipackage");
+       u8 *free_space;
+       union acpi_object *external_object;
+       u32 length = 0;
+       u32 this_index;
+       u32 object_space = 0;
+       union acpi_operand_object *this_internal_obj;
+       union acpi_object *this_external_obj;
 
+       ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage");
 
        /*
         * First package at head of the buffer
@@ -592,24 +561,22 @@ acpi_ut_copy_epackage_to_ipackage (
         */
        free_space = buffer + sizeof(union acpi_object);
 
-
-       external_object->type              = ACPI_GET_OBJECT_TYPE (internal_object);
-       external_object->package.count     = internal_object->package.count;
-       external_object->package.elements  = (union acpi_object *)free_space;
+       external_object->type = ACPI_GET_OBJECT_TYPE(internal_object);
+       external_object->package.count = internal_object->package.count;
+       external_object->package.elements = (union acpi_object *)free_space;
 
        /*
         * Build an array of ACPI_OBJECTS in the buffer
         * and move the free space past it
         */
-       free_space += external_object->package.count * sizeof(union acpi_object);
-
+       free_space +=
+           external_object->package.count * sizeof(union acpi_object);
 
        /* Call walk_package */
 
 }
 
-#endif /* Future implementation */
-
+#endif                         /* Future implementation */
 
 /*******************************************************************************
  *
@@ -625,37 +592,35 @@ acpi_ut_copy_epackage_to_ipackage (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_copy_eobject_to_iobject (
-       union acpi_object               *external_object,
-       union acpi_operand_object       **internal_object)
+acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
+                               union acpi_operand_object **internal_object)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_eobject_to_iobject");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject");
 
        if (external_object->type == ACPI_TYPE_PACKAGE) {
                /*
                 * Packages as external input to control methods are not supported,
                 */
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Packages as parameters not implemented!\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Packages as parameters not implemented!\n"));
 
-               return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
+               return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
        }
 
        else {
                /*
                 * Build a simple object (no nested objects)
                 */
-               status = acpi_ut_copy_esimple_to_isimple (external_object, internal_object);
+               status =
+                   acpi_ut_copy_esimple_to_isimple(external_object,
+                                                   internal_object);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_simple_object
@@ -671,83 +636,75 @@ acpi_ut_copy_eobject_to_iobject (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_simple_object (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc)
+acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
+                          union acpi_operand_object *dest_desc)
 {
-       u16                             reference_count;
-       union acpi_operand_object       *next_object;
-
+       u16 reference_count;
+       union acpi_operand_object *next_object;
 
        /* Save fields from destination that we don't want to overwrite */
 
        reference_count = dest_desc->common.reference_count;
        next_object = dest_desc->common.next_object;
 
-       /* Copy the entire source object over the destination object*/
+       /* Copy the entire source object over the destination object */
 
-       ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc,
-                         sizeof (union acpi_operand_object));
+       ACPI_MEMCPY((char *)dest_desc, (char *)source_desc,
+                   sizeof(union acpi_operand_object));
 
        /* Restore the saved fields */
 
        dest_desc->common.reference_count = reference_count;
        dest_desc->common.next_object = next_object;
 
-       /* Handle the objects with extra data */
+       /* New object is not static, regardless of source */
 
-       switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
-       case ACPI_TYPE_BUFFER:
+       dest_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
 
-               dest_desc->buffer.node = NULL;
-               dest_desc->common.flags = source_desc->common.flags;
+       /* Handle the objects with extra data */
 
+       switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
+       case ACPI_TYPE_BUFFER:
                /*
                 * Allocate and copy the actual buffer if and only if:
                 * 1) There is a valid buffer pointer
-                * 2) The buffer is not static (not in an ACPI table) (in this case,
-                *    the actual pointer was already copied above)
+                * 2) The buffer has a length > 0
                 */
                if ((source_desc->buffer.pointer) &&
-                       (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
-                       dest_desc->buffer.pointer = NULL;
-
-                       /* Create an actual buffer only if length > 0 */
-
-                       if (source_desc->buffer.length) {
-                               dest_desc->buffer.pointer =
-                                       ACPI_MEM_ALLOCATE (source_desc->buffer.length);
-                               if (!dest_desc->buffer.pointer) {
-                                       return (AE_NO_MEMORY);
-                               }
+                   (source_desc->buffer.length)) {
+                       dest_desc->buffer.pointer =
+                           ACPI_MEM_ALLOCATE(source_desc->buffer.length);
+                       if (!dest_desc->buffer.pointer) {
+                               return (AE_NO_MEMORY);
+                       }
 
-                               /* Copy the actual buffer data */
+                       /* Copy the actual buffer data */
 
-                               ACPI_MEMCPY (dest_desc->buffer.pointer,
-                                               source_desc->buffer.pointer,
-                                               source_desc->buffer.length);
-                       }
+                       ACPI_MEMCPY(dest_desc->buffer.pointer,
+                                   source_desc->buffer.pointer,
+                                   source_desc->buffer.length);
                }
                break;
 
        case ACPI_TYPE_STRING:
-
                /*
                 * Allocate and copy the actual string if and only if:
                 * 1) There is a valid string pointer
-                * 2) The string is not static (not in an ACPI table) (in this case,
-                *    the actual pointer was already copied above)
+                * (Pointer to a NULL string is allowed)
                 */
-               if ((source_desc->string.pointer) &&
-                       (!(source_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
+               if (source_desc->string.pointer) {
                        dest_desc->string.pointer =
-                               ACPI_MEM_ALLOCATE ((acpi_size) source_desc->string.length + 1);
+                           ACPI_MEM_ALLOCATE((acpi_size) source_desc->string.
+                                             length + 1);
                        if (!dest_desc->string.pointer) {
                                return (AE_NO_MEMORY);
                        }
 
-                       ACPI_MEMCPY (dest_desc->string.pointer, source_desc->string.pointer,
-                                         (acpi_size) source_desc->string.length + 1);
+                       /* Copy the actual string data */
+
+                       ACPI_MEMCPY(dest_desc->string.pointer,
+                                   source_desc->string.pointer,
+                                   (acpi_size) source_desc->string.length + 1);
                }
                break;
 
@@ -756,7 +713,7 @@ acpi_ut_copy_simple_object (
                 * We copied the reference object, so we now must add a reference
                 * to the object pointed to by the reference
                 */
-               acpi_ut_add_reference (source_desc->reference.object);
+               acpi_ut_add_reference(source_desc->reference.object);
                break;
 
        default:
@@ -767,7 +724,6 @@ acpi_ut_copy_simple_object (
        return (AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_ielement_to_ielement
@@ -781,24 +737,21 @@ acpi_ut_copy_simple_object (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_ielement_to_ielement (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context)
+acpi_ut_copy_ielement_to_ielement(u8 object_type,
+                                 union acpi_operand_object *source_object,
+                                 union acpi_generic_state *state,
+                                 void *context)
 {
-       acpi_status                     status = AE_OK;
-       u32                             this_index;
-       union acpi_operand_object       **this_target_ptr;
-       union acpi_operand_object       *target_object;
-
+       acpi_status status = AE_OK;
+       u32 this_index;
+       union acpi_operand_object **this_target_ptr;
+       union acpi_operand_object *target_object;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
-
-       this_index    = state->pkg.index;
+       this_index = state->pkg.index;
        this_target_ptr = (union acpi_operand_object **)
-                          &state->pkg.dest_object->package.elements[this_index];
+           &state->pkg.dest_object->package.elements[this_index];
 
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
@@ -809,34 +762,36 @@ acpi_ut_copy_ielement_to_ielement (
                        /*
                         * This is a simple object, just copy it
                         */
-                       target_object = acpi_ut_create_internal_object (
-                                          ACPI_GET_OBJECT_TYPE (source_object));
+                       target_object =
+                           acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
+                                                          (source_object));
                        if (!target_object) {
                                return (AE_NO_MEMORY);
                        }
 
-                       status = acpi_ut_copy_simple_object (source_object, target_object);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ut_copy_simple_object(source_object,
+                                                      target_object);
+                       if (ACPI_FAILURE(status)) {
                                goto error_exit;
                        }
 
                        *this_target_ptr = target_object;
-               }
-               else {
+               } else {
                        /* Pass through a null element */
 
                        *this_target_ptr = NULL;
                }
                break;
 
-
        case ACPI_COPY_TYPE_PACKAGE:
 
                /*
                 * This object is a package - go down another nesting level
                 * Create and build the package object
                 */
-               target_object = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
+               target_object =
+                   acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
                if (!target_object) {
                        return (AE_NO_MEMORY);
                }
@@ -848,8 +803,8 @@ acpi_ut_copy_ielement_to_ielement (
                 * Create the object array
                 */
                target_object->package.elements =
-                       ACPI_MEM_CALLOCATE (((acpi_size) source_object->package.count + 1) *
-                                        sizeof (void *));
+                   ACPI_MEM_CALLOCATE(((acpi_size) source_object->package.
+                                       count + 1) * sizeof(void *));
                if (!target_object->package.elements) {
                        status = AE_NO_MEMORY;
                        goto error_exit;
@@ -866,19 +821,17 @@ acpi_ut_copy_ielement_to_ielement (
                *this_target_ptr = target_object;
                break;
 
-
        default:
                return (AE_BAD_PARAMETER);
        }
 
        return (status);
 
-error_exit:
-       acpi_ut_remove_reference (target_object);
+      error_exit:
+       acpi_ut_remove_reference(target_object);
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_ipackage_to_ipackage
@@ -894,49 +847,46 @@ error_exit:
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_copy_ipackage_to_ipackage (
-       union acpi_operand_object       *source_obj,
-       union acpi_operand_object       *dest_obj,
-       struct acpi_walk_state          *walk_state)
+acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
+                                 union acpi_operand_object *dest_obj,
+                                 struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-
+       acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE ("ut_copy_ipackage_to_ipackage");
+       ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage");
 
-
-       dest_obj->common.type   = ACPI_GET_OBJECT_TYPE (source_obj);
-       dest_obj->common.flags  = source_obj->common.flags;
+       dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj);
+       dest_obj->common.flags = source_obj->common.flags;
        dest_obj->package.count = source_obj->package.count;
 
        /*
         * Create the object array and walk the source package tree
         */
-       dest_obj->package.elements = ACPI_MEM_CALLOCATE (
-                          ((acpi_size) source_obj->package.count + 1) *
-                          sizeof (void *));
+       dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size)
+                                                        source_obj->package.
+                                                        count +
+                                                        1) * sizeof(void *));
        if (!dest_obj->package.elements) {
-               ACPI_REPORT_ERROR (
-                       ("aml_build_copy_internal_package_object: Package allocation failure\n"));
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               ACPI_REPORT_ERROR(("aml_build_copy_internal_package_object: Package allocation failure\n"));
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /*
         * Copy the package element-by-element by walking the package "tree".
         * This handles nested packages of arbitrary depth.
         */
-       status = acpi_ut_walk_package_tree (source_obj, dest_obj,
-                        acpi_ut_copy_ielement_to_ielement, walk_state);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_walk_package_tree(source_obj, dest_obj,
+                                          acpi_ut_copy_ielement_to_ielement,
+                                          walk_state);
+       if (ACPI_FAILURE(status)) {
                /* On failure, delete the destination package object */
 
-               acpi_ut_remove_reference (dest_obj);
+               acpi_ut_remove_reference(dest_obj);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_iobject_to_iobject
@@ -952,35 +902,31 @@ acpi_ut_copy_ipackage_to_ipackage (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_copy_iobject_to_iobject (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       **dest_desc,
-       struct acpi_walk_state          *walk_state)
+acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
+                               union acpi_operand_object **dest_desc,
+                               struct acpi_walk_state *walk_state)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("ut_copy_iobject_to_iobject");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject");
 
        /* Create the top level object */
 
-       *dest_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_desc));
+       *dest_desc =
+           acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE(source_desc));
        if (!*dest_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Copy the object and possible subobjects */
 
-       if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_PACKAGE) {
-               status = acpi_ut_copy_ipackage_to_ipackage (source_desc, *dest_desc,
-                                 walk_state);
-       }
-       else {
-               status = acpi_ut_copy_simple_object (source_desc, *dest_desc);
+       if (ACPI_GET_OBJECT_TYPE(source_desc) == ACPI_TYPE_PACKAGE) {
+               status =
+                   acpi_ut_copy_ipackage_to_ipackage(source_desc, *dest_desc,
+                                                     walk_state);
+       else {
+               status = acpi_ut_copy_simple_object(source_desc, *dest_desc);
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
-
-
index 794c7df3f2ad3e833582dd7dbdb9c41425b498e2..d80e9263993251fc00202730df5ea941551530c0 100644 (file)
 #include <acpi/acpi.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utdebug")
-
+ACPI_MODULE_NAME("utdebug")
 
 #ifdef ACPI_DEBUG_OUTPUT
+static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF;
+static char *acpi_gbl_fn_entry_str = "----Entry";
+static char *acpi_gbl_fn_exit_str = "----Exit-";
 
-static u32   acpi_gbl_prev_thread_id = 0xFFFFFFFF;
-static char     *acpi_gbl_fn_entry_str = "----Entry";
-static char     *acpi_gbl_fn_exit_str = "----Exit-";
+/* Local prototypes */
 
+static const char *acpi_ut_trim_function_name(const char *function_name);
 
 /*******************************************************************************
  *
@@ -68,17 +69,13 @@ static char     *acpi_gbl_fn_exit_str = "----Exit-";
  *
  ******************************************************************************/
 
-void
-acpi_ut_init_stack_ptr_trace (
-       void)
+void acpi_ut_init_stack_ptr_trace(void)
 {
-       u32                         current_sp;
-
+       u32 current_sp;
 
-       acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF (&current_sp, NULL);
+       acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF(&current_sp, NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_track_stack_ptr
@@ -91,14 +88,11 @@ acpi_ut_init_stack_ptr_trace (
  *
  ******************************************************************************/
 
-void
-acpi_ut_track_stack_ptr (
-       void)
+void acpi_ut_track_stack_ptr(void)
 {
-       acpi_size                   current_sp;
-
+       acpi_size current_sp;
 
-       current_sp = ACPI_PTR_DIFF (&current_sp, NULL);
+       current_sp = ACPI_PTR_DIFF(&current_sp, NULL);
 
        if (current_sp < acpi_gbl_lowest_stack_pointer) {
                acpi_gbl_lowest_stack_pointer = current_sp;
@@ -109,6 +103,39 @@ acpi_ut_track_stack_ptr (
        }
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_trim_function_name
+ *
+ * PARAMETERS:  function_name       - Ascii string containing a procedure name
+ *
+ * RETURN:      Updated pointer to the function name
+ *
+ * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
+ *              This allows compiler macros such as __FUNCTION__ to be used
+ *              with no change to the debug output.
+ *
+ ******************************************************************************/
+
+static const char *acpi_ut_trim_function_name(const char *function_name)
+{
+
+       /* All Function names are longer than 4 chars, check is safe */
+
+       if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
+               /* This is the case where the original source has not been modified */
+
+               return (function_name + 4);
+       }
+
+       if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
+               /* This is the case where the source has been 'linuxized' */
+
+               return (function_name + 5);
+       }
+
+       return (function_name);
+}
 
 /*******************************************************************************
  *
@@ -116,10 +143,9 @@ acpi_ut_track_stack_ptr (
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number (for error output)
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Format              - Printf format field
  *              ...                 - Optional printf arguments
  *
@@ -130,36 +156,33 @@ acpi_ut_track_stack_ptr (
  *
  ******************************************************************************/
 
-void  ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print (
-       u32                             requested_debug_level,
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *format,
-       ...)
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_debug_print(u32 requested_debug_level,
+                   u32 line_number,
+                   const char *function_name,
+                   char *module_name, u32 component_id, char *format, ...)
 {
-       u32                             thread_id;
-       va_list                 args;
-
+       u32 thread_id;
+       va_list args;
 
        /*
         * Stay silent if the debug level or component ID is disabled
         */
        if (!(requested_debug_level & acpi_dbg_level) ||
-               !(dbg_info->component_id & acpi_dbg_layer)) {
+           !(component_id & acpi_dbg_layer)) {
                return;
        }
 
        /*
         * Thread tracking and context switch notification
         */
-       thread_id = acpi_os_get_thread_id ();
+       thread_id = acpi_os_get_thread_id();
 
        if (thread_id != acpi_gbl_prev_thread_id) {
                if (ACPI_LV_THREADS & acpi_dbg_level) {
-                       acpi_os_printf (
-                               "\n**** Context Switch from TID %X to TID %X ****\n\n",
-                               acpi_gbl_prev_thread_id, thread_id);
+                       acpi_os_printf
+                           ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+                            acpi_gbl_prev_thread_id, thread_id);
                }
 
                acpi_gbl_prev_thread_id = thread_id;
@@ -169,17 +192,18 @@ acpi_ut_debug_print (
         * Display the module name, current line number, thread ID (if requested),
         * current procedure nesting level, and the current procedure name
         */
-       acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number);
+       acpi_os_printf("%8s-%04ld ", module_name, line_number);
 
        if (ACPI_LV_THREADS & acpi_dbg_level) {
-               acpi_os_printf ("[%04lX] ", thread_id);
+               acpi_os_printf("[%04lX] ", thread_id);
        }
 
-       acpi_os_printf ("[%02ld] %-22.22s: ",
-               acpi_gbl_nesting_level, dbg_info->proc_name);
+       acpi_os_printf("[%02ld] %-22.22s: ",
+                      acpi_gbl_nesting_level,
+                      acpi_ut_trim_function_name(function_name));
 
-       va_start (args, format);
-       acpi_os_vprintf (format, args);
+       va_start(args, format);
+       acpi_os_vprintf(format, args);
 }
 
 EXPORT_SYMBOL(acpi_ut_debug_print);
@@ -190,10 +214,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
  *
  * PARAMETERS:  requested_debug_level - Requested debug print level
  *              line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Format              - Printf format field
  *              ...                 - Optional printf arguments
  *
@@ -204,37 +227,33 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
  *
  ******************************************************************************/
 
-void  ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print_raw (
-       u32                             requested_debug_level,
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *format,
-       ...)
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_debug_print_raw(u32 requested_debug_level,
+                       u32 line_number,
+                       const char *function_name,
+                       char *module_name, u32 component_id, char *format, ...)
 {
-       va_list                 args;
-
+       va_list args;
 
        if (!(requested_debug_level & acpi_dbg_level) ||
-               !(dbg_info->component_id & acpi_dbg_layer)) {
+           !(component_id & acpi_dbg_layer)) {
                return;
        }
 
-       va_start (args, format);
-       acpi_os_vprintf (format, args);
+       va_start(args, format);
+       acpi_os_vprintf(format, args);
 }
-EXPORT_SYMBOL(acpi_ut_debug_print_raw);
 
+EXPORT_SYMBOL(acpi_ut_debug_print_raw);
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_trace
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *
  * RETURN:      None
  *
@@ -244,29 +263,28 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
  ******************************************************************************/
 
 void
-acpi_ut_trace (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info)
+acpi_ut_trace(u32 line_number,
+             const char *function_name, char *module_name, u32 component_id)
 {
 
        acpi_gbl_nesting_level++;
-       acpi_ut_track_stack_ptr ();
+       acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s\n", acpi_gbl_fn_entry_str);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s\n", acpi_gbl_fn_entry_str);
 }
-EXPORT_SYMBOL(acpi_ut_trace);
 
+EXPORT_SYMBOL(acpi_ut_trace);
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_trace_ptr
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Pointer             - Pointer to display
  *
  * RETURN:      None
@@ -277,28 +295,27 @@ EXPORT_SYMBOL(acpi_ut_trace);
  ******************************************************************************/
 
 void
-acpi_ut_trace_ptr (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       void                            *pointer)
+acpi_ut_trace_ptr(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, void *pointer)
 {
        acpi_gbl_nesting_level++;
-       acpi_ut_track_stack_ptr ();
+       acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s %p\n", acpi_gbl_fn_entry_str, pointer);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s %p\n", acpi_gbl_fn_entry_str,
+                           pointer);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_trace_str
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              String              - Additional string to display
  *
  * RETURN:      None
@@ -309,29 +326,28 @@ acpi_ut_trace_ptr (
  ******************************************************************************/
 
 void
-acpi_ut_trace_str (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *string)
+acpi_ut_trace_str(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, char *string)
 {
 
        acpi_gbl_nesting_level++;
-       acpi_ut_track_stack_ptr ();
+       acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s %s\n", acpi_gbl_fn_entry_str, string);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s %s\n", acpi_gbl_fn_entry_str,
+                           string);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_trace_u32
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Integer             - Integer to display
  *
  * RETURN:      None
@@ -342,29 +358,28 @@ acpi_ut_trace_str (
  ******************************************************************************/
 
 void
-acpi_ut_trace_u32 (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       u32                             integer)
+acpi_ut_trace_u32(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, u32 integer)
 {
 
        acpi_gbl_nesting_level++;
-       acpi_ut_track_stack_ptr ();
+       acpi_ut_track_stack_ptr();
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s %08X\n", acpi_gbl_fn_entry_str, integer);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s %08X\n", acpi_gbl_fn_entry_str,
+                           integer);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *
  * RETURN:      None
  *
@@ -374,28 +389,27 @@ acpi_ut_trace_u32 (
  ******************************************************************************/
 
 void
-acpi_ut_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info)
+acpi_ut_exit(u32 line_number,
+            const char *function_name, char *module_name, u32 component_id)
 {
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s\n", acpi_gbl_fn_exit_str);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s\n", acpi_gbl_fn_exit_str);
 
        acpi_gbl_nesting_level--;
 }
-EXPORT_SYMBOL(acpi_ut_exit);
 
+EXPORT_SYMBOL(acpi_ut_exit);
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_status_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Status              - Exit status code
  *
  * RETURN:      None
@@ -406,37 +420,38 @@ EXPORT_SYMBOL(acpi_ut_exit);
  ******************************************************************************/
 
 void
-acpi_ut_status_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       acpi_status                     status)
+acpi_ut_status_exit(u32 line_number,
+                   const char *function_name,
+                   char *module_name, u32 component_id, acpi_status status)
 {
 
-       if (ACPI_SUCCESS (status)) {
-               acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                               "%s %s\n", acpi_gbl_fn_exit_str,
-                               acpi_format_exception (status));
-       }
-       else {
-               acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                               "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
-                               acpi_format_exception (status));
+       if (ACPI_SUCCESS(status)) {
+               acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                                   line_number, function_name, module_name,
+                                   component_id, "%s %s\n",
+                                   acpi_gbl_fn_exit_str,
+                                   acpi_format_exception(status));
+       } else {
+               acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                                   line_number, function_name, module_name,
+                                   component_id, "%s ****Exception****: %s\n",
+                                   acpi_gbl_fn_exit_str,
+                                   acpi_format_exception(status));
        }
 
        acpi_gbl_nesting_level--;
 }
-EXPORT_SYMBOL(acpi_ut_status_exit);
 
+EXPORT_SYMBOL(acpi_ut_status_exit);
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_value_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Value               - Value to be printed with exit msg
  *
  * RETURN:      None
@@ -447,30 +462,29 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
  ******************************************************************************/
 
 void
-acpi_ut_value_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       acpi_integer                    value)
+acpi_ut_value_exit(u32 line_number,
+                  const char *function_name,
+                  char *module_name, u32 component_id, acpi_integer value)
 {
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
-                       ACPI_FORMAT_UINT64 (value));
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s %8.8X%8.8X\n",
+                           acpi_gbl_fn_exit_str, ACPI_FORMAT_UINT64(value));
 
        acpi_gbl_nesting_level--;
 }
-EXPORT_SYMBOL(acpi_ut_value_exit);
 
+EXPORT_SYMBOL(acpi_ut_value_exit);
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_ptr_exit
  *
  * PARAMETERS:  line_number         - Caller's line number
- *              dbg_info            - Contains:
- *                  proc_name           - Caller's procedure name
- *                  module_name         - Caller's module name
- *                  component_id        - Caller's component ID
+ *              function_name       - Caller's procedure name
+ *              module_name         - Caller's module name
+ *              component_id        - Caller's component ID
  *              Ptr                 - Pointer to display
  *
  * RETURN:      None
@@ -481,21 +495,20 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
  ******************************************************************************/
 
 void
-acpi_ut_ptr_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       u8                              *ptr)
+acpi_ut_ptr_exit(u32 line_number,
+                const char *function_name,
+                char *module_name, u32 component_id, u8 * ptr)
 {
 
-       acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info,
-                       "%s %p\n", acpi_gbl_fn_exit_str, ptr);
+       acpi_ut_debug_print(ACPI_LV_FUNCTIONS,
+                           line_number, function_name, module_name,
+                           component_id, "%s %p\n", acpi_gbl_fn_exit_str, ptr);
 
        acpi_gbl_nesting_level--;
 }
 
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_dump_buffer
@@ -511,23 +524,17 @@ acpi_ut_ptr_exit (
  *
  ******************************************************************************/
 
-void
-acpi_ut_dump_buffer (
-       u8                              *buffer,
-       u32                             count,
-       u32                             display,
-       u32                             component_id)
+void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
 {
-       acpi_native_uint                i = 0;
-       acpi_native_uint                j;
-       u32                             temp32;
-       u8                              buf_char;
-
+       acpi_native_uint i = 0;
+       acpi_native_uint j;
+       u32 temp32;
+       u8 buf_char;
 
        /* Only dump the buffer if tracing is enabled */
 
        if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
-               (component_id & acpi_dbg_layer))) {
+             (component_id & acpi_dbg_layer))) {
                return;
        }
 
@@ -540,7 +547,7 @@ acpi_ut_dump_buffer (
        while (i < count) {
                /* Print current offset */
 
-               acpi_os_printf ("%6.4X: ", (u32) i);
+               acpi_os_printf("%6.4X: ", (u32) i);
 
                /* Print 16 hex chars */
 
@@ -548,73 +555,66 @@ acpi_ut_dump_buffer (
                        if (i + j >= count) {
                                /* Dump fill spaces */
 
-                               acpi_os_printf ("%*s", ((display * 2) + 1), " ");
-                               j += display;
+                               acpi_os_printf("%*s", ((display * 2) + 1), " ");
+                               j += (acpi_native_uint) display;
                                continue;
                        }
 
                        switch (display) {
-                       default:    /* Default is BYTE display */
+                       default:        /* Default is BYTE display */
 
-                               acpi_os_printf ("%02X ", buffer[i + j]);
+                               acpi_os_printf("%02X ", buffer[i + j]);
                                break;
 
-
                        case DB_WORD_DISPLAY:
 
-                               ACPI_MOVE_16_TO_32 (&temp32, &buffer[i + j]);
-                               acpi_os_printf ("%04X ", temp32);
+                               ACPI_MOVE_16_TO_32(&temp32, &buffer[i + j]);
+                               acpi_os_printf("%04X ", temp32);
                                break;
 
-
                        case DB_DWORD_DISPLAY:
 
-                               ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]);
-                               acpi_os_printf ("%08X ", temp32);
+                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]);
+                               acpi_os_printf("%08X ", temp32);
                                break;
 
-
                        case DB_QWORD_DISPLAY:
 
-                               ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j]);
-                               acpi_os_printf ("%08X", temp32);
+                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j]);
+                               acpi_os_printf("%08X", temp32);
 
-                               ACPI_MOVE_32_TO_32 (&temp32, &buffer[i + j + 4]);
-                               acpi_os_printf ("%08X ", temp32);
+                               ACPI_MOVE_32_TO_32(&temp32, &buffer[i + j + 4]);
+                               acpi_os_printf("%08X ", temp32);
                                break;
                        }
 
-                       j += display;
+                       j += (acpi_native_uint) display;
                }
 
                /*
-                * Print the ASCII equivalent characters
-                * But watch out for the bad unprintable ones...
+                * Print the ASCII equivalent characters but watch out for the bad
+                * unprintable ones (printable chars are 0x20 through 0x7E)
                 */
-               acpi_os_printf (" ");
+               acpi_os_printf(" ");
                for (j = 0; j < 16; j++) {
                        if (i + j >= count) {
-                               acpi_os_printf ("\n");
+                               acpi_os_printf("\n");
                                return;
                        }
 
                        buf_char = buffer[i + j];
-                       if ((buf_char > 0x1F && buf_char < 0x2E) ||
-                               (buf_char > 0x2F && buf_char < 0x61) ||
-                               (buf_char > 0x60 && buf_char < 0x7F)) {
-                               acpi_os_printf ("%c", buf_char);
-                       }
-                       else {
-                               acpi_os_printf (".");
+                       if (ACPI_IS_PRINT(buf_char)) {
+                               acpi_os_printf("%c", buf_char);
+                       } else {
+                               acpi_os_printf(".");
                        }
                }
 
                /* Done with that line. */
 
-               acpi_os_printf ("\n");
+               acpi_os_printf("\n");
                i += 16;
        }
 
        return;
 }
-
index bc54030226819f47ad48ccb82e4e2dbbc0d8ea9a..2bc878f7a12739952a1217be0d90a6ff356e3bcd 100644 (file)
@@ -41,7 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 #include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utdelete")
+ACPI_MODULE_NAME("utdelete")
 
 /* Local prototypes */
+static void acpi_ut_delete_internal_obj(union acpi_operand_object *object);
 
 static void
-acpi_ut_delete_internal_obj (
-       union acpi_operand_object       *object);
-
-static void
-acpi_ut_update_ref_count (
-       union acpi_operand_object       *object,
-       u32                             action);
-
+acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action);
 
 /*******************************************************************************
  *
@@ -76,18 +69,14 @@ acpi_ut_update_ref_count (
  *
  ******************************************************************************/
 
-static void
-acpi_ut_delete_internal_obj (
-       union acpi_operand_object       *object)
+static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
 {
-       void                            *obj_pointer = NULL;
-       union acpi_operand_object       *handler_desc;
-       union acpi_operand_object       *second_desc;
-       union acpi_operand_object       *next_desc;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_delete_internal_obj", object);
+       void *obj_pointer = NULL;
+       union acpi_operand_object *handler_desc;
+       union acpi_operand_object *second_desc;
+       union acpi_operand_object *next_desc;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object);
 
        if (!object) {
                return_VOID;
@@ -97,11 +86,12 @@ acpi_ut_delete_internal_obj (
         * Must delete or free any pointers within the object that are not
         * actual ACPI objects (for example, a raw buffer pointer).
         */
-       switch (ACPI_GET_OBJECT_TYPE (object)) {
+       switch (ACPI_GET_OBJECT_TYPE(object)) {
        case ACPI_TYPE_STRING:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
-                       object, object->string.pointer));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "**** String %p, ptr %p\n", object,
+                                 object->string.pointer));
 
                /* Free the actual string buffer */
 
@@ -112,11 +102,11 @@ acpi_ut_delete_internal_obj (
                }
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
-                       object, object->buffer.pointer));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "**** Buffer %p, ptr %p\n", object,
+                                 object->buffer.pointer));
 
                /* Free the actual buffer */
 
@@ -127,11 +117,11 @@ acpi_ut_delete_internal_obj (
                }
                break;
 
-
        case ACPI_TYPE_PACKAGE:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
-                       object->package.count));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 " **** Package of count %X\n",
+                                 object->package.count));
 
                /*
                 * Elements of the package are not handled here, they are deleted
@@ -143,11 +133,11 @@ acpi_ut_delete_internal_obj (
                obj_pointer = object->package.elements;
                break;
 
-
        case ACPI_TYPE_DEVICE:
 
                if (object->device.gpe_block) {
-                       (void) acpi_ev_delete_gpe_block (object->device.gpe_block);
+                       (void)acpi_ev_delete_gpe_block(object->device.
+                                                      gpe_block);
                }
 
                /* Walk the handler list for this device */
@@ -155,54 +145,51 @@ acpi_ut_delete_internal_obj (
                handler_desc = object->device.handler;
                while (handler_desc) {
                        next_desc = handler_desc->address_space.next;
-                       acpi_ut_remove_reference (handler_desc);
+                       acpi_ut_remove_reference(handler_desc);
                        handler_desc = next_desc;
                }
                break;
 
-
        case ACPI_TYPE_MUTEX:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "***** Mutex %p, Semaphore %p\n",
-                       object, object->mutex.semaphore));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "***** Mutex %p, Semaphore %p\n",
+                                 object, object->mutex.semaphore));
 
-               acpi_ex_unlink_mutex (object);
-               (void) acpi_os_delete_semaphore (object->mutex.semaphore);
+               acpi_ex_unlink_mutex(object);
+               (void)acpi_os_delete_semaphore(object->mutex.semaphore);
                break;
 
-
        case ACPI_TYPE_EVENT:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "***** Event %p, Semaphore %p\n",
-                       object, object->event.semaphore));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "***** Event %p, Semaphore %p\n",
+                                 object, object->event.semaphore));
 
-               (void) acpi_os_delete_semaphore (object->event.semaphore);
+               (void)acpi_os_delete_semaphore(object->event.semaphore);
                object->event.semaphore = NULL;
                break;
 
-
        case ACPI_TYPE_METHOD:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "***** Method %p\n", object));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "***** Method %p\n", object));
 
                /* Delete the method semaphore if it exists */
 
                if (object->method.semaphore) {
-                       (void) acpi_os_delete_semaphore (object->method.semaphore);
+                       (void)acpi_os_delete_semaphore(object->method.
+                                                      semaphore);
                        object->method.semaphore = NULL;
                }
                break;
 
-
        case ACPI_TYPE_REGION:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "***** Region %p\n", object));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "***** Region %p\n", object));
 
-               second_desc = acpi_ns_get_secondary_object (object);
+               second_desc = acpi_ns_get_secondary_object(object);
                if (second_desc) {
                        /*
                         * Free the region_context if and only if the handler is one of the
@@ -211,32 +198,33 @@ acpi_ut_delete_internal_obj (
                         */
                        handler_desc = object->region.handler;
                        if (handler_desc) {
-                               if (handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
-                                       obj_pointer = second_desc->extra.region_context;
+                               if (handler_desc->address_space.
+                                   hflags &
+                                   ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
+                                       obj_pointer =
+                                           second_desc->extra.region_context;
                                }
 
-                               acpi_ut_remove_reference (handler_desc);
+                               acpi_ut_remove_reference(handler_desc);
                        }
 
                        /* Now we can free the Extra object */
 
-                       acpi_ut_delete_object_desc (second_desc);
+                       acpi_ut_delete_object_desc(second_desc);
                }
                break;
 
-
        case ACPI_TYPE_BUFFER_FIELD:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "***** Buffer Field %p\n", object));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "***** Buffer Field %p\n", object));
 
-               second_desc = acpi_ns_get_secondary_object (object);
+               second_desc = acpi_ns_get_secondary_object(object);
                if (second_desc) {
-                       acpi_ut_delete_object_desc (second_desc);
+                       acpi_ut_delete_object_desc(second_desc);
                }
                break;
 
-
        default:
                break;
        }
@@ -244,21 +232,20 @@ acpi_ut_delete_internal_obj (
        /* Free any allocated memory (pointer within the object) found above */
 
        if (obj_pointer) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
-                               obj_pointer));
-               ACPI_MEM_FREE (obj_pointer);
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "Deleting Object Subptr %p\n", obj_pointer));
+               ACPI_MEM_FREE(obj_pointer);
        }
 
        /* Now the object can be safely deleted */
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
-                       object, acpi_ut_get_object_type_name (object)));
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
+                         object, acpi_ut_get_object_type_name(object)));
 
-       acpi_ut_delete_object_desc (object);
+       acpi_ut_delete_object_desc(object);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_delete_internal_object_list
@@ -272,29 +259,24 @@ acpi_ut_delete_internal_obj (
  *
  ******************************************************************************/
 
-void
-acpi_ut_delete_internal_object_list (
-       union acpi_operand_object       **obj_list)
+void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
 {
-       union acpi_operand_object       **internal_obj;
-
-
-       ACPI_FUNCTION_TRACE ("ut_delete_internal_object_list");
+       union acpi_operand_object **internal_obj;
 
+       ACPI_FUNCTION_TRACE("ut_delete_internal_object_list");
 
        /* Walk the null-terminated internal list */
 
        for (internal_obj = obj_list; *internal_obj; internal_obj++) {
-               acpi_ut_remove_reference (*internal_obj);
+               acpi_ut_remove_reference(*internal_obj);
        }
 
        /* Free the combined parameter pointer list and object array */
 
-       ACPI_MEM_FREE (obj_list);
+       ACPI_MEM_FREE(obj_list);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_update_ref_count
@@ -309,16 +291,12 @@ acpi_ut_delete_internal_object_list (
  ******************************************************************************/
 
 static void
-acpi_ut_update_ref_count (
-       union acpi_operand_object       *object,
-       u32                             action)
+acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
 {
-       u16                             count;
-       u16                             new_count;
-
-
-       ACPI_FUNCTION_NAME ("ut_update_ref_count");
+       u16 count;
+       u16 new_count;
 
+       ACPI_FUNCTION_NAME("ut_update_ref_count");
 
        if (!object) {
                return;
@@ -338,58 +316,55 @@ acpi_ut_update_ref_count (
                new_count++;
                object->common.reference_count = new_count;
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "Obj %p Refs=%X, [Incremented]\n",
-                       object, new_count));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "Obj %p Refs=%X, [Incremented]\n",
+                                 object, new_count));
                break;
 
-
        case REF_DECREMENT:
 
                if (count < 1) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                               "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
-                               object, new_count));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                         "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
+                                         object, new_count));
 
                        new_count = 0;
-               }
-               else {
+               } else {
                        new_count--;
 
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                               "Obj %p Refs=%X, [Decremented]\n",
-                               object, new_count));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                         "Obj %p Refs=%X, [Decremented]\n",
+                                         object, new_count));
                }
 
-               if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                               "Method Obj %p Refs=%X, [Decremented]\n",
-                               object, new_count));
+               if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                         "Method Obj %p Refs=%X, [Decremented]\n",
+                                         object, new_count));
                }
 
                object->common.reference_count = new_count;
                if (new_count == 0) {
-                       acpi_ut_delete_internal_obj (object);
+                       acpi_ut_delete_internal_obj(object);
                }
 
                break;
 
-
        case REF_FORCE_DELETE:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "Obj %p Refs=%X, Force delete! (Set to 0)\n",
-                       object, count));
+               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                 "Obj %p Refs=%X, Force delete! (Set to 0)\n",
+                                 object, count));
 
                new_count = 0;
                object->common.reference_count = new_count;
-               acpi_ut_delete_internal_obj (object);
+               acpi_ut_delete_internal_obj(object);
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", action));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n",
+                                 action));
                break;
        }
 
@@ -399,15 +374,14 @@ acpi_ut_update_ref_count (
         */
        if (count > ACPI_MAX_REFERENCE_COUNT) {
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
-                       "**** Warning **** Large Reference Count (%X) in object %p\n\n",
-                       count, object));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "**** Warning **** Large Reference Count (%X) in object %p\n\n",
+                                 count, object));
        }
 
        return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_update_object_reference
@@ -431,65 +405,42 @@ acpi_ut_update_ref_count (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_update_object_reference (
-       union acpi_operand_object       *object,
-       u16                             action)
+acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
 {
-       acpi_status                     status;
-       u32                             i;
-       union acpi_generic_state         *state_list = NULL;
-       union acpi_generic_state         *state;
-       union acpi_operand_object        *tmp;
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);
+       acpi_status status = AE_OK;
+       union acpi_generic_state *state_list = NULL;
+       union acpi_operand_object *next_object = NULL;
+       union acpi_generic_state *state;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object);
 
-       /* Ignore a null object ptr */
+       while (object) {
+               /* Make sure that this isn't a namespace handle */
 
-       if (!object) {
-               return_ACPI_STATUS (AE_OK);
-       }
-
-       /* Make sure that this isn't a namespace handle */
-
-       if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-                       "Object %p is NS handle\n", object));
-               return_ACPI_STATUS (AE_OK);
-       }
-
-       state = acpi_ut_create_update_state (object, action);
-
-       while (state) {
-               object = state->update.object;
-               action = state->update.value;
-               acpi_ut_delete_generic_state (state);
+               if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                                         "Object %p is NS handle\n", object));
+                       return_ACPI_STATUS(AE_OK);
+               }
 
                /*
                 * All sub-objects must have their reference count incremented also.
                 * Different object types have different subobjects.
                 */
-               switch (ACPI_GET_OBJECT_TYPE (object)) {
+               switch (ACPI_GET_OBJECT_TYPE(object)) {
                case ACPI_TYPE_DEVICE:
 
-                       tmp = object->device.system_notify;
-                       if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
-                               object->device.system_notify = NULL;
-                       acpi_ut_update_ref_count (tmp, action);
-
-                       tmp = object->device.device_notify;
-                       if (tmp && (tmp->common.reference_count <= 1) && action == REF_DECREMENT)
-                               object->device.device_notify = NULL;
-                       acpi_ut_update_ref_count (tmp, action);
-
+                       acpi_ut_update_ref_count(object->device.system_notify,
+                                                action);
+                       acpi_ut_update_ref_count(object->device.device_notify,
+                                                action);
                        break;
 
-
                case ACPI_TYPE_PACKAGE:
-
                        /*
-                        * We must update all the sub-objects of the package
-                        * (Each of whom may have their own sub-objects, etc.
+                        * We must update all the sub-objects of the package,
+                        * each of whom may have their own sub-objects.
                         */
                        for (i = 0; i < object->package.count; i++) {
                                /*
@@ -497,116 +448,67 @@ acpi_ut_update_object_reference (
                                 * Note: There can be null elements within the package,
                                 * these are simply ignored
                                 */
-                               status = acpi_ut_create_update_state_and_push (
-                                                object->package.elements[i], action, &state_list);
-                               if (ACPI_FAILURE (status)) {
+                               status =
+                                   acpi_ut_create_update_state_and_push
+                                   (object->package.elements[i], action,
+                                    &state_list);
+                               if (ACPI_FAILURE(status)) {
                                        goto error_exit;
                                }
-
-                               tmp = object->package.elements[i];
-                               if (tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                                       object->package.elements[i] = NULL;
                        }
                        break;
 
-
                case ACPI_TYPE_BUFFER_FIELD:
 
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->buffer_field.buffer_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
-                               goto error_exit;
-                       }
-
-                       tmp = object->buffer_field.buffer_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->buffer_field.buffer_obj = NULL;
+                       next_object = object->buffer_field.buffer_obj;
                        break;
 
-
                case ACPI_TYPE_LOCAL_REGION_FIELD:
 
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->field.region_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
-                               goto error_exit;
-                       }
-
-                       tmp = object->field.region_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->field.region_obj = NULL;
-                  break;
-
+                       next_object = object->field.region_obj;
+                       break;
 
                case ACPI_TYPE_LOCAL_BANK_FIELD:
 
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->bank_field.bank_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
+                       next_object = object->bank_field.bank_obj;
+                       status =
+                           acpi_ut_create_update_state_and_push(object->
+                                                                bank_field.
+                                                                region_obj,
+                                                                action,
+                                                                &state_list);
+                       if (ACPI_FAILURE(status)) {
                                goto error_exit;
                        }
-
-                       tmp = object->bank_field.bank_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->bank_field.bank_obj = NULL;
-
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->bank_field.region_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
-                               goto error_exit;
-                       }
-
-                       tmp = object->bank_field.region_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->bank_field.region_obj = NULL;
                        break;
 
-
                case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->index_field.index_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
-                               goto error_exit;
-                       }
-
-                       tmp = object->index_field.index_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->index_field.index_obj = NULL;
-
-                       status = acpi_ut_create_update_state_and_push (
-                                        object->index_field.data_obj, action, &state_list);
-                       if (ACPI_FAILURE (status)) {
+                       next_object = object->index_field.index_obj;
+                       status =
+                           acpi_ut_create_update_state_and_push(object->
+                                                                index_field.
+                                                                data_obj,
+                                                                action,
+                                                                &state_list);
+                       if (ACPI_FAILURE(status)) {
                                goto error_exit;
                        }
-
-                       tmp = object->index_field.data_obj;
-                       if ( tmp && (tmp->common.reference_count <= 1)  && action == REF_DECREMENT)
-                               object->index_field.data_obj = NULL;
                        break;
 
-
                case ACPI_TYPE_LOCAL_REFERENCE:
-
                        /*
                         * The target of an Index (a package, string, or buffer) must track
                         * changes to the ref count of the index.
                         */
                        if (object->reference.opcode == AML_INDEX_OP) {
-                               status = acpi_ut_create_update_state_and_push (
-                                                object->reference.object, action, &state_list);
-                               if (ACPI_FAILURE (status)) {
-                                       goto error_exit;
-                               }
+                               next_object = object->reference.object;
                        }
                        break;
 
-
                case ACPI_TYPE_REGION:
                default:
-
-                       /* No subobjects */
-                       break;
+                       break;  /* No subobjects */
                }
 
                /*
@@ -614,25 +516,31 @@ acpi_ut_update_object_reference (
                 * happen after we update the sub-objects in case this causes the
                 * main object to be deleted.
                 */
-               acpi_ut_update_ref_count (object, action);
+               acpi_ut_update_ref_count(object, action);
+               object = NULL;
 
                /* Move on to the next object to be updated */
 
-               state = acpi_ut_pop_generic_state (&state_list);
+               if (next_object) {
+                       object = next_object;
+                       next_object = NULL;
+               } else if (state_list) {
+                       state = acpi_ut_pop_generic_state(&state_list);
+                       object = state->update.object;
+                       acpi_ut_delete_generic_state(state);
+               }
        }
 
-       return_ACPI_STATUS (AE_OK);
-
+       return_ACPI_STATUS(AE_OK);
 
-error_exit:
+      error_exit:
 
-       ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
-               acpi_format_exception (status)));
+       ACPI_REPORT_ERROR(("Could not update object reference count, %s\n",
+                          acpi_format_exception(status)));
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_add_reference
@@ -646,31 +554,27 @@ error_exit:
  *
  ******************************************************************************/
 
-void
-acpi_ut_add_reference (
-       union acpi_operand_object       *object)
+void acpi_ut_add_reference(union acpi_operand_object *object)
 {
 
-       ACPI_FUNCTION_TRACE_PTR ("ut_add_reference", object);
-
+       ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object);
 
        /* Ensure that we have a valid object */
 
-       if (!acpi_ut_valid_internal_object (object)) {
+       if (!acpi_ut_valid_internal_object(object)) {
                return_VOID;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-               "Obj %p Current Refs=%X [To Be Incremented]\n",
-               object, object->common.reference_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                         "Obj %p Current Refs=%X [To Be Incremented]\n",
+                         object, object->common.reference_count));
 
        /* Increment the reference count */
 
-       (void) acpi_ut_update_object_reference (object, REF_INCREMENT);
+       (void)acpi_ut_update_object_reference(object, REF_INCREMENT);
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_remove_reference
@@ -683,13 +587,10 @@ acpi_ut_add_reference (
  *
  ******************************************************************************/
 
-void
-acpi_ut_remove_reference (
-       union acpi_operand_object       *object)
+void acpi_ut_remove_reference(union acpi_operand_object *object)
 {
 
-       ACPI_FUNCTION_TRACE_PTR ("ut_remove_reference", object);
-
+       ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object);
 
        /*
         * Allow a NULL pointer to be passed in, just ignore it.  This saves
@@ -697,27 +598,25 @@ acpi_ut_remove_reference (
         *
         */
        if (!object ||
-               (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED)) {
+           (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) {
                return_VOID;
        }
 
        /* Ensure that we have a valid object */
 
-       if (!acpi_ut_valid_internal_object (object)) {
+       if (!acpi_ut_valid_internal_object(object)) {
                return_VOID;
        }
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
-               "Obj %p Current Refs=%X [To Be Decremented]\n",
-               object, object->common.reference_count));
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+                         "Obj %p Current Refs=%X [To Be Decremented]\n",
+                         object, object->common.reference_count));
 
        /*
         * Decrement the reference count, and only actually delete the object
         * if the reference count becomes 0.  (Must also decrement the ref count
         * of all subobjects!)
         */
-       (void) acpi_ut_update_object_reference (object, REF_DECREMENT);
+       (void)acpi_ut_update_object_reference(object, REF_DECREMENT);
        return_VOID;
 }
-
-
index 00046dd5d925850004e3fd6b3f179b10a2bad209..7b81d5ef3c32e4b90e79f63d2c89a7863c813d00 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
-
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("uteval")
+ACPI_MODULE_NAME("uteval")
 
 /* Local prototypes */
-
 static void
-acpi_ut_copy_id_string (
-       char                            *destination,
-       char                            *source,
-       acpi_size                       max_length);
+acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
 
 static acpi_status
-acpi_ut_translate_one_cid (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_compatible_id       *one_cid);
-
+acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
+                         struct acpi_compatible_id *one_cid);
 
 /*******************************************************************************
  *
@@ -77,37 +69,33 @@ acpi_ut_translate_one_cid (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ut_osi_implementation (
-       struct acpi_walk_state          *walk_state)
+acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
 {
-       union acpi_operand_object       *string_desc;
-       union acpi_operand_object       *return_desc;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_TRACE ("ut_osi_implementation");
+       union acpi_operand_object *string_desc;
+       union acpi_operand_object *return_desc;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE("ut_osi_implementation");
 
        /* Validate the string input argument */
 
        string_desc = walk_state->arguments[0].object;
        if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
-               return_ACPI_STATUS (AE_TYPE);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        /* Create a return object (Default value = 0) */
 
-       return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
+       return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
        if (!return_desc) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Compare input string to table of supported strings */
 
        for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
-               if (!ACPI_STRCMP (string_desc->string.pointer,
-                                  (char *) acpi_gbl_valid_osi_strings[i])) {
+               if (!ACPI_STRCMP(string_desc->string.pointer,
+                                (char *)acpi_gbl_valid_osi_strings[i])) {
                        /* This string is supported */
 
                        return_desc->integer.value = 0xFFFFFFFF;
@@ -116,10 +104,9 @@ acpi_ut_osi_implementation (
        }
 
        walk_state->return_desc = return_desc;
-       return_ACPI_STATUS (AE_CTRL_TERMINATE);
+       return_ACPI_STATUS(AE_CTRL_TERMINATE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_evaluate_object
@@ -140,19 +127,16 @@ acpi_ut_osi_implementation (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_evaluate_object (
-       struct acpi_namespace_node      *prefix_node,
-       char                            *path,
-       u32                             expected_return_btypes,
-       union acpi_operand_object       **return_desc)
+acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
+                       char *path,
+                       u32 expected_return_btypes,
+                       union acpi_operand_object **return_desc)
 {
-       struct acpi_parameter_info      info;
-       acpi_status                     status;
-       u32                             return_btype;
-
-
-       ACPI_FUNCTION_TRACE ("ut_evaluate_object");
+       struct acpi_parameter_info info;
+       acpi_status status;
+       u32 return_btype;
 
+       ACPI_FUNCTION_TRACE("ut_evaluate_object");
 
        info.node = prefix_node;
        info.parameters = NULL;
@@ -160,36 +144,38 @@ acpi_ut_evaluate_object (
 
        /* Evaluate the object/method */
 
-       status = acpi_ns_evaluate_relative (path, &info);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ns_evaluate_relative(path, &info);
+       if (ACPI_FAILURE(status)) {
                if (status == AE_NOT_FOUND) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n",
-                               acpi_ut_get_node_name (prefix_node), path));
-               }
-               else {
-                       ACPI_REPORT_METHOD_ERROR ("Method execution failed",
-                               prefix_node, path, status);
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "[%4.4s.%s] was not found\n",
+                                         acpi_ut_get_node_name(prefix_node),
+                                         path));
+               } else {
+                       ACPI_REPORT_METHOD_ERROR("Method execution failed",
+                                                prefix_node, path, status);
                }
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Did we get a return object? */
 
        if (!info.return_object) {
                if (expected_return_btypes) {
-                       ACPI_REPORT_METHOD_ERROR ("No object was returned from",
-                               prefix_node, path, AE_NOT_EXIST);
+                       ACPI_REPORT_METHOD_ERROR("No object was returned from",
+                                                prefix_node, path,
+                                                AE_NOT_EXIST);
 
-                       return_ACPI_STATUS (AE_NOT_EXIST);
+                       return_ACPI_STATUS(AE_NOT_EXIST);
                }
 
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Map the return object type to the bitmapped type */
 
-       switch (ACPI_GET_OBJECT_TYPE (info.return_object)) {
+       switch (ACPI_GET_OBJECT_TYPE(info.return_object)) {
        case ACPI_TYPE_INTEGER:
                return_btype = ACPI_BTYPE_INTEGER;
                break;
@@ -211,41 +197,41 @@ acpi_ut_evaluate_object (
                break;
        }
 
-       if ((acpi_gbl_enable_interpreter_slack) &&
-               (!expected_return_btypes)) {
+       if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
                /*
                 * We received a return object, but one was not expected.  This can
                 * happen frequently if the "implicit return" feature is enabled.
                 * Just delete the return object and return AE_OK.
                 */
-               acpi_ut_remove_reference (info.return_object);
-               return_ACPI_STATUS (AE_OK);
+               acpi_ut_remove_reference(info.return_object);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Is the return object one of the expected types? */
 
        if (!(expected_return_btypes & return_btype)) {
-               ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
-                       prefix_node, path, AE_TYPE);
+               ACPI_REPORT_METHOD_ERROR("Return object type is incorrect",
+                                        prefix_node, path, AE_TYPE);
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Type returned from %s was incorrect: %s, expected Btypes: %X\n",
-                       path, acpi_ut_get_object_type_name (info.return_object),
-                       expected_return_btypes));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Type returned from %s was incorrect: %s, expected Btypes: %X\n",
+                                 path,
+                                 acpi_ut_get_object_type_name(info.
+                                                              return_object),
+                                 expected_return_btypes));
 
                /* On error exit, we must delete the return object */
 
-               acpi_ut_remove_reference (info.return_object);
-               return_ACPI_STATUS (AE_TYPE);
+               acpi_ut_remove_reference(info.return_object);
+               return_ACPI_STATUS(AE_TYPE);
        }
 
        /* Object type is OK, return it */
 
        *return_desc = info.return_object;
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_evaluate_numeric_object
@@ -264,22 +250,19 @@ acpi_ut_evaluate_object (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_evaluate_numeric_object (
-       char                            *object_name,
-       struct acpi_namespace_node      *device_node,
-       acpi_integer                    *address)
+acpi_ut_evaluate_numeric_object(char *object_name,
+                               struct acpi_namespace_node *device_node,
+                               acpi_integer * address)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ut_evaluate_numeric_object");
+       ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object");
 
-
-       status = acpi_ut_evaluate_object (device_node, object_name,
-                        ACPI_BTYPE_INTEGER, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(device_node, object_name,
+                                        ACPI_BTYPE_INTEGER, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the returned Integer */
@@ -288,11 +271,10 @@ acpi_ut_evaluate_numeric_object (
 
        /* On exit, we must delete the return object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_copy_id_string
@@ -310,10 +292,7 @@ acpi_ut_evaluate_numeric_object (
  ******************************************************************************/
 
 static void
-acpi_ut_copy_id_string (
-       char                            *destination,
-       char                            *source,
-       acpi_size                       max_length)
+acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
 {
 
        /*
@@ -328,10 +307,9 @@ acpi_ut_copy_id_string (
 
        /* Do the actual copy */
 
-       ACPI_STRNCPY (destination, source, max_length);
+       ACPI_STRNCPY(destination, source, max_length);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_execute_HID
@@ -349,42 +327,39 @@ acpi_ut_copy_id_string (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_execute_HID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_device_id           *hid)
+acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
+                   struct acpi_device_id *hid)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ut_execute_HID");
+       ACPI_FUNCTION_TRACE("ut_execute_HID");
 
-
-       status = acpi_ut_evaluate_object (device_node, METHOD_NAME__HID,
-                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
+                                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
+                                        &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                /* Convert the Numeric HID to string */
 
-               acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, hid->value);
-       }
-       else {
+               acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
+                                         hid->value);
+       else {
                /* Copy the String HID from the returned object */
 
-               acpi_ut_copy_id_string (hid->value, obj_desc->string.pointer,
-                               sizeof (hid->value));
+               acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
+                                      sizeof(hid->value));
        }
 
        /* On exit, we must delete the return object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_translate_one_cid
@@ -403,18 +378,17 @@ acpi_ut_execute_HID (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_translate_one_cid (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_compatible_id       *one_cid)
+acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
+                         struct acpi_compatible_id *one_cid)
 {
 
-
-       switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
+       switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
        case ACPI_TYPE_INTEGER:
 
                /* Convert the Numeric CID to string */
 
-               acpi_ex_eisa_id_to_string ((u32) obj_desc->integer.value, one_cid->value);
+               acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
+                                         one_cid->value);
                return (AE_OK);
 
        case ACPI_TYPE_STRING:
@@ -425,8 +399,8 @@ acpi_ut_translate_one_cid (
 
                /* Copy the String CID from the returned object */
 
-               acpi_ut_copy_id_string (one_cid->value, obj_desc->string.pointer,
-                               ACPI_MAX_CID_LENGTH);
+               acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
+                                      ACPI_MAX_CID_LENGTH);
                return (AE_OK);
 
        default:
@@ -435,7 +409,6 @@ acpi_ut_translate_one_cid (
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_execute_CID
@@ -453,45 +426,42 @@ acpi_ut_translate_one_cid (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_execute_CID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_compatible_id_list **return_cid_list)
+acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
+                   struct acpi_compatible_id_list ** return_cid_list)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-       u32                             count;
-       u32                             size;
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
+       u32 count;
+       u32 size;
        struct acpi_compatible_id_list *cid_list;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_TRACE ("ut_execute_CID");
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_TRACE("ut_execute_CID");
 
        /* Evaluate the _CID method for this device */
 
-       status = acpi_ut_evaluate_object (device_node, METHOD_NAME__CID,
-                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE,
-                        &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
+                                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
+                                        | ACPI_BTYPE_PACKAGE, &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Get the number of _CIDs returned */
 
        count = 1;
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
                count = obj_desc->package.count;
        }
 
        /* Allocate a worst-case buffer for the _CIDs */
 
-       size = (((count - 1) * sizeof (struct acpi_compatible_id)) +
-                          sizeof (struct acpi_compatible_id_list));
+       size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
+               sizeof(struct acpi_compatible_id_list));
 
-       cid_list = ACPI_MEM_CALLOCATE ((acpi_size) size);
+       cid_list = ACPI_MEM_CALLOCATE((acpi_size) size);
        if (!cid_list) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        /* Init CID list */
@@ -508,39 +478,38 @@ acpi_ut_execute_CID (
 
        /* The _CID object can be either a single CID or a package (list) of CIDs */
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
                /* Translate each package element */
 
                for (i = 0; i < count; i++) {
-                       status = acpi_ut_translate_one_cid (obj_desc->package.elements[i],
-                                         &cid_list->id[i]);
-                       if (ACPI_FAILURE (status)) {
+                       status =
+                           acpi_ut_translate_one_cid(obj_desc->package.
+                                                     elements[i],
+                                                     &cid_list->id[i]);
+                       if (ACPI_FAILURE(status)) {
                                break;
                        }
                }
-       }
-       else {
+       } else {
                /* Only one CID, translate to a string */
 
-               status = acpi_ut_translate_one_cid (obj_desc, cid_list->id);
+               status = acpi_ut_translate_one_cid(obj_desc, cid_list->id);
        }
 
        /* Cleanup on error */
 
-       if (ACPI_FAILURE (status)) {
-               ACPI_MEM_FREE (cid_list);
-       }
-       else {
+       if (ACPI_FAILURE(status)) {
+               ACPI_MEM_FREE(cid_list);
+       } else {
                *return_cid_list = cid_list;
        }
 
        /* On exit, we must delete the _CID return object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_execute_UID
@@ -558,42 +527,39 @@ acpi_ut_execute_CID (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_execute_UID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_device_id           *uid)
+acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
+                   struct acpi_device_id *uid)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ut_execute_UID");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("ut_execute_UID");
 
-       status = acpi_ut_evaluate_object (device_node, METHOD_NAME__UID,
-                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &obj_desc);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
+                                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
+                                        &obj_desc);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
-       if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
+       if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                /* Convert the Numeric UID to string */
 
-               acpi_ex_unsigned_integer_to_string (obj_desc->integer.value, uid->value);
-       }
-       else {
+               acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
+                                                  uid->value);
+       else {
                /* Copy the String UID from the returned object */
 
-               acpi_ut_copy_id_string (uid->value, obj_desc->string.pointer,
-                               sizeof (uid->value));
+               acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer,
+                                      sizeof(uid->value));
        }
 
        /* On exit, we must delete the return object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_execute_STA
@@ -611,30 +577,26 @@ acpi_ut_execute_UID (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_execute_STA (
-       struct acpi_namespace_node      *device_node,
-       u32                             *flags)
+acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
 
-       ACPI_FUNCTION_TRACE ("ut_execute_STA");
+       ACPI_FUNCTION_TRACE("ut_execute_STA");
 
-
-       status = acpi_ut_evaluate_object (device_node, METHOD_NAME__STA,
-                        ACPI_BTYPE_INTEGER, &obj_desc);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
+                                        ACPI_BTYPE_INTEGER, &obj_desc);
+       if (ACPI_FAILURE(status)) {
                if (AE_NOT_FOUND == status) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                               "_STA on %4.4s was not found, assuming device is present\n",
-                               acpi_ut_get_node_name (device_node)));
+                       ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                         "_STA on %4.4s was not found, assuming device is present\n",
+                                         acpi_ut_get_node_name(device_node)));
 
                        *flags = 0x0F;
                        status = AE_OK;
                }
 
-               return_ACPI_STATUS (status);
+               return_ACPI_STATUS(status);
        }
 
        /* Extract the status flags */
@@ -643,11 +605,10 @@ acpi_ut_execute_STA (
 
        /* On exit, we must delete the return object */
 
-       acpi_ut_remove_reference (obj_desc);
-       return_ACPI_STATUS (status);
+       acpi_ut_remove_reference(obj_desc);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_execute_Sxds
@@ -665,44 +626,45 @@ acpi_ut_execute_STA (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_execute_sxds (
-       struct acpi_namespace_node      *device_node,
-       u8                              *highest)
+acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
 {
-       union acpi_operand_object       *obj_desc;
-       acpi_status                     status;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ut_execute_Sxds");
+       union acpi_operand_object *obj_desc;
+       acpi_status status;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ut_execute_Sxds");
 
        for (i = 0; i < 4; i++) {
                highest[i] = 0xFF;
-               status = acpi_ut_evaluate_object (device_node,
-                                (char *) acpi_gbl_highest_dstate_names[i],
-                                ACPI_BTYPE_INTEGER, &obj_desc);
-               if (ACPI_FAILURE (status)) {
+               status = acpi_ut_evaluate_object(device_node,
+                                                (char *)
+                                                acpi_gbl_highest_dstate_names
+                                                [i], ACPI_BTYPE_INTEGER,
+                                                &obj_desc);
+               if (ACPI_FAILURE(status)) {
                        if (status != AE_NOT_FOUND) {
-                               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                                       "%s on Device %4.4s, %s\n",
-                                       (char *) acpi_gbl_highest_dstate_names[i],
-                                       acpi_ut_get_node_name (device_node),
-                                       acpi_format_exception (status)));
-
-                               return_ACPI_STATUS (status);
+                               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                                 "%s on Device %4.4s, %s\n",
+                                                 (char *)
+                                                 acpi_gbl_highest_dstate_names
+                                                 [i],
+                                                 acpi_ut_get_node_name
+                                                 (device_node),
+                                                 acpi_format_exception
+                                                 (status)));
+
+                               return_ACPI_STATUS(status);
                        }
-               }
-               else {
+               } else {
                        /* Extract the Dstate value */
 
                        highest[i] = (u8) obj_desc->integer.value;
 
                        /* Delete the return object */
 
-                       acpi_ut_remove_reference (obj_desc);
+                       acpi_ut_remove_reference(obj_desc);
                }
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
index 4146019b543fd8a9fe6cf776449c925eee6874b6..399e64b5188673c41eb0b7bef4bae0ece4259a64 100644 (file)
@@ -48,8 +48,7 @@
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utglobal")
-
+ACPI_MODULE_NAME("utglobal")
 
 /*******************************************************************************
  *
  * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
  *
  ******************************************************************************/
-
-const char *
-acpi_format_exception (
-       acpi_status                     status)
+const char *acpi_format_exception(acpi_status status)
 {
-       acpi_status                     sub_status;
-       const char                      *exception = NULL;
-
-
-       ACPI_FUNCTION_NAME ("format_exception");
+       acpi_status sub_status;
+       const char *exception = NULL;
 
+       ACPI_FUNCTION_NAME("format_exception");
 
        sub_status = (status & ~AE_CODE_MASK);
 
@@ -81,35 +75,39 @@ acpi_format_exception (
        case AE_CODE_ENVIRONMENTAL:
 
                if (sub_status <= AE_CODE_ENV_MAX) {
-                       exception = acpi_gbl_exception_names_env [sub_status];
+                       exception = acpi_gbl_exception_names_env[sub_status];
                }
                break;
 
        case AE_CODE_PROGRAMMER:
 
                if (sub_status <= AE_CODE_PGM_MAX) {
-                       exception = acpi_gbl_exception_names_pgm [sub_status -1];
+                       exception =
+                           acpi_gbl_exception_names_pgm[sub_status - 1];
                }
                break;
 
        case AE_CODE_ACPI_TABLES:
 
                if (sub_status <= AE_CODE_TBL_MAX) {
-                       exception = acpi_gbl_exception_names_tbl [sub_status -1];
+                       exception =
+                           acpi_gbl_exception_names_tbl[sub_status - 1];
                }
                break;
 
        case AE_CODE_AML:
 
                if (sub_status <= AE_CODE_AML_MAX) {
-                       exception = acpi_gbl_exception_names_aml [sub_status -1];
+                       exception =
+                           acpi_gbl_exception_names_aml[sub_status - 1];
                }
                break;
 
        case AE_CODE_CONTROL:
 
                if (sub_status <= AE_CODE_CTRL_MAX) {
-                       exception = acpi_gbl_exception_names_ctrl [sub_status -1];
+                       exception =
+                           acpi_gbl_exception_names_ctrl[sub_status - 1];
                }
                break;
 
@@ -120,16 +118,15 @@ acpi_format_exception (
        if (!exception) {
                /* Exception code was not recognized */
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Unknown exception code: 0x%8.8X\n", status));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unknown exception code: 0x%8.8X\n", status));
 
-               return ((const char *) "UNKNOWN_STATUS_CODE");
+               return ((const char *)"UNKNOWN_STATUS_CODE");
        }
 
-       return ((const char *) exception);
+       return ((const char *)exception);
 }
 
-
 /*******************************************************************************
  *
  * Static global variable initialization.
@@ -142,34 +139,32 @@ acpi_format_exception (
  */
 
 /* Debug switch - level and trace mask */
-u32                                 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
+u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
 EXPORT_SYMBOL(acpi_dbg_level);
 
 /* Debug switch - layer (component) mask */
 
-u32                                 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
+u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
 EXPORT_SYMBOL(acpi_dbg_layer);
-u32                                 acpi_gbl_nesting_level = 0;
-
+u32 acpi_gbl_nesting_level = 0;
 
 /* Debugger globals */
 
-u8                                  acpi_gbl_db_terminate_threads = FALSE;
-u8                                  acpi_gbl_abort_method = FALSE;
-u8                                  acpi_gbl_method_executing = FALSE;
+u8 acpi_gbl_db_terminate_threads = FALSE;
+u8 acpi_gbl_abort_method = FALSE;
+u8 acpi_gbl_method_executing = FALSE;
 
 /* System flags */
 
-u32                                 acpi_gbl_startup_flags = 0;
+u32 acpi_gbl_startup_flags = 0;
 
 /* System starts uninitialized */
 
-u8                                  acpi_gbl_shutdown = TRUE;
+u8 acpi_gbl_shutdown = TRUE;
 
-const u8                            acpi_gbl_decode_to8bit [8] = {1,2,4,8,16,32,64,128};
+const u8 acpi_gbl_decode_to8bit[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
 
-const char                          *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] =
-{
+const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT] = {
        "\\_S0_",
        "\\_S1_",
        "\\_S2_",
@@ -178,8 +173,7 @@ const char                          *acpi_gbl_sleep_state_names[ACPI_S_STATE_COU
        "\\_S5_"
 };
 
-const char                          *acpi_gbl_highest_dstate_names[4] =
-{
+const char *acpi_gbl_highest_dstate_names[4] = {
        "_S1D",
        "_S2D",
        "_S3D",
@@ -190,8 +184,7 @@ const char                          *acpi_gbl_highest_dstate_names[4] =
  * Strings supported by the _OSI predefined (internal) method.
  * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
  */
-const char                          *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] =
-{
+const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
        /* Operating System Vendor Strings */
 
        "Linux",
@@ -209,7 +202,6 @@ const char                          *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR
        "Extended Address Space Descriptor"
 };
 
-
 /*******************************************************************************
  *
  * Namespace globals
@@ -225,74 +217,70 @@ const char                          *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STR
  * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
  *    perform a Notify() operation on it.
  */
-const struct acpi_predefined_names      acpi_gbl_pre_defined_names[] =
-{ {"_GPE",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
-       {"_PR_",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
-       {"_SB_",    ACPI_TYPE_DEVICE,           NULL},
-       {"_SI_",    ACPI_TYPE_LOCAL_SCOPE,      NULL},
-       {"_TZ_",    ACPI_TYPE_THERMAL,          NULL},
-       {"_REV",    ACPI_TYPE_INTEGER,          (char *) ACPI_CA_SUPPORT_LEVEL},
-       {"_OS_",    ACPI_TYPE_STRING,           ACPI_OS_NAME},
-       {"_GL_",    ACPI_TYPE_MUTEX,            (char *) 1},
+const struct acpi_predefined_names acpi_gbl_pre_defined_names[] =
+    { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
+{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+{"_SB_", ACPI_TYPE_DEVICE, NULL},
+{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
+{"_TZ_", ACPI_TYPE_THERMAL, NULL},
+{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
+{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
+{"_GL_", ACPI_TYPE_MUTEX, (char *)1},
 
 #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
-       {"_OSI",    ACPI_TYPE_METHOD,           (char *) 1},
+{"_OSI", ACPI_TYPE_METHOD, (char *)1},
 #endif
 
        /* Table terminator */
 
-       {NULL,      ACPI_TYPE_ANY,              NULL}
+{NULL, ACPI_TYPE_ANY, NULL}
 };
 
 /*
  * Properties of the ACPI Object Types, both internal and external.
  * The table is indexed by values of acpi_object_type
  */
-const u8                                acpi_gbl_ns_properties[] =
-{
-       ACPI_NS_NORMAL,                     /* 00 Any              */
-       ACPI_NS_NORMAL,                     /* 01 Number           */
-       ACPI_NS_NORMAL,                     /* 02 String           */
-       ACPI_NS_NORMAL,                     /* 03 Buffer           */
-       ACPI_NS_NORMAL,                     /* 04 Package          */
-       ACPI_NS_NORMAL,                     /* 05 field_unit       */
-       ACPI_NS_NEWSCOPE,                   /* 06 Device           */
-       ACPI_NS_NORMAL,                     /* 07 Event            */
-       ACPI_NS_NEWSCOPE,                   /* 08 Method           */
-       ACPI_NS_NORMAL,                     /* 09 Mutex            */
-       ACPI_NS_NORMAL,                     /* 10 Region           */
-       ACPI_NS_NEWSCOPE,                   /* 11 Power            */
-       ACPI_NS_NEWSCOPE,                   /* 12 Processor        */
-       ACPI_NS_NEWSCOPE,                   /* 13 Thermal          */
-       ACPI_NS_NORMAL,                     /* 14 buffer_field     */
-       ACPI_NS_NORMAL,                     /* 15 ddb_handle       */
-       ACPI_NS_NORMAL,                     /* 16 Debug Object     */
-       ACPI_NS_NORMAL,                     /* 17 def_field        */
-       ACPI_NS_NORMAL,                     /* 18 bank_field       */
-       ACPI_NS_NORMAL,                     /* 19 index_field      */
-       ACPI_NS_NORMAL,                     /* 20 Reference        */
-       ACPI_NS_NORMAL,                     /* 21 Alias            */
-       ACPI_NS_NORMAL,                     /* 22 method_alias     */
-       ACPI_NS_NORMAL,                     /* 23 Notify           */
-       ACPI_NS_NORMAL,                     /* 24 Address Handler  */
-       ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 25 Resource Desc    */
-       ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,   /* 26 Resource Field   */
-       ACPI_NS_NEWSCOPE,                   /* 27 Scope            */
-       ACPI_NS_NORMAL,                     /* 28 Extra            */
-       ACPI_NS_NORMAL,                     /* 29 Data             */
-       ACPI_NS_NORMAL                      /* 30 Invalid          */
+const u8 acpi_gbl_ns_properties[] = {
+       ACPI_NS_NORMAL,         /* 00 Any              */
+       ACPI_NS_NORMAL,         /* 01 Number           */
+       ACPI_NS_NORMAL,         /* 02 String           */
+       ACPI_NS_NORMAL,         /* 03 Buffer           */
+       ACPI_NS_NORMAL,         /* 04 Package          */
+       ACPI_NS_NORMAL,         /* 05 field_unit       */
+       ACPI_NS_NEWSCOPE,       /* 06 Device           */
+       ACPI_NS_NORMAL,         /* 07 Event            */
+       ACPI_NS_NEWSCOPE,       /* 08 Method           */
+       ACPI_NS_NORMAL,         /* 09 Mutex            */
+       ACPI_NS_NORMAL,         /* 10 Region           */
+       ACPI_NS_NEWSCOPE,       /* 11 Power            */
+       ACPI_NS_NEWSCOPE,       /* 12 Processor        */
+       ACPI_NS_NEWSCOPE,       /* 13 Thermal          */
+       ACPI_NS_NORMAL,         /* 14 buffer_field     */
+       ACPI_NS_NORMAL,         /* 15 ddb_handle       */
+       ACPI_NS_NORMAL,         /* 16 Debug Object     */
+       ACPI_NS_NORMAL,         /* 17 def_field        */
+       ACPI_NS_NORMAL,         /* 18 bank_field       */
+       ACPI_NS_NORMAL,         /* 19 index_field      */
+       ACPI_NS_NORMAL,         /* 20 Reference        */
+       ACPI_NS_NORMAL,         /* 21 Alias            */
+       ACPI_NS_NORMAL,         /* 22 method_alias     */
+       ACPI_NS_NORMAL,         /* 23 Notify           */
+       ACPI_NS_NORMAL,         /* 24 Address Handler  */
+       ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,       /* 25 Resource Desc    */
+       ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL,       /* 26 Resource Field   */
+       ACPI_NS_NEWSCOPE,       /* 27 Scope            */
+       ACPI_NS_NORMAL,         /* 28 Extra            */
+       ACPI_NS_NORMAL,         /* 29 Data             */
+       ACPI_NS_NORMAL          /* 30 Invalid          */
 };
 
-
 /* Hex to ASCII conversion table */
 
-static const char                   acpi_gbl_hex_to_ascii[] =
-{
-       '0','1','2','3','4','5','6','7',
-       '8','9','A','B','C','D','E','F'
+static const char acpi_gbl_hex_to_ascii[] = {
+       '0', '1', '2', '3', '4', '5', '6', '7',
+       '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
 };
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_hex_to_ascii_char
@@ -307,16 +295,12 @@ static const char                   acpi_gbl_hex_to_ascii[] =
  *
  ******************************************************************************/
 
-char
-acpi_ut_hex_to_ascii_char (
-       acpi_integer                    integer,
-       u32                             position)
+char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
 {
 
        return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]);
 }
 
-
 /*******************************************************************************
  *
  * Table name globals
@@ -330,67 +314,139 @@ acpi_ut_hex_to_ascii_char (
  *
  ******************************************************************************/
 
-struct acpi_table_list              acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
+struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
 
-struct acpi_table_support           acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] =
-{
+struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = {
        /***********    Name,   Signature, Global typed pointer     Signature size,      Type                  How many allowed?,    Contains valid AML? */
 
-       /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL,                    sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT     | ACPI_TABLE_SINGLE},
-       /* DSDT 1 */ {DSDT_SIG,  DSDT_SIG, (void *) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE   | ACPI_TABLE_EXECUTABLE},
-       /* FADT 2 */ {FADT_SIG,  FADT_SIG, (void *) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_SINGLE},
-       /* FACS 3 */ {FACS_SIG,  FACS_SIG, (void *) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
-       /* PSDT 4 */ {PSDT_SIG,  PSDT_SIG, NULL,                    sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
-       /* SSDT 5 */ {SSDT_SIG,  SSDT_SIG, NULL,                    sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY  | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
-       /* XSDT 6 */ {XSDT_SIG,  XSDT_SIG, NULL,                    sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT     | ACPI_TABLE_SINGLE},
+       /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
+                     ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
+       ,
+       /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *)&acpi_gbl_DSDT,
+                     sizeof(DSDT_SIG) - 1,
+                     ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE |
+                     ACPI_TABLE_EXECUTABLE}
+       ,
+       /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *)&acpi_gbl_FADT,
+                     sizeof(FADT_SIG) - 1,
+                     ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE}
+       ,
+       /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *)&acpi_gbl_FACS,
+                     sizeof(FACS_SIG) - 1,
+                     ACPI_TABLE_SECONDARY | ACPI_TABLE_SINGLE}
+       ,
+       /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof(PSDT_SIG) - 1,
+                     ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
+                     ACPI_TABLE_EXECUTABLE}
+       ,
+       /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof(SSDT_SIG) - 1,
+                     ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE |
+                     ACPI_TABLE_EXECUTABLE}
+       ,
+       /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof(RSDT_SIG) - 1,
+                     ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE}
+       ,
 };
 
-
 /******************************************************************************
  *
  * Event and Hardware globals
  *
  ******************************************************************************/
 
-struct acpi_bit_register_info       acpi_gbl_bit_register_info[ACPI_NUM_BITREG] =
-{
+struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
        /* Name                                     Parent Register             Register Bit Position                   Register Bit Mask       */
 
-       /* ACPI_BITREG_TIMER_STATUS         */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_TIMER_STATUS,          ACPI_BITMASK_TIMER_STATUS},
-       /* ACPI_BITREG_BUS_MASTER_STATUS    */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_BUS_MASTER_STATUS,     ACPI_BITMASK_BUS_MASTER_STATUS},
-       /* ACPI_BITREG_GLOBAL_LOCK_STATUS   */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_STATUS},
-       /* ACPI_BITREG_POWER_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_STATUS},
-       /* ACPI_BITREG_SLEEP_BUTTON_STATUS  */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_STATUS},
-       /* ACPI_BITREG_RT_CLOCK_STATUS      */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_RT_CLOCK_STATUS,       ACPI_BITMASK_RT_CLOCK_STATUS},
-       /* ACPI_BITREG_WAKE_STATUS          */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_WAKE_STATUS,           ACPI_BITMASK_WAKE_STATUS},
-       /* ACPI_BITREG_PCIEXP_WAKE_STATUS   */   {ACPI_REGISTER_PM1_STATUS,   ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,    ACPI_BITMASK_PCIEXP_WAKE_STATUS},
-
-       /* ACPI_BITREG_TIMER_ENABLE         */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_TIMER_ENABLE,          ACPI_BITMASK_TIMER_ENABLE},
-       /* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
-       /* ACPI_BITREG_POWER_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_POWER_BUTTON_ENABLE,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
-       /* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
-       /* ACPI_BITREG_RT_CLOCK_ENABLE      */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_RT_CLOCK_ENABLE,       ACPI_BITMASK_RT_CLOCK_ENABLE},
-       /* ACPI_BITREG_WAKE_ENABLE          */   {ACPI_REGISTER_PM1_ENABLE,   0,                                      0},
-       /* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */   {ACPI_REGISTER_PM1_ENABLE,   ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,   ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
-
-       /* ACPI_BITREG_SCI_ENABLE           */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SCI_ENABLE,            ACPI_BITMASK_SCI_ENABLE},
-       /* ACPI_BITREG_BUS_MASTER_RLD       */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_BUS_MASTER_RLD,        ACPI_BITMASK_BUS_MASTER_RLD},
-       /* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,   ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
-       /* ACPI_BITREG_SLEEP_TYPE_A         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
-       /* ACPI_BITREG_SLEEP_TYPE_B         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_TYPE_X,          ACPI_BITMASK_SLEEP_TYPE_X},
-       /* ACPI_BITREG_SLEEP_ENABLE         */   {ACPI_REGISTER_PM1_CONTROL,  ACPI_BITPOSITION_SLEEP_ENABLE,          ACPI_BITMASK_SLEEP_ENABLE},
-
-       /* ACPI_BITREG_ARB_DIS              */   {ACPI_REGISTER_PM2_CONTROL,  ACPI_BITPOSITION_ARB_DISABLE,           ACPI_BITMASK_ARB_DISABLE}
+       /* ACPI_BITREG_TIMER_STATUS         */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_TIMER_STATUS,
+                                               ACPI_BITMASK_TIMER_STATUS},
+       /* ACPI_BITREG_BUS_MASTER_STATUS    */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_BUS_MASTER_STATUS,
+                                               ACPI_BITMASK_BUS_MASTER_STATUS},
+       /* ACPI_BITREG_GLOBAL_LOCK_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_GLOBAL_LOCK_STATUS,
+                                               ACPI_BITMASK_GLOBAL_LOCK_STATUS},
+       /* ACPI_BITREG_POWER_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_POWER_BUTTON_STATUS,
+                                               ACPI_BITMASK_POWER_BUTTON_STATUS},
+       /* ACPI_BITREG_SLEEP_BUTTON_STATUS  */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_SLEEP_BUTTON_STATUS,
+                                               ACPI_BITMASK_SLEEP_BUTTON_STATUS},
+       /* ACPI_BITREG_RT_CLOCK_STATUS      */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_RT_CLOCK_STATUS,
+                                               ACPI_BITMASK_RT_CLOCK_STATUS},
+       /* ACPI_BITREG_WAKE_STATUS          */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_WAKE_STATUS,
+                                               ACPI_BITMASK_WAKE_STATUS},
+       /* ACPI_BITREG_PCIEXP_WAKE_STATUS   */ {ACPI_REGISTER_PM1_STATUS,
+                                               ACPI_BITPOSITION_PCIEXP_WAKE_STATUS,
+                                               ACPI_BITMASK_PCIEXP_WAKE_STATUS},
+
+       /* ACPI_BITREG_TIMER_ENABLE         */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_TIMER_ENABLE,
+                                               ACPI_BITMASK_TIMER_ENABLE},
+       /* ACPI_BITREG_GLOBAL_LOCK_ENABLE   */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE,
+                                               ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+       /* ACPI_BITREG_POWER_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_POWER_BUTTON_ENABLE,
+                                               ACPI_BITMASK_POWER_BUTTON_ENABLE},
+       /* ACPI_BITREG_SLEEP_BUTTON_ENABLE  */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE,
+                                               ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+       /* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_RT_CLOCK_ENABLE,
+                                               ACPI_BITMASK_RT_CLOCK_ENABLE},
+       /* ACPI_BITREG_WAKE_ENABLE          */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
+       /* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
+                                               ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
+                                               ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
+
+       /* ACPI_BITREG_SCI_ENABLE           */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_SCI_ENABLE,
+                                               ACPI_BITMASK_SCI_ENABLE},
+       /* ACPI_BITREG_BUS_MASTER_RLD       */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_BUS_MASTER_RLD,
+                                               ACPI_BITMASK_BUS_MASTER_RLD},
+       /* ACPI_BITREG_GLOBAL_LOCK_RELEASE  */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
+                                               ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
+       /* ACPI_BITREG_SLEEP_TYPE_A         */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_SLEEP_TYPE_X,
+                                               ACPI_BITMASK_SLEEP_TYPE_X},
+       /* ACPI_BITREG_SLEEP_TYPE_B         */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_SLEEP_TYPE_X,
+                                               ACPI_BITMASK_SLEEP_TYPE_X},
+       /* ACPI_BITREG_SLEEP_ENABLE         */ {ACPI_REGISTER_PM1_CONTROL,
+                                               ACPI_BITPOSITION_SLEEP_ENABLE,
+                                               ACPI_BITMASK_SLEEP_ENABLE},
+
+       /* ACPI_BITREG_ARB_DIS              */ {ACPI_REGISTER_PM2_CONTROL,
+                                               ACPI_BITPOSITION_ARB_DISABLE,
+                                               ACPI_BITMASK_ARB_DISABLE}
 };
 
-
-struct acpi_fixed_event_info        acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
-{
-       /* ACPI_EVENT_PMTIMER       */  {ACPI_BITREG_TIMER_STATUS,          ACPI_BITREG_TIMER_ENABLE,        ACPI_BITMASK_TIMER_STATUS,          ACPI_BITMASK_TIMER_ENABLE},
-       /* ACPI_EVENT_GLOBAL        */  {ACPI_BITREG_GLOBAL_LOCK_STATUS,    ACPI_BITREG_GLOBAL_LOCK_ENABLE,  ACPI_BITMASK_GLOBAL_LOCK_STATUS,    ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
-       /* ACPI_EVENT_POWER_BUTTON  */  {ACPI_BITREG_POWER_BUTTON_STATUS,   ACPI_BITREG_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_STATUS,   ACPI_BITMASK_POWER_BUTTON_ENABLE},
-       /* ACPI_EVENT_SLEEP_BUTTON  */  {ACPI_BITREG_SLEEP_BUTTON_STATUS,   ACPI_BITREG_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_STATUS,   ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
-       /* ACPI_EVENT_RTC           */  {ACPI_BITREG_RT_CLOCK_STATUS,       ACPI_BITREG_RT_CLOCK_ENABLE,     ACPI_BITMASK_RT_CLOCK_STATUS,       ACPI_BITMASK_RT_CLOCK_ENABLE},
+struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = {
+       /* ACPI_EVENT_PMTIMER       */ {ACPI_BITREG_TIMER_STATUS,
+                                       ACPI_BITREG_TIMER_ENABLE,
+                                       ACPI_BITMASK_TIMER_STATUS,
+                                       ACPI_BITMASK_TIMER_ENABLE},
+       /* ACPI_EVENT_GLOBAL        */ {ACPI_BITREG_GLOBAL_LOCK_STATUS,
+                                       ACPI_BITREG_GLOBAL_LOCK_ENABLE,
+                                       ACPI_BITMASK_GLOBAL_LOCK_STATUS,
+                                       ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
+       /* ACPI_EVENT_POWER_BUTTON  */ {ACPI_BITREG_POWER_BUTTON_STATUS,
+                                       ACPI_BITREG_POWER_BUTTON_ENABLE,
+                                       ACPI_BITMASK_POWER_BUTTON_STATUS,
+                                       ACPI_BITMASK_POWER_BUTTON_ENABLE},
+       /* ACPI_EVENT_SLEEP_BUTTON  */ {ACPI_BITREG_SLEEP_BUTTON_STATUS,
+                                       ACPI_BITREG_SLEEP_BUTTON_ENABLE,
+                                       ACPI_BITMASK_SLEEP_BUTTON_STATUS,
+                                       ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
+       /* ACPI_EVENT_RTC           */ {ACPI_BITREG_RT_CLOCK_STATUS,
+                                       ACPI_BITREG_RT_CLOCK_ENABLE,
+                                       ACPI_BITMASK_RT_CLOCK_STATUS,
+                                       ACPI_BITMASK_RT_CLOCK_ENABLE},
 };
 
 /*******************************************************************************
@@ -407,8 +463,7 @@ struct acpi_fixed_event_info        acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVE
 
 /* Region type decoding */
 
-const char                *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
-{
+const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
 /*! [Begin] no source code translation (keep these ASL Keywords as-is) */
        "SystemMemory",
        "SystemIO",
@@ -421,25 +476,18 @@ const char                *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] =
 /*! [End] no source code translation !*/
 };
 
-
-char *
-acpi_ut_get_region_name (
-       u8                              space_id)
+char *acpi_ut_get_region_name(u8 space_id)
 {
 
-       if (space_id >= ACPI_USER_REGION_BEGIN)
-       {
+       if (space_id >= ACPI_USER_REGION_BEGIN) {
                return ("user_defined_region");
-       }
-       else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS)
-       {
+       } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
                return ("invalid_space_id");
        }
 
-       return ((char *) acpi_gbl_region_types[space_id]);
+       return ((char *)acpi_gbl_region_types[space_id]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_event_name
@@ -454,8 +502,7 @@ acpi_ut_get_region_name (
 
 /* Event type decoding */
 
-static const char                *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] =
-{
+static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
        "PM_Timer",
        "global_lock",
        "power_button",
@@ -463,21 +510,16 @@ static const char                *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] =
        "real_time_clock",
 };
 
-
-char *
-acpi_ut_get_event_name (
-       u32                             event_id)
+char *acpi_ut_get_event_name(u32 event_id)
 {
 
-       if (event_id > ACPI_EVENT_MAX)
-       {
+       if (event_id > ACPI_EVENT_MAX) {
                return ("invalid_event_iD");
        }
 
-       return ((char *) acpi_gbl_event_types[event_id]);
+       return ((char *)acpi_gbl_event_types[event_id]);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_type_name
@@ -498,12 +540,11 @@ acpi_ut_get_event_name (
  * when stored in a table it really means that we have thus far seen no
  * evidence to indicate what type is actually going to be stored for this entry.
  */
-static const char                   acpi_gbl_bad_type[] = "UNDEFINED";
+static const char acpi_gbl_bad_type[] = "UNDEFINED";
 
 /* Printable names of the ACPI object types */
 
-static const char                   *acpi_gbl_ns_type_names[] =
-{
+static const char *acpi_gbl_ns_type_names[] = {
        /* 00 */ "Untyped",
        /* 01 */ "Integer",
        /* 02 */ "String",
@@ -537,35 +578,26 @@ static const char                   *acpi_gbl_ns_type_names[] =
        /* 30 */ "Invalid"
 };
 
-
-char *
-acpi_ut_get_type_name (
-       acpi_object_type                type)
+char *acpi_ut_get_type_name(acpi_object_type type)
 {
 
-       if (type > ACPI_TYPE_INVALID)
-       {
-               return ((char *) acpi_gbl_bad_type);
+       if (type > ACPI_TYPE_INVALID) {
+               return ((char *)acpi_gbl_bad_type);
        }
 
-       return ((char *) acpi_gbl_ns_type_names[type]);
+       return ((char *)acpi_gbl_ns_type_names[type]);
 }
 
-
-char *
-acpi_ut_get_object_type_name (
-       union acpi_operand_object       *obj_desc)
+char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
 {
 
-       if (!obj_desc)
-       {
+       if (!obj_desc) {
                return ("[NULL Object Descriptor]");
        }
 
-       return (acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)));
+       return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_node_name
@@ -578,39 +610,31 @@ acpi_ut_get_object_type_name (
  *
  ******************************************************************************/
 
-char *
-acpi_ut_get_node_name (
-       void                            *object)
+char *acpi_ut_get_node_name(void *object)
 {
-       struct acpi_namespace_node      *node = (struct acpi_namespace_node *) object;
-
+       struct acpi_namespace_node *node = (struct acpi_namespace_node *)object;
 
        /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
 
-       if (!object)
-       {
+       if (!object) {
                return ("NULL");
        }
 
        /* Check for Root node */
 
-       if ((object == ACPI_ROOT_OBJECT) ||
-               (object == acpi_gbl_root_node))
-       {
+       if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) {
                return ("\"\\\" ");
        }
 
        /* Descriptor must be a namespace node */
 
-       if (node->descriptor != ACPI_DESC_TYPE_NAMED)
-       {
+       if (node->descriptor != ACPI_DESC_TYPE_NAMED) {
                return ("####");
        }
 
        /* Name must be a valid ACPI name */
 
-       if (!acpi_ut_valid_acpi_name (* (u32 *) node->name.ascii))
-       {
+       if (!acpi_ut_valid_acpi_name(*(u32 *) node->name.ascii)) {
                return ("????");
        }
 
@@ -619,7 +643,6 @@ acpi_ut_get_node_name (
        return (node->name.ascii);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_descriptor_name
@@ -634,8 +657,7 @@ acpi_ut_get_node_name (
 
 /* Printable names of object descriptor types */
 
-static const char                   *acpi_gbl_desc_type_names[] =
-{
+static const char *acpi_gbl_desc_type_names[] = {
        /* 00 */ "Invalid",
        /* 01 */ "Cached",
        /* 02 */ "State-Generic",
@@ -654,27 +676,22 @@ static const char                   *acpi_gbl_desc_type_names[] =
        /* 15 */ "Node"
 };
 
-
-char *
-acpi_ut_get_descriptor_name (
-       void                            *object)
+char *acpi_ut_get_descriptor_name(void *object)
 {
 
-       if (!object)
-       {
+       if (!object) {
                return ("NULL OBJECT");
        }
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (object) > ACPI_DESC_TYPE_MAX)
-       {
-               return ((char *) acpi_gbl_bad_type);
+       if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
+               return ((char *)acpi_gbl_bad_type);
        }
 
-       return ((char *) acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE (object)]);
+       return ((char *)
+               acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]);
 
 }
 
-
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 /*
  * Strings and procedures used for debug only
@@ -693,13 +710,10 @@ acpi_ut_get_descriptor_name (
  *
  ******************************************************************************/
 
-char *
-acpi_ut_get_mutex_name (
-       u32                             mutex_id)
+char *acpi_ut_get_mutex_name(u32 mutex_id)
 {
 
-       if (mutex_id > MAX_MUTEX)
-       {
+       if (mutex_id > MAX_MUTEX) {
                return ("Invalid Mutex ID");
        }
 
@@ -707,7 +721,6 @@ acpi_ut_get_mutex_name (
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_object_type
@@ -720,13 +733,10 @@ acpi_ut_get_mutex_name (
  *
  ******************************************************************************/
 
-u8
-acpi_ut_valid_object_type (
-       acpi_object_type                type)
+u8 acpi_ut_valid_object_type(acpi_object_type type)
 {
 
-       if (type > ACPI_TYPE_LOCAL_MAX)
-       {
+       if (type > ACPI_TYPE_LOCAL_MAX) {
                /* Note: Assumes all TYPEs are contiguous (external/local) */
 
                return (FALSE);
@@ -735,74 +745,6 @@ acpi_ut_valid_object_type (
        return (TRUE);
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_allocate_owner_id
- *
- * PARAMETERS:  id_type         - Type of ID (method or table)
- *
- * DESCRIPTION: Allocate a table or method owner id
- *
- * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
- *       should be revisited (TBD)
- *
- ******************************************************************************/
-
-acpi_owner_id
-acpi_ut_allocate_owner_id (
-       u32                             id_type)
-{
-       acpi_owner_id                   owner_id = 0xFFFF;
-
-
-       ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
-
-
-       if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES)))
-       {
-               return (0);
-       }
-
-       switch (id_type)
-       {
-       case ACPI_OWNER_TYPE_TABLE:
-
-               owner_id = acpi_gbl_next_table_owner_id;
-               acpi_gbl_next_table_owner_id++;
-
-               /* Check for wraparound */
-
-               if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
-               {
-                       acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
-                       ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
-               }
-               break;
-
-
-       case ACPI_OWNER_TYPE_METHOD:
-
-               owner_id = acpi_gbl_next_method_owner_id;
-               acpi_gbl_next_method_owner_id++;
-
-               if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
-               {
-                       /* Check for wraparound */
-
-                       acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
-               }
-               break;
-
-       default:
-               break;
-       }
-
-       (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
-       return_VALUE (owner_id);
-}
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_init_globals
@@ -816,129 +758,96 @@ acpi_ut_allocate_owner_id (
  *
  ******************************************************************************/
 
-void
-acpi_ut_init_globals (
-       void)
+void acpi_ut_init_globals(void)
 {
-       u32                             i;
+       acpi_status status;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("ut_init_globals");
 
-       ACPI_FUNCTION_TRACE ("ut_init_globals");
+       /* Create all memory caches */
 
-
-       /* Memory allocation and cache lists */
-
-       ACPI_MEMSET (acpi_gbl_memory_lists, 0, sizeof (struct acpi_memory_list) * ACPI_NUM_MEM_LISTS);
-
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].link_offset      = (u16) ACPI_PTR_DIFF (&(((union acpi_generic_state *) NULL)->common.next), NULL);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].link_offset     = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].link_offset = (u16) ACPI_PTR_DIFF (&(((union acpi_parse_object *) NULL)->common.next), NULL);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].link_offset    = (u16) ACPI_PTR_DIFF (&(((union acpi_operand_object *) NULL)->cache.next), NULL);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].link_offset       = (u16) ACPI_PTR_DIFF (&(((struct acpi_walk_state *) NULL)->next), NULL);
-
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].object_size     = sizeof (struct acpi_namespace_node);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].object_size      = sizeof (union acpi_generic_state);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].object_size     = sizeof (struct acpi_parse_obj_common);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].object_size = sizeof (struct acpi_parse_obj_named);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].object_size    = sizeof (union acpi_operand_object);
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].object_size       = sizeof (struct acpi_walk_state);
-
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].max_cache_depth  = ACPI_MAX_STATE_CACHE_DEPTH;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].max_cache_depth = ACPI_MAX_PARSE_CACHE_DEPTH;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].max_cache_depth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].max_cache_depth = ACPI_MAX_OBJECT_CACHE_DEPTH;
-       acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].max_cache_depth   = ACPI_MAX_WALK_CACHE_DEPTH;
-
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].list_name    = "Global Memory Allocation");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].list_name    = "Namespace Nodes");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_STATE].list_name     = "State Object Cache");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE].list_name    = "Parse Node Cache");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_PSNODE_EXT].list_name = "Extended Parse Node Cache");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_OPERAND].list_name   = "Operand Object Cache");
-       ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_WALK].list_name      = "Tree Walk Node Cache");
+       status = acpi_ut_create_caches();
+       if (ACPI_FAILURE(status)) {
+               return;
+       }
 
        /* ACPI table structure */
 
-       for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
-       {
-               acpi_gbl_table_lists[i].next        = NULL;
-               acpi_gbl_table_lists[i].count       = 0;
+       for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) {
+               acpi_gbl_table_lists[i].next = NULL;
+               acpi_gbl_table_lists[i].count = 0;
        }
 
        /* Mutex locked flags */
 
-       for (i = 0; i < NUM_MUTEX; i++)
-       {
-               acpi_gbl_mutex_info[i].mutex        = NULL;
-               acpi_gbl_mutex_info[i].owner_id     = ACPI_MUTEX_NOT_ACQUIRED;
-               acpi_gbl_mutex_info[i].use_count    = 0;
+       for (i = 0; i < NUM_MUTEX; i++) {
+               acpi_gbl_mutex_info[i].mutex = NULL;
+               acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
+               acpi_gbl_mutex_info[i].use_count = 0;
        }
 
        /* GPE support */
 
-       acpi_gbl_gpe_xrupt_list_head        = NULL;
-       acpi_gbl_gpe_fadt_blocks[0]         = NULL;
-       acpi_gbl_gpe_fadt_blocks[1]         = NULL;
+       acpi_gbl_gpe_xrupt_list_head = NULL;
+       acpi_gbl_gpe_fadt_blocks[0] = NULL;
+       acpi_gbl_gpe_fadt_blocks[1] = NULL;
 
        /* Global notify handlers */
 
-       acpi_gbl_system_notify.handler      = NULL;
-       acpi_gbl_device_notify.handler      = NULL;
-       acpi_gbl_exception_handler          = NULL;
-       acpi_gbl_init_handler               = NULL;
+       acpi_gbl_system_notify.handler = NULL;
+       acpi_gbl_device_notify.handler = NULL;
+       acpi_gbl_exception_handler = NULL;
+       acpi_gbl_init_handler = NULL;
 
        /* Global "typed" ACPI table pointers */
 
-       acpi_gbl_RSDP                       = NULL;
-       acpi_gbl_XSDT                       = NULL;
-       acpi_gbl_FACS                       = NULL;
-       acpi_gbl_FADT                       = NULL;
-       acpi_gbl_DSDT                       = NULL;
+       acpi_gbl_RSDP = NULL;
+       acpi_gbl_XSDT = NULL;
+       acpi_gbl_FACS = NULL;
+       acpi_gbl_FADT = NULL;
+       acpi_gbl_DSDT = NULL;
 
        /* Global Lock support */
 
-       acpi_gbl_global_lock_acquired       = FALSE;
-       acpi_gbl_global_lock_thread_count   = 0;
-       acpi_gbl_global_lock_handle         = 0;
+       acpi_gbl_global_lock_acquired = FALSE;
+       acpi_gbl_global_lock_thread_count = 0;
+       acpi_gbl_global_lock_handle = 0;
 
        /* Miscellaneous variables */
 
-       acpi_gbl_table_flags                = ACPI_PHYSICAL_POINTER;
-       acpi_gbl_rsdp_original_location     = 0;
-       acpi_gbl_cm_single_step             = FALSE;
-       acpi_gbl_db_terminate_threads       = FALSE;
-       acpi_gbl_shutdown                   = FALSE;
-       acpi_gbl_ns_lookup_count            = 0;
-       acpi_gbl_ps_find_count              = 0;
-       acpi_gbl_acpi_hardware_present      = TRUE;
-       acpi_gbl_next_table_owner_id        = ACPI_FIRST_TABLE_ID;
-       acpi_gbl_next_method_owner_id       = ACPI_FIRST_METHOD_ID;
-       acpi_gbl_debugger_configuration     = DEBUGGER_THREADING;
-       acpi_gbl_db_output_flags            = ACPI_DB_CONSOLE_OUTPUT;
+       acpi_gbl_table_flags = ACPI_PHYSICAL_POINTER;
+       acpi_gbl_rsdp_original_location = 0;
+       acpi_gbl_cm_single_step = FALSE;
+       acpi_gbl_db_terminate_threads = FALSE;
+       acpi_gbl_shutdown = FALSE;
+       acpi_gbl_ns_lookup_count = 0;
+       acpi_gbl_ps_find_count = 0;
+       acpi_gbl_acpi_hardware_present = TRUE;
+       acpi_gbl_owner_id_mask = 0;
+       acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
+       acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
 
        /* Hardware oriented */
 
-       acpi_gbl_events_initialized         = FALSE;
-       acpi_gbl_system_awake_and_running   = TRUE;
+       acpi_gbl_events_initialized = FALSE;
+       acpi_gbl_system_awake_and_running = TRUE;
 
        /* Namespace */
 
-       acpi_gbl_root_node                  = NULL;
+       acpi_gbl_root_node = NULL;
 
        acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
        acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED;
-       acpi_gbl_root_node_struct.type      = ACPI_TYPE_DEVICE;
-       acpi_gbl_root_node_struct.child     = NULL;
-       acpi_gbl_root_node_struct.peer      = NULL;
-       acpi_gbl_root_node_struct.object    = NULL;
-       acpi_gbl_root_node_struct.flags     = ANOBJ_END_OF_PEER_LIST;
-
+       acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
+       acpi_gbl_root_node_struct.child = NULL;
+       acpi_gbl_root_node_struct.peer = NULL;
+       acpi_gbl_root_node_struct.object = NULL;
+       acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST;
 
 #ifdef ACPI_DEBUG_OUTPUT
-       acpi_gbl_lowest_stack_pointer       = ACPI_SIZE_MAX;
+       acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX;
 #endif
 
        return_VOID;
 }
-
-
index 7f3713889ff02eae471ec94d1c59097728345f75..9dde82b0beaf537f33a9d6a5612234b157d646ca 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utinit")
+ACPI_MODULE_NAME("utinit")
 
 /* Local prototypes */
-
 static void
-acpi_ut_fadt_register_error (
-       char                            *register_name,
-       u32                             value,
-       acpi_size                       offset);
-
-static void acpi_ut_terminate (
-       void);
+acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset);
 
+static void acpi_ut_terminate(void);
 
 /*******************************************************************************
  *
@@ -76,18 +69,14 @@ static void acpi_ut_terminate (
  ******************************************************************************/
 
 static void
-acpi_ut_fadt_register_error (
-       char                            *register_name,
-       u32                             value,
-       acpi_size                       offset)
+acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
 {
 
-       ACPI_REPORT_WARNING (
-               ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
-               register_name, value, (u32) offset, acpi_gbl_FADT));
+       ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n",
+                            register_name, value, (u32) offset,
+                            acpi_gbl_FADT));
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ut_validate_fadt
@@ -100,9 +89,7 @@ acpi_ut_fadt_register_error (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_ut_validate_fadt (
-       void)
+acpi_status acpi_ut_validate_fadt(void)
 {
 
        /*
@@ -110,64 +97,66 @@ acpi_ut_validate_fadt (
         * but don't abort on any problems, just display error
         */
        if (acpi_gbl_FADT->pm1_evt_len < 4) {
-               acpi_ut_fadt_register_error ("PM1_EVT_LEN",
-                                 (u32) acpi_gbl_FADT->pm1_evt_len,
-                                 ACPI_FADT_OFFSET (pm1_evt_len));
+               acpi_ut_fadt_register_error("PM1_EVT_LEN",
+                                           (u32) acpi_gbl_FADT->pm1_evt_len,
+                                           ACPI_FADT_OFFSET(pm1_evt_len));
        }
 
        if (!acpi_gbl_FADT->pm1_cnt_len) {
-               acpi_ut_fadt_register_error ("PM1_CNT_LEN", 0,
-                                 ACPI_FADT_OFFSET (pm1_cnt_len));
+               acpi_ut_fadt_register_error("PM1_CNT_LEN", 0,
+                                           ACPI_FADT_OFFSET(pm1_cnt_len));
        }
 
        if (!acpi_gbl_FADT->xpm1a_evt_blk.address) {
-               acpi_ut_fadt_register_error ("X_PM1a_EVT_BLK", 0,
-                                 ACPI_FADT_OFFSET (xpm1a_evt_blk.address));
+               acpi_ut_fadt_register_error("X_PM1a_EVT_BLK", 0,
+                                           ACPI_FADT_OFFSET(xpm1a_evt_blk.
+                                                            address));
        }
 
        if (!acpi_gbl_FADT->xpm1a_cnt_blk.address) {
-               acpi_ut_fadt_register_error ("X_PM1a_CNT_BLK", 0,
-                                 ACPI_FADT_OFFSET (xpm1a_cnt_blk.address));
+               acpi_ut_fadt_register_error("X_PM1a_CNT_BLK", 0,
+                                           ACPI_FADT_OFFSET(xpm1a_cnt_blk.
+                                                            address));
        }
 
        if (!acpi_gbl_FADT->xpm_tmr_blk.address) {
-               acpi_ut_fadt_register_error ("X_PM_TMR_BLK", 0,
-                                 ACPI_FADT_OFFSET (xpm_tmr_blk.address));
+               acpi_ut_fadt_register_error("X_PM_TMR_BLK", 0,
+                                           ACPI_FADT_OFFSET(xpm_tmr_blk.
+                                                            address));
        }
 
        if ((acpi_gbl_FADT->xpm2_cnt_blk.address &&
-               !acpi_gbl_FADT->pm2_cnt_len)) {
-               acpi_ut_fadt_register_error ("PM2_CNT_LEN",
-                                 (u32) acpi_gbl_FADT->pm2_cnt_len,
-                                 ACPI_FADT_OFFSET (pm2_cnt_len));
+            !acpi_gbl_FADT->pm2_cnt_len)) {
+               acpi_ut_fadt_register_error("PM2_CNT_LEN",
+                                           (u32) acpi_gbl_FADT->pm2_cnt_len,
+                                           ACPI_FADT_OFFSET(pm2_cnt_len));
        }
 
        if (acpi_gbl_FADT->pm_tm_len < 4) {
-               acpi_ut_fadt_register_error ("PM_TM_LEN",
-                                 (u32) acpi_gbl_FADT->pm_tm_len,
-                                 ACPI_FADT_OFFSET (pm_tm_len));
+               acpi_ut_fadt_register_error("PM_TM_LEN",
+                                           (u32) acpi_gbl_FADT->pm_tm_len,
+                                           ACPI_FADT_OFFSET(pm_tm_len));
        }
 
        /* Length of GPE blocks must be a multiple of 2 */
 
        if (acpi_gbl_FADT->xgpe0_blk.address &&
-               (acpi_gbl_FADT->gpe0_blk_len & 1)) {
-               acpi_ut_fadt_register_error ("(x)GPE0_BLK_LEN",
-                                 (u32) acpi_gbl_FADT->gpe0_blk_len,
-                                 ACPI_FADT_OFFSET (gpe0_blk_len));
+           (acpi_gbl_FADT->gpe0_blk_len & 1)) {
+               acpi_ut_fadt_register_error("(x)GPE0_BLK_LEN",
+                                           (u32) acpi_gbl_FADT->gpe0_blk_len,
+                                           ACPI_FADT_OFFSET(gpe0_blk_len));
        }
 
        if (acpi_gbl_FADT->xgpe1_blk.address &&
-               (acpi_gbl_FADT->gpe1_blk_len & 1)) {
-               acpi_ut_fadt_register_error ("(x)GPE1_BLK_LEN",
-                                 (u32) acpi_gbl_FADT->gpe1_blk_len,
-                                 ACPI_FADT_OFFSET (gpe1_blk_len));
+           (acpi_gbl_FADT->gpe1_blk_len & 1)) {
+               acpi_ut_fadt_register_error("(x)GPE1_BLK_LEN",
+                                           (u32) acpi_gbl_FADT->gpe1_blk_len,
+                                           ACPI_FADT_OFFSET(gpe1_blk_len));
        }
 
        return (AE_OK);
 }
 
-
 /******************************************************************************
  *
  * FUNCTION:    acpi_ut_terminate
@@ -180,18 +169,14 @@ acpi_ut_validate_fadt (
  *
  ******************************************************************************/
 
-static void
-acpi_ut_terminate (
-       void)
+static void acpi_ut_terminate(void)
 {
-       struct acpi_gpe_block_info      *gpe_block;
-       struct acpi_gpe_block_info      *next_gpe_block;
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info;
-       struct acpi_gpe_xrupt_info      *next_gpe_xrupt_info;
-
-
-       ACPI_FUNCTION_TRACE ("ut_terminate");
+       struct acpi_gpe_block_info *gpe_block;
+       struct acpi_gpe_block_info *next_gpe_block;
+       struct acpi_gpe_xrupt_info *gpe_xrupt_info;
+       struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
 
+       ACPI_FUNCTION_TRACE("ut_terminate");
 
        /* Free global tables, etc. */
        /* Free global GPE blocks and related info structures */
@@ -201,21 +186,20 @@ acpi_ut_terminate (
                gpe_block = gpe_xrupt_info->gpe_block_list_head;
                while (gpe_block) {
                        next_gpe_block = gpe_block->next;
-                       ACPI_MEM_FREE (gpe_block->event_info);
-                       ACPI_MEM_FREE (gpe_block->register_info);
-                       ACPI_MEM_FREE (gpe_block);
+                       ACPI_MEM_FREE(gpe_block->event_info);
+                       ACPI_MEM_FREE(gpe_block->register_info);
+                       ACPI_MEM_FREE(gpe_block);
 
                        gpe_block = next_gpe_block;
                }
                next_gpe_xrupt_info = gpe_xrupt_info->next;
-               ACPI_MEM_FREE (gpe_xrupt_info);
+               ACPI_MEM_FREE(gpe_xrupt_info);
                gpe_xrupt_info = next_gpe_xrupt_info;
        }
 
        return_VOID;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_subsystem_shutdown
@@ -229,50 +213,45 @@ acpi_ut_terminate (
  *
  ******************************************************************************/
 
-void
-acpi_ut_subsystem_shutdown (
-       void)
+void acpi_ut_subsystem_shutdown(void)
 {
 
-       ACPI_FUNCTION_TRACE ("ut_subsystem_shutdown");
+       ACPI_FUNCTION_TRACE("ut_subsystem_shutdown");
 
        /* Just exit if subsystem is already shutdown */
 
        if (acpi_gbl_shutdown) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "ACPI Subsystem is already terminated\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "ACPI Subsystem is already terminated\n"));
                return_VOID;
        }
 
        /* Subsystem appears active, go ahead and shut it down */
 
        acpi_gbl_shutdown = TRUE;
-       ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-               "Shutting down ACPI Subsystem...\n"));
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
 
        /* Close the acpi_event Handling */
 
-       acpi_ev_terminate ();
+       acpi_ev_terminate();
 
        /* Close the Namespace */
 
-       acpi_ns_terminate ();
+       acpi_ns_terminate();
 
        /* Close the globals */
 
-       acpi_ut_terminate ();
+       acpi_ut_terminate();
 
        /* Purge the local caches */
 
-       (void) acpi_purge_cached_objects ();
+       (void)acpi_ut_delete_caches();
 
        /* Debug only - display leftover memory allocation, if any */
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
-       acpi_ut_dump_allocations (ACPI_UINT32_MAX, NULL);
+       acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
 #endif
 
        return_VOID;
 }
-
-
index 0d527c91543cbcbb3d202d1e92e8cf9d28f8aed9..68a0a6f94129845e401e43557326b04d524b7178 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 
-
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utmath")
+ACPI_MODULE_NAME("utmath")
 
 /*
  * Support for double-precision integer divide.  This code is included here
  * in order to support kernel environments where the double-precision math
  * library is not available.
  */
-
 #ifndef ACPI_USE_NATIVE_DIVIDE
 /*******************************************************************************
  *
  *              32-bit remainder.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ut_short_divide (
-       acpi_integer                    dividend,
-       u32                             divisor,
-       acpi_integer                    *out_quotient,
-       u32                             *out_remainder)
+acpi_ut_short_divide(acpi_integer dividend,
+                    u32 divisor,
+                    acpi_integer * out_quotient, u32 * out_remainder)
 {
-       union uint64_overlay            dividend_ovl;
-       union uint64_overlay            quotient;
-       u32                             remainder32;
-
-
-       ACPI_FUNCTION_TRACE ("ut_short_divide");
+       union uint64_overlay dividend_ovl;
+       union uint64_overlay quotient;
+       u32 remainder32;
 
+       ACPI_FUNCTION_TRACE("ut_short_divide");
 
        /* Always check for a zero divisor */
 
        if (divisor == 0) {
-               ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n"));
-               return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+               ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n"));
+               return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
        }
 
        dividend_ovl.full = dividend;
@@ -100,9 +92,9 @@ acpi_ut_short_divide (
         * The quotient is 64 bits, the remainder is always 32 bits,
         * and is generated by the second divide.
         */
-       ACPI_DIV_64_BY_32 (0, dividend_ovl.part.hi, divisor,
+       ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor,
                          quotient.part.hi, remainder32);
-       ACPI_DIV_64_BY_32 (remainder32, dividend_ovl.part.lo, divisor,
+       ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor,
                          quotient.part.lo, remainder32);
 
        /* Return only what was requested */
@@ -114,10 +106,9 @@ acpi_ut_short_divide (
                *out_remainder = remainder32;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_divide
@@ -134,34 +125,30 @@ acpi_ut_short_divide (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_divide (
-       acpi_integer                    in_dividend,
-       acpi_integer                    in_divisor,
-       acpi_integer                    *out_quotient,
-       acpi_integer                    *out_remainder)
+acpi_ut_divide(acpi_integer in_dividend,
+              acpi_integer in_divisor,
+              acpi_integer * out_quotient, acpi_integer * out_remainder)
 {
-       union uint64_overlay            dividend;
-       union uint64_overlay            divisor;
-       union uint64_overlay            quotient;
-       union uint64_overlay            remainder;
-       union uint64_overlay            normalized_dividend;
-       union uint64_overlay            normalized_divisor;
-       u32                             partial1;
-       union uint64_overlay            partial2;
-       union uint64_overlay            partial3;
-
-
-       ACPI_FUNCTION_TRACE ("ut_divide");
-
+       union uint64_overlay dividend;
+       union uint64_overlay divisor;
+       union uint64_overlay quotient;
+       union uint64_overlay remainder;
+       union uint64_overlay normalized_dividend;
+       union uint64_overlay normalized_divisor;
+       u32 partial1;
+       union uint64_overlay partial2;
+       union uint64_overlay partial3;
+
+       ACPI_FUNCTION_TRACE("ut_divide");
 
        /* Always check for a zero divisor */
 
        if (in_divisor == 0) {
-               ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n"));
-               return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+               ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n"));
+               return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
        }
 
-       divisor.full  = in_divisor;
+       divisor.full = in_divisor;
        dividend.full = in_dividend;
        if (divisor.part.hi == 0) {
                /*
@@ -174,9 +161,9 @@ acpi_ut_divide (
                 * The quotient is 64 bits, the remainder is always 32 bits,
                 * and is generated by the second divide.
                 */
-               ACPI_DIV_64_BY_32 (0, dividend.part.hi, divisor.part.lo,
+               ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo,
                                  quotient.part.hi, partial1);
-               ACPI_DIV_64_BY_32 (partial1, dividend.part.lo, divisor.part.lo,
+               ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo,
                                  quotient.part.lo, remainder.part.lo);
        }
 
@@ -185,23 +172,23 @@ acpi_ut_divide (
                 * 2) The general case where the divisor is a full 64 bits
                 * is more difficult
                 */
-               quotient.part.hi   = 0;
+               quotient.part.hi = 0;
                normalized_dividend = dividend;
                normalized_divisor = divisor;
 
                /* Normalize the operands (shift until the divisor is < 32 bits) */
 
                do {
-                       ACPI_SHIFT_RIGHT_64 (normalized_divisor.part.hi,
-                                        normalized_divisor.part.lo);
-                       ACPI_SHIFT_RIGHT_64 (normalized_dividend.part.hi,
-                                        normalized_dividend.part.lo);
+                       ACPI_SHIFT_RIGHT_64(normalized_divisor.part.hi,
+                                           normalized_divisor.part.lo);
+                       ACPI_SHIFT_RIGHT_64(normalized_dividend.part.hi,
+                                           normalized_dividend.part.lo);
 
                } while (normalized_divisor.part.hi != 0);
 
                /* Partial divide */
 
-               ACPI_DIV_64_BY_32 (normalized_dividend.part.hi,
+               ACPI_DIV_64_BY_32(normalized_dividend.part.hi,
                                  normalized_dividend.part.lo,
                                  normalized_divisor.part.lo,
                                  quotient.part.lo, partial1);
@@ -210,8 +197,9 @@ acpi_ut_divide (
                 * The quotient is always 32 bits, and simply requires adjustment.
                 * The 64-bit remainder must be generated.
                 */
-               partial1      = quotient.part.lo * divisor.part.hi;
-               partial2.full = (acpi_integer) quotient.part.lo * divisor.part.lo;
+               partial1 = quotient.part.lo * divisor.part.hi;
+               partial2.full =
+                   (acpi_integer) quotient.part.lo * divisor.part.lo;
                partial3.full = (acpi_integer) partial2.part.hi + partial1;
 
                remainder.part.hi = partial3.part.lo;
@@ -224,16 +212,15 @@ acpi_ut_divide (
                                                quotient.part.lo--;
                                                remainder.full -= divisor.full;
                                        }
-                               }
-                               else {
+                               } else {
                                        quotient.part.lo--;
                                        remainder.full -= divisor.full;
                                }
                        }
 
-                       remainder.full    = remainder.full - dividend.full;
-                       remainder.part.hi = (u32) -((s32) remainder.part.hi);
-                       remainder.part.lo = (u32) -((s32) remainder.part.lo);
+                       remainder.full = remainder.full - dividend.full;
+                       remainder.part.hi = (u32) - ((s32) remainder.part.hi);
+                       remainder.part.lo = (u32) - ((s32) remainder.part.lo);
 
                        if (remainder.part.lo) {
                                remainder.part.hi--;
@@ -250,11 +237,10 @@ acpi_ut_divide (
                *out_remainder = remainder.full;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 #else
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_short_divide, acpi_ut_divide
@@ -269,23 +255,19 @@ acpi_ut_divide (
  *                 perform the divide.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ut_short_divide (
-       acpi_integer                    in_dividend,
-       u32                             divisor,
-       acpi_integer                    *out_quotient,
-       u32                             *out_remainder)
+acpi_ut_short_divide(acpi_integer in_dividend,
+                    u32 divisor,
+                    acpi_integer * out_quotient, u32 * out_remainder)
 {
 
-       ACPI_FUNCTION_TRACE ("ut_short_divide");
-
+       ACPI_FUNCTION_TRACE("ut_short_divide");
 
        /* Always check for a zero divisor */
 
        if (divisor == 0) {
-               ACPI_REPORT_ERROR (("acpi_ut_short_divide: Divide by zero\n"));
-               return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+               ACPI_REPORT_ERROR(("acpi_ut_short_divide: Divide by zero\n"));
+               return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
        }
 
        /* Return only what was requested */
@@ -297,27 +279,23 @@ acpi_ut_short_divide (
                *out_remainder = (u32) in_dividend % divisor;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 acpi_status
-acpi_ut_divide (
-       acpi_integer                    in_dividend,
-       acpi_integer                    in_divisor,
-       acpi_integer                    *out_quotient,
-       acpi_integer                    *out_remainder)
+acpi_ut_divide(acpi_integer in_dividend,
+              acpi_integer in_divisor,
+              acpi_integer * out_quotient, acpi_integer * out_remainder)
 {
-       ACPI_FUNCTION_TRACE ("ut_divide");
-
+       ACPI_FUNCTION_TRACE("ut_divide");
 
        /* Always check for a zero divisor */
 
        if (in_divisor == 0) {
-               ACPI_REPORT_ERROR (("acpi_ut_divide: Divide by zero\n"));
-               return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
+               ACPI_REPORT_ERROR(("acpi_ut_divide: Divide by zero\n"));
+               return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
        }
 
-
        /* Return only what was requested */
 
        if (out_quotient) {
@@ -327,9 +305,7 @@ acpi_ut_divide (
                *out_remainder = in_dividend % in_divisor;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
 
 #endif
-
-
index f6de4ed3d527b713146369096ca59f06f342726b..0c5abc536c7ad1deb1f7db7e55c410ccf289a591 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 
-
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utmisc")
+ACPI_MODULE_NAME("utmisc")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_allocate_owner_id
+ *
+ * PARAMETERS:  owner_id        - Where the new owner ID is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
+ *              track objects created by the table or method, to be deleted
+ *              when the method exits or the table is unloaded.
+ *
+ ******************************************************************************/
+acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
+{
+       acpi_native_uint i;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE("ut_allocate_owner_id");
+
+       /* Guard against multiple allocations of ID to the same location */
+
+       if (*owner_id) {
+               ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n",
+                                  *owner_id));
+               return_ACPI_STATUS(AE_ALREADY_EXISTS);
+       }
+
+       /* Mutex for the global ID mask */
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
+       }
 
-/* Local prototypes */
+       /* Find a free owner ID */
 
-static acpi_status
-acpi_ut_create_mutex (
-       acpi_mutex_handle               mutex_id);
+       for (i = 0; i < 32; i++) {
+               if (!(acpi_gbl_owner_id_mask & (1 << i))) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
+                                         "Current owner_id mask: %8.8X New ID: %2.2X\n",
+                                         acpi_gbl_owner_id_mask,
+                                         (unsigned int)(i + 1)));
 
-static acpi_status
-acpi_ut_delete_mutex (
-       acpi_mutex_handle               mutex_id);
+                       acpi_gbl_owner_id_mask |= (1 << i);
+                       *owner_id = (acpi_owner_id) (i + 1);
+                       goto exit;
+               }
+       }
 
+       /*
+        * If we are here, all owner_ids have been allocated. This probably should
+        * not happen since the IDs are reused after deallocation. The IDs are
+        * allocated upon table load (one per table) and method execution, and
+        * they are released when a table is unloaded or a method completes
+        * execution.
+        */
+       *owner_id = 0;
+       status = AE_OWNER_ID_LIMIT;
+       ACPI_REPORT_ERROR(("Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
+
+      exit:
+       (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_release_owner_id
+ *
+ * PARAMETERS:  owner_id_ptr        - Pointer to a previously allocated owner_iD
+ *
+ * RETURN:      None. No error is returned because we are either exiting a
+ *              control method or unloading a table. Either way, we would
+ *              ignore any error anyway.
+ *
+ * DESCRIPTION: Release a table or method owner ID.  Valid IDs are 1 - 32
+ *
+ ******************************************************************************/
+
+void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
+{
+       acpi_owner_id owner_id = *owner_id_ptr;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id);
+
+       /* Always clear the input owner_id (zero is an invalid ID) */
+
+       *owner_id_ptr = 0;
+
+       /* Zero is not a valid owner_iD */
+
+       if ((owner_id == 0) || (owner_id > 32)) {
+               ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id));
+               return_VOID;
+       }
+
+       /* Mutex for the global ID mask */
+
+       status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
+       if (ACPI_FAILURE(status)) {
+               return_VOID;
+       }
+
+       /* Normalize the ID to zero */
+
+       owner_id--;
+
+       /* Free the owner ID only if it is valid */
+
+       if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
+               acpi_gbl_owner_id_mask ^= (1 << owner_id);
+       }
+
+       (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
+       return_VOID;
+}
 
 /*******************************************************************************
  *
@@ -66,7 +172,7 @@ acpi_ut_delete_mutex (
  *
  * PARAMETERS:  src_string      - The source string to convert
  *
- * RETURN:      Converted src_string (same as input pointer)
+ * RETURN:      None
  *
  * DESCRIPTION: Convert string to uppercase
  *
@@ -74,26 +180,25 @@ acpi_ut_delete_mutex (
  *
  ******************************************************************************/
 
-char *
-acpi_ut_strupr (
-       char                            *src_string)
+void acpi_ut_strupr(char *src_string)
 {
-       char                            *string;
-
+       char *string;
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
+       if (!src_string) {
+               return;
+       }
 
        /* Walk entire string, uppercasing the letters */
 
        for (string = src_string; *string; string++) {
-               *string = (char) ACPI_TOUPPER (*string);
+               *string = (char)ACPI_TOUPPER(*string);
        }
 
-       return (src_string);
+       return;
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_print_string
@@ -108,85 +213,77 @@ acpi_ut_strupr (
  *
  ******************************************************************************/
 
-void
-acpi_ut_print_string (
-       char                            *string,
-       u8                              max_length)
+void acpi_ut_print_string(char *string, u8 max_length)
 {
-       u32                             i;
-
+       u32 i;
 
        if (!string) {
-               acpi_os_printf ("<\"NULL STRING PTR\">");
+               acpi_os_printf("<\"NULL STRING PTR\">");
                return;
        }
 
-       acpi_os_printf ("\"");
+       acpi_os_printf("\"");
        for (i = 0; string[i] && (i < max_length); i++) {
                /* Escape sequences */
 
                switch (string[i]) {
                case 0x07:
-                       acpi_os_printf ("\\a");      /* BELL */
+                       acpi_os_printf("\\a");  /* BELL */
                        break;
 
                case 0x08:
-                       acpi_os_printf ("\\b");     /* BACKSPACE */
+                       acpi_os_printf("\\b");  /* BACKSPACE */
                        break;
 
                case 0x0C:
-                       acpi_os_printf ("\\f");     /* FORMFEED */
+                       acpi_os_printf("\\f");  /* FORMFEED */
                        break;
 
                case 0x0A:
-                       acpi_os_printf ("\\n");     /* LINEFEED */
+                       acpi_os_printf("\\n");  /* LINEFEED */
                        break;
 
                case 0x0D:
-                       acpi_os_printf ("\\r");     /* CARRIAGE RETURN*/
+                       acpi_os_printf("\\r");  /* CARRIAGE RETURN */
                        break;
 
                case 0x09:
-                       acpi_os_printf ("\\t");     /* HORIZONTAL TAB */
+                       acpi_os_printf("\\t");  /* HORIZONTAL TAB */
                        break;
 
                case 0x0B:
-                       acpi_os_printf ("\\v");     /* VERTICAL TAB */
+                       acpi_os_printf("\\v");  /* VERTICAL TAB */
                        break;
 
-               case '\'':                      /* Single Quote */
-               case '\"':                      /* Double Quote */
-               case '\\':                      /* Backslash */
-                       acpi_os_printf ("\\%c", (int) string[i]);
+               case '\'':      /* Single Quote */
+               case '\"':      /* Double Quote */
+               case '\\':      /* Backslash */
+                       acpi_os_printf("\\%c", (int)string[i]);
                        break;
 
                default:
 
                        /* Check for printable character or hex escape */
 
-                       if (ACPI_IS_PRINT (string[i]))
-                       {
+                       if (ACPI_IS_PRINT(string[i])) {
                                /* This is a normal character */
 
-                               acpi_os_printf ("%c", (int) string[i]);
-                       }
-                       else
-                       {
+                               acpi_os_printf("%c", (int)string[i]);
+                       } else {
                                /* All others will be Hex escapes */
 
-                               acpi_os_printf ("\\x%2.2X", (s32) string[i]);
+                               acpi_os_printf("\\x%2.2X", (s32) string[i]);
                        }
                        break;
                }
        }
-       acpi_os_printf ("\"");
+       acpi_os_printf("\"");
 
        if (i == max_length && string[i]) {
-               acpi_os_printf ("...");
+               acpi_os_printf("...");
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_dword_byte_swap
@@ -199,22 +296,18 @@ acpi_ut_print_string (
  *
  ******************************************************************************/
 
-u32
-acpi_ut_dword_byte_swap (
-       u32                             value)
+u32 acpi_ut_dword_byte_swap(u32 value)
 {
        union {
-               u32                         value;
-               u8                          bytes[4];
+               u32 value;
+               u8 bytes[4];
        } out;
        union {
-               u32                         value;
-               u8                          bytes[4];
+               u32 value;
+               u8 bytes[4];
        } in;
 
-
-       ACPI_FUNCTION_ENTRY ();
-
+       ACPI_FUNCTION_ENTRY();
 
        in.value = value;
 
@@ -226,7 +319,6 @@ acpi_ut_dword_byte_swap (
        return (out.value);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_set_integer_width
@@ -242,24 +334,20 @@ acpi_ut_dword_byte_swap (
  *
  ******************************************************************************/
 
-void
-acpi_ut_set_integer_width (
-       u8                              revision)
+void acpi_ut_set_integer_width(u8 revision)
 {
 
        if (revision <= 1) {
                acpi_gbl_integer_bit_width = 32;
                acpi_gbl_integer_nybble_width = 8;
                acpi_gbl_integer_byte_width = 4;
-       }
-       else {
+       } else {
                acpi_gbl_integer_bit_width = 64;
                acpi_gbl_integer_nybble_width = 16;
                acpi_gbl_integer_byte_width = 8;
        }
 }
 
-
 #ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
@@ -277,17 +365,14 @@ acpi_ut_set_integer_width (
  ******************************************************************************/
 
 void
-acpi_ut_display_init_pathname (
-       u8                              type,
-       struct acpi_namespace_node      *obj_handle,
-       char                            *path)
+acpi_ut_display_init_pathname(u8 type,
+                             struct acpi_namespace_node *obj_handle,
+                             char *path)
 {
-       acpi_status                     status;
-       struct acpi_buffer              buffer;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       acpi_status status;
+       struct acpi_buffer buffer;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Only print the path if the appropriate debug level is enabled */
 
@@ -298,8 +383,8 @@ acpi_ut_display_init_pathname (
        /* Get the full pathname to the node */
 
        buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
-       if (ACPI_FAILURE (status)) {
+       status = acpi_ns_handle_to_pathname(obj_handle, &buffer);
+       if (ACPI_FAILURE(status)) {
                return;
        }
 
@@ -307,31 +392,30 @@ acpi_ut_display_init_pathname (
 
        switch (type) {
        case ACPI_TYPE_METHOD:
-               acpi_os_printf ("Executing  ");
+               acpi_os_printf("Executing  ");
                break;
 
        default:
-               acpi_os_printf ("Initializing ");
+               acpi_os_printf("Initializing ");
                break;
        }
 
        /* Print the object type and pathname */
 
-       acpi_os_printf ("%-12s %s",
-               acpi_ut_get_type_name (type), (char *) buffer.pointer);
+       acpi_os_printf("%-12s %s",
+                      acpi_ut_get_type_name(type), (char *)buffer.pointer);
 
        /* Extra path is used to append names like _STA, _INI, etc. */
 
        if (path) {
-               acpi_os_printf (".%s", path);
+               acpi_os_printf(".%s", path);
        }
-       acpi_os_printf ("\n");
+       acpi_os_printf("\n");
 
-       ACPI_MEM_FREE (buffer.pointer);
+       ACPI_MEM_FREE(buffer.pointer);
 }
 #endif
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_acpi_name
@@ -347,25 +431,21 @@ acpi_ut_display_init_pathname (
  *
  ******************************************************************************/
 
-u8
-acpi_ut_valid_acpi_name (
-       u32                             name)
+u8 acpi_ut_valid_acpi_name(u32 name)
 {
-       char                            *name_ptr = (char *) &name;
-       char                            character;
-       acpi_native_uint                i;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       char *name_ptr = (char *)&name;
+       char character;
+       acpi_native_uint i;
 
+       ACPI_FUNCTION_ENTRY();
 
        for (i = 0; i < ACPI_NAME_SIZE; i++) {
                character = *name_ptr;
                name_ptr++;
 
                if (!((character == '_') ||
-                         (character >= 'A' && character <= 'Z') ||
-                         (character >= '0' && character <= '9'))) {
+                     (character >= 'A' && character <= 'Z') ||
+                     (character >= '0' && character <= '9'))) {
                        return (FALSE);
                }
        }
@@ -373,7 +453,6 @@ acpi_ut_valid_acpi_name (
        return (TRUE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_acpi_character
@@ -386,19 +465,16 @@ acpi_ut_valid_acpi_name (
  *
  ******************************************************************************/
 
-u8
-acpi_ut_valid_acpi_character (
-       char                            character)
+u8 acpi_ut_valid_acpi_character(char character)
 {
 
-       ACPI_FUNCTION_ENTRY ();
+       ACPI_FUNCTION_ENTRY();
 
-       return ((u8)   ((character == '_') ||
-                          (character >= 'A' && character <= 'Z') ||
-                          (character >= '0' && character <= '9')));
+       return ((u8) ((character == '_') ||
+                     (character >= 'A' && character <= 'Z') ||
+                     (character >= '0' && character <= '9')));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_strtoul64
@@ -415,18 +491,13 @@ acpi_ut_valid_acpi_character (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_strtoul64 (
-       char                            *string,
-       u32                             base,
-       acpi_integer                    *ret_integer)
+acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
 {
-       u32                             this_digit = 0;
-       acpi_integer                    return_value = 0;
-       acpi_integer                    quotient;
-
-
-       ACPI_FUNCTION_TRACE ("ut_stroul64");
+       u32 this_digit = 0;
+       acpi_integer return_value = 0;
+       acpi_integer quotient;
 
+       ACPI_FUNCTION_TRACE("ut_stroul64");
 
        if ((!string) || !(*string)) {
                goto error_exit;
@@ -440,12 +511,12 @@ acpi_ut_strtoul64 (
 
        default:
                /* Invalid Base */
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
        /* Skip over any white space in the buffer */
 
-       while (ACPI_IS_SPACE (*string) || *string == '\t') {
+       while (ACPI_IS_SPACE(*string) || *string == '\t') {
                string++;
        }
 
@@ -454,12 +525,10 @@ acpi_ut_strtoul64 (
         * determine if it is decimal or hexadecimal:
         */
        if (base == 0) {
-               if ((*string == '0') &&
-                       (ACPI_TOLOWER (*(string + 1)) == 'x')) {
+               if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
                        base = 16;
                        string += 2;
-               }
-               else {
+               } else {
                        base = 10;
                }
        }
@@ -469,8 +538,7 @@ acpi_ut_strtoul64 (
         * 0 or 0x, if they are present.
         */
        if ((base == 16) &&
-               (*string == '0') &&
-               (ACPI_TOLOWER (*(string + 1)) == 'x')) {
+           (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
                string += 2;
        }
 
@@ -483,25 +551,23 @@ acpi_ut_strtoul64 (
        /* Main loop: convert the string to a 64-bit integer */
 
        while (*string) {
-               if (ACPI_IS_DIGIT (*string)) {
+               if (ACPI_IS_DIGIT(*string)) {
                        /* Convert ASCII 0-9 to Decimal value */
 
-                       this_digit = ((u8) *string) - '0';
-               }
-               else {
+                       this_digit = ((u8) * string) - '0';
+               } else {
                        if (base == 10) {
                                /* Digit is out of range */
 
                                goto error_exit;
                        }
 
-                       this_digit = (u8) ACPI_TOUPPER (*string);
-                       if (ACPI_IS_XDIGIT ((char) this_digit)) {
+                       this_digit = (u8) ACPI_TOUPPER(*string);
+                       if (ACPI_IS_XDIGIT((char)this_digit)) {
                                /* Convert ASCII Hex char to value */
 
                                this_digit = this_digit - 'A' + 10;
-                       }
-                       else {
+                       } else {
                                /*
                                 * We allow non-hex chars, just stop now, same as end-of-string.
                                 * See ACPI spec, string-to-integer conversion.
@@ -512,8 +578,10 @@ acpi_ut_strtoul64 (
 
                /* Divide the digit into the correct position */
 
-               (void) acpi_ut_short_divide ((ACPI_INTEGER_MAX - (acpi_integer) this_digit),
-                                base, &quotient, NULL);
+               (void)
+                   acpi_ut_short_divide((ACPI_INTEGER_MAX -
+                                         (acpi_integer) this_digit), base,
+                                        &quotient, NULL);
                if (return_value > quotient) {
                        goto error_exit;
                }
@@ -526,335 +594,18 @@ acpi_ut_strtoul64 (
        /* All done, normal exit */
 
        *ret_integer = return_value;
-       return_ACPI_STATUS (AE_OK);
-
+       return_ACPI_STATUS(AE_OK);
 
-error_exit:
+      error_exit:
        /* Base was set/validated above */
 
        if (base == 10) {
-               return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
-       }
-       else {
-               return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
-       }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_mutex_initialize
- *
- * PARAMETERS:  None.
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_mutex_initialize (
-       void)
-{
-       u32                             i;
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE ("ut_mutex_initialize");
-
-
-       /*
-        * Create each of the predefined mutex objects
-        */
-       for (i = 0; i < NUM_MUTEX; i++) {
-               status = acpi_ut_create_mutex (i);
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
-               }
-       }
-
-       status = acpi_os_create_lock (&acpi_gbl_gpe_lock);
-       return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_mutex_terminate
- *
- * PARAMETERS:  None.
- *
- * RETURN:      None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void
-acpi_ut_mutex_terminate (
-       void)
-{
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("ut_mutex_terminate");
-
-
-       /*
-        * Delete each predefined mutex object
-        */
-       for (i = 0; i < NUM_MUTEX; i++) {
-               (void) acpi_ut_delete_mutex (i);
-       }
-
-       acpi_os_delete_lock (acpi_gbl_gpe_lock);
-       return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_mutex
- *
- * PARAMETERS:  mutex_iD        - ID of the mutex to be created
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a mutex object.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_create_mutex (
-       acpi_mutex_handle               mutex_id)
-{
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_create_mutex", mutex_id);
-
-
-       if (mutex_id > MAX_MUTEX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       if (!acpi_gbl_mutex_info[mutex_id].mutex) {
-               status = acpi_os_create_semaphore (1, 1,
-                                 &acpi_gbl_mutex_info[mutex_id].mutex);
-               acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
-               acpi_gbl_mutex_info[mutex_id].use_count = 0;
-       }
-
-       return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_delete_mutex
- *
- * PARAMETERS:  mutex_iD        - ID of the mutex to be deleted
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Delete a mutex object.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_delete_mutex (
-       acpi_mutex_handle               mutex_id)
-{
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_delete_mutex", mutex_id);
-
-
-       if (mutex_id > MAX_MUTEX) {
-               return_ACPI_STATUS (AE_BAD_PARAMETER);
-       }
-
-       status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex);
-
-       acpi_gbl_mutex_info[mutex_id].mutex = NULL;
-       acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
-
-       return_ACPI_STATUS (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_acquire_mutex
- *
- * PARAMETERS:  mutex_iD        - ID of the mutex to be acquired
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Acquire a mutex object.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_acquire_mutex (
-       acpi_mutex_handle               mutex_id)
-{
-       acpi_status                     status;
-       u32                             this_thread_id;
-
-
-       ACPI_FUNCTION_NAME ("ut_acquire_mutex");
-
-
-       if (mutex_id > MAX_MUTEX) {
-               return (AE_BAD_PARAMETER);
-       }
-
-       this_thread_id = acpi_os_get_thread_id ();
-
-#ifdef ACPI_MUTEX_DEBUG
-       {
-               u32                             i;
-               /*
-                * Mutex debug code, for internal debugging only.
-                *
-                * Deadlock prevention.  Check if this thread owns any mutexes of value
-                * greater than or equal to this one.  If so, the thread has violated
-                * the mutex ordering rule.  This indicates a coding error somewhere in
-                * the ACPI subsystem code.
-                */
-               for (i = mutex_id; i < MAX_MUTEX; i++) {
-                       if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
-                               if (i == mutex_id) {
-                                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                               "Mutex [%s] already acquired by this thread [%X]\n",
-                                               acpi_ut_get_mutex_name (mutex_id), this_thread_id));
-
-                                       return (AE_ALREADY_ACQUIRED);
-                               }
-
-                               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                                       "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
-                                       this_thread_id, acpi_ut_get_mutex_name (i),
-                                       acpi_ut_get_mutex_name (mutex_id)));
-
-                               return (AE_ACQUIRE_DEADLOCK);
-                       }
-               }
-       }
-#endif
-
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
-               "Thread %X attempting to acquire Mutex [%s]\n",
-               this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
-
-       status = acpi_os_wait_semaphore (acpi_gbl_mutex_info[mutex_id].mutex,
-                          1, ACPI_WAIT_FOREVER);
-       if (ACPI_SUCCESS (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
-                       this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
-
-               acpi_gbl_mutex_info[mutex_id].use_count++;
-               acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id;
-       }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Thread %X could not acquire Mutex [%s] %s\n",
-                               this_thread_id, acpi_ut_get_mutex_name (mutex_id),
-                               acpi_format_exception (status)));
-       }
-
-       return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_release_mutex
- *
- * PARAMETERS:  mutex_iD        - ID of the mutex to be released
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Release a mutex object.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_release_mutex (
-       acpi_mutex_handle               mutex_id)
-{
-       acpi_status                     status;
-       u32                             i;
-       u32                             this_thread_id;
-
-
-       ACPI_FUNCTION_NAME ("ut_release_mutex");
-
-
-       this_thread_id = acpi_os_get_thread_id ();
-       ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
-               "Thread %X releasing Mutex [%s]\n", this_thread_id,
-               acpi_ut_get_mutex_name (mutex_id)));
-
-       if (mutex_id > MAX_MUTEX) {
-               return (AE_BAD_PARAMETER);
-       }
-
-       /*
-        * Mutex must be acquired in order to release it!
-        */
-       if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Mutex [%s] is not acquired, cannot release\n",
-                       acpi_ut_get_mutex_name (mutex_id)));
-
-               return (AE_NOT_ACQUIRED);
-       }
-
-       /*
-        * Deadlock prevention.  Check if this thread owns any mutexes of value
-        * greater than this one.  If so, the thread has violated the mutex
-        * ordering rule.  This indicates a coding error somewhere in
-        * the ACPI subsystem code.
-        */
-       for (i = mutex_id; i < MAX_MUTEX; i++) {
-               if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
-                       if (i == mutex_id) {
-                               continue;
-                       }
-
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Invalid release order: owns [%s], releasing [%s]\n",
-                               acpi_ut_get_mutex_name (i), acpi_ut_get_mutex_name (mutex_id)));
-
-                       return (AE_RELEASE_DEADLOCK);
-               }
-       }
-
-       /* Mark unlocked FIRST */
-
-       acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
-
-       status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
-
-       if (ACPI_FAILURE (status)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                       "Thread %X could not release Mutex [%s] %s\n",
-                       this_thread_id, acpi_ut_get_mutex_name (mutex_id),
-                       acpi_format_exception (status)));
+               return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
+       } else {
+               return_ACPI_STATUS(AE_BAD_HEX_CONSTANT);
        }
-       else {
-               ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
-                       this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
-       }
-
-       return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_update_state_and_push
@@ -870,16 +621,13 @@ acpi_ut_release_mutex (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_create_update_state_and_push (
-       union acpi_operand_object       *object,
-       u16                             action,
-       union acpi_generic_state        **state_list)
+acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
+                                    u16 action,
+                                    union acpi_generic_state **state_list)
 {
-       union acpi_generic_state         *state;
-
-
-       ACPI_FUNCTION_ENTRY ();
+       union acpi_generic_state *state;
 
+       ACPI_FUNCTION_ENTRY();
 
        /* Ignore null objects; these are expected */
 
@@ -887,371 +635,15 @@ acpi_ut_create_update_state_and_push (
                return (AE_OK);
        }
 
-       state = acpi_ut_create_update_state (object, action);
+       state = acpi_ut_create_update_state(object, action);
        if (!state) {
                return (AE_NO_MEMORY);
        }
 
-       acpi_ut_push_generic_state (state_list, state);
+       acpi_ut_push_generic_state(state_list, state);
        return (AE_OK);
 }
 
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_pkg_state_and_push
- *
- * PARAMETERS:  Object          - Object to be added to the new state
- *              Action          - Increment/Decrement
- *              state_list      - List the state will be added to
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-#ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_ut_create_pkg_state_and_push (
-       void                            *internal_object,
-       void                            *external_object,
-       u16                             index,
-       union acpi_generic_state        **state_list)
-{
-       union acpi_generic_state         *state;
-
-
-       ACPI_FUNCTION_ENTRY ();
-
-
-       state = acpi_ut_create_pkg_state (internal_object, external_object, index);
-       if (!state) {
-               return (AE_NO_MEMORY);
-       }
-
-       acpi_ut_push_generic_state (state_list, state);
-       return (AE_OK);
-}
-#endif  /*  ACPI_FUTURE_USAGE  */
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_push_generic_state
- *
- * PARAMETERS:  list_head           - Head of the state stack
- *              State               - State object to push
- *
- * RETURN:      None
- *
- * DESCRIPTION: Push a state object onto a state stack
- *
- ******************************************************************************/
-
-void
-acpi_ut_push_generic_state (
-       union acpi_generic_state        **list_head,
-       union acpi_generic_state        *state)
-{
-       ACPI_FUNCTION_TRACE ("ut_push_generic_state");
-
-
-       /* Push the state object onto the front of the list (stack) */
-
-       state->common.next = *list_head;
-       *list_head = state;
-
-       return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_pop_generic_state
- *
- * PARAMETERS:  list_head           - Head of the state stack
- *
- * RETURN:      The popped state object
- *
- * DESCRIPTION: Pop a state object from a state stack
- *
- ******************************************************************************/
-
-union acpi_generic_state *
-acpi_ut_pop_generic_state (
-       union acpi_generic_state        **list_head)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE ("ut_pop_generic_state");
-
-
-       /* Remove the state object at the head of the list (stack) */
-
-       state = *list_head;
-       if (state) {
-               /* Update the list head */
-
-               *list_head = state->common.next;
-       }
-
-       return_PTR (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_generic_state
- *
- * PARAMETERS:  None
- *
- * RETURN:      The new state object. NULL on failure.
- *
- * DESCRIPTION: Create a generic state object.  Attempt to obtain one from
- *              the global state cache;  If none available, create a new one.
- *
- ******************************************************************************/
-
-union acpi_generic_state *
-acpi_ut_create_generic_state (
-       void)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_ENTRY ();
-
-
-       state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_STATE);
-
-       /* Initialize */
-
-       if (state) {
-               state->common.data_type = ACPI_DESC_TYPE_STATE;
-       }
-
-       return (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_thread_state
- *
- * PARAMETERS:  None
- *
- * RETURN:      New Thread State. NULL on failure
- *
- * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
- *              to track per-thread info during method execution
- *
- ******************************************************************************/
-
-struct acpi_thread_state *
-acpi_ut_create_thread_state (
-       void)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE ("ut_create_thread_state");
-
-
-       /* Create the generic state object */
-
-       state = acpi_ut_create_generic_state ();
-       if (!state) {
-               return_PTR (NULL);
-       }
-
-       /* Init fields specific to the update struct */
-
-       state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD;
-       state->thread.thread_id = acpi_os_get_thread_id ();
-
-       return_PTR ((struct acpi_thread_state *) state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_update_state
- *
- * PARAMETERS:  Object          - Initial Object to be installed in the state
- *              Action          - Update action to be performed
- *
- * RETURN:      New state object, null on failure
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- *              to update reference counts and delete complex objects such
- *              as packages.
- *
- ******************************************************************************/
-
-union acpi_generic_state *
-acpi_ut_create_update_state (
-       union acpi_operand_object       *object,
-       u16                             action)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_create_update_state", object);
-
-
-       /* Create the generic state object */
-
-       state = acpi_ut_create_generic_state ();
-       if (!state) {
-               return_PTR (NULL);
-       }
-
-       /* Init fields specific to the update struct */
-
-       state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE;
-       state->update.object = object;
-       state->update.value  = action;
-
-       return_PTR (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_pkg_state
- *
- * PARAMETERS:  Object          - Initial Object to be installed in the state
- *              Action          - Update action to be performed
- *
- * RETURN:      New state object, null on failure
- *
- * DESCRIPTION: Create a "Package State"
- *
- ******************************************************************************/
-
-union acpi_generic_state *
-acpi_ut_create_pkg_state (
-       void                            *internal_object,
-       void                            *external_object,
-       u16                             index)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_create_pkg_state", internal_object);
-
-
-       /* Create the generic state object */
-
-       state = acpi_ut_create_generic_state ();
-       if (!state) {
-               return_PTR (NULL);
-       }
-
-       /* Init fields specific to the update struct */
-
-       state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE;
-       state->pkg.source_object = (union acpi_operand_object *) internal_object;
-       state->pkg.dest_object  = external_object;
-       state->pkg.index        = index;
-       state->pkg.num_packages = 1;
-
-       return_PTR (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_create_control_state
- *
- * PARAMETERS:  None
- *
- * RETURN:      New state object, null on failure
- *
- * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
- *              to support nested IF/WHILE constructs in the AML.
- *
- ******************************************************************************/
-
-union acpi_generic_state *
-acpi_ut_create_control_state (
-       void)
-{
-       union acpi_generic_state        *state;
-
-
-       ACPI_FUNCTION_TRACE ("ut_create_control_state");
-
-
-       /* Create the generic state object */
-
-       state = acpi_ut_create_generic_state ();
-       if (!state) {
-               return_PTR (NULL);
-       }
-
-       /* Init fields specific to the control struct */
-
-       state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
-       state->common.state     = ACPI_CONTROL_CONDITIONAL_EXECUTING;
-
-       return_PTR (state);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_delete_generic_state
- *
- * PARAMETERS:  State               - The state object to be deleted
- *
- * RETURN:      None
- *
- * DESCRIPTION: Put a state object back into the global state cache.  The object
- *              is not actually freed at this time.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_generic_state (
-       union acpi_generic_state        *state)
-{
-       ACPI_FUNCTION_TRACE ("ut_delete_generic_state");
-
-
-       acpi_ut_release_to_cache (ACPI_MEM_LIST_STATE, state);
-       return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_delete_generic_state_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_generic_state_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ut_delete_generic_state_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_STATE);
-       return_VOID;
-}
-#endif
-
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_walk_package_tree
@@ -1268,33 +660,29 @@ acpi_ut_delete_generic_state_cache (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_walk_package_tree (
-       union acpi_operand_object       *source_object,
-       void                            *target_object,
-       acpi_pkg_callback               walk_callback,
-       void                            *context)
+acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
+                         void *target_object,
+                         acpi_pkg_callback walk_callback, void *context)
 {
-       acpi_status                     status = AE_OK;
-       union acpi_generic_state        *state_list = NULL;
-       union acpi_generic_state        *state;
-       u32                             this_index;
-       union acpi_operand_object       *this_source_obj;
-
-
-       ACPI_FUNCTION_TRACE ("ut_walk_package_tree");
+       acpi_status status = AE_OK;
+       union acpi_generic_state *state_list = NULL;
+       union acpi_generic_state *state;
+       u32 this_index;
+       union acpi_operand_object *this_source_obj;
 
+       ACPI_FUNCTION_TRACE("ut_walk_package_tree");
 
-       state = acpi_ut_create_pkg_state (source_object, target_object, 0);
+       state = acpi_ut_create_pkg_state(source_object, target_object, 0);
        if (!state) {
-               return_ACPI_STATUS (AE_NO_MEMORY);
+               return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
        while (state) {
                /* Get one element of the package */
 
-               this_index    = state->pkg.index;
+               this_index = state->pkg.index;
                this_source_obj = (union acpi_operand_object *)
-                                 state->pkg.source_object->package.elements[this_index];
+                   state->pkg.source_object->package.elements[this_index];
 
                /*
                 * Check for:
@@ -1305,16 +693,20 @@ acpi_ut_walk_package_tree (
                 *    case below.
                 */
                if ((!this_source_obj) ||
-                       (ACPI_GET_DESCRIPTOR_TYPE (this_source_obj) != ACPI_DESC_TYPE_OPERAND) ||
-                       (ACPI_GET_OBJECT_TYPE (this_source_obj) != ACPI_TYPE_PACKAGE)) {
-                       status = walk_callback (ACPI_COPY_TYPE_SIMPLE, this_source_obj,
-                                        state, context);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                   (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) !=
+                    ACPI_DESC_TYPE_OPERAND)
+                   || (ACPI_GET_OBJECT_TYPE(this_source_obj) !=
+                       ACPI_TYPE_PACKAGE)) {
+                       status =
+                           walk_callback(ACPI_COPY_TYPE_SIMPLE,
+                                         this_source_obj, state, context);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
 
                        state->pkg.index++;
-                       while (state->pkg.index >= state->pkg.source_object->package.count) {
+                       while (state->pkg.index >=
+                              state->pkg.source_object->package.count) {
                                /*
                                 * We've handled all of the objects at this level,  This means
                                 * that we have just completed a package.  That package may
@@ -1322,8 +714,8 @@ acpi_ut_walk_package_tree (
                                 *
                                 * Delete this state and pop the previous state (package).
                                 */
-                               acpi_ut_delete_generic_state (state);
-                               state = acpi_ut_pop_generic_state (&state_list);
+                               acpi_ut_delete_generic_state(state);
+                               state = acpi_ut_pop_generic_state(&state_list);
 
                                /* Finished when there are no more states */
 
@@ -1333,7 +725,7 @@ acpi_ut_walk_package_tree (
                                         * package just add the length of the package objects
                                         * and exit
                                         */
-                                       return_ACPI_STATUS (AE_OK);
+                                       return_ACPI_STATUS(AE_OK);
                                }
 
                                /*
@@ -1342,35 +734,35 @@ acpi_ut_walk_package_tree (
                                 */
                                state->pkg.index++;
                        }
-               }
-               else {
+               } else {
                        /* This is a subobject of type package */
 
-                       status = walk_callback (ACPI_COPY_TYPE_PACKAGE, this_source_obj,
-                                         state, context);
-                       if (ACPI_FAILURE (status)) {
-                               return_ACPI_STATUS (status);
+                       status =
+                           walk_callback(ACPI_COPY_TYPE_PACKAGE,
+                                         this_source_obj, state, context);
+                       if (ACPI_FAILURE(status)) {
+                               return_ACPI_STATUS(status);
                        }
 
                        /*
                         * Push the current state and create a new one
                         * The callback above returned a new target package object.
                         */
-                       acpi_ut_push_generic_state (&state_list, state);
-                       state = acpi_ut_create_pkg_state (this_source_obj,
-                                          state->pkg.this_target_obj, 0);
+                       acpi_ut_push_generic_state(&state_list, state);
+                       state = acpi_ut_create_pkg_state(this_source_obj,
+                                                        state->pkg.
+                                                        this_target_obj, 0);
                        if (!state) {
-                               return_ACPI_STATUS (AE_NO_MEMORY);
+                               return_ACPI_STATUS(AE_NO_MEMORY);
                        }
                }
        }
 
        /* We should never get here */
 
-       return_ACPI_STATUS (AE_AML_INTERNAL);
+       return_ACPI_STATUS(AE_AML_INTERNAL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_generate_checksum
@@ -1384,23 +776,18 @@ acpi_ut_walk_package_tree (
  *
  ******************************************************************************/
 
-u8
-acpi_ut_generate_checksum (
-       u8                              *buffer,
-       u32                             length)
+u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
 {
-       u32                             i;
-       signed char                     sum = 0;
-
+       u32 i;
+       signed char sum = 0;
 
        for (i = 0; i < length; i++) {
-               sum = (signed char) (sum + buffer[i]);
+               sum = (signed char)(sum + buffer[i]);
        }
 
        return ((u8) (0 - sum));
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_resource_end_tag
@@ -1413,17 +800,13 @@ acpi_ut_generate_checksum (
  *
  ******************************************************************************/
 
-
-u8 *
-acpi_ut_get_resource_end_tag (
-       union acpi_operand_object       *obj_desc)
+u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc)
 {
-       u8                              buffer_byte;
-       u8                              *buffer;
-       u8                              *end_buffer;
-
+       u8 buffer_byte;
+       u8 *buffer;
+       u8 *end_buffer;
 
-       buffer    = obj_desc->buffer.pointer;
+       buffer = obj_desc->buffer.pointer;
        end_buffer = buffer + obj_desc->buffer.length;
 
        while (buffer < end_buffer) {
@@ -1431,12 +814,12 @@ acpi_ut_get_resource_end_tag (
                if (buffer_byte & ACPI_RDESC_TYPE_MASK) {
                        /* Large Descriptor - Length is next 2 bytes */
 
-                       buffer += ((*(buffer+1) | (*(buffer+2) << 8)) + 3);
-               }
-               else {
+                       buffer += ((*(buffer + 1) | (*(buffer + 2) << 8)) + 3);
+               } else {
                        /* Small Descriptor.  End Tag will be found here */
 
-                       if ((buffer_byte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG) {
+                       if ((buffer_byte & ACPI_RDESC_SMALL_MASK) ==
+                           ACPI_RDESC_TYPE_END_TAG) {
                                /* Found the end tag descriptor, all done. */
 
                                return (buffer);
@@ -1453,7 +836,6 @@ acpi_ut_get_resource_end_tag (
        return (NULL);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_report_error
@@ -1468,17 +850,12 @@ acpi_ut_get_resource_end_tag (
  *
  ******************************************************************************/
 
-void
-acpi_ut_report_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id)
+void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id)
 {
 
-       acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
+       acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_report_warning
@@ -1494,16 +871,12 @@ acpi_ut_report_error (
  ******************************************************************************/
 
 void
-acpi_ut_report_warning (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id)
+acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id)
 {
 
-       acpi_os_printf ("%8s-%04d: *** Warning: ", module_name, line_number);
+       acpi_os_printf("%8s-%04d: *** Warning: ", module_name, line_number);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_report_info
@@ -1518,14 +891,8 @@ acpi_ut_report_warning (
  *
  ******************************************************************************/
 
-void
-acpi_ut_report_info (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id)
+void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id)
 {
 
-       acpi_os_printf ("%8s-%04d: *** Info: ", module_name, line_number);
+       acpi_os_printf("%8s-%04d: *** Info: ", module_name, line_number);
 }
-
-
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
new file mode 100644 (file)
index 0000000..90134c5
--- /dev/null
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ *
+ * Module Name: utmutex - local mutex support
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+
+#define _COMPONENT          ACPI_UTILITIES
+ACPI_MODULE_NAME("utmutex")
+
+/* Local prototypes */
+static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id);
+
+static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id);
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_mutex_initialize
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create the system mutex objects.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ut_mutex_initialize(void)
+{
+       u32 i;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE("ut_mutex_initialize");
+
+       /*
+        * Create each of the predefined mutex objects
+        */
+       for (i = 0; i < NUM_MUTEX; i++) {
+               status = acpi_ut_create_mutex(i);
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
+               }
+       }
+
+       status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_mutex_terminate
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Delete all of the system mutex objects.
+ *
+ ******************************************************************************/
+
+void acpi_ut_mutex_terminate(void)
+{
+       u32 i;
+
+       ACPI_FUNCTION_TRACE("ut_mutex_terminate");
+
+       /*
+        * Delete each predefined mutex object
+        */
+       for (i = 0; i < NUM_MUTEX; i++) {
+               (void)acpi_ut_delete_mutex(i);
+       }
+
+       acpi_os_delete_lock(acpi_gbl_gpe_lock);
+       return_VOID;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_mutex
+ *
+ * PARAMETERS:  mutex_iD        - ID of the mutex to be created
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a mutex object.
+ *
+ ******************************************************************************/
+
+static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
+{
+       acpi_status status = AE_OK;
+
+       ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id);
+
+       if (mutex_id > MAX_MUTEX) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       if (!acpi_gbl_mutex_info[mutex_id].mutex) {
+               status = acpi_os_create_semaphore(1, 1,
+                                                 &acpi_gbl_mutex_info
+                                                 [mutex_id].mutex);
+               acpi_gbl_mutex_info[mutex_id].thread_id =
+                   ACPI_MUTEX_NOT_ACQUIRED;
+               acpi_gbl_mutex_info[mutex_id].use_count = 0;
+       }
+
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_delete_mutex
+ *
+ * PARAMETERS:  mutex_iD        - ID of the mutex to be deleted
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Delete a mutex object.
+ *
+ ******************************************************************************/
+
+static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
+{
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id);
+
+       if (mutex_id > MAX_MUTEX) {
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
+       }
+
+       status = acpi_os_delete_semaphore(acpi_gbl_mutex_info[mutex_id].mutex);
+
+       acpi_gbl_mutex_info[mutex_id].mutex = NULL;
+       acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
+
+       return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_acquire_mutex
+ *
+ * PARAMETERS:  mutex_iD        - ID of the mutex to be acquired
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Acquire a mutex object.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
+{
+       acpi_status status;
+       u32 this_thread_id;
+
+       ACPI_FUNCTION_NAME("ut_acquire_mutex");
+
+       if (mutex_id > MAX_MUTEX) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       this_thread_id = acpi_os_get_thread_id();
+
+#ifdef ACPI_MUTEX_DEBUG
+       {
+               u32 i;
+               /*
+                * Mutex debug code, for internal debugging only.
+                *
+                * Deadlock prevention.  Check if this thread owns any mutexes of value
+                * greater than or equal to this one.  If so, the thread has violated
+                * the mutex ordering rule.  This indicates a coding error somewhere in
+                * the ACPI subsystem code.
+                */
+               for (i = mutex_id; i < MAX_MUTEX; i++) {
+                       if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+                               if (i == mutex_id) {
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Mutex [%s] already acquired by this thread [%X]\n",
+                                                         acpi_ut_get_mutex_name
+                                                         (mutex_id),
+                                                         this_thread_id));
+
+                                       return (AE_ALREADY_ACQUIRED);
+                               }
+
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+                                                 this_thread_id,
+                                                 acpi_ut_get_mutex_name(i),
+                                                 acpi_ut_get_mutex_name
+                                                 (mutex_id)));
+
+                               return (AE_ACQUIRE_DEADLOCK);
+                       }
+               }
+       }
+#endif
+
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
+                         "Thread %X attempting to acquire Mutex [%s]\n",
+                         this_thread_id, acpi_ut_get_mutex_name(mutex_id)));
+
+       status = acpi_os_wait_semaphore(acpi_gbl_mutex_info[mutex_id].mutex,
+                                       1, ACPI_WAIT_FOREVER);
+       if (ACPI_SUCCESS(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
+                                 "Thread %X acquired Mutex [%s]\n",
+                                 this_thread_id,
+                                 acpi_ut_get_mutex_name(mutex_id)));
+
+               acpi_gbl_mutex_info[mutex_id].use_count++;
+               acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Thread %X could not acquire Mutex [%s] %s\n",
+                                 this_thread_id,
+                                 acpi_ut_get_mutex_name(mutex_id),
+                                 acpi_format_exception(status)));
+       }
+
+       return (status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_release_mutex
+ *
+ * PARAMETERS:  mutex_iD        - ID of the mutex to be released
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Release a mutex object.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
+{
+       acpi_status status;
+       u32 this_thread_id;
+
+       ACPI_FUNCTION_NAME("ut_release_mutex");
+
+       this_thread_id = acpi_os_get_thread_id();
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
+                         "Thread %X releasing Mutex [%s]\n", this_thread_id,
+                         acpi_ut_get_mutex_name(mutex_id)));
+
+       if (mutex_id > MAX_MUTEX) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /*
+        * Mutex must be acquired in order to release it!
+        */
+       if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Mutex [%s] is not acquired, cannot release\n",
+                                 acpi_ut_get_mutex_name(mutex_id)));
+
+               return (AE_NOT_ACQUIRED);
+       }
+#ifdef ACPI_MUTEX_DEBUG
+       {
+               u32 i;
+               /*
+                * Mutex debug code, for internal debugging only.
+                *
+                * Deadlock prevention.  Check if this thread owns any mutexes of value
+                * greater than this one.  If so, the thread has violated the mutex
+                * ordering rule.  This indicates a coding error somewhere in
+                * the ACPI subsystem code.
+                */
+               for (i = mutex_id; i < MAX_MUTEX; i++) {
+                       if (acpi_gbl_mutex_info[i].owner_id == this_thread_id) {
+                               if (i == mutex_id) {
+                                       continue;
+                               }
+
+                               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                 "Invalid release order: owns [%s], releasing [%s]\n",
+                                                 acpi_ut_get_mutex_name(i),
+                                                 acpi_ut_get_mutex_name
+                                                 (mutex_id)));
+
+                               return (AE_RELEASE_DEADLOCK);
+                       }
+               }
+       }
+#endif
+
+       /* Mark unlocked FIRST */
+
+       acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
+
+       status =
+           acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1);
+
+       if (ACPI_FAILURE(status)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Thread %X could not release Mutex [%s] %s\n",
+                                 this_thread_id,
+                                 acpi_ut_get_mutex_name(mutex_id),
+                                 acpi_format_exception(status)));
+       } else {
+               ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
+                                 "Thread %X released Mutex [%s]\n",
+                                 this_thread_id,
+                                 acpi_ut_get_mutex_name(mutex_id)));
+       }
+
+       return (status);
+}
index cd3899b9cc5a6d7dc4fc3af9d5a71daac6489070..3015e15400536d2890617179589f67cd1cbadec7 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utobject")
+ACPI_MODULE_NAME("utobject")
 
 /* Local prototypes */
-
 static acpi_status
-acpi_ut_get_simple_object_size (
-       union acpi_operand_object       *obj,
-       acpi_size                       *obj_length);
+acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
+                              acpi_size * obj_length);
 
 static acpi_status
-acpi_ut_get_package_object_size (
-       union acpi_operand_object       *obj,
-       acpi_size                       *obj_length);
+acpi_ut_get_package_object_size(union acpi_operand_object *obj,
+                               acpi_size * obj_length);
 
 static acpi_status
-acpi_ut_get_element_length (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context);
-
+acpi_ut_get_element_length(u8 object_type,
+                          union acpi_operand_object *source_object,
+                          union acpi_generic_state *state, void *context);
 
 /*******************************************************************************
  *
@@ -91,26 +83,25 @@ acpi_ut_get_element_length (
  *
  ******************************************************************************/
 
-union acpi_operand_object    *
-acpi_ut_create_internal_object_dbg (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       acpi_object_type                type)
+union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
+                                                             u32 line_number,
+                                                             u32 component_id,
+                                                             acpi_object_type
+                                                             type)
 {
-       union acpi_operand_object       *object;
-       union acpi_operand_object       *second_object;
-
-
-       ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg",
-               acpi_ut_get_type_name (type));
+       union acpi_operand_object *object;
+       union acpi_operand_object *second_object;
 
+       ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg",
+                               acpi_ut_get_type_name(type));
 
        /* Allocate the raw object descriptor */
 
-       object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id);
+       object =
+           acpi_ut_allocate_object_desc_dbg(module_name, line_number,
+                                            component_id);
        if (!object) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        switch (type) {
@@ -119,11 +110,12 @@ acpi_ut_create_internal_object_dbg (
 
                /* These types require a secondary object */
 
-               second_object = acpi_ut_allocate_object_desc_dbg (module_name,
-                                  line_number, component_id);
+               second_object = acpi_ut_allocate_object_desc_dbg(module_name,
+                                                                line_number,
+                                                                component_id);
                if (!second_object) {
-                       acpi_ut_delete_object_desc (object);
-                       return_PTR (NULL);
+                       acpi_ut_delete_object_desc(object);
+                       return_PTR(NULL);
                }
 
                second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
@@ -149,10 +141,9 @@ acpi_ut_create_internal_object_dbg (
 
        /* Any per-type initialization should go here */
 
-       return_PTR (object);
+       return_PTR(object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_buffer_object
@@ -165,22 +156,18 @@ acpi_ut_create_internal_object_dbg (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ut_create_buffer_object (
-       acpi_size                       buffer_size)
+union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
 {
-       union acpi_operand_object       *buffer_desc;
-       u8                              *buffer = NULL;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size);
+       union acpi_operand_object *buffer_desc;
+       u8 *buffer = NULL;
 
+       ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size);
 
        /* Create a new Buffer object */
 
-       buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+       buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
        if (!buffer_desc) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        /* Create an actual buffer only if size > 0 */
@@ -188,12 +175,11 @@ acpi_ut_create_buffer_object (
        if (buffer_size > 0) {
                /* Allocate the actual buffer */
 
-               buffer = ACPI_MEM_CALLOCATE (buffer_size);
+               buffer = ACPI_MEM_CALLOCATE(buffer_size);
                if (!buffer) {
-                       ACPI_REPORT_ERROR (("create_buffer: could not allocate size %X\n",
-                               (u32) buffer_size));
-                       acpi_ut_remove_reference (buffer_desc);
-                       return_PTR (NULL);
+                       ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size));
+                       acpi_ut_remove_reference(buffer_desc);
+                       return_PTR(NULL);
                }
        }
 
@@ -205,10 +191,9 @@ acpi_ut_create_buffer_object (
 
        /* Return the new buffer descriptor */
 
-       return_PTR (buffer_desc);
+       return_PTR(buffer_desc);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_string_object
@@ -223,34 +208,29 @@ acpi_ut_create_buffer_object (
  *
  ******************************************************************************/
 
-union acpi_operand_object *
-acpi_ut_create_string_object (
-       acpi_size                       string_size)
+union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
 {
-       union acpi_operand_object       *string_desc;
-       char                            *string;
-
-
-       ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size);
+       union acpi_operand_object *string_desc;
+       char *string;
 
+       ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size);
 
        /* Create a new String object */
 
-       string_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING);
+       string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
        if (!string_desc) {
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        /*
         * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
         * NOTE: Zero-length strings are NULL terminated
         */
-       string = ACPI_MEM_CALLOCATE (string_size + 1);
+       string = ACPI_MEM_CALLOCATE(string_size + 1);
        if (!string) {
-               ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n",
-                       (u32) string_size));
-               acpi_ut_remove_reference (string_desc);
-               return_PTR (NULL);
+               ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size));
+               acpi_ut_remove_reference(string_desc);
+               return_PTR(NULL);
        }
 
        /* Complete string object initialization */
@@ -260,10 +240,9 @@ acpi_ut_create_string_object (
 
        /* Return the new string descriptor */
 
-       return_PTR (string_desc);
+       return_PTR(string_desc);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_valid_internal_object
@@ -276,24 +255,21 @@ acpi_ut_create_string_object (
  *
  ******************************************************************************/
 
-u8
-acpi_ut_valid_internal_object (
-       void                            *object)
+u8 acpi_ut_valid_internal_object(void *object)
 {
 
-       ACPI_FUNCTION_NAME ("ut_valid_internal_object");
-
+       ACPI_FUNCTION_NAME("ut_valid_internal_object");
 
        /* Check for a null pointer */
 
        if (!object) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Null Object Ptr\n"));
                return (FALSE);
        }
 
        /* Check the descriptor type field */
 
-       switch (ACPI_GET_DESCRIPTOR_TYPE (object)) {
+       switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
        case ACPI_DESC_TYPE_OPERAND:
 
                /* The object appears to be a valid union acpi_operand_object    */
@@ -301,16 +277,15 @@ acpi_ut_valid_internal_object (
                return (TRUE);
 
        default:
-               ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-                               "%p is not not an ACPI operand obj [%s]\n",
-                               object, acpi_ut_get_descriptor_name (object)));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                 "%p is not not an ACPI operand obj [%s]\n",
+                                 object, acpi_ut_get_descriptor_name(object)));
                break;
        }
 
        return (FALSE);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_allocate_object_desc_dbg
@@ -326,37 +301,31 @@ acpi_ut_valid_internal_object (
  *
  ******************************************************************************/
 
-void *
-acpi_ut_allocate_object_desc_dbg (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id)
+void *acpi_ut_allocate_object_desc_dbg(char *module_name,
+                                      u32 line_number, u32 component_id)
 {
-       union acpi_operand_object       *object;
+       union acpi_operand_object *object;
 
+       ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg");
 
-       ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg");
-
-
-       object = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_OPERAND);
+       object = acpi_os_acquire_object(acpi_gbl_operand_cache);
        if (!object) {
-               _ACPI_REPORT_ERROR (module_name, line_number, component_id,
-                                 ("Could not allocate an object descriptor\n"));
+               _ACPI_REPORT_ERROR(module_name, line_number, component_id,
+                                  ("Could not allocate an object descriptor\n"));
 
-               return_PTR (NULL);
+               return_PTR(NULL);
        }
 
        /* Mark the descriptor type */
+       memset(object, 0, sizeof(union acpi_operand_object));
+       ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
 
-       ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND);
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
+                         object, (u32) sizeof(union acpi_operand_object)));
 
-       ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
-                       object, (u32) sizeof (union acpi_operand_object)));
-
-       return_PTR (object);
+       return_PTR(object);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_delete_object_desc
@@ -369,54 +338,22 @@ acpi_ut_allocate_object_desc_dbg (
  *
  ******************************************************************************/
 
-void
-acpi_ut_delete_object_desc (
-       union acpi_operand_object       *object)
+void acpi_ut_delete_object_desc(union acpi_operand_object *object)
 {
-       ACPI_FUNCTION_TRACE_PTR ("ut_delete_object_desc", object);
-
+       ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object);
 
        /* Object must be an union acpi_operand_object    */
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "%p is not an ACPI Operand object [%s]\n", object,
-                               acpi_ut_get_descriptor_name (object)));
+       if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "%p is not an ACPI Operand object [%s]\n",
+                                 object, acpi_ut_get_descriptor_name(object)));
                return_VOID;
        }
 
-       acpi_ut_release_to_cache (ACPI_MEM_LIST_OPERAND, object);
-
-       return_VOID;
-}
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_delete_object_cache
- *
- * PARAMETERS:  None
- *
- * RETURN:      None
- *
- * DESCRIPTION: Purge the global state object cache.  Used during subsystem
- *              termination.
- *
- ******************************************************************************/
-
-void
-acpi_ut_delete_object_cache (
-       void)
-{
-       ACPI_FUNCTION_TRACE ("ut_delete_object_cache");
-
-
-       acpi_ut_delete_generic_cache (ACPI_MEM_LIST_OPERAND);
+       (void)acpi_os_release_object(acpi_gbl_operand_cache, object);
        return_VOID;
 }
-#endif
-
 
 /*******************************************************************************
  *
@@ -436,16 +373,13 @@ acpi_ut_delete_object_cache (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_get_simple_object_size (
-       union acpi_operand_object       *internal_object,
-       acpi_size                       *obj_length)
+acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
+                              acpi_size * obj_length)
 {
-       acpi_size                       length;
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object);
+       acpi_size length;
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object);
 
        /*
         * Handle a null object (Could be a uninitialized package
@@ -453,18 +387,18 @@ acpi_ut_get_simple_object_size (
         */
        if (!internal_object) {
                *obj_length = 0;
-               return_ACPI_STATUS (AE_OK);
+               return_ACPI_STATUS(AE_OK);
        }
 
        /* Start with the length of the Acpi object */
 
-       length = sizeof (union acpi_object);
+       length = sizeof(union acpi_object);
 
-       if (ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_NAMED) {
+       if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
                /* Object is a named object (reference), just return the length */
 
-               *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length);
-               return_ACPI_STATUS (status);
+               *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -473,19 +407,17 @@ acpi_ut_get_simple_object_size (
         * must be accessed bytewise or there may be alignment problems on
         * certain processors
         */
-       switch (ACPI_GET_OBJECT_TYPE (internal_object)) {
+       switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
        case ACPI_TYPE_STRING:
 
                length += (acpi_size) internal_object->string.length + 1;
                break;
 
-
        case ACPI_TYPE_BUFFER:
 
                length += (acpi_size) internal_object->buffer.length;
                break;
 
-
        case ACPI_TYPE_INTEGER:
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_POWER:
@@ -495,7 +427,6 @@ acpi_ut_get_simple_object_size (
                 */
                break;
 
-
        case ACPI_TYPE_LOCAL_REFERENCE:
 
                switch (internal_object->reference.opcode) {
@@ -505,8 +436,10 @@ acpi_ut_get_simple_object_size (
                         * Get the actual length of the full pathname to this object.
                         * The reference will be converted to the pathname to the object
                         */
-                       length += ACPI_ROUND_UP_TO_NATIVE_WORD (
-                                        acpi_ns_get_pathname_length (internal_object->reference.node));
+                       length +=
+                           ACPI_ROUND_UP_TO_NATIVE_WORD
+                           (acpi_ns_get_pathname_length
+                            (internal_object->reference.node));
                        break;
 
                default:
@@ -516,19 +449,21 @@ acpi_ut_get_simple_object_size (
                         * Notably, Locals and Args are not supported, but this may be
                         * required eventually.
                         */
-                       ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
-                               "Unsupported Reference opcode=%X in object %p\n",
-                               internal_object->reference.opcode, internal_object));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Unsupported Reference opcode=%X in object %p\n",
+                                         internal_object->reference.opcode,
+                                         internal_object));
                        status = AE_TYPE;
                        break;
                }
                break;
 
-
        default:
 
-               ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
-                       ACPI_GET_OBJECT_TYPE (internal_object), internal_object));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unsupported type=%X in object %p\n",
+                                 ACPI_GET_OBJECT_TYPE(internal_object),
+                                 internal_object));
                status = AE_TYPE;
                break;
        }
@@ -539,11 +474,10 @@ acpi_ut_get_simple_object_size (
         * on a machine word boundary. (preventing alignment faults on some
         * machines.)
         */
-       *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length);
-       return_ACPI_STATUS (status);
+       *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_element_length
@@ -557,16 +491,13 @@ acpi_ut_get_simple_object_size (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_get_element_length (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context)
+acpi_ut_get_element_length(u8 object_type,
+                          union acpi_operand_object *source_object,
+                          union acpi_generic_state *state, void *context)
 {
-       acpi_status                     status = AE_OK;
-       struct acpi_pkg_info            *info = (struct acpi_pkg_info *) context;
-       acpi_size                       object_space;
-
+       acpi_status status = AE_OK;
+       struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
+       acpi_size object_space;
 
        switch (object_type) {
        case ACPI_COPY_TYPE_SIMPLE:
@@ -575,15 +506,16 @@ acpi_ut_get_element_length (
                 * Simple object - just get the size (Null object/entry is handled
                 * here also) and sum it into the running package length
                 */
-               status = acpi_ut_get_simple_object_size (source_object, &object_space);
-               if (ACPI_FAILURE (status)) {
+               status =
+                   acpi_ut_get_simple_object_size(source_object,
+                                                  &object_space);
+               if (ACPI_FAILURE(status)) {
                        return (status);
                }
 
                info->length += object_space;
                break;
 
-
        case ACPI_COPY_TYPE_PACKAGE:
 
                /* Package object - nothing much to do here, let the walk handle it */
@@ -592,7 +524,6 @@ acpi_ut_get_element_length (
                state->pkg.this_target_obj = NULL;
                break;
 
-
        default:
 
                /* No other types allowed */
@@ -603,7 +534,6 @@ acpi_ut_get_element_length (
        return (status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_package_object_size
@@ -622,25 +552,22 @@ acpi_ut_get_element_length (
  ******************************************************************************/
 
 static acpi_status
-acpi_ut_get_package_object_size (
-       union acpi_operand_object       *internal_object,
-       acpi_size                       *obj_length)
+acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
+                               acpi_size * obj_length)
 {
-       acpi_status                     status;
-       struct acpi_pkg_info            info;
+       acpi_status status;
+       struct acpi_pkg_info info;
 
+       ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object);
 
-       ACPI_FUNCTION_TRACE_PTR ("ut_get_package_object_size", internal_object);
-
-
-       info.length      = 0;
+       info.length = 0;
        info.object_space = 0;
        info.num_packages = 1;
 
-       status = acpi_ut_walk_package_tree (internal_object, NULL,
-                        acpi_ut_get_element_length, &info);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_walk_package_tree(internal_object, NULL,
+                                          acpi_ut_get_element_length, &info);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
@@ -648,16 +575,15 @@ acpi_ut_get_package_object_size (
         * just add the length of the package objects themselves.
         * Round up to the next machine word.
         */
-       info.length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)) *
-                         (acpi_size) info.num_packages;
+       info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
+           (acpi_size) info.num_packages;
 
        /* Return the total package length */
 
        *obj_length = info.length;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_get_object_size
@@ -673,25 +599,23 @@ acpi_ut_get_package_object_size (
  ******************************************************************************/
 
 acpi_status
-acpi_ut_get_object_size (
-       union acpi_operand_object       *internal_object,
-       acpi_size                       *obj_length)
+acpi_ut_get_object_size(union acpi_operand_object *internal_object,
+                       acpi_size * obj_length)
 {
-       acpi_status                     status;
-
-
-       ACPI_FUNCTION_ENTRY ();
-
-
-       if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) &&
-               (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE)) {
-               status = acpi_ut_get_package_object_size (internal_object, obj_length);
-       }
-       else {
-               status = acpi_ut_get_simple_object_size (internal_object, obj_length);
+       acpi_status status;
+
+       ACPI_FUNCTION_ENTRY();
+
+       if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) ==
+            ACPI_DESC_TYPE_OPERAND)
+           && (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE)) {
+               status =
+                   acpi_ut_get_package_object_size(internal_object,
+                                                   obj_length);
+       } else {
+               status =
+                   acpi_ut_get_simple_object_size(internal_object, obj_length);
        }
 
        return (status);
 }
-
-
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
new file mode 100644 (file)
index 0000000..c1cb275
--- /dev/null
@@ -0,0 +1,333 @@
+/*******************************************************************************
+ *
+ * Module Name: utstate - state object support procedures
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2005, R. Byron Moore
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+
+#define _COMPONENT          ACPI_UTILITIES
+ACPI_MODULE_NAME("utstate")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_pkg_state_and_push
+ *
+ * PARAMETERS:  Object          - Object to be added to the new state
+ *              Action          - Increment/Decrement
+ *              state_list      - List the state will be added to
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Create a new state and push it
+ *
+ ******************************************************************************/
+acpi_status
+acpi_ut_create_pkg_state_and_push(void *internal_object,
+                                 void *external_object,
+                                 u16 index,
+                                 union acpi_generic_state ** state_list)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_ENTRY();
+
+       state =
+           acpi_ut_create_pkg_state(internal_object, external_object, index);
+       if (!state) {
+               return (AE_NO_MEMORY);
+       }
+
+       acpi_ut_push_generic_state(state_list, state);
+       return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_push_generic_state
+ *
+ * PARAMETERS:  list_head           - Head of the state stack
+ *              State               - State object to push
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Push a state object onto a state stack
+ *
+ ******************************************************************************/
+
+void
+acpi_ut_push_generic_state(union acpi_generic_state **list_head,
+                          union acpi_generic_state *state)
+{
+       ACPI_FUNCTION_TRACE("ut_push_generic_state");
+
+       /* Push the state object onto the front of the list (stack) */
+
+       state->common.next = *list_head;
+       *list_head = state;
+
+       return_VOID;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_pop_generic_state
+ *
+ * PARAMETERS:  list_head           - Head of the state stack
+ *
+ * RETURN:      The popped state object
+ *
+ * DESCRIPTION: Pop a state object from a state stack
+ *
+ ******************************************************************************/
+
+union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
+                                                   **list_head)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_TRACE("ut_pop_generic_state");
+
+       /* Remove the state object at the head of the list (stack) */
+
+       state = *list_head;
+       if (state) {
+               /* Update the list head */
+
+               *list_head = state->common.next;
+       }
+
+       return_PTR(state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_generic_state
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      The new state object. NULL on failure.
+ *
+ * DESCRIPTION: Create a generic state object.  Attempt to obtain one from
+ *              the global state cache;  If none available, create a new one.
+ *
+ ******************************************************************************/
+
+union acpi_generic_state *acpi_ut_create_generic_state(void)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_ENTRY();
+
+       state = acpi_os_acquire_object(acpi_gbl_state_cache);
+       if (state) {
+               /* Initialize */
+               memset(state, 0, sizeof(union acpi_generic_state));
+               state->common.data_type = ACPI_DESC_TYPE_STATE;
+       }
+
+       return (state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_thread_state
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      New Thread State. NULL on failure
+ *
+ * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
+ *              to track per-thread info during method execution
+ *
+ ******************************************************************************/
+
+struct acpi_thread_state *acpi_ut_create_thread_state(void)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_TRACE("ut_create_thread_state");
+
+       /* Create the generic state object */
+
+       state = acpi_ut_create_generic_state();
+       if (!state) {
+               return_PTR(NULL);
+       }
+
+       /* Init fields specific to the update struct */
+
+       state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD;
+       state->thread.thread_id = acpi_os_get_thread_id();
+
+       return_PTR((struct acpi_thread_state *)state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_update_state
+ *
+ * PARAMETERS:  Object          - Initial Object to be installed in the state
+ *              Action          - Update action to be performed
+ *
+ * RETURN:      New state object, null on failure
+ *
+ * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
+ *              to update reference counts and delete complex objects such
+ *              as packages.
+ *
+ ******************************************************************************/
+
+union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
+                                                     *object, u16 action)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object);
+
+       /* Create the generic state object */
+
+       state = acpi_ut_create_generic_state();
+       if (!state) {
+               return_PTR(NULL);
+       }
+
+       /* Init fields specific to the update struct */
+
+       state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE;
+       state->update.object = object;
+       state->update.value = action;
+
+       return_PTR(state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_pkg_state
+ *
+ * PARAMETERS:  Object          - Initial Object to be installed in the state
+ *              Action          - Update action to be performed
+ *
+ * RETURN:      New state object, null on failure
+ *
+ * DESCRIPTION: Create a "Package State"
+ *
+ ******************************************************************************/
+
+union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
+                                                  void *external_object,
+                                                  u16 index)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object);
+
+       /* Create the generic state object */
+
+       state = acpi_ut_create_generic_state();
+       if (!state) {
+               return_PTR(NULL);
+       }
+
+       /* Init fields specific to the update struct */
+
+       state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE;
+       state->pkg.source_object = (union acpi_operand_object *)internal_object;
+       state->pkg.dest_object = external_object;
+       state->pkg.index = index;
+       state->pkg.num_packages = 1;
+
+       return_PTR(state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_control_state
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      New state object, null on failure
+ *
+ * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
+ *              to support nested IF/WHILE constructs in the AML.
+ *
+ ******************************************************************************/
+
+union acpi_generic_state *acpi_ut_create_control_state(void)
+{
+       union acpi_generic_state *state;
+
+       ACPI_FUNCTION_TRACE("ut_create_control_state");
+
+       /* Create the generic state object */
+
+       state = acpi_ut_create_generic_state();
+       if (!state) {
+               return_PTR(NULL);
+       }
+
+       /* Init fields specific to the control struct */
+
+       state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
+       state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
+
+       return_PTR(state);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_delete_generic_state
+ *
+ * PARAMETERS:  State               - The state object to be deleted
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Put a state object back into the global state cache.  The object
+ *              is not actually freed at this time.
+ *
+ ******************************************************************************/
+
+void acpi_ut_delete_generic_state(union acpi_generic_state *state)
+{
+       ACPI_FUNCTION_TRACE("ut_delete_generic_state");
+
+       (void)acpi_os_release_object(acpi_gbl_state_cache, state);
+       return_VOID;
+}
index e8803d81065635ad7435ca1f8899a6b616b4e64b..f06bd5e5e9d1b2970b4cb33f897552177f786f6c 100644 (file)
 #include <acpi/acpi.h>
 #include <acpi/acevents.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
-#include <acpi/acdispat.h>
 #include <acpi/acdebug.h>
 
 #define _COMPONENT          ACPI_UTILITIES
-        ACPI_MODULE_NAME    ("utxface")
-
+ACPI_MODULE_NAME("utxface")
 
 /*******************************************************************************
  *
  *              called, so any early initialization belongs here.
  *
  ******************************************************************************/
-
-acpi_status
-acpi_initialize_subsystem (
-       void)
+acpi_status acpi_initialize_subsystem(void)
 {
-       acpi_status                     status;
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_initialize_subsystem");
 
-       ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem");
+       ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
 
+       /* Initialize the OS-Dependent layer */
 
-       ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ());
-
+       status = acpi_os_initialize();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
+       }
 
        /* Initialize all globals used by the subsystem */
 
-       acpi_ut_init_globals ();
-
-       /* Initialize the OS-Dependent layer */
-
-       status = acpi_os_initialize ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
-       }
+       acpi_ut_init_globals();
 
        /* Create the default mutex objects */
 
-       status = acpi_ut_mutex_initialize ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ut_mutex_initialize();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Initialize the namespace manager and
         * the root of the namespace tree
         */
-       status = acpi_ns_root_initialize ();
-       if (ACPI_FAILURE (status)) {
-               ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
-                       acpi_format_exception (status)));
-               return_ACPI_STATUS (status);
+       status = acpi_ns_root_initialize();
+       if (ACPI_FAILURE(status)) {
+               ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n",
+                                  acpi_format_exception(status)));
+               return_ACPI_STATUS(status);
        }
 
        /* If configured, initialize the AML debugger */
 
-       ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ());
+       ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enable_subsystem
@@ -134,41 +124,39 @@ acpi_initialize_subsystem (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_enable_subsystem (
-       u32                             flags)
+acpi_status acpi_enable_subsystem(u32 flags)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_enable_subsystem");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_enable_subsystem");
 
        /*
         * We must initialize the hardware before we can enable ACPI.
         * The values from the FADT are validated here.
         */
        if (!(flags & ACPI_NO_HARDWARE_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Initializing ACPI hardware\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Initializing ACPI hardware\n"));
 
-               status = acpi_hw_initialize ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_hw_initialize();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Enable ACPI mode */
 
        if (!(flags & ACPI_NO_ACPI_ENABLE)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Going into ACPI mode\n"));
 
                acpi_gbl_original_mode = acpi_hw_get_mode();
 
-               status = acpi_enable ();
-               if (ACPI_FAILURE (status)) {
-                       ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_enable failed.\n"));
-                       return_ACPI_STATUS (status);
+               status = acpi_enable();
+               if (ACPI_FAILURE(status)) {
+                       ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                         "acpi_enable failed.\n"));
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -178,12 +166,12 @@ acpi_enable_subsystem (
         * install_address_space_handler interface.
         */
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Installing default address space handlers\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Installing default address space handlers\n"));
 
-               status = acpi_ev_install_region_handlers ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ev_install_region_handlers();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -196,28 +184,28 @@ acpi_enable_subsystem (
         * execution!
         */
        if (!(flags & ACPI_NO_EVENT_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Initializing ACPI events\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Initializing ACPI events\n"));
 
-               status = acpi_ev_initialize_events ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ev_initialize_events();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
        /* Install the SCI handler and Global Lock handler */
 
        if (!(flags & ACPI_NO_HANDLER_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Installing SCI/GL handlers\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Installing SCI/GL handlers\n"));
 
-               status = acpi_ev_install_xrupt_handlers ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ev_install_xrupt_handlers();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
@@ -233,15 +221,11 @@ acpi_enable_subsystem (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_initialize_objects (
-       u32                             flags)
+acpi_status acpi_initialize_objects(u32 flags)
 {
-       acpi_status                     status = AE_OK;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_initialize_objects");
+       acpi_status status = AE_OK;
 
+       ACPI_FUNCTION_TRACE("acpi_initialize_objects");
 
        /*
         * Run all _REG methods
@@ -251,12 +235,12 @@ acpi_initialize_objects (
         * contain executable AML (see call to acpi_ns_initialize_objects below).
         */
        if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Executing _REG op_region methods\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Executing _REG op_region methods\n"));
 
-               status = acpi_ev_initialize_op_regions ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ev_initialize_op_regions();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -266,12 +250,12 @@ acpi_initialize_objects (
         * objects: operation_regions, buffer_fields, Buffers, and Packages.
         */
        if (!(flags & ACPI_NO_OBJECT_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Completing Initialization of ACPI Objects\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Completing Initialization of ACPI Objects\n"));
 
-               status = acpi_ns_initialize_objects ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ns_initialize_objects();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -280,12 +264,12 @@ acpi_initialize_objects (
         * This runs the _STA and _INI methods.
         */
        if (!(flags & ACPI_NO_DEVICE_INIT)) {
-               ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-                       "[Init] Initializing ACPI Devices\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+                                 "[Init] Initializing ACPI Devices\n"));
 
-               status = acpi_ns_initialize_devices ();
-               if (ACPI_FAILURE (status)) {
-                       return_ACPI_STATUS (status);
+               status = acpi_ns_initialize_devices();
+               if (ACPI_FAILURE(status)) {
+                       return_ACPI_STATUS(status);
                }
        }
 
@@ -294,13 +278,12 @@ acpi_initialize_objects (
         * the table load filled them up more than they will be at runtime --
         * thus wasting non-paged memory.
         */
-       status = acpi_purge_cached_objects ();
+       status = acpi_purge_cached_objects();
 
        acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
-       return_ACPI_STATUS (status);
+       return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_terminate
@@ -313,15 +296,11 @@ acpi_initialize_objects (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_terminate (
-       void)
+acpi_status acpi_terminate(void)
 {
-       acpi_status                 status;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_terminate");
+       acpi_status status;
 
+       ACPI_FUNCTION_TRACE("acpi_terminate");
 
        /* Terminate the AML Debugger if present */
 
@@ -329,28 +308,25 @@ acpi_terminate (
 
        /* Shutdown and free all resources */
 
-       acpi_ut_subsystem_shutdown ();
-
+       acpi_ut_subsystem_shutdown();
 
        /* Free the mutex objects */
 
-       acpi_ut_mutex_terminate ();
-
+       acpi_ut_mutex_terminate();
 
 #ifdef ACPI_DEBUGGER
 
        /* Shut down the debugger */
 
-       acpi_db_terminate ();
+       acpi_db_terminate();
 #endif
 
        /* Now we can shutdown the OS-dependent layer */
 
-       status = acpi_os_terminate ();
-       return_ACPI_STATUS (status);
+       status = acpi_os_terminate();
+       return_ACPI_STATUS(status);
 }
 
-
 #ifdef ACPI_FUTURE_USAGE
 /*******************************************************************************
  *
@@ -366,20 +342,16 @@ acpi_terminate (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_subsystem_status (
-       void)
+acpi_status acpi_subsystem_status(void)
 {
 
        if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
                return (AE_OK);
-       }
-       else {
+       } else {
                return (AE_ERROR);
        }
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_get_system_info
@@ -398,64 +370,60 @@ acpi_subsystem_status (
  *
  ******************************************************************************/
 
-acpi_status
-acpi_get_system_info (
-       struct acpi_buffer              *out_buffer)
+acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
 {
-       struct acpi_system_info         *info_ptr;
-       acpi_status                     status;
-       u32                             i;
-
-
-       ACPI_FUNCTION_TRACE ("acpi_get_system_info");
+       struct acpi_system_info *info_ptr;
+       acpi_status status;
+       u32 i;
 
+       ACPI_FUNCTION_TRACE("acpi_get_system_info");
 
        /* Parameter validation */
 
-       status = acpi_ut_validate_buffer (out_buffer);
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status = acpi_ut_validate_buffer(out_buffer);
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /* Validate/Allocate/Clear caller buffer */
 
-       status = acpi_ut_initialize_buffer (out_buffer, sizeof (struct acpi_system_info));
-       if (ACPI_FAILURE (status)) {
-               return_ACPI_STATUS (status);
+       status =
+           acpi_ut_initialize_buffer(out_buffer,
+                                     sizeof(struct acpi_system_info));
+       if (ACPI_FAILURE(status)) {
+               return_ACPI_STATUS(status);
        }
 
        /*
         * Populate the return buffer
         */
-       info_ptr = (struct acpi_system_info *) out_buffer->pointer;
+       info_ptr = (struct acpi_system_info *)out_buffer->pointer;
 
-       info_ptr->acpi_ca_version   = ACPI_CA_VERSION;
+       info_ptr->acpi_ca_version = ACPI_CA_VERSION;
 
        /* System flags (ACPI capabilities) */
 
-       info_ptr->flags             = ACPI_SYS_MODE_ACPI;
+       info_ptr->flags = ACPI_SYS_MODE_ACPI;
 
        /* Timer resolution - 24 or 32 bits  */
 
        if (!acpi_gbl_FADT) {
                info_ptr->timer_resolution = 0;
-       }
-       else if (acpi_gbl_FADT->tmr_val_ext == 0) {
+       } else if (acpi_gbl_FADT->tmr_val_ext == 0) {
                info_ptr->timer_resolution = 24;
-       }
-       else {
+       } else {
                info_ptr->timer_resolution = 32;
        }
 
        /* Clear the reserved fields */
 
-       info_ptr->reserved1         = 0;
-       info_ptr->reserved2         = 0;
+       info_ptr->reserved1 = 0;
+       info_ptr->reserved2 = 0;
 
        /* Current debug levels */
 
-       info_ptr->debug_layer       = acpi_dbg_layer;
-       info_ptr->debug_level       = acpi_dbg_level;
+       info_ptr->debug_layer = acpi_dbg_layer;
+       info_ptr->debug_level = acpi_dbg_level;
 
        /* Current status of the ACPI tables, per table type */
 
@@ -464,10 +432,10 @@ acpi_get_system_info (
                info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
        }
 
-       return_ACPI_STATUS (AE_OK);
+       return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_get_system_info);
 
+EXPORT_SYMBOL(acpi_get_system_info);
 
 /*****************************************************************************
  *
@@ -485,9 +453,7 @@ EXPORT_SYMBOL(acpi_get_system_info);
  ****************************************************************************/
 
 acpi_status
-acpi_install_initialization_handler (
-       acpi_init_handler               handler,
-       u32                             function)
+acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
 {
 
        if (!handler) {
@@ -502,7 +468,7 @@ acpi_install_initialization_handler (
        return AE_OK;
 }
 
-#endif  /*  ACPI_FUTURE_USAGE  */
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 /*****************************************************************************
  *
@@ -516,19 +482,13 @@ acpi_install_initialization_handler (
  *
  ****************************************************************************/
 
-acpi_status
-acpi_purge_cached_objects (
-       void)
+acpi_status acpi_purge_cached_objects(void)
 {
-       ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects");
-
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-       acpi_ut_delete_generic_state_cache ();
-       acpi_ut_delete_object_cache ();
-       acpi_ds_delete_walk_state_cache ();
-       acpi_ps_delete_parse_cache ();
-#endif
+       ACPI_FUNCTION_TRACE("acpi_purge_cached_objects");
 
-       return_ACPI_STATUS (AE_OK);
+       (void)acpi_os_purge_cache(acpi_gbl_state_cache);
+       (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
+       (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
+       (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
+       return_ACPI_STATUS(AE_OK);
 }
index 1ce2047c3804d828fd16404838154af9e9bec8be..6458c47f7ac202c5113fab82f2563f11d477bac8 100644 (file)
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
-
 #define _COMPONENT             ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME               ("acpi_utils")
-
+ACPI_MODULE_NAME("acpi_utils")
 
 /* --------------------------------------------------------------------------
                             Object Evaluation Helpers
    -------------------------------------------------------------------------- */
-
 #ifdef ACPI_DEBUG_OUTPUT
 #define acpi_util_eval_error(h,p,s) {\
        char prefix[80] = {'\0'};\
@@ -49,26 +46,24 @@ ACPI_MODULE_NAME            ("acpi_utils")
 #else
 #define acpi_util_eval_error(h,p,s)
 #endif
-
-
 acpi_status
-acpi_extract_package (
-       union acpi_object       *package,
-       struct acpi_buffer      *format,
-       struct acpi_buffer      *buffer)
+acpi_extract_package(union acpi_object *package,
+                    struct acpi_buffer *format, struct acpi_buffer *buffer)
 {
-       u32                     size_required = 0;
-       u32                     tail_offset = 0;
-       char                    *format_string = NULL;
-       u32                     format_count = 0;
-       u32                     i = 0;
-       u8                      *head = NULL;
-       u8                      *tail = NULL;
+       u32 size_required = 0;
+       u32 tail_offset = 0;
+       char *format_string = NULL;
+       u32 format_count = 0;
+       u32 i = 0;
+       u8 *head = NULL;
+       u8 *tail = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_extract_package");
 
-       if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'package' argument\n"));
+       if (!package || (package->type != ACPI_TYPE_PACKAGE)
+           || (package->package.count < 1)) {
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Invalid 'package' argument\n"));
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -82,18 +77,20 @@ acpi_extract_package (
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
-       format_count = (format->length/sizeof(char)) - 1;
+       format_count = (format->length / sizeof(char)) - 1;
        if (format_count > package->package.count) {
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
+               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                 "Format specifies more objects [%d] than exist in package [%d].",
+                                 format_count, package->package.count));
                return_ACPI_STATUS(AE_BAD_DATA);
        }
 
-       format_string = (char*)format->pointer;
+       format_string = (char *)format->pointer;
 
        /*
         * Calculate size_required.
         */
-       for (i=0; i<format_count; i++) {
+       for (i = 0; i < format_count; i++) {
 
                union acpi_object *element = &(package->package.elements[i]);
 
@@ -110,11 +107,15 @@ acpi_extract_package (
                                tail_offset += sizeof(acpi_integer);
                                break;
                        case 'S':
-                               size_required += sizeof(char*) + sizeof(acpi_integer) + sizeof(char);
-                               tail_offset += sizeof(char*);
+                               size_required +=
+                                   sizeof(char *) + sizeof(acpi_integer) +
+                                   sizeof(char);
+                               tail_offset += sizeof(char *);
                                break;
                        default:
-                               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format_string[i]));
+                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                 "Invalid package element [%d]: got number, expecing [%c].\n",
+                                                 i, format_string[i]));
                                return_ACPI_STATUS(AE_BAD_DATA);
                                break;
                        }
@@ -124,15 +125,22 @@ acpi_extract_package (
                case ACPI_TYPE_BUFFER:
                        switch (format_string[i]) {
                        case 'S':
-                               size_required += sizeof(char*) + (element->string.length * sizeof(char)) + sizeof(char);
-                               tail_offset += sizeof(char*);
+                               size_required +=
+                                   sizeof(char *) +
+                                   (element->string.length * sizeof(char)) +
+                                   sizeof(char);
+                               tail_offset += sizeof(char *);
                                break;
                        case 'B':
-                               size_required += sizeof(u8*) + (element->buffer.length * sizeof(u8));
-                               tail_offset += sizeof(u8*);
+                               size_required +=
+                                   sizeof(u8 *) +
+                                   (element->buffer.length * sizeof(u8));
+                               tail_offset += sizeof(u8 *);
                                break;
                        default:
-                               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format_string[i]));
+                               ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+                                                 "Invalid package element [%d] got string/buffer, expecing [%c].\n",
+                                                 i, format_string[i]));
                                return_ACPI_STATUS(AE_BAD_DATA);
                                break;
                        }
@@ -140,7 +148,9 @@ acpi_extract_package (
 
                case ACPI_TYPE_PACKAGE:
                default:
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d\n", i));
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "Found unsupported element at index=%d\n",
+                                         i));
                        /* TBD: handle nested packages... */
                        return_ACPI_STATUS(AE_SUPPORT);
                        break;
@@ -153,8 +163,7 @@ acpi_extract_package (
        if (buffer->length < size_required) {
                buffer->length = size_required;
                return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
-       }
-       else if (buffer->length != size_required || !buffer->pointer) {
+       } else if (buffer->length != size_required || !buffer->pointer) {
                return_ACPI_STATUS(AE_BAD_PARAMETER);
        }
 
@@ -164,7 +173,7 @@ acpi_extract_package (
        /*
         * Extract package data.
         */
-       for (i=0; i<format_count; i++) {
+       for (i = 0; i < format_count; i++) {
 
                u8 **pointer = NULL;
                union acpi_object *element = &(package->package.elements[i]);
@@ -178,14 +187,16 @@ acpi_extract_package (
                case ACPI_TYPE_INTEGER:
                        switch (format_string[i]) {
                        case 'N':
-                               *((acpi_integer*)head) = element->integer.value;
+                               *((acpi_integer *) head) =
+                                   element->integer.value;
                                head += sizeof(acpi_integer);
                                break;
                        case 'S':
-                               pointer = (u8**)head;
+                               pointer = (u8 **) head;
                                *pointer = tail;
-                               *((acpi_integer*)tail) = element->integer.value;
-                               head += sizeof(acpi_integer*);
+                               *((acpi_integer *) tail) =
+                                   element->integer.value;
+                               head += sizeof(acpi_integer *);
                                tail += sizeof(acpi_integer);
                                /* NULL terminate string */
                                *tail = (char)0;
@@ -201,20 +212,22 @@ acpi_extract_package (
                case ACPI_TYPE_BUFFER:
                        switch (format_string[i]) {
                        case 'S':
-                               pointer = (u8**)head;
+                               pointer = (u8 **) head;
                                *pointer = tail;
-                               memcpy(tail, element->string.pointer, element->string.length);
-                               head += sizeof(char*);
+                               memcpy(tail, element->string.pointer,
+                                      element->string.length);
+                               head += sizeof(char *);
                                tail += element->string.length * sizeof(char);
                                /* NULL terminate string */
                                *tail = (char)0;
                                tail += sizeof(char);
                                break;
                        case 'B':
-                               pointer = (u8**)head;
+                               pointer = (u8 **) head;
                                *pointer = tail;
-                               memcpy(tail, element->buffer.pointer, element->buffer.length);
-                               head += sizeof(u8*);
+                               memcpy(tail, element->buffer.pointer,
+                                      element->buffer.length);
+                               head += sizeof(u8 *);
                                tail += element->buffer.length * sizeof(u8);
                                break;
                        default:
@@ -233,19 +246,17 @@ acpi_extract_package (
 
        return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_extract_package);
 
+EXPORT_SYMBOL(acpi_extract_package);
 
 acpi_status
-acpi_evaluate_integer (
-       acpi_handle             handle,
-       acpi_string             pathname,
-       struct acpi_object_list *arguments,
-       unsigned long           *data)
+acpi_evaluate_integer(acpi_handle handle,
+                     acpi_string pathname,
+                     struct acpi_object_list *arguments, unsigned long *data)
 {
-       acpi_status             status = AE_OK;
-       union acpi_object       *element;
-       struct acpi_buffer      buffer = {0,NULL};
+       acpi_status status = AE_OK;
+       union acpi_object *element;
+       struct acpi_buffer buffer = { 0, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_evaluate_integer");
 
@@ -253,7 +264,7 @@ acpi_evaluate_integer (
                return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
-       if(!element)
+       if (!element)
                return_ACPI_STATUS(AE_NO_MEMORY);
 
        memset(element, 0, sizeof(union acpi_object));
@@ -277,20 +288,18 @@ acpi_evaluate_integer (
 
        return_ACPI_STATUS(AE_OK);
 }
-EXPORT_SYMBOL(acpi_evaluate_integer);
 
+EXPORT_SYMBOL(acpi_evaluate_integer);
 
 #if 0
 acpi_status
-acpi_evaluate_string (
-       acpi_handle             handle,
-       acpi_string             pathname,
-       acpi_object_list        *arguments,
-       acpi_string             *data)
+acpi_evaluate_string(acpi_handle handle,
+                    acpi_string pathname,
+                    acpi_object_list * arguments, acpi_string * data)
 {
-       acpi_status             status = AE_OK;
-       acpi_object             *element = NULL;
-       acpi_buffer             buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+       acpi_status status = AE_OK;
+       acpi_object *element = NULL;
+       acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
        ACPI_FUNCTION_TRACE("acpi_evaluate_string");
 
@@ -305,9 +314,9 @@ acpi_evaluate_string (
 
        element = (acpi_object *) buffer.pointer;
 
-       if ((element->type != ACPI_TYPE_STRING) 
-               || (element->type != ACPI_TYPE_BUFFER)
-               || !element->string.length) {
+       if ((element->type != ACPI_TYPE_STRING)
+           || (element->type != ACPI_TYPE_BUFFER)
+           || !element->string.length) {
                acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
                return_ACPI_STATUS(AE_BAD_DATA);
        }
@@ -329,19 +338,17 @@ acpi_evaluate_string (
 }
 #endif
 
-
 acpi_status
-acpi_evaluate_reference (
-       acpi_handle             handle,
-       acpi_string             pathname,
-       struct acpi_object_list *arguments,
-       struct acpi_handle_list *list)
+acpi_evaluate_reference(acpi_handle handle,
+                       acpi_string pathname,
+                       struct acpi_object_list *arguments,
+                       struct acpi_handle_list *list)
 {
-       acpi_status             status = AE_OK;
-       union acpi_object       *package = NULL;
-       union acpi_object       *element = NULL;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       u32                     i = 0;
+       acpi_status status = AE_OK;
+       union acpi_object *package = NULL;
+       union acpi_object *element = NULL;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       u32 i = 0;
 
        ACPI_FUNCTION_TRACE("acpi_evaluate_reference");
 
@@ -355,28 +362,28 @@ acpi_evaluate_reference (
        if (ACPI_FAILURE(status))
                goto end;
 
-       package = (union acpi_object *) buffer.pointer;
+       package = (union acpi_object *)buffer.pointer;
 
        if ((buffer.length == 0) || !package) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "No return object (len %X ptr %p)\n", 
-                       (unsigned)buffer.length, package));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "No return object (len %X ptr %p)\n",
+                                 (unsigned)buffer.length, package));
                status = AE_BAD_DATA;
                acpi_util_eval_error(handle, pathname, status);
                goto end;
        }
        if (package->type != ACPI_TYPE_PACKAGE) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "Expecting a [Package], found type %X\n", 
-                       package->type));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Expecting a [Package], found type %X\n",
+                                 package->type));
                status = AE_BAD_DATA;
                acpi_util_eval_error(handle, pathname, status);
                goto end;
        }
        if (!package->package.count) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                       "[Package] has zero elements (%p)\n", 
-                       package));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "[Package] has zero elements (%p)\n",
+                                 package));
                status = AE_BAD_DATA;
                acpi_util_eval_error(handle, pathname, status);
                goto end;
@@ -395,9 +402,9 @@ acpi_evaluate_reference (
 
                if (element->type != ACPI_TYPE_ANY) {
                        status = AE_BAD_DATA;
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 
-                               "Expecting a [Reference] package element, found type %X\n",
-                               element->type));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Expecting a [Reference] package element, found type %X\n",
+                                         element->type));
                        acpi_util_eval_error(handle, pathname, status);
                        break;
                }
@@ -406,10 +413,10 @@ acpi_evaluate_reference (
 
                list->handles[i] = element->reference.handle;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]\n",
-                       list->handles[i]));
+                                 list->handles[i]));
        }
 
-end:
+      end:
        if (ACPI_FAILURE(status)) {
                list->count = 0;
                //kfree(list->handles);
@@ -419,5 +426,5 @@ end:
 
        return_ACPI_STATUS(status);
 }
-EXPORT_SYMBOL(acpi_evaluate_reference);
 
+EXPORT_SYMBOL(acpi_evaluate_reference);
index 2cf264fd52e072e42fcff07b9cc6c948c9cbbede..e383d6109ae109c6963d43abe7ca71449e554518 100644 (file)
 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS      0x85
 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF          0x86
 
-
 #define ACPI_VIDEO_HEAD_INVALID                (~0u - 1)
 #define ACPI_VIDEO_HEAD_END            (~0u)
 
-
 #define _COMPONENT             ACPI_VIDEO_COMPONENT
-ACPI_MODULE_NAME               ("acpi_video")
+ACPI_MODULE_NAME("acpi_video")
 
-MODULE_AUTHOR("Bruno Ducrot");
+    MODULE_AUTHOR("Bruno Ducrot");
 MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int acpi_video_bus_add (struct acpi_device *device);
-static int acpi_video_bus_remove (struct acpi_device *device, int type);
-static int acpi_video_bus_match (struct acpi_device *device, struct acpi_driver *driver);
+static int acpi_video_bus_add(struct acpi_device *device);
+static int acpi_video_bus_remove(struct acpi_device *device, int type);
+static int acpi_video_bus_match(struct acpi_device *device,
+                               struct acpi_driver *driver);
 
 static struct acpi_driver acpi_video_bus = {
        .name = ACPI_VIDEO_DRIVER_NAME,
@@ -76,187 +75,192 @@ static struct acpi_driver acpi_video_bus = {
                .add = acpi_video_bus_add,
                .remove = acpi_video_bus_remove,
                .match = acpi_video_bus_match,
-       },
+               },
 };
 
 struct acpi_video_bus_flags {
-       u8      multihead:1;    /* can switch video heads */
-       u8      rom:1;          /* can retrieve a video rom */
-       u8      post:1;         /* can configure the head to */
-       u8      reserved:5;
+       u8 multihead:1;         /* can switch video heads */
+       u8 rom:1;               /* can retrieve a video rom */
+       u8 post:1;              /* can configure the head to */
+       u8 reserved:5;
 };
 
 struct acpi_video_bus_cap {
-       u8      _DOS:1; /*Enable/Disable output switching*/
-       u8      _DOD:1; /*Enumerate all devices attached to display adapter*/
-       u8      _ROM:1; /*Get ROM Data*/
-       u8      _GPD:1; /*Get POST Device*/
-       u8      _SPD:1; /*Set POST Device*/
-       u8      _VPO:1; /*Video POST Options*/
-       u8      reserved:2;
+       u8 _DOS:1;              /*Enable/Disable output switching */
+       u8 _DOD:1;              /*Enumerate all devices attached to display adapter */
+       u8 _ROM:1;              /*Get ROM Data */
+       u8 _GPD:1;              /*Get POST Device */
+       u8 _SPD:1;              /*Set POST Device */
+       u8 _VPO:1;              /*Video POST Options */
+       u8 reserved:2;
 };
 
-struct acpi_video_device_attrib{
-       u32     display_index:4; /* A zero-based instance of the Display*/
-       u32     display_port_attachment:4; /*This field differenates displays type*/
-       u32     display_type:4; /*Describe the specific type in use*/
-       u32     vendor_specific:4; /*Chipset Vendor Specifi*/ 
-       u32     bios_can_detect:1; /*BIOS can detect the device*/
-       u32     depend_on_vga:1; /*Non-VGA output device whose power is related to 
-                                  the VGA device.*/
-       u32     pipe_id:3; /*For VGA multiple-head devices.*/
-       u32     reserved:10; /*Must be 0*/
-       u32     device_id_scheme:1; /*Device ID Scheme*/
+struct acpi_video_device_attrib {
+       u32 display_index:4;    /* A zero-based instance of the Display */
+       u32 display_port_attachment:4;  /*This field differenates displays type */
+       u32 display_type:4;     /*Describe the specific type in use */
+       u32 vendor_specific:4;  /*Chipset Vendor Specifi */
+       u32 bios_can_detect:1;  /*BIOS can detect the device */
+       u32 depend_on_vga:1;    /*Non-VGA output device whose power is related to 
+                                  the VGA device. */
+       u32 pipe_id:3;          /*For VGA multiple-head devices. */
+       u32 reserved:10;        /*Must be 0 */
+       u32 device_id_scheme:1; /*Device ID Scheme */
 };
 
 struct acpi_video_enumerated_device {
        union {
                u32 int_val;
-               struct acpi_video_device_attrib attrib;
+               struct acpi_video_device_attrib attrib;
        } value;
        struct acpi_video_device *bind_info;
 };
 
 struct acpi_video_bus {
-       acpi_handle     handle;
-       u8      dos_setting;
+       acpi_handle handle;
+       u8 dos_setting;
        struct acpi_video_enumerated_device *attached_array;
-       u8                      attached_count;
-       struct acpi_video_bus_cap       cap;
+       u8 attached_count;
+       struct acpi_video_bus_cap cap;
        struct acpi_video_bus_flags flags;
-       struct semaphore        sem;
-       struct list_head        video_device_list;
-       struct proc_dir_entry   *dir;
+       struct semaphore sem;
+       struct list_head video_device_list;
+       struct proc_dir_entry *dir;
 };
 
 struct acpi_video_device_flags {
-       u8      crt:1;
-       u8      lcd:1;
-       u8      tvout:1;
-       u8      bios:1;
-       u8      unknown:1;
-       u8      reserved:3;
+       u8 crt:1;
+       u8 lcd:1;
+       u8 tvout:1;
+       u8 bios:1;
+       u8 unknown:1;
+       u8 reserved:3;
 };
 
 struct acpi_video_device_cap {
-       u8      _ADR:1; /*Return the unique ID */
-       u8      _BCL:1; /*Query list of brightness control levels supported*/
-       u8      _BCM:1; /*Set the brightness level*/
-       u8      _DDC:1; /*Return the EDID for this device*/
-       u8      _DCS:1; /*Return status of output device*/
-       u8      _DGS:1; /*Query graphics state*/
-       u8      _DSS:1; /*Device state set*/
-       u8      _reserved:1;
+       u8 _ADR:1;              /*Return the unique ID */
+       u8 _BCL:1;              /*Query list of brightness control levels supported */
+       u8 _BCM:1;              /*Set the brightness level */
+       u8 _DDC:1;              /*Return the EDID for this device */
+       u8 _DCS:1;              /*Return status of output device */
+       u8 _DGS:1;              /*Query graphics state */
+       u8 _DSS:1;              /*Device state set */
+       u8 _reserved:1;
 };
 
 struct acpi_video_device_brightness {
-       int     curr;
-       int     count;
-       int     *levels;
+       int curr;
+       int count;
+       int *levels;
 };
 
 struct acpi_video_device {
-       acpi_handle             handle;
-       unsigned long           device_id;
-       struct acpi_video_device_flags  flags;
-       struct acpi_video_device_cap    cap;
-       struct list_head        entry;
-       struct acpi_video_bus   *video;
-       struct acpi_device      *dev;
+       acpi_handle handle;
+       unsigned long device_id;
+       struct acpi_video_device_flags flags;
+       struct acpi_video_device_cap cap;
+       struct list_head entry;
+       struct acpi_video_bus *video;
+       struct acpi_device *dev;
        struct acpi_video_device_brightness *brightness;
 };
 
-
 /* bus */
 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_info_fops = {
-       .open           = acpi_video_bus_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_bus_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_ROM_fops = {
-       .open           = acpi_video_bus_ROM_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_bus_ROM_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static int acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_bus_POST_info_open_fs(struct inode *inode,
+                                           struct file *file);
 static struct file_operations acpi_video_bus_POST_info_fops = {
-       .open           = acpi_video_bus_POST_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_bus_POST_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_POST_fops = {
-       .open           = acpi_video_bus_POST_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_bus_POST_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-
 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_video_bus_DOS_fops = {
-       .open           = acpi_video_bus_DOS_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_bus_DOS_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
 /* device */
-static int acpi_video_device_info_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_info_open_fs(struct inode *inode,
+                                         struct file *file);
 static struct file_operations acpi_video_device_info_fops = {
-       .open           = acpi_video_device_info_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_device_info_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static int acpi_video_device_state_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_state_open_fs(struct inode *inode,
+                                          struct file *file);
 static struct file_operations acpi_video_device_state_fops = {
-       .open           = acpi_video_device_state_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_device_state_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static int acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_brightness_open_fs(struct inode *inode,
+                                               struct file *file);
 static struct file_operations acpi_video_device_brightness_fops = {
-       .open           = acpi_video_device_brightness_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_device_brightness_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static int acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file);
+static int acpi_video_device_EDID_open_fs(struct inode *inode,
+                                         struct file *file);
 static struct file_operations acpi_video_device_EDID_fops = {
-       .open           = acpi_video_device_EDID_open_fs,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
+       .open = acpi_video_device_EDID_open_fs,
+       .read = seq_read,
+       .llseek = seq_lseek,
+       .release = single_release,
 };
 
-static char    device_decode[][30] = {
+static char device_decode[][30] = {
        "motherboard VGA device",
        "PCI VGA device",
        "AGP VGA device",
        "UNKNOWN",
 };
 
-static void acpi_video_device_notify ( acpi_handle handle, u32 event, void *data);
-static void acpi_video_device_rebind( struct acpi_video_bus *video);
-static void acpi_video_device_bind( struct acpi_video_bus *video, struct acpi_video_device *device);
+static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data);
+static void acpi_video_device_rebind(struct acpi_video_bus *video);
+static void acpi_video_device_bind(struct acpi_video_bus *video,
+                                  struct acpi_video_device *device);
 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
-static int acpi_video_switch_output( struct acpi_video_bus *video, int event);
-static int acpi_video_get_next_level( struct acpi_video_device *device, u32 level_current,u32 event);
-static void acpi_video_switch_brightness ( struct acpi_video_device *device, int event);
-
+static int acpi_video_switch_output(struct acpi_video_bus *video, int event);
+static int acpi_video_get_next_level(struct acpi_video_device *device,
+                                    u32 level_current, u32 event);
+static void acpi_video_switch_brightness(struct acpi_video_device *device,
+                                        int event);
 
 /* --------------------------------------------------------------------------
                                Video Management
@@ -265,11 +269,9 @@ static void acpi_video_switch_brightness ( struct acpi_video_device *device, int
 /* device */
 
 static int
-acpi_video_device_query (
-       struct acpi_video_device        *device,
-       unsigned long                   *state)
+acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
 {
-       int                     status;
+       int status;
        ACPI_FUNCTION_TRACE("acpi_video_device_query");
        status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state);
 
@@ -277,11 +279,10 @@ acpi_video_device_query (
 }
 
 static int
-acpi_video_device_get_state (
-       struct acpi_video_device        *device,
-       unsigned long           *state)
+acpi_video_device_get_state(struct acpi_video_device *device,
+                           unsigned long *state)
 {
-       int                     status;
+       int status;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_get_state");
 
@@ -291,31 +292,28 @@ acpi_video_device_get_state (
 }
 
 static int
-acpi_video_device_set_state (
-       struct acpi_video_device        *device,
-       int                     state)
+acpi_video_device_set_state(struct acpi_video_device *device, int state)
 {
-       int                     status;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list args = {1, &arg0};
+       int status;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list args = { 1, &arg0 };
+       unsigned long ret;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_set_state");
 
        arg0.integer.value = state;
-       status = acpi_evaluate_integer(device->handle, "_DSS", &args, NULL);
+       status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret);
 
        return_VALUE(status);
 }
 
 static int
-acpi_video_device_lcd_query_levels (
-       struct acpi_video_device        *device,
-       union acpi_object               **levels)
+acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
+                                  union acpi_object **levels)
 {
-       int                     status;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *obj;
-
+       int status;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *obj;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels");
 
@@ -324,7 +322,7 @@ acpi_video_device_lcd_query_levels (
        status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
        if (!ACPI_SUCCESS(status))
                return_VALUE(status);
-       obj = (union acpi_object *) buffer.pointer;
+       obj = (union acpi_object *)buffer.pointer;
        if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n"));
                status = -EFAULT;
@@ -335,7 +333,7 @@ acpi_video_device_lcd_query_levels (
 
        return_VALUE(0);
 
-err:
+      err:
        if (buffer.pointer)
                kfree(buffer.pointer);
 
@@ -343,13 +341,11 @@ err:
 }
 
 static int
-acpi_video_device_lcd_set_level (
-       struct acpi_video_device        *device,
-       int                             level)
+acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
 {
-       int                     status;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list args = {1, &arg0};
+       int status;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list args = { 1, &arg0 };
 
        ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level");
 
@@ -361,11 +357,10 @@ acpi_video_device_lcd_set_level (
 }
 
 static int
-acpi_video_device_lcd_get_level_current (
-       struct acpi_video_device        *device,
-       unsigned long   *level)
+acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
+                                       unsigned long *level)
 {
-       int                     status;
+       int status;
        ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current");
 
        status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level);
@@ -374,16 +369,14 @@ acpi_video_device_lcd_get_level_current (
 }
 
 static int
-acpi_video_device_EDID (
-       struct acpi_video_device        *device,
-       union acpi_object               **edid,
-       ssize_t                         length)
+acpi_video_device_EDID(struct acpi_video_device *device,
+                      union acpi_object **edid, ssize_t length)
 {
-       int                     status;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *obj;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list args = {1, &arg0};
+       int status;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *obj;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list args = { 1, &arg0 };
 
        ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID");
 
@@ -402,7 +395,7 @@ acpi_video_device_EDID (
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       obj = (union acpi_object *) buffer.pointer;
+       obj = (union acpi_object *)buffer.pointer;
 
        if (obj && obj->type == ACPI_TYPE_BUFFER)
                *edid = obj;
@@ -415,18 +408,15 @@ acpi_video_device_EDID (
        return_VALUE(status);
 }
 
-
 /* bus */
 
 static int
-acpi_video_bus_set_POST (
-       struct acpi_video_bus   *video,
-       unsigned long           option)
+acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
 {
-       int                     status;
-       unsigned long           tmp;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list args = {1, &arg0};
+       int status;
+       unsigned long tmp;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list args = { 1, &arg0 };
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST");
 
@@ -434,15 +424,13 @@ acpi_video_bus_set_POST (
 
        status = acpi_evaluate_integer(video->handle, "_SPD", &args, &tmp);
        if (ACPI_SUCCESS(status))
-               status = tmp ? (-EINVAL):(AE_OK);
+               status = tmp ? (-EINVAL) : (AE_OK);
 
        return_VALUE(status);
 }
 
 static int
-acpi_video_bus_get_POST (
-       struct acpi_video_bus   *video,
-       unsigned long           *id)
+acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
 {
        int status;
 
@@ -454,11 +442,10 @@ acpi_video_bus_get_POST (
 }
 
 static int
-acpi_video_bus_POST_options (
-       struct acpi_video_bus   *video,
-       unsigned long           *options)
+acpi_video_bus_POST_options(struct acpi_video_bus *video,
+                           unsigned long *options)
 {
-       int                     status;
+       int status;
        ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options");
 
        status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options);
@@ -489,18 +476,15 @@ acpi_video_bus_POST_options (
  */
 
 static int
-acpi_video_bus_DOS(
-       struct acpi_video_bus   *video,
-       int                     bios_flag,
-       int                     lcd_flag)
+acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
 {
-       acpi_integer            status = 0;
-       union acpi_object       arg0 = {ACPI_TYPE_INTEGER};
-       struct acpi_object_list args = {1, &arg0};
+       acpi_integer status = 0;
+       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+       struct acpi_object_list args = { 1, &arg0 };
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_DOS");
 
-       if (bios_flag < 0 || bios_flag >3 || lcd_flag < 0 || lcd_flag > 1){
+       if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
                status = -1;
                goto Failed;
        }
@@ -508,7 +492,7 @@ acpi_video_bus_DOS(
        video->dos_setting = arg0.integer.value;
        acpi_evaluate_object(video->handle, "_DOS", &args, NULL);
 
-Failed:
+      Failed:
        return_VALUE(status);
 }
 
@@ -523,10 +507,9 @@ Failed:
  *  device.
  */
 
-static void
-acpi_video_device_find_cap (struct acpi_video_device *device)
+static void acpi_video_device_find_cap(struct acpi_video_device *device)
 {
-       acpi_integer            status;
+       acpi_integer status;
        acpi_handle h_dummy1;
        int i;
        union acpi_object *obj = NULL;
@@ -534,27 +517,27 @@ acpi_video_device_find_cap (struct acpi_video_device *device)
 
        ACPI_FUNCTION_TRACE("acpi_video_device_find_cap");
 
-       memset( &device->cap, 0, 4);
+       memset(&device->cap, 0, 4);
 
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ADR", &h_dummy1))) {
                device->cap._ADR = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
-               device->cap._BCL= 1;
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCL", &h_dummy1))) {
+               device->cap._BCL = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
-               device->cap._BCM= 1;
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_BCM", &h_dummy1))) {
+               device->cap._BCM = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
-               device->cap._DDC= 1;
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DDC", &h_dummy1))) {
+               device->cap._DDC = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DCS", &h_dummy1))) {
                device->cap._DCS = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DGS", &h_dummy1))) {
                device->cap._DGS = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DSS", &h_dummy1))) {
                device->cap._DSS = 1;
        }
 
@@ -563,34 +546,38 @@ acpi_video_device_find_cap (struct acpi_video_device *device)
        if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
                int count = 0;
                union acpi_object *o;
-               
+
                br = kmalloc(sizeof(*br), GFP_KERNEL);
                if (!br) {
                        printk(KERN_ERR "can't allocate memory\n");
                } else {
                        memset(br, 0, sizeof(*br));
                        br->levels = kmalloc(obj->package.count *
-                                       sizeof *(br->levels), GFP_KERNEL);
+                                            sizeof *(br->levels), GFP_KERNEL);
                        if (!br->levels)
                                goto out;
 
                        for (i = 0; i < obj->package.count; i++) {
-                               o = (union acpi_object *) &obj->package.elements[i];
+                               o = (union acpi_object *)&obj->package.
+                                   elements[i];
                                if (o->type != ACPI_TYPE_INTEGER) {
-                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n"));
+                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                                         "Invalid data\n"));
                                        continue;
                                }
                                br->levels[count] = (u32) o->integer.value;
                                count++;
                        }
-out:
+                     out:
                        if (count < 2) {
                                kfree(br->levels);
                                kfree(br);
                        } else {
                                br->count = count;
                                device->brightness = br;
-                               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "found %d brightness levels\n", count));
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                                 "found %d brightness levels\n",
+                                                 count));
                        }
                }
        }
@@ -610,28 +597,27 @@ out:
  *  Find out all required AML method defined under the video bus device.
  */
 
-static void 
-acpi_video_bus_find_cap (struct acpi_video_bus *video)
+static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
 {
-       acpi_handle     h_dummy1;
+       acpi_handle h_dummy1;
 
-       memset(&video->cap ,0, 4);
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
+       memset(&video->cap0, 4);
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOS", &h_dummy1))) {
                video->cap._DOS = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_DOD", &h_dummy1))) {
                video->cap._DOD = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_ROM", &h_dummy1))) {
                video->cap._ROM = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_GPD", &h_dummy1))) {
                video->cap._GPD = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_SPD", &h_dummy1))) {
                video->cap._SPD = 1;
        }
-       ifACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
+       if (ACPI_SUCCESS(acpi_get_handle(video->handle, "_VPO", &h_dummy1))) {
                video->cap._VPO = 1;
        }
 }
@@ -641,12 +627,9 @@ acpi_video_bus_find_cap (struct acpi_video_bus *video)
  * support the desired features
  */
 
-static int
-acpi_video_bus_check (
-       struct acpi_video_bus   *video)
+static int acpi_video_bus_check(struct acpi_video_bus *video)
 {
-       acpi_status             status = -ENOENT;
-
+       acpi_status status = -ENOENT;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_check");
 
@@ -658,19 +641,19 @@ acpi_video_bus_check (
         */
 
        /* Does this device able to support video switching ? */
-       if(video->cap._DOS){
+       if (video->cap._DOS) {
                video->flags.multihead = 1;
                status = 0;
        }
 
        /* Does this device able to retrieve a retrieve a video ROM ? */
-       if(video->cap._ROM){
+       if (video->cap._ROM) {
                video->flags.rom = 1;
                status = 0;
        }
 
        /* Does this device able to configure which video device to POST ? */
-       if(video->cap._GPD && video->cap._SPD && video->cap._VPO){
+       if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
                video->flags.post = 1;
                status = 0;
        }
@@ -682,16 +665,14 @@ acpi_video_bus_check (
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry   *acpi_video_dir;
+static struct proc_dir_entry *acpi_video_dir;
 
 /* video devices */
 
-static int
-acpi_video_device_info_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_device        *dev = (struct acpi_video_device *) seq->private;
+       struct acpi_video_device *dev =
+           (struct acpi_video_device *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show");
 
@@ -709,30 +690,25 @@ acpi_video_device_info_seq_show (
        else
                seq_printf(seq, "UNKNOWN\n");
 
-       seq_printf(seq,"known by bios: %s\n",
-                  dev->flags.bios ? "yes":"no");
+       seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int
-acpi_video_device_info_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+acpi_video_device_info_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_device_info_seq_show,
                           PDE(inode)->data);
 }
 
-static int  
-acpi_video_device_state_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
 {
-       int                     status;
-       struct acpi_video_device        *dev = (struct acpi_video_device *) seq->private;
-       unsigned long   state;
+       int status;
+       struct acpi_video_device *dev =
+           (struct acpi_video_device *)seq->private;
+       unsigned long state;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show");
 
@@ -753,31 +729,27 @@ acpi_video_device_state_seq_show (
        else
                seq_printf(seq, "<not supported>\n");
 
-end:
+      end:
        return_VALUE(0);
 }
 
 static int
-acpi_video_device_state_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+acpi_video_device_state_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_device_state_seq_show,
                           PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_device_write_state (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data)
+acpi_video_device_write_state(struct file *file,
+                             const char __user * buffer,
+                             size_t count, loff_t * data)
 {
-       int                     status;
-       struct seq_file         *m = (struct seq_file *) file->private_data;
-       struct acpi_video_device        *dev = (struct acpi_video_device *) m->private;
-       char                    str[12] = {0};
-       u32                     state = 0;
+       int status;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_video_device *dev = (struct acpi_video_device *)m->private;
+       char str[12] = { 0 };
+       u32 state = 0;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_write_state");
 
@@ -789,7 +761,7 @@ acpi_video_device_write_state (
 
        str[count] = 0;
        state = simple_strtoul(str, NULL, 0);
-       state &= ((1ul<<31) | (1ul<<30) | (1ul<<0));
+       state &= ((1ul << 31) | (1ul << 30) | (1ul << 0));
 
        status = acpi_video_device_set_state(dev, state);
 
@@ -800,12 +772,11 @@ acpi_video_device_write_state (
 }
 
 static int
-acpi_video_device_brightness_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_device        *dev = (struct acpi_video_device *) seq->private;
-       int                     i;
+       struct acpi_video_device *dev =
+           (struct acpi_video_device *)seq->private;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show");
 
@@ -823,26 +794,22 @@ acpi_video_device_brightness_seq_show (
 }
 
 static int
-acpi_video_device_brightness_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_device_brightness_seq_show,
                           PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_device_write_brightness (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data)
+acpi_video_device_write_brightness(struct file *file,
+                                  const char __user * buffer,
+                                  size_t count, loff_t * data)
 {
-       struct seq_file         *m = (struct seq_file *) file->private_data;
-       struct acpi_video_device        *dev = (struct acpi_video_device *) m->private;
-       char                    str[4] = {0};
-       unsigned int            level = 0;
-       int                     i;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_video_device *dev = (struct acpi_video_device *)m->private;
+       char str[4] = { 0 };
+       unsigned int level = 0;
+       int i;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness");
 
@@ -854,14 +821,15 @@ acpi_video_device_write_brightness (
 
        str[count] = 0;
        level = simple_strtoul(str, NULL, 0);
-       
+
        if (level > 100)
                return_VALUE(-EFAULT);
 
        /* validate though the list of available levels */
        for (i = 0; i < dev->brightness->count; i++)
                if (level == dev->brightness->levels[i]) {
-                       if (ACPI_SUCCESS(acpi_video_device_lcd_set_level(dev, level)))
+                       if (ACPI_SUCCESS
+                           (acpi_video_device_lcd_set_level(dev, level)))
                                dev->brightness->curr = level;
                        break;
                }
@@ -869,24 +837,22 @@ acpi_video_device_write_brightness (
        return_VALUE(count);
 }
 
-static int
-acpi_video_device_EDID_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_device        *dev = (struct acpi_video_device *) seq->private;
-       int                     status;
-       int                     i;
-       union acpi_object       *edid = NULL;
+       struct acpi_video_device *dev =
+           (struct acpi_video_device *)seq->private;
+       int status;
+       int i;
+       union acpi_object *edid = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show");
 
        if (!dev)
                goto out;
 
-       status = acpi_video_device_EDID (dev, &edid, 128);
+       status = acpi_video_device_EDID(dev, &edid, 128);
        if (ACPI_FAILURE(status)) {
-               status = acpi_video_device_EDID (dev, &edid, 256);
+               status = acpi_video_device_EDID(dev, &edid, 256);
        }
 
        if (ACPI_FAILURE(status)) {
@@ -898,7 +864,7 @@ acpi_video_device_EDID_seq_show (
                        seq_putc(seq, edid->buffer.pointer[i]);
        }
 
-out:
+      out:
        if (!edid)
                seq_printf(seq, "<not supported>\n");
        else
@@ -908,20 +874,15 @@ out:
 }
 
 static int
-acpi_video_device_EDID_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_device_EDID_seq_show,
                           PDE(inode)->data);
 }
 
-
-static int
-acpi_video_device_add_fs (
-       struct acpi_device      *device)
+static int acpi_video_device_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
+       struct proc_dir_entry *entry = NULL;
        struct acpi_video_device *vid_dev;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_add_fs");
@@ -929,13 +890,13 @@ acpi_video_device_add_fs (
        if (!device)
                return_VALUE(-ENODEV);
 
-       vid_dev = (struct acpi_video_device *) acpi_driver_data(device);
+       vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
        if (!vid_dev)
                return_VALUE(-ENODEV);
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                               vid_dev->video->dir);
+                                                    vid_dev->video->dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                acpi_device_dir(device)->owner = THIS_MODULE;
@@ -945,7 +906,7 @@ acpi_video_device_add_fs (
        entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create 'info' fs entry\n"));
+                                 "Unable to create 'info' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_device_info_fops;
                entry->data = acpi_driver_data(device);
@@ -953,10 +914,12 @@ acpi_video_device_add_fs (
        }
 
        /* 'state' [R/W] */
-       entry = create_proc_entry("state", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+       entry =
+           create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
+                             acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create 'state' fs entry\n"));
+                                 "Unable to create 'state' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_device_state_fops;
                entry->proc_fops->write = acpi_video_device_write_state;
@@ -965,10 +928,12 @@ acpi_video_device_add_fs (
        }
 
        /* 'brightness' [R/W] */
-       entry = create_proc_entry("brightness", S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
+       entry =
+           create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
+                             acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create 'brightness' fs entry\n"));
+                                 "Unable to create 'brightness' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_device_brightness_fops;
                entry->proc_fops->write = acpi_video_device_write_brightness;
@@ -980,7 +945,7 @@ acpi_video_device_add_fs (
        entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
        if (!entry)
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Unable to create 'brightness' fs entry\n"));
+                                 "Unable to create 'brightness' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_device_EDID_fops;
                entry->data = acpi_driver_data(device);
@@ -990,14 +955,12 @@ acpi_video_device_add_fs (
        return_VALUE(0);
 }
 
-static int
-acpi_video_device_remove_fs (
-       struct acpi_device      *device)
+static int acpi_video_device_remove_fs(struct acpi_device *device)
 {
        struct acpi_video_device *vid_dev;
        ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs");
 
-       vid_dev = (struct acpi_video_device *) acpi_driver_data(device);
+       vid_dev = (struct acpi_video_device *)acpi_driver_data(device);
        if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
                return_VALUE(-ENODEV);
 
@@ -1006,22 +969,17 @@ acpi_video_device_remove_fs (
                remove_proc_entry("state", acpi_device_dir(device));
                remove_proc_entry("brightness", acpi_device_dir(device));
                remove_proc_entry("EDID", acpi_device_dir(device));
-               remove_proc_entry(acpi_device_bid(device),
-                                vid_dev->video->dir);
+               remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir);
                acpi_device_dir(device) = NULL;
        }
 
        return_VALUE(0);
 }
 
-
 /* video bus */
-static int
-acpi_video_bus_info_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) seq->private;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show");
 
@@ -1029,30 +987,25 @@ acpi_video_bus_info_seq_show (
                goto end;
 
        seq_printf(seq, "Switching heads:              %s\n",
-                       video->flags.multihead ? "yes":"no");
+                  video->flags.multihead ? "yes" : "no");
        seq_printf(seq, "Video ROM:                    %s\n",
-                       video->flags.rom ? "yes":"no");
+                  video->flags.rom ? "yes" : "no");
        seq_printf(seq, "Device to be POSTed on boot:  %s\n",
-                       video->flags.post ? "yes":"no");
+                  video->flags.post ? "yes" : "no");
 
-end:
+      end:
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_info_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
 {
-       return single_open(file, acpi_video_bus_info_seq_show, PDE(inode)->data);
+       return single_open(file, acpi_video_bus_info_seq_show,
+                          PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_ROM_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) seq->private;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show");
 
@@ -1062,26 +1015,20 @@ acpi_video_bus_ROM_seq_show (
        printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__);
        seq_printf(seq, "<TODO>\n");
 
-end:
+      end:
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_ROM_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_POST_info_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) seq->private;
-       unsigned long           options;
-       int                     status;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
+       unsigned long options;
+       int status;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show");
 
@@ -1091,8 +1038,10 @@ acpi_video_bus_POST_info_seq_show (
        status = acpi_video_bus_POST_options(video, &options);
        if (ACPI_SUCCESS(status)) {
                if (!(options & 1)) {
-                       printk(KERN_WARNING PREFIX "The motherboard VGA device is not listed as a possible POST device.\n");
-                       printk(KERN_WARNING PREFIX "This indicate a BIOS bug.  Please contact the manufacturer.\n");
+                       printk(KERN_WARNING PREFIX
+                              "The motherboard VGA device is not listed as a possible POST device.\n");
+                       printk(KERN_WARNING PREFIX
+                              "This indicate a BIOS bug.  Please contact the manufacturer.\n");
                }
                printk("%lx\n", options);
                seq_printf(seq, "can POST: <intgrated video>");
@@ -1103,89 +1052,74 @@ acpi_video_bus_POST_info_seq_show (
                seq_putc(seq, '\n');
        } else
                seq_printf(seq, "<not supported>\n");
-end:
+      end:
        return_VALUE(0);
 }
 
 static int
-acpi_video_bus_POST_info_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file)
 {
-       return single_open(file, acpi_video_bus_POST_info_seq_show, PDE(inode)->data);
+       return single_open(file, acpi_video_bus_POST_info_seq_show,
+                          PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_POST_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) seq->private;
-       int                     status;
-       unsigned long           id;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
+       int status;
+       unsigned long id;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show");
 
        if (!video)
                goto end;
 
-       status = acpi_video_bus_get_POST (video, &id);
+       status = acpi_video_bus_get_POST(video, &id);
        if (!ACPI_SUCCESS(status)) {
                seq_printf(seq, "<not supported>\n");
                goto end;
        }
-       seq_printf(seq, "device posted is <%s>\n",  device_decode[id & 3]);
+       seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
 
-end:
+      end:
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_DOS_seq_show (
-       struct seq_file         *seq,
-       void                    *offset)
+static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) seq->private;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show");
 
-       seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting );
+       seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
 
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_POST_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
 {
-       return single_open(file, acpi_video_bus_POST_seq_show, PDE(inode)->data);
+       return single_open(file, acpi_video_bus_POST_seq_show,
+                          PDE(inode)->data);
 }
 
-static int
-acpi_video_bus_DOS_open_fs (
-       struct inode            *inode,
-       struct file             *file)
+static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file)
 {
        return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
 }
 
 static ssize_t
-acpi_video_bus_write_POST (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data)
+acpi_video_bus_write_POST(struct file *file,
+                         const char __user * buffer,
+                         size_t count, loff_t * data)
 {
-       int                     status;
-       struct seq_file         *m = (struct seq_file *) file->private_data;
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) m->private;
-       char                    str[12] = {0};
-       unsigned long           opt, options;
+       int status;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)m->private;
+       char str[12] = { 0 };
+       unsigned long opt, options;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST");
 
-
        if (!video || count + 1 > sizeof str)
                return_VALUE(-EINVAL);
 
@@ -1205,32 +1139,28 @@ acpi_video_bus_write_POST (
        options |= 1;
 
        if (options & (1ul << opt)) {
-               status = acpi_video_bus_set_POST (video, opt);
+               status = acpi_video_bus_set_POST(video, opt);
                if (!ACPI_SUCCESS(status))
                        return_VALUE(-EFAULT);
 
        }
 
-
        return_VALUE(count);
 }
 
 static ssize_t
-acpi_video_bus_write_DOS (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data)
+acpi_video_bus_write_DOS(struct file *file,
+                        const char __user * buffer,
+                        size_t count, loff_t * data)
 {
-       int                     status;
-       struct seq_file         *m = (struct seq_file *) file->private_data;
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) m->private;
-       char                    str[12] = {0};
-       unsigned long           opt;
+       int status;
+       struct seq_file *m = (struct seq_file *)file->private_data;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)m->private;
+       char str[12] = { 0 };
+       unsigned long opt;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS");
 
-
        if (!video || count + 1 > sizeof str)
                return_VALUE(-EINVAL);
 
@@ -1242,7 +1172,7 @@ acpi_video_bus_write_DOS (
        if (opt > 7)
                return_VALUE(-EFAULT);
 
-       status = acpi_video_bus_DOS (video, opt & 0x3, (opt & 0x4)>>2);
+       status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
 
        if (!ACPI_SUCCESS(status))
                return_VALUE(-EFAULT);
@@ -1250,20 +1180,18 @@ acpi_video_bus_write_DOS (
        return_VALUE(count);
 }
 
-static int
-acpi_video_bus_add_fs (
-       struct acpi_device      *device)
+static int acpi_video_bus_add_fs(struct acpi_device *device)
 {
-       struct proc_dir_entry   *entry = NULL;
-       struct acpi_video_bus   *video;
+       struct proc_dir_entry *entry = NULL;
+       struct acpi_video_bus *video;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs");
 
-       video = (struct acpi_video_bus *) acpi_driver_data(device);
+       video = (struct acpi_video_bus *)acpi_driver_data(device);
 
        if (!acpi_device_dir(device)) {
                acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
-                               acpi_video_dir);
+                                                    acpi_video_dir);
                if (!acpi_device_dir(device))
                        return_VALUE(-ENODEV);
                video->dir = acpi_device_dir(device);
@@ -1273,7 +1201,8 @@ acpi_video_bus_add_fs (
        /* 'info' [R] */
        entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'info' fs entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create 'info' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_bus_info_fops;
                entry->data = acpi_driver_data(device);
@@ -1283,7 +1212,8 @@ acpi_video_bus_add_fs (
        /* 'ROM' [R] */
        entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'ROM' fs entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create 'ROM' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_bus_ROM_fops;
                entry->data = acpi_driver_data(device);
@@ -1291,9 +1221,11 @@ acpi_video_bus_add_fs (
        }
 
        /* 'POST_info' [R] */
-       entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
+       entry =
+           create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST_info' fs entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create 'POST_info' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_bus_POST_info_fops;
                entry->data = acpi_driver_data(device);
@@ -1301,9 +1233,12 @@ acpi_video_bus_add_fs (
        }
 
        /* 'POST' [R/W] */
-       entry = create_proc_entry("POST", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device));
+       entry =
+           create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
+                             acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'POST' fs entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create 'POST' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_bus_POST_fops;
                entry->proc_fops->write = acpi_video_bus_write_POST;
@@ -1312,9 +1247,12 @@ acpi_video_bus_add_fs (
        }
 
        /* 'DOS' [R/W] */
-       entry = create_proc_entry("DOS", S_IFREG|S_IRUGO|S_IRUSR, acpi_device_dir(device));
+       entry =
+           create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
+                             acpi_device_dir(device));
        if (!entry)
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to create 'DOS' fs entry\n"));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to create 'DOS' fs entry\n"));
        else {
                entry->proc_fops = &acpi_video_bus_DOS_fops;
                entry->proc_fops->write = acpi_video_bus_write_DOS;
@@ -1325,15 +1263,13 @@ acpi_video_bus_add_fs (
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_remove_fs (
-       struct acpi_device      *device)
+static int acpi_video_bus_remove_fs(struct acpi_device *device)
 {
-       struct acpi_video_bus   *video;
+       struct acpi_video_bus *video;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs");
 
-       video = (struct acpi_video_bus *) acpi_driver_data(device);
+       video = (struct acpi_video_bus *)acpi_driver_data(device);
 
        if (acpi_device_dir(device)) {
                remove_proc_entry("info", acpi_device_dir(device));
@@ -1341,8 +1277,7 @@ acpi_video_bus_remove_fs (
                remove_proc_entry("POST_info", acpi_device_dir(device));
                remove_proc_entry("POST", acpi_device_dir(device));
                remove_proc_entry("DOS", acpi_device_dir(device));
-               remove_proc_entry(acpi_device_bid(device),
-                               acpi_video_dir); 
+               remove_proc_entry(acpi_device_bid(device), acpi_video_dir);
                acpi_device_dir(device) = NULL;
        }
 
@@ -1356,20 +1291,20 @@ acpi_video_bus_remove_fs (
 /* device interface */
 
 static int
-acpi_video_bus_get_one_device (
-       struct acpi_device      *device,
-       struct acpi_video_bus   *video)
+acpi_video_bus_get_one_device(struct acpi_device *device,
+                             struct acpi_video_bus *video)
 {
-       unsigned long           device_id;
-       int                     status, result;
-       struct acpi_video_device        *data;
+       unsigned long device_id;
+       int status, result;
+       struct acpi_video_device *data;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device");
 
        if (!device || !video)
                return_VALUE(-EINVAL);
 
-       status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
+       status =
+           acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
        if (ACPI_SUCCESS(status)) {
 
                data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
@@ -1401,15 +1336,17 @@ acpi_video_bus_get_one_device (
                        data->flags.unknown = 1;
                        break;
                }
-               
+
                acpi_video_device_bind(video, data);
                acpi_video_device_find_cap(data);
 
                status = acpi_install_notify_handler(data->handle,
-                       ACPI_DEVICE_NOTIFY, acpi_video_device_notify, data);
+                                                    ACPI_DEVICE_NOTIFY,
+                                                    acpi_video_device_notify,
+                                                    data);
                if (ACPI_FAILURE(status)) {
                        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                               "Error installing notify handler\n"));
+                                         "Error installing notify handler\n"));
                        result = -ENODEV;
                        goto end;
                }
@@ -1423,7 +1360,7 @@ acpi_video_bus_get_one_device (
                return_VALUE(0);
        }
 
-end:
+      end:
        return_VALUE(-ENOENT);
 }
 
@@ -1437,15 +1374,15 @@ end:
  *  Enumerate the video device list of the video bus, 
  *  bind the ids with the corresponding video devices
  *  under the video bus.
- */  
+ */
 
-static void
-acpi_video_device_rebind( struct acpi_video_bus *video)
+static void acpi_video_device_rebind(struct acpi_video_bus *video)
 {
-       struct list_head * node, * next;
+       struct list_head *node, *next;
        list_for_each_safe(node, next, &video->video_device_list) {
-               struct acpi_video_device * dev = container_of(node, struct acpi_video_device, entry);
-               acpi_video_device_bind( video, dev);
+               struct acpi_video_device *dev =
+                   container_of(node, struct acpi_video_device, entry);
+               acpi_video_device_bind(video, dev);
        }
 }
 
@@ -1460,21 +1397,21 @@ acpi_video_device_rebind( struct acpi_video_bus *video)
  *  
  *  Bind the ids with the corresponding video devices
  *  under the video bus.
- */  
+ */
 
 static void
-acpi_video_device_bind( struct acpi_video_bus *video,
-                       struct acpi_video_device *device)
+acpi_video_device_bind(struct acpi_video_bus *video,
+                      struct acpi_video_device *device)
 {
-       int     i;
+       int i;
        ACPI_FUNCTION_TRACE("acpi_video_device_bind");
 
 #define IDS_VAL(i) video->attached_array[i].value.int_val
 #define IDS_BIND(i) video->attached_array[i].bind_info
-       
-       for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && 
-               i < video->attached_count; i++) {
-               if (device->device_id == (IDS_VAL(i)& 0xffff)) {
+
+       for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID &&
+            i < video->attached_count; i++) {
+               if (device->device_id == (IDS_VAL(i) & 0xffff)) {
                        IDS_BIND(i) = device;
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i));
                }
@@ -1492,17 +1429,17 @@ acpi_video_device_bind( struct acpi_video_bus *video,
  *  
  *  Call _DOD to enumerate all devices attached to display adapter
  *
- */  
+ */
 
 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
 {
-       int                     status;
-       int                     count;
-       int                     i;
+       int status;
+       int count;
+       int i;
        struct acpi_video_enumerated_device *active_device_list;
-       struct acpi_buffer      buffer = {ACPI_ALLOCATE_BUFFER, NULL};
-       union acpi_object       *dod = NULL;
-       union acpi_object       *obj;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       union acpi_object *dod = NULL;
+       union acpi_object *obj;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_enumerate");
 
@@ -1512,7 +1449,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
                return_VALUE(status);
        }
 
-       dod = (union acpi_object *) buffer.pointer;
+       dod = (union acpi_object *)buffer.pointer;
        if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n"));
                status = -EFAULT;
@@ -1520,11 +1457,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n",
-               dod->package.count));
+                         dod->package.count));
 
-       active_device_list= kmalloc(
-               (1+dod->package.count)*sizeof(struct acpi_video_enumerated_device),
-               GFP_KERNEL);
+       active_device_list = kmalloc((1 +
+                                     dod->package.count) *
+                                    sizeof(struct
+                                           acpi_video_enumerated_device),
+                                    GFP_KERNEL);
 
        if (!active_device_list) {
                status = -ENOMEM;
@@ -1533,25 +1472,28 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
 
        count = 0;
        for (i = 0; i < dod->package.count; i++) {
-               obj = (union acpi_object *) &dod->package.elements[i];
+               obj = (union acpi_object *)&dod->package.elements[i];
 
                if (obj->type != ACPI_TYPE_INTEGER) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n"));
-                       active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID;
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Invalid _DOD data\n"));
+                       active_device_list[i].value.int_val =
+                           ACPI_VIDEO_HEAD_INVALID;
                }
                active_device_list[i].value.int_val = obj->integer.value;
                active_device_list[i].bind_info = NULL;
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, (int) obj->integer.value));
+               ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i,
+                                 (int)obj->integer.value));
                count++;
        }
        active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
 
-       if(video->attached_array)
+       if (video->attached_array)
                kfree(video->attached_array);
-       
+
        video->attached_array = active_device_list;
        video->attached_count = count;
-out:
+      out:
        acpi_os_free(buffer.pointer);
        return_VALUE(status);
 }
@@ -1567,17 +1509,14 @@ out:
  *     1. Find out the current active output device.
  *     2. Identify the next output device to switch
  *     3. call _DSS to do actual switch.
- */  
+ */
 
-static int 
-acpi_video_switch_output(
-       struct acpi_video_bus *video, 
-       int     event)
+static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
 {
-       struct list_head * node, * next;
-       struct acpi_video_device *dev=NULL;
-               struct acpi_video_device *dev_next=NULL;
-       struct acpi_video_device *dev_prev=NULL;
+       struct list_head *node, *next;
+       struct acpi_video_device *dev = NULL;
+       struct acpi_video_device *dev_next = NULL;
+       struct acpi_video_device *dev_prev = NULL;
        unsigned long state;
        int status = 0;
 
@@ -1586,15 +1525,19 @@ acpi_video_switch_output(
        list_for_each_safe(node, next, &video->video_device_list) {
                dev = container_of(node, struct acpi_video_device, entry);
                status = acpi_video_device_get_state(dev, &state);
-               if (state & 0x2){
-                       dev_next = container_of(node->next, struct acpi_video_device, entry);
-                       dev_prev = container_of(node->prev, struct acpi_video_device, entry);
+               if (state & 0x2) {
+                       dev_next =
+                           container_of(node->next, struct acpi_video_device,
+                                        entry);
+                       dev_prev =
+                           container_of(node->prev, struct acpi_video_device,
+                                        entry);
                        goto out;
                }
        }
        dev_next = container_of(node->next, struct acpi_video_device, entry);
        dev_prev = container_of(node->prev, struct acpi_video_device, entry);
-out:   
+      out:
        switch (event) {
        case ACPI_VIDEO_NOTIFY_CYCLE:
        case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
@@ -1611,21 +1554,16 @@ out:
        return_VALUE(status);
 }
 
-static int 
-acpi_video_get_next_level(
-       struct acpi_video_device *device,
-       u32     level_current,
-       u32     event)
+static int
+acpi_video_get_next_level(struct acpi_video_device *device,
+                         u32 level_current, u32 event)
 {
-       /*Fix me*/
+       /*Fix me */
        return level_current;
 }
 
-
 static void
-acpi_video_switch_brightness (
-       struct acpi_video_device *device, 
-       int     event)
+acpi_video_switch_brightness(struct acpi_video_device *device, int event)
 {
        unsigned long level_current, level_next;
        acpi_video_device_lcd_get_level_current(device, &level_current);
@@ -1634,26 +1572,27 @@ acpi_video_switch_brightness (
 }
 
 static int
-acpi_video_bus_get_devices (
-       struct acpi_video_bus   *video,
-       struct acpi_device      *device)
+acpi_video_bus_get_devices(struct acpi_video_bus *video,
+                          struct acpi_device *device)
 {
-       int                     status = 0;
-       struct list_head        *node, *next;
+       int status = 0;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_video_get_devices");
 
        acpi_video_device_enumerate(video);
 
        list_for_each_safe(node, next, &device->children) {
-               struct acpi_device *dev = list_entry(node, struct acpi_device, node);
+               struct acpi_device *dev =
+                   list_entry(node, struct acpi_device, node);
 
                if (!dev)
                        continue;
 
                status = acpi_video_bus_get_one_device(dev, video);
                if (ACPI_FAILURE(status)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Cant attach device\n"));
+                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                         "Cant attach device\n"));
                        continue;
                }
 
@@ -1661,10 +1600,9 @@ acpi_video_bus_get_devices (
        return_VALUE(status);
 }
 
-static int
-acpi_video_bus_put_one_device(
-       struct acpi_video_device        *device)
+static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
 {
+       acpi_status status;
        struct acpi_video_bus *video;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device");
@@ -1679,26 +1617,33 @@ acpi_video_bus_put_one_device(
        up(&video->sem);
        acpi_video_device_remove_fs(device->dev);
 
+       status = acpi_remove_notify_handler(device->handle,
+                                           ACPI_DEVICE_NOTIFY,
+                                           acpi_video_device_notify);
+       if (ACPI_FAILURE(status))
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Error removing notify handler\n"));
+
        return_VALUE(0);
 }
 
-static int
-acpi_video_bus_put_devices (
-       struct acpi_video_bus   *video)
+static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
 {
-       int                     status;
-       struct list_head        *node, *next;
+       int status;
+       struct list_head *node, *next;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices");
 
        list_for_each_safe(node, next, &video->video_device_list) {
-               struct acpi_video_device *data = list_entry(node, struct acpi_video_device, entry);
+               struct acpi_video_device *data =
+                   list_entry(node, struct acpi_video_device, entry);
                if (!data)
                        continue;
 
                status = acpi_video_bus_put_one_device(data);
-               if(ACPI_FAILURE(status))
-                       printk(KERN_WARNING PREFIX "hhuuhhuu bug in acpi video driver.\n");
+               if (ACPI_FAILURE(status))
+                       printk(KERN_WARNING PREFIX
+                              "hhuuhhuu bug in acpi video driver.\n");
 
                if (data->brightness)
                        kfree(data->brightness);
@@ -1711,28 +1656,20 @@ acpi_video_bus_put_devices (
 
 /* acpi_video interface */
 
-static int
-acpi_video_bus_start_devices(
-       struct acpi_video_bus   *video)
+static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
 {
        return acpi_video_bus_DOS(video, 1, 0);
 }
 
-static int
-acpi_video_bus_stop_devices(
-       struct acpi_video_bus   *video)
+static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
 {
        return acpi_video_bus_DOS(video, 0, 1);
 }
 
-static void
-acpi_video_bus_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_video_bus   *video = (struct acpi_video_bus *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_video_bus *video = (struct acpi_video_bus *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_notify");
        printk("video bus notify\n");
@@ -1757,30 +1694,27 @@ acpi_video_bus_notify (
                acpi_bus_generate_event(device, event, 0);
                break;
 
-       case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed.*/
-       case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
-       case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
+       case ACPI_VIDEO_NOTIFY_CYCLE:   /* Cycle Display output hotkey pressed. */
+       case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:     /* Next Display output hotkey pressed. */
+       case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:     /* previous Display output hotkey pressed. */
                acpi_video_switch_output(video, event);
                acpi_bus_generate_event(device, event, 0);
                break;
 
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
 
        return_VOID;
 }
 
-static void
-acpi_video_device_notify (
-       acpi_handle             handle,
-       u32                     event,
-       void                    *data)
+static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct acpi_video_device        *video_device = (struct acpi_video_device *) data;
-       struct acpi_device      *device = NULL;
+       struct acpi_video_device *video_device =
+           (struct acpi_video_device *)data;
+       struct acpi_device *device = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_video_device_notify");
 
@@ -1792,36 +1726,34 @@ acpi_video_device_notify (
                return_VOID;
 
        switch (event) {
-       case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
-       case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */
+       case ACPI_VIDEO_NOTIFY_SWITCH:  /* change in status (cycle output device) */
+       case ACPI_VIDEO_NOTIFY_PROBE:   /* change in status (output device status) */
                acpi_bus_generate_event(device, event, 0);
                break;
-       case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
-       case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
-       case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
-       case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
-       case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
-               acpi_video_switch_brightness (video_device, event);
+       case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:        /* Cycle brightness */
+       case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:  /* Increase brightness */
+       case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:  /* Decrease brightness */
+       case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
+       case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:     /* display device off */
+               acpi_video_switch_brightness(video_device, event);
                acpi_bus_generate_event(device, event, 0);
                break;
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                       "Unsupported event [0x%x]\n", event));
+                                 "Unsupported event [0x%x]\n", event));
                break;
        }
        return_VOID;
 }
 
-static int
-acpi_video_bus_add (
-       struct acpi_device      *device)
+static int acpi_video_bus_add(struct acpi_device *device)
 {
-       int                     result = 0;
-       acpi_status             status = 0;
-       struct acpi_video_bus   *video = NULL;
+       int result = 0;
+       acpi_status status = 0;
+       struct acpi_video_bus *video = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_add");
-       
+
        if (!device)
                return_VALUE(-EINVAL);
 
@@ -1851,21 +1783,22 @@ acpi_video_bus_add (
        acpi_video_bus_start_devices(video);
 
        status = acpi_install_notify_handler(video->handle,
-               ACPI_DEVICE_NOTIFY, acpi_video_bus_notify, video);
+                                            ACPI_DEVICE_NOTIFY,
+                                            acpi_video_bus_notify, video);
        if (ACPI_FAILURE(status)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error installing notify handler\n"));
+                                 "Error installing notify handler\n"));
                result = -ENODEV;
                goto end;
        }
 
        printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s  rom: %s  post: %s)\n",
-               ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
-               video->flags.multihead ? "yes":"no",
-               video->flags.rom ? "yes":"no",
-               video->flags.post ? "yes":"no");
+              ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
+              video->flags.multihead ? "yes" : "no",
+              video->flags.rom ? "yes" : "no",
+              video->flags.post ? "yes" : "no");
 
-end:
+      end:
        if (result) {
                acpi_video_bus_remove_fs(device);
                kfree(video);
@@ -1874,28 +1807,26 @@ end:
        return_VALUE(result);
 }
 
-static int
-acpi_video_bus_remove (
-       struct acpi_device      *device,
-       int                     type)
+static int acpi_video_bus_remove(struct acpi_device *device, int type)
 {
-       acpi_status             status = 0;
-       struct acpi_video_bus   *video = NULL;
+       acpi_status status = 0;
+       struct acpi_video_bus *video = NULL;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_remove");
 
        if (!device || !acpi_driver_data(device))
                return_VALUE(-EINVAL);
 
-       video = (struct acpi_video_bus *) acpi_driver_data(device);
+       video = (struct acpi_video_bus *)acpi_driver_data(device);
 
        acpi_video_bus_stop_devices(video);
 
        status = acpi_remove_notify_handler(video->handle,
-               ACPI_DEVICE_NOTIFY, acpi_video_bus_notify);
+                                           ACPI_DEVICE_NOTIFY,
+                                           acpi_video_bus_notify);
        if (ACPI_FAILURE(status))
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                       "Error removing notify handler\n"));
+                                 "Error removing notify handler\n"));
 
        acpi_video_bus_put_devices(video);
        acpi_video_bus_remove_fs(device);
@@ -1907,15 +1838,12 @@ acpi_video_bus_remove (
        return_VALUE(0);
 }
 
-
 static int
-acpi_video_bus_match (
-       struct acpi_device      *device,
-       struct acpi_driver      *driver)
+acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
 {
-       acpi_handle             h_dummy1;
-       acpi_handle             h_dummy2;
-       acpi_handle             h_dummy3;
+       acpi_handle h_dummy1;
+       acpi_handle h_dummy2;
+       acpi_handle h_dummy3;
 
        ACPI_FUNCTION_TRACE("acpi_video_bus_match");
 
@@ -1941,22 +1869,19 @@ acpi_video_bus_match (
            ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
                return_VALUE(0);
 
-
        return_VALUE(-ENODEV);
 }
 
-
-static int __init
-acpi_video_init (void)
+static int __init acpi_video_init(void)
 {
-       int                     result = 0;
+       int result = 0;
 
        ACPI_FUNCTION_TRACE("acpi_video_init");
 
        /*
-       acpi_dbg_level = 0xFFFFFFFF;
-       acpi_dbg_layer = 0x08000000;
-       */
+          acpi_dbg_level = 0xFFFFFFFF;
+          acpi_dbg_layer = 0x08000000;
+        */
 
        acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
        if (!acpi_video_dir)
@@ -1972,8 +1897,7 @@ acpi_video_init (void)
        return_VALUE(0);
 }
 
-static void __exit
-acpi_video_exit (void)
+static void __exit acpi_video_exit(void)
 {
        ACPI_FUNCTION_TRACE("acpi_video_exit");
 
index a695f25e4497b647cb20c776f1f2f0a0e6b4d545..5fe8461271fc35812222bd2b2e2f8e138d1ffc02 100644 (file)
@@ -906,11 +906,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
                if (irqp->number_of_interrupts > 0) {
                        hdp->hd_nirqs = irqp->number_of_interrupts;
 
-                       for (i = 0; i < hdp->hd_nirqs; i++)
-                               hdp->hd_irq[i] =
+                       for (i = 0; i < hdp->hd_nirqs; i++) {
+                               int rc =
                                    acpi_register_gsi(irqp->interrupts[i],
                                                      irqp->edge_level,
                                                      irqp->active_high_low);
+                               if (rc < 0)
+                                       return AE_ERROR;
+                               hdp->hd_irq[i] = rc;
+                       }
                }
        }
 
index 1abec687865cf5b4862d26f4552abc39e748094d..278f841049968c15867d25c34e2f17772d375829 100644 (file)
@@ -1019,7 +1019,7 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for"
 #define IPMI_MEM_ADDR_SPACE 1
 #define IPMI_IO_ADDR_SPACE  2
 
-#if defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_X86) || defined(CONFIG_PCI)
+#if defined(CONFIG_ACPI) || defined(CONFIG_X86) || defined(CONFIG_PCI)
 static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr)
 {
        int i;
@@ -1395,7 +1395,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
 }
 
 
-#ifdef CONFIG_ACPI_INTERPRETER
+#ifdef CONFIG_ACPI
 
 #include <linux/acpi.h>
 
@@ -1517,6 +1517,9 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
        char             *io_type;
        u8               addr_space;
 
+       if (acpi_disabled)
+               return -ENODEV;
+
        if (acpi_failure)
                return -ENODEV;
 
@@ -2092,7 +2095,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
        rv = try_init_mem(intf_num, &new_smi);
        if (rv)
                rv = try_init_port(intf_num, &new_smi);
-#ifdef CONFIG_ACPI_INTERPRETER
+#ifdef CONFIG_ACPI
        if (rv && si_trydefaults)
                rv = try_init_acpi(intf_num, &new_smi);
 #endif
index 79e9832ef1f30141add74626adbd1a8d6916e10e..b58adfe3ed191e039888ac21bf9b57fd7db4ed23 100644 (file)
@@ -17,7 +17,7 @@ config TCG_TPM
          obtained at: <http://sourceforge.net/projects/trousers>.  To 
          compile this driver as a module, choose M here; the module 
          will be called tpm. If unsure, say N.
-         Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI_BUS
+         Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
          and CONFIG_PNPACPI.
 
 config TCG_NSC
index 9c4a39ee89b57b5065f575b86b2798ed31dc2fc6..2f1289eebb3c5e597ec5ffa828606cdb1bd1ac85 100644 (file)
@@ -78,7 +78,7 @@ config HOTPLUG_PCI_IBM
 
 config HOTPLUG_PCI_ACPI
        tristate "ACPI PCI Hotplug driver"
-       depends on ACPI_BUS && HOTPLUG_PCI
+       depends on ACPI && HOTPLUG_PCI
        help
          Say Y here if you have a system that supports PCI Hotplug using
          ACPI.
@@ -157,7 +157,7 @@ config HOTPLUG_PCI_SHPC_POLL_EVENT_MODE
 
 config HOTPLUG_PCI_SHPC_PHPRM_LEGACY
        bool "For AMD SHPC only: Use $HRT for resource/configuration"
-       depends on HOTPLUG_PCI_SHPC && !ACPI_BUS 
+       depends on HOTPLUG_PCI_SHPC && !ACPI 
        help
          Say Y here for AMD SHPC. You have to select this option if you are 
          using this driver on platform with AMD SHPC.
index 31a307004b94404377dd15ab5dab210831d6b63b..246586a3d91a1bf5d9343ecae8ebbf749f3fcda2 100644 (file)
@@ -51,7 +51,7 @@ pciehp-objs           :=      pciehp_core.o   \
                                pciehp_ctrl.o   \
                                pciehp_pci.o    \
                                pciehp_hpc.o
-ifdef CONFIG_ACPI_BUS
+ifdef CONFIG_ACPI
        pciehp-objs += pciehprm_acpi.o
 else
        pciehp-objs += pciehprm_nonacpi.o
@@ -62,7 +62,7 @@ shpchp-objs           :=      shpchp_core.o   \
                                shpchp_pci.o    \
                                shpchp_sysfs.o  \
                                shpchp_hpc.o
-ifdef CONFIG_ACPI_BUS
+ifdef CONFIG_ACPI
        shpchp-objs += shpchprm_acpi.o
 else
        ifdef CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY
index 6776308a1fe5a80b7ee6d6a7c0985e8ae496fc9d..c5143201419aebdeff65e7a2ad3e121e6bbd503f 100644 (file)
@@ -6,7 +6,7 @@ menu "Plug and Play support"
 
 config PNP
        bool "Plug and Play support"
-       depends on ISA || ACPI_BUS
+       depends on ISA || ACPI
        ---help---
          Plug and Play (PnP) is a standard for peripherals which allows those
          peripherals to be configured by software, e.g. assign IRQ's or other
index 0782cdc5009f3694f7a3bea60295097f745dff66..b1854171b9632b8ef260cf34ab6f0d0641a0f487 100644 (file)
@@ -3,7 +3,7 @@
 #
 config PNPACPI
        bool "Plug and Play ACPI support (EXPERIMENTAL)"
-       depends on PNP && ACPI_BUS && EXPERIMENTAL
+       depends on PNP && ACPI && EXPERIMENTAL
        default y
        ---help---
          Linux uses the PNPACPI to autodetect built-in
index 675b76a42403fdf8b39f01ab28b65ba2408fa519..416d30debe6c97a12582c7646d3bb6d3eab46ec8 100644 (file)
@@ -73,25 +73,35 @@ static void decode_irq_flags(int flag, int *edge_level, int *active_high_low)
 }
 
 static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi,
+       int edge_level, int active_high_low)
 {
        int i = 0;
+       int irq;
+
+       if (!valid_IRQ(gsi))
+               return;
+
        while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
                        i < PNP_MAX_IRQ)
                i++;
-       if (i < PNP_MAX_IRQ) {
-               res->irq_resource[i].flags = IORESOURCE_IRQ;  //Also clears _UNSET flag
-               if (irq == -1) {
-                       res->irq_resource[i].flags |= IORESOURCE_DISABLED;
-                       return;
-               }
-               res->irq_resource[i].start =(unsigned long) irq;
-               res->irq_resource[i].end = (unsigned long) irq;
+       if (i >= PNP_MAX_IRQ)
+               return;
+
+       res->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+       irq = acpi_register_gsi(gsi, edge_level, active_high_low);
+       if (irq < 0) {
+               res->irq_resource[i].flags |= IORESOURCE_DISABLED;
+               return;
        }
+
+       res->irq_resource[i].start = irq;
+       res->irq_resource[i].end = irq;
+       pcibios_penalize_isa_irq(irq, 1);
 }
 
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma)
 {
        int i = 0;
        while (i < PNP_MAX_DMA &&
@@ -103,14 +113,14 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
                        res->dma_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               res->dma_resource[i].start =(unsigned long) dma;
-               res->dma_resource[i].end = (unsigned long) dma;
+               res->dma_resource[i].start = dma;
+               res->dma_resource[i].end = dma;
        }
 }
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
-       int io, int len)
+       u32 io, u32 len)
 {
        int i = 0;
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -122,14 +132,14 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res,
                        res->port_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               res->port_resource[i].start = (unsigned long) io;
-               res->port_resource[i].end = (unsigned long)(io + len - 1);
+               res->port_resource[i].start = io;
+               res->port_resource[i].end = io + len - 1;
        }
 }
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
-       int mem, int len)
+       u64 mem, u64 len)
 {
        int i = 0;
        while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -141,8 +151,8 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res,
                        res->mem_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               res->mem_resource[i].start = (unsigned long) mem;
-               res->mem_resource[i].end = (unsigned long)(mem + len - 1);
+               res->mem_resource[i].start = mem;
+               res->mem_resource[i].end = mem + len - 1;
        }
 }
 
@@ -151,27 +161,28 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        void *data)
 {
        struct pnp_resource_table * res_table = (struct pnp_resource_table *)data;
+       int i;
 
        switch (res->id) {
        case ACPI_RSTYPE_IRQ:
-               if ((res->data.irq.number_of_interrupts > 0) &&
-                       valid_IRQ(res->data.irq.interrupts[0])) {
-                       pnpacpi_parse_allocated_irqresource(res_table, 
-                               acpi_register_gsi(res->data.irq.interrupts[0],
-                                       res->data.irq.edge_level,
-                                       res->data.irq.active_high_low));
-                       pcibios_penalize_isa_irq(res->data.irq.interrupts[0], 1);
+               /*
+                * Per spec, only one interrupt per descriptor is allowed in
+                * _CRS, but some firmware violates this, so parse them all.
+                */
+               for (i = 0; i < res->data.irq.number_of_interrupts; i++) {
+                       pnpacpi_parse_allocated_irqresource(res_table,
+                               res->data.irq.interrupts[i],
+                               res->data.irq.edge_level,
+                               res->data.irq.active_high_low);
                }
                break;
 
        case ACPI_RSTYPE_EXT_IRQ:
-               if ((res->data.extended_irq.number_of_interrupts > 0) &&
-                       valid_IRQ(res->data.extended_irq.interrupts[0])) {
-                       pnpacpi_parse_allocated_irqresource(res_table, 
-                               acpi_register_gsi(res->data.extended_irq.interrupts[0],
-                                       res->data.extended_irq.edge_level,
-                                       res->data.extended_irq.active_high_low));
-                       pcibios_penalize_isa_irq(res->data.extended_irq.interrupts[0], 1);
+               for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) {
+                       pnpacpi_parse_allocated_irqresource(res_table,
+                               res->data.extended_irq.interrupts[i],
+                               res->data.extended_irq.edge_level,
+                               res->data.extended_irq.active_high_low);
                }
                break;
        case ACPI_RSTYPE_DMA:
index deec0cef88d92bcb007c9b28c514948b3c700758..5f868852904149645e559ff2ac7c7ec2dd432756 100644 (file)
@@ -68,8 +68,8 @@ enum {
        PIIX_COMB_PATA_P0       = (1 << 1),
        PIIX_COMB               = (1 << 2), /* combined mode enabled? */
 
-       PIIX_PORT_PRESENT       = (1 << 0),
-       PIIX_PORT_ENABLED       = (1 << 4),
+       PIIX_PORT_ENABLED       = (1 << 0),
+       PIIX_PORT_PRESENT       = (1 << 4),
 
        PIIX_80C_PRI            = (1 << 5) | (1 << 4),
        PIIX_80C_SEC            = (1 << 7) | (1 << 6),
@@ -377,7 +377,9 @@ static void piix_pata_phy_reset(struct ata_port *ap)
  *     None (inherited from caller).
  *
  *     RETURNS:
- *     Non-zero if device detected, zero otherwise.
+ *     Non-zero if port is enabled, it may or may not have a device
+ *     attached in that case (PRESENT bit would only be set if BIOS probe
+ *     was done). Zero is returned if port is disabled.
  */
 static int piix_sata_probe (struct ata_port *ap)
 {
@@ -401,7 +403,7 @@ static int piix_sata_probe (struct ata_port *ap)
         */
 
        for (i = 0; i < 4; i++) {
-               mask = (PIIX_PORT_PRESENT << i) | (PIIX_PORT_ENABLED << i);
+               mask = (PIIX_PORT_ENABLED << i);
 
                if ((orig_mask & mask) == mask)
                        if (combined || (i == ap->hard_port_no))
index 43af445b3ad2eeafe74f37dbad64f18300f8be12..7d1aaa99aaae0d502eaf838c5766779b36a42ed9 100644 (file)
@@ -52,7 +52,10 @@ enum {
        /* PCI configuration registers */
        SIS_GENCTL              = 0x54, /* IDE General Control register */
        SIS_SCR_BASE            = 0xc0, /* sata0 phy SCR registers */
-       SIS_SATA1_OFS           = 0x10, /* offset from sata0->sata1 phy regs */
+       SIS180_SATA1_OFS        = 0x10, /* offset from sata0->sata1 phy regs */
+       SIS182_SATA1_OFS        = 0x20, /* offset from sata0->sata1 phy regs */
+       SIS_PMR                 = 0x90, /* port mapping register */
+       SIS_PMR_COMBINED        = 0x30, 
 
        /* random bits */
        SIS_FLAG_CFGSCR         = (1 << 30), /* host flag: SCRs via PCI cfg */
@@ -67,6 +70,7 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static struct pci_device_id sis_pci_tbl[] = {
        { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
        { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
+       { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
        { }     /* terminate list */
 };
 
@@ -139,56 +143,94 @@ MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, sis_pci_tbl);
 MODULE_VERSION(DRV_VERSION);
 
-static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg)
+static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg, int device)
 {
        unsigned int addr = SIS_SCR_BASE + (4 * sc_reg);
 
-       if (port_no)
-               addr += SIS_SATA1_OFS;
+       if (port_no) 
+               if (device == 0x182)
+                       addr += SIS182_SATA1_OFS;
+               else
+                       addr += SIS180_SATA1_OFS;
        return addr;
 }
 
 static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg);
-       u32 val;
+       unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev->device);
+       u32 val, val2;
+       u8 pmr;
 
        if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
                return 0xffffffff;
+
+       pci_read_config_byte(pdev, SIS_PMR, &pmr);
+       
        pci_read_config_dword(pdev, cfg_addr, &val);
-       return val;
+
+       if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED)) 
+               pci_read_config_dword(pdev, cfg_addr+0x10, &val2);
+
+       return val|val2;
 }
 
 static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
-       unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr);
+       unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr, pdev->device);
+       u8 pmr;
 
        if (scr == SCR_ERROR) /* doesn't exist in PCI cfg space */
                return;
+
+       pci_read_config_byte(pdev, SIS_PMR, &pmr);
+       
        pci_write_config_dword(pdev, cfg_addr, val);
+
+       if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
+               pci_write_config_dword(pdev, cfg_addr+0x10, val);
 }
 
 static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
 {
+       struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
+       u32 val,val2;
+       u8 pmr;
+
        if (sc_reg > SCR_CONTROL)
                return 0xffffffffU;
 
        if (ap->flags & SIS_FLAG_CFGSCR)
                return sis_scr_cfg_read(ap, sc_reg);
-       return inl(ap->ioaddr.scr_addr + (sc_reg * 4));
+
+       pci_read_config_byte(pdev, SIS_PMR, &pmr);
+
+       val = inl(ap->ioaddr.scr_addr + (sc_reg * 4));
+
+       if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
+               val2 = inl(ap->ioaddr.scr_addr + (sc_reg * 4)+0x10);
+
+       return val|val2;
 }
 
 static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
 {
+       struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
+       u8 pmr;
+
        if (sc_reg > SCR_CONTROL)
                return;
 
+       pci_read_config_byte(pdev, SIS_PMR, &pmr);
+       
        if (ap->flags & SIS_FLAG_CFGSCR)
                sis_scr_cfg_write(ap, sc_reg, val);
-       else
+       else {
                outl(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+               if ((pdev->device == 0x182) || (pmr & SIS_PMR_COMBINED))
+                       outl(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10);
+       }
 }
 
 /* move to PCI layer, integrate w/ MSI stuff */
@@ -210,6 +252,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        u32 genctl;
        struct ata_port_info *ppi;
        int pci_dev_busy = 0;
+       u8 pmr;
+       u8 port2_start;
 
        rc = pci_enable_device(pdev);
        if (rc)
@@ -251,11 +295,27 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
                probe_ent->host_flags |= SIS_FLAG_CFGSCR;
        }
 
+       pci_read_config_byte(pdev, SIS_PMR, &pmr);
+       if (ent->device != 0x182) {
+               if ((pmr & SIS_PMR_COMBINED) == 0) {
+                       printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in SATA mode\n");
+                       port2_start=0x64;
+               }
+               else {
+                       printk(KERN_INFO "sata_sis: Detected SiS 180/181 chipset in combined mode\n");
+                       port2_start=0;
+               }
+       }
+       else {
+               printk(KERN_INFO "sata_sis: Detected SiS 182 chipset\n");
+               port2_start = 0x20;
+       }
+
        if (!(probe_ent->host_flags & SIS_FLAG_CFGSCR)) {
                probe_ent->port[0].scr_addr =
                        pci_resource_start(pdev, SIS_SCR_PCI_BAR);
                probe_ent->port[1].scr_addr =
-                       pci_resource_start(pdev, SIS_SCR_PCI_BAR) + 64;
+                       pci_resource_start(pdev, SIS_SCR_PCI_BAR) + port2_start;
        }
 
        pci_set_master(pdev);
index 6b9ead288517f70b1b306f7f5f0a14466d92d356..a802bdce6e5dd02a044f343cddc4dd1a71fe5308 100644 (file)
@@ -47,18 +47,30 @@ static acpi_status acpi_serial_port(struct uart_port *port,
 static acpi_status acpi_serial_ext_irq(struct uart_port *port,
                                       struct acpi_resource_ext_irq *ext_irq)
 {
-       if (ext_irq->number_of_interrupts > 0)
-               port->irq = acpi_register_gsi(ext_irq->interrupts[0],
+       int rc;
+
+       if (ext_irq->number_of_interrupts > 0) {
+               rc = acpi_register_gsi(ext_irq->interrupts[0],
                           ext_irq->edge_level, ext_irq->active_high_low);
+               if (rc < 0)
+                       return AE_ERROR;
+               port->irq = rc;
+       }
        return AE_OK;
 }
 
 static acpi_status acpi_serial_irq(struct uart_port *port,
                                   struct acpi_resource_irq *irq)
 {
-       if (irq->number_of_interrupts > 0)
-               port->irq = acpi_register_gsi(irq->interrupts[0],
+       int rc;
+
+       if (irq->number_of_interrupts > 0) {
+               rc = acpi_register_gsi(irq->interrupts[0],
                           irq->edge_level, irq->active_high_low);
+               if (rc < 0)
+                       return AE_ERROR;
+               port->irq = rc;
+       }
        return AE_OK;
 }
 
index e39818a34a0754a824df7bb2e3e46878704e18cd..b745a1b9e835258b947493bbb8f8e6ebdb3829e0 100644 (file)
@@ -80,7 +80,7 @@ config SERIAL_8250_CS
 config SERIAL_8250_ACPI
        bool "8250/16550 device discovery via ACPI namespace"
        default y if IA64
-       depends on ACPI_BUS && SERIAL_8250
+       depends on ACPI && SERIAL_8250
        ---help---
          If you wish to enable serial port discovery via the ACPI
          namespace, say Y here.  If unsure, say N.
index c92306f0fdc578e4f4e125acc1fa77b6e13ccb0d..8e8f32dabe53160b2b8bd4f714bbe6c55f39b7eb 100644 (file)
@@ -1,5 +1,3 @@
-menu "XFS support"
-
 config XFS_FS
        tristate "XFS filesystem support"
        select EXPORTFS if NFSD!=n
@@ -22,27 +20,11 @@ config XFS_FS
 
 config XFS_EXPORT
        bool
-       default y if XFS_FS && EXPORTFS
-
-config XFS_RT
-       bool "Realtime support (EXPERIMENTAL)"
-       depends on XFS_FS && EXPERIMENTAL
-       help
-         If you say Y here you will be able to mount and use XFS filesystems
-         which contain a realtime subvolume. The realtime subvolume is a
-         separate area of disk space where only file data is stored. The
-         realtime subvolume is designed to provide very deterministic
-         data rates suitable for media streaming applications.
-
-         See the xfs man page in section 5 for a bit more information.
-
-         This feature is unsupported at this time, is not yet fully
-         functional, and may cause serious problems.
-
-         If unsure, say N.
+       depends on XFS_FS && EXPORTFS
+       default y
 
 config XFS_QUOTA
-       bool "Quota support"
+       tristate "XFS Quota support"
        depends on XFS_FS
        help
          If you say Y here, you will be able to set limits for disk usage on
@@ -59,7 +41,7 @@ config XFS_QUOTA
          they are completely independent subsystems.
 
 config XFS_SECURITY
-       bool "Security Label support"
+       bool "XFS Security Label support"
        depends on XFS_FS
        help
          Security labels support alternative access control models
@@ -71,7 +53,7 @@ config XFS_SECURITY
          extended attributes for inode security labels, say N.
 
 config XFS_POSIX_ACL
-       bool "POSIX ACL support"
+       bool "XFS POSIX ACL support"
        depends on XFS_FS
        help
          POSIX Access Control Lists (ACLs) support permissions for users and
@@ -82,4 +64,19 @@ config XFS_POSIX_ACL
 
          If you don't know what Access Control Lists are, say N.
 
-endmenu
+config XFS_RT
+       bool "XFS Realtime support (EXPERIMENTAL)"
+       depends on XFS_FS && EXPERIMENTAL
+       help
+         If you say Y here you will be able to mount and use XFS filesystems
+         which contain a realtime subvolume. The realtime subvolume is a
+         separate area of disk space where only file data is stored. The
+         realtime subvolume is designed to provide very deterministic
+         data rates suitable for media streaming applications.
+
+         See the xfs man page in section 5 for a bit more information.
+
+         This feature is unsupported at this time, is not yet fully
+         functional, and may cause serious problems.
+
+         If unsure, say N.
index fbfcbe5a7cda30f2cb82f341b5d4c171ed7a3561..8e18ff1572474f397ece37bbb296253bc952592b 100644 (file)
@@ -55,7 +55,7 @@ ifeq ($(CONFIG_XFS_TRACE),y)
 endif
 
 obj-$(CONFIG_XFS_FS)           += xfs.o
-obj-$(CONFIG_XFS_QUOTA)                += quota/
+xfs-$(CONFIG_XFS_QUOTA)                += quota/
 
 xfs-$(CONFIG_XFS_RT)           += xfs_rtalloc.o
 xfs-$(CONFIG_XFS_POSIX_ACL)    += xfs_acl.o
index 8b7b676718b9b25a568cb7be1be329ce063e0199..93e60e8393555bd93c4e93df787a3cab23dd5402 100644 (file)
@@ -41,13 +41,13 @@ ifeq ($(CONFIG_XFS_TRACE),y)
        EXTRA_CFLAGS += -DXFS_VNODE_TRACE
 endif
 
-obj-$(CONFIG_XFS_QUOTA)                += xfs_quota.o
-
-xfs_quota-y                    += xfs_dquot.o \
+xfs-$(CONFIG_XFS_QUOTA)                += xfs_dquot.o \
                                   xfs_dquot_item.o \
                                   xfs_trans_dquot.o \
                                   xfs_qm_syscalls.o \
                                   xfs_qm_bhv.o \
                                   xfs_qm.o
 
-xfs_quota-$(CONFIG_PROC_FS)    += xfs_qm_stats.o
+ifeq ($(CONFIG_XFS_QUOTA),y)
+xfs-$(CONFIG_PROC_FS)          += xfs_qm_stats.o
+endif
index ae35189b3d70050ead6c62e5d9f2e0013d7cde31..5ab0dd885b1b9d74627e73ba9aada509f4dff339 100644 (file)
 
 #include <asm/byteorder.h>
 
-#ifdef __LITTLE_ENDIAN
-# define __BYTE_ORDER  __LITTLE_ENDIAN
-#endif
 #ifdef __BIG_ENDIAN
-# define __BYTE_ORDER  __BIG_ENDIAN
+#define        XFS_NATIVE_HOST 1
+#else
+#undef XFS_NATIVE_HOST
+#endif
+
+#else /* __KERNEL__ */
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define        XFS_NATIVE_HOST 1
+#else
+#undef XFS_NATIVE_HOST
 #endif
 
 #endif /* __KERNEL__ */
 
 /* do we need conversion? */
-
 #define ARCH_NOCONVERT 1
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define ARCH_CONVERT  0
-#else
+#ifdef XFS_NATIVE_HOST
 # define ARCH_CONVERT  ARCH_NOCONVERT
+#else
+# define ARCH_CONVERT  0
 #endif
 
 /* generic swapping macros */
index 09c413576ba81b838254837c3f708ca24797e88c..09a77b17565b06c9c4fde3a8cde2e2e739a4f708 100644 (file)
@@ -2017,7 +2017,7 @@ xfs_bmbt_get_state(
                                ext_flag);
 }
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifndef XFS_NATIVE_HOST
 /* Endian flipping versions of the bmbt extraction functions */
 void
 xfs_bmbt_disk_get_all(
@@ -2087,7 +2087,7 @@ xfs_bmbt_disk_get_state(
        return xfs_extent_state(xfs_bmbt_disk_get_blockcount(r),
                                ext_flag);
 }
-#endif
+#endif /* XFS_NATIVE_HOST */
 
 
 /*
@@ -2531,7 +2531,7 @@ xfs_bmbt_set_allf(
 #endif /* XFS_BIG_BLKNOS */
 }
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifndef XFS_NATIVE_HOST
 /*
  * Set all the fields in a bmap extent record from the uncompressed form.
  */
@@ -2617,7 +2617,7 @@ xfs_bmbt_disk_set_allf(
        }
 #endif /* XFS_BIG_BLKNOS */
 }
-#endif
+#endif /* XFS_NATIVE_HOST */
 
 /*
  * Set the blockcount field in a bmap extent record.
index 0a40cf126c285cfb940b5915f898722fc6ca1ea3..2cf4fe45cbcb16f73a8e1accd97512dae046623b 100644 (file)
@@ -62,7 +62,7 @@ typedef struct xfs_bmdr_block
  *  l1:0-20 are blockcount.
  */
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef XFS_NATIVE_HOST
 
 #define BMBT_TOTAL_BITLEN      128     /* 128 bits, 16 bytes */
 #define BMBT_EXNTFLAG_BITOFF   0
@@ -87,7 +87,7 @@ typedef struct xfs_bmdr_block
 #define BMBT_BLOCKCOUNT_BITOFF 64 /* Start of second 64 bit container */
 #define BMBT_BLOCKCOUNT_BITLEN 21
 
-#endif
+#endif /* XFS_NATIVE_HOST */
 
 
 #define BMBT_USE_64    1
@@ -505,7 +505,7 @@ xfs_exntst_t
 xfs_bmbt_get_state(
        xfs_bmbt_rec_t  *r);
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifndef XFS_NATIVE_HOST
 void
 xfs_bmbt_disk_get_all(
        xfs_bmbt_rec_t  *r,
@@ -538,7 +538,7 @@ xfs_bmbt_disk_get_startoff(
        xfs_bmbt_get_blockcount(r)
 #define xfs_bmbt_disk_get_startoff(r) \
        xfs_bmbt_get_startoff(r)
-#endif
+#endif /* XFS_NATIVE_HOST */
 
 int
 xfs_bmbt_increment(
@@ -623,7 +623,7 @@ xfs_bmbt_set_state(
        xfs_bmbt_rec_t  *r,
        xfs_exntst_t    v);
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifndef XFS_NATIVE_HOST
 void
 xfs_bmbt_disk_set_all(
        xfs_bmbt_rec_t  *r,
@@ -641,7 +641,7 @@ xfs_bmbt_disk_set_allf(
        xfs_bmbt_set_all(r, s)
 #define xfs_bmbt_disk_set_allf(r, o, b, c, v) \
        xfs_bmbt_set_allf(r, o, b, c, v)
-#endif
+#endif /* XFS_NATIVE_HOST */
 
 void
 xfs_bmbt_to_bmdr(
index dd423ce1bc8d082a177effddde9f35b341932996..480bffc1f29fd64cbd6df39c788ffc30a683b472 100644 (file)
@@ -127,13 +127,13 @@ typedef union {
         * Watch the order here (endian-ness dependent).
         */
        struct {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef XFS_NATIVE_HOST
                xfs_dahash_t    h;      /* hash value */
                __uint32_t      be;     /* block and entry */
-#else  /* __BYTE_ORDER == __BIG_ENDIAN */
+#else
                __uint32_t      be;     /* block and entry */
                xfs_dahash_t    h;      /* hash value */
-#endif /* __BYTE_ORDER == __BIG_ENDIAN */
+#endif /* XFS_NATIVE_HOST */
        } s;
 } xfs_dircook_t;
 
index 276ec70eb7f9ab12db2b6102a7382a13128aadd6..50e2cadf9091a57d5f1b6ca4b70b18cd32c4be9f 100644 (file)
@@ -341,7 +341,7 @@ xfs_inode_item_format(
                        nrecs = ip->i_df.if_bytes /
                                (uint)sizeof(xfs_bmbt_rec_t);
                        ASSERT(nrecs > 0);
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef XFS_NATIVE_HOST
                        if (nrecs == ip->i_d.di_nextents) {
                                /*
                                 * There are no delayed allocation
@@ -473,7 +473,7 @@ xfs_inode_item_format(
 #endif
                        ASSERT(nrecs > 0);
                        ASSERT(nrecs == ip->i_d.di_anextents);
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef XFS_NATIVE_HOST
                        /*
                         * There are not delayed allocation extents
                         * for attributes, so just point at the array.
index eb7fdc6ebc3236853198f9770313c595c5e3147b..a884cea82fcaf0aa7792b2a0ab41b6bc15aa1ac9 100644 (file)
@@ -112,7 +112,7 @@ struct xfs_mount;
  * this has endian issues, of course.
  */
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef XFS_NATIVE_HOST
 #define GET_CLIENT_ID(i,arch) \
     ((i) & 0xff)
 #else
@@ -414,14 +414,10 @@ typedef struct xlog_op_header {
 #define XLOG_FMT_IRIX_BE  3
 
 /* our fmt */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define XLOG_FMT XLOG_FMT_LINUX_LE
-#else
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef XFS_NATIVE_HOST
 #define XLOG_FMT XLOG_FMT_LINUX_BE
 #else
-#error unknown byte order
-#endif
+#define XLOG_FMT XLOG_FMT_LINUX_LE
 #endif
 
 typedef struct xlog_rec_header {
index 2f6ab189fc6f0703ef65d00f2c1712cf55ffef0d..427cff1a3f8321ea786c9a104acd21f5e0f67cc1 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef _ACCONFIG_H
 #define _ACCONFIG_H
 
-
 /******************************************************************************
  *
  * Configuration options
@@ -64,7 +63,7 @@
 
 /* Version string */
 
-#define ACPI_CA_VERSION                 0x20050408
+#define ACPI_CA_VERSION                 0x20050902
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
 
 /* Maximum objects in the various object caches */
 
-#define ACPI_MAX_STATE_CACHE_DEPTH      64          /* State objects */
-#define ACPI_MAX_PARSE_CACHE_DEPTH      96          /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   64          /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH     64          /* Interpreter operand objects */
-#define ACPI_MAX_WALK_CACHE_DEPTH       4           /* Objects for parse tree walks */
+#define ACPI_MAX_STATE_CACHE_DEPTH      96     /* State objects */
+#define ACPI_MAX_PARSE_CACHE_DEPTH      96     /* Parse tree objects */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH   96     /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH     96     /* Interpreter operand objects */
 
 /*
  * Should the subystem abort the loading of an ACPI table if the
@@ -90,7 +88,6 @@
  */
 #define ACPI_CHECKSUM_ABORT             FALSE
 
-
 /******************************************************************************
  *
  * Subsystem Constants
 /* String size constants */
 
 #define ACPI_MAX_STRING_LENGTH          512
-#define ACPI_PATHNAME_MAX               256         /* A full namespace pathname */
+#define ACPI_PATHNAME_MAX               256    /* A full namespace pathname */
 
 /* Maximum count for a semaphore object */
 
 
 #define ACPI_SYSMEM_REGION_WINDOW_SIZE  4096
 
-
 /******************************************************************************
  *
  * ACPI Specification constants (Do not change unless the specification changes)
 /* Names within the namespace are 4 bytes long */
 
 #define ACPI_NAME_SIZE                  4
-#define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
+#define ACPI_PATH_SEGMENT_LENGTH        5      /* 4 chars for name + 1 char for separator */
 #define ACPI_PATH_SEPARATOR             '.'
 
 /* Constants used in searching for the RSDP in low memory */
 
-#define ACPI_EBDA_PTR_LOCATION          0x0000040E     /* Physical Address */
+#define ACPI_EBDA_PTR_LOCATION          0x0000040E     /* Physical Address */
 #define ACPI_EBDA_PTR_LENGTH            2
 #define ACPI_EBDA_WINDOW_SIZE           1024
-#define ACPI_HI_RSDP_WINDOW_BASE        0x000E0000     /* Physical Address */
+#define ACPI_HI_RSDP_WINDOW_BASE        0x000E0000     /* Physical Address */
 #define ACPI_HI_RSDP_WINDOW_SIZE        0x00020000
 #define ACPI_RSDP_SCAN_STEP             16
 
 
 #define ACPI_NUM_OSI_STRINGS            10
 
-
 /******************************************************************************
  *
  * ACPI AML Debugger
  *
  *****************************************************************************/
 
-#define ACPI_DEBUGGER_MAX_ARGS          8  /* Must be max method args + 1 */
+#define ACPI_DEBUGGER_MAX_ARGS          8      /* Must be max method args + 1 */
 
 #define ACPI_DEBUGGER_COMMAND_PROMPT    '-'
 #define ACPI_DEBUGGER_EXECUTE_PROMPT    '%'
 
-
-#endif /* _ACCONFIG_H */
-
+#endif                         /* _ACCONFIG_H */
index 8ba372b0f2456c6fe849ac0b04eb02a9969e3bab..70ce3b4d006edc99a0171372005f262a7284db84 100644 (file)
 #ifndef __ACDEBUG_H__
 #define __ACDEBUG_H__
 
-
 #define ACPI_DEBUG_BUFFER_SIZE  4196
 
-struct command_info
-{
-       char                            *name;          /* Command Name */
-       u8                              min_args;       /* Minimum arguments required */
+struct command_info {
+       char *name;             /* Command Name */
+       u8 min_args;            /* Minimum arguments required */
 };
 
-
-struct argument_info
-{
-       char                            *name;          /* Argument Name */
+struct argument_info {
+       char *name;             /* Argument Name */
 };
 
-
 #define PARAM_LIST(pl)                  pl
 #define DBTEST_OUTPUT_LEVEL(lvl)        if (acpi_gbl_db_opt_verbose)
 #define VERBOSE_PRINT(fp)               DBTEST_OUTPUT_LEVEL(lvl) {\
@@ -68,275 +63,155 @@ struct argument_info
 #define EX_NO_SINGLE_STEP               1
 #define EX_SINGLE_STEP                  2
 
-
 /*
  * dbxface - external debugger interfaces
  */
-acpi_status
-acpi_db_initialize (
-       void);
+acpi_status acpi_db_initialize(void);
 
-void
-acpi_db_terminate (
-       void);
+void acpi_db_terminate(void);
 
 acpi_status
-acpi_db_single_step (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u32                             op_type);
-
+acpi_db_single_step(struct acpi_walk_state *walk_state,
+                   union acpi_parse_object *op, u32 op_type);
 
 /*
  * dbcmds - debug commands and output routines
  */
-acpi_status
-acpi_db_disassemble_method (
-       char                            *name);
+acpi_status acpi_db_disassemble_method(char *name);
 
-void
-acpi_db_display_table_info (
-       char                            *table_arg);
+void acpi_db_display_table_info(char *table_arg);
 
-void
-acpi_db_unload_acpi_table (
-       char                            *table_arg,
-       char                            *instance_arg);
+void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg);
 
 void
-acpi_db_set_method_breakpoint (
-       char                            *location,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
+acpi_db_set_method_breakpoint(char *location,
+                             struct acpi_walk_state *walk_state,
+                             union acpi_parse_object *op);
 
-void
-acpi_db_set_method_call_breakpoint (
-       union acpi_parse_object         *op);
+void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
 
-void
-acpi_db_disassemble_aml (
-       char                            *statements,
-       union acpi_parse_object         *op);
+void acpi_db_get_bus_info(void);
 
-void
-acpi_db_dump_namespace (
-       char                            *start_arg,
-       char                            *depth_arg);
+void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
 
-void
-acpi_db_dump_namespace_by_owner (
-       char                            *owner_arg,
-       char                            *depth_arg);
+void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
 
-void
-acpi_db_send_notify (
-       char                            *name,
-       u32                             value);
+void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
 
-void
-acpi_db_set_method_data (
-       char                            *type_arg,
-       char                            *index_arg,
-       char                            *value_arg);
+void acpi_db_send_notify(char *name, u32 value);
 
-acpi_status
-acpi_db_display_objects (
-       char                            *obj_type_arg,
-       char                            *display_count_arg);
+void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
 
 acpi_status
-acpi_db_find_name_in_namespace (
-       char                            *name_arg);
+acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
 
-void
-acpi_db_set_scope (
-       char                            *name);
+acpi_status acpi_db_find_name_in_namespace(char *name_arg);
 
-acpi_status
-acpi_db_sleep (
-       char                            *object_arg);
+void acpi_db_set_scope(char *name);
 
-void
-acpi_db_find_references (
-       char                            *object_arg);
+acpi_status acpi_db_sleep(char *object_arg);
 
-void
-acpi_db_display_locks (
-       void);
+void acpi_db_find_references(char *object_arg);
 
-void
-acpi_db_display_resources (
-       char                            *object_arg);
+void acpi_db_display_locks(void);
 
-void
-acpi_db_display_gpes (
-       void);
+void acpi_db_display_resources(char *object_arg);
 
-void
-acpi_db_check_integrity (
-       void);
+void acpi_db_display_gpes(void);
 
-void
-acpi_db_generate_gpe (
-       char                            *gpe_arg,
-       char                            *block_arg);
+void acpi_db_check_integrity(void);
 
+void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
 
 /*
  * dbdisply - debug display commands
  */
-void
-acpi_db_display_method_info (
-       union acpi_parse_object         *op);
+void acpi_db_display_method_info(union acpi_parse_object *op);
 
-void
-acpi_db_decode_and_display_object (
-       char                            *target,
-       char                            *output_type);
+void acpi_db_decode_and_display_object(char *target, char *output_type);
 
 void
-acpi_db_display_result_object (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_db_display_result_object(union acpi_operand_object *obj_desc,
+                             struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_db_display_all_methods (
-       char                            *display_count_arg);
+acpi_status acpi_db_display_all_methods(char *display_count_arg);
 
-void
-acpi_db_display_arguments (
-       void);
+void acpi_db_display_arguments(void);
 
-void
-acpi_db_display_locals (
-       void);
+void acpi_db_display_locals(void);
 
-void
-acpi_db_display_results (
-       void);
+void acpi_db_display_results(void);
 
-void
-acpi_db_display_calling_tree (
-       void);
+void acpi_db_display_calling_tree(void);
 
-void
-acpi_db_display_object_type (
-       char                            *object_arg);
+void acpi_db_display_object_type(char *object_arg);
 
 void
-acpi_db_display_argument_object (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state);
-
+acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
+                               struct acpi_walk_state *walk_state);
 
 /*
  * dbexec - debugger control method execution
  */
-void
-acpi_db_execute (
-       char                            *name,
-       char                            **args,
-       u32                             flags);
+void acpi_db_execute(char *name, char **args, u32 flags);
 
 void
-acpi_db_create_execution_threads (
-       char                            *num_threads_arg,
-       char                            *num_loops_arg,
-       char                            *method_name_arg);
-
+acpi_db_create_execution_threads(char *num_threads_arg,
+                                char *num_loops_arg, char *method_name_arg);
 
 /*
  * dbfileio - Debugger file I/O commands
  */
 acpi_object_type
-acpi_db_match_argument (
-       char                            *user_argument,
-       struct argument_info            *arguments);
+acpi_db_match_argument(char *user_argument, struct argument_info *arguments);
 
-void
-acpi_db_close_debug_file (
-       void);
+void acpi_db_close_debug_file(void);
 
-void
-acpi_db_open_debug_file (
-       char                            *name);
+void acpi_db_open_debug_file(char *name);
 
-acpi_status
-acpi_db_load_acpi_table (
-       char                            *filename);
+acpi_status acpi_db_load_acpi_table(char *filename);
 
 acpi_status
-acpi_db_get_table_from_file (
-       char                            *filename,
-       struct acpi_table_header        **table);
+acpi_db_get_table_from_file(char *filename, struct acpi_table_header **table);
 
 acpi_status
-acpi_db_read_table_from_file (
-       char                            *filename,
-       struct acpi_table_header        **table);
-
+acpi_db_read_table_from_file(char *filename, struct acpi_table_header **table);
 
 /*
  * dbhistry - debugger HISTORY command
  */
-void
-acpi_db_add_to_history (
-       char                            *command_line);
+void acpi_db_add_to_history(char *command_line);
 
-void
-acpi_db_display_history (
-       void);
-
-char *
-acpi_db_get_from_history (
-       char                            *command_num_arg);
+void acpi_db_display_history(void);
 
+char *acpi_db_get_from_history(char *command_num_arg);
 
 /*
  * dbinput - user front-end to the AML debugger
  */
 acpi_status
-acpi_db_command_dispatch (
-       char                            *input_buffer,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
-void ACPI_SYSTEM_XFACE
-acpi_db_execute_thread (
-       void                            *context);
+acpi_db_command_dispatch(char *input_buffer,
+                        struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op);
 
+void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
 
 /*
  * dbstats - Generation and display of ACPI table statistics
  */
-void
-acpi_db_generate_statistics (
-       union acpi_parse_object         *root,
-       u8                              is_method);
-
-acpi_status
-acpi_db_display_statistics (
-       char                            *type_arg);
+void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
 
+acpi_status acpi_db_display_statistics(char *type_arg);
 
 /*
  * dbutils - AML debugger utilities
  */
-void
-acpi_db_set_output_destination (
-       u32                             where);
+void acpi_db_set_output_destination(u32 where);
 
-void
-acpi_db_dump_object (
-       union acpi_object               *obj_desc,
-       u32                             level);
+void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
 
-void
-acpi_db_prep_namestring (
-       char                            *name);
+void acpi_db_prep_namestring(char *name);
 
-struct acpi_namespace_node *
-acpi_db_local_ns_lookup (
-       char                            *name);
+struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
 
-#endif  /* __ACDEBUG_H__ */
+#endif                         /* __ACDEBUG_H__ */
index dbfa877121ba57b2d7a7a7ecc49ca31b39b41e9f..3d96dcb1bb4bb3725946f76a692a96d34389a0f3 100644 (file)
 
 #include "amlresrc.h"
 
-
 #define BLOCK_NONE              0
 #define BLOCK_PAREN             1
 #define BLOCK_BRACE             2
 #define BLOCK_COMMA_LIST        4
 
-struct acpi_external_list
-{
-       char                                *path;
-       struct acpi_external_list           *next;
+struct acpi_external_list {
+       char *path;
+       struct acpi_external_list *next;
 };
 
-extern struct acpi_external_list        *acpi_gbl_external_list;
-extern const char                       *acpi_gbl_io_decode[2];
-extern const char                       *acpi_gbl_word_decode[4];
-extern const char                       *acpi_gbl_consume_decode[2];
-extern const char                       *acpi_gbl_min_decode[2];
-extern const char                       *acpi_gbl_max_decode[2];
-extern const char                       *acpi_gbl_DECdecode[2];
-extern const char                       *acpi_gbl_RNGdecode[4];
-extern const char                       *acpi_gbl_MEMdecode[4];
-extern const char                       *acpi_gbl_RWdecode[2];
-extern const char                       *acpi_gbl_irq_decode[2];
-extern const char                       *acpi_gbl_HEdecode[2];
-extern const char                       *acpi_gbl_LLdecode[2];
-extern const char                       *acpi_gbl_SHRdecode[2];
-extern const char                       *acpi_gbl_TYPdecode[4];
-extern const char                       *acpi_gbl_BMdecode[2];
-extern const char                       *acpi_gbl_SIZdecode[4];
-extern const char                       *acpi_gbl_TTPdecode[2];
-extern const char                       *acpi_gbl_MTPdecode[4];
-extern const char                       *acpi_gbl_TRSdecode[2];
-
-
-extern const char                       *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
-extern const char                       *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
-extern const char                       *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
-extern const char                       *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
-
-
-struct acpi_op_walk_info
-{
-       u32                             level;
-       u32                             bit_offset;
+extern struct acpi_external_list *acpi_gbl_external_list;
+extern const char *acpi_gbl_io_decode[2];
+extern const char *acpi_gbl_word_decode[4];
+extern const char *acpi_gbl_consume_decode[2];
+extern const char *acpi_gbl_min_decode[2];
+extern const char *acpi_gbl_max_decode[2];
+extern const char *acpi_gbl_DECdecode[2];
+extern const char *acpi_gbl_RNGdecode[4];
+extern const char *acpi_gbl_MEMdecode[4];
+extern const char *acpi_gbl_RWdecode[2];
+extern const char *acpi_gbl_irq_decode[2];
+extern const char *acpi_gbl_HEdecode[2];
+extern const char *acpi_gbl_LLdecode[2];
+extern const char *acpi_gbl_SHRdecode[2];
+extern const char *acpi_gbl_TYPdecode[4];
+extern const char *acpi_gbl_BMdecode[2];
+extern const char *acpi_gbl_SIZdecode[4];
+extern const char *acpi_gbl_TTPdecode[2];
+extern const char *acpi_gbl_MTPdecode[4];
+extern const char *acpi_gbl_TRSdecode[2];
+
+extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
+extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
+extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
+extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
+
+struct acpi_op_walk_info {
+       u32 level;
+       u32 bit_offset;
+       struct acpi_walk_state *walk_state;
 };
 
 typedef
-acpi_status (*asl_walk_callback) (
-       union acpi_parse_object             *op,
-       u32                                 level,
-       void                                *context);
-
+acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
+                                u32 level, void *context);
 
 /*
  * dmwalk
  */
 void
-acpi_dm_disassemble (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *origin,
-       u32                             num_opcodes);
-
+acpi_dm_disassemble(struct acpi_walk_state *walk_state,
+                   union acpi_parse_object *origin, u32 num_opcodes);
 
 /*
  * dmopcode
  */
 void
-acpi_dm_disassemble_one_op (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_op_walk_info        *info,
-       union acpi_parse_object         *op);
+acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
+                          struct acpi_op_walk_info *info,
+                          union acpi_parse_object *op);
 
-void
-acpi_dm_decode_internal_object (
-       union acpi_operand_object       *obj_desc);
+void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
 
-u32
-acpi_dm_list_type (
-       union acpi_parse_object         *op);
+u32 acpi_dm_list_type(union acpi_parse_object *op);
 
-void
-acpi_dm_method_flags (
-       union acpi_parse_object         *op);
-
-void
-acpi_dm_field_flags (
-       union acpi_parse_object         *op);
+void acpi_dm_method_flags(union acpi_parse_object *op);
 
-void
-acpi_dm_address_space (
-       u8                              space_id);
+void acpi_dm_field_flags(union acpi_parse_object *op);
 
-void
-acpi_dm_region_flags (
-       union acpi_parse_object         *op);
+void acpi_dm_address_space(u8 space_id);
 
-void
-acpi_dm_match_op (
-       union acpi_parse_object         *op);
+void acpi_dm_region_flags(union acpi_parse_object *op);
 
-u8
-acpi_dm_comma_if_list_member (
-       union acpi_parse_object         *op);
+void acpi_dm_match_op(union acpi_parse_object *op);
 
-void
-acpi_dm_comma_if_field_member (
-       union acpi_parse_object         *op);
+u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
 
+void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
 
 /*
  * dmnames
  */
-u32
-acpi_dm_dump_name (
-       char                            *name);
+u32 acpi_dm_dump_name(char *name);
 
 acpi_status
-acpi_ps_display_object_pathname (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
-void
-acpi_dm_namestring (
-       char                            *name);
+acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
+                               union acpi_parse_object *op);
 
+void acpi_dm_namestring(char *name);
 
 /*
  * dmobject
  */
 void
-acpi_dm_display_internal_object (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
+                               struct acpi_walk_state *walk_state);
 
-void
-acpi_dm_display_arguments (
-       struct acpi_walk_state          *walk_state);
+void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
 
-void
-acpi_dm_display_locals (
-       struct acpi_walk_state          *walk_state);
+void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
 
 void
-acpi_dm_dump_method_info (
-       acpi_status                     status,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
+acpi_dm_dump_method_info(acpi_status status,
+                        struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op);
 
 /*
  * dmbuffer
  */
-void
-acpi_dm_disasm_byte_list (
-       u32                             level,
-       u8                              *byte_data,
-       u32                             byte_count);
+void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
 
 void
-acpi_dm_byte_list (
-       struct acpi_op_walk_info        *info,
-       union acpi_parse_object         *op);
+acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
 
-void
-acpi_is_eisa_id (
-       union acpi_parse_object         *op);
+void acpi_dm_is_eisa_id(union acpi_parse_object *op);
 
-void
-acpi_dm_eisa_id (
-       u32                             encoded_id);
-
-u8
-acpi_dm_is_unicode_buffer (
-       union acpi_parse_object         *op);
+void acpi_dm_eisa_id(u32 encoded_id);
 
-u8
-acpi_dm_is_string_buffer (
-       union acpi_parse_object         *op);
+u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
 
+u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
 
 /*
  * dmresrc
  */
 void
-acpi_dm_resource_descriptor (
-       struct acpi_op_walk_info        *info,
-       u8                              *byte_data,
-       u32                             byte_count);
+acpi_dm_resource_descriptor(struct acpi_op_walk_info *info,
+                           u8 * byte_data, u32 byte_count);
 
-u8
-acpi_dm_is_resource_descriptor (
-       union acpi_parse_object         *op);
+u8 acpi_dm_is_resource_descriptor(union acpi_parse_object *op);
 
-void
-acpi_dm_indent (
-       u32                             level);
+void acpi_dm_indent(u32 level);
 
-void
-acpi_dm_bit_list (
-       u16                             mask);
-
-void
-acpi_dm_decode_attribute (
-       u8                              attribute);
+void acpi_dm_bit_list(u16 mask);
 
+void acpi_dm_decode_attribute(u8 attribute);
 
 /*
  * dmresrcl
  */
 void
-acpi_dm_word_descriptor (
-       struct asl_word_address_desc    *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_word_descriptor(struct asl_word_address_desc *resource,
+                       u32 length, u32 level);
 
 void
-acpi_dm_dword_descriptor (
-       struct asl_dword_address_desc   *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_dword_descriptor(struct asl_dword_address_desc *resource,
+                        u32 length, u32 level);
 
 void
-acpi_dm_extended_descriptor (
-       struct asl_extended_address_desc   *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_extended_descriptor(struct asl_extended_address_desc *resource,
+                           u32 length, u32 level);
 
 void
-acpi_dm_qword_descriptor (
-       struct asl_qword_address_desc   *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_qword_descriptor(struct asl_qword_address_desc *resource,
+                        u32 length, u32 level);
 
 void
-acpi_dm_memory24_descriptor (
-       struct asl_memory_24_desc       *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_memory24_descriptor(struct asl_memory_24_desc *resource,
+                           u32 length, u32 level);
 
 void
-acpi_dm_memory32_descriptor (
-       struct asl_memory_32_desc       *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_memory32_descriptor(struct asl_memory_32_desc *resource,
+                           u32 length, u32 level);
 
 void
-acpi_dm_fixed_mem32_descriptor (
-       struct asl_fixed_memory_32_desc *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_fixed_mem32_descriptor(struct asl_fixed_memory_32_desc *resource,
+                              u32 length, u32 level);
 
 void
-acpi_dm_generic_register_descriptor (
-       struct asl_general_register_desc *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_generic_register_descriptor(struct asl_general_register_desc *resource,
+                                   u32 length, u32 level);
 
 void
-acpi_dm_interrupt_descriptor (
-       struct asl_extended_xrupt_desc *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_interrupt_descriptor(struct asl_extended_xrupt_desc *resource,
+                            u32 length, u32 level);
 
 void
-acpi_dm_vendor_large_descriptor (
-       struct asl_large_vendor_desc    *resource,
-       u32                             length,
-       u32                             level);
-
+acpi_dm_vendor_large_descriptor(struct asl_large_vendor_desc *resource,
+                               u32 length, u32 level);
 
 /*
  * dmresrcs
  */
 void
-acpi_dm_irq_descriptor (
-       struct asl_irq_format_desc      *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_irq_descriptor(struct asl_irq_format_desc *resource,
+                      u32 length, u32 level);
 
 void
-acpi_dm_dma_descriptor (
-       struct asl_dma_format_desc      *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_dma_descriptor(struct asl_dma_format_desc *resource,
+                      u32 length, u32 level);
 
 void
-acpi_dm_io_descriptor (
-       struct asl_io_port_desc         *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_io_descriptor(struct asl_io_port_desc *resource, u32 length, u32 level);
 
 void
-acpi_dm_fixed_io_descriptor (
-       struct asl_fixed_io_port_desc   *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_fixed_io_descriptor(struct asl_fixed_io_port_desc *resource,
+                           u32 length, u32 level);
 
 void
-acpi_dm_start_dependent_descriptor (
-       struct asl_start_dependent_desc *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_start_dependent_descriptor(struct asl_start_dependent_desc *resource,
+                                  u32 length, u32 level);
 
 void
-acpi_dm_end_dependent_descriptor (
-       struct asl_start_dependent_desc *resource,
-       u32                             length,
-       u32                             level);
+acpi_dm_end_dependent_descriptor(struct asl_start_dependent_desc *resource,
+                                u32 length, u32 level);
 
 void
-acpi_dm_vendor_small_descriptor (
-       struct asl_small_vendor_desc    *resource,
-       u32                             length,
-       u32                             level);
-
+acpi_dm_vendor_small_descriptor(struct asl_small_vendor_desc *resource,
+                               u32 length, u32 level);
 
 /*
  * dmutils
  */
-void
-acpi_dm_add_to_external_list (
-       char                            *path);
+void acpi_dm_add_to_external_list(char *path);
 
-#endif  /* __ACDISASM_H__ */
+#endif                         /* __ACDISASM_H__ */
index 8f5f2f71b1de9a33d617912e1e5169a3324c9cce..065f24a77cfcb44010f053127a0dbdc934e2f2bd 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef _ACDISPAT_H_
 #define _ACDISPAT_H_
 
-
 #define NAMEOF_LOCAL_NTE    "__L0"
 #define NAMEOF_ARG_NTE      "__A0"
 
-
 /*
  * dsopcode - support for late evaluation
  */
 acpi_status
-acpi_ds_get_buffer_field_arguments (
-       union acpi_operand_object       *obj_desc);
-
-acpi_status
-acpi_ds_get_region_arguments (
-       union acpi_operand_object       *rgn_desc);
+acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ds_get_buffer_arguments (
-       union acpi_operand_object       *obj_desc);
+acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc);
 
-acpi_status
-acpi_ds_get_package_arguments (
-       union acpi_operand_object       *obj_desc);
+acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ds_eval_buffer_field_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
+acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc);
 
 acpi_status
-acpi_ds_eval_region_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
+acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
+                                  union acpi_parse_object *op);
 
 acpi_status
-acpi_ds_eval_data_object_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       union acpi_operand_object       *obj_desc);
+acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
+                            union acpi_parse_object *op);
 
 acpi_status
-acpi_ds_initialize_region (
-       acpi_handle                     obj_handle);
+acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
+                                 union acpi_parse_object *op,
+                                 union acpi_operand_object *obj_desc);
 
+acpi_status acpi_ds_initialize_region(acpi_handle obj_handle);
 
 /*
  * dsctrl - Parser/Interpreter interface, control stack routines
  */
 acpi_status
-acpi_ds_exec_begin_control_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
+acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
+                             union acpi_parse_object *op);
 
 acpi_status
-acpi_ds_exec_end_control_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
-
+acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
+                           union acpi_parse_object *op);
 
 /*
  * dsexec - Parser/Interpreter interface, method execution callbacks
  */
 acpi_status
-acpi_ds_get_predicate_value (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *result_obj);
-
-acpi_status
-acpi_ds_exec_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op);
+acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
+                           union acpi_operand_object *result_obj);
 
 acpi_status
-acpi_ds_exec_end_op (
-       struct acpi_walk_state          *state);
+acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
+                     union acpi_parse_object **out_op);
 
+acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state);
 
 /*
  * dsfield - Parser/Interpreter interface for AML fields
  */
 acpi_status
-acpi_ds_create_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_create_field(union acpi_parse_object *op,
+                    struct acpi_namespace_node *region_node,
+                    struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_create_bank_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_create_bank_field(union acpi_parse_object *op,
+                         struct acpi_namespace_node *region_node,
+                         struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_create_index_field (
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *region_node,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_create_index_field(union acpi_parse_object *op,
+                          struct acpi_namespace_node *region_node,
+                          struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_create_buffer_field (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_create_buffer_field(union acpi_parse_object *op,
+                           struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_init_field_objects (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ds_init_field_objects(union acpi_parse_object *op,
+                          struct acpi_walk_state *walk_state);
 
 /*
  * dsload - Parser/Interpreter interface, namespace load callbacks
  */
 acpi_status
-acpi_ds_load1_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op);
+acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
+                      union acpi_parse_object **out_op);
 
-acpi_status
-acpi_ds_load1_end_op (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_load2_begin_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         **out_op);
+acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
+                      union acpi_parse_object **out_op);
 
-acpi_status
-acpi_ds_load2_end_op (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_init_callbacks (
-       struct acpi_walk_state          *walk_state,
-       u32                             pass_number);
-
+acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
 
 /*
  * dsmthdat - method data (locals/args)
  */
 acpi_status
-acpi_ds_store_object_to_local (
-       u16                             opcode,
-       u32                             index,
-       union acpi_operand_object       *src_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_store_object_to_local(u16 opcode,
+                             u32 index,
+                             union acpi_operand_object *src_desc,
+                             struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_method_data_get_entry (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       ***node);
+acpi_ds_method_data_get_entry(u16 opcode,
+                             u32 index,
+                             struct acpi_walk_state *walk_state,
+                             union acpi_operand_object ***node);
 
-void
-acpi_ds_method_data_delete_all (
-       struct acpi_walk_state          *walk_state);
+void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
 
-u8
-acpi_ds_is_method_value (
-       union acpi_operand_object       *obj_desc);
+u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
 
 acpi_status
-acpi_ds_method_data_get_value (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       **dest_desc);
+acpi_ds_method_data_get_value(u16 opcode,
+                             u32 index,
+                             struct acpi_walk_state *walk_state,
+                             union acpi_operand_object **dest_desc);
 
 acpi_status
-acpi_ds_method_data_init_args (
-       union acpi_operand_object       **params,
-       u32                             max_param_count,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_init_args(union acpi_operand_object **params,
+                             u32 max_param_count,
+                             struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_method_data_get_node (
-       u16                             opcode,
-       u32                             index,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      **node);
-
-void
-acpi_ds_method_data_init (
-       struct acpi_walk_state          *walk_state);
+acpi_ds_method_data_get_node(u16 opcode,
+                            u32 index,
+                            struct acpi_walk_state *walk_state,
+                            struct acpi_namespace_node **node);
 
+void acpi_ds_method_data_init(struct acpi_walk_state *walk_state);
 
 /*
  * dsmethod - Parser/Interpreter interface - control method parsing
  */
-acpi_status
-acpi_ds_parse_method (
-       acpi_handle                     obj_handle);
+acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node);
 
 acpi_status
-acpi_ds_call_control_method (
-       struct acpi_thread_state        *thread,
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op);
+acpi_ds_call_control_method(struct acpi_thread_state *thread,
+                           struct acpi_walk_state *walk_state,
+                           union acpi_parse_object *op);
 
 acpi_status
-acpi_ds_restart_control_method (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *return_desc);
+acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
+                              union acpi_operand_object *return_desc);
 
-acpi_status
-acpi_ds_terminate_control_method (
-       struct acpi_walk_state          *walk_state);
+void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_begin_method_execution (
-       struct acpi_namespace_node      *method_node,
-       union acpi_operand_object       *obj_desc,
-       struct acpi_namespace_node      *calling_method_node);
-
+acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
+                              union acpi_operand_object *obj_desc,
+                              struct acpi_namespace_node *calling_method_node);
 
 /*
  * dsinit
  */
 acpi_status
-acpi_ds_initialize_objects (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *start_node);
-
+acpi_ds_initialize_objects(struct acpi_table_desc *table_desc,
+                          struct acpi_namespace_node *start_node);
 
 /*
  * dsobject - Parser/Interpreter interface - object initialization and conversion
  */
 acpi_status
-acpi_ds_build_internal_buffer_obj (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u32                             buffer_length,
-       union acpi_operand_object       **obj_desc_ptr);
+acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
+                                 union acpi_parse_object *op,
+                                 u32 buffer_length,
+                                 union acpi_operand_object **obj_desc_ptr);
 
 acpi_status
-acpi_ds_build_internal_package_obj (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u32                             package_length,
-       union acpi_operand_object       **obj_desc);
+acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
+                                  union acpi_parse_object *op,
+                                  u32 package_length,
+                                  union acpi_operand_object **obj_desc);
 
 acpi_status
-acpi_ds_init_object_from_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       u16                             opcode,
-       union acpi_operand_object       **obj_desc);
+acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
+                           union acpi_parse_object *op,
+                           u16 opcode, union acpi_operand_object **obj_desc);
 
 acpi_status
-acpi_ds_create_node (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *node,
-       union acpi_parse_object         *op);
-
+acpi_ds_create_node(struct acpi_walk_state *walk_state,
+                   struct acpi_namespace_node *node,
+                   union acpi_parse_object *op);
 
 /*
  * dsutils - Parser/Interpreter interface utility routines
  */
-void
-acpi_ds_clear_implicit_return (
-       struct acpi_walk_state          *walk_state);
+void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state);
 
 u8
-acpi_ds_do_implicit_return (
-       union acpi_operand_object       *return_desc,
-       struct acpi_walk_state          *walk_state,
-       u8                              add_reference);
+acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
+                          struct acpi_walk_state *walk_state,
+                          u8 add_reference);
 
 u8
-acpi_ds_is_result_used (
-       union acpi_parse_object         *op,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_is_result_used(union acpi_parse_object *op,
+                      struct acpi_walk_state *walk_state);
 
 void
-acpi_ds_delete_result_if_not_used (
-       union acpi_parse_object         *op,
-       union acpi_operand_object       *result_obj,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
+                                 union acpi_operand_object *result_obj,
+                                 struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_create_operand (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *arg,
-       u32                             args_remaining);
+acpi_ds_create_operand(struct acpi_walk_state *walk_state,
+                      union acpi_parse_object *arg, u32 args_remaining);
 
 acpi_status
-acpi_ds_create_operands (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *first_arg);
+acpi_ds_create_operands(struct acpi_walk_state *walk_state,
+                       union acpi_parse_object *first_arg);
 
-acpi_status
-acpi_ds_resolve_operands (
-       struct acpi_walk_state          *walk_state);
-
-void
-acpi_ds_clear_operands (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state);
 
+void acpi_ds_clear_operands(struct acpi_walk_state *walk_state);
 
 /*
  * dswscope - Scope Stack manipulation
  */
 acpi_status
-acpi_ds_scope_stack_push (
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
+                        acpi_object_type type,
+                        struct acpi_walk_state *walk_state);
 
+acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ds_scope_stack_pop (
-       struct acpi_walk_state          *walk_state);
-
-void
-acpi_ds_scope_stack_clear (
-       struct acpi_walk_state          *walk_state);
-
+void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state);
 
 /*
  * dswstate - parser WALK_STATE management routines
  */
 acpi_status
-acpi_ds_obj_stack_push (
-       void                            *object,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_obj_stack_pop (
-       u32                             pop_count,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
 
-struct acpi_walk_state *
-acpi_ds_create_walk_state (
-       acpi_owner_id                   owner_id,
-       union acpi_parse_object         *origin,
-       union acpi_operand_object       *mth_desc,
-       struct acpi_thread_state        *thread);
+struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
+                                                 union acpi_parse_object
+                                                 *origin,
+                                                 union acpi_operand_object
+                                                 *mth_desc,
+                                                 struct acpi_thread_state
+                                                 *thread);
 
 acpi_status
-acpi_ds_init_aml_walk (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       struct acpi_namespace_node      *method_node,
-       u8                              *aml_start,
-       u32                             aml_length,
-       struct acpi_parameter_info      *info,
-       u32                             pass_number);
+acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
+                     union acpi_parse_object *op,
+                     struct acpi_namespace_node *method_node,
+                     u8 * aml_start,
+                     u32 aml_length,
+                     struct acpi_parameter_info *info, u8 pass_number);
 
 acpi_status
-acpi_ds_obj_stack_pop_and_delete (
-       u32                             pop_count,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
+                                struct acpi_walk_state *walk_state);
 
-void
-acpi_ds_delete_walk_state (
-       struct acpi_walk_state          *walk_state);
+void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state);
 
-struct acpi_walk_state *
-acpi_ds_pop_walk_state (
-       struct acpi_thread_state        *thread);
+struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state
+                                              *thread);
 
 void
-acpi_ds_push_walk_state (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_thread_state        *thread);
+acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
+                       struct acpi_thread_state *thread);
 
-acpi_status
-acpi_ds_result_stack_pop (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ds_result_stack_push (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ds_result_stack_clear (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state);
 
-struct acpi_walk_state *
-acpi_ds_get_current_walk_state (
-       struct acpi_thread_state        *thread);
+struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
+                                                      *thread);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_ds_result_remove (
-       union acpi_operand_object       **object,
-       u32                             index,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_result_remove(union acpi_operand_object **object,
+                     u32 index, struct acpi_walk_state *walk_state);
 #endif
 
 acpi_status
-acpi_ds_result_pop (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_result_pop(union acpi_operand_object **object,
+                  struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_result_push (
-       union acpi_operand_object       *object,
-       struct acpi_walk_state          *walk_state);
+acpi_ds_result_push(union acpi_operand_object *object,
+                   struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_result_pop_from_bottom (
-       union acpi_operand_object       **object,
-       struct acpi_walk_state          *walk_state);
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ds_delete_walk_state_cache (
-       void);
-#endif
+acpi_ds_result_pop_from_bottom(union acpi_operand_object **object,
+                              struct acpi_walk_state *walk_state);
 
-#endif /* _ACDISPAT_H_ */
+#endif                         /* _ACDISPAT_H_ */
index 61a27c8c50795f3d2e46ea3d4c475f7a958f9508..bfa54600ecd9748244db27ea8190f95233919085 100644 (file)
 #ifndef __ACEVENTS_H__
 #define __ACEVENTS_H__
 
-
 /*
  * evevent
  */
-acpi_status
-acpi_ev_initialize_events (
-       void);
+acpi_status acpi_ev_initialize_events(void);
 
-acpi_status
-acpi_ev_install_xrupt_handlers (
-       void);
-
-u32
-acpi_ev_fixed_event_detect (
-       void);
+acpi_status acpi_ev_install_xrupt_handlers(void);
 
+u32 acpi_ev_fixed_event_detect(void);
 
 /*
  * evmisc
  */
-u8
-acpi_ev_is_notify_object (
-       struct acpi_namespace_node      *node);
+u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
 
-acpi_status
-acpi_ev_acquire_global_lock(
-       u16                             timeout);
+acpi_status acpi_ev_acquire_global_lock(u16 timeout);
 
-acpi_status
-acpi_ev_release_global_lock(
-       void);
+acpi_status acpi_ev_release_global_lock(void);
 
-acpi_status
-acpi_ev_init_global_lock_handler (
-       void);
+acpi_status acpi_ev_init_global_lock_handler(void);
 
-u32
-acpi_ev_get_gpe_number_index (
-       u32                             gpe_number);
+u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
 
 acpi_status
-acpi_ev_queue_notify_request (
-       struct acpi_namespace_node      *node,
-       u32                             notify_value);
-
+acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
+                            u32 notify_value);
 
 /*
  * evgpe - GPE handling and dispatch
  */
 acpi_status
-acpi_ev_update_gpe_enable_masks (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              type);
+acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
+                               u8 type);
 
 acpi_status
-acpi_ev_enable_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              write_to_hardware);
+acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
+                  u8 write_to_hardware);
 
-acpi_status
-acpi_ev_disable_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info);
-
-struct acpi_gpe_event_info *
-acpi_ev_get_gpe_event_info (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number);
+acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
+struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
+                                                      u32 gpe_number);
 
 /*
  * evgpeblk
  */
-u8
-acpi_ev_valid_gpe_event (
-       struct acpi_gpe_event_info      *gpe_event_info);
-
-acpi_status
-acpi_ev_walk_gpe_list (
-       ACPI_GPE_CALLBACK       gpe_walk_callback,
-       u32                             flags);
+u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info);
 
-acpi_status
-acpi_ev_delete_gpe_handlers (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
+acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback);
 
 acpi_status
-acpi_ev_create_gpe_block (
-       struct acpi_namespace_node      *gpe_device,
-       struct acpi_generic_address     *gpe_block_address,
-       u32                             register_count,
-       u8                              gpe_block_base_number,
-       u32                             interrupt_level,
-       struct acpi_gpe_block_info      **return_gpe_block);
+acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                           struct acpi_gpe_block_info *gpe_block);
 
 acpi_status
-acpi_ev_delete_gpe_block (
-       struct acpi_gpe_block_info      *gpe_block);
+acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
+                        struct acpi_generic_address *gpe_block_address,
+                        u32 register_count,
+                        u8 gpe_block_base_number,
+                        u32 interrupt_number,
+                        struct acpi_gpe_block_info **return_gpe_block);
 
-u32
-acpi_ev_gpe_dispatch (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u32                             gpe_number);
+acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block);
 
 u32
-acpi_ev_gpe_detect (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_list);
+acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info,
+                    u32 gpe_number);
 
-acpi_status
-acpi_ev_set_gpe_type (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       u8                              type);
+u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
 
 acpi_status
-acpi_ev_check_for_wake_only_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info);
+acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type);
 
 acpi_status
-acpi_ev_gpe_initialize (
-       void);
+acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
+acpi_status acpi_ev_gpe_initialize(void);
 
 /*
  * evregion - Address Space handling
  */
-acpi_status
-acpi_ev_install_region_handlers (
-       void);
+acpi_status acpi_ev_install_region_handlers(void);
 
-acpi_status
-acpi_ev_initialize_op_regions (
-       void);
+acpi_status acpi_ev_initialize_op_regions(void);
 
 acpi_status
-acpi_ev_address_space_dispatch (
-       union acpi_operand_object      *region_obj,
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       void                            *value);
+acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
+                              u32 function,
+                              acpi_physical_address address,
+                              u32 bit_width, void *value);
 
 acpi_status
-acpi_ev_attach_region (
-       union acpi_operand_object       *handler_obj,
-       union acpi_operand_object       *region_obj,
-       u8                              acpi_ns_is_locked);
+acpi_ev_attach_region(union acpi_operand_object *handler_obj,
+                     union acpi_operand_object *region_obj,
+                     u8 acpi_ns_is_locked);
 
 void
-acpi_ev_detach_region (
-       union acpi_operand_object      *region_obj,
-       u8                              acpi_ns_is_locked);
+acpi_ev_detach_region(union acpi_operand_object *region_obj,
+                     u8 acpi_ns_is_locked);
 
 acpi_status
-acpi_ev_install_space_handler (
-       struct acpi_namespace_node      *node,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler,
-       acpi_adr_space_setup            setup,
-       void                            *context);
+acpi_ev_install_space_handler(struct acpi_namespace_node *node,
+                             acpi_adr_space_type space_id,
+                             acpi_adr_space_handler handler,
+                             acpi_adr_space_setup setup, void *context);
 
 acpi_status
-acpi_ev_execute_reg_methods (
-       struct acpi_namespace_node      *node,
-       acpi_adr_space_type             space_id);
+acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
+                           acpi_adr_space_type space_id);
 
 acpi_status
-acpi_ev_execute_reg_method (
-       union acpi_operand_object      *region_obj,
-       u32                             function);
-
+acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
 
 /*
  * evregini - Region initialization and setup
  */
 acpi_status
-acpi_ev_system_memory_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_system_memory_region_setup(acpi_handle handle,
+                                  u32 function,
+                                  void *handler_context,
+                                  void **region_context);
 
 acpi_status
-acpi_ev_io_space_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_io_space_region_setup(acpi_handle handle,
+                             u32 function,
+                             void *handler_context, void **region_context);
 
 acpi_status
-acpi_ev_pci_config_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_pci_config_region_setup(acpi_handle handle,
+                               u32 function,
+                               void *handler_context, void **region_context);
 
 acpi_status
-acpi_ev_cmos_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_cmos_region_setup(acpi_handle handle,
+                         u32 function,
+                         void *handler_context, void **region_context);
 
 acpi_status
-acpi_ev_pci_bar_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_pci_bar_region_setup(acpi_handle handle,
+                            u32 function,
+                            void *handler_context, void **region_context);
 
 acpi_status
-acpi_ev_default_region_setup (
-       acpi_handle                     handle,
-       u32                             function,
-       void                            *handler_context,
-       void                            **region_context);
+acpi_ev_default_region_setup(acpi_handle handle,
+                            u32 function,
+                            void *handler_context, void **region_context);
 
 acpi_status
-acpi_ev_initialize_region (
-       union acpi_operand_object       *region_obj,
-       u8                              acpi_ns_locked);
-
+acpi_ev_initialize_region(union acpi_operand_object *region_obj,
+                         u8 acpi_ns_locked);
 
 /*
  * evsci - SCI (System Control Interrupt) handling/dispatch
  */
-u32 ACPI_SYSTEM_XFACE
-acpi_ev_gpe_xrupt_handler (
-       void                            *context);
-
-u32
-acpi_ev_install_sci_handler (
-       void);
+u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
 
-acpi_status
-acpi_ev_remove_sci_handler (
-       void);
+u32 acpi_ev_install_sci_handler(void);
 
-u32
-acpi_ev_initialize_sCI (
-       u32                             program_sCI);
+acpi_status acpi_ev_remove_sci_handler(void);
 
-void
-acpi_ev_terminate (
-       void);
+u32 acpi_ev_initialize_sCI(u32 program_sCI);
 
+void acpi_ev_terminate(void);
 
-#endif  /* __ACEVENTS_H__  */
+#endif                         /* __ACEVENTS_H__  */
index 60d737b2d70f2dde682c7ea9a5f1202ede670be5..4f005eb659281b0156fbc232633b5f634982e9cb 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __ACEXCEP_H__
 #define __ACEXCEP_H__
 
-
 /*
  * Exceptions returned by external ACPI interfaces
  */
 #define AE_CODE_CONTROL                 0x4000
 #define AE_CODE_MASK                    0xF000
 
-
 #define ACPI_SUCCESS(a)                 (!(a))
 #define ACPI_FAILURE(a)                 (a)
 
-
 #define AE_OK                           (acpi_status) 0x0000
 
 /*
@@ -95,9 +92,9 @@
 #define AE_ABORT_METHOD                 (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
 #define AE_SAME_HANDLER                 (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
 #define AE_WAKE_ONLY_GPE                (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL)
+#define AE_OWNER_ID_LIMIT               (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL)
 
-#define AE_CODE_ENV_MAX                 0x001E
-
+#define AE_CODE_ENV_MAX                 0x001F
 
 /*
  * Programmer exceptions
 
 #define AE_CODE_PGM_MAX                 0x0009
 
-
 /*
  * Acpi table exceptions
  */
 
 #define AE_CODE_TBL_MAX                 0x0006
 
-
 /*
  * AML exceptions.  These are caused by problems with
  * the actual AML byte stream
 
 #define AE_CODE_AML_MAX                 0x0021
 
-
 /*
  * Internal exceptions used for control
  */
 
 #define AE_CODE_CTRL_MAX                0x000B
 
-
 #ifdef DEFINE_ACPI_GLOBALS
 
-
 /*
  * String versions of the exception codes above
  * These strings must match the corresponding defines exactly
  */
-char const   *acpi_gbl_exception_names_env[] =
-{
+char const *acpi_gbl_exception_names_env[] = {
        "AE_OK",
        "AE_ERROR",
        "AE_NO_ACPI_TABLES",
@@ -226,11 +217,11 @@ char const   *acpi_gbl_exception_names_env[] =
        "AE_LOGICAL_ADDRESS",
        "AE_ABORT_METHOD",
        "AE_SAME_HANDLER",
-       "AE_WAKE_ONLY_GPE"
+       "AE_WAKE_ONLY_GPE",
+       "AE_OWNER_ID_LIMIT"
 };
 
-char const   *acpi_gbl_exception_names_pgm[] =
-{
+char const *acpi_gbl_exception_names_pgm[] = {
        "AE_BAD_PARAMETER",
        "AE_BAD_CHARACTER",
        "AE_BAD_PATHNAME",
@@ -242,8 +233,7 @@ char const   *acpi_gbl_exception_names_pgm[] =
        "AE_BAD_DECIMAL_CONSTANT"
 };
 
-char const   *acpi_gbl_exception_names_tbl[] =
-{
+char const *acpi_gbl_exception_names_tbl[] = {
        "AE_BAD_SIGNATURE",
        "AE_BAD_HEADER",
        "AE_BAD_CHECKSUM",
@@ -252,8 +242,7 @@ char const   *acpi_gbl_exception_names_tbl[] =
        "AE_INVALID_TABLE_LENGTH"
 };
 
-char const   *acpi_gbl_exception_names_aml[] =
-{
+char const *acpi_gbl_exception_names_aml[] = {
        "AE_AML_ERROR",
        "AE_AML_PARSE",
        "AE_AML_BAD_OPCODE",
@@ -289,8 +278,7 @@ char const   *acpi_gbl_exception_names_aml[] =
        "AE_AML_BAD_RESOURCE_LENGTH"
 };
 
-char const   *acpi_gbl_exception_names_ctrl[] =
-{
+char const *acpi_gbl_exception_names_ctrl[] = {
        "AE_CTRL_RETURN_VALUE",
        "AE_CTRL_PENDING",
        "AE_CTRL_TERMINATE",
@@ -304,6 +292,6 @@ char const   *acpi_gbl_exception_names_ctrl[] =
        "AE_CTRL_SKIP"
 };
 
-#endif /* ACPI GLOBALS */
+#endif                         /* ACPI GLOBALS */
 
-#endif /* __ACEXCEP_H__ */
+#endif                         /* __ACEXCEP_H__ */
index 4946696088c3a520fe14794be5d47ffe5d83a981..e9c2790139ecfa47165f006afd285705618e34d9 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __ACGLOBAL_H__
 #define __ACGLOBAL_H__
 
-
 /*
  * Ensure that the globals are actually defined and initialized only once.
  *
@@ -63,9 +62,8 @@
  * Keep local copies of these FADT-based registers.  NOTE: These globals
  * are first in this file for alignment reasons on 64-bit systems.
  */
-ACPI_EXTERN struct acpi_generic_address         acpi_gbl_xpm1a_enable;
-ACPI_EXTERN struct acpi_generic_address         acpi_gbl_xpm1b_enable;
-
+ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
+ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
 
 /*****************************************************************************
  *
@@ -75,13 +73,12 @@ ACPI_EXTERN struct acpi_generic_address         acpi_gbl_xpm1b_enable;
 
 /* Runtime configuration of debug print levels */
 
-extern      u32                                 acpi_dbg_level;
-extern      u32                                 acpi_dbg_layer;
+extern u32 acpi_dbg_level;
+extern u32 acpi_dbg_layer;
 
 /* Procedure nesting level for debug output */
 
-extern      u32                                 acpi_gbl_nesting_level;
-
+extern u32 acpi_gbl_nesting_level;
 
 /*****************************************************************************
  *
@@ -98,7 +95,7 @@ extern      u32                                 acpi_gbl_nesting_level;
  * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
  * 4) Allow ANY object type to be a source operand for the Store() operator
  */
-ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE);
+ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
 
 /*
  * Automatically serialize ALL control methods? Default is FALSE, meaning
@@ -106,22 +103,21 @@ ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_enable_interpreter_slack, FALSE)
  * Only change this if the ASL code is poorly written and cannot handle
  * reentrancy even though methods are marked "not_serialized".
  */
-ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_all_methods_serialized, FALSE);
+ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
 
 /*
  * Create the predefined _OSI method in the namespace? Default is TRUE
  * because ACPI CA is fully compatible with other ACPI implementations.
  * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
  */
-ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_create_osi_method, TRUE);
+ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
 
 /*
  * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
  * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
  * be enabled just before going to sleep.
  */
-ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE);
-
+ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
 
 /*****************************************************************************
  *
@@ -137,42 +133,46 @@ ACPI_EXTERN u8       ACPI_INIT_GLOBAL (acpi_gbl_leave_wake_gpes_disabled, TRUE);
  * These tables are single-table only; meaning that there can be at most one
  * of each in the system.  Each global points to the actual table.
  */
-ACPI_EXTERN u32                                 acpi_gbl_table_flags;
-ACPI_EXTERN u32                                 acpi_gbl_rsdt_table_count;
-ACPI_EXTERN struct rsdp_descriptor             *acpi_gbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR            *acpi_gbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR            *acpi_gbl_FADT;
-ACPI_EXTERN struct acpi_table_header           *acpi_gbl_DSDT;
-ACPI_EXTERN FACS_DESCRIPTOR            *acpi_gbl_FACS;
-ACPI_EXTERN struct acpi_common_facs             acpi_gbl_common_fACS;
+ACPI_EXTERN u32 acpi_gbl_table_flags;
+ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
+ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
+ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT;
+ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
+ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
+ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS;
+ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
 /*
  * Since there may be multiple SSDTs and PSDTs, a single pointer is not
  * sufficient; Therefore, there isn't one!
  */
 
+/* The root table can be either an RSDT or an XSDT */
+
+ACPI_EXTERN u8 acpi_gbl_root_table_type;
+#define     ACPI_TABLE_TYPE_RSDT        'R'
+#define     ACPI_TABLE_TYPE_XSDT        'X'
 
 /*
  * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
  * If we are executing a method that exists in a 32-bit ACPI table,
  * use only the lower 32 bits of the (internal) 64-bit Integer.
  */
-ACPI_EXTERN u8                                  acpi_gbl_integer_bit_width;
-ACPI_EXTERN u8                                  acpi_gbl_integer_byte_width;
-ACPI_EXTERN u8                                  acpi_gbl_integer_nybble_width;
+ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
+ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
+ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
 
 /*
  * ACPI Table info arrays
  */
-extern      struct acpi_table_list              acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
-extern      struct acpi_table_support           acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
+extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES];
+extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES];
 
 /*
  * Predefined mutex objects.  This array contains the
  * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
  * (The table maps local handles to the real OS handles)
  */
-ACPI_EXTERN struct acpi_mutex_info              acpi_gbl_mutex_info[NUM_MUTEX];
-
+ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX];
 
 /*****************************************************************************
  *
@@ -180,41 +180,56 @@ ACPI_EXTERN struct acpi_mutex_info              acpi_gbl_mutex_info[NUM_MUTEX];
  *
  ****************************************************************************/
 
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Lists for tracking memory allocations */
 
-ACPI_EXTERN struct acpi_memory_list             acpi_gbl_memory_lists[ACPI_NUM_MEM_LISTS];
-ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_device_notify;
-ACPI_EXTERN struct acpi_object_notify_handler   acpi_gbl_system_notify;
-ACPI_EXTERN acpi_exception_handler              acpi_gbl_exception_handler;
-ACPI_EXTERN acpi_init_handler                   acpi_gbl_init_handler;
-ACPI_EXTERN struct acpi_walk_state             *acpi_gbl_breakpoint_walk;
-ACPI_EXTERN acpi_handle                         acpi_gbl_global_lock_semaphore;
-
-ACPI_EXTERN u32                                 acpi_gbl_global_lock_thread_count;
-ACPI_EXTERN u32                                 acpi_gbl_original_mode;
-ACPI_EXTERN u32                                 acpi_gbl_rsdp_original_location;
-ACPI_EXTERN u32                                 acpi_gbl_ns_lookup_count;
-ACPI_EXTERN u32                                 acpi_gbl_ps_find_count;
-ACPI_EXTERN u16                                 acpi_gbl_pm1_enable_register_save;
-ACPI_EXTERN u16                                 acpi_gbl_next_table_owner_id;
-ACPI_EXTERN u16                                 acpi_gbl_next_method_owner_id;
-ACPI_EXTERN u16                                 acpi_gbl_global_lock_handle;
-ACPI_EXTERN u8                                  acpi_gbl_debugger_configuration;
-ACPI_EXTERN u8                                  acpi_gbl_global_lock_acquired;
-ACPI_EXTERN u8                                  acpi_gbl_step_to_next_call;
-ACPI_EXTERN u8                                  acpi_gbl_acpi_hardware_present;
-ACPI_EXTERN u8                                  acpi_gbl_global_lock_present;
-ACPI_EXTERN u8                                  acpi_gbl_events_initialized;
-ACPI_EXTERN u8                                  acpi_gbl_system_awake_and_running;
-
-extern u8                                       acpi_gbl_shutdown;
-extern u32                                      acpi_gbl_startup_flags;
-extern const u8                                 acpi_gbl_decode_to8bit[8];
-extern const char                              *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
-extern const char                              *acpi_gbl_highest_dstate_names[4];
-extern const struct acpi_opcode_info            acpi_gbl_aml_op_info[AML_NUM_OPCODES];
-extern const char                              *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
-extern const char                              *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
+ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
+ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
+#endif
 
+/* Object caches */
+
+ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;
+ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
+
+/* Global handlers */
+
+ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;
+ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;
+ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
+ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
+ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
+ACPI_EXTERN acpi_handle acpi_gbl_global_lock_semaphore;
+
+/* Misc */
+
+ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
+ACPI_EXTERN u32 acpi_gbl_original_mode;
+ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
+ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
+ACPI_EXTERN u32 acpi_gbl_ps_find_count;
+ACPI_EXTERN u32 acpi_gbl_owner_id_mask;
+ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;
+ACPI_EXTERN u16 acpi_gbl_global_lock_handle;
+ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
+ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;
+ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
+ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
+ACPI_EXTERN u8 acpi_gbl_global_lock_present;
+ACPI_EXTERN u8 acpi_gbl_events_initialized;
+ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
+
+extern u8 acpi_gbl_shutdown;
+extern u32 acpi_gbl_startup_flags;
+extern const u8 acpi_gbl_decode_to8bit[8];
+extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
+extern const char *acpi_gbl_highest_dstate_names[4];
+extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
+extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
+extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
 
 /*****************************************************************************
  *
@@ -230,36 +245,34 @@ extern const char                              *acpi_gbl_valid_osi_strings[ACPI_
 #define NUM_PREDEFINED_NAMES            9
 #endif
 
-ACPI_EXTERN struct acpi_namespace_node          acpi_gbl_root_node_struct;
-ACPI_EXTERN struct acpi_namespace_node         *acpi_gbl_root_node;
-ACPI_EXTERN struct acpi_namespace_node         *acpi_gbl_fadt_gpe_device;
+ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
+ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
+ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
 
-extern const u8                                 acpi_gbl_ns_properties[NUM_NS_TYPES];
-extern const struct acpi_predefined_names       acpi_gbl_pre_defined_names [NUM_PREDEFINED_NAMES];
+extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES];
+extern const struct acpi_predefined_names
+    acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
 
 #ifdef ACPI_DEBUG_OUTPUT
-ACPI_EXTERN u32                                 acpi_gbl_current_node_count;
-ACPI_EXTERN u32                                 acpi_gbl_current_node_size;
-ACPI_EXTERN u32                                 acpi_gbl_max_concurrent_node_count;
-ACPI_EXTERN acpi_size                           acpi_gbl_entry_stack_pointer;
-ACPI_EXTERN acpi_size                           acpi_gbl_lowest_stack_pointer;
-ACPI_EXTERN u32                                 acpi_gbl_deepest_nesting;
+ACPI_EXTERN u32 acpi_gbl_current_node_count;
+ACPI_EXTERN u32 acpi_gbl_current_node_size;
+ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;
+ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer;
+ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer;
+ACPI_EXTERN u32 acpi_gbl_deepest_nesting;
 #endif
 
-
 /*****************************************************************************
  *
  * Interpreter globals
  *
  ****************************************************************************/
 
-
-ACPI_EXTERN struct acpi_thread_state           *acpi_gbl_current_walk_list;
+ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;
 
 /* Control method single step flag */
 
-ACPI_EXTERN u8                                  acpi_gbl_cm_single_step;
-
+ACPI_EXTERN u8 acpi_gbl_cm_single_step;
 
 /*****************************************************************************
  *
@@ -267,8 +280,7 @@ ACPI_EXTERN u8                                  acpi_gbl_cm_single_step;
  *
  ****************************************************************************/
 
-ACPI_EXTERN union acpi_parse_object            *acpi_gbl_parsed_namespace_root;
-
+ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root;
 
 /*****************************************************************************
  *
@@ -276,10 +288,10 @@ ACPI_EXTERN union acpi_parse_object            *acpi_gbl_parsed_namespace_root;
  *
  ****************************************************************************/
 
-extern      struct acpi_bit_register_info       acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
-ACPI_EXTERN u8                                  acpi_gbl_sleep_type_a;
-ACPI_EXTERN u8                                  acpi_gbl_sleep_type_b;
-
+extern struct acpi_bit_register_info
+    acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
+ACPI_EXTERN u8 acpi_gbl_sleep_type_a;
+ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
 
 /*****************************************************************************
  *
@@ -287,12 +299,14 @@ ACPI_EXTERN u8                                  acpi_gbl_sleep_type_b;
  *
  ****************************************************************************/
 
-extern      struct acpi_fixed_event_info        acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
-ACPI_EXTERN struct acpi_fixed_event_handler     acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
-ACPI_EXTERN struct acpi_gpe_xrupt_info         *acpi_gbl_gpe_xrupt_list_head;
-ACPI_EXTERN struct acpi_gpe_block_info         *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
-ACPI_EXTERN acpi_handle                         acpi_gbl_gpe_lock;
-
+extern struct acpi_fixed_event_info
+    acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN struct acpi_fixed_event_handler
+    acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
+ACPI_EXTERN struct acpi_gpe_block_info
+    *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
+ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock;
 
 /*****************************************************************************
  *
@@ -300,58 +314,55 @@ ACPI_EXTERN acpi_handle                         acpi_gbl_gpe_lock;
  *
  ****************************************************************************/
 
-ACPI_EXTERN u8                                  acpi_gbl_db_output_flags;
+ACPI_EXTERN u8 acpi_gbl_db_output_flags;
 
 #ifdef ACPI_DISASSEMBLER
 
-ACPI_EXTERN u8                                  acpi_gbl_db_opt_disasm;
-ACPI_EXTERN u8                                  acpi_gbl_db_opt_verbose;
+ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;
+ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;
 #endif
 
-
 #ifdef ACPI_DEBUGGER
 
-extern      u8                                  acpi_gbl_method_executing;
-extern      u8                                  acpi_gbl_abort_method;
-extern      u8                                  acpi_gbl_db_terminate_threads;
-
-ACPI_EXTERN int                                 optind;
-ACPI_EXTERN char                               *optarg;
-
-ACPI_EXTERN u8                                  acpi_gbl_db_opt_tables;
-ACPI_EXTERN u8                                  acpi_gbl_db_opt_stats;
-ACPI_EXTERN u8                                  acpi_gbl_db_opt_ini_methods;
-
-
-ACPI_EXTERN char                               *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
-ACPI_EXTERN char                                acpi_gbl_db_line_buf[80];
-ACPI_EXTERN char                                acpi_gbl_db_parsed_buf[80];
-ACPI_EXTERN char                                acpi_gbl_db_scope_buf[40];
-ACPI_EXTERN char                                acpi_gbl_db_debug_filename[40];
-ACPI_EXTERN u8                                  acpi_gbl_db_output_to_file;
-ACPI_EXTERN char                               *acpi_gbl_db_buffer;
-ACPI_EXTERN char                               *acpi_gbl_db_filename;
-ACPI_EXTERN u32                                 acpi_gbl_db_debug_level;
-ACPI_EXTERN u32                                 acpi_gbl_db_console_debug_level;
-ACPI_EXTERN struct acpi_table_header           *acpi_gbl_db_table_ptr;
-ACPI_EXTERN struct acpi_namespace_node         *acpi_gbl_db_scope_node;
+extern u8 acpi_gbl_method_executing;
+extern u8 acpi_gbl_abort_method;
+extern u8 acpi_gbl_db_terminate_threads;
+
+ACPI_EXTERN int optind;
+ACPI_EXTERN char *optarg;
+
+ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
+ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
+ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
+
+ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN char acpi_gbl_db_line_buf[80];
+ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];
+ACPI_EXTERN char acpi_gbl_db_scope_buf[40];
+ACPI_EXTERN char acpi_gbl_db_debug_filename[40];
+ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
+ACPI_EXTERN char *acpi_gbl_db_buffer;
+ACPI_EXTERN char *acpi_gbl_db_filename;
+ACPI_EXTERN u32 acpi_gbl_db_debug_level;
+ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
+ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr;
+ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
 
 /*
  * Statistic globals
  */
-ACPI_EXTERN u16                                 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX+1];
-ACPI_EXTERN u16                                 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX+1];
-ACPI_EXTERN u16                                 acpi_gbl_obj_type_count_misc;
-ACPI_EXTERN u16                                 acpi_gbl_node_type_count_misc;
-ACPI_EXTERN u32                                 acpi_gbl_num_nodes;
-ACPI_EXTERN u32                                 acpi_gbl_num_objects;
-
+ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
+ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1];
+ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;
+ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;
+ACPI_EXTERN u32 acpi_gbl_num_nodes;
+ACPI_EXTERN u32 acpi_gbl_num_objects;
 
-ACPI_EXTERN u32                                 acpi_gbl_size_of_parse_tree;
-ACPI_EXTERN u32                                 acpi_gbl_size_of_method_trees;
-ACPI_EXTERN u32                                 acpi_gbl_size_of_node_entries;
-ACPI_EXTERN u32                                 acpi_gbl_size_of_acpi_objects;
+ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;
+ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;
+ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;
+ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;
 
-#endif /* ACPI_DEBUGGER */
+#endif                         /* ACPI_DEBUGGER */
 
-#endif /* __ACGLOBAL_H__ */
+#endif                         /* __ACGLOBAL_H__ */
index 9d63641b8e7dc4acf02f01286b19448440f17669..3644d7248e7e7fd54bf3716b9b2b04736ab5f32e 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __ACHWARE_H__
 #define __ACHWARE_H__
 
-
 /* PM Timer ticks per second (HZ) */
 
 #define PM_TIMER_FREQUENCY  3579545
 #define ACPI_SST_SLEEPING       3
 #define ACPI_SST_SLEEP_CONTEXT  4
 
-
 /* Prototypes */
 
-
 /*
  * hwacpi - high level functions
  */
-acpi_status
-acpi_hw_initialize (
-       void);
+acpi_status acpi_hw_initialize(void);
 
-acpi_status
-acpi_hw_set_mode (
-       u32                             mode);
-
-u32
-acpi_hw_get_mode (
-       void);
+acpi_status acpi_hw_set_mode(u32 mode);
 
+u32 acpi_hw_get_mode(void);
 
 /*
  * hwregs - ACPI Register I/O
  */
-struct acpi_bit_register_info *
-acpi_hw_get_bit_register_info (
-       u32                             register_id);
-
-acpi_status
-acpi_hw_register_read (
-       u8                              use_lock,
-       u32                             register_id,
-       u32                             *return_value);
+struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
 
 acpi_status
-acpi_hw_register_write (
-       u8                              use_lock,
-       u32                             register_id,
-       u32                             value);
+acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value);
 
-acpi_status
-acpi_hw_low_level_read (
-       u32                             width,
-       u32                             *value,
-       struct acpi_generic_address     *reg);
+acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value);
 
 acpi_status
-acpi_hw_low_level_write (
-       u32                             width,
-       u32                             value,
-       struct acpi_generic_address     *reg);
+acpi_hw_low_level_read(u32 width,
+                      u32 * value, struct acpi_generic_address *reg);
 
 acpi_status
-acpi_hw_clear_acpi_status (
-       u32                             flags);
+acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
 
+acpi_status acpi_hw_clear_acpi_status(u32 flags);
 
 /*
  * hwgpe - GPE support
  */
 acpi_status
-acpi_hw_write_gpe_enable_reg (
-       struct acpi_gpe_event_info      *gpe_event_info);
+acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status
-acpi_hw_disable_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
+acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                         struct acpi_gpe_block_info *gpe_block);
 
-acpi_status
-acpi_hw_clear_gpe (
-       struct acpi_gpe_event_info      *gpe_event_info);
+acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
 acpi_status
-acpi_hw_clear_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
+acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                       struct acpi_gpe_block_info *gpe_block);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_hw_get_gpe_status (
-       struct acpi_gpe_event_info      *gpe_event_info,
-       acpi_event_status               *event_status);
-#endif /* ACPI_FUTURE_USAGE */
+acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
+                      acpi_event_status * event_status);
+#endif                         /* ACPI_FUTURE_USAGE */
 
-acpi_status
-acpi_hw_disable_all_gpes (
-       u32                             flags);
+acpi_status acpi_hw_disable_all_gpes(void);
 
-acpi_status
-acpi_hw_enable_all_runtime_gpes (
-       u32                             flags);
+acpi_status acpi_hw_enable_all_runtime_gpes(void);
 
-acpi_status
-acpi_hw_enable_all_wakeup_gpes (
-       u32                             flags);
+acpi_status acpi_hw_enable_all_wakeup_gpes(void);
 
 acpi_status
-acpi_hw_enable_runtime_gpe_block (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
-
+acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
+                                struct acpi_gpe_block_info *gpe_block);
 
 #ifdef ACPI_FUTURE_USAGE
 /*
  * hwtimer - ACPI Timer prototypes
  */
-acpi_status
-acpi_get_timer_resolution (
-       u32                             *resolution);
+acpi_status acpi_get_timer_resolution(u32 * resolution);
 
-acpi_status
-acpi_get_timer (
-       u32                             *ticks);
+acpi_status acpi_get_timer(u32 * ticks);
 
 acpi_status
-acpi_get_timer_duration (
-       u32                             start_ticks,
-       u32                             end_ticks,
-       u32                             *time_elapsed);
-#endif /* ACPI_FUTURE_USAGE */
-
+acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed);
+#endif                         /* ACPI_FUTURE_USAGE */
 
-#endif /* __ACHWARE_H__ */
+#endif                         /* __ACHWARE_H__ */
index 5c7172477a0f5d356ef9ce86bbf991e4c391b392..2c9c1a1d1b7f05c742fb51758e48bbee7f31571a 100644 (file)
 #ifndef __ACINTERP_H__
 #define __ACINTERP_H__
 
-
 #define ACPI_WALK_OPERANDS       (&(walk_state->operands [walk_state->num_operands -1]))
 
-
 /*
  * exconvrt - object conversion
  */
 acpi_status
-acpi_ex_convert_to_integer (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc,
-       u32                             flags);
+acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
+                          union acpi_operand_object **result_desc, u32 flags);
 
 acpi_status
-acpi_ex_convert_to_buffer (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc);
+acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
+                         union acpi_operand_object **result_desc);
 
 acpi_status
-acpi_ex_convert_to_string (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc,
-       u32                             type);
+acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
+                         union acpi_operand_object **result_desc, u32 type);
 
 /* Types for ->String conversion */
 
@@ -76,587 +69,412 @@ acpi_ex_convert_to_string (
 #define ACPI_EXPLICIT_CONVERT_DECIMAL   0x00000003
 
 acpi_status
-acpi_ex_convert_to_target_type (
-       acpi_object_type                destination_type,
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       **result_desc,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_convert_to_target_type(acpi_object_type destination_type,
+                              union acpi_operand_object *source_desc,
+                              union acpi_operand_object **result_desc,
+                              struct acpi_walk_state *walk_state);
 
 /*
  * exfield - ACPI AML (p-code) execution - field manipulation
  */
 acpi_status
-acpi_ex_common_buffer_setup (
-       union acpi_operand_object       *obj_desc,
-       u32                             buffer_length,
-       u32                             *datum_count);
+acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
+                           u32 buffer_length, u32 * datum_count);
 
 acpi_status
-acpi_ex_write_with_update_rule (
-       union acpi_operand_object       *obj_desc,
-       acpi_integer                    mask,
-       acpi_integer                    field_value,
-       u32                             field_datum_byte_offset);
+acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
+                              acpi_integer mask,
+                              acpi_integer field_value,
+                              u32 field_datum_byte_offset);
 
 void
-acpi_ex_get_buffer_datum(
-       acpi_integer                    *datum,
-       void                            *buffer,
-       u32                             buffer_length,
-       u32                             byte_granularity,
-       u32                             buffer_offset);
+acpi_ex_get_buffer_datum(acpi_integer * datum,
+                        void *buffer,
+                        u32 buffer_length,
+                        u32 byte_granularity, u32 buffer_offset);
 
 void
-acpi_ex_set_buffer_datum (
-       acpi_integer                    merged_datum,
-       void                            *buffer,
-       u32                             buffer_length,
-       u32                             byte_granularity,
-       u32                             buffer_offset);
+acpi_ex_set_buffer_datum(acpi_integer merged_datum,
+                        void *buffer,
+                        u32 buffer_length,
+                        u32 byte_granularity, u32 buffer_offset);
 
 acpi_status
-acpi_ex_read_data_from_field (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **ret_buffer_desc);
+acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
+                            union acpi_operand_object *obj_desc,
+                            union acpi_operand_object **ret_buffer_desc);
 
 acpi_status
-acpi_ex_write_data_to_field (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **result_desc);
-
+acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
+                           union acpi_operand_object *obj_desc,
+                           union acpi_operand_object **result_desc);
 
 /*
  * exfldio - low level field I/O
  */
 acpi_status
-acpi_ex_extract_from_field (
-       union acpi_operand_object       *obj_desc,
-       void                            *buffer,
-       u32                             buffer_length);
+acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
+                          void *buffer, u32 buffer_length);
 
 acpi_status
-acpi_ex_insert_into_field (
-       union acpi_operand_object       *obj_desc,
-       void                            *buffer,
-       u32                             buffer_length);
+acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
+                         void *buffer, u32 buffer_length);
 
 acpi_status
-acpi_ex_access_region (
-       union acpi_operand_object       *obj_desc,
-       u32                             field_datum_byte_offset,
-       acpi_integer                    *value,
-       u32                             read_write);
-
+acpi_ex_access_region(union acpi_operand_object *obj_desc,
+                     u32 field_datum_byte_offset,
+                     acpi_integer * value, u32 read_write);
 
 /*
  * exmisc - misc support routines
  */
 acpi_status
-acpi_ex_get_object_reference (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       **return_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
+                            union acpi_operand_object **return_desc,
+                            struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_concat_template (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *obj_desc2,
-       union acpi_operand_object       **actual_return_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_concat_template(union acpi_operand_object *obj_desc,
+                       union acpi_operand_object *obj_desc2,
+                       union acpi_operand_object **actual_return_desc,
+                       struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_do_concatenate (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *obj_desc2,
-       union acpi_operand_object       **actual_return_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
+                      union acpi_operand_object *obj_desc2,
+                      union acpi_operand_object **actual_return_desc,
+                      struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_do_logical_numeric_op (
-       u16                             opcode,
-       acpi_integer                    integer0,
-       acpi_integer                    integer1,
-       u8                              *logical_result);
+acpi_ex_do_logical_numeric_op(u16 opcode,
+                             acpi_integer integer0,
+                             acpi_integer integer1, u8 * logical_result);
 
 acpi_status
-acpi_ex_do_logical_op (
-       u16                             opcode,
-       union acpi_operand_object       *operand0,
-       union acpi_operand_object       *operand1,
-       u8                              *logical_result);
+acpi_ex_do_logical_op(u16 opcode,
+                     union acpi_operand_object *operand0,
+                     union acpi_operand_object *operand1, u8 * logical_result);
 
 acpi_integer
-acpi_ex_do_math_op (
-       u16                             opcode,
-       acpi_integer                    operand0,
-       acpi_integer                    operand1);
+acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1);
 
-acpi_status
-acpi_ex_create_mutex (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_create_processor (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_create_power_resource (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_create_region (
-       u8                              *aml_start,
-       u32                             aml_length,
-       u8                              region_space,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_create_region(u8 * aml_start,
+                     u32 aml_length,
+                     u8 region_space, struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_create_table_region (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_create_event (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_create_alias (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_create_method (
-       u8                              *aml_start,
-       u32                             aml_length,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_create_method(u8 * aml_start,
+                     u32 aml_length, struct acpi_walk_state *walk_state);
 
 /*
  * exconfig - dynamic table load/unload
  */
 acpi_status
-acpi_ex_load_op (
-       union acpi_operand_object       *obj_desc,
-       union acpi_operand_object       *target,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_load_op(union acpi_operand_object *obj_desc,
+               union acpi_operand_object *target,
+               struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_load_table_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       **return_desc);
-
-acpi_status
-acpi_ex_unload_table (
-       union acpi_operand_object       *ddb_handle);
+acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
+                     union acpi_operand_object **return_desc);
 
+acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
 
 /*
  * exmutex - mutex support
  */
 acpi_status
-acpi_ex_acquire_mutex (
-       union acpi_operand_object       *time_desc,
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
+                     union acpi_operand_object *obj_desc,
+                     struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_release_mutex (
-       union acpi_operand_object       *obj_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
+                     struct acpi_walk_state *walk_state);
 
-void
-acpi_ex_release_all_mutexes (
-       struct acpi_thread_state        *thread);
-
-void
-acpi_ex_unlink_mutex (
-       union acpi_operand_object       *obj_desc);
+void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
 
+void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
 
 /*
  * exprep - ACPI AML execution - prep utilities
  */
 acpi_status
-acpi_ex_prep_common_field_object (
-       union acpi_operand_object       *obj_desc,
-       u8                              field_flags,
-       u8                              field_attribute,
-       u32                             field_bit_position,
-       u32                             field_bit_length);
-
-acpi_status
-acpi_ex_prep_field_value (
-       struct acpi_create_field_info   *info);
+acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
+                                u8 field_flags,
+                                u8 field_attribute,
+                                u32 field_bit_position, u32 field_bit_length);
 
+acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
 
 /*
  * exsystem - Interface to OS services
  */
 acpi_status
-acpi_ex_system_do_notify_op (
-       union acpi_operand_object       *value,
-       union acpi_operand_object       *obj_desc);
+acpi_ex_system_do_notify_op(union acpi_operand_object *value,
+                           union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ex_system_do_suspend(
-       acpi_integer                    time);
+acpi_status acpi_ex_system_do_suspend(acpi_integer time);
 
-acpi_status
-acpi_ex_system_do_stall (
-       u32                             time);
+acpi_status acpi_ex_system_do_stall(u32 time);
 
 acpi_status
-acpi_ex_system_acquire_mutex(
-       union acpi_operand_object       *time,
-       union acpi_operand_object       *obj_desc);
+acpi_ex_system_acquire_mutex(union acpi_operand_object *time,
+                            union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ex_system_release_mutex(
-       union acpi_operand_object       *obj_desc);
+acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ex_system_signal_event(
-       union acpi_operand_object       *obj_desc);
+acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
 
 acpi_status
-acpi_ex_system_wait_event(
-       union acpi_operand_object       *time,
-       union acpi_operand_object       *obj_desc);
+acpi_ex_system_wait_event(union acpi_operand_object *time,
+                         union acpi_operand_object *obj_desc);
 
-acpi_status
-acpi_ex_system_reset_event(
-       union acpi_operand_object       *obj_desc);
-
-acpi_status
-acpi_ex_system_wait_semaphore (
-       acpi_handle                     semaphore,
-       u16                             timeout);
+acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
 
+acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout);
 
 /*
  * exoparg1 - ACPI AML execution, 1 operand
  */
-acpi_status
-acpi_ex_opcode_0A_0T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_1A_0T_0R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_1A_0T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_1A_1T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_1A_1T_0R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
 
 /*
  * exoparg2 - ACPI AML execution, 2 operands
  */
-acpi_status
-acpi_ex_opcode_2A_0T_0R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_2A_0T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
 
-acpi_status
-acpi_ex_opcode_2A_1T_1R (
-       struct acpi_walk_state          *walk_state);
-
-acpi_status
-acpi_ex_opcode_2A_2T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
 
+acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
 
 /*
  * exoparg3 - ACPI AML execution, 3 operands
  */
-acpi_status
-acpi_ex_opcode_3A_0T_0R (
-       struct acpi_walk_state          *walk_state);
-
-acpi_status
-acpi_ex_opcode_3A_1T_1R (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
 
+acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
 
 /*
  * exoparg6 - ACPI AML execution, 6 operands
  */
-acpi_status
-acpi_ex_opcode_6A_0T_1R (
-       struct acpi_walk_state          *walk_state);
-
+acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
 
 /*
  * exresolv - Object resolution and get value functions
  */
 acpi_status
-acpi_ex_resolve_to_value (
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
+                        struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_resolve_multiple (
-       struct acpi_walk_state          *walk_state,
-       union acpi_operand_object       *operand,
-       acpi_object_type                *return_type,
-       union acpi_operand_object       **return_desc);
-
+acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
+                        union acpi_operand_object *operand,
+                        acpi_object_type * return_type,
+                        union acpi_operand_object **return_desc);
 
 /*
  * exresnte - resolve namespace node
  */
 acpi_status
-acpi_ex_resolve_node_to_value (
-       struct acpi_namespace_node      **stack_ptr,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
+                             struct acpi_walk_state *walk_state);
 
 /*
  * exresop - resolve operand to value
  */
 acpi_status
-acpi_ex_resolve_operands (
-       u16                             opcode,
-       union acpi_operand_object       **stack_ptr,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_resolve_operands(u16 opcode,
+                        union acpi_operand_object **stack_ptr,
+                        struct acpi_walk_state *walk_state);
 
 /*
  * exdump - Interpreter debug output routines
  */
-void
-acpi_ex_dump_operand (
-       union acpi_operand_object       *obj_desc,
-       u32                             depth);
+void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
 
 void
-acpi_ex_dump_operands (
-       union acpi_operand_object       **operands,
-       acpi_interpreter_mode           interpreter_mode,
-       char                            *ident,
-       u32                             num_levels,
-       char                            *note,
-       char                            *module_name,
-       u32                             line_number);
+acpi_ex_dump_operands(union acpi_operand_object **operands,
+                     acpi_interpreter_mode interpreter_mode,
+                     char *ident,
+                     u32 num_levels,
+                     char *note, char *module_name, u32 line_number);
 
 #ifdef ACPI_FUTURE_USAGE
 void
-acpi_ex_dump_object_descriptor (
-       union acpi_operand_object       *object,
-       u32                             flags);
-
-void
-acpi_ex_dump_node (
-       struct acpi_namespace_node      *node,
-       u32                             flags);
-#endif /* ACPI_FUTURE_USAGE */
+acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
 
+void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*
  * exnames - AML namestring support
  */
 acpi_status
-acpi_ex_get_name_string (
-       acpi_object_type                data_type,
-       u8                              *in_aml_address,
-       char                            **out_name_string,
-       u32                             *out_name_length);
-
+acpi_ex_get_name_string(acpi_object_type data_type,
+                       u8 * in_aml_address,
+                       char **out_name_string, u32 * out_name_length);
 
 /*
  * exstore - Object store support
  */
 acpi_status
-acpi_ex_store (
-       union acpi_operand_object       *val_desc,
-       union acpi_operand_object       *dest_desc,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_store(union acpi_operand_object *val_desc,
+             union acpi_operand_object *dest_desc,
+             struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_store_object_to_node (
-       union acpi_operand_object       *source_desc,
-       struct acpi_namespace_node      *node,
-       struct acpi_walk_state          *walk_state,
-       u8                              implicit_conversion);
+acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
+                            struct acpi_namespace_node *node,
+                            struct acpi_walk_state *walk_state,
+                            u8 implicit_conversion);
 
 #define ACPI_IMPLICIT_CONVERSION        TRUE
 #define ACPI_NO_IMPLICIT_CONVERSION     FALSE
 
-
 /*
  * exstoren - resolve/store object
  */
 acpi_status
-acpi_ex_resolve_object (
-       union acpi_operand_object       **source_desc_ptr,
-       acpi_object_type                target_type,
-       struct acpi_walk_state          *walk_state);
+acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
+                      acpi_object_type target_type,
+                      struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ex_store_object_to_object (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *dest_desc,
-       union acpi_operand_object       **new_desc,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *dest_desc,
+                              union acpi_operand_object **new_desc,
+                              struct acpi_walk_state *walk_state);
 
 /*
  * exstorob - store object - buffer/string
  */
 acpi_status
-acpi_ex_store_buffer_to_buffer (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc);
+acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *target_desc);
 
 acpi_status
-acpi_ex_store_string_to_string (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc);
-
+acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
+                              union acpi_operand_object *target_desc);
 
 /*
  * excopy - object copy
  */
 acpi_status
-acpi_ex_copy_integer_to_index_field (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc);
+acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
+                                   union acpi_operand_object *target_desc);
 
 acpi_status
-acpi_ex_copy_integer_to_bank_field (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc);
+acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
+                                  union acpi_operand_object *target_desc);
 
 acpi_status
-acpi_ex_copy_data_to_named_field (
-       union acpi_operand_object       *source_desc,
-       struct acpi_namespace_node      *node);
+acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
+                                struct acpi_namespace_node *node);
 
 acpi_status
-acpi_ex_copy_integer_to_buffer_field (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       *target_desc);
-
+acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
+                                    union acpi_operand_object *target_desc);
 
 /*
  * exutils - interpreter/scanner utilities
  */
-acpi_status
-acpi_ex_enter_interpreter (
-       void);
+acpi_status acpi_ex_enter_interpreter(void);
 
-void
-acpi_ex_exit_interpreter (
-       void);
+void acpi_ex_exit_interpreter(void);
 
-void
-acpi_ex_truncate_for32bit_table (
-       union acpi_operand_object       *obj_desc);
+void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
 
-u8
-acpi_ex_acquire_global_lock (
-       u32                             rule);
+u8 acpi_ex_acquire_global_lock(u32 rule);
 
-void
-acpi_ex_release_global_lock (
-       u8                              locked);
+void acpi_ex_release_global_lock(u8 locked);
 
-void
-acpi_ex_eisa_id_to_string (
-       u32                             numeric_id,
-       char                            *out_string);
-
-void
-acpi_ex_unsigned_integer_to_string (
-       acpi_integer                    value,
-       char                            *out_string);
+void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);
 
+void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);
 
 /*
  * exregion - default op_region handlers
  */
 acpi_status
-acpi_ex_system_memory_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_system_io_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_pci_config_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_cmos_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_pci_bar_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_embedded_controller_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-acpi_status
-acpi_ex_sm_bus_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-
-acpi_status
-acpi_ex_data_table_space_handler (
-       u32                             function,
-       acpi_physical_address           address,
-       u32                             bit_width,
-       acpi_integer                    *value,
-       void                            *handler_context,
-       void                            *region_context);
-
-#endif /* __INTERP_H__ */
+acpi_ex_system_memory_space_handler(u32 function,
+                                   acpi_physical_address address,
+                                   u32 bit_width,
+                                   acpi_integer * value,
+                                   void *handler_context,
+                                   void *region_context);
+
+acpi_status
+acpi_ex_system_io_space_handler(u32 function,
+                               acpi_physical_address address,
+                               u32 bit_width,
+                               acpi_integer * value,
+                               void *handler_context, void *region_context);
+
+acpi_status
+acpi_ex_pci_config_space_handler(u32 function,
+                                acpi_physical_address address,
+                                u32 bit_width,
+                                acpi_integer * value,
+                                void *handler_context, void *region_context);
+
+acpi_status
+acpi_ex_cmos_space_handler(u32 function,
+                          acpi_physical_address address,
+                          u32 bit_width,
+                          acpi_integer * value,
+                          void *handler_context, void *region_context);
+
+acpi_status
+acpi_ex_pci_bar_space_handler(u32 function,
+                             acpi_physical_address address,
+                             u32 bit_width,
+                             acpi_integer * value,
+                             void *handler_context, void *region_context);
+
+acpi_status
+acpi_ex_embedded_controller_space_handler(u32 function,
+                                         acpi_physical_address address,
+                                         u32 bit_width,
+                                         acpi_integer * value,
+                                         void *handler_context,
+                                         void *region_context);
+
+acpi_status
+acpi_ex_sm_bus_space_handler(u32 function,
+                            acpi_physical_address address,
+                            u32 bit_width,
+                            acpi_integer * value,
+                            void *handler_context, void *region_context);
+
+acpi_status
+acpi_ex_data_table_space_handler(u32 function,
+                                acpi_physical_address address,
+                                u32 bit_width,
+                                acpi_integer * value,
+                                void *handler_context, void *region_context);
+
+#endif                         /* __INTERP_H__ */
index 030e641115cb6c663568d65a90f09eb6938bbe36..9fba0fddda909f408509de845f50955aa4c4698f 100644 (file)
 #ifndef __ACLOCAL_H__
 #define __ACLOCAL_H__
 
+#define ACPI_WAIT_FOREVER               0xFFFF /* u16, as per ACPI spec */
 
-#define ACPI_WAIT_FOREVER               0xFFFF  /* u16, as per ACPI spec */
-
-typedef void *                                  acpi_mutex;
-typedef u32                                     acpi_mutex_handle;
-
+typedef void *acpi_mutex;
+typedef u32 acpi_mutex_handle;
 
 /* Total number of aml opcodes defined */
 
 #define AML_NUM_OPCODES                 0x7F
 
+/* Forward declarations */
+
+struct acpi_walk_state;
+struct acpi_obj_mutex;
+union acpi_parse_object;
 
 /*****************************************************************************
  *
@@ -62,7 +65,6 @@ typedef u32                                     acpi_mutex_handle;
  *
  ****************************************************************************/
 
-
 /*
  * Predefined handles for the mutex objects used within the subsystem
  * All mutex objects are automatically created by acpi_ut_mutex_initialize.
@@ -89,14 +91,12 @@ typedef u32                                     acpi_mutex_handle;
 #define MAX_MUTEX                       12
 #define NUM_MUTEX                       MAX_MUTEX+1
 
-
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 #ifdef DEFINE_ACPI_GLOBALS
 
 /* Names for the mutexes used in the subsystem */
 
-static char                         *acpi_gbl_mutex_names[] =
-{
+static char *acpi_gbl_mutex_names[] = {
        "ACPI_MTX_Execute",
        "ACPI_MTX_Interpreter",
        "ACPI_MTX_Parser",
@@ -115,34 +115,28 @@ static char                         *acpi_gbl_mutex_names[] =
 #endif
 #endif
 
+/* Owner IDs are used to track namespace nodes for selective deletion */
 
-/* Table for the global mutexes */
+typedef u8 acpi_owner_id;
+#define ACPI_OWNER_ID_MAX               0xFF
 
-struct acpi_mutex_info
-{
-       acpi_mutex                          mutex;
-       u32                                 use_count;
-       u32                                 owner_id;
-};
+/* This Thread ID means that the mutex is not in use (unlocked) */
 
-/* This owner ID means that the mutex is not in use (unlocked) */
+#define ACPI_MUTEX_NOT_ACQUIRED         (u32) -1
 
-#define ACPI_MUTEX_NOT_ACQUIRED         (u32) (-1)
+/* Table for the global mutexes */
 
+struct acpi_mutex_info {
+       acpi_mutex mutex;
+       u32 use_count;
+       u32 thread_id;
+};
 
 /* Lock flag parameter for various interfaces */
 
 #define ACPI_MTX_DO_NOT_LOCK            0
 #define ACPI_MTX_LOCK                   1
 
-
-typedef u16                                     acpi_owner_id;
-#define ACPI_OWNER_TYPE_TABLE           0x0
-#define ACPI_OWNER_TYPE_METHOD          0x1
-#define ACPI_FIRST_METHOD_ID            0x0001
-#define ACPI_FIRST_TABLE_ID             0xF000
-
-
 /* Field access granularities */
 
 #define ACPI_FIELD_BYTE_GRANULARITY     1
@@ -150,7 +144,6 @@ typedef u16                                     acpi_owner_id;
 #define ACPI_FIELD_DWORD_GRANULARITY    4
 #define ACPI_FIELD_QWORD_GRANULARITY    8
 
-
 /*****************************************************************************
  *
  * Namespace typedefs and structs
@@ -159,15 +152,12 @@ typedef u16                                     acpi_owner_id;
 
 /* Operational modes of the AML interpreter/scanner */
 
-typedef enum
-{
-       ACPI_IMODE_LOAD_PASS1               = 0x01,
-       ACPI_IMODE_LOAD_PASS2               = 0x02,
-       ACPI_IMODE_EXECUTE                  = 0x0E
-
+typedef enum {
+       ACPI_IMODE_LOAD_PASS1 = 0x01,
+       ACPI_IMODE_LOAD_PASS2 = 0x02,
+       ACPI_IMODE_EXECUTE = 0x0E
 } acpi_interpreter_mode;
 
-
 /*
  * The Node describes a named object that appears in the AML
  * An acpi_node is used to store Nodes.
@@ -175,34 +165,37 @@ typedef enum
  * data_type is used to differentiate between internal descriptors, and MUST
  * be the first byte in this structure.
  */
-union acpi_name_union
-{
-       u32                                 integer;
-       char                                ascii[4];
-};
-
-struct acpi_namespace_node
-{
-       u8                                  descriptor;     /* Used to differentiate object descriptor types */
-       u8                                  type;           /* Type associated with this name */
-       u16                                 owner_id;
-       union acpi_name_union               name;           /* ACPI Name, always 4 chars per ACPI spec */
-       union acpi_operand_object           *object;        /* Pointer to attached ACPI object (optional) */
-       struct acpi_namespace_node          *child;         /* First child */
-       struct acpi_namespace_node          *peer;          /* Next peer*/
-       u16                                 reference_count; /* Current count of references and children */
-       u8                                  flags;
+union acpi_name_union {
+       u32 integer;
+       char ascii[4];
+};
+
+struct acpi_namespace_node {
+       u8 descriptor;          /* Used to differentiate object descriptor types */
+       u8 type;                /* Type associated with this name */
+       u16 reference_count;    /* Current count of references and children */
+       union acpi_name_union name;     /* ACPI Name, always 4 chars per ACPI spec */
+       union acpi_operand_object *object;      /* Pointer to attached ACPI object (optional) */
+       struct acpi_namespace_node *child;      /* First child */
+       struct acpi_namespace_node *peer;       /* Next peer */
+       u8 owner_id;            /* Who created this node */
+       u8 flags;
+
+       /* Fields used by the ASL compiler only */
+
+#ifdef ACPI_ASL_COMPILER
+       u32 value;
+       union acpi_parse_object *op;
+#endif
 };
 
-
 #define ACPI_ENTRY_NOT_FOUND            NULL
 
-
 /* Node flags */
 
 #define ANOBJ_RESERVED                  0x01
 #define ANOBJ_END_OF_PEER_LIST          0x02
-#define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
+#define ANOBJ_DATA_WIDTH_32             0x04   /* Parent table is 64-bits */
 #define ANOBJ_METHOD_ARG                0x08
 #define ANOBJ_METHOD_LOCAL              0x10
 #define ANOBJ_METHOD_NO_RETVAL          0x20
@@ -212,91 +205,77 @@ struct acpi_namespace_node
 /*
  * ACPI Table Descriptor.  One per ACPI table
  */
-struct acpi_table_desc
-{
-       struct acpi_table_desc          *prev;
-       struct acpi_table_desc          *next;
-       struct acpi_table_desc          *installed_desc;
-       struct acpi_table_header        *pointer;
-       u8                              *aml_start;
-       u64                             physical_address;
-       u32                             aml_length;
-       acpi_size                       length;
-       acpi_owner_id                   table_id;
-       u8                              type;
-       u8                              allocation;
-       u8                              loaded_into_namespace;
+struct acpi_table_desc {
+       struct acpi_table_desc *prev;
+       struct acpi_table_desc *next;
+       struct acpi_table_desc *installed_desc;
+       struct acpi_table_header *pointer;
+       u8 *aml_start;
+       u64 physical_address;
+       u32 aml_length;
+       acpi_size length;
+       acpi_owner_id owner_id;
+       u8 type;
+       u8 allocation;
+       u8 loaded_into_namespace;
 };
 
-struct acpi_table_list
-{
-       struct acpi_table_desc          *next;
-       u32                             count;
+struct acpi_table_list {
+       struct acpi_table_desc *next;
+       u32 count;
 };
 
-
-struct acpi_find_context
-{
-       char                            *search_for;
-       acpi_handle                     *list;
-       u32                             *count;
+struct acpi_find_context {
+       char *search_for;
+       acpi_handle *list;
+       u32 *count;
 };
 
-
-struct acpi_ns_search_data
-{
-       struct acpi_namespace_node      *node;
+struct acpi_ns_search_data {
+       struct acpi_namespace_node *node;
 };
 
-
 /*
  * Predefined Namespace items
  */
-struct acpi_predefined_names
-{
-       char                            *name;
-       u8                              type;
-       char                            *val;
+struct acpi_predefined_names {
+       char *name;
+       u8 type;
+       char *val;
 };
 
-
 /* Object types used during package copies */
 
-
 #define ACPI_COPY_TYPE_SIMPLE           0
 #define ACPI_COPY_TYPE_PACKAGE          1
 
 /* Info structure used to convert external<->internal namestrings */
 
-struct acpi_namestring_info
-{
-       char                            *external_name;
-       char                            *next_external_char;
-       char                            *internal_name;
-       u32                             length;
-       u32                             num_segments;
-       u32                             num_carats;
-       u8                              fully_qualified;
+struct acpi_namestring_info {
+       char *external_name;
+       char *next_external_char;
+       char *internal_name;
+       u32 length;
+       u32 num_segments;
+       u32 num_carats;
+       u8 fully_qualified;
 };
 
-
 /* Field creation info */
 
-struct acpi_create_field_info
-{
-       struct acpi_namespace_node      *region_node;
-       struct acpi_namespace_node      *field_node;
-       struct acpi_namespace_node      *register_node;
-       struct acpi_namespace_node      *data_register_node;
-       u32                             bank_value;
-       u32                             field_bit_position;
-       u32                             field_bit_length;
-       u8                              field_flags;
-       u8                              attribute;
-       u8                              field_type;
+struct acpi_create_field_info {
+       struct acpi_namespace_node *region_node;
+       struct acpi_namespace_node *field_node;
+       struct acpi_namespace_node *register_node;
+       struct acpi_namespace_node *data_register_node;
+       u32 bank_value;
+       u32 field_bit_position;
+       u32 field_bit_length;
+       u8 field_flags;
+       u8 attribute;
+       u8 field_type;
 };
 
-
 /*****************************************************************************
  *
  * Event typedefs and structs
@@ -305,108 +284,95 @@ struct acpi_create_field_info
 
 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
 
-struct acpi_handler_info
-{
-       acpi_event_handler                      address;        /* Address of handler, if any */
-       void                                    *context;       /* Context to be passed to handler */
-       struct acpi_namespace_node              *method_node;   /* Method node for this GPE level (saved) */
+struct acpi_handler_info {
+       acpi_event_handler address;     /* Address of handler, if any */
+       void *context;          /* Context to be passed to handler */
+       struct acpi_namespace_node *method_node;        /* Method node for this GPE level (saved) */
 };
 
-union acpi_gpe_dispatch_info
-{
-       struct acpi_namespace_node              *method_node;   /* Method node for this GPE level */
-       struct acpi_handler_info                *handler;
+union acpi_gpe_dispatch_info {
+       struct acpi_namespace_node *method_node;        /* Method node for this GPE level */
+       struct acpi_handler_info *handler;
 };
 
 /*
  * Information about a GPE, one per each GPE in an array.
  * NOTE: Important to keep this struct as small as possible.
  */
-struct acpi_gpe_event_info
-{
-       union acpi_gpe_dispatch_info    dispatch;       /* Either Method or Handler */
-       struct acpi_gpe_register_info           *register_info; /* Backpointer to register info */
-       u8                                      flags;          /* Misc info about this GPE */
-       u8                                      register_bit;   /* This GPE bit within the register */
+struct acpi_gpe_event_info {
+       union acpi_gpe_dispatch_info dispatch;  /* Either Method or Handler */
+       struct acpi_gpe_register_info *register_info;   /* Backpointer to register info */
+       u8 flags;               /* Misc info about this GPE */
+       u8 register_bit;        /* This GPE bit within the register */
 };
 
 /* Information about a GPE register pair, one per each status/enable pair in an array */
 
-struct acpi_gpe_register_info
-{
-       struct acpi_generic_address             status_address; /* Address of status reg */
-       struct acpi_generic_address             enable_address; /* Address of enable reg */
-       u8                                      enable_for_wake; /* GPEs to keep enabled when sleeping */
-       u8                                      enable_for_run; /* GPEs to keep enabled when running */
-       u8                                      base_gpe_number; /* Base GPE number for this register */
+struct acpi_gpe_register_info {
+       struct acpi_generic_address status_address;     /* Address of status reg */
+       struct acpi_generic_address enable_address;     /* Address of enable reg */
+       u8 enable_for_wake;     /* GPEs to keep enabled when sleeping */
+       u8 enable_for_run;      /* GPEs to keep enabled when running */
+       u8 base_gpe_number;     /* Base GPE number for this register */
 };
 
 /*
  * Information about a GPE register block, one per each installed block --
  * GPE0, GPE1, and one per each installed GPE Block Device.
  */
-struct acpi_gpe_block_info
-{
-       struct acpi_namespace_node              *node;
-       struct acpi_gpe_block_info              *previous;
-       struct acpi_gpe_block_info              *next;
-       struct acpi_gpe_xrupt_info              *xrupt_block;   /* Backpointer to interrupt block */
-       struct acpi_gpe_register_info           *register_info; /* One per GPE register pair */
-       struct acpi_gpe_event_info              *event_info;    /* One for each GPE */
-       struct acpi_generic_address             block_address;  /* Base address of the block */
-       u32                                     register_count; /* Number of register pairs in block */
-       u8                                      block_base_number;/* Base GPE number for this block */
+struct acpi_gpe_block_info {
+       struct acpi_namespace_node *node;
+       struct acpi_gpe_block_info *previous;
+       struct acpi_gpe_block_info *next;
+       struct acpi_gpe_xrupt_info *xrupt_block;        /* Backpointer to interrupt block */
+       struct acpi_gpe_register_info *register_info;   /* One per GPE register pair */
+       struct acpi_gpe_event_info *event_info; /* One for each GPE */
+       struct acpi_generic_address block_address;      /* Base address of the block */
+       u32 register_count;     /* Number of register pairs in block */
+       u8 block_base_number;   /* Base GPE number for this block */
 };
 
 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
 
-struct acpi_gpe_xrupt_info
-{
-       struct acpi_gpe_xrupt_info              *previous;
-       struct acpi_gpe_xrupt_info              *next;
-       struct acpi_gpe_block_info              *gpe_block_list_head; /* List of GPE blocks for this xrupt */
-       u32                                     interrupt_level;    /* System interrupt level */
+struct acpi_gpe_xrupt_info {
+       struct acpi_gpe_xrupt_info *previous;
+       struct acpi_gpe_xrupt_info *next;
+       struct acpi_gpe_block_info *gpe_block_list_head;        /* List of GPE blocks for this xrupt */
+       u32 interrupt_number;   /* System interrupt number */
 };
 
-
-struct acpi_gpe_walk_info
-{
-       struct acpi_namespace_node              *gpe_device;
-       struct acpi_gpe_block_info              *gpe_block;
+struct acpi_gpe_walk_info {
+       struct acpi_namespace_node *gpe_device;
+       struct acpi_gpe_block_info *gpe_block;
 };
 
-
-typedef acpi_status (*ACPI_GPE_CALLBACK) (
-       struct acpi_gpe_xrupt_info      *gpe_xrupt_info,
-       struct acpi_gpe_block_info      *gpe_block);
-
+typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info *
+                                        gpe_xrupt_info,
+                                        struct acpi_gpe_block_info *
+                                        gpe_block);
 
 /* Information about each particular fixed event */
 
-struct acpi_fixed_event_handler
-{
-       acpi_event_handler              handler;        /* Address of handler. */
-       void                            *context;       /* Context to be passed to handler */
+struct acpi_fixed_event_handler {
+       acpi_event_handler handler;     /* Address of handler. */
+       void *context;          /* Context to be passed to handler */
 };
 
-struct acpi_fixed_event_info
-{
-       u8                              status_register_id;
-       u8                              enable_register_id;
-       u16                             status_bit_mask;
-       u16                             enable_bit_mask;
+struct acpi_fixed_event_info {
+       u8 status_register_id;
+       u8 enable_register_id;
+       u16 status_bit_mask;
+       u16 enable_bit_mask;
 };
 
 /* Information used during field processing */
 
-struct acpi_field_info
-{
-       u8                              skip_field;
-       u8                              field_flag;
-       u32                             pkg_length;
+struct acpi_field_info {
+       u8 skip_field;
+       u8 field_flag;
+       u32 pkg_length;
 };
 
-
 /*****************************************************************************
  *
  * Generic "state" object for stacks
@@ -419,14 +385,6 @@ struct acpi_field_info
 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
 
-
-/* Forward declarations */
-
-struct acpi_walk_state        ;
-struct acpi_obj_mutex;
-union acpi_parse_object        ;
-
-
 #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
        u8                                  data_type;          /* To differentiate various internal objs */\
        u8                                  flags;      \
@@ -435,147 +393,112 @@ union acpi_parse_object        ;
        u16                                 reserved;   \
        void                                *next;      \
 
-struct acpi_common_state
-{
-       ACPI_STATE_COMMON
-};
-
+struct acpi_common_state {
+ACPI_STATE_COMMON};
 
 /*
  * Update state - used to traverse complex objects such as packages
  */
-struct acpi_update_state
-{
-       ACPI_STATE_COMMON
-       union acpi_operand_object           *object;
+struct acpi_update_state {
+       ACPI_STATE_COMMON union acpi_operand_object *object;
 };
 
-
 /*
  * Pkg state - used to traverse nested package structures
  */
-struct acpi_pkg_state
-{
-       ACPI_STATE_COMMON
-       union acpi_operand_object           *source_object;
-       union acpi_operand_object           *dest_object;
-       struct acpi_walk_state              *walk_state;
-       void                                *this_target_obj;
-       u32                                 num_packages;
-       u16                                 index;
+struct acpi_pkg_state {
+       ACPI_STATE_COMMON union acpi_operand_object *source_object;
+       union acpi_operand_object *dest_object;
+       struct acpi_walk_state *walk_state;
+       void *this_target_obj;
+       u32 num_packages;
+       u16 index;
 };
 
-
 /*
  * Control state - one per if/else and while constructs.
  * Allows nesting of these constructs
  */
-struct acpi_control_state
-{
-       ACPI_STATE_COMMON
-       union acpi_parse_object             *predicate_op;
-       u8                                  *aml_predicate_start;   /* Start of if/while predicate */
-       u8                                  *package_end;           /* End of if/while block */
-       u16                                 opcode;
+struct acpi_control_state {
+       ACPI_STATE_COMMON union acpi_parse_object *predicate_op;
+       u8 *aml_predicate_start;        /* Start of if/while predicate */
+       u8 *package_end;        /* End of if/while block */
+       u16 opcode;
 };
 
-
 /*
  * Scope state - current scope during namespace lookups
  */
-struct acpi_scope_state
-{
-       ACPI_STATE_COMMON
-       struct acpi_namespace_node          *node;
+struct acpi_scope_state {
+       ACPI_STATE_COMMON struct acpi_namespace_node *node;
 };
 
-
-struct acpi_pscope_state
-{
-       ACPI_STATE_COMMON
-       union acpi_parse_object             *op;                    /* Current op being parsed */
-       u8                                  *arg_end;               /* Current argument end */
-       u8                                  *pkg_end;               /* Current package end */
-       u32                                 arg_list;               /* Next argument to parse */
-       u32                                 arg_count;              /* Number of fixed arguments */
+struct acpi_pscope_state {
+       ACPI_STATE_COMMON union acpi_parse_object *op;  /* Current op being parsed */
+       u8 *arg_end;            /* Current argument end */
+       u8 *pkg_end;            /* Current package end */
+       u32 arg_list;           /* Next argument to parse */
+       u32 arg_count;          /* Number of fixed arguments */
 };
 
-
 /*
  * Thread state - one per thread across multiple walk states.  Multiple walk
  * states are created when there are nested control methods executing.
  */
-struct acpi_thread_state
-{
-       ACPI_STATE_COMMON
-       struct acpi_walk_state              *walk_state_list;       /* Head of list of walk_states for this thread */
-       union acpi_operand_object           *acquired_mutex_list;   /* List of all currently acquired mutexes */
-       u32                                 thread_id;              /* Running thread ID */
-       u8                                  current_sync_level;     /* Mutex Sync (nested acquire) level */
+struct acpi_thread_state {
+       ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list;      /* Head of list of walk_states for this thread */
+       union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
+       u32 thread_id;          /* Running thread ID */
+       u8 current_sync_level;  /* Mutex Sync (nested acquire) level */
 };
 
-
 /*
  * Result values - used to accumulate the results of nested
  * AML arguments
  */
-struct acpi_result_values
-{
+struct acpi_result_values {
        ACPI_STATE_COMMON
-       union acpi_operand_object           *obj_desc [ACPI_OBJ_NUM_OPERANDS];
-       u8                                  num_results;
-       u8                                  last_insert;
+           union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS];
+       u8 num_results;
+       u8 last_insert;
 };
 
-
-typedef
-acpi_status (*acpi_parse_downwards) (
-       struct acpi_walk_state              *walk_state,
-       union acpi_parse_object             **out_op);
-
 typedef
-acpi_status (*acpi_parse_upwards) (
-       struct acpi_walk_state              *walk_state);
+acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
+                                   union acpi_parse_object ** out_op);
 
+typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
 
 /*
  * Notify info - used to pass info to the deferred notify
  * handler/dispatcher.
  */
-struct acpi_notify_info
-{
-       ACPI_STATE_COMMON
-       struct acpi_namespace_node          *node;
-       union acpi_operand_object           *handler_obj;
+struct acpi_notify_info {
+       ACPI_STATE_COMMON struct acpi_namespace_node *node;
+       union acpi_operand_object *handler_obj;
 };
 
-
 /* Generic state is union of structs above */
 
-union acpi_generic_state
-{
-       struct acpi_common_state            common;
-       struct acpi_control_state           control;
-       struct acpi_update_state            update;
-       struct acpi_scope_state             scope;
-       struct acpi_pscope_state            parse_scope;
-       struct acpi_pkg_state               pkg;
-       struct acpi_thread_state            thread;
-       struct acpi_result_values           results;
-       struct acpi_notify_info             notify;
+union acpi_generic_state {
+       struct acpi_common_state common;
+       struct acpi_control_state control;
+       struct acpi_update_state update;
+       struct acpi_scope_state scope;
+       struct acpi_pscope_state parse_scope;
+       struct acpi_pkg_state pkg;
+       struct acpi_thread_state thread;
+       struct acpi_result_values results;
+       struct acpi_notify_info notify;
 };
 
-
 /*****************************************************************************
  *
  * Interpreter typedefs and structs
  *
  ****************************************************************************/
 
-typedef
-acpi_status (*ACPI_EXECUTE_OP) (
-       struct acpi_walk_state              *walk_state);
-
+typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
 
 /*****************************************************************************
  *
@@ -586,28 +509,26 @@ acpi_status (*ACPI_EXECUTE_OP) (
 /*
  * AML opcode, name, and argument layout
  */
-struct acpi_opcode_info
-{
+struct acpi_opcode_info {
 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
-       char                                *name;          /* Opcode name (disassembler/debug only) */
+       char *name;             /* Opcode name (disassembler/debug only) */
 #endif
-       u32                                 parse_args;     /* Grammar/Parse time arguments */
-       u32                                 runtime_args;   /* Interpret time arguments */
-       u32                                 flags;          /* Misc flags */
-       u8                                  object_type;    /* Corresponding internal object type */
-       u8                                  class;          /* Opcode class */
-       u8                                  type;           /* Opcode type */
+       u32 parse_args;         /* Grammar/Parse time arguments */
+       u32 runtime_args;       /* Interpret time arguments */
+       u32 flags;              /* Misc flags */
+       u8 object_type;         /* Corresponding internal object type */
+       u8 class;               /* Opcode class */
+       u8 type;                /* Opcode type */
 };
 
-union acpi_parse_value
-{
-       acpi_integer                        integer;        /* Integer constant (Up to 64 bits) */
-       struct uint64_struct                integer64;      /* Structure overlay for 2 32-bit Dwords */
-       u32                                 size;           /* bytelist or field size */
-       char                                *string;        /* NULL terminated string */
-       u8                                  *buffer;        /* buffer or string */
-       char                                *name;          /* NULL terminated string */
-       union acpi_parse_object             *arg;           /* arguments and contained ops */
+union acpi_parse_value {
+       acpi_integer integer;   /* Integer constant (Up to 64 bits) */
+       struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */
+       u32 size;               /* bytelist or field size */
+       char *string;           /* NULL terminated string */
+       u8 *buffer;             /* buffer or string */
+       char *name;             /* NULL terminated string */
+       union acpi_parse_object *arg;   /* arguments and contained ops */
 };
 
 #define ACPI_PARSE_COMMON \
@@ -636,84 +557,72 @@ union acpi_parse_value
 /*
  * generic operation (for example:  If, While, Store)
  */
-struct acpi_parse_obj_common
-{
-       ACPI_PARSE_COMMON
-};
-
+struct acpi_parse_obj_common {
+ACPI_PARSE_COMMON};
 
 /*
  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
  * and bytelists.
  */
-struct acpi_parse_obj_named
-{
-       ACPI_PARSE_COMMON
-       u8                                  *path;
-       u8                                  *data;          /* AML body or bytelist data */
-       u32                                 length;         /* AML length */
-       u32                                 name;           /* 4-byte name or zero if no name */
+struct acpi_parse_obj_named {
+       ACPI_PARSE_COMMON u8 * path;
+       u8 *data;               /* AML body or bytelist data */
+       u32 length;             /* AML length */
+       u32 name;               /* 4-byte name or zero if no name */
 };
 
-
 /* The parse node is the fundamental element of the parse tree */
 
-struct acpi_parse_obj_asl
-{
-       ACPI_PARSE_COMMON
-       union acpi_parse_object             *child;
-       union acpi_parse_object             *parent_method;
-       char                                *filename;
-       char                                *external_name;
-       char                                *namepath;
-       char                                name_seg[4];
-       u32                                 extra_value;
-       u32                                 column;
-       u32                                 line_number;
-       u32                                 logical_line_number;
-       u32                                 logical_byte_offset;
-       u32                                 end_line;
-       u32                                 end_logical_line;
-       u32                                 acpi_btype;
-       u32                                 aml_length;
-       u32                                 aml_subtree_length;
-       u32                                 final_aml_length;
-       u32                                 final_aml_offset;
-       u32                                 compile_flags;
-       u16                                 parse_opcode;
-       u8                                  aml_opcode_length;
-       u8                                  aml_pkg_len_bytes;
-       u8                                  extra;
-       char                                parse_op_name[12];
-};
-
-union acpi_parse_object
-{
-       struct acpi_parse_obj_common        common;
-       struct acpi_parse_obj_named         named;
-       struct acpi_parse_obj_asl           asl;
+struct acpi_parse_obj_asl {
+       ACPI_PARSE_COMMON union acpi_parse_object *child;
+       union acpi_parse_object *parent_method;
+       char *filename;
+       char *external_name;
+       char *namepath;
+       char name_seg[4];
+       u32 extra_value;
+       u32 column;
+       u32 line_number;
+       u32 logical_line_number;
+       u32 logical_byte_offset;
+       u32 end_line;
+       u32 end_logical_line;
+       u32 acpi_btype;
+       u32 aml_length;
+       u32 aml_subtree_length;
+       u32 final_aml_length;
+       u32 final_aml_offset;
+       u32 compile_flags;
+       u16 parse_opcode;
+       u8 aml_opcode_length;
+       u8 aml_pkg_len_bytes;
+       u8 extra;
+       char parse_op_name[12];
+};
+
+union acpi_parse_object {
+       struct acpi_parse_obj_common common;
+       struct acpi_parse_obj_named named;
+       struct acpi_parse_obj_asl asl;
 };
 
-
 /*
  * Parse state - one state per parser invocation and each control
  * method.
  */
-struct acpi_parse_state
-{
-       u32                                 aml_size;
-       u8                                  *aml_start;     /* First AML byte */
-       u8                                  *aml;           /* Next AML byte */
-       u8                                  *aml_end;       /* (last + 1) AML byte */
-       u8                                  *pkg_start;     /* Current package begin */
-       u8                                  *pkg_end;       /* Current package end */
-       union acpi_parse_object             *start_op;      /* Root of parse tree */
-       struct acpi_namespace_node          *start_node;
-       union acpi_generic_state            *scope;         /* Current scope */
-       union acpi_parse_object             *start_scope;
+struct acpi_parse_state {
+       u32 aml_size;
+       u8 *aml_start;          /* First AML byte */
+       u8 *aml;                /* Next AML byte */
+       u8 *aml_end;            /* (last + 1) AML byte */
+       u8 *pkg_start;          /* Current package begin */
+       u8 *pkg_end;            /* Current package end */
+       union acpi_parse_object *start_op;      /* Root of parse tree */
+       struct acpi_namespace_node *start_node;
+       union acpi_generic_state *scope;        /* Current scope */
+       union acpi_parse_object *start_scope;
 };
 
-
 /* Parse object flags */
 
 #define ACPI_PARSEOP_GENERIC                    0x01
@@ -729,7 +638,6 @@ struct acpi_parse_state
 #define ACPI_PARSEOP_EMPTY_TERMLIST             0x04
 #define ACPI_PARSEOP_SPECIAL                    0x10
 
-
 /*****************************************************************************
  *
  * Hardware (ACPI registers) and PNP
@@ -737,15 +645,14 @@ struct acpi_parse_state
  ****************************************************************************/
 
 #define PCI_ROOT_HID_STRING         "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
 
-struct acpi_bit_register_info
-{
-       u8                                  parent_register;
-       u8                                  bit_position;
-       u16                                 access_bit_mask;
+struct acpi_bit_register_info {
+       u8 parent_register;
+       u8 bit_position;
+       u16 access_bit_mask;
 };
 
-
 /*
  * Register IDs
  * These are the full ACPI registers
@@ -760,7 +667,6 @@ struct acpi_bit_register_info
 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
 
-
 /* Masks used to access the bit_registers */
 
 #define ACPI_BITMASK_TIMER_STATUS               0x0001
@@ -769,7 +675,7 @@ struct acpi_bit_register_info
 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
-#define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
+#define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000 /* ACPI 3.0 */
 #define ACPI_BITMASK_WAKE_STATUS                0x8000
 
 #define ACPI_BITMASK_ALL_FIXED_STATUS           (ACPI_BITMASK_TIMER_STATUS          | \
@@ -785,7 +691,7 @@ struct acpi_bit_register_info
 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
-#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
+#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000 /* ACPI 3.0 */
 
 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
@@ -795,7 +701,6 @@ struct acpi_bit_register_info
 
 #define ACPI_BITMASK_ARB_DISABLE                0x0001
 
-
 /* Raw bit position of each bit_register */
 
 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
@@ -804,7 +709,7 @@ struct acpi_bit_register_info
 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
-#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
+#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E   /* ACPI 3.0 */
 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
 
 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
@@ -812,7 +717,7 @@ struct acpi_bit_register_info
 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
-#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
+#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E   /* ACPI 3.0 */
 
 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
@@ -822,7 +727,6 @@ struct acpi_bit_register_info
 
 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
 
-
 /*****************************************************************************
  *
  * Resource descriptors
@@ -841,8 +745,7 @@ struct acpi_bit_register_info
 #define ACPI_RDESC_TYPE_SMALL                   0x00
 
 #define ACPI_RDESC_TYPE_MASK                    0x80
-#define ACPI_RDESC_SMALL_MASK                   0x78 /* Only bits 6:3 contain the type */
-
+#define ACPI_RDESC_SMALL_MASK                   0x78   /* Only bits 6:3 contain the type */
 
 /*
  * Small resource descriptor types
@@ -871,7 +774,6 @@ struct acpi_bit_register_info
 #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE     0x8A
 #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE  0x8B
 
-
 /*****************************************************************************
  *
  * Miscellaneous
@@ -880,49 +782,36 @@ struct acpi_bit_register_info
 
 #define ACPI_ASCII_ZERO                      0x30
 
-
 /*****************************************************************************
  *
  * Debugger
  *
  ****************************************************************************/
 
-struct acpi_db_method_info
-{
-       acpi_handle                     thread_gate;
-       char                            *name;
-       char                            **args;
-       u32                             flags;
-       u32                             num_loops;
-       char                            pathname[128];
+struct acpi_db_method_info {
+       acpi_handle thread_gate;
+       char *name;
+       char **args;
+       u32 flags;
+       u32 num_loops;
+       char pathname[128];
 };
 
-struct acpi_integrity_info
-{
-       u32                         nodes;
-       u32                         objects;
+struct acpi_integrity_info {
+       u32 nodes;
+       u32 objects;
 };
 
-
 #define ACPI_DB_REDIRECTABLE_OUTPUT  0x01
 #define ACPI_DB_CONSOLE_OUTPUT       0x02
 #define ACPI_DB_DUPLICATE_OUTPUT     0x03
 
-
 /*****************************************************************************
  *
  * Debug
  *
  ****************************************************************************/
 
-struct acpi_debug_print_info
-{
-       u32                             component_id;
-       char                            *proc_name;
-       char                            *module_name;
-};
-
-
 /* Entry for a memory allocation (debug only) */
 
 #define ACPI_MEM_MALLOC                      0
@@ -938,51 +827,36 @@ struct acpi_debug_print_info
        char                                module[ACPI_MAX_MODULE_NAME]; \
        u8                                  alloc_type;
 
-struct acpi_debug_mem_header
-{
-       ACPI_COMMON_DEBUG_MEM_HEADER
-};
+struct acpi_debug_mem_header {
+ACPI_COMMON_DEBUG_MEM_HEADER};
 
-struct acpi_debug_mem_block
-{
-       ACPI_COMMON_DEBUG_MEM_HEADER
-       u64                                 user_space;
+struct acpi_debug_mem_block {
+       ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
 };
 
-
 #define ACPI_MEM_LIST_GLOBAL            0
 #define ACPI_MEM_LIST_NSNODE            1
+#define ACPI_MEM_LIST_MAX               1
+#define ACPI_NUM_MEM_LISTS              2
 
-#define ACPI_MEM_LIST_FIRST_CACHE_LIST  2
-#define ACPI_MEM_LIST_STATE             2
-#define ACPI_MEM_LIST_PSNODE            3
-#define ACPI_MEM_LIST_PSNODE_EXT        4
-#define ACPI_MEM_LIST_OPERAND           5
-#define ACPI_MEM_LIST_WALK              6
-#define ACPI_MEM_LIST_MAX               6
-#define ACPI_NUM_MEM_LISTS              7
-
-
-struct acpi_memory_list
-{
-       void                                *list_head;
-       u16                                 link_offset;
-       u16                                 max_cache_depth;
-       u16                                 cache_depth;
-       u16                                 object_size;
+struct acpi_memory_list {
+       char *list_name;
+       void *list_head;
+       u16 object_size;
+       u16 max_depth;
+       u16 current_depth;
+       u16 link_offset;
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
        /* Statistics for debug memory tracking only */
 
-       u32                                 total_allocated;
-       u32                                 total_freed;
-       u32                                 current_total_size;
-       u32                                 cache_requests;
-       u32                                 cache_hits;
-       char                                *list_name;
+       u32 total_allocated;
+       u32 total_freed;
+       u32 current_total_size;
+       u32 requests;
+       u32 hits;
 #endif
 };
 
-
-#endif /* __ACLOCAL_H__ */
+#endif                         /* __ACLOCAL_H__ */
index 09be937d2c3916217bd501a89dac5f1dc74159be..702cc4e57f5f727b431e494a794154aead07f760 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __ACMACROS_H__
 #define __ACMACROS_H__
 
-
 /*
  * Data manipulation macros
  */
@@ -57,7 +56,6 @@
 #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
 #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
 
-
 #if ACPI_MACHINE_WIDTH == 16
 
 /*
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
 
 #define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
                                                                          ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
 
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
 
 #define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
 #define ACPI_MOVE_32_TO_32(d,s)         *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
 #define ACPI_MOVE_32_TO_64(d,s)         ACPI_MOVE_32_TO_32(d,s)
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
 #define ACPI_MOVE_64_TO_64(d,s)         ACPI_MOVE_32_TO_32(d,s)
 
 #else
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
 #define ACPI_MOVE_32_TO_32(d,s)         *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
 #define ACPI_MOVE_32_TO_64(d,s)         *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
 #define ACPI_MOVE_64_TO_64(d,s)         *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
 #endif
 
 
 /* 32-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
+#define ACPI_MOVE_32_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
 
 #define ACPI_MOVE_32_TO_32(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
 
 /* 64-bit source, 16/32/64 destination */
 
-#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)    /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)    /* Truncate to 32 */
+#define ACPI_MOVE_64_TO_16(d,s)         ACPI_MOVE_16_TO_16(d,s)        /* Truncate to 16 */
+#define ACPI_MOVE_64_TO_32(d,s)         ACPI_MOVE_32_TO_32(d,s)        /* Truncate to 32 */
 #define ACPI_MOVE_64_TO_64(d,s)         {((  u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
                                                                                 ((  u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
                                                                                 ((  u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
 #error unknown ACPI_MACHINE_WIDTH
 #endif
 
-
 /*
  * Fast power-of-two math macros for non-optimized compilers
  */
 #define ACPI_MUL_16(a)                  _ACPI_MUL(a,4)
 #define ACPI_MOD_16(a)                  _ACPI_MOD(a,16)
 
-
 /*
  * Rounding macros (Power of two boundaries only)
  */
 #define ACPI_ROUND_UP_to_64_bITS(a)          ACPI_ROUND_UP(a,8)
 #define ACPI_ROUND_UP_TO_NATIVE_WORD(a)      ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
 
-
 #define ACPI_ROUND_BITS_UP_TO_BYTES(a)       ACPI_DIV_8((a) + 7)
 #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a)     ACPI_DIV_8((a))
 
 
 #define ACPI_IS_OCTAL_DIGIT(d)               (((char)(d) >= '0') && ((char)(d) <= '7'))
 
-
 /* Bitfields within ACPI registers */
 
 #define ACPI_REGISTER_PREPARE_BITS(val, pos, mask)      ((val << pos) & mask)
 #define ACPI_GET_DESCRIPTOR_TYPE(d)     (((union acpi_descriptor *)(void *)(d))->descriptor_id)
 #define ACPI_SET_DESCRIPTOR_TYPE(d,t)   (((union acpi_descriptor *)(void *)(d))->descriptor_id = t)
 
-
 /* Macro to test the object type */
 
 #define ACPI_GET_OBJECT_TYPE(d)         (((union acpi_operand_object *)(void *)(d))->common.type)
 #define GET_CURRENT_ARG_TYPE(list)      (list & ((u32) 0x1F))
 #define INCREMENT_ARG_LIST(list)        (list >>= ((u32) ARG_TYPE_WIDTH))
 
-
 /*
  * Reporting macros that are never compiled out
  */
 #define ACPI_PARAM_LIST(pl)                 pl
 
 /*
- * Error reporting.  These versions add callers module and line#.  Since
- * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
- * use it in debug mode.
+ * Error reporting.  These versions add callers module and line#.
+ *
+ * Since _acpi_module_name gets compiled out when ACPI_DEBUG_OUTPUT
+ * isn't defined, only use it in debug mode.
  */
 #ifdef ACPI_DEBUG_OUTPUT
 
-#define ACPI_REPORT_INFO(fp)                {acpi_ut_report_info(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_INFO(fp)                {acpi_ut_report_info(_acpi_module_name,__LINE__,_COMPONENT); \
                                                                                                acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp)               {acpi_ut_report_error(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_ERROR(fp)               {acpi_ut_report_error(_acpi_module_name,__LINE__,_COMPONENT); \
                                                                                                acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp)             {acpi_ut_report_warning(_THIS_MODULE,__LINE__,_COMPONENT); \
+#define ACPI_REPORT_WARNING(fp)             {acpi_ut_report_warning(_acpi_module_name,__LINE__,_COMPONENT); \
                                                                                                acpi_os_printf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e)            acpi_ns_report_error(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+#define ACPI_REPORT_NSERROR(s,e)            acpi_ns_report_error(_acpi_module_name,__LINE__,_COMPONENT, s, e);
 
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e)   acpi_ns_report_method_error(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+#define ACPI_REPORT_METHOD_ERROR(s,n,p,e)   acpi_ns_report_method_error(_acpi_module_name,__LINE__,_COMPONENT, s, n, p, e);
 
 #else
 
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
+#define ACPI_MODULE_NAME(name)          static char ACPI_UNUSED_VAR *_acpi_module_name = name;
 
-#define ACPI_MODULE_NAME(name)               static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
+/*
+ * Common parameters used for debug output functions:
+ * line number, function name, module(file) name, component ID
+ */
+#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
 
 /*
- * Function entry tracing.
- * The first parameter should be the procedure name as a quoted string.  This is declared
- * as a local string ("_proc_name) so that it can be also used by the function exit macros below.
+ * Function entry tracing
+ */
+
+/*
+ * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
+ * define it now. This is the case where there the compiler does not support
+ * a __FUNCTION__ macro or equivalent. We save the function name on the
+ * local stack.
+ */
+#ifndef ACPI_GET_FUNCTION_NAME
+#define ACPI_GET_FUNCTION_NAME          _acpi_function_name
+/*
+ * The Name parameter should be the procedure name as a quoted string.
+ * This is declared as a local string ("my_function_name") so that it can
+ * be also used by the function exit macros below.
+ * Note: (const char) is used to be compatible with the debug interfaces
+ * and macros such as __FUNCTION__.
  */
-#define ACPI_FUNCTION_NAME(a)               struct acpi_debug_print_info _debug_info; \
-                                                                                               _debug_info.component_id = _COMPONENT; \
-                                                                                               _debug_info.proc_name  = a; \
-                                                                                               _debug_info.module_name = _THIS_MODULE;
-
-#define ACPI_FUNCTION_TRACE(a)              ACPI_FUNCTION_NAME(a) \
-                                                                                               acpi_ut_trace(__LINE__,&_debug_info)
-#define ACPI_FUNCTION_TRACE_PTR(a,b)        ACPI_FUNCTION_NAME(a) \
-                                                                                               acpi_ut_trace_ptr(__LINE__,&_debug_info,(void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a,b)        ACPI_FUNCTION_NAME(a) \
-                                                                                               acpi_ut_trace_u32(__LINE__,&_debug_info,(u32)b)
-#define ACPI_FUNCTION_TRACE_STR(a,b)        ACPI_FUNCTION_NAME(a) \
-                                                                                               acpi_ut_trace_str(__LINE__,&_debug_info,(char *)b)
-
-#define ACPI_FUNCTION_ENTRY()               acpi_ut_track_stack_ptr()
+#define ACPI_FUNCTION_NAME(name)        const char *_acpi_function_name = name;
+
+#else
+/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
+
+#define ACPI_FUNCTION_NAME(name)
+#endif
+
+#define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
+                                                                                       acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
+#define ACPI_FUNCTION_TRACE_PTR(a,b)    ACPI_FUNCTION_NAME(a) \
+                                                                                       acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b)    ACPI_FUNCTION_NAME(a) \
+                                                                                       acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b)    ACPI_FUNCTION_NAME(a) \
+                                                                                       acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
 
 /*
  * Function exit tracing.
  * WARNING: These macros include a return statement.  This is usually considered
  * bad form, but having a separate exit macro is very ugly and difficult to maintain.
  * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_proc_name" is defined.
+ * so that "_acpi_function_name" is defined.
  */
 #ifdef ACPI_USE_DO_WHILE_0
 #define ACPI_DO_WHILE0(a)               do a while(0)
 #define ACPI_DO_WHILE0(a)               a
 #endif
 
-#define return_VOID                     ACPI_DO_WHILE0 ({acpi_ut_exit(__LINE__,&_debug_info);return;})
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({acpi_ut_status_exit(__LINE__,&_debug_info,(s));return((s));})
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({acpi_ut_value_exit(__LINE__,&_debug_info,(acpi_integer)(s));return((s));})
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(__LINE__,&_debug_info,(u8 *)(s));return((s));})
+#define return_VOID                     ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;})
+#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));})
+#define return_VALUE(s)                 ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));})
+#define return_PTR(s)                   ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));})
 
 /* Conditional execution */
 
 #define ACPI_DEBUG_ONLY_MEMBERS(a)      a;
 #define _VERBOSE_STRUCTURES
 
-
 /* Stack and buffer dumping */
 
 #define ACPI_DUMP_STACK_ENTRY(a)        acpi_ex_dump_operand((a),0)
-#define ACPI_DUMP_OPERANDS(a,b,c,d,e)   acpi_ex_dump_operands(a,b,c,d,e,_THIS_MODULE,__LINE__)
-
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e)   acpi_ex_dump_operands(a,b,c,d,e,_acpi_module_name,__LINE__)
 
 #define ACPI_DUMP_ENTRY(a,b)            acpi_ns_dump_entry (a,b)
 #define ACPI_DUMP_PATHNAME(a,b,c,d)     acpi_ns_dump_pathname(a,b,c,d)
 #define ACPI_DUMP_BUFFER(a,b)           acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
 #define ACPI_BREAK_MSG(a)               acpi_os_signal (ACPI_SIGNAL_BREAKPOINT,(a))
 
-
 /*
  * Generate INT3 on ACPI_ERROR (Debug only!)
  */
 #define ACPI_DEBUG_PRINT(pl)            acpi_ut_debug_print ACPI_PARAM_LIST(pl)
 #define ACPI_DEBUG_PRINT_RAW(pl)        acpi_ut_debug_print_raw ACPI_PARAM_LIST(pl)
 
-
 #else
 /*
  * This is the non-debug case -- make everything go away,
  * leaving no executable debug code!
  */
 #define ACPI_MODULE_NAME(name)
-#define _THIS_MODULE ""
+#define _acpi_module_name ""
 
 #define ACPI_DEBUG_EXEC(a)
 #define ACPI_NORMAL_EXEC(a)             a;
 #define ACPI_DEBUGGER_EXEC(a)
 #endif
 
-
 /*
  * For 16-bit code, we want to shrink some things even though
  * we are using ACPI_DEBUG_OUTPUT to get the debug output
 #define ACPI_DEBUG_ONLY_MEMBERS(a)
 #endif
 
-
 #ifdef ACPI_DEBUG_OUTPUT
 /*
  * 1) Set name to blanks
 #define ACPI_ADD_OBJECT_NAME(a,b)
 #endif
 
-
 /*
  * Memory allocation tracking (DEBUG ONLY)
  */
 
 /* Memory allocation */
 
-#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
 #define ACPI_MEM_FREE(a)                acpi_os_free(a)
 #define ACPI_MEM_TRACKING(a)
 
-
 #else
 
 /* Memory allocation */
 
-#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a)                acpi_ut_free_and_track(a,_COMPONENT,_THIS_MODULE,__LINE__)
+#define ACPI_MEM_ALLOCATE(a)            acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_CALLOCATE(a)           acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__)
+#define ACPI_MEM_FREE(a)                acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__)
 #define ACPI_MEM_TRACKING(a)            a
 
-#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+#endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
-#endif /* ACMACROS_H */
+#endif                         /* ACMACROS_H */
index deb7cb06f5f0a0639e50bb6498d4d0d866990307..4f9063f3e951af91b66c6d876acb14b3fb1b0dd6 100644 (file)
 
 /* Definitions of the predefined namespace names  */
 
-#define ACPI_UNKNOWN_NAME       (u32) 0x3F3F3F3F     /* Unknown name is  "????" */
-#define ACPI_ROOT_NAME          (u32) 0x5F5F5F5C     /* Root name is     "\___" */
-#define ACPI_SYS_BUS_NAME       (u32) 0x5F53425F     /* Sys bus name is  "_SB_" */
+#define ACPI_UNKNOWN_NAME       (u32) 0x3F3F3F3F       /* Unknown name is "????" */
+#define ACPI_ROOT_NAME          (u32) 0x5F5F5F5C       /* Root name is    "\___" */
+
+#define ACPI_PREFIX_MIXED       (u32) 0x69706341       /* "Acpi" */
+#define ACPI_PREFIX_LOWER       (u32) 0x69706361       /* "acpi" */
 
 #define ACPI_NS_ROOT_PATH       "\\"
 #define ACPI_NS_SYSTEM_BUS      "_SB_"
 
-
-#endif  /* __ACNAMES_H__  */
-
-
+#endif                         /* __ACNAMES_H__  */
index d1b3ce80056f44f878dc53111c37c1768ae5318a..dd3501f7e5d683bb47110fd47e5b16f838d88be3 100644 (file)
@@ -44,7 +44,6 @@
 #ifndef __ACNAMESP_H__
 #define __ACNAMESP_H__
 
-
 /* To search the entire name space, pass this as search_base */
 
 #define ACPI_NS_ALL                 ((acpi_handle)0)
@@ -54,8 +53,8 @@
  * and should be one-to-one with values of acpi_object_type
  */
 #define ACPI_NS_NORMAL              0
-#define ACPI_NS_NEWSCOPE            1   /* a definition of this type opens a name scope */
-#define ACPI_NS_LOCAL               2   /* suppress search of enclosing scopes */
+#define ACPI_NS_NEWSCOPE            1  /* a definition of this type opens a name scope */
+#define ACPI_NS_LOCAL               2  /* suppress search of enclosing scopes */
 
 /* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
 
 #define ACPI_NS_WALK_UNLOCK         TRUE
 #define ACPI_NS_WALK_NO_UNLOCK      FALSE
 
-
 /*
  * nsinit - Namespace initialization
  */
-acpi_status
-acpi_ns_initialize_objects (
-       void);
-
-acpi_status
-acpi_ns_initialize_devices (
-       void);
+acpi_status acpi_ns_initialize_objects(void);
 
+acpi_status acpi_ns_initialize_devices(void);
 
 /*
  * nsload -  Namespace loading
  */
-acpi_status
-acpi_ns_load_namespace (
-       void);
+acpi_status acpi_ns_load_namespace(void);
 
 acpi_status
-acpi_ns_load_table (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *node);
-
+acpi_ns_load_table(struct acpi_table_desc *table_desc,
+                  struct acpi_namespace_node *node);
 
 /*
  * nswalk - walk the namespace
  */
 acpi_status
-acpi_ns_walk_namespace (
-       acpi_object_type                type,
-       acpi_handle                     start_object,
-       u32                             max_depth,
-       u8                              unlock_before_callback,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value);
-
-struct acpi_namespace_node *
-acpi_ns_get_next_node (
-       acpi_object_type                type,
-       struct acpi_namespace_node      *parent,
-       struct acpi_namespace_node      *child);
-
+acpi_ns_walk_namespace(acpi_object_type type,
+                      acpi_handle start_object,
+                      u32 max_depth,
+                      u8 unlock_before_callback,
+                      acpi_walk_callback user_function,
+                      void *context, void **return_value);
+
+struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
+                                                 struct acpi_namespace_node
+                                                 *parent,
+                                                 struct acpi_namespace_node
+                                                 *child);
 
 /*
  * nsparse - table parsing
  */
 acpi_status
-acpi_ns_parse_table (
-       struct acpi_table_desc          *table_desc,
-       struct acpi_namespace_node      *scope);
+acpi_ns_parse_table(struct acpi_table_desc *table_desc,
+                   struct acpi_namespace_node *scope);
 
 acpi_status
-acpi_ns_one_complete_parse (
-       u32                             pass_number,
-       struct acpi_table_desc          *table_desc);
-
+acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc);
 
 /*
  * nsaccess - Top-level namespace access
  */
-acpi_status
-acpi_ns_root_initialize (
-       void);
+acpi_status acpi_ns_root_initialize(void);
 
 acpi_status
-acpi_ns_lookup (
-       union acpi_generic_state        *scope_info,
-       char                            *name,
-       acpi_object_type                type,
-       acpi_interpreter_mode           interpreter_mode,
-       u32                             flags,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      **ret_node);
-
+acpi_ns_lookup(union acpi_generic_state *scope_info,
+              char *name,
+              acpi_object_type type,
+              acpi_interpreter_mode interpreter_mode,
+              u32 flags,
+              struct acpi_walk_state *walk_state,
+              struct acpi_namespace_node **ret_node);
 
 /*
  * nsalloc - Named object allocation/deallocation
  */
-struct acpi_namespace_node *
-acpi_ns_create_node (
-       u32                             name);
-
-void
-acpi_ns_delete_node (
-       struct acpi_namespace_node      *node);
+struct acpi_namespace_node *acpi_ns_create_node(u32 name);
 
-void
-acpi_ns_delete_namespace_subtree (
-       struct acpi_namespace_node      *parent_handle);
+void acpi_ns_delete_node(struct acpi_namespace_node *node);
 
 void
-acpi_ns_delete_namespace_by_owner (
-       u16                             table_id);
+acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
 
-void
-acpi_ns_detach_object (
-       struct acpi_namespace_node      *node);
+void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
 
-void
-acpi_ns_delete_children (
-       struct acpi_namespace_node      *parent);
+void acpi_ns_detach_object(struct acpi_namespace_node *node);
 
-int
-acpi_ns_compare_names (
-       char                            *name1,
-       char                            *name2);
+void acpi_ns_delete_children(struct acpi_namespace_node *parent);
 
+int acpi_ns_compare_names(char *name1, char *name2);
 
 /*
  * nsdump - Namespace dump/print utilities
  */
 #ifdef ACPI_FUTURE_USAGE
-void
-acpi_ns_dump_tables (
-       acpi_handle                     search_base,
-       u32                             max_depth);
-#endif /* ACPI_FUTURE_USAGE */
+void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
+#endif                         /* ACPI_FUTURE_USAGE */
 
-void
-acpi_ns_dump_entry (
-       acpi_handle                     handle,
-       u32                             debug_level);
+void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
 
 void
-acpi_ns_dump_pathname (
-       acpi_handle                     handle,
-       char                            *msg,
-       u32                             level,
-       u32                             component);
+acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
 
-void
-acpi_ns_print_pathname (
-       u32                             num_segments,
-       char                            *pathname);
+void acpi_ns_print_pathname(u32 num_segments, char *pathname);
 
 acpi_status
-acpi_ns_dump_one_object (
-       acpi_handle                     obj_handle,
-       u32                             level,
-       void                            *context,
-       void                            **return_value);
+acpi_ns_dump_one_object(acpi_handle obj_handle,
+                       u32 level, void *context, void **return_value);
 
 #ifdef ACPI_FUTURE_USAGE
 void
-acpi_ns_dump_objects (
-       acpi_object_type                type,
-       u8                              display_type,
-       u32                             max_depth,
-       u32                             ownder_id,
-       acpi_handle                     start_handle);
-#endif /* ACPI_FUTURE_USAGE */
-
+acpi_ns_dump_objects(acpi_object_type type,
+                    u8 display_type,
+                    u32 max_depth,
+                    acpi_owner_id owner_id, acpi_handle start_handle);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*
  * nseval - Namespace evaluation functions
  */
-acpi_status
-acpi_ns_evaluate_by_handle (
-       struct acpi_parameter_info      *info);
+acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info);
 
 acpi_status
-acpi_ns_evaluate_by_name (
-       char                            *pathname,
-       struct acpi_parameter_info      *info);
+acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info);
 
 acpi_status
-acpi_ns_evaluate_relative (
-       char                            *pathname,
-       struct acpi_parameter_info      *info);
-
+acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info);
 
 /*
  * nsnames - Name and Scope manipulation
  */
-u32
-acpi_ns_opens_scope (
-       acpi_object_type                type);
+u32 acpi_ns_opens_scope(acpi_object_type type);
 
-char *
-acpi_ns_get_external_pathname (
-       struct acpi_namespace_node      *node);
+char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
 
-char *
-acpi_ns_name_of_current_scope (
-       struct acpi_walk_state          *walk_state);
+char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ns_handle_to_pathname (
-       acpi_handle                     target_handle,
-       struct acpi_buffer              *buffer);
+acpi_ns_handle_to_pathname(acpi_handle target_handle,
+                          struct acpi_buffer *buffer);
 
 u8
-acpi_ns_pattern_match (
-       struct acpi_namespace_node      *obj_node,
-       char                            *search_for);
+acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
 
 acpi_status
-acpi_ns_get_node_by_path (
-       char                            *external_pathname,
-       struct acpi_namespace_node      *in_prefix_node,
-       u32                             flags,
-       struct acpi_namespace_node      **out_node);
-
-acpi_size
-acpi_ns_get_pathname_length (
-       struct acpi_namespace_node      *node);
+acpi_ns_get_node_by_path(char *external_pathname,
+                        struct acpi_namespace_node *in_prefix_node,
+                        u32 flags, struct acpi_namespace_node **out_node);
 
+acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
 
 /*
  * nsobject - Object management for namespace nodes
  */
 acpi_status
-acpi_ns_attach_object (
-       struct acpi_namespace_node      *node,
-       union acpi_operand_object       *object,
-       acpi_object_type                type);
+acpi_ns_attach_object(struct acpi_namespace_node *node,
+                     union acpi_operand_object *object, acpi_object_type type);
 
-union acpi_operand_object *
-acpi_ns_get_attached_object (
-       struct acpi_namespace_node      *node);
+union acpi_operand_object *acpi_ns_get_attached_object(struct
+                                                      acpi_namespace_node
+                                                      *node);
 
-union acpi_operand_object *
-acpi_ns_get_secondary_object (
-       union acpi_operand_object       *obj_desc);
+union acpi_operand_object *acpi_ns_get_secondary_object(union
+                                                       acpi_operand_object
+                                                       *obj_desc);
 
 acpi_status
-acpi_ns_attach_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler,
-       void                            *data);
+acpi_ns_attach_data(struct acpi_namespace_node *node,
+                   acpi_object_handler handler, void *data);
 
 acpi_status
-acpi_ns_detach_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler);
+acpi_ns_detach_data(struct acpi_namespace_node *node,
+                   acpi_object_handler handler);
 
 acpi_status
-acpi_ns_get_attached_data (
-       struct acpi_namespace_node      *node,
-       acpi_object_handler             handler,
-       void                            **data);
-
+acpi_ns_get_attached_data(struct acpi_namespace_node *node,
+                         acpi_object_handler handler, void **data);
 
 /*
  * nssearch - Namespace searching and entry
  */
 acpi_status
-acpi_ns_search_and_enter (
-       u32                             entry_name,
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *node,
-       acpi_interpreter_mode           interpreter_mode,
-       acpi_object_type                type,
-       u32                             flags,
-       struct acpi_namespace_node      **ret_node);
+acpi_ns_search_and_enter(u32 entry_name,
+                        struct acpi_walk_state *walk_state,
+                        struct acpi_namespace_node *node,
+                        acpi_interpreter_mode interpreter_mode,
+                        acpi_object_type type,
+                        u32 flags, struct acpi_namespace_node **ret_node);
 
 acpi_status
-acpi_ns_search_node (
-       u32                             entry_name,
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type,
-       struct acpi_namespace_node      **ret_node);
+acpi_ns_search_node(u32 entry_name,
+                   struct acpi_namespace_node *node,
+                   acpi_object_type type,
+                   struct acpi_namespace_node **ret_node);
 
 void
-acpi_ns_install_node (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_namespace_node      *parent_node,
-       struct acpi_namespace_node      *node,
-       acpi_object_type                type);
-
+acpi_ns_install_node(struct acpi_walk_state *walk_state,
+                    struct acpi_namespace_node *parent_node,
+                    struct acpi_namespace_node *node, acpi_object_type type);
 
 /*
  * nsutils - Utility functions
  */
-u8
-acpi_ns_valid_root_prefix (
-       char                            prefix);
+u8 acpi_ns_valid_root_prefix(char prefix);
 
-acpi_object_type
-acpi_ns_get_type (
-       struct acpi_namespace_node      *node);
+acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
 
-u32
-acpi_ns_local (
-       acpi_object_type                type);
+u32 acpi_ns_local(acpi_object_type type);
 
 void
-acpi_ns_report_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       char                            *internal_name,
-       acpi_status                     lookup_status);
+acpi_ns_report_error(char *module_name,
+                    u32 line_number,
+                    u32 component_id,
+                    char *internal_name, acpi_status lookup_status);
 
 void
-acpi_ns_report_method_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       char                            *message,
-       struct acpi_namespace_node      *node,
-       char                            *path,
-       acpi_status                     lookup_status);
+acpi_ns_report_method_error(char *module_name,
+                           u32 line_number,
+                           u32 component_id,
+                           char *message,
+                           struct acpi_namespace_node *node,
+                           char *path, acpi_status lookup_status);
 
-void
-acpi_ns_print_node_pathname (
-       struct acpi_namespace_node      *node,
-       char                            *msg);
+void acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *msg);
 
-acpi_status
-acpi_ns_build_internal_name (
-       struct acpi_namestring_info     *info);
+acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
 
-void
-acpi_ns_get_internal_name_length (
-       struct acpi_namestring_info     *info);
+void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
 
-acpi_status
-acpi_ns_internalize_name (
-       char                            *dotted_name,
-       char                            **converted_name);
+acpi_status acpi_ns_internalize_name(char *dotted_name, char **converted_name);
 
 acpi_status
-acpi_ns_externalize_name (
-       u32                             internal_name_length,
-       char                            *internal_name,
-       u32                             *converted_name_length,
-       char                            **converted_name);
+acpi_ns_externalize_name(u32 internal_name_length,
+                        char *internal_name,
+                        u32 * converted_name_length, char **converted_name);
 
-struct acpi_namespace_node *
-acpi_ns_map_handle_to_node (
-       acpi_handle                     handle);
+struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle);
 
-acpi_handle
-acpi_ns_convert_entry_to_handle(
-       struct acpi_namespace_node      *node);
-
-void
-acpi_ns_terminate (
-       void);
+acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
 
-struct acpi_namespace_node *
-acpi_ns_get_parent_node (
-       struct acpi_namespace_node      *node);
+void acpi_ns_terminate(void);
 
+struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
+                                                   *node);
 
-struct acpi_namespace_node *
-acpi_ns_get_next_valid_node (
-       struct acpi_namespace_node      *node);
+struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
+                                                       acpi_namespace_node
+                                                       *node);
 
-#endif /* __ACNAMESP_H__ */
+#endif                         /* __ACNAMESP_H__ */
index e079b94e4fce4d5933d72cee885e9c2bdfbf45e2..4a326ba6d482c99d84cee3db9b822ea4e7f4bcce 100644 (file)
@@ -45,7 +45,6 @@
 #ifndef _ACOBJECT_H
 #define _ACOBJECT_H
 
-
 /*
  * The union acpi_operand_object    is used to pass AML operands from the dispatcher
  * to the interpreter, and to keep track of the various handlers such as
@@ -81,7 +80,6 @@
 #define AOPOBJ_SETUP_COMPLETE       0x10
 #define AOPOBJ_SINGLE_DATUM         0x20
 
-
 /*
  * Common bitfield for the field objects
  * "Field Datum"  -- a datum from the actual field object
@@ -96,8 +94,7 @@
        u8                                      start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
        u8                                      access_bit_width;   /* Read/Write size in bits (8-64) */\
        u32                                     value;              /* Value to store into the Bank or Index register */\
-       struct acpi_namespace_node              *node;              /* Link back to parent node */
-
+       struct acpi_namespace_node              *node;  /* Link back to parent node */
 
 /*
  * Fields common to both Strings and Buffers
 #define ACPI_COMMON_BUFFER_INFO \
        u32                                     length;
 
-
 /*
  * Common fields for objects that support ASL notifications
  */
 #define ACPI_COMMON_NOTIFY_INFO \
        union acpi_operand_object               *system_notify;     /* Handler for system notifies */\
        union acpi_operand_object               *device_notify;     /* Handler for driver notifies */\
-       union acpi_operand_object               *handler;           /* Handler for Address space */
-
+       union acpi_operand_object               *handler;       /* Handler for Address space */
 
 /******************************************************************************
  *
  *
  *****************************************************************************/
 
-struct acpi_object_common
-{
-       ACPI_OBJECT_COMMON_HEADER
-};
+struct acpi_object_common {
+ACPI_OBJECT_COMMON_HEADER};
 
-
-struct acpi_object_integer
-{
-       ACPI_OBJECT_COMMON_HEADER
-       acpi_integer                            value;
+struct acpi_object_integer {
+       ACPI_OBJECT_COMMON_HEADER acpi_integer value;
 };
 
-
 /*
  * Note: The String and Buffer object must be identical through the Pointer
  * element.  There is code that depends on this.
  */
-struct acpi_object_string           /* Null terminated, ASCII characters only */
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_BUFFER_INFO
-       char                                    *pointer;           /* String in AML stream or allocated string */
+struct acpi_object_string {    /* Null terminated, ASCII characters only */
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer;        /* String in AML stream or allocated string */
 };
 
-
-struct acpi_object_buffer
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_BUFFER_INFO
-       u8                                      *pointer;           /* Buffer in AML stream or allocated buffer */
-       struct acpi_namespace_node              *node;              /* Link back to parent node */
-       u8                                      *aml_start;
-       u32                                     aml_length;
+struct acpi_object_buffer {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */
+       struct acpi_namespace_node *node;       /* Link back to parent node */
+       u8 *aml_start;
+       u32 aml_length;
 };
 
-
-struct acpi_object_package
-{
-       ACPI_OBJECT_COMMON_HEADER
-
-       u32                                     count;              /* # of elements in package */
-       u32                                     aml_length;
-       u8                                      *aml_start;
-       struct acpi_namespace_node              *node;              /* Link back to parent node */
-       union acpi_operand_object               **elements;         /* Array of pointers to acpi_objects */
+struct acpi_object_package {
+       ACPI_OBJECT_COMMON_HEADER u32 count;    /* # of elements in package */
+       u32 aml_length;
+       u8 *aml_start;
+       struct acpi_namespace_node *node;       /* Link back to parent node */
+       union acpi_operand_object **elements;   /* Array of pointers to acpi_objects */
 };
 
-
 /******************************************************************************
  *
  * Complex data types
  *
  *****************************************************************************/
 
-struct acpi_object_event
-{
-       ACPI_OBJECT_COMMON_HEADER
-       void                                    *semaphore;
+struct acpi_object_event {
+       ACPI_OBJECT_COMMON_HEADER void *semaphore;
 };
 
-
 #define ACPI_INFINITE_CONCURRENCY   0xFF
 
 typedef
-acpi_status (*ACPI_INTERNAL_METHOD) (
-       struct acpi_walk_state          *walk_state);
-
-struct acpi_object_method
-{
-       ACPI_OBJECT_COMMON_HEADER
-       u8                                      method_flags;
-       u8                                      param_count;
-       u32                                     aml_length;
-       void                                    *semaphore;
-       u8                                      *aml_start;
-       ACPI_INTERNAL_METHOD            implementation;
-       u8                                      concurrency;
-       u8                                      thread_count;
-       acpi_owner_id                           owning_id;
+acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
+
+struct acpi_object_method {
+       ACPI_OBJECT_COMMON_HEADER u8 method_flags;
+       u8 param_count;
+       u32 aml_length;
+       void *semaphore;
+       u8 *aml_start;
+       ACPI_INTERNAL_METHOD implementation;
+       u8 concurrency;
+       u8 thread_count;
+       acpi_owner_id owner_id;
 };
 
-
-struct acpi_object_mutex
-{
-       ACPI_OBJECT_COMMON_HEADER
-       u8                                      sync_level;         /* 0-15, specified in Mutex() call */
-       u16                                     acquisition_depth;  /* Allow multiple Acquires, same thread */
-       struct acpi_thread_state                *owner_thread;      /* Current owner of the mutex */
-       void                                    *semaphore;         /* Actual OS synchronization object */
-       union acpi_operand_object               *prev;              /* Link for list of acquired mutexes */
-       union acpi_operand_object               *next;              /* Link for list of acquired mutexes */
-       struct acpi_namespace_node              *node;              /* Containing namespace node */
-       u8                                      original_sync_level; /* Owner's original sync level (0-15) */
+struct acpi_object_mutex {
+       ACPI_OBJECT_COMMON_HEADER u8 sync_level;        /* 0-15, specified in Mutex() call */
+       u16 acquisition_depth;  /* Allow multiple Acquires, same thread */
+       struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
+       void *semaphore;        /* Actual OS synchronization object */
+       union acpi_operand_object *prev;        /* Link for list of acquired mutexes */
+       union acpi_operand_object *next;        /* Link for list of acquired mutexes */
+       struct acpi_namespace_node *node;       /* Containing namespace node */
+       u8 original_sync_level; /* Owner's original sync level (0-15) */
 };
 
-
-struct acpi_object_region
-{
-       ACPI_OBJECT_COMMON_HEADER
-
-       u8                                      space_id;
-       union acpi_operand_object               *handler;           /* Handler for region access */
-       struct acpi_namespace_node              *node;              /* Containing namespace node */
-       union acpi_operand_object               *next;
-       u32                                     length;
-       acpi_physical_address                   address;
+struct acpi_object_region {
+       ACPI_OBJECT_COMMON_HEADER u8 space_id;
+       union acpi_operand_object *handler;     /* Handler for region access */
+       struct acpi_namespace_node *node;       /* Containing namespace node */
+       union acpi_operand_object *next;
+       u32 length;
+       acpi_physical_address address;
 };
 
-
 /******************************************************************************
  *
  * Objects that can be notified.  All share a common notify_info area.
  *
  *****************************************************************************/
 
-struct acpi_object_notify_common            /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_NOTIFY_INFO
-};
-
-
-struct acpi_object_device
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_NOTIFY_INFO
-       struct acpi_gpe_block_info              *gpe_block;
-};
-
+struct acpi_object_notify_common {     /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
+ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
 
-struct acpi_object_power_resource
-{
+struct acpi_object_device {
        ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_NOTIFY_INFO
-       u32                                     system_level;
-       u32                                     resource_order;
+           ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block;
 };
 
-
-struct acpi_object_processor
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_NOTIFY_INFO
-       u32                                     proc_id;
-       u32                                     length;
-       acpi_io_address                         address;
+struct acpi_object_power_resource {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level;
+       u32 resource_order;
 };
 
-
-struct acpi_object_thermal_zone
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_NOTIFY_INFO
+struct acpi_object_processor {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id;
+       u32 length;
+       acpi_io_address address;
 };
 
+struct acpi_object_thermal_zone {
+ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
 
 /******************************************************************************
  *
@@ -283,90 +227,63 @@ struct acpi_object_thermal_zone
  *
  *****************************************************************************/
 
-struct acpi_object_field_common                         /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_FIELD_INFO
-       union acpi_operand_object               *region_obj;        /* Containing Operation Region object */
-                         /* (REGION/BANK fields only) */
+struct acpi_object_field_common {      /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */
+       /* (REGION/BANK fields only) */
 };
 
-
-struct acpi_object_region_field
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_FIELD_INFO
-       union acpi_operand_object               *region_obj;        /* Containing op_region object */
+struct acpi_object_region_field {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
 };
 
-
-struct acpi_object_bank_field
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_FIELD_INFO
-       union acpi_operand_object               *region_obj;        /* Containing op_region object */
-       union acpi_operand_object               *bank_obj;          /* bank_select Register object */
+struct acpi_object_bank_field {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
+       union acpi_operand_object *bank_obj;    /* bank_select Register object */
 };
 
-
-struct acpi_object_index_field
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_FIELD_INFO
-
-       /*
-        * No "region_obj" pointer needed since the Index and Data registers
-        * are each field definitions unto themselves.
-        */
-       union acpi_operand_object               *index_obj;         /* Index register */
-       union acpi_operand_object               *data_obj;          /* Data register */
+struct acpi_object_index_field {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
+           /*
+            * No "region_obj" pointer needed since the Index and Data registers
+            * are each field definitions unto themselves.
+            */
+       union acpi_operand_object *index_obj;   /* Index register */
+       union acpi_operand_object *data_obj;    /* Data register */
 };
 
-
 /* The buffer_field is different in that it is part of a Buffer, not an op_region */
 
-struct acpi_object_buffer_field
-{
-       ACPI_OBJECT_COMMON_HEADER
-       ACPI_COMMON_FIELD_INFO
-       union acpi_operand_object               *buffer_obj;        /* Containing Buffer object */
+struct acpi_object_buffer_field {
+       ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */
 };
 
-
 /******************************************************************************
  *
  * Objects for handlers
  *
  *****************************************************************************/
 
-struct acpi_object_notify_handler
-{
-       ACPI_OBJECT_COMMON_HEADER
-       struct acpi_namespace_node              *node;              /* Parent device */
-       acpi_notify_handler                     handler;
-       void                                    *context;
+struct acpi_object_notify_handler {
+       ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node;     /* Parent device */
+       acpi_notify_handler handler;
+       void *context;
 };
 
-
 /* Flags for address handler */
 
 #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x1
 
-
-struct acpi_object_addr_handler
-{
-       ACPI_OBJECT_COMMON_HEADER
-       u8                                      space_id;
-       u16                                     hflags;
-       acpi_adr_space_handler                  handler;
-       struct acpi_namespace_node              *node;              /* Parent device */
-       void                                    *context;
-       acpi_adr_space_setup                    setup;
-       union acpi_operand_object               *region_list;       /* regions using this handler */
-       union acpi_operand_object               *next;
+struct acpi_object_addr_handler {
+       ACPI_OBJECT_COMMON_HEADER u8 space_id;
+       u16 hflags;
+       acpi_adr_space_handler handler;
+       struct acpi_namespace_node *node;       /* Parent device */
+       void *context;
+       acpi_adr_space_setup setup;
+       union acpi_operand_object *region_list; /* regions using this handler */
+       union acpi_operand_object *next;
 };
 
-
 /******************************************************************************
  *
  * Special internal objects
@@ -377,18 +294,15 @@ struct acpi_object_addr_handler
  * The Reference object type is used for these opcodes:
  * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op
  */
-struct acpi_object_reference
-{
-       ACPI_OBJECT_COMMON_HEADER
-       u8                                      target_type;        /* Used for index_op */
-       u16                                     opcode;
-       u32                                     offset;             /* Used for arg_op, local_op, and index_op */
-       void                                    *object;            /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object  */
-       struct acpi_namespace_node              *node;
-       union acpi_operand_object               **where;
+struct acpi_object_reference {
+       ACPI_OBJECT_COMMON_HEADER u8 target_type;       /* Used for index_op */
+       u16 opcode;
+       u32 offset;             /* Used for arg_op, local_op, and index_op */
+       void *object;           /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object  */
+       struct acpi_namespace_node *node;
+       union acpi_operand_object **where;
 };
 
-
 /*
  * Extra object is used as additional storage for types that
  * have AML code in their declarations (term_args) that must be
@@ -396,73 +310,62 @@ struct acpi_object_reference
  *
  * Currently: Region and field_unit types
  */
-struct acpi_object_extra
-{
-       ACPI_OBJECT_COMMON_HEADER
-       u8                                      byte_fill1;
-       u16                                     word_fill1;
-       u32                                     aml_length;
-       u8                                      *aml_start;
-       struct acpi_namespace_node              *method_REG;        /* _REG method for this region (if any) */
-       void                                    *region_context;    /* Region-specific data */
+struct acpi_object_extra {
+       ACPI_OBJECT_COMMON_HEADER u8 byte_fill1;
+       u16 word_fill1;
+       u32 aml_length;
+       u8 *aml_start;
+       struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
+       void *region_context;   /* Region-specific data */
 };
 
-
 /* Additional data that can be attached to namespace nodes */
 
-struct acpi_object_data
-{
-       ACPI_OBJECT_COMMON_HEADER
-       acpi_object_handler                     handler;
-       void                                    *pointer;
+struct acpi_object_data {
+       ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
+       void *pointer;
 };
 
-
 /* Structure used when objects are cached for reuse */
 
-struct acpi_object_cache_list
-{
-       ACPI_OBJECT_COMMON_HEADER
-       union acpi_operand_object               *next;              /* Link for object cache and internal lists*/
+struct acpi_object_cache_list {
+       ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next;      /* Link for object cache and internal lists */
 };
 
-
 /******************************************************************************
  *
  * union acpi_operand_object Descriptor - a giant union of all of the above
  *
  *****************************************************************************/
 
-union acpi_operand_object
-{
-       struct acpi_object_common               common;
-       struct acpi_object_integer              integer;
-       struct acpi_object_string               string;
-       struct acpi_object_buffer               buffer;
-       struct acpi_object_package              package;
-       struct acpi_object_event                event;
-       struct acpi_object_method               method;
-       struct acpi_object_mutex                mutex;
-       struct acpi_object_region               region;
-       struct acpi_object_notify_common        common_notify;
-       struct acpi_object_device               device;
-       struct acpi_object_power_resource       power_resource;
-       struct acpi_object_processor            processor;
-       struct acpi_object_thermal_zone         thermal_zone;
-       struct acpi_object_field_common         common_field;
-       struct acpi_object_region_field         field;
-       struct acpi_object_buffer_field         buffer_field;
-       struct acpi_object_bank_field           bank_field;
-       struct acpi_object_index_field          index_field;
-       struct acpi_object_notify_handler       notify;
-       struct acpi_object_addr_handler         address_space;
-       struct acpi_object_reference            reference;
-       struct acpi_object_extra                extra;
-       struct acpi_object_data                 data;
-       struct acpi_object_cache_list           cache;
+union acpi_operand_object {
+       struct acpi_object_common common;
+       struct acpi_object_integer integer;
+       struct acpi_object_string string;
+       struct acpi_object_buffer buffer;
+       struct acpi_object_package package;
+       struct acpi_object_event event;
+       struct acpi_object_method method;
+       struct acpi_object_mutex mutex;
+       struct acpi_object_region region;
+       struct acpi_object_notify_common common_notify;
+       struct acpi_object_device device;
+       struct acpi_object_power_resource power_resource;
+       struct acpi_object_processor processor;
+       struct acpi_object_thermal_zone thermal_zone;
+       struct acpi_object_field_common common_field;
+       struct acpi_object_region_field field;
+       struct acpi_object_buffer_field buffer_field;
+       struct acpi_object_bank_field bank_field;
+       struct acpi_object_index_field index_field;
+       struct acpi_object_notify_handler notify;
+       struct acpi_object_addr_handler address_space;
+       struct acpi_object_reference reference;
+       struct acpi_object_extra extra;
+       struct acpi_object_data data;
+       struct acpi_object_cache_list cache;
 };
 
-
 /******************************************************************************
  *
  * union acpi_descriptor - objects that share a common descriptor identifier
@@ -471,7 +374,7 @@ union acpi_operand_object
 
 /* Object descriptor types */
 
-#define ACPI_DESC_TYPE_CACHED           0x01        /* Used only when object is cached */
+#define ACPI_DESC_TYPE_CACHED           0x01   /* Used only when object is cached */
 #define ACPI_DESC_TYPE_STATE            0x02
 #define ACPI_DESC_TYPE_STATE_UPDATE     0x03
 #define ACPI_DESC_TYPE_STATE_PACKAGE    0x04
@@ -488,14 +391,11 @@ union acpi_operand_object
 #define ACPI_DESC_TYPE_NAMED            0x0F
 #define ACPI_DESC_TYPE_MAX              0x0F
 
-
-union acpi_descriptor
-{
-       u8                                      descriptor_id;  /* To differentiate various internal objs */\
-       union acpi_operand_object               object;
-       struct acpi_namespace_node              node;
-       union acpi_parse_object                 op;
+union acpi_descriptor {
+       u8 descriptor_id;       /* To differentiate various internal objs */
+       union acpi_operand_object object;
+       struct acpi_namespace_node node;
+       union acpi_parse_object op;
 };
 
-
-#endif /* _ACOBJECT_H */
+#endif                         /* _ACOBJECT_H */
index 118ecba4cf05e056f255f9dc4922e8434e03e2df..64da42992199f58e826aee308277e31ba3cc3a60 100644 (file)
@@ -62,7 +62,6 @@
 #define _NAM                        0x6C
 #define _PFX                        0x6D
 
-
 /*
  * All AML opcodes and the parse-time arguments for each.  Used by the AML
  * parser  Each list is compressed into a 32-bit number and stored in the
 #define ARGP_WORD_OP                    ARGP_LIST1 (ARGP_WORDDATA)
 #define ARGP_ZERO_OP                    ARG_NONE
 
-
 /*
  * All AML opcodes and the runtime arguments for each.  Used by the AML
  * interpreter  Each list is compressed into a 32-bit number and stored
 #define ARGI_FIELD_OP                   ARGI_INVALID_OPCODE
 #define ARGI_FIND_SET_LEFT_BIT_OP       ARGI_LIST2 (ARGI_INTEGER,    ARGI_TARGETREF)
 #define ARGI_FIND_SET_RIGHT_BIT_OP      ARGI_LIST2 (ARGI_INTEGER,    ARGI_TARGETREF)
-#define ARGI_FROM_BCD_OP                ARGI_LIST2 (ARGI_INTEGER,    ARGI_TARGETREF)
+#define ARGI_FROM_BCD_OP                ARGI_LIST2 (ARGI_INTEGER,    ARGI_FIXED_TARGET)
 #define ARGI_IF_OP                      ARGI_INVALID_OPCODE
 #define ARGI_INCREMENT_OP               ARGI_LIST1 (ARGI_INTEGER_REF)
 #define ARGI_INDEX_FIELD_OP             ARGI_INVALID_OPCODE
 #define ARGI_WORD_OP                    ARGI_INVALID_OPCODE
 #define ARGI_ZERO_OP                    ARG_NONE
 
-#endif /* __ACOPCODE_H__ */
+#endif                         /* __ACOPCODE_H__ */
index 2fbe180fee6b47841c515d1893847523ea54757e..68d7edf0f6979ebe87007ed2d215859d11526e99 100644 (file)
 #define ACPI_ALL_COMPONENTS         0x00003FFF
 #define ACPI_COMPONENT_DEFAULT      (ACPI_ALL_COMPONENTS)
 
-
 /* Component IDs reserved for ACPI drivers */
 
 #define ACPI_ALL_DRIVERS            0xFFFF0000
 
-
 /*
  * Raw debug output levels, do not use these in the DEBUG_PRINT macros
  */
 
 #define ACPI_LV_VERBOSE             0xF0000000
 
-
 /*
  * Debug level macros that are used in the DEBUG_PRINT macros
  */
-#define ACPI_DEBUG_LEVEL(dl)        (u32) dl,__LINE__,&_debug_info
+#define ACPI_DEBUG_LEVEL(dl)        (u32) dl,ACPI_DEBUG_PARAMETERS
 
 /* Exception level -- used in the global "debug_level" */
 
 #define ACPI_DB_INFO                ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
 #define ACPI_DB_ALL_EXCEPTIONS      ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
 
-
 /* Trace level -- also used in the global "debug_level" */
 
 #define ACPI_DB_INIT_NAMES          ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
 
 #define ACPI_DB_ALL                 ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
 
-
 /* Defaults for debug_level, debug and normal */
 
 #define ACPI_DEBUG_DEFAULT          (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
 #define ACPI_NORMAL_DEFAULT         (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT)
 #define ACPI_DEBUG_ALL              (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
 
-
-#endif /* __ACOUTPUT_H__ */
+#endif                         /* __ACOUTPUT_H__ */
index 69827657181864dec118477184d5658c2b8e8348..d352d40de1f3210ae66a1571ec73dd5afa857ed2 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ACPARSER_H__
 #define __ACPARSER_H__
 
-
 #define OP_HAS_RETURN_VALUE             1
 
 /* variable # arguments */
 
 #define ACPI_VAR_ARGS                   ACPI_UINT32_MAX
 
-
 #define ACPI_PARSE_DELETE_TREE          0x0001
 #define ACPI_PARSE_NO_TREE_DELETE       0x0000
 #define ACPI_PARSE_TREE_MASK            0x0001
@@ -63,7 +60,7 @@
 #define ACPI_PARSE_MODE_MASK            0x0030
 
 #define ACPI_PARSE_DEFERRED_OP          0x0100
-
+#define ACPI_PARSE_DISASSEMBLE          0x0200
 
 /******************************************************************************
  *
  *
  *****************************************************************************/
 
-
 /*
  * psxface - Parser external interfaces
  */
-acpi_status
-acpi_psx_load_table (
-       u8                              *pcode_addr,
-       u32                             pcode_length);
-
-acpi_status
-acpi_psx_execute (
-       struct acpi_parameter_info      *info);
-
+acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info);
 
 /*
  * psargs - Parse AML opcode arguments
  */
-u8 *
-acpi_ps_get_next_package_end (
-       struct acpi_parse_state         *parser_state);
+u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state);
 
-char *
-acpi_ps_get_next_namestring (
-       struct acpi_parse_state         *parser_state);
+char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state);
 
 void
-acpi_ps_get_next_simple_arg (
-       struct acpi_parse_state         *parser_state,
-       u32                             arg_type,
-       union acpi_parse_object         *arg);
+acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
+                           u32 arg_type, union acpi_parse_object *arg);
 
 acpi_status
-acpi_ps_get_next_namepath (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *arg,
-       u8                              method_call);
+acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
+                         struct acpi_parse_state *parser_state,
+                         union acpi_parse_object *arg, u8 method_call);
 
 acpi_status
-acpi_ps_get_next_arg (
-       struct acpi_walk_state          *walk_state,
-       struct acpi_parse_state         *parser_state,
-       u32                             arg_type,
-       union acpi_parse_object         **return_arg);
-
+acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
+                    struct acpi_parse_state *parser_state,
+                    u32 arg_type, union acpi_parse_object **return_arg);
 
 /*
  * psfind
  */
-union acpi_parse_object *
-acpi_ps_find_name (
-       union acpi_parse_object         *scope,
-       u32                             name,
-       u32                             opcode);
-
-union acpi_parse_object*
-acpi_ps_get_parent (
-       union acpi_parse_object         *op);
+union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
+                                          u32 name, u32 opcode);
 
+union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
 
 /*
  * psopcode - AML Opcode information
  */
-const struct acpi_opcode_info *
-acpi_ps_get_opcode_info (
-       u16                             opcode);
-
-char *
-acpi_ps_get_opcode_name (
-       u16                             opcode);
+const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
 
+char *acpi_ps_get_opcode_name(u16 opcode);
 
 /*
  * psparse - top level parsing routines
  */
-acpi_status
-acpi_ps_parse_aml (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state);
 
-u32
-acpi_ps_get_opcode_size (
-       u32                             opcode);
+u32 acpi_ps_get_opcode_size(u32 opcode);
 
-u16
-acpi_ps_peek_opcode (
-       struct acpi_parse_state         *state);
+u16 acpi_ps_peek_opcode(struct acpi_parse_state *state);
 
+acpi_status
+acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op);
+
+acpi_status
+acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op,
+                        acpi_status callback_status);
+
+/*
+ * psloop - main parse loop
+ */
+acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state);
 
 /*
  * psscope - Scope stack management routines
  */
 acpi_status
-acpi_ps_init_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *root);
+acpi_ps_init_scope(struct acpi_parse_state *parser_state,
+                  union acpi_parse_object *root);
 
-union acpi_parse_object *
-acpi_ps_get_parent_scope (
-       struct acpi_parse_state         *state);
+union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
+                                                 *state);
 
-u8
-acpi_ps_has_completed_scope (
-       struct acpi_parse_state         *parser_state);
+u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
 
 void
-acpi_ps_pop_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         **op,
-       u32                             *arg_list,
-       u32                             *arg_count);
+acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
+                 union acpi_parse_object **op,
+                 u32 * arg_list, u32 * arg_count);
 
 acpi_status
-acpi_ps_push_scope (
-       struct acpi_parse_state         *parser_state,
-       union acpi_parse_object         *op,
-       u32                             remaining_args,
-       u32                             arg_count);
-
-void
-acpi_ps_cleanup_scope (
-       struct acpi_parse_state         *state);
+acpi_ps_push_scope(struct acpi_parse_state *parser_state,
+                  union acpi_parse_object *op,
+                  u32 remaining_args, u32 arg_count);
 
+void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
 
 /*
  * pstree - parse tree manipulation routines
  */
 void
-acpi_ps_append_arg(
-       union acpi_parse_object         *op,
-       union acpi_parse_object         *arg);
-
-union acpi_parse_object*
-acpi_ps_find (
-       union acpi_parse_object         *scope,
-       char                            *path,
-       u16                             opcode,
-       u32                             create);
-
-union acpi_parse_object *
-acpi_ps_get_arg(
-       union acpi_parse_object         *op,
-       u32                              argn);
+acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg);
 
-#ifdef ACPI_FUTURE_USAGE
-union acpi_parse_object *
-acpi_ps_get_depth_next (
-       union acpi_parse_object         *origin,
-       union acpi_parse_object         *op);
-#endif /* ACPI_FUTURE_USAGE */
+union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope,
+                                     char *path, u16 opcode, u32 create);
 
+union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn);
+
+#ifdef ACPI_FUTURE_USAGE
+union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
+                                               union acpi_parse_object *op);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*
  * pswalk - parse tree walk routines
  */
 acpi_status
-acpi_ps_walk_parsed_aml (
-       union acpi_parse_object         *start_op,
-       union acpi_parse_object         *end_op,
-       union acpi_operand_object       *mth_desc,
-       struct acpi_namespace_node      *start_node,
-       union acpi_operand_object       **params,
-       union acpi_operand_object       **caller_return_desc,
-       acpi_owner_id                   owner_id,
-       acpi_parse_downwards            descending_callback,
-       acpi_parse_upwards              ascending_callback);
-
-acpi_status
-acpi_ps_get_next_walk_op (
-       struct acpi_walk_state          *walk_state,
-       union acpi_parse_object         *op,
-       acpi_parse_upwards              ascending_callback);
+acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op,
+                       union acpi_parse_object *end_op,
+                       union acpi_operand_object *mth_desc,
+                       struct acpi_namespace_node *start_node,
+                       union acpi_operand_object **params,
+                       union acpi_operand_object **caller_return_desc,
+                       acpi_owner_id owner_id,
+                       acpi_parse_downwards descending_callback,
+                       acpi_parse_upwards ascending_callback);
 
 acpi_status
-acpi_ps_delete_completed_op (
-       struct acpi_walk_state          *walk_state);
+acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state,
+                        union acpi_parse_object *op,
+                        acpi_parse_upwards ascending_callback);
 
-void
-acpi_ps_delete_parse_tree (
-       union acpi_parse_object         *root);
+acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state);
 
+void acpi_ps_delete_parse_tree(union acpi_parse_object *root);
 
 /*
  * psutils - parser utilities
  */
-union acpi_parse_object *
-acpi_ps_create_scope_op (
-       void);
+union acpi_parse_object *acpi_ps_create_scope_op(void);
 
-void
-acpi_ps_init_op (
-       union acpi_parse_object         *op,
-       u16                             opcode);
+void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode);
 
-union acpi_parse_object *
-acpi_ps_alloc_op (
-       u16                             opcode);
+union acpi_parse_object *acpi_ps_alloc_op(u16 opcode);
 
-void
-acpi_ps_free_op (
-       union acpi_parse_object         *op);
+void acpi_ps_free_op(union acpi_parse_object *op);
 
-u8
-acpi_ps_is_leading_char (
-       u32                             c);
+u8 acpi_ps_is_leading_char(u32 c);
 
-u8
-acpi_ps_is_prefix_char (
-       u32                             c);
+u8 acpi_ps_is_prefix_char(u32 c);
 
 #ifdef ACPI_FUTURE_USAGE
-u32
-acpi_ps_get_name(
-       union acpi_parse_object         *op);
-#endif /* ACPI_FUTURE_USAGE */
-
-void
-acpi_ps_set_name(
-       union acpi_parse_object         *op,
-       u32                             name);
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ps_delete_parse_cache (
-       void);
-#endif
+u32 acpi_ps_get_name(union acpi_parse_object *op);
+#endif                         /* ACPI_FUTURE_USAGE */
 
+void acpi_ps_set_name(union acpi_parse_object *op, u32 name);
 
 /*
  * psdump - display parser tree
  */
 u32
-acpi_ps_sprint_path (
-       char                            *buffer_start,
-       u32                             buffer_size,
-       union acpi_parse_object         *op);
+acpi_ps_sprint_path(char *buffer_start,
+                   u32 buffer_size, union acpi_parse_object *op);
 
 u32
-acpi_ps_sprint_op (
-       char                            *buffer_start,
-       u32                             buffer_size,
-       union acpi_parse_object         *op);
-
-void
-acpi_ps_show (
-       union acpi_parse_object         *op);
+acpi_ps_sprint_op(char *buffer_start,
+                 u32 buffer_size, union acpi_parse_object *op);
 
+void acpi_ps_show(union acpi_parse_object *op);
 
-#endif /* __ACPARSER_H__ */
+#endif                         /* __ACPARSER_H__ */
index a69d78942040c549f8362db736da55318bec4a08..ccf34f9dac642c4baf08a102bec003ab3ab4c388 100644 (file)
  * We put them here because we don't want to duplicate them
  * in the rest of the source code again and again.
  */
-#include "acnames.h"            /* Global ACPI names and strings */
-#include "acconfig.h"           /* Configuration constants */
-#include "platform/acenv.h"     /* Target environment specific items */
-#include "actypes.h"            /* Fundamental common data types */
-#include "acexcep.h"            /* ACPI exception codes */
-#include "acmacros.h"           /* C macros */
-#include "actbl.h"              /* ACPI table definitions */
-#include "aclocal.h"            /* Internal data types */
-#include "acoutput.h"           /* Error output and Debug macros */
-#include "acpiosxf.h"           /* Interfaces to the ACPI-to-OS layer*/
-#include "acpixf.h"             /* ACPI core subsystem external interfaces */
-#include "acobject.h"           /* ACPI internal object */
-#include "acstruct.h"           /* Common structures */
-#include "acglobal.h"           /* All global variables */
-#include "achware.h"            /* Hardware defines and interfaces */
-#include "acutils.h"            /* Utility interfaces */
+#include "acnames.h"           /* Global ACPI names and strings */
+#include "acconfig.h"          /* Configuration constants */
+#include "platform/acenv.h"    /* Target environment specific items */
+#include "actypes.h"           /* Fundamental common data types */
+#include "acexcep.h"           /* ACPI exception codes */
+#include "acmacros.h"          /* C macros */
+#include "actbl.h"             /* ACPI table definitions */
+#include "aclocal.h"           /* Internal data types */
+#include "acoutput.h"          /* Error output and Debug macros */
+#include "acpiosxf.h"          /* Interfaces to the ACPI-to-OS layer */
+#include "acpixf.h"            /* ACPI core subsystem external interfaces */
+#include "acobject.h"          /* ACPI internal object */
+#include "acstruct.h"          /* Common structures */
+#include "acglobal.h"          /* All global variables */
+#include "achware.h"           /* Hardware defines and interfaces */
+#include "acutils.h"           /* Utility interfaces */
 
-
-#endif /* __ACPI_H__ */
+#endif                         /* __ACPI_H__ */
index 8d0e1290bc7626eef77e6cf264687c1b3559cfe5..0b54e9a4a8a1fdbdc9d2f8a560720fef51f55fe0 100644 (file)
 /* TBD: Make dynamic */
 #define ACPI_MAX_HANDLES       10
 struct acpi_handle_list {
-       u32                     count;
-       acpi_handle             handles[ACPI_MAX_HANDLES];
+       u32 count;
+       acpi_handle handles[ACPI_MAX_HANDLES];
 };
 
-
 /* acpi_utils.h */
 acpi_status
-acpi_extract_package (
-       union acpi_object       *package,
-       struct acpi_buffer      *format,
-       struct acpi_buffer      *buffer);
+acpi_extract_package(union acpi_object *package,
+                    struct acpi_buffer *format, struct acpi_buffer *buffer);
 acpi_status
-acpi_evaluate_integer (
-       acpi_handle             handle,
-       acpi_string             pathname,
-       struct acpi_object_list *arguments,
-       unsigned long           *data);
+acpi_evaluate_integer(acpi_handle handle,
+                     acpi_string pathname,
+                     struct acpi_object_list *arguments, unsigned long *data);
 acpi_status
-acpi_evaluate_reference (
-       acpi_handle             handle,
-       acpi_string             pathname,
-       struct acpi_object_list *arguments,
-       struct acpi_handle_list *list);
-
+acpi_evaluate_reference(acpi_handle handle,
+                       acpi_string pathname,
+                       struct acpi_object_list *arguments,
+                       struct acpi_handle_list *list);
 
-#ifdef CONFIG_ACPI_BUS
+#ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
 
 #define ACPI_BUS_FILE_ROOT     "acpi"
-extern struct proc_dir_entry   *acpi_root_dir;
-extern FADT_DESCRIPTOR         acpi_fadt;
+extern struct proc_dir_entry *acpi_root_dir;
+extern FADT_DESCRIPTOR acpi_fadt;
 
 enum acpi_bus_removal_type {
-       ACPI_BUS_REMOVAL_NORMAL = 0,
+       ACPI_BUS_REMOVAL_NORMAL = 0,
        ACPI_BUS_REMOVAL_EJECT,
        ACPI_BUS_REMOVAL_SUPRISE,
        ACPI_BUS_REMOVAL_TYPE_COUNT
 };
 
 enum acpi_bus_device_type {
-       ACPI_BUS_TYPE_DEVICE    = 0,
+       ACPI_BUS_TYPE_DEVICE = 0,
        ACPI_BUS_TYPE_POWER,
        ACPI_BUS_TYPE_PROCESSOR,
        ACPI_BUS_TYPE_THERMAL,
@@ -89,61 +82,60 @@ enum acpi_bus_device_type {
 struct acpi_driver;
 struct acpi_device;
 
-
 /*
  * ACPI Driver
  * -----------
  */
 
-typedef int (*acpi_op_add)     (struct acpi_device *device);
-typedef int (*acpi_op_remove)  (struct acpi_device *device, int type);
-typedef int (*acpi_op_lock)    (struct acpi_device *device, int type);
-typedef int (*acpi_op_start)   (struct acpi_device *device);
-typedef int (*acpi_op_stop)    (struct acpi_device *device, int type);
-typedef int (*acpi_op_suspend) (struct acpi_device *device, int state);
-typedef int (*acpi_op_resume)  (struct acpi_device *device, int state);
-typedef int (*acpi_op_scan)    (struct acpi_device *device);
-typedef int (*acpi_op_bind)    (struct acpi_device *device);
-typedef int (*acpi_op_unbind)  (struct acpi_device *device);
-typedef int (*acpi_op_match)   (struct acpi_device *device,
-                                struct acpi_driver *driver);
+typedef int (*acpi_op_add) (struct acpi_device * device);
+typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
+typedef int (*acpi_op_lock) (struct acpi_device * device, int type);
+typedef int (*acpi_op_start) (struct acpi_device * device);
+typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
+typedef int (*acpi_op_suspend) (struct acpi_device * device, int state);
+typedef int (*acpi_op_resume) (struct acpi_device * device, int state);
+typedef int (*acpi_op_scan) (struct acpi_device * device);
+typedef int (*acpi_op_bind) (struct acpi_device * device);
+typedef int (*acpi_op_unbind) (struct acpi_device * device);
+typedef int (*acpi_op_match) (struct acpi_device * device,
+                             struct acpi_driver * driver);
 
 struct acpi_bus_ops {
-       u32                     acpi_op_add:1;
-       u32                     acpi_op_remove:1;
-       u32                     acpi_op_lock:1;
-       u32                     acpi_op_start:1;
-       u32                     acpi_op_stop:1;
-       u32                     acpi_op_suspend:1;
-       u32                     acpi_op_resume:1;
-       u32                     acpi_op_scan:1;
-       u32                     acpi_op_bind:1;
-       u32                     acpi_op_unbind:1;
-       u32                     acpi_op_match:1;
-       u32                     reserved:21;
+       u32 acpi_op_add:1;
+       u32 acpi_op_remove:1;
+       u32 acpi_op_lock:1;
+       u32 acpi_op_start:1;
+       u32 acpi_op_stop:1;
+       u32 acpi_op_suspend:1;
+       u32 acpi_op_resume:1;
+       u32 acpi_op_scan:1;
+       u32 acpi_op_bind:1;
+       u32 acpi_op_unbind:1;
+       u32 acpi_op_match:1;
+       u32 reserved:21;
 };
 
 struct acpi_device_ops {
-       acpi_op_add             add;
-       acpi_op_remove          remove;
-       acpi_op_lock            lock;
-       acpi_op_start           start;
-       acpi_op_stop            stop;
-       acpi_op_suspend         suspend;
-       acpi_op_resume          resume;
-       acpi_op_scan            scan;
-       acpi_op_bind            bind;
-       acpi_op_unbind          unbind;
-       acpi_op_match           match;
+       acpi_op_add add;
+       acpi_op_remove remove;
+       acpi_op_lock lock;
+       acpi_op_start start;
+       acpi_op_stop stop;
+       acpi_op_suspend suspend;
+       acpi_op_resume resume;
+       acpi_op_scan scan;
+       acpi_op_bind bind;
+       acpi_op_unbind unbind;
+       acpi_op_match match;
 };
 
 struct acpi_driver {
-       struct list_head        node;
-       char                    name[80];
-       char                    class[80];
-       atomic_t                references;
-       char                    *ids;           /* Supported Hardware IDs */
-       struct acpi_device_ops  ops;
+       struct list_head node;
+       char name[80];
+       char class[80];
+       atomic_t references;
+       char *ids;              /* Supported Hardware IDs */
+       struct acpi_device_ops ops;
 };
 
 /*
@@ -154,60 +146,57 @@ struct acpi_driver {
 /* Status (_STA) */
 
 struct acpi_device_status {
-       u32                     present:1;
-       u32                     enabled:1;
-       u32                     show_in_ui:1;
-       u32                     functional:1;
-       u32                     battery_present:1;
-       u32                     reserved:27;
+       u32 present:1;
+       u32 enabled:1;
+       u32 show_in_ui:1;
+       u32 functional:1;
+       u32 battery_present:1;
+       u32 reserved:27;
 };
 
-
 /* Flags */
 
 struct acpi_device_flags {
-       u32                     dynamic_status:1;
-       u32                     hardware_id:1;
-       u32                     compatible_ids:1;
-       u32                     bus_address:1;
-       u32                     unique_id:1;
-       u32                     removable:1;
-       u32                     ejectable:1;
-       u32                     lockable:1;
-       u32                     suprise_removal_ok:1;
-       u32                     power_manageable:1;
-       u32                     performance_manageable:1;
-       u32                     wake_capable:1; /* Wakeup(_PRW) supported? */
-       u32                     reserved:20;
+       u32 dynamic_status:1;
+       u32 hardware_id:1;
+       u32 compatible_ids:1;
+       u32 bus_address:1;
+       u32 unique_id:1;
+       u32 removable:1;
+       u32 ejectable:1;
+       u32 lockable:1;
+       u32 suprise_removal_ok:1;
+       u32 power_manageable:1;
+       u32 performance_manageable:1;
+       u32 wake_capable:1;     /* Wakeup(_PRW) supported? */
+       u32 reserved:20;
 };
 
-
 /* File System */
 
 struct acpi_device_dir {
-       struct proc_dir_entry   *entry;
+       struct proc_dir_entry *entry;
 };
 
 #define acpi_device_dir(d)     ((d)->dir.entry)
 
-
 /* Plug and Play */
 
-typedef char                   acpi_bus_id[5];
-typedef unsigned long          acpi_bus_address;
-typedef char                   acpi_hardware_id[9];
-typedef char                   acpi_unique_id[9];
-typedef char                   acpi_device_name[40];
-typedef char                   acpi_device_class[20];
+typedef char acpi_bus_id[5];
+typedef unsigned long acpi_bus_address;
+typedef char acpi_hardware_id[9];
+typedef char acpi_unique_id[9];
+typedef char acpi_device_name[40];
+typedef char acpi_device_class[20];
 
 struct acpi_device_pnp {
-       acpi_bus_id             bus_id;                        /* Object name */
-       acpi_bus_address        bus_address;                          /* _ADR */
-       acpi_hardware_id        hardware_id;                          /* _HID */
-       struct acpi_compatible_id_list *cid_list;                    /* _CIDs */
-       acpi_unique_id          unique_id;                            /* _UID */
-       acpi_device_name        device_name;             /* Driver-determined */
-       acpi_device_class       device_class;            /*        "          */
+       acpi_bus_id bus_id;     /* Object name */
+       acpi_bus_address bus_address;   /* _ADR */
+       acpi_hardware_id hardware_id;   /* _HID */
+       struct acpi_compatible_id_list *cid_list;       /* _CIDs */
+       acpi_unique_id unique_id;       /* _UID */
+       acpi_device_name device_name;   /* Driver-determined */
+       acpi_device_class device_class; /*        "          */
 };
 
 #define acpi_device_bid(d)     ((d)->pnp.bus_id)
@@ -217,114 +206,111 @@ struct acpi_device_pnp {
 #define acpi_device_name(d)    ((d)->pnp.device_name)
 #define acpi_device_class(d)   ((d)->pnp.device_class)
 
-
 /* Power Management */
 
 struct acpi_device_power_flags {
-       u32                     explicit_get:1;              /* _PSC present? */
-       u32                     power_resources:1;         /* Power resources */
-       u32                     inrush_current:1;         /* Serialize Dx->D0 */
-       u32                     power_removed:1;           /* Optimize Dx->D0 */
-       u32                     reserved:28;
+       u32 explicit_get:1;     /* _PSC present? */
+       u32 power_resources:1;  /* Power resources */
+       u32 inrush_current:1;   /* Serialize Dx->D0 */
+       u32 power_removed:1;    /* Optimize Dx->D0 */
+       u32 reserved:28;
 };
 
 struct acpi_device_power_state {
        struct {
-               u8                      valid:1;        
-               u8                      explicit_set:1;      /* _PSx present? */
-               u8                      reserved:6;
-       }                       flags;
-       int                     power;            /* % Power (compared to D0) */
-       int                     latency;        /* Dx->D0 time (microseconds) */
-       struct acpi_handle_list resources;      /* Power resources referenced */
+               u8 valid:1;
+               u8 explicit_set:1;      /* _PSx present? */
+               u8 reserved:6;
+       } flags;
+       int power;              /* % Power (compared to D0) */
+       int latency;            /* Dx->D0 time (microseconds) */
+       struct acpi_handle_list resources;      /* Power resources referenced */
 };
 
 struct acpi_device_power {
-       int                     state;                       /* Current state */
+       int state;              /* Current state */
        struct acpi_device_power_flags flags;
-       struct acpi_device_power_state states[4];     /* Power states (D0-D3) */
+       struct acpi_device_power_state states[4];       /* Power states (D0-D3) */
 };
 
-
 /* Performance Management */
 
 struct acpi_device_perf_flags {
-       u8                      reserved:8;
+       u8 reserved:8;
 };
 
 struct acpi_device_perf_state {
        struct {
-               u8                      valid:1;        
-               u8                      reserved:7;
-       }                       flags;
-       u8                      power;            /* % Power (compared to P0) */
-       u8                      performance;      /* % Performance (    "   ) */
-       int                     latency;        /* Px->P0 time (microseconds) */
+               u8 valid:1;
+               u8 reserved:7;
+       } flags;
+       u8 power;               /* % Power (compared to P0) */
+       u8 performance;         /* % Performance (    "   ) */
+       int latency;            /* Px->P0 time (microseconds) */
 };
 
 struct acpi_device_perf {
-       int                     state;
+       int state;
        struct acpi_device_perf_flags flags;
-       int                     state_count;
+       int state_count;
        struct acpi_device_perf_state *states;
 };
 
 /* Wakeup Management */
 struct acpi_device_wakeup_flags {
-       u8      valid:1; /* Can successfully enable wakeup? */
-       u8      run_wake:1; /* Run-Wake GPE devices */
+       u8 valid:1;             /* Can successfully enable wakeup? */
+       u8 run_wake:1;          /* Run-Wake GPE devices */
 };
 
 struct acpi_device_wakeup_state {
-       u8      enabled:1;
-       u8      active:1;
+       u8 enabled:1;
+       u8 active:1;
 };
 
 struct acpi_device_wakeup {
-       acpi_handle             gpe_device;
-       acpi_integer            gpe_number;;
-       acpi_integer            sleep_state;
-       struct acpi_handle_list resources;
-       struct acpi_device_wakeup_state state;
-       struct acpi_device_wakeup_flags flags;
+       acpi_handle gpe_device;
+       acpi_integer gpe_number;;
+       acpi_integer sleep_state;
+       struct acpi_handle_list resources;
+       struct acpi_device_wakeup_state state;
+       struct acpi_device_wakeup_flags flags;
 };
 
 /* Device */
 
 struct acpi_device {
-       acpi_handle             handle;
-       struct acpi_device      *parent;
-       struct list_head        children;
-       struct list_head        node;
-       struct list_head        wakeup_list;
-       struct list_head        g_list;
+       acpi_handle handle;
+       struct acpi_device *parent;
+       struct list_head children;
+       struct list_head node;
+       struct list_head wakeup_list;
+       struct list_head g_list;
        struct acpi_device_status status;
        struct acpi_device_flags flags;
-       struct acpi_device_pnp  pnp;
+       struct acpi_device_pnp pnp;
        struct acpi_device_power power;
        struct acpi_device_wakeup wakeup;
-       struct acpi_device_perf performance;
-       struct acpi_device_dir  dir;
-       struct acpi_device_ops  ops;
-       struct acpi_driver      *driver;
-       void                    *driver_data;
-       struct kobject          kobj;
+       struct acpi_device_perf performance;
+       struct acpi_device_dir dir;
+       struct acpi_device_ops ops;
+       struct acpi_driver *driver;
+       void *driver_data;
+       struct kobject kobj;
 };
 
 #define acpi_driver_data(d)    ((d)->driver_data)
 
-
 /*
  * Events
  * ------
  */
 
 struct acpi_bus_event {
-       struct list_head        node;
-       acpi_device_class       device_class;
-       acpi_bus_id             bus_id;
-       u32                     type;
-       u32                     data;
+       struct list_head node;
+       acpi_device_class device_class;
+       acpi_bus_id bus_id;
+       u32 type;
+       u32 data;
 };
 
 extern struct subsystem acpi_subsys;
@@ -335,34 +321,32 @@ extern struct subsystem acpi_subsys;
 
 int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
 void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context);
-int acpi_bus_get_status (struct acpi_device *device);
-int acpi_bus_get_power (acpi_handle handle, int *state);
-int acpi_bus_set_power (acpi_handle handle, int state);
-int acpi_bus_generate_event (struct acpi_device *device, u8 type, int data);
-int acpi_bus_receive_event (struct acpi_bus_event *event);
-int acpi_bus_register_driver (struct acpi_driver *driver);
-int acpi_bus_unregister_driver (struct acpi_driver *driver);
-int acpi_bus_add (struct acpi_device **child, struct acpi_device *parent,
-               acpi_handle handle, int type);
-int acpi_bus_start (struct acpi_device *device);
-
-
-int acpi_match_ids (struct acpi_device *device, char   *ids);
+int acpi_bus_get_status(struct acpi_device *device);
+int acpi_bus_get_power(acpi_handle handle, int *state);
+int acpi_bus_set_power(acpi_handle handle, int state);
+int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
+int acpi_bus_receive_event(struct acpi_bus_event *event);
+int acpi_bus_register_driver(struct acpi_driver *driver);
+int acpi_bus_unregister_driver(struct acpi_driver *driver);
+int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
+                acpi_handle handle, int type);
+int acpi_bus_start(struct acpi_device *device);
+
+int acpi_match_ids(struct acpi_device *device, char *ids);
 int acpi_create_dir(struct acpi_device *);
 void acpi_remove_dir(struct acpi_device *);
 
-
 /*
  * Bind physical devices with ACPI devices
  */
 #include <linux/device.h>
 struct acpi_bus_type {
-       struct list_head        list;
-       struct bus_type         *bus;
-       /* For general devices under the bus*/
-       int (*find_device)(struct device *, acpi_handle*);
+       struct list_head list;
+       struct bus_type *bus;
+       /* For general devices under the bus */
+       int (*find_device) (struct device *, acpi_handle *);
        /* For bridges, such as PCI root bridge, IDE controller */
-       int (*find_bridge)(struct device *, acpi_handle *);
+       int (*find_bridge) (struct device *, acpi_handle *);
 };
 int register_acpi_bus_type(struct acpi_bus_type *);
 int unregister_acpi_bus_type(struct acpi_bus_type *);
@@ -372,6 +356,6 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer);
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->firmware_data))
 
-#endif /*CONFIG_ACPI_BUS*/
+#endif /* CONFIG_ACPI */
 
 #endif /*__ACPI_BUS_H__*/
index 579fe191b7e7d3415fe9163568b575403e409a6a..c1b4e1f882e4a28c19e25e5c3518fed589c3eb11 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/acpi.h>
 #include <acpi/acpi_bus.h>
 
-
 #define ACPI_MAX_STRING                        80
 
 #define ACPI_BUS_COMPONENT             0x00010000
 #define ACPI_BUTTON_HID_POWERF         "ACPI_FPB"
 #define ACPI_BUTTON_HID_SLEEPF         "ACPI_FSB"
 
-
 /* --------------------------------------------------------------------------
                                        PCI
    -------------------------------------------------------------------------- */
 
-#ifdef CONFIG_ACPI_PCI
-
 #define ACPI_PCI_COMPONENT             0x00400000
 
 /* ACPI PCI Interrupt Link (pci_link.c) */
 
-int acpi_irq_penalty_init (void);
-int acpi_pci_link_allocate_irq (acpi_handle handle, int index, int *edge_level,
-       int *active_high_low, char **name);
+int acpi_irq_penalty_init(void);
+int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *edge_level,
+                              int *active_high_low, char **name);
 int acpi_pci_link_free_irq(acpi_handle handle);
 
 /* ACPI PCI Interrupt Routing (pci_irq.c) */
 
-int acpi_pci_irq_add_prt (acpi_handle handle, int segment, int bus);
-void acpi_pci_irq_del_prt (int segment, int bus);
+int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus);
+void acpi_pci_irq_del_prt(int segment, int bus);
 
 /* ACPI PCI Device Binding (pci_bind.c) */
 
 struct pci_bus;
 
-acpi_status acpi_get_pci_id (acpi_handle handle, struct acpi_pci_id *id);
-int acpi_pci_bind (struct acpi_device *device);
-int acpi_pci_unbind (struct acpi_device *device);
-int acpi_pci_bind_root (struct acpi_device *device, struct acpi_pci_id *id, struct pci_bus *bus);
+acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id);
+int acpi_pci_bind(struct acpi_device *device);
+int acpi_pci_unbind(struct acpi_device *device);
+int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id,
+                      struct pci_bus *bus);
 
 /* Arch-defined function to add a bus to the system */
 
-struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, int bus);
-
-#endif /*CONFIG_ACPI_PCI*/
-
+struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain,
+                                  int bus);
 
 /* --------------------------------------------------------------------------
                                   Power Resource
    -------------------------------------------------------------------------- */
 
 #ifdef CONFIG_ACPI_POWER
-int acpi_enable_wakeup_device_power (struct acpi_device *dev);
-int acpi_disable_wakeup_device_power (struct acpi_device *dev);
-int acpi_power_get_inferred_state (struct acpi_device *device);
-int acpi_power_transition (struct acpi_device *device, int state);
+int acpi_enable_wakeup_device_power(struct acpi_device *dev);
+int acpi_disable_wakeup_device_power(struct acpi_device *dev);
+int acpi_power_get_inferred_state(struct acpi_device *device);
+int acpi_power_transition(struct acpi_device *device, int state);
 #endif
 
-
 /* --------------------------------------------------------------------------
                                   Embedded Controller
    -------------------------------------------------------------------------- */
 #ifdef CONFIG_ACPI_EC
-int acpi_ec_ecdt_probe (void);
+int acpi_ec_ecdt_probe(void);
 #endif
 
 /* --------------------------------------------------------------------------
index ea489f2352160e3670772b235a2fe275bbcfc710..98e0b8cd14ed81bc4860b706950b99237976aeac 100644 (file)
@@ -7,7 +7,6 @@
  *
  *****************************************************************************/
 
-
 /*
  * Copyright (C) 2000 - 2005, R. Byron Moore
  * All rights reserved.
@@ -51,7 +50,6 @@
 #include "platform/acenv.h"
 #include "actypes.h"
 
-
 /* Priorities for acpi_os_queue_for_execution */
 
 #define OSD_PRIORITY_GPE            1
 #define ACPI_NO_UNIT_LIMIT          ((u32) -1)
 #define ACPI_MUTEX_SEM              1
 
-
 /* Functions for acpi_os_signal */
 
 #define ACPI_SIGNAL_FATAL           0
 #define ACPI_SIGNAL_BREAKPOINT      1
 
-struct acpi_signal_fatal_info
-{
-       u32                             type;
-       u32                             code;
-       u32                             argument;
+struct acpi_signal_fatal_info {
+       u32 type;
+       u32 code;
+       u32 argument;
 };
 
-
 /*
  * OSL Initialization and shutdown primitives
  */
-acpi_status
-acpi_os_initialize (
-       void);
-
-acpi_status
-acpi_os_terminate (
-       void);
+acpi_status acpi_os_initialize(void);
 
+acpi_status acpi_os_terminate(void);
 
 /*
  * ACPI Table interfaces
  */
-acpi_status
-acpi_os_get_root_pointer (
-       u32                             flags,
-       struct acpi_pointer             *address);
+acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address);
 
 acpi_status
-acpi_os_predefined_override (
-       const struct acpi_predefined_names *init_val,
-       acpi_string                         *new_val);
+acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
+                           acpi_string * new_val);
 
 acpi_status
-acpi_os_table_override (
-       struct acpi_table_header        *existing_table,
-       struct acpi_table_header        **new_table);
-
+acpi_os_table_override(struct acpi_table_header *existing_table,
+                      struct acpi_table_header **new_table);
 
 /*
  * Synchronization primitives
  */
 acpi_status
-acpi_os_create_semaphore (
-       u32                             max_units,
-       u32                             initial_units,
-       acpi_handle                     *out_handle);
-
-acpi_status
-acpi_os_delete_semaphore (
-       acpi_handle                     handle);
+acpi_os_create_semaphore(u32 max_units,
+                        u32 initial_units, acpi_handle * out_handle);
 
-acpi_status
-acpi_os_wait_semaphore (
-       acpi_handle                     handle,
-       u32                             units,
-       u16                             timeout);
+acpi_status acpi_os_delete_semaphore(acpi_handle handle);
 
-acpi_status
-acpi_os_signal_semaphore (
-       acpi_handle                     handle,
-       u32                             units);
+acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout);
 
-acpi_status
-acpi_os_create_lock (
-       acpi_handle                     *out_handle);
+acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units);
 
-void
-acpi_os_delete_lock (
-       acpi_handle                     handle);
+acpi_status acpi_os_create_lock(acpi_handle * out_handle);
 
-void
-acpi_os_acquire_lock (
-       acpi_handle                     handle,
-       u32                             flags);
+void acpi_os_delete_lock(acpi_handle handle);
 
-void
-acpi_os_release_lock (
-       acpi_handle                     handle,
-       u32                             flags);
+unsigned long acpi_os_acquire_lock(acpi_handle handle);
 
+void acpi_os_release_lock(acpi_handle handle, unsigned long flags);
 
 /*
  * Memory allocation and mapping
  */
-void *
-acpi_os_allocate (
-       acpi_size                       size);
+void *acpi_os_allocate(acpi_size size);
 
-void
-acpi_os_free (
-       void *                          memory);
+void acpi_os_free(void *memory);
 
 acpi_status
-acpi_os_map_memory (
-       acpi_physical_address           physical_address,
-       acpi_size                       size,
-       void __iomem                  **logical_address);
+acpi_os_map_memory(acpi_physical_address physical_address,
+                  acpi_size size, void __iomem ** logical_address);
 
-void
-acpi_os_unmap_memory (
-       void __iomem                  *logical_address,
-       acpi_size                       size);
+void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_os_get_physical_address (
-       void                            *logical_address,
-       acpi_physical_address           *physical_address);
+acpi_os_get_physical_address(void *logical_address,
+                            acpi_physical_address * physical_address);
 #endif
 
+/*
+ * Memory/Object Cache
+ */
+acpi_status
+acpi_os_create_cache(char *cache_name,
+                    u16 object_size,
+                    u16 max_depth, acpi_cache_t ** return_cache);
+
+acpi_status acpi_os_delete_cache(acpi_cache_t * cache);
+
+acpi_status acpi_os_purge_cache(acpi_cache_t * cache);
+
+void *acpi_os_acquire_object(acpi_cache_t * cache);
+
+acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
 
 /*
  * Interrupt handlers
  */
 acpi_status
-acpi_os_install_interrupt_handler (
-       u32                             gsi,
-       acpi_osd_handler                service_routine,
-       void                            *context);
+acpi_os_install_interrupt_handler(u32 gsi,
+                                 acpi_osd_handler service_routine,
+                                 void *context);
 
 acpi_status
-acpi_os_remove_interrupt_handler (
-       u32                             gsi,
-       acpi_osd_handler                service_routine);
-
+acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
 
 /*
  * Threads and Scheduling
  */
-u32
-acpi_os_get_thread_id (
-       void);
+u32 acpi_os_get_thread_id(void);
 
 acpi_status
-acpi_os_queue_for_execution (
-       u32                             priority,
-       acpi_osd_exec_callback          function,
-       void                            *context);
+acpi_os_queue_for_execution(u32 priority,
+                           acpi_osd_exec_callback function, void *context);
 
-void
-acpi_os_wait_events_complete(
-       void * context);
+void acpi_os_wait_events_complete(void *context);
 
-void
-acpi_os_wait_events_complete (
-       void                            *context);
+void acpi_os_wait_events_complete(void *context);
 
-void
-acpi_os_sleep (
-       acpi_integer                    milliseconds);
-
-void
-acpi_os_stall (
-       u32                             microseconds);
+void acpi_os_sleep(acpi_integer milliseconds);
 
+void acpi_os_stall(u32 microseconds);
 
 /*
  * Platform and hardware-independent I/O interfaces
  */
-acpi_status
-acpi_os_read_port (
-       acpi_io_address                 address,
-       u32                             *value,
-       u32                             width);
-
-acpi_status
-acpi_os_write_port (
-       acpi_io_address                 address,
-       u32                             value,
-       u32                             width);
+acpi_status acpi_os_read_port(acpi_io_address address, u32 * value, u32 width);
 
+acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
 
 /*
  * Platform and hardware-independent physical memory interfaces
  */
 acpi_status
-acpi_os_read_memory (
-       acpi_physical_address           address,
-       u32                             *value,
-       u32                             width);
+acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width);
 
 acpi_status
-acpi_os_write_memory (
-       acpi_physical_address           address,
-       u32                             value,
-       u32                             width);
-
+acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
 
 /*
  * Platform and hardware-independent PCI configuration space access
@@ -263,111 +197,69 @@ acpi_os_write_memory (
  * certain compilers complain.
  */
 acpi_status
-acpi_os_read_pci_configuration (
-       struct acpi_pci_id              *pci_id,
-       u32                             reg,
-       void                            *value,
-       u32                             width);
+acpi_os_read_pci_configuration(struct acpi_pci_id *pci_id,
+                              u32 reg, void *value, u32 width);
 
 acpi_status
-acpi_os_write_pci_configuration (
-       struct acpi_pci_id              *pci_id,
-       u32                             reg,
-       acpi_integer                    value,
-       u32                             width);
+acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
+                               u32 reg, acpi_integer value, u32 width);
 
 /*
  * Interim function needed for PCI IRQ routing
  */
 void
-acpi_os_derive_pci_id(
-       acpi_handle                     rhandle,
-       acpi_handle                     chandle,
-       struct acpi_pci_id              **pci_id);
+acpi_os_derive_pci_id(acpi_handle rhandle,
+                     acpi_handle chandle, struct acpi_pci_id **pci_id);
 
 /*
  * Miscellaneous
  */
-u8
-acpi_os_readable (
-       void                            *pointer,
-       acpi_size                       length);
+u8 acpi_os_readable(void *pointer, acpi_size length);
 
 #ifdef ACPI_FUTURE_USAGE
-u8
-acpi_os_writable (
-       void                            *pointer,
-       acpi_size                       length);
+u8 acpi_os_writable(void *pointer, acpi_size length);
 #endif
 
-u64
-acpi_os_get_timer (
-       void);
+u64 acpi_os_get_timer(void);
 
-acpi_status
-acpi_os_signal (
-       u32                             function,
-       void                            *info);
+acpi_status acpi_os_signal(u32 function, void *info);
 
 /*
  * Debug print routines
  */
-void ACPI_INTERNAL_VAR_XFACE
-acpi_os_printf (
-       const char                      *format,
-       ...);
-
-void
-acpi_os_vprintf (
-       const char                      *format,
-       va_list                 args);
+void ACPI_INTERNAL_VAR_XFACE acpi_os_printf(const char *format, ...);
 
-void
-acpi_os_redirect_output (
-       void                            *destination);
+void acpi_os_vprintf(const char *format, va_list args);
 
+void acpi_os_redirect_output(void *destination);
 
 #ifdef ACPI_FUTURE_USAGE
 /*
  * Debug input
  */
-u32
-acpi_os_get_line (
-       char                            *buffer);
+u32 acpi_os_get_line(char *buffer);
 #endif
 
-
 /*
  * Directory manipulation
  */
-void *
-acpi_os_open_directory (
-       char                            *pathname,
-       char                            *wildcard_spec,
-       char                            requested_file_type);
+void *acpi_os_open_directory(char *pathname,
+                            char *wildcard_spec, char requested_file_type);
 
 /* requeste_file_type values */
 
 #define REQUEST_FILE_ONLY                   0
 #define REQUEST_DIR_ONLY                    1
 
+char *acpi_os_get_next_filename(void *dir_handle);
 
-char *
-acpi_os_get_next_filename (
-       void                            *dir_handle);
-
-void
-acpi_os_close_directory (
-       void                            *dir_handle);
+void acpi_os_close_directory(void *dir_handle);
 
 /*
  * Debug
  */
 void
-acpi_os_dbg_assert(
-       void                            *failed_assertion,
-       void                            *file_name,
-       u32                             line_number,
-       char                            *message);
+acpi_os_dbg_assert(void *failed_assertion,
+                  void *file_name, u32 line_number, char *message);
 
-#endif /* __ACPIOSXF_H__ */
+#endif                         /* __ACPIOSXF_H__ */
index f8f619f8e4f8f1f7b19eac252b2a1b1f7ddb018f..2a9dbc13b0f2d41a1cdbb773bf1613cd75964ec5 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __ACXFACE_H__
 #define __ACXFACE_H__
 
 #include "actypes.h"
 #include "actbl.h"
 
-
 /*
  * Global interfaces
  */
-acpi_status
-acpi_initialize_subsystem (
-       void);
+acpi_status acpi_initialize_subsystem(void);
 
-acpi_status
-acpi_enable_subsystem (
-       u32                             flags);
+acpi_status acpi_enable_subsystem(u32 flags);
 
-acpi_status
-acpi_initialize_objects (
-       u32                             flags);
+acpi_status acpi_initialize_objects(u32 flags);
 
-acpi_status
-acpi_terminate (
-       void);
+acpi_status acpi_terminate(void);
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_subsystem_status (
-       void);
+acpi_status acpi_subsystem_status(void);
 #endif
 
-acpi_status
-acpi_enable (
-       void);
+acpi_status acpi_enable(void);
 
-acpi_status
-acpi_disable (
-       void);
+acpi_status acpi_disable(void);
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_get_system_info (
-       struct acpi_buffer              *ret_buffer);
+acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
 #endif
 
-const char *
-acpi_format_exception (
-       acpi_status                     exception);
+const char *acpi_format_exception(acpi_status exception);
 
-acpi_status
-acpi_purge_cached_objects (
-       void);
+acpi_status acpi_purge_cached_objects(void);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_install_initialization_handler (
-       acpi_init_handler               handler,
-       u32                             function);
+acpi_install_initialization_handler(acpi_init_handler handler, u32 function);
 #endif
 
 /*
  * ACPI Memory managment
  */
-void *
-acpi_allocate (
-       u32                             size);
-
-void *
-acpi_callocate (
-       u32                             size);
+void *acpi_allocate(u32 size);
 
-void
-acpi_free (
-       void                            *address);
+void *acpi_callocate(u32 size);
 
+void acpi_free(void *address);
 
 /*
  * ACPI table manipulation interfaces
  */
 acpi_status
-acpi_find_root_pointer (
-       u32                             flags,
-       struct acpi_pointer             *rsdp_address);
+acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address);
 
-acpi_status
-acpi_load_tables (
-       void);
+acpi_status acpi_load_tables(void);
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_load_table (
-       struct acpi_table_header        *table_ptr);
+acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
 
-acpi_status
-acpi_unload_table (
-       acpi_table_type                 table_type);
+acpi_status acpi_unload_table(acpi_table_type table_type);
 
 acpi_status
-acpi_get_table_header (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_table_header        *out_table_header);
-#endif  /*  ACPI_FUTURE_USAGE  */
+acpi_get_table_header(acpi_table_type table_type,
+                     u32 instance, struct acpi_table_header *out_table_header);
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 acpi_status
-acpi_get_table (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_buffer              *ret_buffer);
+acpi_get_table(acpi_table_type table_type,
+              u32 instance, struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_get_firmware_table (
-       acpi_string                     signature,
-       u32                             instance,
-       u32                             flags,
-       struct acpi_table_header        **table_pointer);
-
+acpi_get_firmware_table(acpi_string signature,
+                       u32 instance,
+                       u32 flags, struct acpi_table_header **table_pointer);
 
 /*
  * Namespace and name interfaces
  */
 acpi_status
-acpi_walk_namespace (
-       acpi_object_type                type,
-       acpi_handle                     start_object,
-       u32                             max_depth,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value);
+acpi_walk_namespace(acpi_object_type type,
+                   acpi_handle start_object,
+                   u32 max_depth,
+                   acpi_walk_callback user_function,
+                   void *context, void **return_value);
 
 acpi_status
-acpi_get_devices (
-       char                            *HID,
-       acpi_walk_callback              user_function,
-       void                            *context,
-       void                            **return_value);
+acpi_get_devices(char *HID,
+                acpi_walk_callback user_function,
+                void *context, void **return_value);
 
 acpi_status
-acpi_get_name (
-       acpi_handle                     handle,
-       u32                             name_type,
-       struct acpi_buffer              *ret_path_ptr);
+acpi_get_name(acpi_handle handle,
+             u32 name_type, struct acpi_buffer *ret_path_ptr);
 
 acpi_status
-acpi_get_handle (
-       acpi_handle                     parent,
-       acpi_string                     pathname,
-       acpi_handle                     *ret_handle);
+acpi_get_handle(acpi_handle parent,
+               acpi_string pathname, acpi_handle * ret_handle);
 
 acpi_status
-acpi_attach_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler,
-       void                            *data);
+acpi_attach_data(acpi_handle obj_handle,
+                acpi_object_handler handler, void *data);
 
 acpi_status
-acpi_detach_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler);
+acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler);
 
 acpi_status
-acpi_get_data (
-       acpi_handle                     obj_handle,
-       acpi_object_handler             handler,
-       void                            **data);
-
+acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data);
 
 /*
  * Object manipulation and enumeration
  */
 acpi_status
-acpi_evaluate_object (
-       acpi_handle                     object,
-       acpi_string                     pathname,
-       struct acpi_object_list         *parameter_objects,
-       struct acpi_buffer              *return_object_buffer);
+acpi_evaluate_object(acpi_handle object,
+                    acpi_string pathname,
+                    struct acpi_object_list *parameter_objects,
+                    struct acpi_buffer *return_object_buffer);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_evaluate_object_typed (
-       acpi_handle                     object,
-       acpi_string                     pathname,
-       struct acpi_object_list         *external_params,
-       struct acpi_buffer              *return_buffer,
-       acpi_object_type                return_type);
+acpi_evaluate_object_typed(acpi_handle object,
+                          acpi_string pathname,
+                          struct acpi_object_list *external_params,
+                          struct acpi_buffer *return_buffer,
+                          acpi_object_type return_type);
 #endif
 
 acpi_status
-acpi_get_object_info (
-       acpi_handle                     handle,
-       struct acpi_buffer              *return_buffer);
+acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
 
 acpi_status
-acpi_get_next_object (
-       acpi_object_type                type,
-       acpi_handle                     parent,
-       acpi_handle                     child,
-       acpi_handle                     *out_handle);
+acpi_get_next_object(acpi_object_type type,
+                    acpi_handle parent,
+                    acpi_handle child, acpi_handle * out_handle);
 
-acpi_status
-acpi_get_type (
-       acpi_handle                     object,
-       acpi_object_type                *out_type);
-
-acpi_status
-acpi_get_parent (
-       acpi_handle                     object,
-       acpi_handle                     *out_handle);
+acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type);
 
+acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle);
 
 /*
  * Event handler interfaces
  */
 acpi_status
-acpi_install_fixed_event_handler (
-       u32                             acpi_event,
-       acpi_event_handler              handler,
-       void                            *context);
+acpi_install_fixed_event_handler(u32 acpi_event,
+                                acpi_event_handler handler, void *context);
 
 acpi_status
-acpi_remove_fixed_event_handler (
-       u32                             acpi_event,
-       acpi_event_handler              handler);
+acpi_remove_fixed_event_handler(u32 acpi_event, acpi_event_handler handler);
 
 acpi_status
-acpi_install_notify_handler (
-       acpi_handle                     device,
-       u32                             handler_type,
-       acpi_notify_handler             handler,
-       void                            *context);
+acpi_install_notify_handler(acpi_handle device,
+                           u32 handler_type,
+                           acpi_notify_handler handler, void *context);
 
 acpi_status
-acpi_remove_notify_handler (
-       acpi_handle                     device,
-       u32                             handler_type,
-       acpi_notify_handler             handler);
+acpi_remove_notify_handler(acpi_handle device,
+                          u32 handler_type, acpi_notify_handler handler);
 
 acpi_status
-acpi_install_address_space_handler (
-       acpi_handle                     device,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler,
-       acpi_adr_space_setup            setup,
-       void                            *context);
+acpi_install_address_space_handler(acpi_handle device,
+                                  acpi_adr_space_type space_id,
+                                  acpi_adr_space_handler handler,
+                                  acpi_adr_space_setup setup, void *context);
 
 acpi_status
-acpi_remove_address_space_handler (
-       acpi_handle                     device,
-       acpi_adr_space_type             space_id,
-       acpi_adr_space_handler          handler);
+acpi_remove_address_space_handler(acpi_handle device,
+                                 acpi_adr_space_type space_id,
+                                 acpi_adr_space_handler handler);
 
 acpi_status
-acpi_install_gpe_handler (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             type,
-       acpi_event_handler              address,
-       void                            *context);
+acpi_install_gpe_handler(acpi_handle gpe_device,
+                        u32 gpe_number,
+                        u32 type, acpi_event_handler address, void *context);
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_install_exception_handler (
-       acpi_exception_handler          handler);
+acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
 #endif
 
-
 /*
  * Event interfaces
  */
-acpi_status
-acpi_acquire_global_lock (
-       u16                             timeout,
-       u32                             *handle);
+acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
 
-acpi_status
-acpi_release_global_lock (
-       u32                             handle);
+acpi_status acpi_release_global_lock(u32 handle);
 
 acpi_status
-acpi_remove_gpe_handler (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       acpi_event_handler              address);
+acpi_remove_gpe_handler(acpi_handle gpe_device,
+                       u32 gpe_number, acpi_event_handler address);
 
-acpi_status
-acpi_enable_event (
-       u32                             event,
-       u32                             flags);
+acpi_status acpi_enable_event(u32 event, u32 flags);
 
-acpi_status
-acpi_disable_event (
-       u32                             event,
-       u32                             flags);
+acpi_status acpi_disable_event(u32 event, u32 flags);
 
-acpi_status
-acpi_clear_event (
-       u32                             event);
+acpi_status acpi_clear_event(u32 event);
 
 #ifdef ACPI_FUTURE_USAGE
-acpi_status
-acpi_get_event_status (
-       u32                             event,
-       acpi_event_status               *event_status);
-#endif  /*  ACPI_FUTURE_USAGE  */
+acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
-acpi_status
-acpi_set_gpe_type (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u8                              type);
+acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type);
 
-acpi_status
-acpi_enable_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags);
+acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
 
-acpi_status
-acpi_disable_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags);
+acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
 
-acpi_status
-acpi_clear_gpe (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags);
+acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_gpe_status (
-       acpi_handle                     gpe_device,
-       u32                             gpe_number,
-       u32                             flags,
-       acpi_event_status               *event_status);
-#endif  /*  ACPI_FUTURE_USAGE  */
+acpi_get_gpe_status(acpi_handle gpe_device,
+                   u32 gpe_number,
+                   u32 flags, acpi_event_status * event_status);
+#endif                         /*  ACPI_FUTURE_USAGE  */
 
 acpi_status
-acpi_install_gpe_block (
-       acpi_handle                     gpe_device,
-       struct acpi_generic_address     *gpe_block_address,
-       u32                             register_count,
-       u32                             interrupt_level);
-
-acpi_status
-acpi_remove_gpe_block (
-       acpi_handle                     gpe_device);
+acpi_install_gpe_block(acpi_handle gpe_device,
+                      struct acpi_generic_address *gpe_block_address,
+                      u32 register_count, u32 interrupt_number);
 
+acpi_status acpi_remove_gpe_block(acpi_handle gpe_device);
 
 /*
  * Resource interfaces
  */
 typedef
-acpi_status (*ACPI_WALK_RESOURCE_CALLBACK) (
-       struct acpi_resource            *resource,
-       void                            *context);
-
+acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource,
+                                          void *context);
 
 acpi_status
-acpi_get_current_resources(
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *ret_buffer);
+acpi_get_current_resources(acpi_handle device_handle,
+                          struct acpi_buffer *ret_buffer);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_possible_resources(
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *ret_buffer);
+acpi_get_possible_resources(acpi_handle device_handle,
+                           struct acpi_buffer *ret_buffer);
 #endif
 
 acpi_status
-acpi_walk_resources (
-       acpi_handle                             device_handle,
-       char                                    *path,
-       ACPI_WALK_RESOURCE_CALLBACK     user_function,
-       void                                    *context);
+acpi_walk_resources(acpi_handle device_handle,
+                   char *path,
+                   ACPI_WALK_RESOURCE_CALLBACK user_function, void *context);
 
 acpi_status
-acpi_set_current_resources (
-       acpi_handle                     device_handle,
-       struct acpi_buffer              *in_buffer);
+acpi_set_current_resources(acpi_handle device_handle,
+                          struct acpi_buffer *in_buffer);
 
 acpi_status
-acpi_get_irq_routing_table (
-       acpi_handle                     bus_device_handle,
-       struct acpi_buffer              *ret_buffer);
+acpi_get_irq_routing_table(acpi_handle bus_device_handle,
+                          struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_resource_to_address64 (
-       struct acpi_resource            *resource,
-       struct acpi_resource_address64 *out);
+acpi_resource_to_address64(struct acpi_resource *resource,
+                          struct acpi_resource_address64 *out);
 
 /*
  * Hardware (ACPI device) interfaces
  */
-acpi_status
-acpi_get_register (
-       u32                             register_id,
-       u32                             *return_value,
-       u32                             flags);
+acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags);
 
-acpi_status
-acpi_set_register (
-       u32                             register_id,
-       u32                             value,
-       u32                             flags);
+acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags);
 
 acpi_status
-acpi_set_firmware_waking_vector (
-       acpi_physical_address           physical_address);
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_get_firmware_waking_vector (
-       acpi_physical_address           *physical_address);
+acpi_get_firmware_waking_vector(acpi_physical_address * physical_address);
 #endif
 
 acpi_status
-acpi_get_sleep_type_data (
-       u8                              sleep_state,
-       u8                              *slp_typ_a,
-       u8                              *slp_typ_b);
+acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
 
-acpi_status
-acpi_enter_sleep_state_prep (
-       u8                              sleep_state);
+acpi_status acpi_enter_sleep_state_prep(u8 sleep_state);
 
-acpi_status asmlinkage
-acpi_enter_sleep_state (
-       u8                              sleep_state);
+acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state);
 
-acpi_status asmlinkage
-acpi_enter_sleep_state_s4bios (
-       void);
-
-acpi_status
-acpi_leave_sleep_state (
-       u8                              sleep_state);
+acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void);
 
+acpi_status acpi_leave_sleep_state(u8 sleep_state);
 
-#endif /* __ACXFACE_H__ */
+#endif                         /* __ACXFACE_H__ */
index ed679264c12c96debab75b04eaf91eb7168415aa..38e798b05d088f826ca56f1ff67ba91edcb303c5 100644 (file)
 #ifndef __ACRESRC_H__
 #define __ACRESRC_H__
 
-
 /*
  *  Function prototypes called from Acpi* APIs
  */
 acpi_status
-acpi_rs_get_prt_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer);
-
+acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_rs_get_crs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer);
+acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_rs_get_prs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer);
-#endif /* ACPI_FUTURE_USAGE */
+acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 acpi_status
-acpi_rs_get_method_data (
-       acpi_handle                     handle,
-       char                            *path,
-       struct acpi_buffer              *ret_buffer);
+acpi_rs_get_method_data(acpi_handle handle,
+                       char *path, struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_rs_set_srs_method_data (
-       acpi_handle                     handle,
-       struct acpi_buffer              *ret_buffer);
+acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_rs_create_resource_list (
-       union acpi_operand_object       *byte_stream_buffer,
-       struct acpi_buffer              *output_buffer);
+acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
+                            struct acpi_buffer *output_buffer);
 
 acpi_status
-acpi_rs_create_byte_stream (
-       struct acpi_resource            *linked_list_buffer,
-       struct acpi_buffer              *output_buffer);
+acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
+                          struct acpi_buffer *output_buffer);
 
 acpi_status
-acpi_rs_create_pci_routing_table (
-       union acpi_operand_object       *package_object,
-       struct acpi_buffer              *output_buffer);
-
+acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
+                                struct acpi_buffer *output_buffer);
 
 /*
  * rsdump
  */
 #ifdef ACPI_FUTURE_USAGE
-void
-acpi_rs_dump_resource_list (
-       struct acpi_resource            *resource);
-
-void
-acpi_rs_dump_irq_list (
-       u8                              *route_table);
-#endif /* ACPI_FUTURE_USAGE */
+void acpi_rs_dump_resource_list(struct acpi_resource *resource);
 
+void acpi_rs_dump_irq_list(u8 * route_table);
+#endif                         /* ACPI_FUTURE_USAGE */
 
 /*
  * rscalc
  */
 acpi_status
-acpi_rs_get_byte_stream_start (
-       u8                              *byte_stream_buffer,
-       u8                              **byte_stream_start,
-       u32                             *size);
+acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer,
+                             u8 ** byte_stream_start, u32 * size);
 
 acpi_status
-acpi_rs_get_list_length (
-       u8                              *byte_stream_buffer,
-       u32                             byte_stream_buffer_length,
-       acpi_size                       *size_needed);
+acpi_rs_get_list_length(u8 * byte_stream_buffer,
+                       u32 byte_stream_buffer_length, acpi_size * size_needed);
 
 acpi_status
-acpi_rs_get_byte_stream_length (
-       struct acpi_resource            *linked_list_buffer,
-       acpi_size                       *size_needed);
+acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer,
+                              acpi_size * size_needed);
 
 acpi_status
-acpi_rs_get_pci_routing_table_length (
-       union acpi_operand_object       *package_object,
-       acpi_size                       *buffer_size_needed);
+acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
+                                    acpi_size * buffer_size_needed);
 
 acpi_status
-acpi_rs_byte_stream_to_list (
-       u8                              *byte_stream_buffer,
-       u32                             byte_stream_buffer_length,
-       u8                              *output_buffer);
+acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
+                           u32 byte_stream_buffer_length, u8 * output_buffer);
 
 acpi_status
-acpi_rs_list_to_byte_stream (
-       struct acpi_resource            *linked_list,
-       acpi_size                       byte_stream_size_needed,
-       u8                              *output_buffer);
+acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
+                           acpi_size byte_stream_size_needed,
+                           u8 * output_buffer);
 
 acpi_status
-acpi_rs_io_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_io_resource(u8 * byte_stream_buffer,
+                   acpi_size * bytes_consumed,
+                   u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_fixed_io_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
+                         acpi_size * bytes_consumed,
+                         u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_io_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_io_stream(struct acpi_resource *linked_list,
+                 u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_fixed_io_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
+                       u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_irq_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_irq_resource(u8 * byte_stream_buffer,
+                    acpi_size * bytes_consumed,
+                    u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_irq_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_irq_stream(struct acpi_resource *linked_list,
+                  u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_dma_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_dma_resource(u8 * byte_stream_buffer,
+                    acpi_size * bytes_consumed,
+                    u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_dma_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_dma_stream(struct acpi_resource *linked_list,
+                  u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_address16_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_address16_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_address16_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_address16_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_address32_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_address32_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_address32_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_address32_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_address64_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_address64_resource(u8 * byte_stream_buffer,
+                          acpi_size * bytes_consumed,
+                          u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_address64_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_address64_stream(struct acpi_resource *linked_list,
+                        u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_start_depend_fns_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
+                                 acpi_size * bytes_consumed,
+                                 u8 ** output_buffer,
+                                 acpi_size * structure_size);
 
 acpi_status
-acpi_rs_end_depend_fns_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer,
+                               acpi_size * structure_size);
 
 acpi_status
-acpi_rs_start_depend_fns_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
+                               u8 ** output_buffer,
+                               acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_end_depend_fns_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_memory24_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_memory24_resource(u8 * byte_stream_buffer,
+                         acpi_size * bytes_consumed,
+                         u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_memory24_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_memory24_stream(struct acpi_resource *linked_list,
+                       u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_memory32_range_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer,
+                               acpi_size * structure_size);
 
 acpi_status
-acpi_rs_fixed_memory32_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
+                               acpi_size * bytes_consumed,
+                               u8 ** output_buffer,
+                               acpi_size * structure_size);
 
 acpi_status
-acpi_rs_memory32_range_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_fixed_memory32_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
+                             u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_extended_irq_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
+                             acpi_size * bytes_consumed,
+                             u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_extended_irq_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
+                           u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_end_tag_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
+                        acpi_size * bytes_consumed,
+                        u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_end_tag_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
+                      u8 ** output_buffer, acpi_size * bytes_consumed);
 
 acpi_status
-acpi_rs_vendor_resource (
-       u8                              *byte_stream_buffer,
-       acpi_size                       *bytes_consumed,
-       u8                              **output_buffer,
-       acpi_size                       *structure_size);
+acpi_rs_vendor_resource(u8 * byte_stream_buffer,
+                       acpi_size * bytes_consumed,
+                       u8 ** output_buffer, acpi_size * structure_size);
 
 acpi_status
-acpi_rs_vendor_stream (
-       struct acpi_resource            *linked_list,
-       u8                              **output_buffer,
-       acpi_size                       *bytes_consumed);
+acpi_rs_vendor_stream(struct acpi_resource *linked_list,
+                     u8 ** output_buffer, acpi_size * bytes_consumed);
 
-u8
-acpi_rs_get_resource_type (
-       u8                              resource_start_byte);
+u8 acpi_rs_get_resource_type(u8 resource_start_byte);
 
-#endif  /* __ACRESRC_H__ */
+#endif                         /* __ACRESRC_H__ */
index e6b9e36a2eda31d4cd4a032546f67ae1f7f1106c..99d2353398016c3bb47df71b892672f0380486e3 100644 (file)
 #ifndef __ACSTRUCT_H__
 #define __ACSTRUCT_H__
 
-
 /*****************************************************************************
  *
  * Tree walking typedefs and structs
  *
  ****************************************************************************/
 
-
 /*
  * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
  * the tree (for whatever reason), and for control method execution.
 #define ACPI_WALK_CONST_REQUIRED    3
 #define ACPI_WALK_CONST_OPTIONAL    4
 
-struct acpi_walk_state
-{
-       u8                                  data_type;                          /* To differentiate various internal objs MUST BE FIRST!*/\
-       u8                                  walk_type;
-       acpi_owner_id                       owner_id;                           /* Owner of objects created during the walk */
-       u8                                  last_predicate;                     /* Result of last predicate */
-       u8                                  reserved;                           /* For alignment */
-       u8                                  current_result;                     /* */
-       u8                                  next_op_info;                       /* Info about next_op */
-       u8                                  num_operands;                       /* Stack pointer for Operands[] array */
-       u8                                  return_used;
-       u16                                 opcode;                             /* Current AML opcode */
-       u8                                  scope_depth;
-       u8                                  reserved1;
-       u32                                 arg_count;                          /* push for fixed or var args */
-       u32                                 aml_offset;
-       u32                                 arg_types;
-       u32                                 method_breakpoint;                  /* For single stepping */
-       u32                                 user_breakpoint;                    /* User AML breakpoint */
-       u32                                 parse_flags;
-       u32                                 prev_arg_types;
-
-       u8                                  *aml_last_while;
-       struct acpi_namespace_node          arguments[ACPI_METHOD_NUM_ARGS];    /* Control method arguments */
-       union acpi_operand_object           **caller_return_desc;
-       union acpi_generic_state            *control_state;                     /* List of control states (nested IFs) */
-       struct acpi_namespace_node          *deferred_node;                     /* Used when executing deferred opcodes */
-       struct acpi_gpe_event_info          *gpe_event_info;                    /* Info for GPE (_Lxx/_Exx methods only */
-       union acpi_operand_object           *implicit_return_obj;
-       struct acpi_namespace_node          local_variables[ACPI_METHOD_NUM_LOCALS];    /* Control method locals */
-       struct acpi_namespace_node          *method_call_node;                  /* Called method Node*/
-       union acpi_parse_object             *method_call_op;                    /* method_call Op if running a method */
-       union acpi_operand_object           *method_desc;                       /* Method descriptor if running a method */
-       struct acpi_namespace_node          *method_node;                       /* Method node if running a method. */
-       union acpi_parse_object             *op;                                /* Current parser op */
-       union acpi_operand_object           *operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
-       const struct acpi_opcode_info       *op_info;                           /* Info on current opcode */
-       union acpi_parse_object             *origin;                            /* Start of walk [Obsolete] */
-       union acpi_operand_object           **params;
-       struct acpi_parse_state             parser_state;                       /* Current state of parser */
-       union acpi_operand_object           *result_obj;
-       union acpi_generic_state            *results;                           /* Stack of accumulated results */
-       union acpi_operand_object           *return_desc;                       /* Return object, if any */
-       union acpi_generic_state            *scope_info;                        /* Stack of nested scopes */
-
-       union acpi_parse_object             *prev_op;                           /* Last op that was processed */
-       union acpi_parse_object             *next_op;                           /* next op to be processed */
-       acpi_parse_downwards                descending_callback;
-       acpi_parse_upwards                  ascending_callback;
-       struct acpi_thread_state            *thread;
-       struct acpi_walk_state              *next;                              /* Next walk_state in list */
+struct acpi_walk_state {
+       u8 data_type;           /* To differentiate various internal objs MUST BE FIRST! */
+       u8 walk_type;
+       acpi_owner_id owner_id; /* Owner of objects created during the walk */
+       u8 last_predicate;      /* Result of last predicate */
+       u8 current_result;      /* */
+       u8 next_op_info;        /* Info about next_op */
+       u8 num_operands;        /* Stack pointer for Operands[] array */
+       u8 return_used;
+       u16 opcode;             /* Current AML opcode */
+       u8 scope_depth;
+       u8 pass_number;         /* Parse pass during table load */
+       u32 arg_count;          /* push for fixed or var args */
+       u32 aml_offset;
+       u32 arg_types;
+       u32 method_breakpoint;  /* For single stepping */
+       u32 user_breakpoint;    /* User AML breakpoint */
+       u32 parse_flags;
+       u32 prev_arg_types;
+
+       u8 *aml_last_while;
+       struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS];     /* Control method arguments */
+       union acpi_operand_object **caller_return_desc;
+       union acpi_generic_state *control_state;        /* List of control states (nested IFs) */
+       struct acpi_namespace_node *deferred_node;      /* Used when executing deferred opcodes */
+       struct acpi_gpe_event_info *gpe_event_info;     /* Info for GPE (_Lxx/_Exx methods only */
+       union acpi_operand_object *implicit_return_obj;
+       struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS];     /* Control method locals */
+       struct acpi_namespace_node *method_call_node;   /* Called method Node */
+       union acpi_parse_object *method_call_op;        /* method_call Op if running a method */
+       union acpi_operand_object *method_desc; /* Method descriptor if running a method */
+       struct acpi_namespace_node *method_node;        /* Method node if running a method. */
+       union acpi_parse_object *op;    /* Current parser op */
+       union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+       const struct acpi_opcode_info *op_info; /* Info on current opcode */
+       union acpi_parse_object *origin;        /* Start of walk [Obsolete] */
+       union acpi_operand_object **params;
+       struct acpi_parse_state parser_state;   /* Current state of parser */
+       union acpi_operand_object *result_obj;
+       union acpi_generic_state *results;      /* Stack of accumulated results */
+       union acpi_operand_object *return_desc; /* Return object, if any */
+       union acpi_generic_state *scope_info;   /* Stack of nested scopes */
+
+       union acpi_parse_object *prev_op;       /* Last op that was processed */
+       union acpi_parse_object *next_op;       /* next op to be processed */
+       acpi_parse_downwards descending_callback;
+       acpi_parse_upwards ascending_callback;
+       struct acpi_thread_state *thread;
+       struct acpi_walk_state *next;   /* Next walk_state in list */
 };
 
-
 /* Info used by acpi_ps_init_objects */
 
-struct acpi_init_walk_info
-{
-       u16                             method_count;
-       u16                             device_count;
-       u16                             op_region_count;
-       u16                             field_count;
-       u16                             buffer_count;
-       u16                             package_count;
-       u16                             op_region_init;
-       u16                             field_init;
-       u16                             buffer_init;
-       u16                             package_init;
-       u16                             object_count;
-       struct acpi_table_desc          *table_desc;
+struct acpi_init_walk_info {
+       u16 method_count;
+       u16 device_count;
+       u16 op_region_count;
+       u16 field_count;
+       u16 buffer_count;
+       u16 package_count;
+       u16 op_region_init;
+       u16 field_init;
+       u16 buffer_init;
+       u16 package_init;
+       u16 object_count;
+       struct acpi_table_desc *table_desc;
 };
 
-
 /* Info used by acpi_ns_initialize_devices */
 
-struct acpi_device_walk_info
-{
-       u16                             device_count;
-       u16                             num_STA;
-       u16                             num_INI;
-       struct acpi_table_desc          *table_desc;
+struct acpi_device_walk_info {
+       u16 device_count;
+       u16 num_STA;
+       u16 num_INI;
+       struct acpi_table_desc *table_desc;
 };
 
-
 /* TBD: [Restructure] Merge with struct above */
 
-struct acpi_walk_info
-{
-       u32                             debug_level;
-       u32                             owner_id;
-       u8                              display_type;
+struct acpi_walk_info {
+       u32 debug_level;
+       u32 count;
+       acpi_owner_id owner_id;
+       u8 display_type;
 };
 
 /* Display Types */
 
-#define ACPI_DISPLAY_SUMMARY    0
-#define ACPI_DISPLAY_OBJECTS    1
+#define ACPI_DISPLAY_SUMMARY    (u8) 0
+#define ACPI_DISPLAY_OBJECTS    (u8) 1
+#define ACPI_DISPLAY_MASK       (u8) 1
 
-struct acpi_get_devices_info
-{
-       acpi_walk_callback              user_function;
-       void                            *context;
-       char                            *hid;
-};
+#define ACPI_DISPLAY_SHORT      (u8) 2
 
+struct acpi_get_devices_info {
+       acpi_walk_callback user_function;
+       void *context;
+       char *hid;
+};
 
-union acpi_aml_operands
-{
-       union acpi_operand_object           *operands[7];
+union acpi_aml_operands {
+       union acpi_operand_object *operands[7];
 
-       struct
-       {
-               struct acpi_object_integer      *type;
-               struct acpi_object_integer      *code;
-               struct acpi_object_integer      *argument;
+       struct {
+               struct acpi_object_integer *type;
+               struct acpi_object_integer *code;
+               struct acpi_object_integer *argument;
 
        } fatal;
 
-       struct
-       {
-               union acpi_operand_object       *source;
-               struct acpi_object_integer      *index;
-               union acpi_operand_object       *target;
+       struct {
+               union acpi_operand_object *source;
+               struct acpi_object_integer *index;
+               union acpi_operand_object *target;
 
        } index;
 
-       struct
-       {
-               union acpi_operand_object       *source;
-               struct acpi_object_integer      *index;
-               struct acpi_object_integer      *length;
-               union acpi_operand_object       *target;
+       struct {
+               union acpi_operand_object *source;
+               struct acpi_object_integer *index;
+               struct acpi_object_integer *length;
+               union acpi_operand_object *target;
 
        } mid;
 };
 
-
 /* Internal method parameter list */
 
-struct acpi_parameter_info
-{
-       struct acpi_namespace_node      *node;
-       union acpi_operand_object       **parameters;
-       union acpi_operand_object       *return_object;
-       u8                              parameter_type;
-       u8                              return_object_type;
+struct acpi_parameter_info {
+       struct acpi_namespace_node *node;
+       union acpi_operand_object *obj_desc;
+       union acpi_operand_object **parameters;
+       union acpi_operand_object *return_object;
+       u8 pass_number;
+       u8 parameter_type;
+       u8 return_object_type;
 };
 
 /* Types for parameter_type above */
@@ -218,5 +206,4 @@ struct acpi_parameter_info
 #define ACPI_PARAM_ARGS                 0
 #define ACPI_PARAM_GPE                  1
 
-
 #endif
index 39df92e21a0d9f72e05ad0e2e66c410875f62c27..f92c1858b8084f5bca9f455fcf70dc8b81942f70 100644 (file)
 #ifndef __ACTABLES_H__
 #define __ACTABLES_H__
 
-
 /* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */
 
 #define SIZE_IN_HEADER          0
 
-
 /*
  * tbconvrt - Table conversion routines
  */
-acpi_status
-acpi_tb_convert_to_xsdt (
-       struct acpi_table_desc          *table_info);
+acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info);
 
-acpi_status
-acpi_tb_convert_table_fadt (
-       void);
+acpi_status acpi_tb_convert_table_fadt(void);
 
-acpi_status
-acpi_tb_build_common_facs (
-       struct acpi_table_desc          *table_info);
+acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info);
 
 u32
-acpi_tb_get_table_count (
-       struct rsdp_descriptor          *RSDP,
-       struct acpi_table_header        *RSDT);
-
+acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
+                       struct acpi_table_header *RSDT);
 
 /*
  * tbget - Table "get" routines
  */
 acpi_status
-acpi_tb_get_table (
-       struct acpi_pointer             *address,
-       struct acpi_table_desc          *table_info);
-
-acpi_status
-acpi_tb_get_table_header (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *return_header);
+acpi_tb_get_table(struct acpi_pointer *address,
+                 struct acpi_table_desc *table_info);
 
 acpi_status
-acpi_tb_get_table_body (
-       struct acpi_pointer             *address,
-       struct acpi_table_header        *header,
-       struct acpi_table_desc          *table_info);
+acpi_tb_get_table_header(struct acpi_pointer *address,
+                        struct acpi_table_header *return_header);
 
 acpi_status
-acpi_tb_get_table_ptr (
-       acpi_table_type                 table_type,
-       u32                             instance,
-       struct acpi_table_header        **table_ptr_loc);
+acpi_tb_get_table_body(struct acpi_pointer *address,
+                      struct acpi_table_header *header,
+                      struct acpi_table_desc *table_info);
 
 acpi_status
-acpi_tb_verify_rsdp (
-       struct acpi_pointer             *address);
+acpi_tb_get_table_ptr(acpi_table_type table_type,
+                     u32 instance, struct acpi_table_header **table_ptr_loc);
 
-void
-acpi_tb_get_rsdt_address (
-       struct acpi_pointer             *out_address);
+acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address);
 
-acpi_status
-acpi_tb_validate_rsdt (
-       struct acpi_table_header        *table_ptr);
+void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address);
 
+acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr);
 
 /*
  * tbgetall - get multiple required tables
  */
-acpi_status
-acpi_tb_get_required_tables (
-       void);
-
+acpi_status acpi_tb_get_required_tables(void);
 
 /*
  * tbinstall - Table installation
  */
-acpi_status
-acpi_tb_install_table (
-       struct acpi_table_desc          *table_info);
+acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info);
 
 acpi_status
-acpi_tb_recognize_table (
-       struct acpi_table_desc          *table_info,
-       u8                              search_type);
+acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type);
 
 acpi_status
-acpi_tb_init_table_descriptor (
-       acpi_table_type                 table_type,
-       struct acpi_table_desc          *table_info);
-
+acpi_tb_init_table_descriptor(acpi_table_type table_type,
+                             struct acpi_table_desc *table_info);
 
 /*
  * tbremove - Table removal and deletion
  */
-void
-acpi_tb_delete_all_tables (
-       void);
-
-void
-acpi_tb_delete_tables_by_type (
-       acpi_table_type                 type);
+void acpi_tb_delete_all_tables(void);
 
-void
-acpi_tb_delete_single_table (
-       struct acpi_table_desc          *table_desc);
+void acpi_tb_delete_tables_by_type(acpi_table_type type);
 
-struct acpi_table_desc *
-acpi_tb_uninstall_table (
-       struct acpi_table_desc          *table_desc);
+void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc);
 
+struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc
+                                               *table_desc);
 
 /*
  * tbxfroot - RSDP, RSDT utilities
  */
 acpi_status
-acpi_tb_find_table (
-       char                            *signature,
-       char                            *oem_id,
-       char                            *oem_table_id,
-       struct acpi_table_header        **table_ptr);
+acpi_tb_find_table(char *signature,
+                  char *oem_id,
+                  char *oem_table_id, struct acpi_table_header **table_ptr);
 
-acpi_status
-acpi_tb_get_table_rsdt (
-       void);
+acpi_status acpi_tb_get_table_rsdt(void);
 
+acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp);
 
 /*
  * tbutils - common table utilities
  */
+acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc);
+
 acpi_status
-acpi_tb_verify_table_checksum (
-       struct acpi_table_header        *table_header);
+acpi_tb_verify_table_checksum(struct acpi_table_header *table_header);
 
-u8
-acpi_tb_checksum (
-       void                            *buffer,
-       u32                             length);
+u8 acpi_tb_generate_checksum(void *buffer, u32 length);
 
 acpi_status
-acpi_tb_validate_table_header (
-       struct acpi_table_header        *table_header);
+acpi_tb_validate_table_header(struct acpi_table_header *table_header);
 
-#endif /* __ACTABLES_H__ */
+#endif                         /* __ACTABLES_H__ */
index b5cdcca444c812a75434d8d9c22d06db8518613b..a46f406e1c94528c79034886dc94c0c130535116 100644 (file)
 #ifndef __ACTBL_H__
 #define __ACTBL_H__
 
-
 /*
  *  Values for description table header signatures
  */
 #define RSDP_NAME               "RSDP"
-#define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
-#define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
-#define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
-#define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
-#define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
-#define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
-#define RSDT_SIG                "RSDT"      /* Root System Description Table */
-#define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
-#define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
-#define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
-#define SPIC_SIG                "SPIC"      /* IOSAPIC table */
-#define BOOT_SIG                "BOOT"      /* Boot table */
-
-
-#define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
-
+#define RSDP_SIG                "RSD PTR "     /* RSDT Pointer signature */
+#define APIC_SIG                "APIC" /* Multiple APIC Description Table */
+#define DSDT_SIG                "DSDT" /* Differentiated System Description Table */
+#define FADT_SIG                "FACP" /* Fixed ACPI Description Table */
+#define FACS_SIG                "FACS" /* Firmware ACPI Control Structure */
+#define PSDT_SIG                "PSDT" /* Persistent System Description Table */
+#define RSDT_SIG                "RSDT" /* Root System Description Table */
+#define XSDT_SIG                "XSDT" /* Extended  System Description Table */
+#define SSDT_SIG                "SSDT" /* Secondary System Description Table */
+#define SBST_SIG                "SBST" /* Smart Battery Specification Table */
+#define SPIC_SIG                "SPIC" /* IOSAPIC table */
+#define BOOT_SIG                "BOOT" /* Boot table */
+
+#define GL_OWNED                0x02   /* Ownership of global lock is bit 1 */
 
 /*
  * Common table types.  The base code can remain
@@ -75,7 +72,6 @@
 #define FACS_DESCRIPTOR         struct facs_descriptor_rev2
 #define FADT_DESCRIPTOR         struct fadt_descriptor_rev2
 
-
 #pragma pack(1)
 
 /*
  * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
  * are in separate files.
  */
-struct rsdp_descriptor         /* Root System Descriptor Pointer */
-{
-       char                            signature [8];          /* ACPI signature, contains "RSD PTR " */
-       u8                              checksum;               /* To make sum of struct == 0 */
-       char                            oem_id [6];             /* OEM identification */
-       u8                              revision;               /* Must be 0 for 1.0, 2 for 2.0 */
-       u32                             rsdt_physical_address;  /* 32-bit physical address of RSDT */
-       u32                             length;                 /* XSDT Length in bytes including hdr */
-       u64                             xsdt_physical_address;  /* 64-bit physical address of XSDT */
-       u8                              extended_checksum;      /* Checksum of entire table */
-       char                            reserved [3];           /* Reserved field must be 0 */
+struct rsdp_descriptor {       /* Root System Descriptor Pointer */
+       char signature[8];      /* ACPI signature, contains "RSD PTR " */
+       u8 checksum;            /* ACPI 1.0 checksum */
+       char oem_id[6];         /* OEM identification */
+       u8 revision;            /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+       u32 rsdt_physical_address;      /* 32-bit physical address of the RSDT */
+       u32 length;             /* XSDT Length in bytes, including header */
+       u64 xsdt_physical_address;      /* 64-bit physical address of the XSDT */
+       u8 extended_checksum;   /* Checksum of entire table (ACPI 2.0) */
+       char reserved[3];       /* Reserved, must be zero */
 };
 
-
-struct acpi_common_facs          /* Common FACS for internal use */
-{
-       u32                             *global_lock;
-       u64                             *firmware_waking_vector;
-       u8                              vector_width;
+struct acpi_common_facs {      /* Common FACS for internal use */
+       u32 *global_lock;
+       u64 *firmware_waking_vector;
+       u8 vector_width;
 };
 
-
 #define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
-       char                            signature [4];          /* ACPI signature (4 ASCII characters) */\
-       u32                             length;                 /* Length of table, in bytes, including header */\
+       char                            signature[4];           /* ASCII table signature */\
+       u32                             length;                 /* Length of table in bytes, including this header */\
        u8                              revision;               /* ACPI Specification minor version # */\
        u8                              checksum;               /* To make sum of entire table == 0 */\
-       char                            oem_id [6];             /* OEM identification */\
-       char                            oem_table_id [8];       /* OEM table identification */\
+       char                            oem_id[6];              /* ASCII OEM identification */\
+       char                            oem_table_id[8];        /* ASCII OEM table identification */\
        u32                             oem_revision;           /* OEM revision number */\
-       char                            asl_compiler_id [4];    /* ASL compiler vendor ID */\
-       u32                             asl_compiler_revision;  /* ASL compiler revision number */
-
-
-struct acpi_table_header         /* ACPI common table header */
-{
-       ACPI_TABLE_HEADER_DEF
-};
+       char                            asl_compiler_id [4];    /* ASCII ASL compiler vendor ID */\
+       u32                             asl_compiler_revision;  /* ASL compiler version */
 
+struct acpi_table_header {     /* ACPI common table header */
+ACPI_TABLE_HEADER_DEF};
 
 /*
  * MADT values and structures
@@ -135,12 +123,15 @@ struct acpi_table_header         /* ACPI common table header */
 
 /* Master MADT */
 
-struct multiple_apic_table
-{
-       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
-       u32                             local_apic_address;     /* Physical address of local APIC */
-       u32                             PCATcompat      : 1;    /* A one indicates system also has dual 8259s */
-       u32                             reserved1       : 31;
+struct multiple_apic_table {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       u32 local_apic_address; /* Physical address of local APIC */
+
+       /* Flags (32 bits) */
+
+       u8 PCATcompat:1;        /* 00:    System also has dual 8259s */
+        u8:7;                  /* 01-07: Reserved, must be zero */
+       u8 reserved1[3];        /* 08-31: Reserved, must be zero */
 };
 
 /* Values for Type in APIC_HEADER_DEF */
@@ -154,7 +145,7 @@ struct multiple_apic_table
 #define APIC_IO_SAPIC           6
 #define APIC_LOCAL_SAPIC        7
 #define APIC_XRUPT_SOURCE       8
-#define APIC_RESERVED           9           /* 9 and greater are reserved */
+#define APIC_RESERVED           9      /* 9 and greater are reserved */
 
 /*
  * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
@@ -163,10 +154,8 @@ struct multiple_apic_table
        u8                              type; \
        u8                              length;
 
-struct apic_header
-{
-       APIC_HEADER_DEF
-};
+struct apic_header {
+APIC_HEADER_DEF};
 
 /* Values for MPS INTI flags */
 
@@ -180,117 +169,90 @@ struct apic_header
 #define TRIGGER_RESERVED        2
 #define TRIGGER_LEVEL           3
 
-/* Common flag definitions */
+/* Common flag definitions (16 bits each) */
 
 #define MPS_INTI_FLAGS \
-       u16                             polarity        : 2;    /* Polarity of APIC I/O input signals */\
-       u16                             trigger_mode    : 2;    /* Trigger mode of APIC input signals */\
-       u16                             reserved1       : 12;   /* Reserved, must be zero */
+       u8                              polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
+       u8                              trigger_mode    : 2;    /* 02-03: Trigger mode of APIC input signals */\
+       u8                                              : 4;    /* 04-07: Reserved, must be zero */\
+       u8                              reserved1;      /* 08-15: Reserved, must be zero */
 
 #define LOCAL_APIC_FLAGS \
-       u32                             processor_enabled: 1;   /* Processor is usable if set */\
-       u32                             reserved2       : 31;   /* Reserved, must be zero */
+       u8                              processor_enabled: 1;   /* 00:    Processor is usable if set */\
+       u8                                              : 7;    /* 01-07: Reserved, must be zero */\
+       u8                              reserved2;      /* 08-15: Reserved, must be zero */
 
 /* Sub-structures for MADT */
 
-struct madt_processor_apic
-{
-       APIC_HEADER_DEF
-       u8                              processor_id;           /* ACPI processor id */
-       u8                              local_apic_id;          /* Processor's local APIC id */
-       LOCAL_APIC_FLAGS
-};
-
-struct madt_io_apic
-{
-       APIC_HEADER_DEF
-       u8                              io_apic_id;             /* I/O APIC ID */
-       u8                              reserved;               /* Reserved - must be zero */
-       u32                             address;                /* APIC physical address */
-       u32                             interrupt;              /* Global system interrupt where INTI
-                         * lines start */
+struct madt_processor_apic {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       u8 local_apic_id;       /* Processor's local APIC id */
+ LOCAL_APIC_FLAGS};
+
+struct madt_io_apic {
+       APIC_HEADER_DEF u8 io_apic_id;  /* I/O APIC ID */
+       u8 reserved;            /* Reserved - must be zero */
+       u32 address;            /* APIC physical address */
+       u32 interrupt;          /* Global system interrupt where INTI
+                                * lines start */
 };
 
-struct madt_interrupt_override
-{
-       APIC_HEADER_DEF
-       u8                              bus;                    /* 0 - ISA */
-       u8                              source;                 /* Interrupt source (IRQ) */
-       u32                             interrupt;              /* Global system interrupt */
-       MPS_INTI_FLAGS
-};
+struct madt_interrupt_override {
+       APIC_HEADER_DEF u8 bus; /* 0 - ISA */
+       u8 source;              /* Interrupt source (IRQ) */
+       u32 interrupt;          /* Global system interrupt */
+ MPS_INTI_FLAGS};
 
-struct madt_nmi_source
-{
-       APIC_HEADER_DEF
-       MPS_INTI_FLAGS
-       u32                             interrupt;              /* Global system interrupt */
+struct madt_nmi_source {
+       APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt;   /* Global system interrupt */
 };
 
-struct madt_local_apic_nmi
-{
-       APIC_HEADER_DEF
-       u8                              processor_id;           /* ACPI processor id */
-       MPS_INTI_FLAGS
-       u8                              lint;                   /* LINTn to which NMI is connected */
+struct madt_local_apic_nmi {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */
 };
 
-struct madt_address_override
-{
-       APIC_HEADER_DEF
-       u16                             reserved;               /* Reserved - must be zero */
-       u64                             address;                /* APIC physical address */
+struct madt_address_override {
+       APIC_HEADER_DEF u16 reserved;   /* Reserved, must be zero */
+       u64 address;            /* APIC physical address */
 };
 
-struct madt_io_sapic
-{
-       APIC_HEADER_DEF
-       u8                              io_sapic_id;            /* I/O SAPIC ID */
-       u8                              reserved;               /* Reserved - must be zero */
-       u32                             interrupt_base;         /* Glocal interrupt for SAPIC start */
-       u64                             address;                /* SAPIC physical address */
+struct madt_io_sapic {
+       APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
+       u8 reserved;            /* Reserved, must be zero */
+       u32 interrupt_base;     /* Glocal interrupt for SAPIC start */
+       u64 address;            /* SAPIC physical address */
 };
 
-struct madt_local_sapic
-{
-       APIC_HEADER_DEF
-       u8                              processor_id;           /* ACPI processor id */
-       u8                              local_sapic_id;         /* SAPIC ID */
-       u8                              local_sapic_eid;        /* SAPIC EID */
-       u8                              reserved [3];           /* Reserved - must be zero */
-       LOCAL_APIC_FLAGS
-       u32                             processor_uID;          /* Numeric UID - ACPI 3.0 */
-       char                            processor_uIDstring[1]; /* String UID  - ACPI 3.0 */
+struct madt_local_sapic {
+       APIC_HEADER_DEF u8 processor_id;        /* ACPI processor id */
+       u8 local_sapic_id;      /* SAPIC ID */
+       u8 local_sapic_eid;     /* SAPIC EID */
+       u8 reserved[3];         /* Reserved, must be zero */
+        LOCAL_APIC_FLAGS u32 processor_uID;    /* Numeric UID - ACPI 3.0 */
+       char processor_uIDstring[1];    /* String UID  - ACPI 3.0 */
 };
 
-struct madt_interrupt_source
-{
-       APIC_HEADER_DEF
-       MPS_INTI_FLAGS
-       u8                              interrupt_type;         /* 1=PMI, 2=INIT, 3=corrected */
-       u8                              processor_id;           /* Processor ID */
-       u8                              processor_eid;          /* Processor EID */
-       u8                              io_sapic_vector;        /* Vector value for PMI interrupts */
-       u32                             interrupt;              /* Global system interrupt */
-       u32                             flags;                  /* Interrupt Source Flags */
+struct madt_interrupt_source {
+       APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type;       /* 1=PMI, 2=INIT, 3=corrected */
+       u8 processor_id;        /* Processor ID */
+       u8 processor_eid;       /* Processor EID */
+       u8 io_sapic_vector;     /* Vector value for PMI interrupts */
+       u32 interrupt;          /* Global system interrupt */
+       u32 flags;              /* Interrupt Source Flags */
 };
 
-
 /*
  * Smart Battery
  */
-struct smart_battery_table
-{
-       ACPI_TABLE_HEADER_DEF
-       u32                             warning_level;
-       u32                             low_level;
-       u32                             critical_level;
+struct smart_battery_table {
+       ACPI_TABLE_HEADER_DEF u32 warning_level;
+       u32 low_level;
+       u32 critical_level;
 };
 
-
 #pragma pack()
 
-
 /*
  * ACPI Table information.  We save the table address, length,
  * and type of memory allocation (mapped or allocated) for each
@@ -314,39 +276,35 @@ struct smart_battery_table
 
 /* Data about each known table type */
 
-struct acpi_table_support
-{
-       char                            *name;
-       char                            *signature;
-       void                            **global_ptr;
-       u8                              sig_length;
-       u8                              flags;
+struct acpi_table_support {
+       char *name;
+       char *signature;
+       void **global_ptr;
+       u8 sig_length;
+       u8 flags;
 };
 
-
 /*
  * Get the ACPI version-specific tables
  */
-#include "actbl1.h"   /* Acpi 1.0 table definitions */
-#include "actbl2.h"   /* Acpi 2.0 table definitions */
+#include "actbl1.h"            /* Acpi 1.0 table definitions */
+#include "actbl2.h"            /* Acpi 2.0 table definitions */
 
-extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
-                           * needed for certain workarounds */
+extern u8 acpi_fadt_is_v1;     /* is set to 1 if FADT is revision 1,
+                                * needed for certain workarounds */
 
 #pragma pack(1)
 /*
  * High performance timer
  */
-struct hpet_table
-{
-       ACPI_TABLE_HEADER_DEF
-       u32                             hardware_id;
-       struct acpi_generic_address     base_address;
-       u8                              hpet_number;
-       u16                             clock_tick;
-       u8                              attributes;
+struct hpet_table {
+       ACPI_TABLE_HEADER_DEF u32 hardware_id;
+       struct acpi_generic_address base_address;
+       u8 hpet_number;
+       u16 clock_tick;
+       u8 attributes;
 };
 
 #pragma pack()
 
-#endif /* __ACTBL_H__ */
+#endif                         /* __ACTBL_H__ */
index 33de5f4d2cccc8afdf31ea889ab14dc6c19bb0fd..67312c3a915a711b044f209c65bc8571305840dd 100644 (file)
 /*
  * ACPI 1.0 Root System Description Table (RSDT)
  */
-struct rsdt_descriptor_rev1
-{
-       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
-       u32                             table_offset_entry [1]; /* Array of pointers to other */
-                        /* ACPI tables */
+struct rsdt_descriptor_rev1 {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       u32 table_offset_entry[1];      /* Array of pointers to ACPI tables */
 };
 
-
 /*
  * ACPI 1.0 Firmware ACPI Control Structure (FACS)
  */
-struct facs_descriptor_rev1
-{
-       char                            signature[4];           /* ACPI Signature */
-       u32                             length;                 /* Length of structure, in bytes */
-       u32                             hardware_signature;     /* Hardware configuration signature */
-       u32                             firmware_waking_vector; /* ACPI OS waking vector */
-       u32                             global_lock;            /* Global Lock */
-       u32                             S4bios_f        : 1;    /* Indicates if S4BIOS support is present */
-       u32                             reserved1       : 31;   /* Must be 0 */
-       u8                              resverved3 [40];        /* Reserved - must be zero */
-};
+struct facs_descriptor_rev1 {
+       char signature[4];      /* ASCII table signature */
+       u32 length;             /* Length of structure in bytes */
+       u32 hardware_signature; /* Hardware configuration signature */
+       u32 firmware_waking_vector;     /* ACPI OS waking vector */
+       u32 global_lock;        /* Global Lock */
+
+       /* Flags (32 bits) */
 
+       u8 S4bios_f:1;          /* 00:    S4BIOS support is present */
+        u8:7;                  /* 01-07: Reserved, must be zero */
+       u8 reserved1[3];        /* 08-31: Reserved, must be zero */
+
+       u8 reserved2[40];       /* Reserved, must be zero */
+};
 
 /*
  * ACPI 1.0 Fixed ACPI Description Table (FADT)
  */
-struct fadt_descriptor_rev1
-{
-       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
-       u32                             firmware_ctrl;          /* Physical address of FACS */
-       u32                             dsdt;                   /* Physical address of DSDT */
-       u8                              model;                  /* System Interrupt Model */
-       u8                              reserved1;              /* Reserved */
-       u16                             sci_int;                /* System vector of SCI interrupt */
-       u32                             smi_cmd;                /* Port address of SMI command port */
-       u8                              acpi_enable;            /* Value to write to smi_cmd to enable ACPI */
-       u8                              acpi_disable;           /* Value to write to smi_cmd to disable ACPI */
-       u8                              S4bios_req;             /* Value to write to SMI CMD to enter S4BIOS state */
-       u8                              reserved2;              /* Reserved - must be zero */
-       u32                             pm1a_evt_blk;           /* Port address of Power Mgt 1a acpi_event Reg Blk */
-       u32                             pm1b_evt_blk;           /* Port address of Power Mgt 1b acpi_event Reg Blk */
-       u32                             pm1a_cnt_blk;           /* Port address of Power Mgt 1a Control Reg Blk */
-       u32                             pm1b_cnt_blk;           /* Port address of Power Mgt 1b Control Reg Blk */
-       u32                             pm2_cnt_blk;            /* Port address of Power Mgt 2 Control Reg Blk */
-       u32                             pm_tmr_blk;             /* Port address of Power Mgt Timer Ctrl Reg Blk */
-       u32                             gpe0_blk;               /* Port addr of General Purpose acpi_event 0 Reg Blk */
-       u32                             gpe1_blk;               /* Port addr of General Purpose acpi_event 1 Reg Blk */
-       u8                              pm1_evt_len;            /* Byte length of ports at pm1_x_evt_blk */
-       u8                              pm1_cnt_len;            /* Byte length of ports at pm1_x_cnt_blk */
-       u8                              pm2_cnt_len;            /* Byte Length of ports at pm2_cnt_blk */
-       u8                              pm_tm_len;              /* Byte Length of ports at pm_tm_blk */
-       u8                              gpe0_blk_len;           /* Byte Length of ports at gpe0_blk */
-       u8                              gpe1_blk_len;           /* Byte Length of ports at gpe1_blk */
-       u8                              gpe1_base;              /* Offset in gpe model where gpe1 events start */
-       u8                              reserved3;              /* Reserved */
-       u16                             plvl2_lat;              /* Worst case HW latency to enter/exit C2 state */
-       u16                             plvl3_lat;              /* Worst case HW latency to enter/exit C3 state */
-       u16                             flush_size;             /* Size of area read to flush caches */
-       u16                             flush_stride;           /* Stride used in flushing caches */
-       u8                              duty_offset;            /* Bit location of duty cycle field in p_cnt reg */
-       u8                              duty_width;             /* Bit width of duty cycle field in p_cnt reg */
-       u8                              day_alrm;               /* Index to day-of-month alarm in RTC CMOS RAM */
-       u8                              mon_alrm;               /* Index to month-of-year alarm in RTC CMOS RAM */
-       u8                              century;                /* Index to century in RTC CMOS RAM */
-       u8                              reserved4;              /* Reserved */
-       u8                              reserved4a;             /* Reserved */
-       u8                              reserved4b;             /* Reserved */
-       u32                             wb_invd         : 1;    /* The wbinvd instruction works properly */
-       u32                             wb_invd_flush   : 1;    /* The wbinvd flushes but does not invalidate */
-       u32                             proc_c1         : 1;    /* All processors support C1 state */
-       u32                             plvl2_up        : 1;    /* C2 state works on MP system */
-       u32                             pwr_button      : 1;    /* Power button is handled as a generic feature */
-       u32                             sleep_button    : 1;    /* Sleep button is handled as a generic feature, or not present */
-       u32                             fixed_rTC       : 1;    /* RTC wakeup stat not in fixed register space */
-       u32                             rtcs4           : 1;    /* RTC wakeup stat not possible from S4 */
-       u32                             tmr_val_ext     : 1;    /* The tmr_val width is 32 bits (0 = 24 bits) */
-       u32                             reserved5       : 23;   /* Reserved - must be zero */
-};
+struct fadt_descriptor_rev1 {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       u32 firmware_ctrl;      /* Physical address of FACS */
+       u32 dsdt;               /* Physical address of DSDT */
+       u8 model;               /* System Interrupt Model */
+       u8 reserved1;           /* Reserved, must be zero */
+       u16 sci_int;            /* System vector of SCI interrupt */
+       u32 smi_cmd;            /* Port address of SMI command port */
+       u8 acpi_enable;         /* Value to write to smi_cmd to enable ACPI */
+       u8 acpi_disable;        /* Value to write to smi_cmd to disable ACPI */
+       u8 S4bios_req;          /* Value to write to SMI CMD to enter S4BIOS state */
+       u8 reserved2;           /* Reserved, must be zero */
+       u32 pm1a_evt_blk;       /* Port address of Power Mgt 1a acpi_event Reg Blk */
+       u32 pm1b_evt_blk;       /* Port address of Power Mgt 1b acpi_event Reg Blk */
+       u32 pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
+       u32 pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
+       u32 pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
+       u32 pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u32 gpe0_blk;           /* Port addr of General Purpose acpi_event 0 Reg Blk */
+       u32 gpe1_blk;           /* Port addr of General Purpose acpi_event 1 Reg Blk */
+       u8 pm1_evt_len;         /* Byte length of ports at pm1_x_evt_blk */
+       u8 pm1_cnt_len;         /* Byte length of ports at pm1_x_cnt_blk */
+       u8 pm2_cnt_len;         /* Byte Length of ports at pm2_cnt_blk */
+       u8 pm_tm_len;           /* Byte Length of ports at pm_tm_blk */
+       u8 gpe0_blk_len;        /* Byte Length of ports at gpe0_blk */
+       u8 gpe1_blk_len;        /* Byte Length of ports at gpe1_blk */
+       u8 gpe1_base;           /* Offset in gpe model where gpe1 events start */
+       u8 reserved3;           /* Reserved, must be zero */
+       u16 plvl2_lat;          /* Worst case HW latency to enter/exit C2 state */
+       u16 plvl3_lat;          /* Worst case HW latency to enter/exit C3 state */
+       u16 flush_size;         /* Size of area read to flush caches */
+       u16 flush_stride;       /* Stride used in flushing caches */
+       u8 duty_offset;         /* Bit location of duty cycle field in p_cnt reg */
+       u8 duty_width;          /* Bit width of duty cycle field in p_cnt reg */
+       u8 day_alrm;            /* Index to day-of-month alarm in RTC CMOS RAM */
+       u8 mon_alrm;            /* Index to month-of-year alarm in RTC CMOS RAM */
+       u8 century;             /* Index to century in RTC CMOS RAM */
+       u8 reserved4[3];        /* Reserved, must be zero */
 
-#pragma pack()
+       /* Flags (32 bits) */
 
-#endif /* __ACTBL1_H__ */
+       u8 wb_invd:1;           /* 00:    The wbinvd instruction works properly */
+       u8 wb_invd_flush:1;     /* 01:    The wbinvd flushes but does not invalidate */
+       u8 proc_c1:1;           /* 02:    All processors support C1 state */
+       u8 plvl2_up:1;          /* 03:    C2 state works on MP system */
+       u8 pwr_button:1;        /* 04:    Power button is handled as a generic feature */
+       u8 sleep_button:1;      /* 05:    Sleep button is handled as a generic feature, or not present */
+       u8 fixed_rTC:1;         /* 06:    RTC wakeup stat not in fixed register space */
+       u8 rtcs4:1;             /* 07:    RTC wakeup stat not possible from S4 */
+       u8 tmr_val_ext:1;       /* 08:    tmr_val width is 32 bits (0 = 24 bits) */
+        u8:7;                  /* 09-15: Reserved, must be zero */
+       u8 reserved5[2];        /* 16-31: Reserved, must be zero */
+};
 
+#pragma pack()
 
+#endif                         /* __ACTBL1_H__ */
index e1729c967e052af28f7c0b884207e454a953dd1b..50305ce2681abf38f8659bed86a44df6f3cf0e8d 100644 (file)
 #define FADT2_REVISION_ID               3
 #define FADT2_MINUS_REVISION_ID         2
 
-
 #pragma pack(1)
 
 /*
  * ACPI 2.0 Root System Description Table (RSDT)
  */
-struct rsdt_descriptor_rev2
-{
-       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
-       u32                             table_offset_entry [1]; /* Array of pointers to  */
-                        /* ACPI table headers */
+struct rsdt_descriptor_rev2 {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       u32 table_offset_entry[1];      /* Array of pointers to ACPI tables */
 };
 
-
 /*
  * ACPI 2.0 Extended System Description Table (XSDT)
  */
-struct xsdt_descriptor_rev2
-{
-       ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
-       u64                             table_offset_entry [1]; /* Array of pointers to  */
-                        /* ACPI table headers */
+struct xsdt_descriptor_rev2 {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       u64 table_offset_entry[1];      /* Array of pointers to ACPI tables */
 };
 
-
 /*
  * ACPI 2.0 Firmware ACPI Control Structure (FACS)
  */
-struct facs_descriptor_rev2
-{
-       char                            signature[4];           /* ACPI signature */
-       u32                             length;                 /* Length of structure, in bytes */
-       u32                             hardware_signature;     /* Hardware configuration signature */
-       u32                             firmware_waking_vector; /* 32bit physical address of the Firmware Waking Vector. */
-       u32                             global_lock;            /* Global Lock used to synchronize access to shared hardware resources */
-       u32                             S4bios_f        : 1;    /* S4Bios_f - Indicates if S4BIOS support is present */
-       u32                             reserved1       : 31;   /* Must be 0 */
-       u64                             xfirmware_waking_vector; /* 64bit physical address of the Firmware Waking Vector. */
-       u8                              version;                /* Version of this table */
-       u8                              reserved3 [31];         /* Reserved - must be zero */
+struct facs_descriptor_rev2 {
+       char signature[4];      /* ASCII table signature */
+       u32 length;             /* Length of structure, in bytes */
+       u32 hardware_signature; /* Hardware configuration signature */
+       u32 firmware_waking_vector;     /* 32-bit physical address of the Firmware Waking Vector. */
+       u32 global_lock;        /* Global Lock used to synchronize access to shared hardware resources */
+
+       /* Flags (32 bits) */
+
+       u8 S4bios_f:1;          /* 00:    S4BIOS support is present */
+        u8:7;                  /* 01-07: Reserved, must be zero */
+       u8 reserved1[3];        /* 08-31: Reserved, must be zero */
+
+       u64 xfirmware_waking_vector;    /* 64-bit physical address of the Firmware Waking Vector. */
+       u8 version;             /* Version of this table */
+       u8 reserved3[31];       /* Reserved, must be zero */
 };
 
-
 /*
  * ACPI 2.0+ Generic Address Structure (GAS)
  */
-struct acpi_generic_address
-{
-       u8                              address_space_id;       /* Address space where struct or register exists. */
-       u8                              register_bit_width;     /* Size in bits of given register */
-       u8                              register_bit_offset;    /* Bit offset within the register */
-       u8                              access_width;           /* Minimum Access size (ACPI 3.0) */
-       u64                             address;                /* 64-bit address of struct or register */
+struct acpi_generic_address {
+       u8 address_space_id;    /* Address space where struct or register exists. */
+       u8 register_bit_width;  /* Size in bits of given register */
+       u8 register_bit_offset; /* Bit offset within the register */
+       u8 access_width;        /* Minimum Access size (ACPI 3.0) */
+       u64 address;            /* 64-bit address of struct or register */
 };
 
-
 #define FADT_REV2_COMMON \
        u32                             V1_firmware_ctrl;   /* 32-bit physical address of FACS */ \
        u32                             V1_dsdt;            /* 32-bit physical address of DSDT */ \
@@ -161,129 +155,123 @@ struct acpi_generic_address
 /*
  * ACPI 2.0+ Fixed ACPI Description Table (FADT)
  */
-struct fadt_descriptor_rev2
-{
-       ACPI_TABLE_HEADER_DEF                       /* ACPI common table header */
-       FADT_REV2_COMMON
-       u8                              reserved2;          /* Reserved */
-       u32                             wb_invd     : 1;    /* The wbinvd instruction works properly */
-       u32                             wb_invd_flush : 1;  /* The wbinvd flushes but does not invalidate */
-       u32                             proc_c1     : 1;    /* All processors support C1 state */
-       u32                             plvl2_up    : 1;    /* C2 state works on MP system */
-       u32                             pwr_button  : 1;    /* Power button is handled as a generic feature */
-       u32                             sleep_button : 1;   /* Sleep button is handled as a generic feature, or not present */
-       u32                             fixed_rTC   : 1;    /* RTC wakeup stat not in fixed register space */
-       u32                             rtcs4       : 1;    /* RTC wakeup stat not possible from S4 */
-       u32                             tmr_val_ext : 1;    /* Indicates tmr_val is 32 bits 0=24-bits */
-       u32                             dock_cap    : 1;    /* Supports Docking */
-       u32                             reset_reg_sup : 1;  /* Indicates system supports system reset via the FADT RESET_REG */
-       u32                             sealed_case : 1;    /* Indicates system has no internal expansion capabilities and case is sealed */
-       u32                             headless    : 1;    /* Indicates system does not have local video capabilities or local input devices */
-       u32                             cpu_sw_sleep : 1;   /* Indicates to OSPM that a processor native instruction */
-                          /* must be executed after writing the SLP_TYPx register */
-       /* ACPI 3.0 flag bits */
-
-       u32                             pci_exp_wak                         : 1; /* System supports PCIEXP_WAKE (STS/EN) bits */
-       u32                             use_platform_clock                  : 1; /* OSPM should use platform-provided timer */
-       u32                             S4rtc_sts_valid                     : 1; /* Contents of RTC_STS valid after S4 wake */
-       u32                             remote_power_on_capable             : 1; /* System is compatible with remote power on */
-       u32                             force_apic_cluster_model            : 1; /* All local APICs must use cluster model */
-       u32                             force_apic_physical_destination_mode : 1; /* all local x_aPICs must use physical dest mode */
-       u32                             reserved6                           : 12;/* Reserved - must be zero */
-
-       struct acpi_generic_address     reset_register;     /* Reset register address in GAS format */
-       u8                              reset_value;        /* Value to write to the reset_register port to reset the system */
-       u8                              reserved7[3];       /* These three bytes must be zero */
-       u64                             xfirmware_ctrl;     /* 64-bit physical address of FACS */
-       u64                             Xdsdt;              /* 64-bit physical address of DSDT */
-       struct acpi_generic_address     xpm1a_evt_blk;      /* Extended Power Mgt 1a acpi_event Reg Blk address */
-       struct acpi_generic_address     xpm1b_evt_blk;      /* Extended Power Mgt 1b acpi_event Reg Blk address */
-       struct acpi_generic_address     xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
-       struct acpi_generic_address     xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
-       struct acpi_generic_address     xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
-       struct acpi_generic_address     xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
-       struct acpi_generic_address     xgpe0_blk;          /* Extended General Purpose acpi_event 0 Reg Blk address */
-       struct acpi_generic_address     xgpe1_blk;          /* Extended General Purpose acpi_event 1 Reg Blk address */
+struct fadt_descriptor_rev2 {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       FADT_REV2_COMMON u8 reserved2;  /* Reserved, must be zero */
+
+       /* Flags (32 bits) */
+
+       u8 wb_invd:1;           /* 00:    The wbinvd instruction works properly */
+       u8 wb_invd_flush:1;     /* 01:    The wbinvd flushes but does not invalidate */
+       u8 proc_c1:1;           /* 02:    All processors support C1 state */
+       u8 plvl2_up:1;          /* 03:    C2 state works on MP system */
+       u8 pwr_button:1;        /* 04:    Power button is handled as a generic feature */
+       u8 sleep_button:1;      /* 05:    Sleep button is handled as a generic feature, or not present */
+       u8 fixed_rTC:1;         /* 06:    RTC wakeup stat not in fixed register space */
+       u8 rtcs4:1;             /* 07:    RTC wakeup stat not possible from S4 */
+       u8 tmr_val_ext:1;       /* 08:    tmr_val is 32 bits 0=24-bits */
+       u8 dock_cap:1;          /* 09:    Docking supported */
+       u8 reset_reg_sup:1;     /* 10:    System reset via the FADT RESET_REG supported */
+       u8 sealed_case:1;       /* 11:    No internal expansion capabilities and case is sealed */
+       u8 headless:1;          /* 12:    No local video capabilities or local input devices */
+       u8 cpu_sw_sleep:1;      /* 13:    Must execute native instruction after writing SLP_TYPx register */
+
+       u8 pci_exp_wak:1;       /* 14:    System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+       u8 use_platform_clock:1;        /* 15:    OSPM should use platform-provided timer (ACPI 3.0) */
+       u8 S4rtc_sts_valid:1;   /* 16:    Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+       u8 remote_power_on_capable:1;   /* 17:    System is compatible with remote power on (ACPI 3.0) */
+       u8 force_apic_cluster_model:1;  /* 18:    All local APICs must use cluster model (ACPI 3.0) */
+       u8 force_apic_physical_destination_mode:1;      /* 19:   all local x_aPICs must use physical dest mode (ACPI 3.0) */
+        u8:4;                  /* 20-23: Reserved, must be zero */
+       u8 reserved3;           /* 24-31: Reserved, must be zero */
+
+       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
+       u8 reset_value;         /* Value to write to the reset_register port to reset the system */
+       u8 reserved4[3];        /* These three bytes must be zero */
+       u64 xfirmware_ctrl;     /* 64-bit physical address of FACS */
+       u64 Xdsdt;              /* 64-bit physical address of DSDT */
+       struct acpi_generic_address xpm1a_evt_blk;      /* Extended Power Mgt 1a acpi_event Reg Blk address */
+       struct acpi_generic_address xpm1b_evt_blk;      /* Extended Power Mgt 1b acpi_event Reg Blk address */
+       struct acpi_generic_address xpm1a_cnt_blk;      /* Extended Power Mgt 1a Control Reg Blk address */
+       struct acpi_generic_address xpm1b_cnt_blk;      /* Extended Power Mgt 1b Control Reg Blk address */
+       struct acpi_generic_address xpm2_cnt_blk;       /* Extended Power Mgt 2 Control Reg Blk address */
+       struct acpi_generic_address xpm_tmr_blk;        /* Extended Power Mgt Timer Ctrl Reg Blk address */
+       struct acpi_generic_address xgpe0_blk;  /* Extended General Purpose acpi_event 0 Reg Blk address */
+       struct acpi_generic_address xgpe1_blk;  /* Extended General Purpose acpi_event 1 Reg Blk address */
 };
 
-
 /* "Down-revved" ACPI 2.0 FADT descriptor */
 
-struct fadt_descriptor_rev2_minus
-{
-       ACPI_TABLE_HEADER_DEF                       /* ACPI common table header */
-       FADT_REV2_COMMON
-       u8                              reserved2;          /* Reserved */
-       u32                             flags;
-       struct acpi_generic_address     reset_register;     /* Reset register address in GAS format */
-       u8                              reset_value;        /* Value to write to the reset_register port to reset the system. */
-       u8                              reserved7[3];       /* These three bytes must be zero */
+struct fadt_descriptor_rev2_minus {
+       ACPI_TABLE_HEADER_DEF   /* ACPI common table header */
+       FADT_REV2_COMMON u8 reserved2;  /* Reserved, must be zero */
+       u32 flags;
+       struct acpi_generic_address reset_register;     /* Reset register address in GAS format */
+       u8 reset_value;         /* Value to write to the reset_register port to reset the system. */
+       u8 reserved7[3];        /* Reserved, must be zero */
 };
 
-
 /* ECDT - Embedded Controller Boot Resources Table */
 
-struct ec_boot_resources
-{
-       ACPI_TABLE_HEADER_DEF
-       struct acpi_generic_address     ec_control;         /* Address of EC command/status register */
-       struct acpi_generic_address     ec_data;            /* Address of EC data register */
-       u32                             uid;                /* Unique ID - must be same as the EC _UID method */
-       u8                              gpe_bit;            /* The GPE for the EC */
-       u8                              ec_id[1];           /* Full namepath of the EC in the ACPI namespace */
+struct ec_boot_resources {
+       ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control;   /* Address of EC command/status register */
+       struct acpi_generic_address ec_data;    /* Address of EC data register */
+       u32 uid;                /* Unique ID - must be same as the EC _UID method */
+       u8 gpe_bit;             /* The GPE for the EC */
+       u8 ec_id[1];            /* Full namepath of the EC in the ACPI namespace */
 };
 
-
 /* SRAT - System Resource Affinity Table */
 
-struct static_resource_alloc
-{
-       u8                              type;
-       u8                              length;
-       u8                              proximity_domain_lo;
-       u8                              apic_id;
-       u32                             enabled         :1;
-       u32                             reserved3       :31;
-       u8                              local_sapic_eid;
-       u8                              proximity_domain_hi[3];
-       u32                             reserved4;
-};
+struct static_resource_alloc {
+       u8 type;
+       u8 length;
+       u8 proximity_domain_lo;
+       u8 apic_id;
 
-struct memory_affinity
-{
-       u8                              type;
-       u8                              length;
-       u32                             proximity_domain;
-       u16                             reserved3;
-       u64                             base_address;
-       u64                             address_length;
-       u32                             reserved4;
-       u32                             enabled         :1;
-       u32                             hot_pluggable   :1;
-       u32                             non_volatile    :1;
-       u32                             reserved5       :29;
-       u64                             reserved6;
+       /* Flags (32 bits) */
+
+       u8 enabled:1;           /* 00:    Use affinity structure */
+        u8:7;                  /* 01-07: Reserved, must be zero */
+       u8 reserved3[3];        /* 08-31: Reserved, must be zero */
+
+       u8 local_sapic_eid;
+       u8 proximity_domain_hi[3];
+       u32 reserved4;          /* Reserved, must be zero */
 };
 
-struct system_resource_affinity
-{
-       ACPI_TABLE_HEADER_DEF
-       u32                             reserved1;          /* Must be value '1' */
-       u64                             reserved2;
+struct memory_affinity {
+       u8 type;
+       u8 length;
+       u32 proximity_domain;
+       u16 reserved3;
+       u64 base_address;
+       u64 address_length;
+       u32 reserved4;
+
+       /* Flags (32 bits) */
+
+       u8 enabled:1;           /* 00:    Use affinity structure */
+       u8 hot_pluggable:1;     /* 01:    Memory region is hot pluggable */
+       u8 non_volatile:1;      /* 02:    Memory is non-volatile */
+        u8:5;                  /* 03-07: Reserved, must be zero */
+       u8 reserved5[3];        /* 08-31: Reserved, must be zero */
+
+       u64 reserved6;          /* Reserved, must be zero */
 };
 
+struct system_resource_affinity {
+       ACPI_TABLE_HEADER_DEF u32 reserved1;    /* Must be value '1' */
+       u64 reserved2;          /* Reserved, must be zero */
+};
 
 /* SLIT - System Locality Distance Information Table */
 
-struct system_locality_info
-{
-       ACPI_TABLE_HEADER_DEF
-       u64                             locality_count;
-       u8                              entry[1][1];
+struct system_locality_info {
+       ACPI_TABLE_HEADER_DEF u64 locality_count;
+       u8 entry[1][1];
 };
 
-
 #pragma pack()
 
-#endif /* __ACTBL2_H__ */
-
+#endif                         /* __ACTBL2_H__ */
index 7b4fb44261f3c46a6c6e1441c279670db436995e..10ac05bb36bc04b37fdd5ef074e5bb68ee108ca3 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef __ACTBL71_H__
 #define __ACTBL71_H__
 
-
 /* 0.71 FADT address_space data item bitmasks defines */
 /* If the associated bit is zero then it is in memory space else in io space */
 
 
 /* Only for clarity in declarations */
 
-typedef u64                         IO_ADDRESS;
-
+typedef u64 IO_ADDRESS;
 
 #pragma pack(1)
-struct  /* Root System Descriptor Pointer */
-{
-       NATIVE_CHAR             signature [8];          /* contains "RSD PTR " */
-       u8                              checksum;               /* to make sum of struct == 0 */
-       NATIVE_CHAR             oem_id [6];             /* OEM identification */
-       u8                              reserved;               /* Must be 0 for 1.0, 2 for 2.0 */
-       u64                             rsdt_physical_address;  /* 64-bit physical address of RSDT */
+struct {                       /* Root System Descriptor Pointer */
+       NATIVE_CHAR signature[8];       /* contains "RSD PTR " */
+       u8 checksum;            /* to make sum of struct == 0 */
+       NATIVE_CHAR oem_id[6];  /* OEM identification */
+       u8 reserved;            /* Must be 0 for 1.0, 2 for 2.0 */
+       u64 rsdt_physical_address;      /* 64-bit physical address of RSDT */
 };
 
-
 /*****************************************/
 /* IA64 Extensions to ACPI Spec Rev 0.71 */
 /* for the Root System Description Table */
 /*****************************************/
-struct
-{
-       struct acpi_table_header    header;                 /* Table header */
-       u32                         reserved_pad;           /* IA64 alignment, must be 0 */
-       u64                         table_offset_entry [1]; /* Array of pointers to other */
-                          /* tables' headers */
+struct {
+       struct acpi_table_header header;        /* Table header */
+       u32 reserved_pad;       /* IA64 alignment, must be 0 */
+       u64 table_offset_entry[1];      /* Array of pointers to other */
+       /* tables' headers */
 };
 
-
 /*******************************************/
 /* IA64 Extensions to ACPI Spec Rev 0.71   */
 /* for the Firmware ACPI Control Structure */
 /*******************************************/
-struct
-{
-       NATIVE_CHAR         signature[4];         /* signature "FACS" */
-       u32                         length;               /* length of structure, in bytes */
-       u32                         hardware_signature;   /* hardware configuration signature */
-       u32                         reserved4;            /* must be 0 */
-       u64                         firmware_waking_vector; /* ACPI OS waking vector */
-       u64                         global_lock;          /* Global Lock */
-       u32                         S4bios_f      : 1;    /* Indicates if S4BIOS support is present */
-       u32                         reserved1     : 31;   /* must be 0 */
-       u8                          reserved3 [28];       /* reserved - must be zero */
+struct {
+       NATIVE_CHAR signature[4];       /* signature "FACS" */
+       u32 length;             /* length of structure, in bytes */
+       u32 hardware_signature; /* hardware configuration signature */
+       u32 reserved4;          /* must be 0 */
+       u64 firmware_waking_vector;     /* ACPI OS waking vector */
+       u64 global_lock;        /* Global Lock */
+       u32 S4bios_f:1;         /* Indicates if S4BIOS support is present */
+       u32 reserved1:31;       /* must be 0 */
+       u8 reserved3[28];       /* reserved - must be zero */
 };
 
-
 /******************************************/
 /* IA64 Extensions to ACPI Spec Rev 0.71  */
 /* for the Fixed ACPI Description Table   */
 /******************************************/
-struct
-{
-       struct acpi_table_header    header;             /* table header */
-       u32                         reserved_pad;       /* IA64 alignment, must be 0 */
-       u64                         firmware_ctrl;      /* 64-bit Physical address of FACS */
-       u64                         dsdt;               /* 64-bit Physical address of DSDT */
-       u8                          model;              /* System Interrupt Model */
-       u8                          address_space;      /* Address Space Bitmask */
-       u16                         sci_int;            /* System vector of SCI interrupt */
-       u8                          acpi_enable;        /* value to write to smi_cmd to enable ACPI */
-       u8                          acpi_disable;       /* value to write to smi_cmd to disable ACPI */
-       u8                          S4bios_req;         /* Value to write to SMI CMD to enter S4BIOS state */
-       u8                          reserved2;          /* reserved - must be zero */
-       u64                         smi_cmd;            /* Port address of SMI command port */
-       u64                         pm1a_evt_blk;       /* Port address of Power Mgt 1a acpi_event Reg Blk */
-       u64                         pm1b_evt_blk;       /* Port address of Power Mgt 1b acpi_event Reg Blk */
-       u64                         pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
-       u64                         pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
-       u64                         pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
-       u64                         pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
-       u64                         gpe0_blk;           /* Port addr of General Purpose acpi_event 0 Reg Blk */
-       u64                         gpe1_blk;           /* Port addr of General Purpose acpi_event 1 Reg Blk */
-       u8                          pm1_evt_len;        /* Byte length of ports at pm1_x_evt_blk */
-       u8                          pm1_cnt_len;        /* Byte length of ports at pm1_x_cnt_blk */
-       u8                          pm2_cnt_len;        /* Byte Length of ports at pm2_cnt_blk */
-       u8                          pm_tm_len;          /* Byte Length of ports at pm_tm_blk */
-       u8                          gpe0_blk_len;       /* Byte Length of ports at gpe0_blk */
-       u8                          gpe1_blk_len;       /* Byte Length of ports at gpe1_blk */
-       u8                          gpe1_base;          /* offset in gpe model where gpe1 events start */
-       u8                          reserved3;          /* reserved */
-       u16                         plvl2_lat;          /* worst case HW latency to enter/exit C2 state */
-       u16                         plvl3_lat;          /* worst case HW latency to enter/exit C3 state */
-       u8                          day_alrm;           /* index to day-of-month alarm in RTC CMOS RAM */
-       u8                          mon_alrm;           /* index to month-of-year alarm in RTC CMOS RAM */
-       u8                          century;            /* index to century in RTC CMOS RAM */
-       u8                          reserved4;          /* reserved */
-       u32                         flush_cash  : 1;    /* PAL_FLUSH_CACHE is correctly supported */
-       u32                         reserved5   : 1;    /* reserved - must be zero */
-       u32                         proc_c1     : 1;    /* all processors support C1 state */
-       u32                         plvl2_up    : 1;    /* C2 state works on MP system */
-       u32                         pwr_button  : 1;    /* Power button is handled as a generic feature */
-       u32                         sleep_button : 1;   /* Sleep button is handled as a generic feature, or not present */
-       u32                         fixed_rTC   : 1;    /* RTC wakeup stat not in fixed register space */
-       u32                         rtcs4       : 1;    /* RTC wakeup stat not possible from S4 */
-       u32                         tmr_val_ext : 1;    /* tmr_val is 32 bits */
-       u32                         dock_cap    : 1;    /* Supports Docking */
-       u32                         reserved6   : 22;    /* reserved - must be zero */
+struct {
+       struct acpi_table_header header;        /* table header */
+       u32 reserved_pad;       /* IA64 alignment, must be 0 */
+       u64 firmware_ctrl;      /* 64-bit Physical address of FACS */
+       u64 dsdt;               /* 64-bit Physical address of DSDT */
+       u8 model;               /* System Interrupt Model */
+       u8 address_space;       /* Address Space Bitmask */
+       u16 sci_int;            /* System vector of SCI interrupt */
+       u8 acpi_enable;         /* value to write to smi_cmd to enable ACPI */
+       u8 acpi_disable;        /* value to write to smi_cmd to disable ACPI */
+       u8 S4bios_req;          /* Value to write to SMI CMD to enter S4BIOS state */
+       u8 reserved2;           /* reserved - must be zero */
+       u64 smi_cmd;            /* Port address of SMI command port */
+       u64 pm1a_evt_blk;       /* Port address of Power Mgt 1a acpi_event Reg Blk */
+       u64 pm1b_evt_blk;       /* Port address of Power Mgt 1b acpi_event Reg Blk */
+       u64 pm1a_cnt_blk;       /* Port address of Power Mgt 1a Control Reg Blk */
+       u64 pm1b_cnt_blk;       /* Port address of Power Mgt 1b Control Reg Blk */
+       u64 pm2_cnt_blk;        /* Port address of Power Mgt 2 Control Reg Blk */
+       u64 pm_tmr_blk;         /* Port address of Power Mgt Timer Ctrl Reg Blk */
+       u64 gpe0_blk;           /* Port addr of General Purpose acpi_event 0 Reg Blk */
+       u64 gpe1_blk;           /* Port addr of General Purpose acpi_event 1 Reg Blk */
+       u8 pm1_evt_len;         /* Byte length of ports at pm1_x_evt_blk */
+       u8 pm1_cnt_len;         /* Byte length of ports at pm1_x_cnt_blk */
+       u8 pm2_cnt_len;         /* Byte Length of ports at pm2_cnt_blk */
+       u8 pm_tm_len;           /* Byte Length of ports at pm_tm_blk */
+       u8 gpe0_blk_len;        /* Byte Length of ports at gpe0_blk */
+       u8 gpe1_blk_len;        /* Byte Length of ports at gpe1_blk */
+       u8 gpe1_base;           /* offset in gpe model where gpe1 events start */
+       u8 reserved3;           /* reserved */
+       u16 plvl2_lat;          /* worst case HW latency to enter/exit C2 state */
+       u16 plvl3_lat;          /* worst case HW latency to enter/exit C3 state */
+       u8 day_alrm;            /* index to day-of-month alarm in RTC CMOS RAM */
+       u8 mon_alrm;            /* index to month-of-year alarm in RTC CMOS RAM */
+       u8 century;             /* index to century in RTC CMOS RAM */
+       u8 reserved4;           /* reserved */
+       u32 flush_cash:1;       /* PAL_FLUSH_CACHE is correctly supported */
+       u32 reserved5:1;        /* reserved - must be zero */
+       u32 proc_c1:1;          /* all processors support C1 state */
+       u32 plvl2_up:1;         /* C2 state works on MP system */
+       u32 pwr_button:1;       /* Power button is handled as a generic feature */
+       u32 sleep_button:1;     /* Sleep button is handled as a generic feature, or not present */
+       u32 fixed_rTC:1;        /* RTC wakeup stat not in fixed register space */
+       u32 rtcs4:1;            /* RTC wakeup stat not possible from S4 */
+       u32 tmr_val_ext:1;      /* tmr_val is 32 bits */
+       u32 dock_cap:1;         /* Supports Docking */
+       u32 reserved6:22;       /* reserved - must be zero */
 };
 
 #pragma pack()
 
-#endif /* __ACTBL71_H__ */
-
+#endif                         /* __ACTBL71_H__ */
index 3a451dc48ac865eb4d1f71ad3ecb52e1a999fff5..6213b27516e8b583dc852475c5cf4f04e9eb26ee 100644 (file)
 
 /*! [Begin] no source code translation (keep the typedefs) */
 
-
-
 /*
  * Data type ranges
  * Note: These macros are designed to be compiler independent as well as
  * working around problems that some 32-bit compilers have with 64-bit
  * constants.
  */
-#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
-#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
-#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
-#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
+#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0))        /* 0xFF               */
+#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0))        /* 0xFFFF             */
+#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0))        /* 0xFFFFFFFF         */
+#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0))        /* 0xFFFFFFFFFFFFFFFF */
 #define ACPI_ASCII_MAX                  0x7F
 
-
 #ifdef DEFINE_ALTERNATE_TYPES
 /*
  * Types used only in translated source, defined here to enable
  * cross-platform compilation only.
  */
-typedef int                             s32;
-typedef unsigned char                   u8;
-typedef unsigned short                  u16;
-typedef unsigned int                    u32;
-typedef COMPILER_DEPENDENT_UINT64       u64;
+typedef int s32;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef COMPILER_DEPENDENT_UINT64 u64;
 
 #endif
 
-
 /*
  * Data types - Fixed across all compilation models (16/32/64)
  *
@@ -102,30 +98,29 @@ typedef COMPILER_DEPENDENT_UINT64       u64;
 /*
  * 64-bit type definitions
  */
-typedef unsigned char                   UINT8;
-typedef unsigned char                   BOOLEAN;
-typedef unsigned short                  UINT16;
-typedef int                             INT32;
-typedef unsigned int                    UINT32;
-typedef COMPILER_DEPENDENT_INT64        INT64;
-typedef COMPILER_DEPENDENT_UINT64       UINT64;
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned short UINT16;
+typedef int INT32;
+typedef unsigned int UINT32;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
 
 /*! [End] no source code translation !*/
 
-typedef s64                                     acpi_native_int;
-typedef u64                                     acpi_native_uint;
+typedef s64 acpi_native_int;
+typedef u64 acpi_native_uint;
 
-typedef u64                                     acpi_table_ptr;
-typedef u64                                     acpi_io_address;
-typedef u64                                     acpi_physical_address;
-typedef u64                                     acpi_size;
+typedef u64 acpi_table_ptr;
+typedef u64 acpi_io_address;
+typedef u64 acpi_physical_address;
+typedef u64 acpi_size;
 
-#define ALIGNED_ADDRESS_BOUNDARY        0x00000008      /* No hardware alignment support in IA64 */
-#define ACPI_USE_NATIVE_DIVIDE                          /* Native 64-bit integer support */
+#define ALIGNED_ADDRESS_BOUNDARY        0x00000008     /* No hardware alignment support in IA64 */
+#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
 
-
 #elif ACPI_MACHINE_WIDTH == 16
 
 /*! [Begin] no source code translation (keep the typedefs) */
@@ -133,32 +128,31 @@ typedef u64                                     acpi_size;
 /*
  * 16-bit type definitions
  */
-typedef unsigned char                   UINT8;
-typedef unsigned char                   BOOLEAN;
-typedef unsigned int                    UINT16;
-typedef long                            INT32;
-typedef int                             INT16;
-typedef unsigned long                   UINT32;
-
-struct
-{
-       UINT32                                  Lo;
-       UINT32                                  Hi;
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned int UINT16;
+typedef long INT32;
+typedef int INT16;
+typedef unsigned long UINT32;
+
+struct {
+       UINT32 Lo;
+       UINT32 Hi;
 };
 
 /*! [End] no source code translation !*/
 
-typedef u16                                     acpi_native_uint;
-typedef s16                                     acpi_native_int;
+typedef u16 acpi_native_uint;
+typedef s16 acpi_native_int;
 
-typedef u32                                     acpi_table_ptr;
-typedef u32                                     acpi_io_address;
-typedef char                                    *acpi_physical_address;
-typedef u16                                     acpi_size;
+typedef u32 acpi_table_ptr;
+typedef u32 acpi_io_address;
+typedef char *acpi_physical_address;
+typedef u16 acpi_size;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000002
 #define ACPI_MISALIGNED_TRANSFERS
-#define ACPI_USE_NATIVE_DIVIDE                          /* No 64-bit integers, ok to use native divide */
+#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
 #define ACPI_MAX_PTR                    ACPI_UINT16_MAX
 #define ACPI_SIZE_MAX                   ACPI_UINT16_MAX
 
@@ -168,7 +162,6 @@ typedef u16                                     acpi_size;
  */
 #define ACPI_NO_INTEGER64_SUPPORT
 
-
 #elif ACPI_MACHINE_WIDTH == 32
 
 /*! [Begin] no source code translation (keep the typedefs) */
@@ -176,23 +169,23 @@ typedef u16                                     acpi_size;
 /*
  * 32-bit type definitions (default)
  */
-typedef unsigned char                   UINT8;
-typedef unsigned char                   BOOLEAN;
-typedef unsigned short                  UINT16;
-typedef int                             INT32;
-typedef unsigned int                    UINT32;
-typedef COMPILER_DEPENDENT_INT64        INT64;
-typedef COMPILER_DEPENDENT_UINT64       UINT64;
+typedef unsigned char UINT8;
+typedef unsigned char BOOLEAN;
+typedef unsigned short UINT16;
+typedef int INT32;
+typedef unsigned int UINT32;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
 
 /*! [End] no source code translation !*/
 
-typedef s32                                     acpi_native_int;
-typedef u32                                     acpi_native_uint;
+typedef s32 acpi_native_int;
+typedef u32 acpi_native_uint;
 
-typedef u64                                     acpi_table_ptr;
-typedef u32                                     acpi_io_address;
-typedef u64                                     acpi_physical_address;
-typedef u32                                     acpi_size;
+typedef u64 acpi_table_ptr;
+typedef u32 acpi_io_address;
+typedef u64 acpi_physical_address;
+typedef u32 acpi_size;
 
 #define ALIGNED_ADDRESS_BOUNDARY        0x00000004
 #define ACPI_MISALIGNED_TRANSFERS
@@ -203,29 +196,27 @@ typedef u32                                     acpi_size;
 #error unknown ACPI_MACHINE_WIDTH
 #endif
 
-
 /*
- * Miscellaneous common types
+ * This type is used for bitfields in ACPI tables. The only type that is
+ * even remotely portable is u8. Anything else is not portable, so
+ * do not add any more bitfield types.
  */
-typedef u16                                     UINT16_BIT;
-typedef u32                                     UINT32_BIT;
-typedef acpi_native_uint                        ACPI_PTRDIFF;
+typedef u8 UINT8_BIT;
+typedef acpi_native_uint ACPI_PTRDIFF;
 
 /*
  * Pointer overlays to avoid lots of typecasting for
  * code that accepts both physical and logical pointers.
  */
-union acpi_pointers
-{
-       acpi_physical_address               physical;
-       void                                *logical;
-       acpi_table_ptr                      value;
+union acpi_pointers {
+       acpi_physical_address physical;
+       void *logical;
+       acpi_table_ptr value;
 };
 
-struct acpi_pointer
-{
-       u32                                 pointer_type;
-       union acpi_pointers                 pointer;
+struct acpi_pointer {
+       u32 pointer_type;
+       union acpi_pointers pointer;
 };
 
 /* pointer_types for above */
@@ -243,6 +234,14 @@ struct acpi_pointer
 #define ACPI_LOGMODE_PHYSPTR            ACPI_LOGICAL_ADDRESSING  | ACPI_PHYSICAL_POINTER
 #define ACPI_LOGMODE_LOGPTR             ACPI_LOGICAL_ADDRESSING  | ACPI_LOGICAL_POINTER
 
+/*
+ * If acpi_cache_t was not defined in the OS-dependent header,
+ * define it now. This is typically the case where the local cache
+ * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
+ */
+#ifndef acpi_cache_t
+#define acpi_cache_t                            struct acpi_memory_list
+#endif
 
 /*
  * Useful defines
@@ -261,34 +260,29 @@ struct acpi_pointer
 #define NULL                            (void *) 0
 #endif
 
-
 /*
  * Local datatypes
  */
-typedef u32                                     acpi_status;    /* All ACPI Exceptions */
-typedef u32                                     acpi_name;      /* 4-byte ACPI name */
-typedef char *                                  acpi_string;    /* Null terminated ASCII string */
-typedef void *                                  acpi_handle;    /* Actually a ptr to an Node */
-
-struct uint64_struct
-{
-       u32                                 lo;
-       u32                                 hi;
+typedef u32 acpi_status;       /* All ACPI Exceptions */
+typedef u32 acpi_name;         /* 4-byte ACPI name */
+typedef char *acpi_string;     /* Null terminated ASCII string */
+typedef void *acpi_handle;     /* Actually a ptr to an Node */
+
+struct uint64_struct {
+       u32 lo;
+       u32 hi;
 };
 
-union uint64_overlay
-{
-       u64                                 full;
-       struct uint64_struct                part;
+union uint64_overlay {
+       u64 full;
+       struct uint64_struct part;
 };
 
-struct uint32_struct
-{
-       u32                                 lo;
-       u32                                 hi;
+struct uint32_struct {
+       u32 lo;
+       u32 hi;
 };
 
-
 /*
  * Acpi integer width. In ACPI version 1, integers are
  * 32 bits.  In ACPI version 2, integers are 64 bits.
@@ -300,26 +294,24 @@ struct uint32_struct
 
 /* 32-bit integers only, no 64-bit support */
 
-typedef u32                                     acpi_integer;
+typedef u32 acpi_integer;
 #define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
 #define ACPI_INTEGER_BIT_SIZE           32
-#define ACPI_MAX_DECIMAL_DIGITS         10  /* 2^32 = 4,294,967,296 */
-
-#define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 32-bit divide */
+#define ACPI_MAX_DECIMAL_DIGITS         10     /* 2^32 = 4,294,967,296 */
 
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
 
 #else
 
 /* 64-bit integers */
 
-typedef u64                                     acpi_integer;
+typedef u64 acpi_integer;
 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
 #define ACPI_INTEGER_BIT_SIZE           64
-#define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
-
+#define ACPI_MAX_DECIMAL_DIGITS         20     /* 2^64 = 18,446,744,073,709,551,616 */
 
 #if ACPI_MACHINE_WIDTH == 64
-#define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 64-bit divide */
+#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
 #endif
 #endif
 
@@ -333,7 +325,6 @@ typedef u64                                     acpi_integer;
  */
 #define ACPI_ROOT_OBJECT                (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
 
-
 /*
  * Initialization sequence
  */
@@ -400,7 +391,7 @@ typedef u64                                     acpi_integer;
 /*
  *  Table types.  These values are passed to the table related APIs
  */
-typedef u32                                     acpi_table_type;
+typedef u32 acpi_table_type;
 
 #define ACPI_TABLE_RSDP                 (acpi_table_type) 0
 #define ACPI_TABLE_DSDT                 (acpi_table_type) 1
@@ -421,22 +412,22 @@ typedef u32                                     acpi_table_type;
  * NOTE: Types must be kept in sync with the global acpi_ns_properties
  * and acpi_ns_type_names arrays.
  */
-typedef u32                                     acpi_object_type;
+typedef u32 acpi_object_type;
 
 #define ACPI_TYPE_ANY                   0x00
-#define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
+#define ACPI_TYPE_INTEGER               0x01   /* Byte/Word/Dword/Zero/One/Ones */
 #define ACPI_TYPE_STRING                0x02
 #define ACPI_TYPE_BUFFER                0x03
-#define ACPI_TYPE_PACKAGE               0x04  /* byte_const, multiple data_term/Constant/super_name */
+#define ACPI_TYPE_PACKAGE               0x04   /* byte_const, multiple data_term/Constant/super_name */
 #define ACPI_TYPE_FIELD_UNIT            0x05
-#define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
+#define ACPI_TYPE_DEVICE                0x06   /* Name, multiple Node */
 #define ACPI_TYPE_EVENT                 0x07
-#define ACPI_TYPE_METHOD                0x08  /* Name, byte_const, multiple Code */
+#define ACPI_TYPE_METHOD                0x08   /* Name, byte_const, multiple Code */
 #define ACPI_TYPE_MUTEX                 0x09
 #define ACPI_TYPE_REGION                0x0A
-#define ACPI_TYPE_POWER                 0x0B  /* Name,byte_const,word_const,multi Node */
-#define ACPI_TYPE_PROCESSOR             0x0C  /* Name,byte_const,Dword_const,byte_const,multi nm_o */
-#define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
+#define ACPI_TYPE_POWER                 0x0B   /* Name,byte_const,word_const,multi Node */
+#define ACPI_TYPE_PROCESSOR             0x0C   /* Name,byte_const,Dword_const,byte_const,multi nm_o */
+#define ACPI_TYPE_THERMAL               0x0D   /* Name, multiple Node */
 #define ACPI_TYPE_BUFFER_FIELD          0x0E
 #define ACPI_TYPE_DDB_HANDLE            0x0F
 #define ACPI_TYPE_DEBUG_OBJECT          0x10
@@ -453,16 +444,16 @@ typedef u32                                     acpi_object_type;
 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
-#define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, ref_of, Index */
+#define ACPI_TYPE_LOCAL_REFERENCE       0x14   /* Arg#, Local#, Name, Debug, ref_of, Index */
 #define ACPI_TYPE_LOCAL_ALIAS           0x15
 #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
 #define ACPI_TYPE_LOCAL_NOTIFY          0x17
 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
 #define ACPI_TYPE_LOCAL_RESOURCE        0x19
 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
-#define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple object_list Nodes */
+#define ACPI_TYPE_LOCAL_SCOPE           0x1B   /* 1 Name, multiple object_list Nodes */
 
-#define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
+#define ACPI_TYPE_NS_NODE_MAX           0x1B   /* Last typecode used within a NS Node */
 
 /*
  * These are special object types that never appear in
@@ -506,7 +497,7 @@ typedef u32                                     acpi_object_type;
 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
-#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
+#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF     /* ARG or LOCAL */
 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 
 /*
@@ -519,7 +510,7 @@ typedef u32                                     acpi_object_type;
 /*
  * Event Types: Fixed & General Purpose
  */
-typedef u32                                     acpi_event_type;
+typedef u32 acpi_event_type;
 
 /*
  * Fixed events
@@ -547,7 +538,7 @@ typedef u32                                     acpi_event_type;
  *          |     +----- Set?
  *          +----------- <Reserved>
  */
-typedef u32                                     acpi_event_status;
+typedef u32 acpi_event_status;
 
 #define ACPI_EVENT_FLAG_DISABLED        (acpi_event_status) 0x00
 #define ACPI_EVENT_FLAG_ENABLED         (acpi_event_status) 0x01
@@ -564,7 +555,6 @@ typedef u32                                     acpi_event_status;
 #define ACPI_GPE_ENABLE                 0
 #define ACPI_GPE_DISABLE                1
 
-
 /*
  * GPE info flags - Per GPE
  * +-+-+-+---+---+-+
@@ -585,22 +575,22 @@ typedef u32                                     acpi_event_status;
 #define ACPI_GPE_TYPE_MASK              (u8) 0x06
 #define ACPI_GPE_TYPE_WAKE_RUN          (u8) 0x06
 #define ACPI_GPE_TYPE_WAKE              (u8) 0x02
-#define ACPI_GPE_TYPE_RUNTIME           (u8) 0x04    /* Default */
+#define ACPI_GPE_TYPE_RUNTIME           (u8) 0x04      /* Default */
 
 #define ACPI_GPE_DISPATCH_MASK          (u8) 0x18
 #define ACPI_GPE_DISPATCH_HANDLER       (u8) 0x08
 #define ACPI_GPE_DISPATCH_METHOD        (u8) 0x10
-#define ACPI_GPE_DISPATCH_NOT_USED      (u8) 0x00    /* Default */
+#define ACPI_GPE_DISPATCH_NOT_USED      (u8) 0x00      /* Default */
 
 #define ACPI_GPE_RUN_ENABLE_MASK        (u8) 0x20
 #define ACPI_GPE_RUN_ENABLED            (u8) 0x20
-#define ACPI_GPE_RUN_DISABLED           (u8) 0x00    /* Default */
+#define ACPI_GPE_RUN_DISABLED           (u8) 0x00      /* Default */
 
 #define ACPI_GPE_WAKE_ENABLE_MASK       (u8) 0x40
 #define ACPI_GPE_WAKE_ENABLED           (u8) 0x40
-#define ACPI_GPE_WAKE_DISABLED          (u8) 0x00    /* Default */
+#define ACPI_GPE_WAKE_DISABLED          (u8) 0x00      /* Default */
 
-#define ACPI_GPE_ENABLE_MASK            (u8) 0x60    /* Both run/wake */
+#define ACPI_GPE_ENABLE_MASK            (u8) 0x60      /* Both run/wake */
 
 #define ACPI_GPE_SYSTEM_MASK            (u8) 0x80
 #define ACPI_GPE_SYSTEM_RUNNING         (u8) 0x80
@@ -609,13 +599,12 @@ typedef u32                                     acpi_event_status;
 /*
  * Flags for GPE and Lock interfaces
  */
-#define ACPI_EVENT_WAKE_ENABLE          0x2             /* acpi_gpe_enable */
-#define ACPI_EVENT_WAKE_DISABLE         0x2             /* acpi_gpe_disable */
+#define ACPI_EVENT_WAKE_ENABLE          0x2    /* acpi_gpe_enable */
+#define ACPI_EVENT_WAKE_DISABLE         0x2    /* acpi_gpe_disable */
 
 #define ACPI_NOT_ISR                    0x1
 #define ACPI_ISR                        0x0
 
-
 /* Notify types */
 
 #define ACPI_SYSTEM_NOTIFY              0x1
@@ -625,10 +614,9 @@ typedef u32                                     acpi_event_status;
 
 #define ACPI_MAX_SYS_NOTIFY             0x7f
 
-
 /* Address Space (Operation Region) Types */
 
-typedef u8                                      acpi_adr_space_type;
+typedef u8 acpi_adr_space_type;
 
 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (acpi_adr_space_type) 0
 #define ACPI_ADR_SPACE_SYSTEM_IO        (acpi_adr_space_type) 1
@@ -640,7 +628,6 @@ typedef u8                                      acpi_adr_space_type;
 #define ACPI_ADR_SPACE_DATA_TABLE       (acpi_adr_space_type) 7
 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (acpi_adr_space_type) 127
 
-
 /*
  * bit_register IDs
  * These are bitfields defined within the full ACPI registers
@@ -674,74 +661,62 @@ typedef u8                                      acpi_adr_space_type;
 #define ACPI_BITREG_MAX                         0x15
 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
 
-
 /*
  * External ACPI object definition
  */
-union acpi_object
-{
-       acpi_object_type                    type;   /* See definition of acpi_ns_type for values */
-       struct
-       {
-               acpi_object_type                    type;
-               acpi_integer                        value;      /* The actual number */
+union acpi_object {
+       acpi_object_type type;  /* See definition of acpi_ns_type for values */
+       struct {
+               acpi_object_type type;
+               acpi_integer value;     /* The actual number */
        } integer;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 length;     /* # of bytes in string, excluding trailing null */
-               char                                *pointer;   /* points to the string value */
+       struct {
+               acpi_object_type type;
+               u32 length;     /* # of bytes in string, excluding trailing null */
+               char *pointer;  /* points to the string value */
        } string;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 length;     /* # of bytes in buffer */
-               u8                                  *pointer;   /* points to the buffer */
+       struct {
+               acpi_object_type type;
+               u32 length;     /* # of bytes in buffer */
+               u8 *pointer;    /* points to the buffer */
        } buffer;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 fill1;
-               acpi_handle                         handle;     /* object reference */
+       struct {
+               acpi_object_type type;
+               u32 fill1;
+               acpi_handle handle;     /* object reference */
        } reference;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 count;      /* # of elements in package */
-               union acpi_object                   *elements;  /* Pointer to an array of ACPI_OBJECTs */
+       struct {
+               acpi_object_type type;
+               u32 count;      /* # of elements in package */
+               union acpi_object *elements;    /* Pointer to an array of ACPI_OBJECTs */
        } package;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 proc_id;
-               acpi_io_address                     pblk_address;
-               u32                                 pblk_length;
+       struct {
+               acpi_object_type type;
+               u32 proc_id;
+               acpi_io_address pblk_address;
+               u32 pblk_length;
        } processor;
 
-       struct
-       {
-               acpi_object_type                    type;
-               u32                                 system_level;
-               u32                                 resource_order;
+       struct {
+               acpi_object_type type;
+               u32 system_level;
+               u32 resource_order;
        } power_resource;
 };
 
-
 /*
  * List of objects, used as a parameter list for control method evaluation
  */
-struct acpi_object_list
-{
-       u32                                 count;
-       union acpi_object                   *pointer;
+struct acpi_object_list {
+       u32 count;
+       union acpi_object *pointer;
 };
 
-
 /*
  * Miscellaneous common Data Structures used by the interfaces
  */
@@ -749,13 +724,11 @@ struct acpi_object_list
 #define ACPI_ALLOCATE_BUFFER        (acpi_size) (-1)
 #define ACPI_ALLOCATE_LOCAL_BUFFER  (acpi_size) (-2)
 
-struct acpi_buffer
-{
-       acpi_size                           length;         /* Length in bytes of the buffer */
-       void                                *pointer;       /* pointer to buffer */
+struct acpi_buffer {
+       acpi_size length;       /* Length in bytes of the buffer */
+       void *pointer;          /* pointer to buffer */
 };
 
-
 /*
  * name_type for acpi_get_name
  */
@@ -763,7 +736,6 @@ struct acpi_buffer
 #define ACPI_SINGLE_NAME                1
 #define ACPI_NAME_TYPE_MAX              1
 
-
 /*
  * Structure and flags for acpi_get_system_info
  */
@@ -772,139 +744,106 @@ struct acpi_buffer
 #define ACPI_SYS_MODE_LEGACY            0x0002
 #define ACPI_SYS_MODES_MASK             0x0003
 
-
 /*
  * ACPI Table Info.  One per ACPI table _type_
  */
-struct acpi_table_info
-{
-       u32                                 count;
+struct acpi_table_info {
+       u32 count;
 };
 
-
 /*
  * System info returned by acpi_get_system_info()
  */
-struct acpi_system_info
-{
-       u32                                 acpi_ca_version;
-       u32                                 flags;
-       u32                                 timer_resolution;
-       u32                                 reserved1;
-       u32                                 reserved2;
-       u32                                 debug_level;
-       u32                                 debug_layer;
-       u32                                 num_table_types;
-       struct acpi_table_info              table_info [NUM_ACPI_TABLE_TYPES];
+struct acpi_system_info {
+       u32 acpi_ca_version;
+       u32 flags;
+       u32 timer_resolution;
+       u32 reserved1;
+       u32 reserved2;
+       u32 debug_level;
+       u32 debug_layer;
+       u32 num_table_types;
+       struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES];
 };
 
-
 /*
  * Types specific to the OS service interfaces
  */
-typedef u32
-(ACPI_SYSTEM_XFACE *acpi_osd_handler) (
-       void                            *context);
+typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context);
 
 typedef void
-(ACPI_SYSTEM_XFACE *acpi_osd_exec_callback) (
-       void                            *context);
+ (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context);
 
 /*
  * Various handlers and callback procedures
  */
-typedef
-u32 (*acpi_event_handler) (
-       void                                *context);
+typedef u32(*acpi_event_handler) (void *context);
 
 typedef
-void (*acpi_notify_handler) (
-       acpi_handle                         device,
-       u32                                 value,
-       void                                *context);
+void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context);
 
 typedef
-void (*acpi_object_handler) (
-       acpi_handle                         object,
-       u32                                 function,
-       void                                *data);
+void (*acpi_object_handler) (acpi_handle object, u32 function, void *data);
 
-typedef
-acpi_status (*acpi_init_handler) (
-       acpi_handle                         object,
-       u32                                 function);
+typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function);
 
 #define ACPI_INIT_DEVICE_INI        1
 
 typedef
-acpi_status (*acpi_exception_handler) (
-       acpi_status                     aml_status,
-       acpi_name                       name,
-       u16                             opcode,
-       u32                             aml_offset,
-       void                            *context);
-
+acpi_status(*acpi_exception_handler) (acpi_status aml_status,
+                                     acpi_name name,
+                                     u16 opcode,
+                                     u32 aml_offset, void *context);
 
 /* Address Spaces (For Operation Regions) */
 
 typedef
-acpi_status (*acpi_adr_space_handler) (
-       u32                                 function,
-       acpi_physical_address               address,
-       u32                                 bit_width,
-       acpi_integer                        *value,
-       void                                *handler_context,
-       void                                *region_context);
+acpi_status(*acpi_adr_space_handler) (u32 function,
+                                     acpi_physical_address address,
+                                     u32 bit_width,
+                                     acpi_integer * value,
+                                     void *handler_context,
+                                     void *region_context);
 
 #define ACPI_DEFAULT_HANDLER        NULL
 
-
 typedef
-acpi_status (*acpi_adr_space_setup) (
-       acpi_handle                         region_handle,
-       u32                                 function,
-       void                                *handler_context,
-       void                                **region_context);
+acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
+                                   u32 function,
+                                   void *handler_context,
+                                   void **region_context);
 
 #define ACPI_REGION_ACTIVATE    0
 #define ACPI_REGION_DEACTIVATE  1
 
 typedef
-acpi_status (*acpi_walk_callback) (
-       acpi_handle                         obj_handle,
-       u32                                 nesting_level,
-       void                                *context,
-       void                                **return_value);
-
+acpi_status(*acpi_walk_callback) (acpi_handle obj_handle,
+                                 u32 nesting_level,
+                                 void *context, void **return_value);
 
 /* Interrupt handler return values */
 
 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
 #define ACPI_INTERRUPT_HANDLED          0x01
 
-
 /* Common string version of device HIDs and UIDs */
 
-struct acpi_device_id
-{
-       char                            value[ACPI_DEVICE_ID_LENGTH];
+struct acpi_device_id {
+       char value[ACPI_DEVICE_ID_LENGTH];
 };
 
 /* Common string version of device CIDs */
 
-struct acpi_compatible_id
-{
-       char                            value[ACPI_MAX_CID_LENGTH];
+struct acpi_compatible_id {
+       char value[ACPI_MAX_CID_LENGTH];
 };
 
-struct acpi_compatible_id_list
-{
-       u32                             count;
-       u32                             size;
-       struct acpi_compatible_id       id[1];
+struct acpi_compatible_id_list {
+       u32 count;
+       u32 size;
+       struct acpi_compatible_id id[1];
 };
 
-
 /* Structure and flags for acpi_get_object_info */
 
 #define ACPI_VALID_STA                  0x0001
@@ -914,55 +853,45 @@ struct acpi_compatible_id_list
 #define ACPI_VALID_CID                  0x0010
 #define ACPI_VALID_SXDS                 0x0020
 
-
 #define ACPI_COMMON_OBJ_INFO \
        acpi_object_type                    type;           /* ACPI object type */ \
-       acpi_name                           name            /* ACPI object Name */
-
+       acpi_name                           name        /* ACPI object Name */
 
-struct acpi_obj_info_header
-{
+struct acpi_obj_info_header {
        ACPI_COMMON_OBJ_INFO;
 };
 
-
 /* Structure returned from Get Object Info */
 
-struct acpi_device_info
-{
+struct acpi_device_info {
        ACPI_COMMON_OBJ_INFO;
 
-       u32                                 valid;              /* Indicates which fields below are valid */
-       u32                                 current_status;     /* _STA value */
-       acpi_integer                        address;            /* _ADR value if any */
-       struct acpi_device_id               hardware_id;        /* _HID value if any */
-       struct acpi_device_id               unique_id;          /* _UID value if any */
-       u8                                  highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */
-       struct acpi_compatible_id_list      compatibility_id;   /* List of _CIDs if any */
+       u32 valid;              /* Indicates which fields below are valid */
+       u32 current_status;     /* _STA value */
+       acpi_integer address;   /* _ADR value if any */
+       struct acpi_device_id hardware_id;      /* _HID value if any */
+       struct acpi_device_id unique_id;        /* _UID value if any */
+       u8 highest_dstates[4];  /* _sx_d values: 0xFF indicates not valid */
+       struct acpi_compatible_id_list compatibility_id;        /* List of _CIDs if any */
 };
 
-
 /* Context structs for address space handlers */
 
-struct acpi_pci_id
-{
-       u16                                 segment;
-       u16                                 bus;
-       u16                                 device;
-       u16                                 function;
+struct acpi_pci_id {
+       u16 segment;
+       u16 bus;
+       u16 device;
+       u16 function;
 };
 
-
-struct acpi_mem_space_context
-{
-       u32                                 length;
-       acpi_physical_address               address;
-       acpi_physical_address               mapped_physical_address;
-       u8                                  *mapped_logical_address;
-       acpi_size                           mapped_length;
+struct acpi_mem_space_context {
+       u32 length;
+       acpi_physical_address address;
+       acpi_physical_address mapped_physical_address;
+       u8 *mapped_logical_address;
+       acpi_size mapped_length;
 };
 
-
 /*
  * Definitions for Resource Attributes
  */
@@ -992,8 +921,8 @@ struct acpi_mem_space_context
 /*
  *  IO Port Descriptor Decode
  */
-#define ACPI_DECODE_10                  (u8) 0x00    /* 10-bit IO address decode */
-#define ACPI_DECODE_16                  (u8) 0x01    /* 16-bit IO address decode */
+#define ACPI_DECODE_10                  (u8) 0x00      /* 10-bit IO address decode */
+#define ACPI_DECODE_16                  (u8) 0x01      /* 16-bit IO address decode */
 
 /*
  *  IRQ Attributes
@@ -1045,32 +974,28 @@ struct acpi_mem_space_context
 #define ACPI_PRODUCER                   (u8) 0x00
 #define ACPI_CONSUMER                   (u8) 0x01
 
-
 /*
  *  Structures used to describe device resources
  */
-struct acpi_resource_irq
-{
-       u32                                 edge_level;
-       u32                                 active_high_low;
-       u32                                 shared_exclusive;
-       u32                                 number_of_interrupts;
-       u32                                 interrupts[1];
+struct acpi_resource_irq {
+       u32 edge_level;
+       u32 active_high_low;
+       u32 shared_exclusive;
+       u32 number_of_interrupts;
+       u32 interrupts[1];
 };
 
-struct acpi_resource_dma
-{
-       u32                                 type;
-       u32                                 bus_master;
-       u32                                 transfer;
-       u32                                 number_of_channels;
-       u32                                 channels[1];
+struct acpi_resource_dma {
+       u32 type;
+       u32 bus_master;
+       u32 transfer;
+       u32 number_of_channels;
+       u32 channels[1];
 };
 
-struct acpi_resource_start_dpf
-{
-       u32                                 compatibility_priority;
-       u32                                 performance_robustness;
+struct acpi_resource_start_dpf {
+       u32 compatibility_priority;
+       u32 performance_robustness;
 };
 
 /*
@@ -1078,149 +1003,127 @@ struct acpi_resource_start_dpf
  * needed because it has no fields
  */
 
-struct acpi_resource_io
-{
-       u32                                 io_decode;
-       u32                                 min_base_address;
-       u32                                 max_base_address;
-       u32                                 alignment;
-       u32                                 range_length;
+struct acpi_resource_io {
+       u32 io_decode;
+       u32 min_base_address;
+       u32 max_base_address;
+       u32 alignment;
+       u32 range_length;
 };
 
-struct acpi_resource_fixed_io
-{
-       u32                                 base_address;
-       u32                                 range_length;
+struct acpi_resource_fixed_io {
+       u32 base_address;
+       u32 range_length;
 };
 
-struct acpi_resource_vendor
-{
-       u32                                 length;
-       u8                                  reserved[1];
+struct acpi_resource_vendor {
+       u32 length;
+       u8 reserved[1];
 };
 
-struct acpi_resource_end_tag
-{
-       u8                                  checksum;
+struct acpi_resource_end_tag {
+       u8 checksum;
 };
 
-struct acpi_resource_mem24
-{
-       u32                                 read_write_attribute;
-       u32                                 min_base_address;
-       u32                                 max_base_address;
-       u32                                 alignment;
-       u32                                 range_length;
+struct acpi_resource_mem24 {
+       u32 read_write_attribute;
+       u32 min_base_address;
+       u32 max_base_address;
+       u32 alignment;
+       u32 range_length;
 };
 
-struct acpi_resource_mem32
-{
-       u32                                 read_write_attribute;
-       u32                                 min_base_address;
-       u32                                 max_base_address;
-       u32                                 alignment;
-       u32                                 range_length;
+struct acpi_resource_mem32 {
+       u32 read_write_attribute;
+       u32 min_base_address;
+       u32 max_base_address;
+       u32 alignment;
+       u32 range_length;
 };
 
-struct acpi_resource_fixed_mem32
-{
-       u32                                 read_write_attribute;
-       u32                                 range_base_address;
-       u32                                 range_length;
+struct acpi_resource_fixed_mem32 {
+       u32 read_write_attribute;
+       u32 range_base_address;
+       u32 range_length;
 };
 
-struct acpi_memory_attribute
-{
-       u16                                 cache_attribute;
-       u16                                 read_write_attribute;
+struct acpi_memory_attribute {
+       u16 cache_attribute;
+       u16 read_write_attribute;
 };
 
-struct acpi_io_attribute
-{
-       u16                                 range_attribute;
-       u16                                 translation_attribute;
+struct acpi_io_attribute {
+       u16 range_attribute;
+       u16 translation_attribute;
 };
 
-struct acpi_bus_attribute
-{
-       u16                                 reserved1;
-       u16                                 reserved2;
+struct acpi_bus_attribute {
+       u16 reserved1;
+       u16 reserved2;
 };
 
-union acpi_resource_attribute
-{
-       struct acpi_memory_attribute        memory;
-       struct acpi_io_attribute            io;
-       struct acpi_bus_attribute           bus;
+union acpi_resource_attribute {
+       struct acpi_memory_attribute memory;
+       struct acpi_io_attribute io;
+       struct acpi_bus_attribute bus;
 };
 
-struct acpi_resource_source
-{
-       u32                                 index;
-       u32                                 string_length;
-       char                                *string_ptr;
+struct acpi_resource_source {
+       u32 index;
+       u32 string_length;
+       char *string_ptr;
 };
 
-struct acpi_resource_address16
-{
-       u32                                 resource_type;
-       u32                                 producer_consumer;
-       u32                                 decode;
-       u32                                 min_address_fixed;
-       u32                                 max_address_fixed;
-       union acpi_resource_attribute       attribute;
-       u32                                 granularity;
-       u32                                 min_address_range;
-       u32                                 max_address_range;
-       u32                                 address_translation_offset;
-       u32                                 address_length;
-       struct acpi_resource_source         resource_source;
-};
+/* Fields common to all address descriptors, 16/32/64 bit */
 
-struct acpi_resource_address32
-{
-       u32                                 resource_type;
-       u32                                 producer_consumer;
-       u32                                 decode;
-       u32                                 min_address_fixed;
-       u32                                 max_address_fixed;
+#define ACPI_RESOURCE_ADDRESS_COMMON \
+       u32                                 resource_type; \
+       u32                                 producer_consumer; \
+       u32                                 decode; \
+       u32                                 min_address_fixed; \
+       u32                                 max_address_fixed; \
        union acpi_resource_attribute       attribute;
-       u32                                 granularity;
-       u32                                 min_address_range;
-       u32                                 max_address_range;
-       u32                                 address_translation_offset;
-       u32                                 address_length;
-       struct acpi_resource_source         resource_source;
+
+struct acpi_resource_address {
+ACPI_RESOURCE_ADDRESS_COMMON};
+
+struct acpi_resource_address16 {
+       ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
+       u32 min_address_range;
+       u32 max_address_range;
+       u32 address_translation_offset;
+       u32 address_length;
+       struct acpi_resource_source resource_source;
 };
 
-struct acpi_resource_address64
-{
-       u32                                 resource_type;
-       u32                                 producer_consumer;
-       u32                                 decode;
-       u32                                 min_address_fixed;
-       u32                                 max_address_fixed;
-       union acpi_resource_attribute       attribute;
-       u64                                 granularity;
-       u64                                 min_address_range;
-       u64                                 max_address_range;
-       u64                                 address_translation_offset;
-       u64                                 address_length;
-       u64                                 type_specific_attributes;
-       struct acpi_resource_source         resource_source;
+struct acpi_resource_address32 {
+       ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
+       u32 min_address_range;
+       u32 max_address_range;
+       u32 address_translation_offset;
+       u32 address_length;
+       struct acpi_resource_source resource_source;
 };
 
-struct acpi_resource_ext_irq
-{
-       u32                                 producer_consumer;
-       u32                                 edge_level;
-       u32                                 active_high_low;
-       u32                                 shared_exclusive;
-       u32                                 number_of_interrupts;
-       struct acpi_resource_source         resource_source;
-       u32                                 interrupts[1];
+struct acpi_resource_address64 {
+       ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
+       u64 min_address_range;
+       u64 max_address_range;
+       u64 address_translation_offset;
+       u64 address_length;
+       u64 type_specific_attributes;
+       struct acpi_resource_source resource_source;
 };
 
+struct acpi_resource_ext_irq {
+       u32 producer_consumer;
+       u32 edge_level;
+       u32 active_high_low;
+       u32 shared_exclusive;
+       u32 number_of_interrupts;
+       struct acpi_resource_source resource_source;
+       u32 interrupts[1];
+};
 
 /* ACPI_RESOURCE_TYPEs */
 
@@ -1240,35 +1143,34 @@ struct acpi_resource_ext_irq
 #define ACPI_RSTYPE_ADDRESS64           13
 #define ACPI_RSTYPE_EXT_IRQ             14
 
-typedef u32                                     acpi_resource_type;
-
-union acpi_resource_data
-{
-       struct acpi_resource_irq            irq;
-       struct acpi_resource_dma            dma;
-       struct acpi_resource_start_dpf      start_dpf;
-       struct acpi_resource_io             io;
-       struct acpi_resource_fixed_io       fixed_io;
-       struct acpi_resource_vendor         vendor_specific;
-       struct acpi_resource_end_tag        end_tag;
-       struct acpi_resource_mem24          memory24;
-       struct acpi_resource_mem32          memory32;
-       struct acpi_resource_fixed_mem32    fixed_memory32;
-       struct acpi_resource_address16      address16;
-       struct acpi_resource_address32      address32;
-       struct acpi_resource_address64      address64;
-       struct acpi_resource_ext_irq        extended_irq;
+typedef u32 acpi_resource_type;
+
+union acpi_resource_data {
+       struct acpi_resource_irq irq;
+       struct acpi_resource_dma dma;
+       struct acpi_resource_start_dpf start_dpf;
+       struct acpi_resource_io io;
+       struct acpi_resource_fixed_io fixed_io;
+       struct acpi_resource_vendor vendor_specific;
+       struct acpi_resource_end_tag end_tag;
+       struct acpi_resource_mem24 memory24;
+       struct acpi_resource_mem32 memory32;
+       struct acpi_resource_fixed_mem32 fixed_memory32;
+       struct acpi_resource_address address;   /* Common 16/32/64 address fields */
+       struct acpi_resource_address16 address16;
+       struct acpi_resource_address32 address32;
+       struct acpi_resource_address64 address64;
+       struct acpi_resource_ext_irq extended_irq;
 };
 
-struct acpi_resource
-{
-       acpi_resource_type                  id;
-       u32                                 length;
-       union acpi_resource_data            data;
+struct acpi_resource {
+       acpi_resource_type id;
+       u32 length;
+       union acpi_resource_data data;
 };
 
 #define ACPI_RESOURCE_LENGTH                12
-#define ACPI_RESOURCE_LENGTH_NO_DATA        8       /* Id + Length fields */
+#define ACPI_RESOURCE_LENGTH_NO_DATA        8  /* Id + Length fields */
 
 #define ACPI_SIZEOF_RESOURCE(type)          (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type))
 
@@ -1284,19 +1186,16 @@ struct acpi_resource
  * END: of definitions for Resource Attributes
  */
 
-
-struct acpi_pci_routing_table
-{
-       u32                                 length;
-       u32                                 pin;
-       acpi_integer                        address;        /* here for 64-bit alignment */
-       u32                                 source_index;
-       char                                source[4];      /* pad to 64 bits so sizeof() works in all cases */
+struct acpi_pci_routing_table {
+       u32 length;
+       u32 pin;
+       acpi_integer address;   /* here for 64-bit alignment */
+       u32 source_index;
+       char source[4];         /* pad to 64 bits so sizeof() works in all cases */
 };
 
 /*
  * END: of definitions for PCI Routing tables
  */
 
-
-#endif /* __ACTYPES_H__ */
+#endif                         /* __ACTYPES_H__ */
index 192d0bea3884d0a16ba2b0492c418ff007334332..c1086452696ea63cc0c855a287e0cc11574bf89d 100644 (file)
 #ifndef _ACUTILS_H
 #define _ACUTILS_H
 
-
 typedef
-acpi_status (*acpi_pkg_callback) (
-       u8                              object_type,
-       union acpi_operand_object       *source_object,
-       union acpi_generic_state        *state,
-       void                            *context);
-
-struct acpi_pkg_info
-{
-       u8                              *free_space;
-       acpi_size                       length;
-       u32                             object_space;
-       u32                             num_packages;
+acpi_status(*acpi_pkg_callback) (u8 object_type,
+                                union acpi_operand_object * source_object,
+                                union acpi_generic_state * state,
+                                void *context);
+
+struct acpi_pkg_info {
+       u8 *free_space;
+       acpi_size length;
+       u32 object_space;
+       u32 num_packages;
 };
 
 #define REF_INCREMENT       (u16) 0
@@ -71,167 +68,89 @@ struct acpi_pkg_info
 #define DB_DWORD_DISPLAY    4
 #define DB_QWORD_DISPLAY    8
 
-
 /*
  * utglobal - Global data structures and procedures
  */
-void
-acpi_ut_init_globals (
-       void);
+void acpi_ut_init_globals(void);
 
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 
-char *
-acpi_ut_get_mutex_name (
-       u32                             mutex_id);
+char *acpi_ut_get_mutex_name(u32 mutex_id);
 
 #endif
 
-char *
-acpi_ut_get_type_name (
-       acpi_object_type                type);
-
-char *
-acpi_ut_get_node_name (
-       void                            *object);
-
-char *
-acpi_ut_get_descriptor_name (
-       void                            *object);
+char *acpi_ut_get_type_name(acpi_object_type type);
 
-char *
-acpi_ut_get_object_type_name (
-       union acpi_operand_object       *obj_desc);
+char *acpi_ut_get_node_name(void *object);
 
-char *
-acpi_ut_get_region_name (
-       u8                              space_id);
+char *acpi_ut_get_descriptor_name(void *object);
 
-char *
-acpi_ut_get_event_name (
-       u32                             event_id);
+char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
 
-char
-acpi_ut_hex_to_ascii_char (
-       acpi_integer                    integer,
-       u32                             position);
+char *acpi_ut_get_region_name(u8 space_id);
 
-u8
-acpi_ut_valid_object_type (
-       acpi_object_type                type);
+char *acpi_ut_get_event_name(u32 event_id);
 
-acpi_owner_id
-acpi_ut_allocate_owner_id (
-       u32                             id_type);
+char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position);
 
+u8 acpi_ut_valid_object_type(acpi_object_type type);
 
 /*
  * utinit - miscellaneous initialization and shutdown
  */
-acpi_status
-acpi_ut_hardware_initialize (
-       void);
+acpi_status acpi_ut_hardware_initialize(void);
 
-void
-acpi_ut_subsystem_shutdown (
-       void);
-
-acpi_status
-acpi_ut_validate_fadt (
-       void);
+void acpi_ut_subsystem_shutdown(void);
 
+acpi_status acpi_ut_validate_fadt(void);
 
 /*
  * utclib - Local implementations of C library functions
  */
 #ifndef ACPI_USE_SYSTEM_CLIBRARY
 
-acpi_size
-acpi_ut_strlen (
-       const char                      *string);
-
-char *
-acpi_ut_strcpy (
-       char                            *dst_string,
-       const char                      *src_string);
-
-char *
-acpi_ut_strncpy (
-       char                            *dst_string,
-       const char                      *src_string,
-       acpi_size                       count);
-
-int
-acpi_ut_memcmp (
-       const char                      *buffer1,
-       const char                      *buffer2,
-       acpi_size                       count);
-
-int
-acpi_ut_strncmp (
-       const char                      *string1,
-       const char                      *string2,
-       acpi_size                       count);
-
-int
-acpi_ut_strcmp (
-       const char                      *string1,
-       const char                      *string2);
-
-char *
-acpi_ut_strcat (
-       char                            *dst_string,
-       const char                      *src_string);
-
-char *
-acpi_ut_strncat (
-       char                            *dst_string,
-       const char                      *src_string,
-       acpi_size                       count);
-
-u32
-acpi_ut_strtoul (
-       const char                      *string,
-       char                            **terminator,
-       u32                             base);
-
-char *
-acpi_ut_strstr (
-       char                            *string1,
-       char                            *string2);
-
-void *
-acpi_ut_memcpy (
-       void                            *dest,
-       const void                      *src,
-       acpi_size                       count);
-
-void *
-acpi_ut_memset (
-       void                            *dest,
-       acpi_native_uint                value,
-       acpi_size                       count);
-
-int
-acpi_ut_to_upper (
-       int                             c);
-
-int
-acpi_ut_to_lower (
-       int                             c);
+acpi_size acpi_ut_strlen(const char *string);
+
+char *acpi_ut_strcpy(char *dst_string, const char *src_string);
+
+char *acpi_ut_strncpy(char *dst_string,
+                     const char *src_string, acpi_size count);
+
+int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
+
+int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
+
+int acpi_ut_strcmp(const char *string1, const char *string2);
+
+char *acpi_ut_strcat(char *dst_string, const char *src_string);
+
+char *acpi_ut_strncat(char *dst_string,
+                     const char *src_string, acpi_size count);
+
+u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
+
+char *acpi_ut_strstr(char *string1, char *string2);
+
+void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
+
+void *acpi_ut_memset(void *dest, acpi_native_uint value, acpi_size count);
+
+int acpi_ut_to_upper(int c);
+
+int acpi_ut_to_lower(int c);
 
 extern const u8 _acpi_ctype[];
 
-#define _ACPI_XA     0x00    /* extra alphabetic - not supported */
-#define _ACPI_XS     0x40    /* extra space */
-#define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
-#define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
-#define _ACPI_DI     0x04    /* '0'-'9' */
-#define _ACPI_LO     0x02    /* 'a'-'z' */
-#define _ACPI_PU     0x10    /* punctuation */
-#define _ACPI_SP     0x08    /* space */
-#define _ACPI_UP     0x01    /* 'A'-'Z' */
-#define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
+#define _ACPI_XA     0x00      /* extra alphabetic - not supported */
+#define _ACPI_XS     0x40      /* extra space */
+#define _ACPI_BB     0x00      /* BEL, BS, etc. - not supported */
+#define _ACPI_CN     0x20      /* CR, FF, HT, NL, VT */
+#define _ACPI_DI     0x04      /* '0'-'9' */
+#define _ACPI_LO     0x02      /* 'a'-'z' */
+#define _ACPI_PU     0x10      /* punctuation */
+#define _ACPI_SP     0x08      /* space */
+#define _ACPI_UP     0x01      /* 'A'-'Z' */
+#define _ACPI_XD     0x80      /* '0'-'9', 'A'-'F', 'a'-'f' */
 
 #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
 #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
@@ -242,502 +161,323 @@ extern const u8 _acpi_ctype[];
 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
 
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-
+#endif                         /* ACPI_USE_SYSTEM_CLIBRARY */
 
 /*
  * utcopy - Object construction and conversion interfaces
  */
 acpi_status
-acpi_ut_build_simple_object(
-       union acpi_operand_object       *obj,
-       union acpi_object               *user_obj,
-       u8                              *data_space,
-       u32                             *buffer_space_used);
+acpi_ut_build_simple_object(union acpi_operand_object *obj,
+                           union acpi_object *user_obj,
+                           u8 * data_space, u32 * buffer_space_used);
 
 acpi_status
-acpi_ut_build_package_object (
-       union acpi_operand_object       *obj,
-       u8                              *buffer,
-       u32                             *space_used);
+acpi_ut_build_package_object(union acpi_operand_object *obj,
+                            u8 * buffer, u32 * space_used);
 
 acpi_status
-acpi_ut_copy_iobject_to_eobject (
-       union acpi_operand_object       *obj,
-       struct acpi_buffer              *ret_buffer);
+acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
+                               struct acpi_buffer *ret_buffer);
 
 acpi_status
-acpi_ut_copy_eobject_to_iobject (
-       union acpi_object               *obj,
-       union acpi_operand_object       **internal_obj);
+acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
+                               union acpi_operand_object **internal_obj);
 
 acpi_status
-acpi_ut_copy_isimple_to_isimple (
-       union acpi_operand_object       *source_obj,
-       union acpi_operand_object       *dest_obj);
+acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
+                               union acpi_operand_object *dest_obj);
 
 acpi_status
-acpi_ut_copy_iobject_to_iobject (
-       union acpi_operand_object       *source_desc,
-       union acpi_operand_object       **dest_desc,
-       struct acpi_walk_state          *walk_state);
-
+acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
+                               union acpi_operand_object **dest_desc,
+                               struct acpi_walk_state *walk_state);
 
 /*
  * utcreate - Object creation
  */
 acpi_status
-acpi_ut_update_object_reference (
-       union acpi_operand_object       *object,
-       u16                             action);
-
+acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
 
 /*
  * utdebug - Debug interfaces
  */
-void
-acpi_ut_init_stack_ptr_trace (
-       void);
+void acpi_ut_init_stack_ptr_trace(void);
 
-void
-acpi_ut_track_stack_ptr (
-       void);
+void acpi_ut_track_stack_ptr(void);
 
 void
-acpi_ut_trace (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info);
+acpi_ut_trace(u32 line_number,
+             const char *function_name, char *module_name, u32 component_id);
 
 void
-acpi_ut_trace_ptr (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       void                            *pointer);
+acpi_ut_trace_ptr(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, void *pointer);
 
 void
-acpi_ut_trace_u32 (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       u32                             integer);
+acpi_ut_trace_u32(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, u32 integer);
 
 void
-acpi_ut_trace_str (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *string);
+acpi_ut_trace_str(u32 line_number,
+                 const char *function_name,
+                 char *module_name, u32 component_id, char *string);
 
 void
-acpi_ut_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info);
+acpi_ut_exit(u32 line_number,
+            const char *function_name, char *module_name, u32 component_id);
 
 void
-acpi_ut_status_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       acpi_status                     status);
+acpi_ut_status_exit(u32 line_number,
+                   const char *function_name,
+                   char *module_name, u32 component_id, acpi_status status);
 
 void
-acpi_ut_value_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       acpi_integer                    value);
+acpi_ut_value_exit(u32 line_number,
+                  const char *function_name,
+                  char *module_name, u32 component_id, acpi_integer value);
 
 void
-acpi_ut_ptr_exit (
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       u8                              *ptr);
+acpi_ut_ptr_exit(u32 line_number,
+                const char *function_name,
+                char *module_name, u32 component_id, u8 * ptr);
 
-void
-acpi_ut_report_info (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id);
+void acpi_ut_report_info(char *module_name, u32 line_number, u32 component_id);
 
-void
-acpi_ut_report_error (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id);
+void acpi_ut_report_error(char *module_name, u32 line_number, u32 component_id);
 
 void
-acpi_ut_report_warning (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id);
+acpi_ut_report_warning(char *module_name, u32 line_number, u32 component_id);
 
-void
-acpi_ut_dump_buffer (
-       u8                              *buffer,
-       u32                             count,
-       u32                             display,
-       u32                             component_id);
+void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print (
-       u32                             requested_debug_level,
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *format,
-       ...) ACPI_PRINTF_LIKE_FUNC;
+acpi_ut_debug_print(u32 requested_debug_level,
+                   u32 line_number,
+                   const char *function_name,
+                   char *module_name,
+                   u32 component_id, char *format, ...) ACPI_PRINTF_LIKE_FUNC;
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_debug_print_raw (
-       u32                             requested_debug_level,
-       u32                             line_number,
-       struct acpi_debug_print_info    *dbg_info,
-       char                            *format,
-       ...) ACPI_PRINTF_LIKE_FUNC;
-
+acpi_ut_debug_print_raw(u32 requested_debug_level,
+                       u32 line_number,
+                       const char *function_name,
+                       char *module_name,
+                       u32 component_id,
+                       char *format, ...) ACPI_PRINTF_LIKE_FUNC;
 
 /*
  * utdelete - Object deletion and reference counts
  */
-void
-acpi_ut_add_reference (
-       union acpi_operand_object       *object);
+void acpi_ut_add_reference(union acpi_operand_object *object);
 
-void
-acpi_ut_remove_reference (
-       union acpi_operand_object       *object);
+void acpi_ut_remove_reference(union acpi_operand_object *object);
 
-void
-acpi_ut_delete_internal_package_object (
-       union acpi_operand_object       *object);
+void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
 
-void
-acpi_ut_delete_internal_simple_object (
-       union acpi_operand_object       *object);
-
-void
-acpi_ut_delete_internal_object_list (
-       union acpi_operand_object       **obj_list);
+void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
 
+void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
 
 /*
  * uteval - object evaluation
  */
-acpi_status
-acpi_ut_osi_implementation (
-       struct acpi_walk_state          *walk_state);
+acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ut_evaluate_object (
-       struct acpi_namespace_node      *prefix_node,
-       char                            *path,
-       u32                             expected_return_btypes,
-       union acpi_operand_object       **return_desc);
+acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
+                       char *path,
+                       u32 expected_return_btypes,
+                       union acpi_operand_object **return_desc);
 
 acpi_status
-acpi_ut_evaluate_numeric_object (
-       char                            *object_name,
-       struct acpi_namespace_node      *device_node,
-       acpi_integer                    *address);
+acpi_ut_evaluate_numeric_object(char *object_name,
+                               struct acpi_namespace_node *device_node,
+                               acpi_integer * address);
 
 acpi_status
-acpi_ut_execute_HID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_device_id           *hid);
+acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
+                   struct acpi_device_id *hid);
 
 acpi_status
-acpi_ut_execute_CID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_compatible_id_list **return_cid_list);
+acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
+                   struct acpi_compatible_id_list **return_cid_list);
 
 acpi_status
-acpi_ut_execute_STA (
-       struct acpi_namespace_node      *device_node,
-       u32                             *status_flags);
+acpi_ut_execute_STA(struct acpi_namespace_node *device_node,
+                   u32 * status_flags);
 
 acpi_status
-acpi_ut_execute_UID (
-       struct acpi_namespace_node      *device_node,
-       struct acpi_device_id           *uid);
+acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
+                   struct acpi_device_id *uid);
 
 acpi_status
-acpi_ut_execute_sxds (
-       struct acpi_namespace_node      *device_node,
-       u8                              *highest);
-
+acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
 
 /*
  * utobject - internal object create/delete/cache routines
  */
-union acpi_operand_object    *
-acpi_ut_create_internal_object_dbg (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id,
-       acpi_object_type                type);
-
-void *
-acpi_ut_allocate_object_desc_dbg (
-       char                            *module_name,
-       u32                             line_number,
-       u32                             component_id);
-
-#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define acpi_ut_allocate_object_desc()  acpi_ut_allocate_object_desc_dbg (_THIS_MODULE,__LINE__,_COMPONENT)
+union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
+                                                             u32 line_number,
+                                                             u32 component_id,
+                                                             acpi_object_type
+                                                             type);
 
-void
-acpi_ut_delete_object_desc (
-       union acpi_operand_object       *object);
+void *acpi_ut_allocate_object_desc_dbg(char *module_name,
+                                      u32 line_number, u32 component_id);
 
-u8
-acpi_ut_valid_internal_object (
-       void                            *object);
+#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
+#define acpi_ut_allocate_object_desc()  acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
 
-union acpi_operand_object *
-acpi_ut_create_buffer_object (
-       acpi_size                       buffer_size);
+void acpi_ut_delete_object_desc(union acpi_operand_object *object);
 
-union acpi_operand_object *
-acpi_ut_create_string_object (
-       acpi_size                       string_size);
+u8 acpi_ut_valid_internal_object(void *object);
 
-acpi_status
-acpi_ut_get_object_size(
-       union acpi_operand_object       *obj,
-       acpi_size                       *obj_length);
+union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
 
+union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
+
+acpi_status
+acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
 
 /*
  * utstate - Generic state creation/cache routines
  */
 void
-acpi_ut_push_generic_state (
-       union acpi_generic_state        **list_head,
-       union acpi_generic_state        *state);
+acpi_ut_push_generic_state(union acpi_generic_state **list_head,
+                          union acpi_generic_state *state);
 
-union acpi_generic_state *
-acpi_ut_pop_generic_state (
-       union acpi_generic_state        **list_head);
+union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
+                                                   **list_head);
 
+union acpi_generic_state *acpi_ut_create_generic_state(void);
 
-union acpi_generic_state *
-acpi_ut_create_generic_state (
-       void);
+struct acpi_thread_state *acpi_ut_create_thread_state(void);
 
-struct acpi_thread_state *
-acpi_ut_create_thread_state (
-       void);
+union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
+                                                     *object, u16 action);
 
-union acpi_generic_state *
-acpi_ut_create_update_state (
-       union acpi_operand_object       *object,
-       u16                             action);
-
-union acpi_generic_state *
-acpi_ut_create_pkg_state (
-       void                            *internal_object,
-       void                            *external_object,
-       u16                             index);
+union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
+                                                  void *external_object,
+                                                  u16 index);
 
 acpi_status
-acpi_ut_create_update_state_and_push (
-       union acpi_operand_object       *object,
-       u16                             action,
-       union acpi_generic_state        **state_list);
+acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
+                                    u16 action,
+                                    union acpi_generic_state **state_list);
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status
-acpi_ut_create_pkg_state_and_push (
-       void                            *internal_object,
-       void                            *external_object,
-       u16                             index,
-       union acpi_generic_state        **state_list);
-#endif /* ACPI_FUTURE_USAGE */
+acpi_ut_create_pkg_state_and_push(void *internal_object,
+                                 void *external_object,
+                                 u16 index,
+                                 union acpi_generic_state **state_list);
+#endif                         /* ACPI_FUTURE_USAGE */
 
-union acpi_generic_state *
-acpi_ut_create_control_state (
-       void);
-
-void
-acpi_ut_delete_generic_state (
-       union acpi_generic_state        *state);
-
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_state_cache (
-       void);
-
-void
-acpi_ut_delete_object_cache (
-       void);
-#endif
+union acpi_generic_state *acpi_ut_create_control_state(void);
 
+void acpi_ut_delete_generic_state(union acpi_generic_state *state);
 
 /*
  * utmath
  */
 acpi_status
-acpi_ut_divide (
-       acpi_integer                    in_dividend,
-       acpi_integer                    in_divisor,
-       acpi_integer                    *out_quotient,
-       acpi_integer                    *out_remainder);
+acpi_ut_divide(acpi_integer in_dividend,
+              acpi_integer in_divisor,
+              acpi_integer * out_quotient, acpi_integer * out_remainder);
 
 acpi_status
-acpi_ut_short_divide (
-       acpi_integer                    in_dividend,
-       u32                             divisor,
-       acpi_integer                    *out_quotient,
-       u32                             *out_remainder);
+acpi_ut_short_divide(acpi_integer in_dividend,
+                    u32 divisor,
+                    acpi_integer * out_quotient, u32 * out_remainder);
 
 /*
  * utmisc
  */
+acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
+
+void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
+
 acpi_status
-acpi_ut_walk_package_tree (
-       union acpi_operand_object       *source_object,
-       void                            *target_object,
-       acpi_pkg_callback               walk_callback,
-       void                            *context);
+acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
+                         void *target_object,
+                         acpi_pkg_callback walk_callback, void *context);
 
-char *
-acpi_ut_strupr (
-       char                            *src_string);
+void acpi_ut_strupr(char *src_string);
 
-void
-acpi_ut_print_string (
-       char                            *string,
-       u8                              max_length);
+void acpi_ut_print_string(char *string, u8 max_length);
 
-u8
-acpi_ut_valid_acpi_name (
-       u32                             name);
+u8 acpi_ut_valid_acpi_name(u32 name);
 
-u8
-acpi_ut_valid_acpi_character (
-       char                            character);
+u8 acpi_ut_valid_acpi_character(char character);
 
 acpi_status
-acpi_ut_strtoul64 (
-       char                            *string,
-       u32                             base,
-       acpi_integer                    *ret_integer);
+acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
 
 /* Values for Base above (16=Hex, 10=Decimal) */
 
 #define ACPI_ANY_BASE        0
 
-acpi_status
-acpi_ut_mutex_initialize (
-       void);
-
-void
-acpi_ut_mutex_terminate (
-       void);
-
-acpi_status
-acpi_ut_acquire_mutex (
-       acpi_mutex_handle               mutex_id);
-
-acpi_status
-acpi_ut_release_mutex (
-       acpi_mutex_handle               mutex_id);
-
-u8 *
-acpi_ut_get_resource_end_tag (
-       union acpi_operand_object       *obj_desc);
+u8 *acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc);
 
-u8
-acpi_ut_generate_checksum (
-       u8                              *buffer,
-       u32                             length);
+u8 acpi_ut_generate_checksum(u8 * buffer, u32 length);
 
-u32
-acpi_ut_dword_byte_swap (
-       u32                             value);
+u32 acpi_ut_dword_byte_swap(u32 value);
 
-void
-acpi_ut_set_integer_width (
-       u8                              revision);
+void acpi_ut_set_integer_width(u8 revision);
 
 #ifdef ACPI_DEBUG_OUTPUT
 void
-acpi_ut_display_init_pathname (
-       u8                              type,
-       struct acpi_namespace_node      *obj_handle,
-       char                            *path);
+acpi_ut_display_init_pathname(u8 type,
+                             struct acpi_namespace_node *obj_handle,
+                             char *path);
 
 #endif
 
+/*
+ * utmutex - mutex support
+ */
+acpi_status acpi_ut_mutex_initialize(void);
+
+void acpi_ut_mutex_terminate(void);
+
+acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
+
+acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
 
 /*
  * utalloc - memory allocation and object caching
  */
-void *
-acpi_ut_acquire_from_cache (
-       u32                             list_id);
+acpi_status acpi_ut_create_caches(void);
 
-void
-acpi_ut_release_to_cache (
-       u32                             list_id,
-       void                            *object);
+acpi_status acpi_ut_delete_caches(void);
 
-#ifdef ACPI_ENABLE_OBJECT_CACHE
-void
-acpi_ut_delete_generic_cache (
-       u32                             list_id);
-#endif
+acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
 
 acpi_status
-acpi_ut_validate_buffer (
-       struct acpi_buffer              *buffer);
+acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
+                         acpi_size required_length);
 
-acpi_status
-acpi_ut_initialize_buffer (
-       struct acpi_buffer              *buffer,
-       acpi_size                       required_length);
-
-void *
-acpi_ut_allocate (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line);
-
-void *
-acpi_ut_callocate (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line);
+void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line);
+
+void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line);
 
 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
-void *
-acpi_ut_allocate_and_track (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line);
-
-void *
-acpi_ut_callocate_and_track (
-       acpi_size                       size,
-       u32                             component,
-       char                            *module,
-       u32                             line);
+void *acpi_ut_allocate_and_track(acpi_size size,
+                                u32 component, char *module, u32 line);
+
+void *acpi_ut_callocate_and_track(acpi_size size,
+                                 u32 component, char *module, u32 line);
 
 void
-acpi_ut_free_and_track (
-       void                            *address,
-       u32                             component,
-       char                            *module,
-       u32                             line);
+acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line);
 
 #ifdef ACPI_FUTURE_USAGE
-void
-acpi_ut_dump_allocation_info (
-       void);
-#endif /* ACPI_FUTURE_USAGE */
+void acpi_ut_dump_allocation_info(void);
+#endif                         /* ACPI_FUTURE_USAGE */
 
-void
-acpi_ut_dump_allocations (
-       u32                             component,
-       char                            *module);
+void acpi_ut_dump_allocations(u32 component, char *module);
 #endif
 
-#endif /* _ACUTILS_H */
+#endif                         /* _ACUTILS_H */
index 55e97ed29190642635e0434a6c321d8d83d3671f..7fdf5299f501104ce305de61d94da85c4135552e 100644 (file)
 #define AML_WORD_OP                 (u16) 0x0b
 #define AML_DWORD_OP                (u16) 0x0c
 #define AML_STRING_OP               (u16) 0x0d
-#define AML_QWORD_OP                (u16) 0x0e     /* ACPI 2.0 */
+#define AML_QWORD_OP                (u16) 0x0e /* ACPI 2.0 */
 #define AML_SCOPE_OP                (u16) 0x10
 #define AML_BUFFER_OP               (u16) 0x11
 #define AML_PACKAGE_OP              (u16) 0x12
-#define AML_VAR_PACKAGE_OP          (u16) 0x13     /* ACPI 2.0 */
+#define AML_VAR_PACKAGE_OP          (u16) 0x13 /* ACPI 2.0 */
 #define AML_METHOD_OP               (u16) 0x14
 #define AML_DUAL_NAME_PREFIX        (u16) 0x2e
 #define AML_MULTI_NAME_PREFIX_OP    (u16) 0x2f
 #define AML_NAME_CHAR_SUBSEQ        (u16) 0x30
 #define AML_NAME_CHAR_FIRST         (u16) 0x41
-#define AML_OP_PREFIX               (u16) 0x5b
+#define AML_EXTENDED_OP_PREFIX      (u16) 0x5b
 #define AML_ROOT_PREFIX             (u16) 0x5c
 #define AML_PARENT_PREFIX           (u16) 0x5e
 #define AML_LOCAL_OP                (u16) 0x60
 #define AML_FIND_SET_LEFT_BIT_OP    (u16) 0x81
 #define AML_FIND_SET_RIGHT_BIT_OP   (u16) 0x82
 #define AML_DEREF_OF_OP             (u16) 0x83
-#define AML_CONCAT_RES_OP           (u16) 0x84     /* ACPI 2.0 */
-#define AML_MOD_OP                  (u16) 0x85     /* ACPI 2.0 */
+#define AML_CONCAT_RES_OP           (u16) 0x84 /* ACPI 2.0 */
+#define AML_MOD_OP                  (u16) 0x85 /* ACPI 2.0 */
 #define AML_NOTIFY_OP               (u16) 0x86
 #define AML_SIZE_OF_OP              (u16) 0x87
 #define AML_INDEX_OP                (u16) 0x88
 #define AML_CREATE_BYTE_FIELD_OP    (u16) 0x8c
 #define AML_CREATE_BIT_FIELD_OP     (u16) 0x8d
 #define AML_TYPE_OP                 (u16) 0x8e
-#define AML_CREATE_QWORD_FIELD_OP   (u16) 0x8f     /* ACPI 2.0 */
+#define AML_CREATE_QWORD_FIELD_OP   (u16) 0x8f /* ACPI 2.0 */
 #define AML_LAND_OP                 (u16) 0x90
 #define AML_LOR_OP                  (u16) 0x91
 #define AML_LNOT_OP                 (u16) 0x92
 #define AML_LEQUAL_OP               (u16) 0x93
 #define AML_LGREATER_OP             (u16) 0x94
 #define AML_LLESS_OP                (u16) 0x95
-#define AML_TO_BUFFER_OP            (u16) 0x96     /* ACPI 2.0 */
-#define AML_TO_DECSTRING_OP         (u16) 0x97     /* ACPI 2.0 */
-#define AML_TO_HEXSTRING_OP         (u16) 0x98     /* ACPI 2.0 */
-#define AML_TO_INTEGER_OP           (u16) 0x99     /* ACPI 2.0 */
-#define AML_TO_STRING_OP            (u16) 0x9c     /* ACPI 2.0 */
-#define AML_COPY_OP                 (u16) 0x9d     /* ACPI 2.0 */
-#define AML_MID_OP                  (u16) 0x9e     /* ACPI 2.0 */
-#define AML_CONTINUE_OP             (u16) 0x9f     /* ACPI 2.0 */
+#define AML_TO_BUFFER_OP            (u16) 0x96 /* ACPI 2.0 */
+#define AML_TO_DECSTRING_OP         (u16) 0x97 /* ACPI 2.0 */
+#define AML_TO_HEXSTRING_OP         (u16) 0x98 /* ACPI 2.0 */
+#define AML_TO_INTEGER_OP           (u16) 0x99 /* ACPI 2.0 */
+#define AML_TO_STRING_OP            (u16) 0x9c /* ACPI 2.0 */
+#define AML_COPY_OP                 (u16) 0x9d /* ACPI 2.0 */
+#define AML_MID_OP                  (u16) 0x9e /* ACPI 2.0 */
+#define AML_CONTINUE_OP             (u16) 0x9f /* ACPI 2.0 */
 #define AML_IF_OP                   (u16) 0xa0
 #define AML_ELSE_OP                 (u16) 0xa1
 #define AML_WHILE_OP                (u16) 0xa2
 
 /* prefixed opcodes */
 
-#define AML_EXTOP                   (u16) 0x005b     /* prefix for 2-byte opcodes */
+#define AML_EXTENDED_OPCODE         (u16) 0x5b00       /* prefix for 2-byte opcodes */
 
 #define AML_MUTEX_OP                (u16) 0x5b01
 #define AML_EVENT_OP                (u16) 0x5b02
 #define AML_SHIFT_LEFT_BIT_OP       (u16) 0x5b11
 #define AML_COND_REF_OF_OP          (u16) 0x5b12
 #define AML_CREATE_FIELD_OP         (u16) 0x5b13
-#define AML_LOAD_TABLE_OP           (u16) 0x5b1f     /* ACPI 2.0 */
+#define AML_LOAD_TABLE_OP           (u16) 0x5b1f       /* ACPI 2.0 */
 #define AML_LOAD_OP                 (u16) 0x5b20
 #define AML_STALL_OP                (u16) 0x5b21
 #define AML_SLEEP_OP                (u16) 0x5b22
 #define AML_REVISION_OP             (u16) 0x5b30
 #define AML_DEBUG_OP                (u16) 0x5b31
 #define AML_FATAL_OP                (u16) 0x5b32
-#define AML_TIMER_OP                (u16) 0x5b33     /* ACPI 3.0 */
+#define AML_TIMER_OP                (u16) 0x5b33       /* ACPI 3.0 */
 #define AML_REGION_OP               (u16) 0x5b80
 #define AML_FIELD_OP                (u16) 0x5b81
 #define AML_DEVICE_OP               (u16) 0x5b82
 #define AML_THERMAL_ZONE_OP         (u16) 0x5b85
 #define AML_INDEX_FIELD_OP          (u16) 0x5b86
 #define AML_BANK_FIELD_OP           (u16) 0x5b87
-#define AML_DATA_REGION_OP          (u16) 0x5b88     /* ACPI 2.0 */
-
+#define AML_DATA_REGION_OP          (u16) 0x5b88       /* ACPI 2.0 */
 
 /* Bogus opcodes (they are actually two separate opcodes) */
 
 #define AML_LLESSEQUAL_OP           (u16) 0x9294
 #define AML_LNOTEQUAL_OP            (u16) 0x9293
 
-
 /*
  * Internal opcodes
  * Use only "Unknown" AML opcodes, don't attempt to use
 #define AML_INT_RETURN_VALUE_OP     (u16) 0x0036
 #define AML_INT_EVAL_SUBTREE_OP     (u16) 0x0037
 
-
 #define ARG_NONE                    0x0
 
 /*
 
 /* Single, simple types */
 
-#define ARGI_ANYTYPE                0x01    /* Don't care */
+#define ARGI_ANYTYPE                0x01       /* Don't care */
 #define ARGI_PACKAGE                0x02
 #define ARGI_EVENT                  0x03
 #define ARGI_MUTEX                  0x04
 #define ARGI_INTEGER                0x06
 #define ARGI_STRING                 0x07
 #define ARGI_BUFFER                 0x08
-#define ARGI_BUFFER_OR_STRING       0x09    /* Used by MID op only */
-#define ARGI_COMPUTEDATA            0x0A    /* Buffer, String, or Integer */
+#define ARGI_BUFFER_OR_STRING       0x09       /* Used by MID op only */
+#define ARGI_COMPUTEDATA            0x0A       /* Buffer, String, or Integer */
 
 /* Reference objects */
 
 #define ARGI_OBJECT_REF             0x0C
 #define ARGI_DEVICE_REF             0x0D
 #define ARGI_REFERENCE              0x0E
-#define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
-#define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
-#define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
+#define ARGI_TARGETREF              0x0F       /* Target, subject to implicit conversion */
+#define ARGI_FIXED_TARGET           0x10       /* Target, no implicit conversion */
+#define ARGI_SIMPLE_TARGET          0x11       /* Name, Local, Arg -- no implicit conversion */
 
 /* Multiple/complex types */
 
-#define ARGI_DATAOBJECT             0x12    /* Buffer, String, package or reference to a Node - Used only by size_of operator*/
-#define ARGI_COMPLEXOBJ             0x13    /* Buffer, String, or package (Used by INDEX op only) */
-#define ARGI_REF_OR_STRING          0x14    /* Reference or String (Used by DEREFOF op only) */
-#define ARGI_REGION_OR_FIELD        0x15    /* Used by LOAD op only */
+#define ARGI_DATAOBJECT             0x12       /* Buffer, String, package or reference to a Node - Used only by size_of operator */
+#define ARGI_COMPLEXOBJ             0x13       /* Buffer, String, or package (Used by INDEX op only) */
+#define ARGI_REF_OR_STRING          0x14       /* Reference or String (Used by DEREFOF op only) */
+#define ARGI_REGION_OR_FIELD        0x15       /* Used by LOAD op only */
 #define ARGI_DATAREFOBJ             0x16
 
 /* Note: types above can expand to 0x1F maximum */
 
 #define ARGI_INVALID_OPCODE         0xFFFFFFFF
 
-
 /*
  * hash offsets
  */
 #define AML_EXTOP_HASH_OFFSET       22
 #define AML_LNOT_HASH_OFFSET        19
 
-
 /*
  * opcode groups and types
  */
 #define OPGRP_FIELD                 0x02
 #define OPGRP_BYTELIST              0x04
 
-
 /*
  * Opcode information
  */
 /* Convenient flag groupings */
 
 #define AML_FLAGS_EXEC_0A_0T_1R                                     AML_HAS_RETVAL
-#define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
-#define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Monadic2  */
+#define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS       /* Monadic1  */
+#define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL     /* Monadic2  */
 #define AML_FLAGS_EXEC_1A_1T_0R     AML_HAS_ARGS | AML_HAS_TARGET
-#define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
-#define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS                                   /* Dyadic1   */
-#define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Dyadic2   */
-#define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r  */
+#define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL     /* monadic2_r */
+#define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS       /* Dyadic1   */
+#define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL     /* Dyadic2   */
+#define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL     /* dyadic2_r  */
 #define AML_FLAGS_EXEC_2A_2T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
 #define AML_FLAGS_EXEC_3A_0T_0R     AML_HAS_ARGS
 #define AML_FLAGS_EXEC_3A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
 #define AML_FLAGS_EXEC_6A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL
 
-
 /*
  * The opcode Type is used in a dispatch table, do not change
  * without updating the table.
  */
 #define AML_TYPE_EXEC_0A_0T_1R      0x00
-#define AML_TYPE_EXEC_1A_0T_0R      0x01 /* Monadic1  */
-#define AML_TYPE_EXEC_1A_0T_1R      0x02 /* Monadic2  */
+#define AML_TYPE_EXEC_1A_0T_0R      0x01       /* Monadic1  */
+#define AML_TYPE_EXEC_1A_0T_1R      0x02       /* Monadic2  */
 #define AML_TYPE_EXEC_1A_1T_0R      0x03
-#define AML_TYPE_EXEC_1A_1T_1R      0x04 /* monadic2_r */
-#define AML_TYPE_EXEC_2A_0T_0R      0x05 /* Dyadic1   */
-#define AML_TYPE_EXEC_2A_0T_1R      0x06 /* Dyadic2   */
-#define AML_TYPE_EXEC_2A_1T_1R      0x07 /* dyadic2_r  */
+#define AML_TYPE_EXEC_1A_1T_1R      0x04       /* monadic2_r */
+#define AML_TYPE_EXEC_2A_0T_0R      0x05       /* Dyadic1   */
+#define AML_TYPE_EXEC_2A_0T_1R      0x06       /* Dyadic2   */
+#define AML_TYPE_EXEC_2A_1T_1R      0x07       /* dyadic2_r  */
 #define AML_TYPE_EXEC_2A_2T_1R      0x08
 #define AML_TYPE_EXEC_3A_0T_0R      0x09
 #define AML_TYPE_EXEC_3A_1T_1R      0x0A
 #define AML_CLASS_METHOD_CALL       0x09
 #define AML_CLASS_UNKNOWN           0x0A
 
-
 /* Predefined Operation Region space_iDs */
 
-typedef enum
-{
-       REGION_MEMORY                   = 0,
+typedef enum {
+       REGION_MEMORY = 0,
        REGION_IO,
        REGION_PCI_CONFIG,
        REGION_EC,
        REGION_SMBUS,
        REGION_CMOS,
        REGION_PCI_BAR,
-       REGION_DATA_TABLE,              /* Internal use only */
-       REGION_FIXED_HW                 = 0x7F
-
+       REGION_DATA_TABLE,      /* Internal use only */
+       REGION_FIXED_HW = 0x7F
 } AML_REGION_TYPES;
 
-
 /* Comparison operation codes for match_op operator */
 
-typedef enum
-{
-       MATCH_MTR                       = 0,
-       MATCH_MEQ                       = 1,
-       MATCH_MLE                       = 2,
-       MATCH_MLT                       = 3,
-       MATCH_MGE                       = 4,
-       MATCH_MGT                       = 5
-
+typedef enum {
+       MATCH_MTR = 0,
+       MATCH_MEQ = 1,
+       MATCH_MLE = 2,
+       MATCH_MLT = 3,
+       MATCH_MGE = 4,
+       MATCH_MGT = 5
 } AML_MATCH_OPERATOR;
 
 #define MAX_MATCH_OPERATOR          5
 
-
 /*
  * field_flags
  *
@@ -450,60 +436,47 @@ typedef enum
 #define AML_FIELD_LOCK_RULE_MASK    0x10
 #define AML_FIELD_UPDATE_RULE_MASK  0x60
 
-
 /* 1) Field Access Types */
 
-typedef enum
-{
-       AML_FIELD_ACCESS_ANY            = 0x00,
-       AML_FIELD_ACCESS_BYTE           = 0x01,
-       AML_FIELD_ACCESS_WORD           = 0x02,
-       AML_FIELD_ACCESS_DWORD          = 0x03,
-       AML_FIELD_ACCESS_QWORD          = 0x04,    /* ACPI 2.0 */
-       AML_FIELD_ACCESS_BUFFER         = 0x05     /* ACPI 2.0 */
-
+typedef enum {
+       AML_FIELD_ACCESS_ANY = 0x00,
+       AML_FIELD_ACCESS_BYTE = 0x01,
+       AML_FIELD_ACCESS_WORD = 0x02,
+       AML_FIELD_ACCESS_DWORD = 0x03,
+       AML_FIELD_ACCESS_QWORD = 0x04,  /* ACPI 2.0 */
+       AML_FIELD_ACCESS_BUFFER = 0x05  /* ACPI 2.0 */
 } AML_ACCESS_TYPE;
 
-
 /* 2) Field Lock Rules */
 
-typedef enum
-{
-       AML_FIELD_LOCK_NEVER            = 0x00,
-       AML_FIELD_LOCK_ALWAYS           = 0x10
-
+typedef enum {
+       AML_FIELD_LOCK_NEVER = 0x00,
+       AML_FIELD_LOCK_ALWAYS = 0x10
 } AML_LOCK_RULE;
 
-
 /* 3) Field Update Rules */
 
-typedef enum
-{
-       AML_FIELD_UPDATE_PRESERVE       = 0x00,
-       AML_FIELD_UPDATE_WRITE_AS_ONES  = 0x20,
+typedef enum {
+       AML_FIELD_UPDATE_PRESERVE = 0x00,
+       AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
        AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
-
 } AML_UPDATE_RULE;
 
-
 /*
  * Field Access Attributes.
  * This byte is extracted from the AML via the
  * access_as keyword
  */
-typedef enum
-{
-       AML_FIELD_ATTRIB_SMB_QUICK      = 0x02,
-       AML_FIELD_ATTRIB_SMB_SEND_RCV   = 0x04,
-       AML_FIELD_ATTRIB_SMB_BYTE       = 0x06,
-       AML_FIELD_ATTRIB_SMB_WORD       = 0x08,
-       AML_FIELD_ATTRIB_SMB_BLOCK      = 0x0A,
-       AML_FIELD_ATTRIB_SMB_WORD_CALL  = 0x0C,
+typedef enum {
+       AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
+       AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
+       AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
+       AML_FIELD_ATTRIB_SMB_WORD = 0x08,
+       AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
+       AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
        AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
-
 } AML_ACCESS_ATTRIBUTE;
 
-
 /* Bit fields in method_flags byte */
 
 #define AML_METHOD_ARG_COUNT        0x07
@@ -516,5 +489,4 @@ typedef enum
 #define AML_METHOD_RESERVED1        0x02
 #define AML_METHOD_RESERVED2        0x04
 
-
-#endif /* __AMLCODE_H__ */
+#endif                         /* __AMLCODE_H__ */
index b20ec303df074f669844653289ff5bd4a983f104..051786e4b210d9cc80d3dd8aa9da0c1d649bb3d5 100644 (file)
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #ifndef __AMLRESRC_H
 #define __AMLRESRC_H
 
-
 #define ASL_RESNAME_ADDRESS                     "_ADR"
 #define ASL_RESNAME_ALIGNMENT                   "_ALN"
 #define ASL_RESNAME_ADDRESSSPACE                "_ASI"
 #define ASL_RESNAME_ACCESSSIZE                  "_ASZ"
 #define ASL_RESNAME_TYPESPECIFICATTRIBUTES      "_ATT"
 #define ASL_RESNAME_BASEADDRESS                 "_BAS"
-#define ASL_RESNAME_BUSMASTER                   "_BM_"  /* Master(1), Slave(0) */
+#define ASL_RESNAME_BUSMASTER                   "_BM_" /* Master(1), Slave(0) */
 #define ASL_RESNAME_DECODE                      "_DEC"
 #define ASL_RESNAME_DMA                         "_DMA"
-#define ASL_RESNAME_DMATYPE                     "_TYP"  /* Compatible(0), A(1), B(2), F(3) */
+#define ASL_RESNAME_DMATYPE                     "_TYP" /* Compatible(0), A(1), B(2), F(3) */
 #define ASL_RESNAME_GRANULARITY                 "_GRA"
 #define ASL_RESNAME_INTERRUPT                   "_INT"
-#define ASL_RESNAME_INTERRUPTLEVEL              "_LL_"  /* active_lo(1), active_hi(0) */
-#define ASL_RESNAME_INTERRUPTSHARE              "_SHR"  /* Shareable(1), no_share(0) */
-#define ASL_RESNAME_INTERRUPTTYPE               "_HE_"  /* Edge(1), Level(0) */
+#define ASL_RESNAME_INTERRUPTLEVEL              "_LL_" /* active_lo(1), active_hi(0) */
+#define ASL_RESNAME_INTERRUPTSHARE              "_SHR" /* Shareable(1), no_share(0) */
+#define ASL_RESNAME_INTERRUPTTYPE               "_HE_" /* Edge(1), Level(0) */
 #define ASL_RESNAME_LENGTH                      "_LEN"
-#define ASL_RESNAME_MEMATTRIBUTES               "_MTP"  /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
-#define ASL_RESNAME_MEMTYPE                     "_MEM"  /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ASL_RESNAME_MEMATTRIBUTES               "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ASL_RESNAME_MEMTYPE                     "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
 #define ASL_RESNAME_MAXADDR                     "_MAX"
 #define ASL_RESNAME_MINADDR                     "_MIN"
 #define ASL_RESNAME_MAXTYPE                     "_MAF"
 #define ASL_RESNAME_REGISTERBITOFFSET           "_RBO"
 #define ASL_RESNAME_REGISTERBITWIDTH            "_RBW"
 #define ASL_RESNAME_RANGETYPE                   "_RNG"
-#define ASL_RESNAME_READWRITETYPE               "_RW_"  /* read_only(0), Writeable (1) */
+#define ASL_RESNAME_READWRITETYPE               "_RW_" /* read_only(0), Writeable (1) */
 #define ASL_RESNAME_TRANSLATION                 "_TRA"
-#define ASL_RESNAME_TRANSTYPE                   "_TRS"  /* Sparse(1), Dense(0) */
-#define ASL_RESNAME_TYPE                        "_TTP"  /* Translation(1), Static (0) */
-#define ASL_RESNAME_XFERTYPE                    "_SIz"  /* 8(0), 8_and16(1), 16(2) */
-
+#define ASL_RESNAME_TRANSTYPE                   "_TRS" /* Sparse(1), Dense(0) */
+#define ASL_RESNAME_TYPE                        "_TTP" /* Translation(1), Static (0) */
+#define ASL_RESNAME_XFERTYPE                    "_SIz" /* 8(0), 8_and16(1), 16(2) */
 
 /* Default sizes for "small" resource descriptors */
 
 #define ASL_RDESC_FIXED_IO_SIZE                 0x03
 #define ASL_RDESC_END_TAG_SIZE                  0x01
 
-
-struct asl_resource_node
-{
-       u32                                 buffer_length;
-       void                                *buffer;
-       struct asl_resource_node            *next;
+struct asl_resource_node {
+       u32 buffer_length;
+       void *buffer;
+       struct asl_resource_node *next;
 };
 
-
 /*
  * Resource descriptors defined in the ACPI specification.
  *
@@ -106,214 +100,175 @@ struct asl_resource_node
  */
 #pragma pack(1)
 
-struct asl_irq_format_desc
-{
-       u8                                  descriptor_type;
-       u16                                 irq_mask;
-       u8                                  flags;
+struct asl_irq_format_desc {
+       u8 descriptor_type;
+       u16 irq_mask;
+       u8 flags;
 };
 
-
-struct asl_irq_noflags_desc
-{
-       u8                                  descriptor_type;
-       u16                                 irq_mask;
+struct asl_irq_noflags_desc {
+       u8 descriptor_type;
+       u16 irq_mask;
 };
 
-
-struct asl_dma_format_desc
-{
-       u8                                  descriptor_type;
-       u8                                  dma_channel_mask;
-       u8                                  flags;
+struct asl_dma_format_desc {
+       u8 descriptor_type;
+       u8 dma_channel_mask;
+       u8 flags;
 };
 
-
-struct asl_start_dependent_desc
-{
-       u8                                  descriptor_type;
-       u8                                  flags;
+struct asl_start_dependent_desc {
+       u8 descriptor_type;
+       u8 flags;
 };
 
-
-struct asl_start_dependent_noprio_desc
-{
-       u8                                  descriptor_type;
+struct asl_start_dependent_noprio_desc {
+       u8 descriptor_type;
 };
 
-
-struct asl_end_dependent_desc
-{
-       u8                                  descriptor_type;
+struct asl_end_dependent_desc {
+       u8 descriptor_type;
 };
 
-
-struct asl_io_port_desc
-{
-       u8                                  descriptor_type;
-       u8                                  information;
-       u16                                 address_min;
-       u16                                 address_max;
-       u8                                  alignment;
-       u8                                  length;
+struct asl_io_port_desc {
+       u8 descriptor_type;
+       u8 information;
+       u16 address_min;
+       u16 address_max;
+       u8 alignment;
+       u8 length;
 };
 
-
-struct asl_fixed_io_port_desc
-{
-       u8                                  descriptor_type;
-       u16                                 base_address;
-       u8                                  length;
+struct asl_fixed_io_port_desc {
+       u8 descriptor_type;
+       u16 base_address;
+       u8 length;
 };
 
-
-struct asl_small_vendor_desc
-{
-       u8                                  descriptor_type;
-       u8                                  vendor_defined[7];
+struct asl_small_vendor_desc {
+       u8 descriptor_type;
+       u8 vendor_defined[7];
 };
 
-
-struct asl_end_tag_desc
-{
-       u8                                  descriptor_type;
-       u8                                  checksum;
+struct asl_end_tag_desc {
+       u8 descriptor_type;
+       u8 checksum;
 };
 
-
 /* LARGE descriptors */
 
-struct asl_memory_24_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  information;
-       u16                                 address_min;
-       u16                                 address_max;
-       u16                                 alignment;
-       u16                                 range_length;
+struct asl_memory_24_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 information;
+       u16 address_min;
+       u16 address_max;
+       u16 alignment;
+       u16 range_length;
 };
 
-
-struct asl_large_vendor_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  vendor_defined[1];
+struct asl_large_vendor_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 vendor_defined[1];
 };
 
-
-struct asl_memory_32_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  information;
-       u32                                 address_min;
-       u32                                 address_max;
-       u32                                 alignment;
-       u32                                 range_length;
+struct asl_memory_32_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 information;
+       u32 address_min;
+       u32 address_max;
+       u32 alignment;
+       u32 range_length;
 };
 
-
-struct asl_fixed_memory_32_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  information;
-       u32                                 base_address;
-       u32                                 range_length;
+struct asl_fixed_memory_32_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 information;
+       u32 base_address;
+       u32 range_length;
 };
 
-
-struct asl_extended_address_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  resource_type;
-       u8                                  flags;
-       u8                                  specific_flags;
-       u8                                  revision_iD;
-       u8                                  reserved;
-       u64                                 granularity;
-       u64                                 address_min;
-       u64                                 address_max;
-       u64                                 translation_offset;
-       u64                                 address_length;
-       u64                                 type_specific_attributes;
-       u8                                  optional_fields[2]; /* Used for length calculation only */
+struct asl_extended_address_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 resource_type;
+       u8 flags;
+       u8 specific_flags;
+       u8 revision_iD;
+       u8 reserved;
+       u64 granularity;
+       u64 address_min;
+       u64 address_max;
+       u64 translation_offset;
+       u64 address_length;
+       u64 type_specific_attributes;
+       u8 optional_fields[2];  /* Used for length calculation only */
 };
 
-#define ASL_EXTENDED_ADDRESS_DESC_REVISION          1       /* ACPI 3.0 */
-
-
-struct asl_qword_address_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  resource_type;
-       u8                                  flags;
-       u8                                  specific_flags;
-       u64                                 granularity;
-       u64                                 address_min;
-       u64                                 address_max;
-       u64                                 translation_offset;
-       u64                                 address_length;
-       u8                                  optional_fields[2];
+#define ASL_EXTENDED_ADDRESS_DESC_REVISION          1  /* ACPI 3.0 */
+
+struct asl_qword_address_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 resource_type;
+       u8 flags;
+       u8 specific_flags;
+       u64 granularity;
+       u64 address_min;
+       u64 address_max;
+       u64 translation_offset;
+       u64 address_length;
+       u8 optional_fields[2];
 };
 
-
-struct asl_dword_address_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  resource_type;
-       u8                                  flags;
-       u8                                  specific_flags;
-       u32                                 granularity;
-       u32                                 address_min;
-       u32                                 address_max;
-       u32                                 translation_offset;
-       u32                                 address_length;
-       u8                                  optional_fields[2];
+struct asl_dword_address_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 resource_type;
+       u8 flags;
+       u8 specific_flags;
+       u32 granularity;
+       u32 address_min;
+       u32 address_max;
+       u32 translation_offset;
+       u32 address_length;
+       u8 optional_fields[2];
 };
 
-
-struct asl_word_address_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  resource_type;
-       u8                                  flags;
-       u8                                  specific_flags;
-       u16                                 granularity;
-       u16                                 address_min;
-       u16                                 address_max;
-       u16                                 translation_offset;
-       u16                                 address_length;
-       u8                                  optional_fields[2];
+struct asl_word_address_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 resource_type;
+       u8 flags;
+       u8 specific_flags;
+       u16 granularity;
+       u16 address_min;
+       u16 address_max;
+       u16 translation_offset;
+       u16 address_length;
+       u8 optional_fields[2];
 };
 
-
-struct asl_extended_xrupt_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  flags;
-       u8                                  table_length;
-       u32                                 interrupt_number[1];
+struct asl_extended_xrupt_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 flags;
+       u8 table_length;
+       u32 interrupt_number[1];
        /* res_source_index, res_source optional fields follow */
 };
 
-
-struct asl_general_register_desc
-{
-       u8                                  descriptor_type;
-       u16                                 length;
-       u8                                  address_space_id;
-       u8                                  bit_width;
-       u8                                  bit_offset;
-       u8                                  access_size; /* ACPI 3.0, was Reserved */
-       u64                                 address;
+struct asl_general_register_desc {
+       u8 descriptor_type;
+       u16 length;
+       u8 address_space_id;
+       u8 bit_width;
+       u8 bit_offset;
+       u8 access_size;         /* ACPI 3.0, was Reserved */
+       u64 address;
 };
 
 /* restore default alignment */
@@ -322,32 +277,29 @@ struct asl_general_register_desc
 
 /* Union of all resource descriptors, so we can allocate the worst case */
 
-union asl_resource_desc
-{
-       struct asl_irq_format_desc          irq;
-       struct asl_dma_format_desc          dma;
-       struct asl_start_dependent_desc     std;
-       struct asl_end_dependent_desc       end;
-       struct asl_io_port_desc             iop;
-       struct asl_fixed_io_port_desc       fio;
-       struct asl_small_vendor_desc        smv;
-       struct asl_end_tag_desc             et;
-
-       struct asl_memory_24_desc           M24;
-       struct asl_large_vendor_desc        lgv;
-       struct asl_memory_32_desc           M32;
-       struct asl_fixed_memory_32_desc     F32;
-       struct asl_qword_address_desc       qas;
-       struct asl_dword_address_desc       das;
-       struct asl_word_address_desc        was;
-       struct asl_extended_address_desc    eas;
-       struct asl_extended_xrupt_desc      exx;
-       struct asl_general_register_desc    grg;
-       u32                                 u32_item;
-       u16                                 u16_item;
-       u8                                  U8item;
+union asl_resource_desc {
+       struct asl_irq_format_desc irq;
+       struct asl_dma_format_desc dma;
+       struct asl_start_dependent_desc std;
+       struct asl_end_dependent_desc end;
+       struct asl_io_port_desc iop;
+       struct asl_fixed_io_port_desc fio;
+       struct asl_small_vendor_desc smv;
+       struct asl_end_tag_desc et;
+
+       struct asl_memory_24_desc M24;
+       struct asl_large_vendor_desc lgv;
+       struct asl_memory_32_desc M32;
+       struct asl_fixed_memory_32_desc F32;
+       struct asl_qword_address_desc qas;
+       struct asl_dword_address_desc das;
+       struct asl_word_address_desc was;
+       struct asl_extended_address_desc eas;
+       struct asl_extended_xrupt_desc exx;
+       struct asl_general_register_desc grg;
+       u32 u32_item;
+       u16 u16_item;
+       u8 U8item;
 };
 
-
 #endif
-
index d716df04d9dc505054f7311c843357c4565bb9b7..a703f14e049eeadd9cab2ee5dc8504c6726e8e93 100644 (file)
@@ -9,5 +9,4 @@ struct acpi_container {
        int state;
 };
 
-#endif /* __ACPI_CONTAINER_H */
-
+#endif                         /* __ACPI_CONTAINER_H */
index fd6730e4e567e283821fa412ef5c4517f26da307..91f4a12a99a1900a70e18b985e0b06a789ee8de4 100644 (file)
@@ -14,7 +14,6 @@
 #define ACPI_PDC_SMP_T_SWCOORD         (0x0080)
 #define ACPI_PDC_C_C1_FFH              (0x0100)
 
-
 #define ACPI_PDC_EST_CAPABILITY_SMP    (ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT)
 
@@ -25,5 +24,4 @@
                                         ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT)
 
-#endif /* __PDC_INTEL_H__ */
-
+#endif                         /* __PDC_INTEL_H__ */
index adf969efa510dd52d9eeda4bbebb94cc3b52f73c..16609c1ab2eb8f18f711ae44a26183327155ad5b 100644 (file)
 #ifndef __ACENV_H__
 #define __ACENV_H__
 
-
 /*
  * Configuration for ACPI tools and utilities
  */
 
-#ifdef _ACPI_DUMP_APP
+#ifdef ACPI_LIBRARY
+#define ACPI_USE_LOCAL_CACHE
+#endif
+
+#ifdef ACPI_DUMP_APP
 #ifndef MSDOS
 #define ACPI_DEBUG_OUTPUT
 #endif
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
 #define ACPI_NO_METHOD_EXECUTION
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
 #endif
 
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
 #undef DEBUGGER_THREADING
 #define DEBUGGER_THREADING      DEBUGGER_SINGLE_THREADED
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
 #define ACPI_DEBUGGER
 #define ACPI_DISASSEMBLER
-#define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
 #endif
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 #define ACPI_DEBUG_OUTPUT
 #define ACPI_APPLICATION
 #define ACPI_DISASSEMBLER
 #define ACPI_CONSTANT_EVAL_ONLY
+#endif
+
+#ifdef ACPI_APPLICATION
 #define ACPI_USE_SYSTEM_CLIBRARY
-#define ACPI_ENABLE_OBJECT_CACHE
+#define ACPI_USE_LOCAL_CACHE
 #endif
 
 /*
 #elif defined(WIN64)
 #include "acwin64.h"
 
-#elif defined(MSDOS)        /* Must appear after WIN32 and WIN64 check */
+#elif defined(MSDOS)           /* Must appear after WIN32 and WIN64 check */
 #include "acdos16.h"
 
 #elif defined(__FreeBSD__)
 
 /*! [End] no source code translation !*/
 
-
 /*
  * Debugger threading model
  * Use single threaded if the entire subsystem is contained in an application
 #else
 #define DEBUGGER_THREADING          DEBUGGER_MULTI_THREADED
 #endif
-#endif /* !DEBUGGER_THREADING */
-
+#endif                         /* !DEBUGGER_THREADING */
 
 /******************************************************************************
  *
 #include <string.h>
 #include <ctype.h>
 
-#endif /* ACPI_USE_STANDARD_HEADERS */
+#endif                         /* ACPI_USE_STANDARD_HEADERS */
 
 /*
  * We will be linking to the standard Clib functions
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
 
-#define ACPI_TOUPPER            toupper
-#define ACPI_TOLOWER            tolower
-#define ACPI_IS_XDIGIT          isxdigit
-#define ACPI_IS_DIGIT           isdigit
-#define ACPI_IS_SPACE           isspace
-#define ACPI_IS_UPPER           isupper
-#define ACPI_IS_PRINT           isprint
-#define ACPI_IS_ALPHA           isalpha
-#define ACPI_IS_ASCII           isascii
+#define ACPI_TOUPPER(i)         toupper((int) (i))
+#define ACPI_TOLOWER(i)         tolower((int) (i))
+#define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
+#define ACPI_IS_DIGIT(i)        isdigit((int) (i))
+#define ACPI_IS_SPACE(i)        isspace((int) (i))
+#define ACPI_IS_UPPER(i)        isupper((int) (i))
+#define ACPI_IS_PRINT(i)        isprint((int) (i))
+#define ACPI_IS_ALPHA(i)        isalpha((int) (i))
+#define ACPI_IS_ASCII(i)        isascii((int) (i))
 
 #else
 
  *****************************************************************************/
 
  /*
- * Use local definitions of C library macros and functions
- * NOTE: The function implementations may not be as efficient
- * as an inline or assembly code implementation provided by a
- * native C library.
- */
 * Use local definitions of C library macros and functions
 * NOTE: The function implementations may not be as efficient
 * as an inline or assembly code implementation provided by a
 * native C library.
 */
 
 #ifndef va_arg
 
 #ifndef _VALIST
 #define _VALIST
 typedef char *va_list;
-#endif /* _VALIST */
+#endif                         /* _VALIST */
 
 /*
  * Storage alignment properties
@@ -284,8 +284,7 @@ typedef char *va_list;
 #define va_end(ap)              (void) 0
 #define va_start(ap, A)         (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
 
-#endif /* va_arg */
-
+#endif                         /* va_arg */
 
 #define ACPI_STRSTR(s1,s2)      acpi_ut_strstr ((s1), (s2))
 #define ACPI_STRCHR(s1,c)       acpi_ut_strchr ((s1), (c))
@@ -303,8 +302,7 @@ typedef char *va_list;
 #define ACPI_TOUPPER            acpi_ut_to_upper
 #define ACPI_TOLOWER            acpi_ut_to_lower
 
-#endif /* ACPI_USE_SYSTEM_CLIBRARY */
-
+#endif                         /* ACPI_USE_SYSTEM_CLIBRARY */
 
 /******************************************************************************
  *
@@ -345,8 +343,7 @@ typedef char *va_list;
 #define ACPI_ACQUIRE_GLOBAL_LOCK(Glptr, acq)
 #define ACPI_RELEASE_GLOBAL_LOCK(Glptr, acq)
 
-#endif /* ACPI_ASM_MACROS */
-
+#endif                         /* ACPI_ASM_MACROS */
 
 #ifdef ACPI_APPLICATION
 
@@ -356,11 +353,10 @@ typedef char *va_list;
 #define BREAKPOINT3
 #endif
 
-
 /******************************************************************************
  *
  * Compiler-specific information is contained in the compiler-specific
  * headers.
  *
  *****************************************************************************/
-#endif /* __ACENV_H__ */
+#endif                         /* __ACENV_H__ */
index 91fda36b042bad6a0177dd4bab9e87206b18f30f..4c0e0ba09ba0213d4bd83a23314d88282a6f0fea 100644 (file)
 #ifndef __ACGCC_H__
 #define __ACGCC_H__
 
+/* Function name is used for debug output. Non-ANSI, compiler-dependent */
+
+#define ACPI_GET_FUNCTION_NAME          __FUNCTION__
+
 /* This macro is used to tag functions as "printf-like" because
  * some compilers (like GCC) can catch printf format string problems.
  */
-#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7)))
 
 /* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+ * use all the variables (for example, _acpi_module_name). This allows us
  * to to tell the compiler warning in a per-variable manner that a variable
  * is unused.
  */
 #define ACPI_UNUSED_VAR __attribute__ ((unused))
 
-#endif /* __ACGCC_H__ */
+#endif                         /* __ACGCC_H__ */
index a3de0db856942cad99fa80c16451b4a028cade3f..c93e6562f0e1312ef857a715db84c3379de2d138 100644 (file)
 
 #define ACPI_MACHINE_WIDTH  BITS_PER_LONG
 
-#else /* !__KERNEL__ */
+/* Type(s) for the OSL */
+
+#ifdef ACPI_USE_LOCAL_CACHE
+#define acpi_cache_t   struct acpi_memory_list
+#else
+#include <linux/slab.h>
+#define acpi_cache_t   kmem_cache_t
+#endif
+
+#else                          /* !__KERNEL__ */
 
 #include <stdarg.h>
 #include <string.h>
 
 #define __cdecl
 #define ACPI_FLUSH_CPU_CACHE()
-#endif /* __KERNEL__ */
+#endif                         /* __KERNEL__ */
 
 /* Linux uses GCC */
 
 #include "acgcc.h"
 
-#endif /* __ACLINUX_H__ */
+#endif                         /* __ACLINUX_H__ */
index 50cfea4ff6ca3d1b3d35162ff9d2c56624c9e7ac..7a00d5089de983d0fb91f39f410aa60ee152e2e8 100644 (file)
 struct acpi_processor_cx;
 
 struct acpi_power_register {
-       u8                      descriptor;
-       u16                     length;
-       u8                      space_id;
-       u8                      bit_width;
-       u8                      bit_offset;
-       u8                      reserved;
-       u64                     address;
+       u8 descriptor;
+       u16 length;
+       u8 space_id;
+       u8 bit_width;
+       u8 bit_offset;
+       u8 reserved;
+       u64 address;
 } __attribute__ ((packed));
 
-
 struct acpi_processor_cx_policy {
-       u32                     count;
+       u32 count;
        struct acpi_processor_cx *state;
        struct {
-               u32                     time;
-               u32                     ticks;
-               u32                     count;
-               u32                     bm;
-       }                       threshold;
+               u32 time;
+               u32 ticks;
+               u32 count;
+               u32 bm;
+       } threshold;
 };
 
 struct acpi_processor_cx {
-       u8                      valid;
-       u8                      type;
-       u32                     address;
-       u32                     latency;
-       u32                     latency_ticks;
-       u32                     power;
-       u32                     usage;
+       u8 valid;
+       u8 type;
+       u32 address;
+       u32 latency;
+       u32 latency_ticks;
+       u32 power;
+       u32 usage;
        struct acpi_processor_cx_policy promotion;
        struct acpi_processor_cx_policy demotion;
 };
 
 struct acpi_processor_power {
        struct acpi_processor_cx *state;
-       unsigned long           bm_check_timestamp;
-       u32                     default_state;
-       u32                     bm_activity;
-       int                     count;
+       unsigned long bm_check_timestamp;
+       u32 default_state;
+       u32 bm_activity;
+       int count;
        struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
 
        /* the _PDC objects passed by the driver, if any */
@@ -71,85 +70,82 @@ struct acpi_processor_power {
 /* Performance Management */
 
 struct acpi_pct_register {
-       u8                      descriptor;
-       u16                     length;
-       u8                      space_id;
-       u8                      bit_width;
-       u8                      bit_offset;
-       u8                      reserved;
-       u64                     address;
+       u8 descriptor;
+       u16 length;
+       u8 space_id;
+       u8 bit_width;
+       u8 bit_offset;
+       u8 reserved;
+       u64 address;
 } __attribute__ ((packed));
 
 struct acpi_processor_px {
-       acpi_integer            core_frequency;         /* megahertz */
-       acpi_integer            power;                  /* milliWatts */
-       acpi_integer            transition_latency;     /* microseconds */
-       acpi_integer            bus_master_latency;     /* microseconds */
-       acpi_integer            control;                /* control value */
-       acpi_integer            status;                 /* success indicator */
+       acpi_integer core_frequency;    /* megahertz */
+       acpi_integer power;     /* milliWatts */
+       acpi_integer transition_latency;        /* microseconds */
+       acpi_integer bus_master_latency;        /* microseconds */
+       acpi_integer control;   /* control value */
+       acpi_integer status;    /* success indicator */
 };
 
 struct acpi_processor_performance {
-       unsigned int             state;
-       unsigned int             platform_limit;
+       unsigned int state;
+       unsigned int platform_limit;
        struct acpi_pct_register control_register;
        struct acpi_pct_register status_register;
-       unsigned int             state_count;
+       unsigned int state_count;
        struct acpi_processor_px *states;
 
        /* the _PDC objects passed by the driver, if any */
        struct acpi_object_list *pdc;
 };
 
-
-
 /* Throttling Control */
 
 struct acpi_processor_tx {
-       u16                     power;
-       u16                     performance;
+       u16 power;
+       u16 performance;
 };
 
 struct acpi_processor_throttling {
-       int                     state;
-       u32                     address;
-       u8                      duty_offset;
-       u8                      duty_width;
-       int                     state_count;
+       int state;
+       u32 address;
+       u8 duty_offset;
+       u8 duty_width;
+       int state_count;
        struct acpi_processor_tx states[ACPI_PROCESSOR_MAX_THROTTLING];
 };
 
 /* Limit Interface */
 
 struct acpi_processor_lx {
-       int                     px;             /* performace state */  
-       int                     tx;             /* throttle level */
+       int px;                 /* performace state */
+       int tx;                 /* throttle level */
 };
 
 struct acpi_processor_limit {
-       struct acpi_processor_lx state;         /* current limit */
+       struct acpi_processor_lx state; /* current limit */
        struct acpi_processor_lx thermal;       /* thermal limit */
-       struct acpi_processor_lx user;          /* user limit */
+       struct acpi_processor_lx user;  /* user limit */
 };
 
-
 struct acpi_processor_flags {
-       u8                      power:1;
-       u8                      performance:1;
-       u8                      throttling:1;
-       u8                      limit:1;
-       u8                      bm_control:1;
-       u8                      bm_check:1;
-       u8                      has_cst:1;
-       u8                      power_setup_done:1;
+       u8 power:1;
+       u8 performance:1;
+       u8 throttling:1;
+       u8 limit:1;
+       u8 bm_control:1;
+       u8 bm_check:1;
+       u8 has_cst:1;
+       u8 power_setup_done:1;
 };
 
 struct acpi_processor {
-       acpi_handle             handle;
-       u32                     acpi_id;
-       u32                     id;
-       u32                     pblk;
-       int                     performance_platform_limit;
+       acpi_handle handle;
+       u32 acpi_id;
+       u32 id;
+       u32 pblk;
+       int performance_platform_limit;
        struct acpi_processor_flags flags;
        struct acpi_processor_power power;
        struct acpi_processor_performance *performance;
@@ -158,50 +154,49 @@ struct acpi_processor {
 };
 
 struct acpi_processor_errata {
-       u8                      smp;
+       u8 smp;
        struct {
-               u8                      throttle:1;
-               u8                      fdma:1;
-               u8                      reserved:6;
-               u32                     bmisx;
-       }                       piix4;
+               u8 throttle:1;
+               u8 fdma:1;
+               u8 reserved:6;
+               u32 bmisx;
+       } piix4;
 };
 
-extern int acpi_processor_register_performance (
-       struct acpi_processor_performance * performance,
-       unsigned int cpu);
-extern void acpi_processor_unregister_performance (
-       struct acpi_processor_performance * performance,
-       unsigned int cpu);
+extern int acpi_processor_register_performance(struct acpi_processor_performance
+                                              *performance, unsigned int cpu);
+extern void acpi_processor_unregister_performance(struct
+                                                 acpi_processor_performance
+                                                 *performance,
+                                                 unsigned int cpu);
 
 /* note: this locks both the calling module and the processor module
          if a _PPC object exists, rmmod is disallowed then */
 int acpi_processor_notify_smm(struct module *calling_module);
 
-
-
 /* for communication between multiple parts of the processor kernel module */
-extern struct acpi_processor   *processors[NR_CPUS];
+extern struct acpi_processor *processors[NR_CPUS];
 extern struct acpi_processor_errata errata;
 
 int acpi_processor_set_pdc(struct acpi_processor *pr,
-               struct acpi_object_list *pdc_in);
+                          struct acpi_object_list *pdc_in);
 
 #ifdef ARCH_HAS_POWER_PDC_INIT
 void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
-               unsigned int cpu);
+                                  unsigned int cpu);
 void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
-               unsigned int cpu);
+                                       unsigned int cpu);
 #else
-static inline void acpi_processor_power_init_pdc(
-               struct acpi_processor_power *pow, unsigned int cpu)
+static inline void acpi_processor_power_init_pdc(struct acpi_processor_power
+                                                *pow, unsigned int cpu)
 {
        pow->pdc = NULL;
        return;
 }
 
-static inline void acpi_processor_power_init_bm_check(
-               struct acpi_processor_flags *flags, unsigned int cpu)
+static inline void acpi_processor_power_init_bm_check(struct
+                                                     acpi_processor_flags
+                                                     *flags, unsigned int cpu)
 {
        flags->bm_check = 1;
        return;
@@ -215,51 +210,62 @@ void acpi_processor_ppc_init(void);
 void acpi_processor_ppc_exit(void);
 int acpi_processor_ppc_has_changed(struct acpi_processor *pr);
 #else
-static inline void acpi_processor_ppc_init(void) { return; }
-static inline void acpi_processor_ppc_exit(void) { return; }
-static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr) {
+static inline void acpi_processor_ppc_init(void)
+{
+       return;
+}
+static inline void acpi_processor_ppc_exit(void)
+{
+       return;
+}
+static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr)
+{
        static unsigned int printout = 1;
        if (printout) {
-               printk(KERN_WARNING "Warning: Processor Platform Limit event detected, but not handled.\n");
-               printk(KERN_WARNING "Consider compiling CPUfreq support into your kernel.\n");
+               printk(KERN_WARNING
+                      "Warning: Processor Platform Limit event detected, but not handled.\n");
+               printk(KERN_WARNING
+                      "Consider compiling CPUfreq support into your kernel.\n");
                printout = 0;
        }
        return 0;
 }
-#endif /* CONFIG_CPU_FREQ */
+#endif                         /* CONFIG_CPU_FREQ */
 
 /* in processor_throttling.c */
-int acpi_processor_get_throttling_info (struct acpi_processor *pr);
-int acpi_processor_set_throttling (struct acpi_processor *pr, int state);
-ssize_t acpi_processor_write_throttling (
-        struct file            *file,
-        const char             __user *buffer,
-        size_t                 count,
-        loff_t                 *data);
+int acpi_processor_get_throttling_info(struct acpi_processor *pr);
+int acpi_processor_set_throttling(struct acpi_processor *pr, int state);
+ssize_t acpi_processor_write_throttling(struct file *file,
+                                       const char __user * buffer,
+                                       size_t count, loff_t * data);
 extern struct file_operations acpi_processor_throttling_fops;
 
 /* in processor_idle.c */
-int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device);
-int acpi_processor_cst_has_changed (struct acpi_processor *pr);
-int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device);
-
+int acpi_processor_power_init(struct acpi_processor *pr,
+                             struct acpi_device *device);
+int acpi_processor_cst_has_changed(struct acpi_processor *pr);
+int acpi_processor_power_exit(struct acpi_processor *pr,
+                             struct acpi_device *device);
 
 /* in processor_thermal.c */
-int acpi_processor_get_limit_info (struct acpi_processor *pr);
-ssize_t acpi_processor_write_limit (
-       struct file             *file,
-       const char              __user *buffer,
-       size_t                  count,
-       loff_t                  *data);
+int acpi_processor_get_limit_info(struct acpi_processor *pr);
+ssize_t acpi_processor_write_limit(struct file *file,
+                                  const char __user * buffer,
+                                  size_t count, loff_t * data);
 extern struct file_operations acpi_processor_limit_fops;
 
 #ifdef CONFIG_CPU_FREQ
 void acpi_thermal_cpufreq_init(void);
 void acpi_thermal_cpufreq_exit(void);
 #else
-static inline void acpi_thermal_cpufreq_init(void) { return; }
-static inline void acpi_thermal_cpufreq_exit(void) { return; }
+static inline void acpi_thermal_cpufreq_init(void)
+{
+       return;
+}
+static inline void acpi_thermal_cpufreq_exit(void)
+{
+       return;
+}
 #endif
 
-
 #endif
index 72b04d846a231bb473e4986f05276f6d399ff2fe..cf35721cfa453f4a853520fce7e42b3e6298a5f3 100644 (file)
 
 #ifndef __ASSEMBLY__
 
-#if 0
-# define __REG(x)      (*((volatile u32 *)io_p2v(x)))
-#else
-/*
- * This __REG() version gives the same results as the one above,  except
- * that we are fooling gcc somehow so it generates far better and smaller
- * assembly code for access to contigous registers.  It's a shame that gcc
- * doesn't guess this by itself.
- */
-#include <asm/types.h>
-typedef struct { volatile u32 offset[4096]; } __regbase;
-# define __REGP(x)     ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
-# define __REG(x)      __REGP(io_p2v(x))
-#endif
+# define __REG(x)      (*((volatile unsigned long *)io_p2v(x)))
 
 /* With indexed regs we don't want to feed the index through io_p2v()
    especially if it is a variable, otherwise horrible code will result. */
-# define __REG2(x,y)     (*(volatile u32 *)((u32)&__REG(x) + (y)))
+# define __REG2(x,y)   \
+       (*(volatile unsigned long *)((unsigned long)&__REG(x) + (y)))
 
 # define __PREG(x)     (io_v2p((u32)&(x)))
 
index 10c62db3436247accb5c32e8ad9dc0589565533b..19c3b1e186bb6f8774704f138f10cb814fce3af4 100644 (file)
    ( (((x)&0x00ffffff) | (((x)&(0x30000000>>VIO_SHIFT))<<VIO_SHIFT)) + PIO_START )
 
 #ifndef __ASSEMBLY__
-#include <asm/types.h>
 
-#if 0
-# define __REG(x)      (*((volatile u32 *)io_p2v(x)))
-#else
-/*
- * This __REG() version gives the same results as the one above,  except
- * that we are fooling gcc somehow so it generates far better and smaller
- * assembly code for access to contigous registers.  It's a shame that gcc
- * doesn't guess this by itself.
- */
-typedef struct { volatile u32 offset[4096]; } __regbase;
-# define __REGP(x)     ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
-# define __REG(x)      __REGP(io_p2v(x))
-#endif
-
-# define __PREG(x)     (io_v2p((u32)&(x)))
+# define __REG(x)      (*((volatile unsigned long *)io_p2v(x)))
+# define __PREG(x)     (io_v2p((unsigned long)&(x)))
 
 #else
 
index 035cdcff43d233e8566e5ed0ce3e6b04514be4d9..e81baff4f54b3293d18290088af1e1ac1f65fabe 100644 (file)
@@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long);
  * Convert calls to our calling convention.
  */
 #define flush_cache_all()              __cpuc_flush_kern_all()
-
+#ifndef CONFIG_CPU_CACHE_VIPT
 static inline void flush_cache_mm(struct mm_struct *mm)
 {
        if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
@@ -279,6 +279,11 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned l
                __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
        }
 }
+#else
+extern void flush_cache_mm(struct mm_struct *mm);
+extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
+extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
+#endif
 
 /*
  * flush_cache_user_range is used when we want to ensure that the
index cf828ace13f95d9e92b9403f95b788ca7d21017a..df4ed323aa4de7be66e707cbdc59c1ff9a37a4cf 100644 (file)
@@ -103,7 +103,7 @@ __acpi_release_global_lock (unsigned int *lock)
         :"=r"(n_hi), "=r"(n_lo)     \
         :"0"(n_hi), "1"(n_lo))
 
-#ifdef CONFIG_ACPI_BOOT 
+#ifdef CONFIG_ACPI 
 extern int acpi_lapic;
 extern int acpi_ioapic;
 extern int acpi_noirq;
@@ -146,13 +146,6 @@ static inline void check_acpi_pci(void) { }
 
 #endif
 
-#else  /* CONFIG_ACPI_BOOT */
-#  define acpi_lapic 0
-#  define acpi_ioapic 0
-
-#endif
-
-#ifdef CONFIG_ACPI_PCI
 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
 static inline void acpi_disable_pci(void) 
 {
@@ -160,11 +153,16 @@ static inline void acpi_disable_pci(void)
        acpi_noirq_set();
 }
 extern int acpi_irq_balance_set(char *str);
-#else
+
+#else  /* !CONFIG_ACPI */
+
+#define acpi_lapic 0
+#define acpi_ioapic 0
 static inline void acpi_noirq_set(void) { }
 static inline void acpi_disable_pci(void) { }
-static inline int acpi_irq_balance_set(char *str) { return 0; }
-#endif
+
+#endif /* !CONFIG_ACPI */
+
 
 #ifdef CONFIG_ACPI_SLEEP
 
index c94cac958389439233e1965afba9f69afd32dcfc..cfb1c61d3b9c0b933766a9e70acc61db561642cf 100644 (file)
@@ -76,7 +76,7 @@ enum fixed_addresses {
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
        FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
 #endif
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
        FIX_ACPI_BEGIN,
        FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
 #endif
index 002c203ccd6ac98441f4df66e5d2926902f1a23a..51c4e5fe6062d0e239f257521804d342f008b33e 100644 (file)
@@ -195,12 +195,12 @@ extern int skip_ioapic_setup;
  */
 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern int io_apic_get_unique_id (int ioapic, int apic_id);
 extern int io_apic_get_version (int ioapic);
 extern int io_apic_get_redir_entries (int ioapic);
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /* CONFIG_ACPI */
 
 extern int (*ioapic_renumber_irq)(int ioapic, int irq);
 
index d84a9c326c2238e70cdc3159d18dd864a481fd01..64a0b8e6afeb27137c70b45ff981023ac2fad532 100644 (file)
@@ -27,14 +27,14 @@ extern unsigned long mp_lapic_addr;
 extern int pic_mode;
 extern int using_apic_timer;
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern void mp_register_lapic (u8 id, u8 enabled);
 extern void mp_register_lapic_address (u64 address);
 extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
 extern void mp_config_acpi_legacy_irqs (void);
 extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low);
-#endif /*CONFIG_ACPI_BOOT*/
+#endif /* CONFIG_ACPI */
 
 #define PHYSID_ARRAY_SIZE      BITS_TO_LONGS(MAX_APICS)
 
index 9271d74c64ccffc728bf3b5a2070adc4b2104a3d..56d2ddc97b30cd9c236e8b173edeea52ae2fc0c0 100644 (file)
@@ -11,6 +11,7 @@
 #define _ASM_IA64_ACPI_EXT_H
 
 #include <linux/types.h>
+#include <acpi/actypes.h>
 
 extern acpi_status hp_acpi_csr_space (acpi_handle, u64 *base, u64 *length);
 
index dc8c981af27f0b3c33bc3563ef87f560e84dc1bb..aa1c7b2e438cb36d3c9756b153d37a04c2570e9a 100644 (file)
@@ -101,7 +101,7 @@ __acpi_release_global_lock (unsigned int *lock)
         :"=r"(n_hi), "=r"(n_lo)     \
         :"0"(n_hi), "1"(n_lo))
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern int acpi_lapic;
 extern int acpi_ioapic;
 extern int acpi_noirq;
@@ -121,17 +121,6 @@ static inline void disable_acpi(void)
 #define FIX_ACPI_PAGES 4
 
 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
-
-#else  /* !CONFIG_ACPI_BOOT */
-#define acpi_lapic 0
-#define acpi_ioapic 0
-#endif /* !CONFIG_ACPI_BOOT */
-
-extern int acpi_numa;
-extern int acpi_scan_nodes(unsigned long start, unsigned long end);
-#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
-
-#ifdef CONFIG_ACPI_PCI
 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
 static inline void acpi_disable_pci(void) 
 {
@@ -139,11 +128,19 @@ static inline void acpi_disable_pci(void)
        acpi_noirq_set();
 }
 extern int acpi_irq_balance_set(char *str);
-#else
+
+#else  /* !CONFIG_ACPI */
+
+#define acpi_lapic 0
+#define acpi_ioapic 0
 static inline void acpi_noirq_set(void) { }
 static inline void acpi_disable_pci(void) { }
-static inline int acpi_irq_balance_set(char *str) { return 0; }
-#endif
+
+#endif /* !CONFIG_ACPI */
+
+extern int acpi_numa;
+extern int acpi_scan_nodes(unsigned long start, unsigned long end);
+#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
 
 #ifdef CONFIG_ACPI_SLEEP
 
index a8babd2bbe849c5197e96b908ffc7ded77e388e0..ee1bc69aec9ce56386f3acddc7de60a80e9c968f 100644 (file)
@@ -201,7 +201,7 @@ extern int skip_ioapic_setup;
  */
 #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern int io_apic_get_version (int ioapic);
 extern int io_apic_get_redir_entries (int ioapic);
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
index 331f6a3c72a2a4bb1ab35a646223bfc922bfb15e..f267e10c023df25debbba406a52f6a237a2bebb4 100644 (file)
@@ -179,7 +179,7 @@ extern int mpc_default_type;
 extern unsigned long mp_lapic_addr;
 extern int pic_mode;
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 extern void mp_register_lapic (u8 id, u8 enabled);
 extern void mp_register_lapic_address (u64 address);
 
index b46a5205ee7b1ce25f327cc07759220142d7f34d..026c3c011dc0c8fed9ab441e3374fdefe7f61bcf 100644 (file)
@@ -41,7 +41,7 @@
 #include <asm/acpi.h>
 
 
-#ifdef CONFIG_ACPI_BOOT
+#ifdef CONFIG_ACPI
 
 enum acpi_irq_model_id {
        ACPI_IRQ_MODEL_PIC = 0,
@@ -429,23 +429,13 @@ extern int pci_mmcfg_config_num;
 
 extern int sbf_port ;
 
-#else  /*!CONFIG_ACPI_BOOT*/
+#else  /* !CONFIG_ACPI */
 
 #define acpi_mp_config 0
 
-static inline int acpi_boot_init(void)
-{
-       return 0;
-}
-
-static inline int acpi_boot_table_init(void)
-{
-       return 0;
-}
+#endif         /* !CONFIG_ACPI */
 
-#endif         /*!CONFIG_ACPI_BOOT*/
-
-unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
+int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
 /*
@@ -455,7 +445,7 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
  */
 void acpi_unregister_gsi (u32 gsi);
 
-#ifdef CONFIG_ACPI_PCI
+#ifdef CONFIG_ACPI
 
 struct acpi_prt_entry {
        struct list_head        node;
@@ -489,7 +479,7 @@ struct acpi_pci_driver {
 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
 
-#endif /*CONFIG_ACPI_PCI*/
+#endif /* CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_EC
 
@@ -498,20 +488,9 @@ extern int ec_write(u8 addr, u8 val);
 
 #endif /*CONFIG_ACPI_EC*/
 
-#ifdef CONFIG_ACPI_INTERPRETER
-
 extern int acpi_blacklisted(void);
 extern void acpi_bios_year(char *s);
 
-#else /*!CONFIG_ACPI_INTERPRETER*/
-
-static inline int acpi_blacklisted(void)
-{
-       return 0;
-}
-
-#endif /*!CONFIG_ACPI_INTERPRETER*/
-
 #define        ACPI_CSTATE_LIMIT_DEFINED       /* for driver builds */
 #ifdef CONFIG_ACPI
 
@@ -549,5 +528,17 @@ static inline int acpi_get_pxm(acpi_handle handle)
 
 extern int pnpacpi_disabled;
 
+#else  /* CONFIG_ACPI */
+
+static inline int acpi_boot_init(void)
+{
+       return 0;
+}
+
+static inline int acpi_boot_table_init(void)
+{
+       return 0;
+}
+
 #endif /* CONFIG_ACPI */
 #endif /*_LINUX_ACPI_H*/
index 9b12fe731612dfd2ccb1665278dd5416e2e509f3..27db8da43aa40d4f40133cce0869c08f159d017e 100644 (file)
@@ -401,6 +401,9 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch,
 #endif
        return 0;
 }
+#ifndef SUPPORT_SYSRQ
+#define uart_handle_sysrq_char(port,ch,regs) uart_handle_sysrq_char(port, 0, NULL)
+#endif
 
 /*
  * We do the SysRQ and SAK checking like this...
index 9983fd857804dc7f85467ec8c7af743920bd8343..482eb820f13af0c7c0b5197e45f434967738cc1b 100644 (file)
@@ -33,7 +33,7 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi
 extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
 extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
 extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
-extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
+extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *,
                int);
 
 #endif /* NET_COMPAT_H */
index c14cd99911818c893294c52afff301b58e729554..396c7873e804076a7dbdf718bcbbcc19bb94f475 100644 (file)
@@ -1,5 +1,6 @@
 config PM
        bool "Power Management support"
+       depends on !IA64_HP_SIM
        ---help---
          "Power Management" means that parts of your computer are shut
          off or put into a power conserving "sleep" mode if they are not
index d99ab969589397f9cc844db57aac0b7ab2f9711f..e593dace2fdb05e975266cacb870914c8cc13db9 100644 (file)
@@ -135,13 +135,14 @@ static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *ms
  * thus placement) of cmsg headers and length are different for
  * 32-bit apps.  -DaveM
  */
-int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
+int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
                               unsigned char *stackbuf, int stackbuf_size)
 {
        struct compat_cmsghdr __user *ucmsg;
        struct cmsghdr *kcmsg, *kcmsg_base;
        compat_size_t ucmlen;
        __kernel_size_t kcmlen, tmp;
+       int err = -EFAULT;
 
        kcmlen = 0;
        kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf;
@@ -156,6 +157,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
 
                tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
                       CMSG_ALIGN(sizeof(struct cmsghdr)));
+               tmp = CMSG_ALIGN(tmp);
                kcmlen += tmp;
                ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
        }
@@ -167,30 +169,34 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
         * until we have successfully copied over all of the data
         * from the user.
         */
-       if(kcmlen > stackbuf_size)
-               kcmsg_base = kcmsg = kmalloc(kcmlen, GFP_KERNEL);
-       if(kcmsg == NULL)
+       if (kcmlen > stackbuf_size)
+               kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
+       if (kcmsg == NULL)
                return -ENOBUFS;
 
        /* Now copy them over neatly. */
        memset(kcmsg, 0, kcmlen);
        ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg);
        while(ucmsg != NULL) {
-               __get_user(ucmlen, &ucmsg->cmsg_len);
+               if (__get_user(ucmlen, &ucmsg->cmsg_len))
+                       goto Efault;
+               if (!CMSG_COMPAT_OK(ucmlen, ucmsg, kmsg))
+                       goto Einval;
                tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
                       CMSG_ALIGN(sizeof(struct cmsghdr)));
+               if ((char *)kcmsg_base + kcmlen - (char *)kcmsg < CMSG_ALIGN(tmp))
+                       goto Einval;
                kcmsg->cmsg_len = tmp;
-               __get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level);
-               __get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type);
-
-               /* Copy over the data. */
-               if(copy_from_user(CMSG_DATA(kcmsg),
-                                 CMSG_COMPAT_DATA(ucmsg),
-                                 (ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
-                       goto out_free_efault;
+               tmp = CMSG_ALIGN(tmp);
+               if (__get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level) ||
+                   __get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type) ||
+                   copy_from_user(CMSG_DATA(kcmsg),
+                                  CMSG_COMPAT_DATA(ucmsg),
+                                  (ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
+                       goto Efault;
 
                /* Advance. */
-               kcmsg = (struct cmsghdr *)((char *)kcmsg + CMSG_ALIGN(tmp));
+               kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp);
                ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
        }
 
@@ -199,10 +205,12 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
        kmsg->msg_controllen = kcmlen;
        return 0;
 
-out_free_efault:
-       if(kcmsg_base != (struct cmsghdr *)stackbuf)
-               kfree(kcmsg_base);
-       return -EFAULT;
+Einval:
+       err = -EINVAL;
+Efault:
+       if (kcmsg_base != (struct cmsghdr *)stackbuf)
+               sock_kfree_s(sk, kcmsg_base, kcmlen);
+       return err;
 }
 
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
index 58ed4319e6930167664bce8e7e5c15cddda301b7..91b16fbf91f0c88ace7137e2e5709b5dfac4a0ae 100644 (file)
@@ -1,6 +1,5 @@
 config IEEE80211
        tristate "Generic IEEE 802.11 Networking Stack"
-       select NET_RADIO
        ---help---
        This option enables the hardware independent IEEE 802.11
        networking stack.
index e1bd5d84d7bf11acce8a2c6b73d0f5ac41809d05..c699e93c33d72141332fdfa0c16afa87ed4a971e 100644 (file)
@@ -1745,10 +1745,11 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
                goto out_freeiov;
        ctl_len = msg_sys.msg_controllen; 
        if ((MSG_CMSG_COMPAT & flags) && ctl_len) {
-               err = cmsghdr_from_user_compat_to_kern(&msg_sys, ctl, sizeof(ctl));
+               err = cmsghdr_from_user_compat_to_kern(&msg_sys, sock->sk, ctl, sizeof(ctl));
                if (err)
                        goto out_freeiov;
                ctl_buf = msg_sys.msg_control;
+               ctl_len = msg_sys.msg_controllen;
        } else if (ctl_len) {
                if (ctl_len > sizeof(ctl))
                {