Merge branch 'release' of master.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
This commit is contained in:
commit
6a4b170c54
|
@ -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.
|
||||
|
|
|
@ -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):
|
||||
|
||||
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.
|
||||
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:
|
||||
|
||||
Experimental: CMOS control - /proc/acpi/ibm/cmos
|
||||
------------------------------------------------
|
||||
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.
|
||||
|
||||
Note: the UltraBay eject support on the 600e/x, A22p and A3x is
|
||||
EXPERIMENTAL and may not work as expected. USE WITH CAUTION!
|
||||
|
||||
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
|
||||
|
||||
(I've only been able to identify a couple of them).
|
||||
Temperature sensors -- /proc/acpi/ibm/thermal
|
||||
---------------------------------------------
|
||||
|
||||
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.
|
||||
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:
|
||||
|
||||
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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -40,9 +40,15 @@
|
|||
|
||||
#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 */
|
||||
|
@ -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_ht __initdata = 1; /* enable HT */
|
||||
|
||||
int acpi_lapic;
|
||||
|
@ -212,10 +213,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
|
|||
#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;
|
||||
|
||||
|
@ -240,10 +238,8 @@ acpi_parse_madt (
|
|||
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;
|
||||
|
||||
|
@ -260,16 +256,15 @@ acpi_parse_lapic (
|
|||
|
||||
x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
|
||||
|
||||
mp_register_lapic (
|
||||
processor->id, /* APIC ID */
|
||||
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;
|
||||
|
||||
|
@ -284,8 +279,7 @@ 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;
|
||||
|
||||
|
@ -302,14 +296,12 @@ acpi_parse_lapic_nmi (
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#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;
|
||||
|
||||
|
@ -320,10 +312,8 @@ acpi_parse_ioapic (
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -331,8 +321,7 @@ acpi_parse_ioapic (
|
|||
/*
|
||||
* 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;
|
||||
|
@ -363,8 +352,8 @@ 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;
|
||||
|
||||
|
@ -377,7 +366,8 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -387,19 +377,15 @@ acpi_parse_int_src_ovr (
|
|||
return 0;
|
||||
}
|
||||
|
||||
mp_override_legacy_irq (
|
||||
intsrc->bus_irq,
|
||||
mp_override_legacy_irq(intsrc->bus_irq,
|
||||
intsrc->flags.polarity,
|
||||
intsrc->flags.trigger,
|
||||
intsrc->global_irq);
|
||||
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;
|
||||
|
||||
|
@ -417,8 +403,6 @@ acpi_parse_nmi_src (
|
|||
|
||||
#endif /* CONFIG_X86_IO_APIC */
|
||||
|
||||
#ifdef CONFIG_ACPI_BUS
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
@ -470,9 +453,6 @@ 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
|
||||
|
@ -484,7 +464,11 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
|
|||
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;
|
||||
|
@ -509,50 +493,48 @@ 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);
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
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;
|
||||
|
@ -588,7 +570,6 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_HPET_TIMER
|
||||
|
||||
static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
|
||||
|
@ -609,7 +590,6 @@ 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);
|
||||
|
@ -645,23 +625,20 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
|
|||
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,14 +647,13 @@ 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;
|
||||
|
||||
|
@ -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,9 +688,12 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -727,14 +705,14 @@ acpi_parse_madt_lapic_entries(void)
|
|||
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 */
|
||||
|
@ -744,13 +722,12 @@ acpi_parse_madt_lapic_entries(void)
|
|||
}
|
||||
#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;
|
||||
|
||||
|
@ -773,19 +750,23 @@ acpi_parse_madt_ioapic_entries(void)
|
|||
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,7 +866,6 @@ 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)
|
||||
{
|
||||
|
@ -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 {
|
||||
|
@ -1032,7 +1013,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
|
|||
},
|
||||
},
|
||||
|
||||
#ifdef CONFIG_ACPI_PCI
|
||||
/*
|
||||
* Boxes that need ACPI PCI IRQ routing disabled
|
||||
*/
|
||||
|
@ -1043,7 +1023,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
|
|||
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"),
|
||||
DMI_MATCH(DMI_BIOS_VERSION,
|
||||
"ASUS A7V ACPI BIOS Revision 1007"),
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -1056,7 +1037,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
|
|||
.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_VERSION,
|
||||
"ASUS PR-DLS ACPI BIOS Revision 1010"),
|
||||
DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
|
||||
},
|
||||
},
|
||||
|
@ -1068,7 +1050,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
|
|||
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
|
||||
},
|
||||
},
|
||||
#endif
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
/*
|
||||
|
@ -1171,4 +1149,3 @@ int __init acpi_boot_init(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ 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)) {
|
||||
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++;
|
||||
}
|
||||
|
@ -42,7 +43,8 @@ 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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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,10 +166,16 @@ 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.
|
||||
*/
|
||||
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;
|
||||
|
@ -186,11 +195,15 @@ acpi_processor_set_performance (
|
|||
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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -50,7 +50,9 @@ 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;
|
||||
}
|
||||
|
@ -64,7 +66,8 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
|
|||
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;
|
||||
|
|
|
@ -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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -174,10 +174,9 @@ 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;
|
||||
|
||||
|
@ -193,7 +192,6 @@ acpi_parse_lapic_addr_ovr (
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
|
||||
{
|
||||
|
@ -206,9 +204,11 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
|
|||
|
||||
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,7 +216,6 @@ 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)
|
||||
{
|
||||
|
@ -231,7 +230,6 @@ 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)
|
||||
{
|
||||
|
@ -245,10 +243,9 @@ 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;
|
||||
|
@ -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,8 +322,8 @@ 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;
|
||||
|
||||
|
@ -333,12 +333,13 @@ acpi_parse_int_src_ovr (
|
|||
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)
|
||||
{
|
||||
|
@ -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,8 +369,7 @@ 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;
|
||||
|
@ -401,7 +399,6 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
|
||||
#undef SLIT_DEBUG
|
||||
|
@ -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;
|
||||
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;
|
||||
|
@ -443,7 +440,8 @@ 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++;
|
||||
|
@ -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,10 +531,13 @@ 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++) {
|
||||
if (!pxm_bit_test(i))
|
||||
|
@ -563,29 +563,36 @@ acpi_numa_arch_fixup (void)
|
|||
}
|
||||
#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 */
|
||||
|
||||
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;
|
||||
|
@ -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,27 +646,39 @@ 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");
|
||||
|
@ -681,7 +697,8 @@ 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();
|
||||
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,8 +745,7 @@ 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;
|
||||
|
@ -738,17 +756,14 @@ 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;
|
||||
#endif
|
||||
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 };
|
||||
union acpi_object *obj;
|
||||
|
@ -798,11 +813,10 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
|||
*pcpu = cpu;
|
||||
return (0);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_map_lsapic);
|
||||
|
||||
|
||||
int
|
||||
acpi_unmap_lsapic(int cpu)
|
||||
int acpi_unmap_lsapic(int cpu)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -821,10 +835,10 @@ acpi_unmap_lsapic(int cpu)
|
|||
|
||||
return (0);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_unmap_lsapic);
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
acpi_status __devinit
|
||||
acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
|
||||
|
@ -880,8 +894,7 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
|
|||
}
|
||||
#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;
|
||||
|
||||
|
@ -894,13 +907,14 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
|
|||
|
||||
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 */
|
||||
|
|
|
@ -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;
|
||||
|
@ -738,7 +739,7 @@ again:
|
|||
if (vector < 0) {
|
||||
vector = iosapic_find_sharable_vector(trigger, polarity);
|
||||
if (vector < 0)
|
||||
panic("%s: out of interrupt vectors!\n", __FUNCTION__);
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include <asm/proto.h>
|
||||
#include <asm/tlbflush.h>
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Low-Level Sleep Support
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -81,7 +80,8 @@ 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;
|
||||
|
@ -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)
|
||||
|
@ -129,4 +130,6 @@ __setup("acpi_sleep=", acpi_sleep_setup);
|
|||
|
||||
#endif /*CONFIG_ACPI_SLEEP */
|
||||
|
||||
void acpi_pci_link_exit(void) {}
|
||||
void acpi_pci_link_exit(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -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*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
@ -81,9 +80,7 @@ static struct file_operations acpi_ac_fops = {
|
|||
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;
|
||||
|
||||
|
@ -103,7 +100,6 @@ acpi_ac_get_state (
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -145,9 +141,7 @@ 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;
|
||||
|
||||
|
@ -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,16 +185,11 @@ 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;
|
||||
|
@ -231,10 +216,7 @@ acpi_ac_notify (
|
|||
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;
|
||||
|
@ -264,7 +246,8 @@ 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"));
|
||||
|
@ -285,11 +268,7 @@ 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;
|
||||
|
@ -314,9 +293,7 @@ acpi_ac_remove (
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_ac_init (void)
|
||||
static int __init acpi_ac_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
@ -78,7 +77,6 @@ struct acpi_memory_device {
|
|||
u64 end_addr; /* Memory Range end physical addr */
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -147,8 +144,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -162,8 +158,7 @@ end:
|
|||
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;
|
||||
|
||||
|
@ -185,8 +180,7 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
|||
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;
|
||||
|
||||
|
@ -209,8 +203,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
|||
(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,8 +211,7 @@ 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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -355,8 +345,7 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
|||
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;
|
||||
|
||||
|
@ -410,8 +398,7 @@ 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;
|
||||
|
@ -475,7 +462,8 @@ 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"));
|
||||
|
@ -485,8 +473,7 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
|
|||
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;
|
||||
|
@ -512,8 +499,7 @@ acpi_memory_device_init (void)
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
static void __exit
|
||||
acpi_memory_device_exit (void)
|
||||
static void __exit acpi_memory_device_exit(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
|
|||
|
||||
module_init(acpi_memory_device_init);
|
||||
module_exit(acpi_memory_device_exit);
|
||||
|
||||
|
||||
|
|
|
@ -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,7 +82,6 @@ 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 {
|
||||
|
@ -171,8 +169,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.mt_lcd_switch = A1x_PREFIX "_Q10",
|
||||
.lcd_status = "\\BKLI",
|
||||
.brightness_up = A1x_PREFIX "_Q0E",
|
||||
.brightness_down = A1x_PREFIX "_Q0F"
|
||||
},
|
||||
.brightness_down = A1x_PREFIX "_Q0F"},
|
||||
|
||||
{
|
||||
.name = "A2x",
|
||||
|
@ -184,8 +181,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "D1x",
|
||||
|
@ -196,8 +192,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_down = "\\Q0B",
|
||||
.brightness_status = "\\BLVL",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "L2D",
|
||||
|
@ -210,8 +205,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_up = "\\Q0E",
|
||||
.brightness_down = "\\Q0F",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "L3C",
|
||||
|
@ -222,8 +216,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"
|
||||
},
|
||||
.display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"},
|
||||
|
||||
{
|
||||
.name = "L3D",
|
||||
|
@ -235,8 +228,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "L3H",
|
||||
|
@ -247,8 +239,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "L4R",
|
||||
|
@ -260,8 +251,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\_SB.PCI0.P0P1.VGA.GETD"
|
||||
},
|
||||
.display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
|
||||
|
||||
{
|
||||
.name = "L5x",
|
||||
|
@ -273,8 +263,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "L8L"
|
||||
|
@ -290,8 +279,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_down = M1A_PREFIX "Q0F",
|
||||
.brightness_status = "\\BRIT",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "M2E",
|
||||
|
@ -302,8 +290,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\INFB"
|
||||
},
|
||||
.display_get = "\\INFB"},
|
||||
|
||||
{
|
||||
.name = "M6N",
|
||||
|
@ -315,8 +302,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\SSTE"
|
||||
},
|
||||
.display_get = "\\SSTE"},
|
||||
{
|
||||
.name = "M6R",
|
||||
.mt_mled = "MLED",
|
||||
|
@ -326,9 +312,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\SSTE"
|
||||
},
|
||||
|
||||
.display_get = "\\SSTE"},
|
||||
|
||||
{
|
||||
.name = "P30",
|
||||
|
@ -339,8 +323,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_down = P30_PREFIX "_Q69",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\DNXT"
|
||||
},
|
||||
.display_get = "\\DNXT"},
|
||||
|
||||
{
|
||||
.name = "S1x",
|
||||
|
@ -350,8 +333,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.mt_lcd_switch = S1x_PREFIX "Q10",
|
||||
.lcd_status = "\\PNOF",
|
||||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV"
|
||||
},
|
||||
.brightness_get = "GPLV"},
|
||||
|
||||
{
|
||||
.name = "S2x",
|
||||
|
@ -360,8 +342,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.mt_lcd_switch = S2x_PREFIX "_Q10",
|
||||
.lcd_status = "\\BKLI",
|
||||
.brightness_up = S2x_PREFIX "_Q0B",
|
||||
.brightness_down = S2x_PREFIX "_Q0A"
|
||||
},
|
||||
.brightness_down = S2x_PREFIX "_Q0A"},
|
||||
|
||||
{
|
||||
.name = "xxN",
|
||||
|
@ -372,8 +353,7 @@ static struct model_data model_conf[END_MODEL] = {
|
|||
.brightness_set = "SPLV",
|
||||
.brightness_get = "GPLV",
|
||||
.display_set = "SDSP",
|
||||
.display_get = "\\ADVG"
|
||||
}
|
||||
.display_get = "\\ADVG"}
|
||||
};
|
||||
|
||||
/* procdir we use */
|
||||
|
@ -427,7 +407,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
|
|||
return (status == AE_OK);
|
||||
}
|
||||
|
||||
|
||||
static int read_acpi_int(acpi_handle handle, const char *method, int *val)
|
||||
{
|
||||
struct acpi_buffer output;
|
||||
|
@ -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;
|
||||
|
@ -559,12 +538,12 @@ write_led(const char __user *buffer, unsigned long count,
|
|||
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,10 +551,10 @@ 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,
|
||||
unsigned long count, void *data)
|
||||
|
@ -590,7 +569,8 @@ 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
|
||||
|
@ -607,7 +587,8 @@ 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
|
||||
|
@ -617,7 +598,6 @@ proc_write_tled(struct file *file, const char __user *buffer,
|
|||
return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
|
||||
}
|
||||
|
||||
|
||||
static int get_lcd_state(void)
|
||||
{
|
||||
int lcd = 0;
|
||||
|
@ -625,7 +605,8 @@ static int get_lcd_state(void)
|
|||
if (hotk->model != L3H) {
|
||||
/* 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;
|
||||
|
@ -648,7 +629,9 @@ 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)
|
||||
|
@ -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))
|
||||
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,7 +677,6 @@ 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,
|
||||
unsigned long count, void *data)
|
||||
|
@ -704,7 +689,6 @@ proc_write_lcd(struct file *file, const char __user *buffer,
|
|||
return count;
|
||||
}
|
||||
|
||||
|
||||
static int read_brightness(void)
|
||||
{
|
||||
int value;
|
||||
|
@ -712,11 +696,13 @@ static int read_brightness(void)
|
|||
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");
|
||||
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");
|
||||
printk(KERN_WARNING
|
||||
"Asus ACPI: Error reading brightness\n");
|
||||
} else /* No GPLV method */
|
||||
value = hotk->brightness;
|
||||
return value;
|
||||
|
@ -733,7 +719,8 @@ static void set_brightness(int value)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -746,7 +733,8 @@ static void set_brightness(int value)
|
|||
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;
|
||||
}
|
||||
|
@ -796,7 +784,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
|
|||
int value = 0;
|
||||
|
||||
if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
|
||||
printk(KERN_WARNING "Asus ACPI: Error reading display status\n");
|
||||
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);
|
||||
}
|
||||
|
@ -822,7 +811,6 @@ 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,
|
||||
|
@ -833,7 +821,8 @@ __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));
|
||||
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;
|
||||
|
@ -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,16 +889,19 @@ 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;
|
||||
|
@ -924,8 +919,10 @@ static int asus_hotk_remove_fs(struct acpi_device* 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,7 +930,6 @@ 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. */
|
||||
|
@ -988,7 +984,8 @@ 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 */
|
||||
|
@ -996,7 +993,8 @@ static int __init asus_hotk_get_info(void)
|
|||
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");
|
||||
|
@ -1009,7 +1007,8 @@ static int __init asus_hotk_get_info(void)
|
|||
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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,14 +1149,19 @@ 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,
|
||||
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,
|
||||
status =
|
||||
acpi_evaluate_object(NULL,
|
||||
hotk->methods->brightness_up,
|
||||
NULL, NULL);
|
||||
if (ACPI_FAILURE(status))
|
||||
printk(KERN_WARNING " Strange, error changing"
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
|
@ -53,7 +52,6 @@
|
|||
#define ACPI_BATTERY_UNITS_WATTS "mW"
|
||||
#define ACPI_BATTERY_UNITS_AMPS "mA"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_BATTERY_COMPONENT
|
||||
ACPI_MODULE_NAME("acpi_battery")
|
||||
|
||||
|
@ -117,21 +115,20 @@ struct acpi_battery {
|
|||
struct acpi_battery_info *info;
|
||||
};
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Battery Management
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
acpi_battery_get_info (
|
||||
struct acpi_battery *battery,
|
||||
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};
|
||||
ACPI_BATTERY_FORMAT_BIF
|
||||
};
|
||||
struct acpi_buffer data = { 0, NULL };
|
||||
union acpi_object *package = NULL;
|
||||
|
||||
|
@ -184,15 +181,15 @@ end:
|
|||
}
|
||||
|
||||
static int
|
||||
acpi_battery_get_status (
|
||||
struct acpi_battery *battery,
|
||||
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};
|
||||
ACPI_BATTERY_FORMAT_BST
|
||||
};
|
||||
struct acpi_buffer data = { 0, NULL };
|
||||
union acpi_object *package = NULL;
|
||||
|
||||
|
@ -244,11 +241,8 @@ end:
|
|||
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 };
|
||||
|
@ -275,10 +269,7 @@ 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;
|
||||
|
@ -336,7 +327,6 @@ acpi_battery_check (
|
|||
return_VALUE(result);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -369,7 +359,9 @@ 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");
|
||||
|
@ -409,14 +401,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
|||
(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);
|
||||
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);
|
||||
|
@ -429,9 +417,7 @@ 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;
|
||||
|
@ -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) */
|
||||
|
||||
|
@ -468,11 +456,11 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
|
|||
seq_printf(seq, "capacity state: critical\n");
|
||||
|
||||
if ((bst->state & 0x01) && (bst->state & 0x02)) {
|
||||
seq_printf(seq, "charging state: charging/discharging\n");
|
||||
seq_printf(seq,
|
||||
"charging state: charging/discharging\n");
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Battery Charging and Discharging?\n"));
|
||||
}
|
||||
else if (bst->state & 0x01)
|
||||
} else if (bst->state & 0x01)
|
||||
seq_printf(seq, "charging state: discharging\n");
|
||||
else if (bst->state & 0x02)
|
||||
seq_printf(seq, "charging state: charging\n");
|
||||
|
@ -509,9 +497,7 @@ 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 = "?";
|
||||
|
@ -528,7 +514,9 @@ 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 */
|
||||
|
||||
|
@ -542,13 +530,10 @@ end:
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static ssize_t
|
||||
acpi_battery_write_alarm (
|
||||
struct file *file,
|
||||
acpi_battery_write_alarm(struct file *file,
|
||||
const char __user * buffer,
|
||||
size_t count,
|
||||
loff_t *ppos)
|
||||
size_t count, loff_t * ppos)
|
||||
{
|
||||
int result = 0;
|
||||
char alarm_string[12] = { '\0' };
|
||||
|
@ -606,9 +591,7 @@ static struct file_operations acpi_battery_alarm_ops = {
|
|||
.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;
|
||||
|
||||
|
@ -650,7 +633,8 @@ 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",
|
||||
|
@ -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,16 +667,11 @@ 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;
|
||||
|
@ -723,10 +699,7 @@ acpi_battery_notify (
|
|||
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;
|
||||
|
@ -756,7 +729,8 @@ 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"));
|
||||
|
@ -777,11 +751,7 @@ 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;
|
||||
|
@ -794,7 +764,8 @@ acpi_battery_remove (
|
|||
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"));
|
||||
|
@ -806,9 +777,7 @@ acpi_battery_remove (
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_battery_init (void)
|
||||
static int __init acpi_battery_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
@ -34,16 +33,14 @@
|
|||
#include <acpi/acpi_bus.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
enum acpi_blacklist_predicates
|
||||
{
|
||||
enum acpi_blacklist_predicates {
|
||||
all_versions,
|
||||
less_than_or_equal,
|
||||
equal,
|
||||
greater_than_or_equal,
|
||||
};
|
||||
|
||||
struct acpi_blacklist_item
|
||||
{
|
||||
struct acpi_blacklist_item {
|
||||
char oem_id[7];
|
||||
char oem_table_id[9];
|
||||
u32 oem_revision;
|
||||
|
@ -57,26 +54,28 @@ struct acpi_blacklist_item
|
|||
* 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);
|
||||
|
@ -109,19 +108,21 @@ blacklist_by_year(void)
|
|||
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)) {
|
||||
&& table_header->oem_revision ==
|
||||
acpi_blacklist[i].oem_revision)) {
|
||||
|
||||
printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
|
||||
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",
|
||||
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"));
|
||||
(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;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,8 @@
|
|||
#include <acpi/acpi_bus.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_BUS_COMPONENT
|
||||
ACPI_MODULE_NAME("acpi_bus")
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
|
||||
#endif
|
||||
|
@ -57,10 +55,7 @@ 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;
|
||||
|
||||
|
@ -80,11 +75,10 @@ acpi_bus_get_device (
|
|||
|
||||
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;
|
||||
|
@ -98,7 +92,8 @@ 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;
|
||||
|
@ -116,27 +111,24 @@ 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));
|
||||
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)));
|
||||
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;
|
||||
|
@ -157,8 +149,7 @@ 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).
|
||||
|
@ -169,8 +160,7 @@ acpi_bus_get_power (
|
|||
if (ACPI_FAILURE(status))
|
||||
return_VALUE(-ENODEV);
|
||||
device->power.state = (int)psc;
|
||||
}
|
||||
else if (device->power.flags.power_resources) {
|
||||
} else if (device->power.flags.power_resources) {
|
||||
result = acpi_power_get_inferred_state(device);
|
||||
if (result)
|
||||
return_VALUE(result);
|
||||
|
@ -184,13 +174,10 @@ acpi_bus_get_power (
|
|||
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -252,8 +243,7 @@ acpi_bus_set_power (
|
|||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (device->power.states[state].flags.explicit_set) {
|
||||
status = acpi_evaluate_object(device->handle,
|
||||
object_name, NULL, NULL);
|
||||
|
@ -271,18 +261,19 @@ acpi_bus_set_power (
|
|||
|
||||
end:
|
||||
if (result)
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
|
||||
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",
|
||||
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);
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
Event Management
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -294,11 +285,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
|
|||
|
||||
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;
|
||||
|
@ -329,11 +316,10 @@ 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;
|
||||
|
@ -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,17 +362,15 @@ 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;
|
||||
struct acpi_device_status old_status;
|
||||
|
@ -429,8 +414,7 @@ acpi_bus_check_device (
|
|||
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,10 +422,7 @@ 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;
|
||||
|
@ -467,17 +448,12 @@ 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;
|
||||
|
@ -490,7 +466,8 @@ acpi_bus_notify (
|
|||
switch (type) {
|
||||
|
||||
case ACPI_NOTIFY_BUS_CHECK:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Received BUS CHECK notification for device [%s]\n",
|
||||
device->pnp.bus_id));
|
||||
result = acpi_bus_check_scope(device);
|
||||
/*
|
||||
|
@ -500,7 +477,8 @@ acpi_bus_notify (
|
|||
break;
|
||||
|
||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n",
|
||||
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);
|
||||
/*
|
||||
|
@ -510,43 +488,50 @@ acpi_bus_notify (
|
|||
break;
|
||||
|
||||
case ACPI_NOTIFY_DEVICE_WAKE:
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Received unknown/unsupported notification [%08x]\n",
|
||||
type));
|
||||
break;
|
||||
}
|
||||
|
@ -558,8 +543,7 @@ 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 };
|
||||
|
@ -601,9 +585,7 @@ 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 };
|
||||
|
@ -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;
|
||||
|
@ -671,8 +658,7 @@ error0:
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
static int __init
|
||||
acpi_bus_init (void)
|
||||
static int __init acpi_bus_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
acpi_status status = AE_OK;
|
||||
|
@ -682,14 +668,17 @@ acpi_bus_init (void)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -750,8 +742,7 @@ static int __init acpi_init (void)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
@ -67,7 +66,6 @@ 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_info_open_fs(struct inode *inode, struct file *file);
|
||||
|
@ -103,6 +101,7 @@ static struct file_operations acpi_button_state_fops = {
|
|||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
@ -143,9 +142,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
|
|||
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,9 +159,7 @@ 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;
|
||||
|
@ -237,10 +234,7 @@ 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;
|
||||
|
||||
|
@ -262,16 +256,11 @@ acpi_button_remove_fs (
|
|||
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;
|
||||
|
||||
|
@ -282,7 +271,8 @@ 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,
|
||||
|
@ -293,10 +283,7 @@ acpi_button_notify (
|
|||
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;
|
||||
|
||||
|
@ -310,10 +297,7 @@ 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;
|
||||
|
@ -339,40 +323,32 @@ 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);
|
||||
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_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);
|
||||
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_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);
|
||||
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)));
|
||||
result = -ENODEV;
|
||||
|
@ -385,20 +361,19 @@ acpi_button_add (
|
|||
|
||||
switch (button->type) {
|
||||
case ACPI_BUTTON_TYPE_POWERF:
|
||||
status = acpi_install_fixed_event_handler (
|
||||
ACPI_EVENT_POWER_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,
|
||||
status =
|
||||
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
|
||||
acpi_button_notify_fixed,
|
||||
button);
|
||||
break;
|
||||
default:
|
||||
status = acpi_install_notify_handler (
|
||||
button->handle,
|
||||
status = acpi_install_notify_handler(button->handle,
|
||||
ACPI_DEVICE_NOTIFY,
|
||||
acpi_button_notify,
|
||||
button);
|
||||
|
@ -415,7 +390,8 @@ acpi_button_add (
|
|||
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);
|
||||
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;
|
||||
|
@ -433,9 +409,7 @@ 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;
|
||||
|
@ -450,16 +424,19 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -474,9 +451,7 @@ acpi_button_remove (struct acpi_device *device, int type)
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_button_init (void)
|
||||
static int __init acpi_button_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
@ -495,9 +470,7 @@ 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");
|
||||
|
||||
|
@ -514,6 +487,5 @@ acpi_button_exit (void)
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
module_init(acpi_button_init);
|
||||
module_exit(acpi_button_exit);
|
||||
|
|
|
@ -65,11 +65,9 @@ static struct acpi_driver acpi_container_driver = {
|
|||
},
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
static int
|
||||
is_device_present(acpi_handle handle)
|
||||
static int is_device_present(acpi_handle handle)
|
||||
{
|
||||
acpi_handle temp;
|
||||
acpi_status status;
|
||||
|
@ -89,8 +87,7 @@ is_device_present(acpi_handle handle)
|
|||
}
|
||||
|
||||
/*******************************************************************/
|
||||
static int
|
||||
acpi_container_add(struct acpi_device *device)
|
||||
static int acpi_container_add(struct acpi_device *device)
|
||||
{
|
||||
struct acpi_container *container;
|
||||
|
||||
|
@ -111,15 +108,13 @@ acpi_container_add(struct acpi_device *device)
|
|||
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_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;
|
||||
|
@ -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,8 +151,7 @@ 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;
|
||||
int result;
|
||||
|
@ -207,9 +199,7 @@ 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 };
|
||||
|
@ -241,8 +231,7 @@ container_walk_namespace_cb(acpi_handle handle,
|
|||
case INSTALL_NOTIFY_HANDLER:
|
||||
acpi_install_notify_handler(handle,
|
||||
ACPI_SYSTEM_NOTIFY,
|
||||
container_notify_cb,
|
||||
NULL);
|
||||
container_notify_cb, NULL);
|
||||
break;
|
||||
case UNINSTALL_NOTIFY_HANDLER:
|
||||
acpi_remove_notify_handler(handle,
|
||||
|
@ -259,9 +248,7 @@ end:
|
|||
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;
|
||||
|
@ -275,14 +262,12 @@ acpi_container_init(void)
|
|||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb,
|
||||
&action, NULL);
|
||||
container_walk_namespace_cb, &action, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void __exit
|
||||
acpi_container_exit(void)
|
||||
static void __exit acpi_container_exit(void)
|
||||
{
|
||||
int action = UNINSTALL_NOTIFY_HANDLER;
|
||||
|
||||
|
@ -291,8 +276,7 @@ acpi_container_exit(void)
|
|||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||
ACPI_ROOT_OBJECT,
|
||||
ACPI_UINT32_MAX,
|
||||
container_walk_namespace_cb,
|
||||
&action, NULL);
|
||||
container_walk_namespace_cb, &action, NULL);
|
||||
|
||||
acpi_bus_unregister_driver(&acpi_container_driver);
|
||||
|
||||
|
|
|
@ -13,14 +13,11 @@
|
|||
|
||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||
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_level, uint, 0400);
|
||||
|
@ -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),
|
||||
|
@ -92,13 +87,8 @@ static const struct acpi_dlevel acpi_debug_levels[] =
|
|||
};
|
||||
|
||||
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;
|
||||
|
@ -115,14 +105,15 @@ acpi_system_read_debug (
|
|||
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_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_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);
|
||||
|
@ -132,8 +123,8 @@ acpi_system_read_debug (
|
|||
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_dbg_level & acpi_debug_levels[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
|
||||
acpi_dbg_level);
|
||||
|
@ -145,22 +136,22 @@ acpi_system_read_debug (
|
|||
|
||||
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,
|
||||
acpi_system_write_debug(struct file *file,
|
||||
const char __user * buffer,
|
||||
unsigned long count,
|
||||
void *data)
|
||||
unsigned long count, void *data)
|
||||
{
|
||||
char debug_string[12] = { '\0' };
|
||||
|
||||
|
@ -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,8 +203,10 @@ 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);
|
||||
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
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/amlcode.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
@ -49,19 +48,15 @@
|
|||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acparser.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME("dsfield")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_get_field_names (
|
||||
struct acpi_create_field_info *info,
|
||||
acpi_ds_get_field_names(struct acpi_create_field_info *info,
|
||||
struct acpi_walk_state *walk_state,
|
||||
union acpi_parse_object *arg);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_buffer_field
|
||||
|
@ -82,8 +77,7 @@ acpi_ds_get_field_names (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_buffer_field (
|
||||
union acpi_parse_object *op,
|
||||
acpi_ds_create_buffer_field(union acpi_parse_object *op,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
union acpi_parse_object *arg;
|
||||
|
@ -93,16 +87,13 @@ acpi_ds_create_buffer_field (
|
|||
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 {
|
||||
} else {
|
||||
/* Create Bit/Byte/Word/Dword field */
|
||||
|
||||
arg = acpi_ps_get_arg(op, 2);
|
||||
|
@ -115,8 +106,7 @@ acpi_ds_create_buffer_field (
|
|||
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,8 +114,7 @@ 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;
|
||||
}
|
||||
|
@ -133,9 +122,11 @@ acpi_ds_create_buffer_field (
|
|||
/*
|
||||
* 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));
|
||||
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);
|
||||
|
@ -188,7 +179,6 @@ acpi_ds_create_buffer_field (
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Remove local reference to the object */
|
||||
|
@ -197,7 +187,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_field_names
|
||||
|
@ -214,18 +203,15 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_get_field_names (
|
||||
struct acpi_create_field_info *info,
|
||||
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);
|
||||
|
||||
|
||||
/* First field starts at bit zero */
|
||||
|
||||
info->field_bit_position = 0;
|
||||
|
@ -246,15 +232,13 @@ acpi_ds_get_field_names (
|
|||
+ (acpi_integer) arg->common.value.size;
|
||||
|
||||
if (position > ACPI_UINT32_MAX) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
|
||||
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,31 +250,32 @@ acpi_ds_get_field_names (
|
|||
* ACCESS_TYPE bits
|
||||
*/
|
||||
info->field_flags = (u8)
|
||||
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
|
||||
((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,
|
||||
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);
|
||||
ACPI_REPORT_NSERROR((char *)&arg->named.name,
|
||||
status);
|
||||
if (status != AE_ALREADY_EXISTS) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Already exists, ignore error */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
arg->common.node = info->field_node;
|
||||
info->field_bit_length = arg->common.value.size;
|
||||
|
||||
|
@ -308,16 +293,13 @@ acpi_ds_get_field_names (
|
|||
+ (acpi_integer) arg->common.value.size;
|
||||
|
||||
if (position > ACPI_UINT32_MAX) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
|
||||
(char *) &info->field_node->name));
|
||||
ACPI_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,
|
||||
|
@ -332,7 +314,6 @@ acpi_ds_get_field_names (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_field
|
||||
|
@ -348,8 +329,7 @@ acpi_ds_get_field_names (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_field (
|
||||
union acpi_parse_object *op,
|
||||
acpi_ds_create_field(union acpi_parse_object *op,
|
||||
struct acpi_namespace_node *region_node,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
|
@ -357,17 +337,17 @@ acpi_ds_create_field (
|
|||
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, ®ion_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, ®ion_node);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_NSERROR(arg->common.value.name, status);
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -390,7 +370,6 @@ acpi_ds_create_field (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_init_field_objects
|
||||
|
@ -407,8 +386,7 @@ acpi_ds_create_field (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_init_field_objects (
|
||||
union acpi_parse_object *op,
|
||||
acpi_ds_init_field_objects(union acpi_parse_object *op,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
acpi_status status;
|
||||
|
@ -416,10 +394,8 @@ acpi_ds_init_field_objects (
|
|||
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);
|
||||
|
@ -450,11 +426,13 @@ acpi_ds_init_field_objects (
|
|||
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_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);
|
||||
ACPI_REPORT_NSERROR((char *)&arg->named.name,
|
||||
status);
|
||||
if (status != AE_ALREADY_EXISTS) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -475,7 +453,6 @@ acpi_ds_init_field_objects (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_bank_field
|
||||
|
@ -491,8 +468,7 @@ acpi_ds_init_field_objects (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_bank_field (
|
||||
union acpi_parse_object *op,
|
||||
acpi_ds_create_bank_field(union acpi_parse_object *op,
|
||||
struct acpi_namespace_node *region_node,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
|
@ -500,17 +476,17 @@ acpi_ds_create_bank_field (
|
|||
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, ®ion_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, ®ion_node);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_NSERROR(arg->common.value.name, status);
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -520,9 +496,11 @@ acpi_ds_create_bank_field (
|
|||
/* 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,
|
||||
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);
|
||||
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);
|
||||
|
@ -548,7 +526,6 @@ acpi_ds_create_bank_field (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_index_field
|
||||
|
@ -564,8 +541,7 @@ acpi_ds_create_bank_field (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_index_field (
|
||||
union acpi_parse_object *op,
|
||||
acpi_ds_create_index_field(union acpi_parse_object *op,
|
||||
struct acpi_namespace_node *region_node,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
|
@ -573,16 +549,16 @@ acpi_ds_create_index_field (
|
|||
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,
|
||||
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);
|
||||
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);
|
||||
|
@ -591,9 +567,11 @@ acpi_ds_create_index_field (
|
|||
/* 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,
|
||||
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);
|
||||
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);
|
||||
|
@ -613,5 +591,3 @@ acpi_ds_create_index_field (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
@ -50,14 +49,9 @@
|
|||
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)
|
||||
{
|
||||
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;
|
||||
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -116,18 +107,16 @@ acpi_ds_init_one_object (
|
|||
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),
|
||||
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
|
||||
|
@ -143,7 +132,7 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -153,31 +142,22 @@ acpi_ds_init_one_object (
|
|||
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),
|
||||
"\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,17 +184,14 @@ acpi_ds_init_one_object (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_initialize_objects (
|
||||
struct acpi_table_desc *table_desc,
|
||||
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_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:"));
|
||||
|
@ -237,13 +213,14 @@ acpi_ds_initialize_objects (
|
|||
|
||||
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));
|
||||
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));
|
||||
"%hd Methods, %hd Regions\n", info.method_count,
|
||||
info.op_region_count));
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -49,53 +48,43 @@
|
|||
#include <acpi/acinterp.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
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_FUNCTION_TRACE_PTR("ds_parse_method", node);
|
||||
|
||||
/* Parameter Validation */
|
||||
|
||||
if (!obj_handle) {
|
||||
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);
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||
|
@ -132,14 +121,19 @@ 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,
|
||||
|
@ -147,7 +141,7 @@ acpi_ds_parse_method (
|
|||
obj_desc->method.aml_length, NULL, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
return_ACPI_STATUS (status);
|
||||
goto cleanup2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -161,18 +155,29 @@ acpi_ds_parse_method (
|
|||
*/
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS (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_ut_get_node_name(node), node, op));
|
||||
|
||||
/*
|
||||
* Delete the parse tree. We simply re-parse the method for every
|
||||
* execution since there isn't much overhead (compared to keeping lots
|
||||
* of parse trees around)
|
||||
*/
|
||||
acpi_ns_delete_namespace_subtree(node);
|
||||
acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
|
||||
|
||||
cleanup2:
|
||||
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
|
||||
|
||||
cleanup:
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_begin_method_execution
|
||||
|
@ -190,21 +195,25 @@ acpi_ds_parse_method (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_begin_method_execution (
|
||||
struct acpi_namespace_node *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_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
|
||||
|
||||
|
||||
if (!method_node) {
|
||||
return_ACPI_STATUS(AE_NULL_ENTRY);
|
||||
}
|
||||
|
||||
/* Prevent wraparound of thread count */
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a concurrency limit on this method, we need to
|
||||
* obtain a unit from the method semaphore.
|
||||
|
@ -219,7 +228,8 @@ 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) {
|
||||
if (obj_desc->method.thread_count >=
|
||||
obj_desc->method.concurrency) {
|
||||
return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
|
||||
}
|
||||
}
|
||||
|
@ -228,10 +238,23 @@ 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,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Increment the method parse tree thread count since it has been
|
||||
* reentered one more time (even if it is the same thread)
|
||||
|
@ -240,7 +263,6 @@ acpi_ds_begin_method_execution (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_call_control_method
|
||||
|
@ -256,22 +278,21 @@ acpi_ds_begin_method_execution (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_call_control_method (
|
||||
struct acpi_thread_state *thread,
|
||||
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;
|
||||
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_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"Execute method %p, currentstate=%p\n",
|
||||
this_walk_state->prev_op, this_walk_state));
|
||||
|
||||
/*
|
||||
|
@ -287,21 +308,20 @@ acpi_ds_call_control_method (
|
|||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -315,7 +335,8 @@ acpi_ds_call_control_method (
|
|||
}
|
||||
|
||||
status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
|
||||
obj_desc->method.aml_start, obj_desc->method.aml_length,
|
||||
obj_desc->method.aml_start,
|
||||
obj_desc->method.aml_length,
|
||||
NULL, 1);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(next_walk_state);
|
||||
|
@ -330,7 +351,7 @@ acpi_ds_call_control_method (
|
|||
|
||||
/* 2) Execute: Create a new state for the preempting walk */
|
||||
|
||||
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
|
||||
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;
|
||||
|
@ -339,8 +360,7 @@ acpi_ds_call_control_method (
|
|||
/*
|
||||
* 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
|
||||
* start at index 0. Also, null terminate the list of arguments
|
||||
*/
|
||||
this_walk_state->operands[this_walk_state->num_operands] = NULL;
|
||||
|
||||
|
@ -348,8 +368,8 @@ acpi_ds_call_control_method (
|
|||
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);
|
||||
obj_desc->method.aml_start,
|
||||
obj_desc->method.aml_length, &info, 3);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -368,30 +388,29 @@ acpi_ds_call_control_method (
|
|||
this_walk_state->num_operands = 0;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"Starting nested execution, newstate=%p\n", next_walk_state));
|
||||
"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);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
cleanup:
|
||||
/* Decrement the thread count on the method parse tree */
|
||||
|
||||
if (next_walk_state && (next_walk_state->method_desc)) {
|
||||
next_walk_state->method_desc->method.thread_count--;
|
||||
}
|
||||
|
||||
/* On error, we must delete the new walk state */
|
||||
|
||||
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--;
|
||||
}
|
||||
(void) acpi_ds_terminate_control_method (next_walk_state);
|
||||
acpi_ds_terminate_control_method(next_walk_state);
|
||||
acpi_ds_delete_walk_state(next_walk_state);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_restart_control_method
|
||||
|
@ -407,20 +426,17 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_restart_control_method (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
|
||||
union acpi_operand_object *return_desc)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
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));
|
||||
(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",
|
||||
|
@ -456,7 +472,8 @@ 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
|
||||
|
@ -468,14 +485,13 @@ acpi_ds_restart_control_method (
|
|||
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,27 +499,23 @@ 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);
|
||||
|
||||
|
||||
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 */
|
||||
|
@ -517,17 +529,17 @@ acpi_ds_terminate_control_method (
|
|||
*/
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS (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);
|
||||
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;
|
||||
|
||||
/* Ignore error and continue cleanup */
|
||||
}
|
||||
|
@ -536,10 +548,10 @@ acpi_ds_terminate_control_method (
|
|||
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));
|
||||
}
|
||||
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
|
||||
|
@ -552,9 +564,10 @@ acpi_ds_terminate_control_method (
|
|||
*/
|
||||
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);
|
||||
status = acpi_os_create_semaphore(1, 1,
|
||||
&walk_state->
|
||||
method_desc->method.
|
||||
semaphore);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -571,7 +584,7 @@ acpi_ds_terminate_control_method (
|
|||
*/
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (method_node->child) {
|
||||
|
@ -582,15 +595,14 @@ acpi_ds_terminate_control_method (
|
|||
* Delete any namespace entries created anywhere else within
|
||||
* the namespace
|
||||
*/
|
||||
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);
|
||||
acpi_ns_delete_namespace_by_owner(walk_state->method_desc->
|
||||
method.owner_id);
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE (status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,41 +41,32 @@
|
|||
* 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")
|
||||
|
||||
/* 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,
|
||||
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,16 +88,12 @@ 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");
|
||||
|
||||
|
||||
/* Init the method arguments */
|
||||
|
||||
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
|
||||
|
@ -126,7 +113,8 @@ acpi_ds_method_data_init (
|
|||
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].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;
|
||||
|
@ -135,7 +123,6 @@ acpi_ds_method_data_init (
|
|||
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");
|
||||
|
||||
|
||||
/* 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));
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +163,8 @@ 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));
|
||||
index,
|
||||
walk_state->arguments[index].object));
|
||||
|
||||
/* Detach object (if present) and remove a reference */
|
||||
|
||||
|
@ -188,7 +175,6 @@ acpi_ds_method_data_delete_all (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_method_data_init_args
|
||||
|
@ -206,35 +192,33 @@ acpi_ds_method_data_delete_all (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_method_data_init_args (
|
||||
union acpi_operand_object **params,
|
||||
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);
|
||||
|
||||
|
||||
if (!params) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
|
||||
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);
|
||||
params[index],
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -246,7 +230,6 @@ acpi_ds_method_data_init_args (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_method_data_get_node
|
||||
|
@ -263,15 +246,13 @@ acpi_ds_method_data_init_args (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_method_data_get_node (
|
||||
u16 opcode,
|
||||
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");
|
||||
|
||||
|
||||
/*
|
||||
* Method Locals and Arguments are supported
|
||||
*/
|
||||
|
@ -305,14 +286,14 @@ acpi_ds_method_data_get_node (
|
|||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", 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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_method_data_set_value
|
||||
|
@ -330,8 +311,7 @@ acpi_ds_method_data_get_node (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_method_data_set_value (
|
||||
u16 opcode,
|
||||
acpi_ds_method_data_set_value(u16 opcode,
|
||||
u32 index,
|
||||
union acpi_operand_object *object,
|
||||
struct acpi_walk_state *walk_state)
|
||||
|
@ -339,10 +319,8 @@ acpi_ds_method_data_set_value (
|
|||
acpi_status status;
|
||||
struct acpi_namespace_node *node;
|
||||
|
||||
|
||||
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,
|
||||
|
@ -369,7 +347,6 @@ acpi_ds_method_data_set_value (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_method_data_get_value
|
||||
|
@ -387,8 +364,7 @@ acpi_ds_method_data_set_value (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_method_data_get_value (
|
||||
u16 opcode,
|
||||
acpi_ds_method_data_get_value(u16 opcode,
|
||||
u32 index,
|
||||
struct acpi_walk_state *walk_state,
|
||||
union acpi_operand_object **dest_desc)
|
||||
|
@ -397,14 +373,13 @@ acpi_ds_method_data_get_value (
|
|||
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"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Null object descriptor pointer\n"));
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -433,7 +408,8 @@ 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);
|
||||
}
|
||||
|
@ -444,7 +420,8 @@ acpi_ds_method_data_get_value (
|
|||
|
||||
/* Otherwise, return the error */
|
||||
|
||||
else switch (opcode) {
|
||||
else
|
||||
switch (opcode) {
|
||||
case AML_ARG_OP:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
|
@ -462,7 +439,8 @@ acpi_ds_method_data_get_value (
|
|||
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
|
||||
|
||||
default:
|
||||
ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
|
||||
ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
|
||||
opcode));
|
||||
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
@ -477,7 +455,6 @@ acpi_ds_method_data_get_value (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_method_data_delete_value
|
||||
|
@ -494,19 +471,15 @@ 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");
|
||||
|
||||
|
||||
/* Get the namespace node for the arg/local */
|
||||
|
||||
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||
|
@ -538,7 +511,6 @@ acpi_ds_method_data_delete_value (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_store_object_to_local
|
||||
|
@ -557,8 +529,7 @@ acpi_ds_method_data_delete_value (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_store_object_to_local (
|
||||
u16 opcode,
|
||||
acpi_ds_store_object_to_local(u16 opcode,
|
||||
u32 index,
|
||||
union acpi_operand_object *obj_desc,
|
||||
struct acpi_walk_state *walk_state)
|
||||
|
@ -568,7 +539,6 @@ acpi_ds_store_object_to_local (
|
|||
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));
|
||||
|
@ -602,7 +572,9 @@ 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);
|
||||
status =
|
||||
acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -632,35 +604,32 @@ 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)) {
|
||||
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));
|
||||
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,
|
||||
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 */
|
||||
|
@ -684,7 +653,9 @@ 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 */
|
||||
|
||||
|
@ -695,7 +666,6 @@ acpi_ds_store_object_to_local (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -712,19 +682,15 @@ 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");
|
||||
|
||||
|
||||
/* Get the namespace node for the arg/local */
|
||||
|
||||
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||
|
@ -746,5 +712,3 @@ acpi_ds_method_data_get_type (
|
|||
return_VALUE(ACPI_GET_OBJECT_TYPE(object));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -53,12 +52,10 @@
|
|||
ACPI_MODULE_NAME("dsobject")
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_build_internal_object (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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,18 +73,15 @@ acpi_ds_build_internal_object (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_build_internal_object (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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");
|
||||
|
||||
|
||||
*obj_desc_ptr = NULL;
|
||||
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
||||
/*
|
||||
|
@ -98,13 +92,16 @@ acpi_ds_build_internal_object (
|
|||
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));
|
||||
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);
|
||||
ACPI_REPORT_NSERROR(op->common.value.string,
|
||||
status);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
|
@ -112,13 +109,15 @@ acpi_ds_build_internal_object (
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
|
||||
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);
|
||||
|
@ -129,7 +128,6 @@ acpi_ds_build_internal_object (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_build_internal_buffer_obj
|
||||
|
@ -147,8 +145,7 @@ acpi_ds_build_internal_object (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_build_internal_buffer_obj (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
|
@ -158,18 +155,15 @@ acpi_ds_build_internal_buffer_obj (
|
|||
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) {
|
||||
/*
|
||||
* 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);
|
||||
|
@ -191,7 +185,8 @@ acpi_ds_build_internal_buffer_obj (
|
|||
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));
|
||||
byte_list->common.aml_opcode,
|
||||
byte_list));
|
||||
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
return (AE_TYPE);
|
||||
|
@ -216,10 +211,9 @@ acpi_ds_build_internal_buffer_obj (
|
|||
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);
|
||||
} 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);
|
||||
|
@ -228,8 +222,8 @@ acpi_ds_build_internal_buffer_obj (
|
|||
/* 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,7 +232,6 @@ acpi_ds_build_internal_buffer_obj (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_build_internal_package_obj
|
||||
|
@ -256,8 +249,7 @@ acpi_ds_build_internal_buffer_obj (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_build_internal_package_obj (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
|
@ -269,10 +261,8 @@ acpi_ds_build_internal_package_obj (
|
|||
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;
|
||||
|
@ -287,8 +277,7 @@ 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 {
|
||||
} else {
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
|
||||
*obj_desc_ptr = obj_desc;
|
||||
if (!obj_desc) {
|
||||
|
@ -323,8 +312,9 @@ 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);
|
||||
|
@ -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 {
|
||||
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]);
|
||||
&obj_desc->
|
||||
package.
|
||||
elements[i]);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
@ -358,7 +350,6 @@ acpi_ds_build_internal_package_obj (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_node
|
||||
|
@ -374,18 +365,15 @@ acpi_ds_build_internal_package_obj (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_node (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* Because of the execution pass through the non-control-method
|
||||
* parts of the table, we can arrive here twice. Only init
|
||||
|
@ -425,7 +413,6 @@ acpi_ds_create_node (
|
|||
|
||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_init_object_from_op
|
||||
|
@ -444,8 +431,7 @@ acpi_ds_create_node (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_init_object_from_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
|
@ -454,10 +440,8 @@ acpi_ds_init_object_from_op (
|
|||
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);
|
||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||
|
@ -480,7 +464,6 @@ acpi_ds_init_object_from_op (
|
|||
obj_desc->buffer.aml_length = op->named.length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
/*
|
||||
|
@ -492,7 +475,6 @@ acpi_ds_init_object_from_op (
|
|||
obj_desc->package.aml_length = op->named.length;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
switch (op_info->type) {
|
||||
|
@ -537,32 +519,35 @@ acpi_ds_init_object_from_op (
|
|||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unknown constant opcode %X\n", opcode));
|
||||
"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",
|
||||
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) {
|
||||
|
@ -588,13 +571,16 @@ acpi_ds_init_object_from_op (
|
|||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
|
||||
obj_desc->reference.offset,
|
||||
obj_desc->
|
||||
reference.offset,
|
||||
walk_state,
|
||||
(struct acpi_namespace_node **) &obj_desc->reference.object);
|
||||
(struct
|
||||
acpi_namespace_node
|
||||
**)&obj_desc->
|
||||
reference.object);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_METHOD_ARGUMENT:
|
||||
|
||||
/* Split the opcode into a base opcode + offset */
|
||||
|
@ -604,9 +590,13 @@ acpi_ds_init_object_from_op (
|
|||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
status = acpi_ds_method_data_get_node(AML_ARG_OP,
|
||||
obj_desc->reference.offset,
|
||||
obj_desc->
|
||||
reference.offset,
|
||||
walk_state,
|
||||
(struct acpi_namespace_node **) &obj_desc->reference.object);
|
||||
(struct
|
||||
acpi_namespace_node
|
||||
**)&obj_desc->
|
||||
reference.object);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -623,10 +613,10 @@ acpi_ds_init_object_from_op (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unimplemented data type: %X\n",
|
||||
ACPI_GET_OBJECT_TYPE(obj_desc)));
|
||||
|
||||
status = AE_AML_OPERAND_TYPE;
|
||||
|
@ -635,5 +625,3 @@ acpi_ds_init_object_from_op (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -55,24 +54,19 @@
|
|||
ACPI_MODULE_NAME("dsopcode")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_execute_arguments (
|
||||
struct acpi_namespace_node *node,
|
||||
acpi_ds_execute_arguments(struct acpi_namespace_node *node,
|
||||
struct acpi_namespace_node *scope_node,
|
||||
u32 aml_length,
|
||||
u8 *aml_start);
|
||||
u32 aml_length, u8 * aml_start);
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_init_buffer_field (
|
||||
u16 aml_opcode,
|
||||
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);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_execute_arguments
|
||||
|
@ -89,20 +83,16 @@ acpi_ds_init_buffer_field (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_execute_arguments (
|
||||
struct acpi_namespace_node *node,
|
||||
acpi_ds_execute_arguments(struct acpi_namespace_node *node,
|
||||
struct acpi_namespace_node *scope_node,
|
||||
u32 aml_length,
|
||||
u8 *aml_start)
|
||||
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");
|
||||
|
||||
|
||||
/*
|
||||
* Allocate a new parser op to be the root of the parsed tree
|
||||
*/
|
||||
|
@ -119,14 +109,15 @@ acpi_ds_execute_arguments (
|
|||
|
||||
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);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Mark this parse as a deferred opcode */
|
||||
|
@ -138,8 +129,7 @@ acpi_ds_execute_arguments (
|
|||
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ps_delete_parse_tree (op);
|
||||
return_ACPI_STATUS (status);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Get and init the Op created above */
|
||||
|
@ -160,7 +150,8 @@ acpi_ds_execute_arguments (
|
|||
|
||||
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 */
|
||||
|
@ -169,18 +160,19 @@ acpi_ds_execute_arguments (
|
|||
aml_length, NULL, 3);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ds_delete_walk_state(walk_state);
|
||||
return_ACPI_STATUS (status);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Mark this execution as a deferred opcode */
|
||||
|
||||
walk_state->deferred_node = node;
|
||||
status = acpi_ps_parse_aml(walk_state);
|
||||
|
||||
cleanup:
|
||||
acpi_ps_delete_parse_tree(op);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_buffer_field_arguments
|
||||
|
@ -195,17 +187,14 @@ 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);
|
||||
|
||||
|
||||
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -215,18 +204,19 @@ acpi_ds_get_buffer_field_arguments (
|
|||
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_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);
|
||||
extra_desc->extra.aml_length,
|
||||
extra_desc->extra.aml_start);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_buffer_arguments
|
||||
|
@ -240,17 +230,13 @@ 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);
|
||||
|
||||
|
||||
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -259,8 +245,7 @@ acpi_ds_get_buffer_arguments (
|
|||
|
||||
node = obj_desc->buffer.node;
|
||||
if (!node) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"No pointer back to NS node in buffer obj %p\n", obj_desc));
|
||||
ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc));
|
||||
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
|
@ -269,11 +254,11 @@ acpi_ds_get_buffer_arguments (
|
|||
/* 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);
|
||||
obj_desc->buffer.aml_length,
|
||||
obj_desc->buffer.aml_start);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_package_arguments
|
||||
|
@ -287,17 +272,13 @@ 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);
|
||||
|
||||
|
||||
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -306,8 +287,8 @@ acpi_ds_get_package_arguments (
|
|||
|
||||
node = obj_desc->package.node;
|
||||
if (!node) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"No pointer back to NS node in package %p\n", obj_desc));
|
||||
ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n",
|
||||
obj_desc));
|
||||
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||
}
|
||||
|
||||
|
@ -316,11 +297,11 @@ acpi_ds_get_package_arguments (
|
|||
/* 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);
|
||||
obj_desc->package.aml_length,
|
||||
obj_desc->package.aml_start);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_region_arguments
|
||||
|
@ -334,18 +315,14 @@ 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);
|
||||
|
||||
|
||||
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -359,19 +336,22 @@ acpi_ds_get_region_arguments (
|
|||
|
||||
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);
|
||||
extra_desc->extra.aml_length,
|
||||
extra_desc->extra.aml_start);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_initialize_region
|
||||
|
@ -384,14 +364,11 @@ 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;
|
||||
|
||||
|
||||
obj_desc = acpi_ns_get_attached_object(obj_handle);
|
||||
|
||||
/* Namespace is NOT locked */
|
||||
|
@ -400,7 +377,6 @@ acpi_ds_initialize_region (
|
|||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_init_buffer_field
|
||||
|
@ -419,8 +395,7 @@ acpi_ds_initialize_region (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ds_init_buffer_field (
|
||||
u16 aml_opcode,
|
||||
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,
|
||||
|
@ -433,10 +408,8 @@ acpi_ds_init_buffer_field (
|
|||
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) {
|
||||
|
@ -543,13 +516,13 @@ acpi_ds_init_buffer_field (
|
|||
|
||||
/* Entire field must fit within the current length of the buffer */
|
||||
|
||||
if ((bit_offset + bit_count) >
|
||||
(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),
|
||||
acpi_ut_get_node_name(buffer_desc->buffer.
|
||||
node),
|
||||
8 * (u32) buffer_desc->buffer.length));
|
||||
status = AE_AML_BUFFER_LIMIT;
|
||||
goto cleanup;
|
||||
|
@ -571,8 +544,8 @@ 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:
|
||||
|
||||
|
@ -589,8 +562,7 @@ cleanup:
|
|||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_remove_reference(result_desc); /* Result descriptor */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Now the address and length are valid for this buffer_field */
|
||||
|
||||
obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
|
||||
|
@ -599,7 +571,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_eval_buffer_field_operands
|
||||
|
@ -615,8 +586,7 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_eval_buffer_field_operands (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
|
||||
union acpi_parse_object *op)
|
||||
{
|
||||
acpi_status status;
|
||||
|
@ -624,10 +594,8 @@ acpi_ds_eval_buffer_field_operands (
|
|||
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
|
||||
|
@ -657,11 +625,13 @@ acpi_ds_eval_buffer_field_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");
|
||||
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));
|
||||
acpi_ps_get_opcode_name(op->common.
|
||||
aml_opcode), status));
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_eval_region_operands
|
||||
|
@ -702,8 +675,7 @@ acpi_ds_eval_buffer_field_operands (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_eval_region_operands (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
|
||||
union acpi_parse_object *op)
|
||||
{
|
||||
acpi_status status;
|
||||
|
@ -712,10 +684,8 @@ acpi_ds_eval_region_operands (
|
|||
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
|
||||
|
@ -785,7 +755,6 @@ acpi_ds_eval_region_operands (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_eval_data_object_operands
|
||||
|
@ -802,8 +771,7 @@ acpi_ds_eval_region_operands (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_eval_data_object_operands (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
|
||||
union acpi_parse_object *op,
|
||||
union acpi_operand_object *obj_desc)
|
||||
{
|
||||
|
@ -811,10 +779,8 @@ acpi_ds_eval_data_object_operands (
|
|||
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);
|
||||
|
@ -823,8 +789,9 @@ acpi_ds_eval_data_object_operands (
|
|||
}
|
||||
|
||||
status = acpi_ex_resolve_operands(walk_state->opcode,
|
||||
&(walk_state->operands [walk_state->num_operands -1]),
|
||||
walk_state);
|
||||
&(walk_state->
|
||||
operands[walk_state->num_operands -
|
||||
1]), walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -849,13 +816,17 @@ 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:
|
||||
|
@ -870,8 +841,10 @@ acpi_ds_eval_data_object_operands (
|
|||
*/
|
||||
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_VAR_PACKAGE_OP)
|
||||
&& (op->common.parent->common.aml_opcode !=
|
||||
AML_NAME_OP))) {
|
||||
walk_state->result_obj = obj_desc;
|
||||
}
|
||||
}
|
||||
|
@ -879,7 +852,6 @@ acpi_ds_eval_data_object_operands (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_exec_begin_control_op
|
||||
|
@ -895,17 +867,14 @@ acpi_ds_eval_data_object_operands (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_exec_begin_control_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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_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));
|
||||
|
||||
|
@ -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,17 +945,14 @@ acpi_ds_exec_begin_control_op (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_exec_end_control_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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");
|
||||
|
||||
|
||||
switch (op->common.aml_opcode) {
|
||||
case AML_IF_OP:
|
||||
|
||||
|
@ -1002,16 +969,15 @@ acpi_ds_exec_end_control_op (
|
|||
* 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);
|
||||
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));
|
||||
|
@ -1027,17 +993,19 @@ acpi_ds_exec_end_control_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;
|
||||
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));
|
||||
"[RETURN_OP] Op=%p Arg=%p\n", op,
|
||||
op->common.value.arg));
|
||||
|
||||
/*
|
||||
* One optional operand -- the return value
|
||||
|
@ -1051,7 +1019,9 @@ acpi_ds_exec_end_control_op (
|
|||
|
||||
/* Return statement has an immediate operand */
|
||||
|
||||
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
|
||||
status =
|
||||
acpi_ds_create_operands(walk_state,
|
||||
op->common.value.arg);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
@ -1061,7 +1031,9 @@ 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);
|
||||
status =
|
||||
acpi_ex_resolve_to_value(&walk_state->operands[0],
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (status);
|
||||
}
|
||||
|
@ -1072,8 +1044,7 @@ 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) &&
|
||||
} else if ((walk_state->results) &&
|
||||
(walk_state->results->results.num_results > 0)) {
|
||||
/* Since we have a real Return(), delete any implicit return */
|
||||
|
||||
|
@ -1088,22 +1059,33 @@ 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_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;
|
||||
|
@ -1111,7 +1093,6 @@ acpi_ds_exec_end_control_op (
|
|||
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));
|
||||
|
@ -1121,33 +1102,34 @@ acpi_ds_exec_end_control_op (
|
|||
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 */
|
||||
|
||||
|
||||
/* 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);
|
||||
(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);
|
||||
}
|
||||
|
||||
|
@ -1159,22 +1141,22 @@ 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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unknown control opcode=%X Op=%p\n",
|
||||
op->common.aml_opcode, op));
|
||||
|
||||
status = AE_AML_BAD_OPCODE;
|
||||
|
@ -1183,4 +1165,3 @@ acpi_ds_exec_end_control_op (
|
|||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -53,7 +52,6 @@
|
|||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME("dsutils")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_clear_implicit_return
|
||||
|
@ -68,14 +66,10 @@
|
|||
* 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");
|
||||
|
||||
|
||||
/*
|
||||
* Slack must be enabled for this feature
|
||||
*/
|
||||
|
@ -98,7 +92,6 @@ acpi_ds_clear_implicit_return (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#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");
|
||||
|
||||
|
||||
/*
|
||||
* 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));
|
||||
return_desc, walk_state->implicit_return_obj));
|
||||
|
||||
/*
|
||||
* Delete any "stale" implicit return value first. However, in
|
||||
|
@ -164,7 +152,6 @@ acpi_ds_do_implicit_return (
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_is_result_used
|
||||
|
@ -179,15 +166,13 @@ acpi_ds_do_implicit_return (
|
|||
******************************************************************************/
|
||||
|
||||
u8
|
||||
acpi_ds_is_result_used (
|
||||
union acpi_parse_object *op,
|
||||
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);
|
||||
|
||||
|
||||
/* Must have both an Op and a Result Object */
|
||||
|
||||
if (!op) {
|
||||
|
@ -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
|
||||
|
@ -220,13 +206,15 @@ acpi_ds_is_result_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)));
|
||||
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));
|
||||
|
@ -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)) {
|
||||
(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));
|
||||
acpi_ps_get_opcode_name(op->common.parent->common.
|
||||
aml_opcode), op));
|
||||
|
||||
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));
|
||||
acpi_ps_get_opcode_name(op->common.parent->common.
|
||||
aml_opcode), op));
|
||||
|
||||
return_VALUE(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_delete_result_if_not_used
|
||||
|
@ -346,18 +334,15 @@ result_not_used:
|
|||
******************************************************************************/
|
||||
|
||||
void
|
||||
acpi_ds_delete_result_if_not_used (
|
||||
union acpi_parse_object *op,
|
||||
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);
|
||||
|
||||
|
||||
if (!op) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
|
||||
return_VOID;
|
||||
|
@ -379,7 +364,6 @@ acpi_ds_delete_result_if_not_used (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_resolve_operands
|
||||
|
@ -394,24 +378,22 @@ 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);
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to resolve each of the valid operands
|
||||
* Method arguments are passed by reference, not by value. This means
|
||||
* 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);
|
||||
status =
|
||||
acpi_ex_resolve_to_value(&walk_state->operands[i],
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
}
|
||||
|
@ -420,7 +402,6 @@ acpi_ds_resolve_operands (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_clear_operands
|
||||
|
@ -433,16 +414,12 @@ 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);
|
||||
|
||||
|
||||
/* Remove a reference on each operand on the stack */
|
||||
|
||||
for (i = 0; i < walk_state->num_operands; i++) {
|
||||
|
@ -459,7 +436,6 @@ acpi_ds_clear_operands (
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_operand
|
||||
|
@ -478,10 +454,8 @@ 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;
|
||||
|
@ -492,19 +466,20 @@ acpi_ds_create_operand (
|
|||
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));
|
||||
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,
|
||||
status =
|
||||
acpi_ex_get_name_string(ACPI_TYPE_ANY,
|
||||
arg->common.value.buffer,
|
||||
&name_string, &name_length);
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
@ -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,
|
||||
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));
|
||||
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
|
||||
|
@ -603,9 +587,9 @@ acpi_ds_create_operand (
|
|||
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) {
|
||||
|
@ -619,8 +603,7 @@ acpi_ds_create_operand (
|
|||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"Null namepath: Arg=%p\n", arg));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
opcode = arg->common.aml_opcode;
|
||||
}
|
||||
|
||||
|
@ -635,14 +618,18 @@ acpi_ds_create_operand (
|
|||
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);
|
||||
status =
|
||||
acpi_ds_result_pop_from_bottom(&obj_desc,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
/*
|
||||
* Only error is underflow, and this indicates
|
||||
|
@ -650,22 +637,25 @@ acpi_ds_create_operand (
|
|||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Missing or null operand, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
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);
|
||||
}
|
||||
|
||||
/* Initialize the new object */
|
||||
|
||||
status = acpi_ds_init_object_from_op (
|
||||
walk_state, arg, opcode, &obj_desc);
|
||||
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);
|
||||
|
@ -679,13 +669,13 @@ acpi_ds_create_operand (
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_operands
|
||||
|
@ -702,18 +692,15 @@ acpi_ds_create_operand (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_create_operands (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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);
|
||||
|
||||
|
||||
/* For all arguments in the list... */
|
||||
|
||||
arg = first_arg;
|
||||
|
@ -723,8 +710,9 @@ acpi_ds_create_operands (
|
|||
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 */
|
||||
|
||||
|
@ -734,7 +722,6 @@ acpi_ds_create_operands (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
|
||||
cleanup:
|
||||
/*
|
||||
* We must undo everything done above; meaning that we must
|
||||
|
@ -747,5 +734,3 @@ cleanup:
|
|||
(arg_count + 1), acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -52,7 +51,6 @@
|
|||
#include <acpi/acdebug.h>
|
||||
#include <acpi/acdisasm.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME("dswexec")
|
||||
|
||||
|
@ -71,8 +69,8 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
|
|||
acpi_ex_opcode_2A_2T_1R,
|
||||
acpi_ex_opcode_3A_0T_0R,
|
||||
acpi_ex_opcode_3A_1T_1R,
|
||||
acpi_ex_opcode_6A_0T_1R};
|
||||
|
||||
acpi_ex_opcode_6A_0T_1R
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
@ -88,17 +86,15 @@ 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_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) {
|
||||
|
@ -110,14 +106,15 @@ acpi_ds_get_predicate_value (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} 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);
|
||||
status =
|
||||
acpi_ex_resolve_to_value(&walk_state->operands[0],
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -145,7 +142,8 @@ acpi_ds_get_predicate_value (
|
|||
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)));
|
||||
obj_desc, walk_state,
|
||||
ACPI_GET_OBJECT_TYPE(obj_desc)));
|
||||
|
||||
status = AE_AML_OPERAND_TYPE;
|
||||
goto cleanup;
|
||||
|
@ -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,15 +168,16 @@ acpi_ds_get_predicate_value (
|
|||
status = AE_CTRL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
|
||||
walk_state->control_state->common.value, walk_state->op));
|
||||
walk_state->control_state->common.value,
|
||||
walk_state->op));
|
||||
|
||||
/* 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
|
||||
|
@ -194,7 +192,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_exec_begin_op
|
||||
|
@ -211,18 +208,15 @@ cleanup:
|
|||
****************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_exec_begin_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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);
|
||||
|
||||
|
||||
op = walk_state->op;
|
||||
if (!op) {
|
||||
status = acpi_ds_load2_begin_op(walk_state, out_op);
|
||||
|
@ -233,12 +227,16 @@ acpi_ds_exec_begin_op (
|
|||
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);
|
||||
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));
|
||||
acpi_ut_get_type_name(walk_state->
|
||||
op_info->
|
||||
object_type),
|
||||
op));
|
||||
|
||||
status = acpi_ds_scope_stack_pop(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
@ -263,17 +261,18 @@ acpi_ds_exec_begin_op (
|
|||
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));
|
||||
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 */
|
||||
|
@ -296,7 +295,6 @@ acpi_ds_exec_begin_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) {
|
||||
|
@ -314,7 +312,6 @@ acpi_ds_exec_begin_op (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_CLASS_EXECUTE:
|
||||
case AML_CLASS_CREATE:
|
||||
|
||||
|
@ -325,7 +322,6 @@ acpi_ds_exec_begin_op (
|
|||
status = acpi_ds_result_stack_push(walk_state);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -335,7 +331,6 @@ acpi_ds_exec_begin_op (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_exec_end_op
|
||||
|
@ -350,9 +345,7 @@ 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;
|
||||
|
@ -361,16 +354,15 @@ acpi_ds_exec_end_op (
|
|||
union acpi_parse_object *next_op;
|
||||
union acpi_parse_object *first_arg;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
|
||||
|
||||
|
||||
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));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
|
||||
op->common.aml_opcode));
|
||||
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
@ -384,8 +376,11 @@ 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 */
|
||||
|
||||
|
@ -393,7 +388,6 @@ acpi_ds_exec_end_op (
|
|||
case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
|
||||
break;
|
||||
|
||||
|
||||
case AML_CLASS_EXECUTE: /* most operators with arguments */
|
||||
|
||||
/* Build resolved operand stack */
|
||||
|
@ -418,12 +412,18 @@ acpi_ds_exec_end_op (
|
|||
/* Resolve all operands */
|
||||
|
||||
status = acpi_ex_resolve_operands(walk_state->opcode,
|
||||
&(walk_state->operands [walk_state->num_operands -1]),
|
||||
&(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");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,28 +433,31 @@ acpi_ds_exec_end_op (
|
|||
* 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[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 {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"[%s]: Could not resolve operands, %s\n",
|
||||
acpi_ps_get_opcode_name (walk_state->opcode),
|
||||
acpi_format_exception (status)));
|
||||
acpi_ps_get_opcode_name
|
||||
(walk_state->opcode),
|
||||
acpi_format_exception
|
||||
(status)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,14 +469,14 @@ acpi_ds_exec_end_op (
|
|||
* 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) {
|
||||
|
@ -487,8 +490,7 @@ acpi_ds_exec_end_op (
|
|||
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status = acpi_ds_result_stack_pop(walk_state);
|
||||
}
|
||||
else if (status == AE_CTRL_PENDING) {
|
||||
} else if (status == AE_CTRL_PENDING) {
|
||||
status = acpi_ds_result_stack_pop(walk_state);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status = AE_CTRL_PENDING;
|
||||
|
@ -496,7 +498,6 @@ acpi_ds_exec_end_op (
|
|||
}
|
||||
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))) {
|
||||
((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);
|
||||
"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
|
||||
|
@ -561,25 +568,26 @@ acpi_ds_exec_end_op (
|
|||
*/
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
|
||||
case AML_TYPE_CREATE_FIELD:
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Executing create_field Buffer/Index Op=%p\n", op));
|
||||
"Executing create_field Buffer/Index Op=%p\n",
|
||||
op));
|
||||
|
||||
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));
|
||||
"Executing create_object (Buffer/Package) Op=%p\n",
|
||||
op));
|
||||
|
||||
switch (op->common.parent->common.aml_opcode) {
|
||||
case AML_NAME_OP:
|
||||
|
@ -588,11 +596,13 @@ 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->
|
||||
common.node,
|
||||
op->common.parent);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
|
@ -603,13 +613,19 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -625,11 +641,12 @@ 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:
|
||||
|
@ -642,9 +659,12 @@ acpi_ds_exec_end_op (
|
|||
|
||||
if (op->common.aml_opcode == AML_REGION_OP) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Executing op_region Address/Length Op=%p\n", op));
|
||||
"Executing op_region Address/Length Op=%p\n",
|
||||
op));
|
||||
|
||||
status = acpi_ds_eval_region_operands (walk_state, op);
|
||||
status =
|
||||
acpi_ds_eval_region_operands(walk_state,
|
||||
op);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
}
|
||||
|
@ -654,14 +674,12 @@ acpi_ds_exec_end_op (
|
|||
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_UNDEFINED:
|
||||
|
||||
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,
|
||||
|
@ -669,12 +687,12 @@ acpi_ds_exec_end_op (
|
|||
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));
|
||||
op_class, op_type,
|
||||
op->common.aml_opcode, op));
|
||||
|
||||
status = AE_NOT_IMPLEMENTED;
|
||||
break;
|
||||
|
@ -697,39 +715,42 @@ acpi_ds_exec_end_op (
|
|||
(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);
|
||||
status =
|
||||
acpi_ds_get_predicate_value(walk_state,
|
||||
walk_state->result_obj);
|
||||
walk_state->result_obj = NULL;
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Invoke exception handler on error */
|
||||
|
||||
if (ACPI_FAILURE(status) &&
|
||||
acpi_gbl_exception_handler &&
|
||||
!(status & AE_CODE_CONTROL)) {
|
||||
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);
|
||||
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) {
|
||||
|
@ -752,5 +773,3 @@ cleanup:
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -50,14 +49,13 @@
|
|||
#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")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_init_callbacks
|
||||
|
@ -70,11 +68,8 @@
|
|||
* 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) {
|
||||
|
@ -108,7 +103,6 @@ acpi_ds_init_callbacks (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_load1_begin_op
|
||||
|
@ -123,8 +117,7 @@ acpi_ds_init_callbacks (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_load1_begin_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
|
||||
union acpi_parse_object ** out_op)
|
||||
{
|
||||
union acpi_parse_object *op;
|
||||
|
@ -134,26 +127,16 @@ acpi_ds_load1_begin_op (
|
|||
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);
|
||||
}
|
||||
|
@ -173,7 +156,8 @@ acpi_ds_load1_begin_op (
|
|||
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)));
|
||||
"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,9 +167,11 @@ 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:
|
||||
|
@ -193,9 +179,11 @@ acpi_ds_load1_begin_op (
|
|||
* 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));
|
||||
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)) {
|
||||
|
@ -234,7 +222,8 @@ acpi_ds_load1_begin_op (
|
|||
|
||||
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)));
|
||||
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:
|
||||
|
||||
/*
|
||||
|
@ -283,10 +269,10 @@ acpi_ds_load1_begin_op (
|
|||
if ((walk_state->opcode != AML_SCOPE_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_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"[%s] Cannot already exist\n",
|
||||
acpi_ut_get_type_name(object_type)));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||
"[%s] Both Find or Create allowed\n",
|
||||
acpi_ut_get_type_name(object_type)));
|
||||
|
@ -298,8 +284,10 @@ 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));
|
||||
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);
|
||||
|
@ -307,7 +295,6 @@ acpi_ds_load1_begin_op (
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Common exit */
|
||||
|
||||
if (!op) {
|
||||
|
@ -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");
|
||||
|
||||
|
||||
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 */
|
||||
|
||||
|
@ -388,12 +371,11 @@ acpi_ds_load1_end_op (
|
|||
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);
|
||||
((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;
|
||||
}
|
||||
}
|
||||
|
@ -427,10 +412,13 @@ acpi_ds_load1_end_op (
|
|||
walk_state->operands[0] = (void *)op->named.node;
|
||||
walk_state->num_operands = 1;
|
||||
|
||||
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
|
||||
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);
|
||||
op->named.length,
|
||||
walk_state);
|
||||
}
|
||||
walk_state->operands[0] = NULL;
|
||||
walk_state->num_operands = 0;
|
||||
|
@ -444,7 +432,8 @@ 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_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);
|
||||
|
@ -453,7 +442,6 @@ acpi_ds_load1_end_op (
|
|||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_load2_begin_op
|
||||
|
@ -468,8 +456,7 @@ acpi_ds_load1_end_op (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_load2_begin_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
|
||||
union acpi_parse_object ** out_op)
|
||||
{
|
||||
union acpi_parse_object *op;
|
||||
|
@ -478,19 +465,43 @@ acpi_ds_load2_begin_op (
|
|||
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))) {
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -505,17 +516,16 @@ acpi_ds_load2_begin_op (
|
|||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Get name from the op */
|
||||
|
||||
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 */
|
||||
|
@ -523,8 +533,8 @@ acpi_ds_load2_begin_op (
|
|||
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));
|
||||
|
||||
"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,15 +565,15 @@ 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));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
#ifdef _ACPI_ASL_COMPILER
|
||||
#ifdef ACPI_ASL_COMPILER
|
||||
if (status == AE_NOT_FOUND) {
|
||||
status = AE_OK;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_REPORT_NSERROR(buffer_ptr, status);
|
||||
}
|
||||
#else
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -626,7 +633,9 @@ 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);
|
||||
status =
|
||||
acpi_ds_scope_stack_push(node, object_type,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -651,9 +660,12 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -662,7 +674,6 @@ acpi_ds_load2_begin_op (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
if (!op) {
|
||||
/* Create a new op */
|
||||
|
||||
|
@ -676,10 +687,8 @@ acpi_ds_load2_begin_op (
|
|||
if (node) {
|
||||
op->named.name = node->name.integer;
|
||||
}
|
||||
if (out_op) {
|
||||
*out_op = op;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the Node in the "op" object that the parser uses, so we
|
||||
|
@ -690,7 +699,6 @@ acpi_ds_load2_begin_op (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_load2_end_op
|
||||
|
@ -704,9 +712,7 @@ 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;
|
||||
|
@ -718,25 +724,42 @@ acpi_ds_load2_end_op (
|
|||
u32 i;
|
||||
#endif
|
||||
|
||||
|
||||
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));
|
||||
|
||||
/* Only interested in opcodes that have namespace objects */
|
||||
/* Check if opcode had an associated namespace object */
|
||||
|
||||
if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
|
||||
#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));
|
||||
"Ending scope Op=%p State=%p\n", op,
|
||||
walk_state));
|
||||
}
|
||||
|
||||
|
||||
object_type = walk_state->op_info->object_type;
|
||||
|
||||
/*
|
||||
|
@ -756,7 +779,8 @@ acpi_ds_load2_end_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_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);
|
||||
|
@ -795,7 +819,8 @@ acpi_ds_load2_end_op (
|
|||
|
||||
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_ps_get_opcode_name(op->common.aml_opcode),
|
||||
walk_state, op, node));
|
||||
|
||||
/* Decode the opcode */
|
||||
|
||||
|
@ -813,24 +838,29 @@ acpi_ds_load2_end_op (
|
|||
status = acpi_ds_create_buffer_field(op, walk_state);
|
||||
break;
|
||||
|
||||
|
||||
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,7 +869,6 @@ acpi_ds_load2_end_op (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_NAMED_SIMPLE:
|
||||
|
||||
status = acpi_ds_create_operands(walk_state, arg);
|
||||
|
@ -909,8 +938,9 @@ 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);
|
||||
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
|
||||
|
@ -923,14 +953,12 @@ acpi_ds_load2_end_op (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_NAME_OP:
|
||||
|
||||
status = acpi_ds_create_node(walk_state, node, op);
|
||||
break;
|
||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||
|
||||
|
||||
default:
|
||||
/* All NAMED_COMPLEX opcodes must be handled above */
|
||||
/* Note: Method objects were already created in Pass 1 */
|
||||
|
@ -938,13 +966,11 @@ 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,
|
||||
|
@ -954,11 +980,15 @@ acpi_ds_load2_end_op (
|
|||
/*
|
||||
* 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));
|
||||
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,13 +1003,11 @@ 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 {
|
||||
} else {
|
||||
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -992,5 +1020,3 @@ cleanup:
|
|||
walk_state->num_operands = 0;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,15 +41,12 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME("dswscope")
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_scope_stack_clear
|
||||
|
@ -62,16 +59,12 @@
|
|||
* 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");
|
||||
|
||||
|
||||
while (walk_state->scope_info) {
|
||||
/* Pop a scope off the stack */
|
||||
|
||||
|
@ -80,12 +73,12 @@ acpi_ds_scope_stack_clear (
|
|||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"Popped object type (%s)\n",
|
||||
acpi_ut_get_type_name (scope_info->common.value)));
|
||||
acpi_ut_get_type_name(scope_info->common.
|
||||
value)));
|
||||
acpi_ut_delete_generic_state(scope_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_scope_stack_push
|
||||
|
@ -102,18 +95,15 @@ acpi_ds_scope_stack_clear (
|
|||
***************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_scope_stack_push (
|
||||
struct acpi_namespace_node *node,
|
||||
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");
|
||||
|
||||
|
||||
if (!node) {
|
||||
/* Invalid scope */
|
||||
|
||||
|
@ -124,8 +114,7 @@ acpi_ds_scope_stack_push (
|
|||
/* Make sure object type is valid */
|
||||
|
||||
if (!acpi_ut_valid_object_type(type)) {
|
||||
ACPI_REPORT_WARNING ((
|
||||
"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
|
||||
ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
|
||||
}
|
||||
|
||||
/* Allocate a new scope object */
|
||||
|
@ -144,18 +133,19 @@ acpi_ds_scope_stack_push (
|
|||
walk_state->scope_depth++;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"[%.2d] Pushed scope ", (u32) walk_state->scope_depth));
|
||||
"[%.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_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,
|
||||
|
@ -169,7 +159,6 @@ acpi_ds_scope_stack_push (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_scope_stack_pop
|
||||
|
@ -182,17 +171,13 @@ 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");
|
||||
|
||||
|
||||
/*
|
||||
* Pop scope info object off the stack.
|
||||
*/
|
||||
|
@ -213,16 +198,14 @@ acpi_ds_scope_stack_pop (
|
|||
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_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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
@ -51,26 +50,18 @@
|
|||
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 (
|
||||
acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
|
||||
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,
|
||||
void *acpi_ds_obj_stack_get_value(u32 index,
|
||||
struct acpi_walk_state *walk_state);
|
||||
#endif
|
||||
|
||||
|
@ -92,20 +83,17 @@ 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");
|
||||
|
||||
|
||||
state = walk_state->results;
|
||||
if (!state) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No result object pushed! State=%p\n",
|
||||
walk_state));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
@ -113,7 +101,8 @@ acpi_ds_result_remove (
|
|||
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));
|
||||
index, walk_state,
|
||||
state->results.num_results));
|
||||
}
|
||||
|
||||
/* Check for a valid result object */
|
||||
|
@ -121,7 +110,8 @@ acpi_ds_result_remove (
|
|||
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));
|
||||
walk_state, state->results.num_results,
|
||||
index));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
|
@ -134,8 +124,10 @@ acpi_ds_result_remove (
|
|||
|
||||
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));
|
||||
*object,
|
||||
(*object) ? acpi_ut_get_object_type_name(*object) :
|
||||
"NULL", index, walk_state,
|
||||
state->results.num_results));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
@ -157,24 +149,22 @@ acpi_ds_result_remove (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_result_pop (
|
||||
union acpi_operand_object **object,
|
||||
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");
|
||||
|
||||
|
||||
state = walk_state->results;
|
||||
if (!state) {
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
if (!state->results.num_results) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Result stack is empty! State=%p\n",
|
||||
walk_state));
|
||||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
@ -193,8 +183,10 @@ acpi_ds_result_pop (
|
|||
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));
|
||||
(*object) ?
|
||||
acpi_ut_get_object_type_name(*object)
|
||||
: "NULL", (u32) index - 1, walk_state,
|
||||
state->results.num_results));
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
@ -205,7 +197,6 @@ acpi_ds_result_pop (
|
|||
return (AE_AML_NO_RETURN_VALUE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_result_pop_from_bottom
|
||||
|
@ -221,27 +212,25 @@ acpi_ds_result_pop (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_result_pop_from_bottom (
|
||||
union acpi_operand_object **object,
|
||||
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");
|
||||
|
||||
|
||||
state = walk_state->results;
|
||||
if (!state) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Warning: No result object pushed! State=%p\n", walk_state));
|
||||
"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);
|
||||
}
|
||||
|
||||
|
@ -252,7 +241,8 @@ acpi_ds_result_pop_from_bottom (
|
|||
/* 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--;
|
||||
|
@ -261,19 +251,20 @@ acpi_ds_result_pop_from_bottom (
|
|||
|
||||
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));
|
||||
"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,16 +279,13 @@ acpi_ds_result_pop_from_bottom (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_result_push (
|
||||
union acpi_operand_object *object,
|
||||
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");
|
||||
|
||||
|
||||
state = walk_state->results;
|
||||
if (!state) {
|
||||
ACPI_REPORT_ERROR(("No result stack frame during push\n"));
|
||||
|
@ -307,14 +295,16 @@ acpi_ds_result_push (
|
|||
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));
|
||||
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));
|
||||
object, walk_state,
|
||||
state->results.num_results));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -322,13 +312,17 @@ acpi_ds_result_push (
|
|||
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));
|
||||
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,15 +335,12 @@ 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");
|
||||
|
||||
|
||||
state = acpi_ut_create_generic_state();
|
||||
if (!state) {
|
||||
return (AE_NO_MEMORY);
|
||||
|
@ -364,7 +355,6 @@ acpi_ds_result_stack_push (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_result_stack_pop
|
||||
|
@ -377,15 +367,12 @@ 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");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (walk_state->results == NULL) {
|
||||
|
@ -405,7 +392,6 @@ acpi_ds_result_stack_pop (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_obj_stack_push
|
||||
|
@ -420,19 +406,17 @@ 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");
|
||||
|
||||
|
||||
/* 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));
|
||||
object, walk_state,
|
||||
walk_state->num_operands));
|
||||
return (AE_STACK_OVERFLOW);
|
||||
}
|
||||
|
||||
|
@ -442,13 +426,15 @@ acpi_ds_obj_stack_push (
|
|||
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));
|
||||
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,22 +450,20 @@ 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");
|
||||
|
||||
|
||||
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));
|
||||
pop_count, walk_state,
|
||||
walk_state->num_operands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
|
||||
|
@ -495,7 +479,6 @@ acpi_ds_obj_stack_pop (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_obj_stack_pop_and_delete
|
||||
|
@ -511,24 +494,22 @@ acpi_ds_obj_stack_pop (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_obj_stack_pop_and_delete (
|
||||
u32 pop_count,
|
||||
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");
|
||||
|
||||
|
||||
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));
|
||||
pop_count, walk_state,
|
||||
walk_state->num_operands));
|
||||
return (AE_STACK_UNDERFLOW);
|
||||
}
|
||||
|
||||
|
@ -537,7 +518,9 @@ acpi_ds_obj_stack_pop_and_delete (
|
|||
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]);
|
||||
acpi_ut_remove_reference(walk_state->
|
||||
operands[walk_state->
|
||||
num_operands]);
|
||||
walk_state->operands[walk_state->num_operands] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -548,7 +531,6 @@ acpi_ds_obj_stack_pop_and_delete (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_get_current_walk_state
|
||||
|
@ -562,14 +544,11 @@ 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");
|
||||
|
||||
|
||||
if (!thread) {
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -580,7 +559,6 @@ acpi_ds_get_current_walk_state (
|
|||
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,
|
||||
acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
|
||||
struct acpi_thread_state *thread)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("ds_push_walk_state");
|
||||
|
||||
|
||||
walk_state->next = thread->walk_state_list;
|
||||
thread->walk_state_list = walk_state;
|
||||
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_pop_walk_state
|
||||
|
@ -623,16 +598,12 @@ 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");
|
||||
|
||||
|
||||
walk_state = thread->walk_state_list;
|
||||
|
||||
if (walk_state) {
|
||||
|
@ -650,7 +621,6 @@ acpi_ds_pop_walk_state (
|
|||
return_PTR(walk_state);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_create_walk_state
|
||||
|
@ -667,21 +637,20 @@ 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;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -704,7 +673,7 @@ acpi_ds_create_walk_state (
|
|||
|
||||
status = acpi_ds_result_stack_push(walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
|
||||
ACPI_MEM_FREE(walk_state);
|
||||
return_PTR(NULL);
|
||||
}
|
||||
|
||||
|
@ -717,7 +686,6 @@ acpi_ds_create_walk_state (
|
|||
return_PTR(walk_state);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_init_aml_walk
|
||||
|
@ -737,23 +705,19 @@ acpi_ds_create_walk_state (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_init_aml_walk (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
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_FUNCTION_TRACE("ds_init_aml_walk");
|
||||
|
||||
|
||||
walk_state->parser_state.aml =
|
||||
walk_state->parser_state.aml_start = aml_start;
|
||||
walk_state->parser_state.aml_end =
|
||||
|
@ -762,13 +726,14 @@ acpi_ds_init_aml_walk (
|
|||
/* 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,
|
||||
walk_state->gpe_event_info =
|
||||
ACPI_CAST_PTR(struct acpi_gpe_event_info,
|
||||
info->parameters);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
walk_state->params = info->parameters;
|
||||
walk_state->caller_return_desc = &info->return_object;
|
||||
}
|
||||
|
@ -783,11 +748,14 @@ acpi_ds_init_aml_walk (
|
|||
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->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);
|
||||
status =
|
||||
acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -795,12 +763,12 @@ acpi_ds_init_aml_walk (
|
|||
/* Init the method arguments */
|
||||
|
||||
status = acpi_ds_method_data_init_args(walk_state->params,
|
||||
ACPI_METHOD_NUM_ARGS, walk_state);
|
||||
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,16 +782,17 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
@ -834,7 +803,6 @@ acpi_ds_init_aml_walk (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_delete_walk_state
|
||||
|
@ -847,28 +815,26 @@ 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);
|
||||
|
||||
|
||||
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",
|
||||
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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"%p walk still has a scope list\n",
|
||||
walk_state));
|
||||
}
|
||||
|
||||
|
@ -899,38 +865,10 @@ acpi_ds_delete_walk_state (
|
|||
acpi_ut_delete_generic_state(state);
|
||||
}
|
||||
|
||||
acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);
|
||||
ACPI_MEM_FREE(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);
|
||||
return_VOID;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -947,20 +885,17 @@ 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");
|
||||
|
||||
|
||||
state = walk_state->results;
|
||||
if (!state) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No result object pushed! State=%p\n",
|
||||
walk_state));
|
||||
return (AE_NOT_EXIST);
|
||||
}
|
||||
|
@ -968,14 +903,16 @@ acpi_ds_result_insert (
|
|||
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));
|
||||
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));
|
||||
index, object, walk_state,
|
||||
state->results.num_results));
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -984,13 +921,17 @@ acpi_ds_result_insert (
|
|||
|
||||
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));
|
||||
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,16 +945,12 @@ 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);
|
||||
|
||||
|
||||
/* The stack size is configurable, but fixed */
|
||||
|
||||
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
|
||||
|
@ -1026,7 +963,6 @@ acpi_ds_obj_stack_delete_all (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_obj_stack_pop_object
|
||||
|
@ -1042,13 +978,11 @@ acpi_ds_obj_stack_delete_all (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ds_obj_stack_pop_object (
|
||||
union acpi_operand_object **object,
|
||||
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");
|
||||
|
||||
|
||||
/* Check for stack underflow */
|
||||
|
||||
if (walk_state->num_operands == 0) {
|
||||
|
@ -1085,7 +1019,6 @@ acpi_ds_obj_stack_pop_object (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ds_obj_stack_get_value
|
||||
|
@ -1101,15 +1034,11 @@ 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);
|
||||
|
||||
|
||||
/* Can't do it if the stack is empty */
|
||||
|
||||
if (walk_state->num_operands == 0) {
|
||||
|
@ -1122,9 +1051,8 @@ acpi_ds_obj_stack_get_value (
|
|||
return_PTR(NULL);
|
||||
}
|
||||
|
||||
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
|
||||
return_PTR(walk_state->
|
||||
operands[(acpi_native_uint) (walk_state->num_operands - 1) -
|
||||
index]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,8 +21,7 @@ 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);
|
||||
|
||||
|
@ -40,10 +39,7 @@ out_busy:
|
|||
}
|
||||
|
||||
static ssize_t
|
||||
acpi_system_read_event (
|
||||
struct file *file,
|
||||
char __user *buffer,
|
||||
size_t count,
|
||||
acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
|
||||
loff_t * ppos)
|
||||
{
|
||||
int result = 0;
|
||||
|
@ -52,7 +48,6 @@ acpi_system_read_event (
|
|||
static int chars_remaining = 0;
|
||||
static char *ptr;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_system_read_event");
|
||||
|
||||
if (!chars_remaining) {
|
||||
|
@ -68,9 +63,11 @@ acpi_system_read_event (
|
|||
}
|
||||
|
||||
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);
|
||||
event.device_class ? event.
|
||||
device_class : "<unknown>",
|
||||
event.bus_id ? event.
|
||||
bus_id : "<unknown>", event.type,
|
||||
event.data);
|
||||
ptr = str;
|
||||
}
|
||||
|
||||
|
@ -88,8 +85,7 @@ 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);
|
||||
event_is_open = 0;
|
||||
|
@ -97,10 +93,7 @@ acpi_system_close_event(struct inode *inode, struct file *file)
|
|||
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))
|
||||
|
@ -131,7 +124,8 @@ static int __init acpi_event_init(void)
|
|||
entry->proc_fops = &acpi_system_event_ops;
|
||||
else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unable to create '%s' proc fs entry\n","event" ));
|
||||
"Unable to create '%s' proc fs entry\n",
|
||||
"event"));
|
||||
error = -EFAULT;
|
||||
}
|
||||
return_VALUE(error);
|
||||
|
|
|
@ -48,15 +48,9 @@
|
|||
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,16 +64,12 @@ 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");
|
||||
|
||||
|
||||
/* Make sure we have ACPI tables */
|
||||
|
||||
if (!acpi_gbl_DSDT) {
|
||||
|
@ -94,24 +84,20 @@ acpi_ev_initialize_events (
|
|||
*/
|
||||
status = acpi_ev_fixed_event_initialize();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to initialize fixed events, %s\n",
|
||||
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)));
|
||||
ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_install_xrupt_handlers
|
||||
|
@ -124,23 +110,17 @@ 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");
|
||||
|
||||
|
||||
/* 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)));
|
||||
ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
@ -148,9 +128,7 @@ acpi_ev_install_xrupt_handlers (
|
|||
|
||||
status = acpi_ev_init_global_lock_handler();
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"Unable to initialize Global Lock handler, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
@ -158,7 +136,6 @@ acpi_ev_install_xrupt_handlers (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_fixed_event_initialize
|
||||
|
@ -171,14 +148,11 @@ 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;
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the structure that keeps track of fixed event handlers
|
||||
* and enable the fixed events.
|
||||
|
@ -190,9 +164,10 @@ 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);
|
||||
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,27 +189,23 @@ 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");
|
||||
|
||||
|
||||
/*
|
||||
* 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",
|
||||
|
@ -247,8 +217,10 @@ 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);
|
||||
|
@ -258,7 +230,6 @@ acpi_ev_fixed_event_detect (
|
|||
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();
|
||||
|
||||
|
||||
/* 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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,11 +49,7 @@
|
|||
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,16 +65,12 @@ 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");
|
||||
|
||||
|
||||
/* Validate type and update register enable masks */
|
||||
|
||||
switch (type) {
|
||||
|
@ -102,7 +94,6 @@ acpi_ev_set_gpe_type (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_update_gpe_enable_masks
|
||||
|
@ -118,17 +109,14 @@ acpi_ev_set_gpe_type (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_update_gpe_enable_masks (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
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");
|
||||
|
||||
|
||||
gpe_register_info = gpe_event_info->register_info;
|
||||
if (!gpe_register_info) {
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
|
@ -138,7 +126,8 @@ acpi_ev_update_gpe_enable_masks (
|
|||
/* 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_wake,
|
||||
register_bit);
|
||||
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -152,7 +141,8 @@ acpi_ev_update_gpe_enable_masks (
|
|||
break;
|
||||
|
||||
case ACPI_GPE_TYPE_RUNTIME:
|
||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, 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;
|
||||
|
||||
|
@ -168,7 +158,6 @@ acpi_ev_update_gpe_enable_masks (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_enable_gpe
|
||||
|
@ -184,19 +173,17 @@ acpi_ev_update_gpe_enable_masks (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_enable_gpe (
|
||||
struct acpi_gpe_event_info *gpe_event_info,
|
||||
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");
|
||||
|
||||
|
||||
/* Make sure HW enable masks are updated */
|
||||
|
||||
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
|
||||
status =
|
||||
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -240,7 +227,6 @@ acpi_ev_enable_gpe (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_disable_gpe
|
||||
|
@ -253,23 +239,20 @@ 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");
|
||||
|
||||
|
||||
if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
|
||||
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);
|
||||
status =
|
||||
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -301,7 +284,6 @@ acpi_ev_disable_gpe (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_get_gpe_event_info
|
||||
|
@ -319,19 +301,15 @@ acpi_ev_disable_gpe (
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
struct acpi_gpe_event_info *
|
||||
acpi_ev_get_gpe_event_info (
|
||||
acpi_handle gpe_device,
|
||||
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();
|
||||
|
||||
|
||||
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
|
||||
|
||||
if (!gpe_device) {
|
||||
|
@ -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 +
|
||||
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]);
|
||||
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,21 +370,19 @@ 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;
|
||||
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);
|
||||
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);
|
||||
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));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,11 +471,10 @@ acpi_ev_gpe_detect (
|
|||
|
||||
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,9 +491,7 @@ 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;
|
||||
|
@ -507,10 +499,8 @@ acpi_ev_asynch_execute_gpe_method (
|
|||
struct acpi_gpe_event_info local_gpe_event_info;
|
||||
struct acpi_parameter_info info;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_VOID;
|
||||
|
@ -550,16 +540,13 @@ acpi_ev_asynch_execute_gpe_method (
|
|||
* 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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,7 +568,6 @@ acpi_ev_asynch_execute_gpe_method (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_gpe_dispatch
|
||||
|
@ -599,16 +585,12 @@ 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");
|
||||
|
||||
|
||||
/*
|
||||
* If edge-triggered, clear the GPE status bit now. Note that
|
||||
* level-triggered events are cleared after the GPE is serviced.
|
||||
|
@ -617,9 +599,7 @@ acpi_ev_gpe_dispatch (
|
|||
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));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -628,8 +608,7 @@ acpi_ev_gpe_dispatch (
|
|||
|
||||
if (acpi_gbl_system_awake_and_running) {
|
||||
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
||||
}
|
||||
|
||||
|
@ -647,8 +626,10 @@ 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. */
|
||||
|
||||
|
@ -656,9 +637,7 @@ acpi_ev_gpe_dispatch (
|
|||
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));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -672,9 +651,7 @@ acpi_ev_gpe_dispatch (
|
|||
*/
|
||||
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));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -683,11 +660,10 @@ acpi_ev_gpe_dispatch (
|
|||
* 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);
|
||||
acpi_ev_asynch_execute_gpe_method,
|
||||
gpe_event_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
|
||||
acpi_format_exception (status), gpe_number));
|
||||
ACPI_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,9 +671,7 @@ 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
|
||||
|
@ -705,9 +679,7 @@ acpi_ev_gpe_dispatch (
|
|||
*/
|
||||
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));
|
||||
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;
|
||||
|
@ -716,7 +688,6 @@ acpi_ev_gpe_dispatch (
|
|||
return_VALUE(ACPI_INTERRUPT_HANDLED);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||
/*******************************************************************************
|
||||
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
|
||||
|
@ -735,17 +706,14 @@ 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_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 */ {
|
||||
((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);
|
||||
|
@ -754,8 +722,7 @@ acpi_ev_check_for_wake_only_gpe (
|
|||
|
||||
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 */
|
||||
|
||||
|
@ -765,5 +732,3 @@ acpi_ev_check_for_wake_only_gpe (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -49,38 +49,26 @@
|
|||
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);
|
||||
|
||||
static acpi_status
|
||||
acpi_ev_save_method_info (
|
||||
acpi_handle obj_handle,
|
||||
u32 level,
|
||||
void *obj_desc,
|
||||
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_number);
|
||||
|
||||
static acpi_status
|
||||
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);
|
||||
acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt);
|
||||
|
||||
static acpi_status
|
||||
acpi_ev_delete_gpe_xrupt (
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt);
|
||||
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
|
||||
u32 interrupt_number);
|
||||
|
||||
static acpi_status
|
||||
acpi_ev_install_gpe_block (
|
||||
struct acpi_gpe_block_info *gpe_block,
|
||||
u32 interrupt_level);
|
||||
|
||||
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,17 +84,13 @@ 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();
|
||||
|
||||
|
||||
/* No need for spin lock since we are not changing any list elements */
|
||||
|
||||
/* Walk the GPE interrupt levels */
|
||||
|
@ -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;
|
||||
|
||||
u32 flags;
|
||||
|
||||
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 */
|
||||
|
||||
|
@ -187,7 +168,6 @@ unlock_and_exit:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_delete_gpe_handlers
|
||||
|
@ -203,31 +183,31 @@ unlock_and_exit:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_delete_gpe_handlers (
|
||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||
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");
|
||||
|
||||
|
||||
/* Examine each GPE Register within the block */
|
||||
|
||||
for (i = 0; i < gpe_block->register_count; i++) {
|
||||
/* 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);
|
||||
gpe_event_info->dispatch.handler = NULL;
|
||||
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
|
||||
gpe_event_info->flags &=
|
||||
~ACPI_GPE_DISPATCH_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +215,6 @@ acpi_ev_delete_gpe_handlers (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_save_method_info
|
||||
|
@ -259,11 +238,8 @@ 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;
|
||||
|
@ -272,17 +248,16 @@ acpi_ev_save_method_info (
|
|||
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);
|
||||
&((struct acpi_namespace_node *)obj_handle)->name.
|
||||
integer);
|
||||
name[ACPI_NAME_SIZE] = 0;
|
||||
|
||||
/*
|
||||
|
@ -325,7 +300,9 @@ acpi_ev_save_method_info (
|
|||
/* 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
|
||||
|
@ -339,12 +316,14 @@ 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);
|
||||
|
||||
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 */
|
||||
|
||||
|
@ -356,7 +335,6 @@ acpi_ev_save_method_info (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_match_prw_and_gpe
|
||||
|
@ -373,11 +351,8 @@ 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;
|
||||
|
@ -389,10 +364,8 @@ acpi_ev_match_prw_and_gpe (
|
|||
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,
|
||||
|
@ -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;
|
||||
|
@ -459,17 +433,24 @@ acpi_ev_match_prw_and_gpe (
|
|||
*/
|
||||
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_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);
|
||||
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:
|
||||
|
@ -477,12 +458,11 @@ cleanup:
|
|||
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,23 +473,21 @@ 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;
|
||||
|
||||
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) {
|
||||
if (next_gpe_xrupt->interrupt_number == interrupt_number) {
|
||||
return_PTR(next_gpe_xrupt);
|
||||
}
|
||||
|
||||
|
@ -523,11 +501,11 @@ acpi_ev_get_gpe_xrupt_block (
|
|||
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,21 +514,21 @@ 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 (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_level));
|
||||
interrupt_number));
|
||||
return_PTR(NULL);
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +536,6 @@ acpi_ev_get_gpe_xrupt_block (
|
|||
return_PTR(gpe_xrupt);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_delete_gpe_xrupt
|
||||
|
@ -573,25 +550,23 @@ 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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* Disable this interrupt */
|
||||
|
||||
status = acpi_os_remove_interrupt_handler (gpe_xrupt->interrupt_level,
|
||||
status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number,
|
||||
acpi_ev_gpe_xrupt_handler);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -599,7 +574,7 @@ acpi_ev_delete_gpe_xrupt (
|
|||
|
||||
/* 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,7 +582,7 @@ 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 */
|
||||
|
||||
|
@ -615,13 +590,12 @@ acpi_ev_delete_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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_delete_gpe_block
|
||||
|
@ -690,16 +660,13 @@ 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;
|
||||
|
||||
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);
|
||||
|
@ -716,22 +683,21 @@ acpi_ev_delete_gpe_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 */
|
||||
|
@ -745,7 +711,6 @@ unlock_and_exit:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_create_gpe_info_blocks
|
||||
|
@ -759,8 +724,7 @@ 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;
|
||||
|
@ -770,15 +734,14 @@ acpi_ev_create_gpe_info_blocks (
|
|||
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"));
|
||||
|
@ -789,8 +752,8 @@ acpi_ev_create_gpe_info_blocks (
|
|||
* 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 *
|
||||
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) {
|
||||
|
@ -817,24 +780,29 @@ acpi_ev_create_gpe_info_blocks (
|
|||
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 +
|
||||
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));
|
||||
(gpe_block->block_address.address + i));
|
||||
|
||||
ACPI_STORE_ADDRESS(this_register->enable_address.address,
|
||||
(gpe_block->block_address.address
|
||||
+ i
|
||||
+ gpe_block->register_count));
|
||||
+ 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->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 */
|
||||
|
||||
|
@ -850,13 +818,15 @@ acpi_ev_create_gpe_info_blocks (
|
|||
* by writing a '0'.
|
||||
*/
|
||||
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
|
||||
&this_register->enable_address);
|
||||
&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);
|
||||
&this_register->
|
||||
status_address);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto error_exit;
|
||||
}
|
||||
|
@ -866,7 +836,6 @@ acpi_ev_create_gpe_info_blocks (
|
|||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
|
||||
error_exit:
|
||||
if (gpe_register_info) {
|
||||
ACPI_MEM_FREE(gpe_register_info);
|
||||
|
@ -878,7 +847,6 @@ error_exit:
|
|||
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,12 +865,11 @@ error_exit:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_create_gpe_block (
|
||||
struct acpi_namespace_node *gpe_device,
|
||||
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,
|
||||
u32 interrupt_number,
|
||||
struct acpi_gpe_block_info **return_gpe_block)
|
||||
{
|
||||
struct acpi_gpe_block_info *gpe_block;
|
||||
|
@ -914,10 +881,8 @@ acpi_ev_create_gpe_block (
|
|||
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);
|
||||
}
|
||||
|
@ -948,7 +913,7 @@ acpi_ev_create_gpe_block (
|
|||
|
||||
/* Install the new block in the global list(s) */
|
||||
|
||||
status = acpi_ev_install_gpe_block (gpe_block, interrupt_level);
|
||||
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_MEM_FREE(gpe_block);
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -957,8 +922,9 @@ acpi_ev_create_gpe_block (
|
|||
/* 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);
|
||||
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++;
|
||||
}
|
||||
|
||||
|
@ -1010,10 +982,10 @@ acpi_ev_create_gpe_block (
|
|||
"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));
|
||||
((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 */
|
||||
|
||||
|
@ -1032,7 +1004,6 @@ acpi_ev_create_gpe_block (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_gpe_initialize
|
||||
|
@ -1045,19 +1016,15 @@ 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;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_gpe_initialize");
|
||||
|
||||
|
||||
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]);
|
||||
&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_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);
|
||||
|
@ -1119,28 +1086,25 @@ acpi_ev_gpe_initialize (
|
|||
|
||||
if ((register_count0) &&
|
||||
(gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
|
||||
ACPI_REPORT_ERROR ((
|
||||
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
|
||||
gpe_number_max, acpi_gbl_FADT->gpe1_base,
|
||||
acpi_gbl_FADT->gpe1_base +
|
||||
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
|
||||
ACPI_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,
|
||||
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]);
|
||||
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)));
|
||||
ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1166,8 +1130,7 @@ 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;
|
||||
}
|
||||
|
@ -1176,5 +1139,3 @@ cleanup:
|
|||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,10 +49,8 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
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_notify_dispatch(void *context);
|
||||
|
||||
static void ACPI_SYSTEM_XFACE
|
||||
acpi_ev_global_lock_thread (
|
||||
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,8 +116,7 @@ acpi_ev_is_notify_object (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_queue_notify_request (
|
||||
struct acpi_namespace_node *node,
|
||||
acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
|
||||
u32 notify_value)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
|
@ -137,10 +124,8 @@ acpi_ev_queue_notify_request (
|
|||
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.
|
||||
* For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
|
||||
|
@ -149,13 +134,13 @@ acpi_ev_queue_notify_request (
|
|||
* initiate soft-off or sleep operation?
|
||||
*/
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Dispatching Notify(%X) on node %p\n", notify_value, node));
|
||||
"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 {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Notify value: 0x%2.2X **Device Specific**\n",
|
||||
notify_value));
|
||||
|
@ -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,9 +175,10 @@ 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) {
|
||||
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);
|
||||
|
@ -203,7 +190,8 @@ acpi_ev_queue_notify_request (
|
|||
notify_info->notify.handler_obj = handler_obj;
|
||||
|
||||
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
|
||||
acpi_ev_notify_dispatch, notify_info);
|
||||
acpi_ev_notify_dispatch,
|
||||
notify_info);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_delete_generic_state(notify_info);
|
||||
}
|
||||
|
@ -216,13 +204,13 @@ acpi_ev_queue_notify_request (
|
|||
*/
|
||||
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_ut_get_node_name(node), notify_value,
|
||||
node));
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_notify_dispatch
|
||||
|
@ -236,19 +224,16 @@ 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;
|
||||
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.
|
||||
* This is done _before_ we invoke the per-device handler attached
|
||||
|
@ -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,8 +258,8 @@ 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 */
|
||||
|
@ -292,7 +276,6 @@ acpi_ev_notify_dispatch (
|
|||
acpi_ut_delete_generic_state(notify_info);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_thread
|
||||
|
@ -307,19 +290,17 @@ 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;
|
||||
|
||||
|
||||
/* 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,
|
||||
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"));
|
||||
|
@ -327,7 +308,6 @@ acpi_ev_global_lock_thread (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_global_lock_handler
|
||||
|
@ -342,14 +322,11 @@ 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;
|
||||
|
||||
|
||||
/*
|
||||
* Attempt to get the lock
|
||||
* If we don't get it now, it will be marked pending and we will
|
||||
|
@ -364,10 +341,10 @@ 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);
|
||||
acpi_ev_global_lock_thread,
|
||||
context);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
|
||||
acpi_format_exception (status)));
|
||||
ACPI_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_gbl_global_lock_present = TRUE;
|
||||
status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
|
||||
acpi_ev_global_lock_handler, NULL);
|
||||
acpi_ev_global_lock_handler,
|
||||
NULL);
|
||||
|
||||
/*
|
||||
* If the global lock does not exist on this platform, the attempt
|
||||
|
@ -411,6 +384,8 @@ 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;
|
||||
}
|
||||
|
@ -418,7 +393,6 @@ acpi_ev_init_global_lock_handler (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_acquire_global_lock
|
||||
|
@ -431,17 +405,13 @@ 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");
|
||||
|
||||
|
||||
#ifndef ACPI_APPLICATION
|
||||
/* Make sure that we actually have a global lock */
|
||||
|
||||
|
@ -468,7 +438,8 @@ acpi_ev_acquire_global_lock (
|
|||
if (acquired) {
|
||||
/* 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);
|
||||
|
@ -489,7 +460,6 @@ acpi_ev_acquire_global_lock (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_release_global_lock
|
||||
|
@ -502,20 +472,15 @@ 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");
|
||||
|
||||
|
||||
if (!acpi_gbl_global_lock_thread_count) {
|
||||
ACPI_REPORT_WARNING((
|
||||
"Cannot release HW Global Lock, it has not been acquired\n"));
|
||||
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
|
||||
return_ACPI_STATUS(AE_NOT_ACQUIRED);
|
||||
}
|
||||
|
||||
|
@ -547,7 +512,6 @@ acpi_ev_release_global_lock (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_terminate
|
||||
|
@ -560,17 +524,13 @@ 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");
|
||||
|
||||
|
||||
if (acpi_gbl_events_initialized) {
|
||||
/*
|
||||
* Disable all event-related functionality.
|
||||
|
@ -583,13 +543,14 @@ acpi_ev_terminate (
|
|||
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));
|
||||
"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 */
|
||||
|
||||
|
@ -602,16 +563,16 @@ acpi_ev_terminate (
|
|||
|
||||
/* 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"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||
"acpi_disable failed\n"));
|
||||
}
|
||||
}
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
@ -49,31 +48,23 @@
|
|||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evregion")
|
||||
|
||||
#define ACPI_NUM_DEFAULT_SPACES 4
|
||||
|
||||
static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
|
||||
ACPI_ADR_SPACE_SYSTEM_MEMORY,
|
||||
ACPI_ADR_SPACE_SYSTEM_IO,
|
||||
ACPI_ADR_SPACE_PCI_CONFIG,
|
||||
ACPI_ADR_SPACE_DATA_TABLE};
|
||||
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,16 +78,13 @@ acpi_ev_install_handler (
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_install_region_handlers (
|
||||
void) {
|
||||
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);
|
||||
|
@ -122,8 +110,10 @@ acpi_ev_install_region_handlers (
|
|||
*/
|
||||
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);
|
||||
acpi_gbl_default_address_spaces
|
||||
[i],
|
||||
ACPI_DEFAULT_HANDLER,
|
||||
NULL, NULL);
|
||||
switch (status) {
|
||||
case AE_OK:
|
||||
case AE_SAME_HANDLER:
|
||||
|
@ -145,7 +135,6 @@ unlock_and_exit:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_initialize_op_regions
|
||||
|
@ -159,17 +148,13 @@ 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_FUNCTION_TRACE("ev_initialize_op_regions");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -183,14 +168,14 @@ acpi_ev_initialize_op_regions (
|
|||
* _REG will have already been run.
|
||||
*/
|
||||
status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
|
||||
acpi_gbl_default_address_spaces[i]);
|
||||
acpi_gbl_default_address_spaces
|
||||
[i]);
|
||||
}
|
||||
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_execute_reg_method
|
||||
|
@ -205,19 +190,15 @@ 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;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_execute_reg_method");
|
||||
|
||||
|
||||
region_obj2 = acpi_ns_get_secondary_object(region_obj);
|
||||
if (!region_obj2) {
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
|
@ -260,8 +241,8 @@ 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));
|
||||
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]);
|
||||
|
@ -272,7 +253,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_address_space_dispatch
|
||||
|
@ -291,12 +271,10 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_address_space_dispatch (
|
||||
union acpi_operand_object *region_obj,
|
||||
acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
|
||||
u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
void *value)
|
||||
u32 bit_width, void *value)
|
||||
{
|
||||
acpi_status status;
|
||||
acpi_status status2;
|
||||
|
@ -306,10 +284,8 @@ acpi_ev_address_space_dispatch (
|
|||
union acpi_operand_object *region_obj2;
|
||||
void *region_context = NULL;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_address_space_dispatch");
|
||||
|
||||
|
||||
region_obj2 = acpi_ns_get_secondary_object(region_obj);
|
||||
if (!region_obj2) {
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
|
@ -321,8 +297,10 @@ acpi_ev_address_space_dispatch (
|
|||
if (!handler_desc) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No handler for Region [%4.4s] (%p) [%s]\n",
|
||||
acpi_ut_get_node_name (region_obj->region.node),
|
||||
region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
|
||||
acpi_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);
|
||||
}
|
||||
|
@ -341,7 +319,10 @@ acpi_ev_address_space_dispatch (
|
|||
|
||||
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)));
|
||||
region_obj,
|
||||
acpi_ut_get_region_name(region_obj->
|
||||
region.
|
||||
space_id)));
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
@ -353,7 +334,8 @@ acpi_ev_address_space_dispatch (
|
|||
acpi_ex_exit_interpreter();
|
||||
|
||||
status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
|
||||
handler_desc->address_space.context, ®ion_context);
|
||||
handler_desc->address_space.context,
|
||||
®ion_context);
|
||||
|
||||
/* Re-enter the interpreter */
|
||||
|
||||
|
@ -365,9 +347,12 @@ acpi_ev_address_space_dispatch (
|
|||
/* Check for failure of the Region Setup */
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
|
||||
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)));
|
||||
acpi_ut_get_region_name(region_obj->
|
||||
region.
|
||||
space_id)));
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
@ -381,13 +366,13 @@ acpi_ev_address_space_dispatch (
|
|||
/* The handler for this region was already installed */
|
||||
|
||||
ACPI_MEM_FREE(region_context);
|
||||
}
|
||||
else {
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -400,9 +385,12 @@ acpi_ev_address_space_dispatch (
|
|||
"Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
|
||||
®ion_obj->region.handler->address_space, handler,
|
||||
ACPI_FORMAT_UINT64(address),
|
||||
acpi_ut_get_region_name (region_obj->region.space_id)));
|
||||
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
|
||||
|
@ -419,11 +407,14 @@ acpi_ev_address_space_dispatch (
|
|||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n",
|
||||
acpi_ut_get_region_name (region_obj->region.space_id),
|
||||
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
|
||||
|
@ -437,7 +428,6 @@ acpi_ev_address_space_dispatch (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_detach_region
|
||||
|
@ -453,8 +443,7 @@ acpi_ev_address_space_dispatch (
|
|||
******************************************************************************/
|
||||
|
||||
void
|
||||
acpi_ev_detach_region(
|
||||
union acpi_operand_object *region_obj,
|
||||
acpi_ev_detach_region(union acpi_operand_object *region_obj,
|
||||
u8 acpi_ns_is_locked)
|
||||
{
|
||||
union acpi_operand_object *handler_obj;
|
||||
|
@ -465,10 +454,8 @@ acpi_ev_detach_region(
|
|||
union acpi_operand_object *region_obj2;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ev_detach_region");
|
||||
|
||||
|
||||
region_obj2 = acpi_ns_get_secondary_object(region_obj);
|
||||
if (!region_obj2) {
|
||||
return_VOID;
|
||||
|
@ -503,7 +490,8 @@ acpi_ev_detach_region(
|
|||
obj_desc->region.next = NULL; /* Must clear field */
|
||||
|
||||
if (acpi_ns_is_locked) {
|
||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
status =
|
||||
acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_VOID;
|
||||
}
|
||||
|
@ -513,13 +501,17 @@ acpi_ev_detach_region(
|
|||
|
||||
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_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)));
|
||||
acpi_ut_get_region_name
|
||||
(region_obj->region.
|
||||
space_id)));
|
||||
}
|
||||
|
||||
if (acpi_ns_is_locked) {
|
||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
||||
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_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)));
|
||||
acpi_ut_get_region_name
|
||||
(region_obj->region.
|
||||
space_id)));
|
||||
}
|
||||
|
||||
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
|
||||
|
@ -572,7 +569,6 @@ acpi_ev_detach_region(
|
|||
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,
|
||||
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_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_ut_get_region_name(region_obj->region.
|
||||
space_id)));
|
||||
|
||||
/* Link this region to the front of the handler's list */
|
||||
|
||||
|
@ -621,7 +616,6 @@ acpi_ev_attach_region (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_install_handler
|
||||
|
@ -640,11 +634,8 @@ 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;
|
||||
|
@ -652,10 +643,8 @@ acpi_ev_install_handler (
|
|||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME("ev_install_handler");
|
||||
|
||||
|
||||
handler_obj = (union acpi_operand_object *)context;
|
||||
|
||||
/* Parameter validation */
|
||||
|
@ -676,8 +665,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -699,11 +687,15 @@ acpi_ev_install_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) {
|
||||
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));
|
||||
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
|
||||
|
@ -752,7 +744,6 @@ acpi_ev_install_handler (
|
|||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_install_space_handler
|
||||
|
@ -771,12 +762,10 @@ acpi_ev_install_handler (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_install_space_handler (
|
||||
struct acpi_namespace_node *node,
|
||||
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_adr_space_setup setup, void *context)
|
||||
{
|
||||
union acpi_operand_object *obj_desc;
|
||||
union acpi_operand_object *handler_obj;
|
||||
|
@ -784,10 +773,8 @@ acpi_ev_install_space_handler (
|
|||
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
|
||||
|
@ -795,8 +782,7 @@ acpi_ev_install_space_handler (
|
|||
*/
|
||||
if ((node->type != ACPI_TYPE_DEVICE) &&
|
||||
(node->type != ACPI_TYPE_PROCESSOR) &&
|
||||
(node->type != ACPI_TYPE_THERMAL) &&
|
||||
(node != acpi_gbl_root_node)) {
|
||||
(node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
@ -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,17 +870,16 @@ acpi_ev_install_space_handler (
|
|||
|
||||
handler_obj = handler_obj->address_space.next;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||
"Creating object on Device %p while installing handler\n", node));
|
||||
"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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -972,14 +958,14 @@ acpi_ev_install_space_handler (
|
|||
* 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);
|
||||
ACPI_NS_WALK_UNLOCK,
|
||||
acpi_ev_install_handler, handler_obj,
|
||||
NULL);
|
||||
|
||||
unlock_and_exit:
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_execute_reg_methods
|
||||
|
@ -995,16 +981,13 @@ unlock_and_exit:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_execute_reg_methods (
|
||||
struct acpi_namespace_node *node,
|
||||
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");
|
||||
|
||||
|
||||
/*
|
||||
* Run all _REG methods for all Operation Regions for this
|
||||
* space ID. This is a separate walk in order to handle any
|
||||
|
@ -1019,7 +1002,6 @@ acpi_ev_execute_reg_methods (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_reg_run
|
||||
|
@ -1031,18 +1013,14 @@ 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;
|
||||
|
||||
|
||||
space_id = *ACPI_CAST_PTR(acpi_adr_space_type, context);
|
||||
|
||||
/* Convert and validate the device handle */
|
||||
|
@ -1056,8 +1034,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -1083,4 +1060,3 @@ acpi_ev_reg_run (
|
|||
status = acpi_ev_execute_reg_method(obj_desc, 1);
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
@ -49,7 +48,6 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evrgnini")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_system_memory_region_setup
|
||||
|
@ -64,21 +62,17 @@
|
|||
* DESCRIPTION: Setup a system_memory operation region
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_system_memory_region_setup (
|
||||
acpi_handle handle,
|
||||
acpi_ev_system_memory_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
union acpi_operand_object *region_desc = (union acpi_operand_object *) handle;
|
||||
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);
|
||||
|
@ -89,7 +83,8 @@ acpi_ev_system_memory_region_setup (
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -103,7 +98,6 @@ acpi_ev_system_memory_region_setup (
|
|||
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,
|
||||
acpi_ev_io_space_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_pci_config_region_setup
|
||||
|
@ -158,11 +147,9 @@ acpi_ev_io_space_region_setup (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_pci_config_region_setup (
|
||||
acpi_handle handle,
|
||||
acpi_ev_pci_config_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_integer pci_value;
|
||||
|
@ -170,13 +157,12 @@ acpi_ev_pci_config_region_setup (
|
|||
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;
|
||||
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) {
|
||||
/*
|
||||
|
@ -184,7 +170,8 @@ acpi_ev_pci_config_region_setup (
|
|||
* 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));
|
||||
"Attempting to init a region %p, with no handler\n",
|
||||
region_obj));
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
@ -216,17 +203,27 @@ 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);
|
||||
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)))) {
|
||||
/*
|
||||
* 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);
|
||||
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) {
|
||||
/*
|
||||
|
@ -235,11 +232,8 @@ 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;
|
||||
|
@ -250,8 +244,7 @@ acpi_ev_pci_config_region_setup (
|
|||
}
|
||||
|
||||
/* PCI root bridge not found, use namespace root node */
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pci_root_node = handler_obj->address_space.node;
|
||||
}
|
||||
|
||||
|
@ -279,7 +272,9 @@ 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
|
||||
|
@ -292,14 +287,18 @@ acpi_ev_pci_config_region_setup (
|
|||
|
||||
/* The PCI segment number comes from the _SEG method */
|
||||
|
||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &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);
|
||||
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);
|
||||
}
|
||||
|
@ -312,7 +311,6 @@ acpi_ev_pci_config_region_setup (
|
|||
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,
|
||||
acpi_ev_pci_bar_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
|
||||
|
||||
|
||||
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,
|
||||
acpi_ev_cmos_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
|
||||
|
||||
|
||||
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,
|
||||
acpi_ev_default_region_setup(acpi_handle handle,
|
||||
u32 function,
|
||||
void *handler_context,
|
||||
void **region_context)
|
||||
void *handler_context, void **region_context)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_initialize_region
|
||||
|
@ -434,8 +419,7 @@ acpi_ev_default_region_setup (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ev_initialize_region (
|
||||
union acpi_operand_object *region_obj,
|
||||
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
|
||||
u8 acpi_ns_locked)
|
||||
{
|
||||
union acpi_operand_object *handler_obj;
|
||||
|
@ -447,10 +431,8 @@ acpi_ev_initialize_region (
|
|||
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);
|
||||
}
|
||||
|
@ -523,14 +505,19 @@ 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));
|
||||
handler_obj,
|
||||
region_obj,
|
||||
obj_desc));
|
||||
|
||||
status = acpi_ev_attach_region (handler_obj, region_obj,
|
||||
status =
|
||||
acpi_ev_attach_region(handler_obj,
|
||||
region_obj,
|
||||
acpi_ns_locked);
|
||||
|
||||
/*
|
||||
|
@ -538,18 +525,26 @@ acpi_ev_initialize_region (
|
|||
* method
|
||||
*/
|
||||
if (acpi_ns_locked) {
|
||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
||||
status =
|
||||
acpi_ut_release_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS (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);
|
||||
status =
|
||||
acpi_ut_acquire_mutex
|
||||
(ACPI_MTX_NAMESPACE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS (status);
|
||||
return_ACPI_STATUS
|
||||
(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,8 +568,8 @@ acpi_ev_initialize_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_ut_get_region_name(space_id), space_id,
|
||||
region_obj));
|
||||
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,16 +45,11 @@
|
|||
#include <acpi/acpi.h>
|
||||
#include <acpi/acevents.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EVENTS
|
||||
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;
|
||||
|
||||
|
||||
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.
|
||||
|
@ -100,7 +91,6 @@ acpi_ev_sci_xrupt_handler (
|
|||
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;
|
||||
|
||||
|
||||
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.
|
||||
|
@ -138,7 +124,6 @@ acpi_ev_gpe_xrupt_handler (
|
|||
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;
|
||||
|
||||
|
||||
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);
|
||||
acpi_ev_sci_xrupt_handler,
|
||||
acpi_gbl_gpe_xrupt_list_head);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_remove_sci_handler
|
||||
|
@ -186,16 +167,12 @@ 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");
|
||||
|
||||
|
||||
/* Just let the OS remove the handler and disable the level */
|
||||
|
||||
status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||
|
@ -203,5 +180,3 @@ acpi_ev_remove_sci_handler (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evxface")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_install_exception_handler
|
||||
|
@ -64,18 +63,13 @@
|
|||
* 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_FUNCTION_TRACE("acpi_install_exception_handler");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -98,7 +92,6 @@ cleanup:
|
|||
}
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_install_fixed_event_handler
|
||||
|
@ -116,17 +109,13 @@ 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");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
|
@ -154,25 +143,25 @@ acpi_install_fixed_event_handler (
|
|||
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"));
|
||||
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 {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Enabled fixed event %X, Handler=%p\n", event, handler));
|
||||
"Enabled fixed event %X, Handler=%p\n", event,
|
||||
handler));
|
||||
}
|
||||
|
||||
|
||||
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,16 +177,12 @@ 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");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
|
@ -221,16 +206,16 @@ acpi_remove_fixed_event_handler (
|
|||
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));
|
||||
} 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);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -251,26 +236,21 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_notify_handler (
|
||||
acpi_handle device,
|
||||
acpi_install_notify_handler(acpi_handle device,
|
||||
u32 handler_type,
|
||||
acpi_notify_handler handler,
|
||||
void *context)
|
||||
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");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!device) ||
|
||||
(!handler) ||
|
||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -345,8 +325,7 @@ acpi_install_notify_handler (
|
|||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* Create a new object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(node->type);
|
||||
|
@ -357,7 +336,8 @@ 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 */
|
||||
|
||||
|
@ -369,7 +349,8 @@ acpi_install_notify_handler (
|
|||
|
||||
/* 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;
|
||||
|
@ -394,13 +375,12 @@ acpi_install_notify_handler (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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,25 +400,20 @@ 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");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if ((!device) ||
|
||||
(!handler) ||
|
||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -554,13 +529,12 @@ acpi_remove_notify_handler (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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,21 +555,17 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_gpe_handler (
|
||||
acpi_handle gpe_device,
|
||||
acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||
u32 gpe_number,
|
||||
u32 type,
|
||||
acpi_event_handler address,
|
||||
void *context)
|
||||
u32 type, acpi_event_handler address, void *context)
|
||||
{
|
||||
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)) {
|
||||
|
@ -617,7 +587,8 @@ 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;
|
||||
}
|
||||
|
@ -643,7 +614,7 @@ acpi_install_gpe_handler (
|
|||
|
||||
/* 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) */
|
||||
|
@ -651,15 +622,14 @@ acpi_install_gpe_handler (
|
|||
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);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -677,19 +647,16 @@ 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;
|
||||
|
||||
u32 flags;
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!address) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -741,7 +709,7 @@ acpi_remove_gpe_handler (
|
|||
|
||||
/* 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 */
|
||||
|
@ -751,19 +719,18 @@ acpi_remove_gpe_handler (
|
|||
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);
|
||||
|
||||
|
||||
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,14 +746,10 @@ 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;
|
||||
|
||||
|
||||
if (!handle) {
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -806,8 +769,8 @@ acpi_acquire_global_lock (
|
|||
|
||||
return (status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||
|
||||
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -821,13 +784,10 @@ 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;
|
||||
|
||||
|
||||
if (handle != acpi_gbl_global_lock_handle) {
|
||||
return (AE_NOT_ACQUIRED);
|
||||
}
|
||||
|
@ -835,5 +795,5 @@ acpi_release_global_lock (
|
|||
status = acpi_ev_release_global_lock();
|
||||
return (status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_release_global_lock);
|
||||
|
||||
EXPORT_SYMBOL(acpi_release_global_lock);
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evxfevnt")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_enable
|
||||
|
@ -62,28 +61,24 @@
|
|||
* DESCRIPTION: Transfers the system into ACPI mode.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_enable (
|
||||
void)
|
||||
acpi_status acpi_enable(void)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_enable");
|
||||
|
||||
|
||||
/* Make sure we have the FADT */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
|
||||
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);
|
||||
|
@ -99,7 +94,6 @@ acpi_enable (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_disable
|
||||
|
@ -112,26 +106,22 @@ acpi_enable (
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_disable (
|
||||
void)
|
||||
acpi_status acpi_disable(void)
|
||||
{
|
||||
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"));
|
||||
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 {
|
||||
} else {
|
||||
/* Transition to LEGACY mode */
|
||||
|
||||
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
||||
|
@ -148,7 +138,6 @@ acpi_disable (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_enable_event
|
||||
|
@ -162,18 +151,13 @@ 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");
|
||||
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
|
@ -184,30 +168,33 @@ acpi_enable_event (
|
|||
* 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);
|
||||
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);
|
||||
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)));
|
||||
"Could not enable %s event\n",
|
||||
acpi_ut_get_event_name(event)));
|
||||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_enable_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_enable_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -223,19 +210,13 @@ 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");
|
||||
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
|
@ -255,8 +236,8 @@ acpi_set_gpe_type (
|
|||
unlock_and_exit:
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||
|
||||
EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -273,19 +254,13 @@ 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");
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
|
@ -313,8 +288,8 @@ unlock_and_exit:
|
|||
}
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_enable_gpe);
|
||||
|
||||
EXPORT_SYMBOL(acpi_enable_gpe);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -331,19 +306,13 @@ 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");
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
|
@ -370,7 +339,6 @@ unlock_and_exit:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_disable_event
|
||||
|
@ -384,18 +352,13 @@ 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");
|
||||
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
|
@ -406,28 +369,31 @@ acpi_disable_event (
|
|||
* 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);
|
||||
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);
|
||||
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)));
|
||||
"Could not disable %s events\n",
|
||||
acpi_ut_get_event_name(event)));
|
||||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_disable_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_disable_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -441,16 +407,12 @@ 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");
|
||||
|
||||
|
||||
/* Decode the Fixed Event */
|
||||
|
||||
if (event > ACPI_EVENT_MAX) {
|
||||
|
@ -461,13 +423,14 @@ acpi_clear_event (
|
|||
* 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);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_clear_event);
|
||||
|
||||
EXPORT_SYMBOL(acpi_clear_event);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -483,19 +446,13 @@ 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");
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
|
@ -522,7 +479,6 @@ unlock_and_exit:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_FUTURE_USAGE
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -538,17 +494,12 @@ 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");
|
||||
|
||||
|
||||
if (!event_status) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -561,13 +512,13 @@ acpi_get_event_status (
|
|||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_get_gpe_status
|
||||
|
@ -585,19 +536,14 @@ 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");
|
||||
|
||||
|
||||
/* Use semaphore lock if not executing at interrupt level */
|
||||
|
||||
if (flags & ACPI_NOT_ISR) {
|
||||
|
@ -627,7 +573,6 @@ unlock_and_exit:
|
|||
}
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_install_gpe_block
|
||||
|
@ -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,24 +589,18 @@ unlock_and_exit:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_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_level)
|
||||
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_FUNCTION_TRACE("acpi_install_gpe_block");
|
||||
|
||||
|
||||
if ((!gpe_device) ||
|
||||
(!gpe_block_address) ||
|
||||
(!register_count)) {
|
||||
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
|
@ -680,8 +619,9 @@ 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);
|
||||
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;
|
||||
}
|
||||
|
@ -698,7 +638,8 @@ acpi_install_gpe_block (
|
|||
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 */
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||
|
||||
EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -733,18 +673,14 @@ 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");
|
||||
|
||||
|
||||
if (!gpe_device) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -763,8 +699,7 @@ 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) {
|
||||
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#define _COMPONENT ACPI_EVENTS
|
||||
ACPI_MODULE_NAME("evxfregn")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_install_address_space_handler
|
||||
|
@ -67,22 +66,17 @@
|
|||
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_install_address_space_handler (
|
||||
acpi_handle device,
|
||||
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_adr_space_setup setup, void *context)
|
||||
{
|
||||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!device) {
|
||||
|
@ -104,7 +98,9 @@ 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);
|
||||
status =
|
||||
acpi_ev_install_space_handler(node, space_id, handler, setup,
|
||||
context);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
@ -117,8 +113,8 @@ 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,8 +131,7 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_remove_address_space_handler (
|
||||
acpi_handle device,
|
||||
acpi_remove_address_space_handler(acpi_handle device,
|
||||
acpi_adr_space_type space_id,
|
||||
acpi_adr_space_handler handler)
|
||||
{
|
||||
|
@ -147,10 +142,8 @@ acpi_remove_address_space_handler (
|
|||
struct acpi_namespace_node *node;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (!device) {
|
||||
|
@ -190,7 +183,8 @@ acpi_remove_address_space_handler (
|
|||
|
||||
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),
|
||||
handler_obj, handler,
|
||||
acpi_ut_get_region_name(space_id),
|
||||
node, obj_desc));
|
||||
|
||||
region_obj = handler_obj->address_space.region_list;
|
||||
|
@ -211,7 +205,8 @@ acpi_remove_address_space_handler (
|
|||
* 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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -235,7 +230,8 @@ acpi_remove_address_space_handler (
|
|||
|
||||
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));
|
||||
handler, acpi_ut_get_region_name(space_id), space_id,
|
||||
node, obj_desc));
|
||||
|
||||
status = AE_NOT_EXIST;
|
||||
|
||||
|
@ -243,5 +239,5 @@ 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);
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -50,19 +49,15 @@
|
|||
#include <acpi/actables.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exconfig")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_add_table (
|
||||
struct acpi_table_header *table,
|
||||
acpi_ex_add_table(struct acpi_table_header *table,
|
||||
struct acpi_namespace_node *parent_node,
|
||||
union acpi_operand_object **ddb_handle);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_add_table
|
||||
|
@ -79,8 +74,7 @@ acpi_ex_add_table (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_add_table (
|
||||
struct acpi_table_header *table,
|
||||
acpi_ex_add_table(struct acpi_table_header *table,
|
||||
struct acpi_namespace_node *parent_node,
|
||||
union acpi_operand_object **ddb_handle)
|
||||
{
|
||||
|
@ -88,10 +82,8 @@ acpi_ex_add_table (
|
|||
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);
|
||||
|
@ -99,6 +91,11 @@ acpi_ex_add_table (
|
|||
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));
|
||||
|
@ -109,7 +106,14 @@ acpi_ex_add_table (
|
|||
table_info.allocation = ACPI_MEM_ALLOCATED;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -123,20 +127,14 @@ acpi_ex_add_table (
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Init the table handle */
|
||||
|
||||
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);
|
||||
*ddb_handle = NULL;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_load_table_op
|
||||
|
@ -151,8 +149,7 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_load_table_op (
|
||||
struct acpi_walk_state *walk_state,
|
||||
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
||||
union acpi_operand_object **return_desc)
|
||||
{
|
||||
acpi_status status;
|
||||
|
@ -163,10 +160,8 @@ acpi_ex_load_table_op (
|
|||
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
|
||||
|
@ -215,8 +210,10 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
@ -236,8 +233,10 @@ 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, ¶meter_node);
|
||||
status =
|
||||
acpi_ns_get_node_by_path(operand[4]->string.pointer,
|
||||
start_node, ACPI_NS_SEARCH_PARENT,
|
||||
¶meter_node);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -256,7 +255,8 @@ acpi_ex_load_table_op (
|
|||
/* Store the parameter data into the optional parameter object */
|
||||
|
||||
status = acpi_ex_store(operand[5],
|
||||
ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
|
||||
ACPI_CAST_PTR(union acpi_operand_object,
|
||||
parameter_node),
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
(void)acpi_ex_unload_table(ddb_handle);
|
||||
|
@ -268,7 +268,6 @@ acpi_ex_load_table_op (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_load_op
|
||||
|
@ -285,8 +284,7 @@ acpi_ex_load_table_op (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_load_op (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_load_op(union acpi_operand_object *obj_desc,
|
||||
union acpi_operand_object *target,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
|
@ -300,14 +298,14 @@ acpi_ex_load_op (
|
|||
|
||||
ACPI_FUNCTION_TRACE("ex_load_op");
|
||||
|
||||
|
||||
/* Object can be either an op_region or a Field */
|
||||
|
||||
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)));
|
||||
obj_desc,
|
||||
acpi_ut_get_object_type_name(obj_desc)));
|
||||
|
||||
/*
|
||||
* If the Region Address and Length have not been previously evaluated,
|
||||
|
@ -328,9 +326,12 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
@ -352,44 +353,54 @@ acpi_ex_load_op (
|
|||
/* 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));
|
||||
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)));
|
||||
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);
|
||||
status =
|
||||
acpi_ex_read_data_from_field(walk_state, obj_desc,
|
||||
&buffer_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
table_ptr = ACPI_CAST_PTR(struct acpi_table_header,
|
||||
buffer_desc->buffer.pointer);
|
||||
|
||||
/* All done with the buffer_desc, delete it */
|
||||
|
||||
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)) {
|
||||
return_ACPI_STATUS (AE_BAD_HEADER);
|
||||
status = AE_BAD_HEADER;
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
@ -413,7 +424,9 @@ acpi_ex_load_op (
|
|||
|
||||
status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
/* On error, table_ptr was deallocated above */
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Store the ddb_handle into the Target operand */
|
||||
|
@ -421,23 +434,19 @@ acpi_ex_load_op (
|
|||
status = acpi_ex_store(ddb_handle, target, walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
(void)acpi_ex_unload_table(ddb_handle);
|
||||
}
|
||||
|
||||
/* table_ptr was deallocated above */
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
if (buffer_desc) {
|
||||
acpi_ut_remove_reference (buffer_desc);
|
||||
}
|
||||
else {
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_MEM_FREE(table_ptr);
|
||||
}
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_unload_table
|
||||
|
@ -450,18 +459,14 @@ 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");
|
||||
|
||||
|
||||
/*
|
||||
* Validate the handle
|
||||
* Although the handle is partially validated in acpi_ex_reconfiguration(),
|
||||
|
@ -482,7 +487,8 @@ acpi_ex_unload_table (
|
|||
* 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 */
|
||||
|
||||
|
@ -493,4 +499,3 @@ acpi_ex_unload_table (
|
|||
acpi_ut_remove_reference(table_desc);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,24 +41,17 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
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,10 +69,8 @@ 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;
|
||||
|
@ -88,10 +79,8 @@ acpi_ex_convert_to_integer (
|
|||
u32 count;
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
|
||||
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
|
@ -141,7 +130,6 @@ acpi_ex_convert_to_integer (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* Check for zero-length buffer */
|
||||
|
@ -170,7 +158,6 @@ acpi_ex_convert_to_integer (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/* No other types can get here */
|
||||
break;
|
||||
|
@ -191,7 +178,6 @@ acpi_ex_convert_to_integer (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_convert_to_buffer
|
||||
|
@ -207,17 +193,14 @@ acpi_ex_convert_to_integer (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_convert_to_buffer (
|
||||
union acpi_operand_object *obj_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;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
|
||||
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
|
@ -226,14 +209,14 @@ acpi_ex_convert_to_buffer (
|
|||
*result_desc = obj_desc;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
@ -246,7 +229,6 @@ acpi_ex_convert_to_buffer (
|
|||
acpi_gbl_integer_byte_width);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/*
|
||||
|
@ -258,8 +240,9 @@ 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);
|
||||
}
|
||||
|
@ -271,7 +254,6 @@ acpi_ex_convert_to_buffer (
|
|||
obj_desc->string.length);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS(AE_TYPE);
|
||||
}
|
||||
|
@ -283,7 +265,6 @@ acpi_ex_convert_to_buffer (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_convert_to_ascii
|
||||
|
@ -300,11 +281,8 @@ 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;
|
||||
|
@ -315,10 +293,8 @@ acpi_ex_convert_to_ascii (
|
|||
u32 remainder;
|
||||
u8 supress_zeros;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY();
|
||||
|
||||
|
||||
switch (base) {
|
||||
case 10:
|
||||
|
||||
|
@ -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);
|
||||
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;
|
||||
|
@ -395,7 +374,6 @@ acpi_ex_convert_to_ascii (
|
|||
return ((u32) k);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_convert_to_string
|
||||
|
@ -412,10 +390,8 @@ 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;
|
||||
|
@ -424,10 +400,8 @@ acpi_ex_convert_to_string (
|
|||
u16 base = 16;
|
||||
u8 separator = ',';
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
|
||||
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
|
@ -436,7 +410,6 @@ acpi_ex_convert_to_string (
|
|||
*result_desc = obj_desc;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
switch (type) {
|
||||
|
@ -460,7 +433,8 @@ 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);
|
||||
}
|
||||
|
@ -469,8 +443,10 @@ acpi_ex_convert_to_string (
|
|||
|
||||
/* 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 */
|
||||
|
||||
|
@ -478,7 +454,6 @@ acpi_ex_convert_to_string (
|
|||
new_buf[string_length] = 0;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* Setup string length, base, and separator */
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -535,13 +508,14 @@ 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 */ {
|
||||
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);
|
||||
}
|
||||
|
@ -553,8 +527,9 @@ 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 += 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 */
|
||||
}
|
||||
|
@ -575,7 +550,6 @@ acpi_ex_convert_to_string (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_convert_to_target_type
|
||||
|
@ -592,18 +566,15 @@ acpi_ex_convert_to_string (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_convert_to_target_type (
|
||||
acpi_object_type destination_type,
|
||||
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");
|
||||
|
||||
|
||||
/* Default behavior */
|
||||
|
||||
*result_desc = source_desc;
|
||||
|
@ -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)) {
|
||||
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)));
|
||||
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,54 +622,54 @@ 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,
|
||||
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,
|
||||
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)));
|
||||
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)))
|
||||
GET_CURRENT_ARG_TYPE(walk_state->op_info->
|
||||
runtime_args)))
|
||||
status = AE_AML_INTERNAL;
|
||||
}
|
||||
|
||||
|
@ -712,5 +685,3 @@ acpi_ex_convert_to_target_type (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -49,11 +48,9 @@
|
|||
#include <acpi/acevents.h>
|
||||
#include <acpi/actables.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("excreate")
|
||||
|
||||
|
||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -66,19 +63,14 @@
|
|||
* 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");
|
||||
|
||||
|
||||
/* Get the source/alias operands (both namespace nodes) */
|
||||
|
||||
alias_node = (struct acpi_namespace_node *)walk_state->operands[0];
|
||||
|
@ -92,7 +84,9 @@ acpi_ex_create_alias (
|
|||
* 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:
|
||||
|
@ -140,7 +136,9 @@ acpi_ex_create_alias (
|
|||
* target node or the alias Node
|
||||
*/
|
||||
status = acpi_ns_attach_object(alias_node,
|
||||
acpi_ns_get_attached_object (target_node), target_node->type);
|
||||
acpi_ns_get_attached_object
|
||||
(target_node),
|
||||
target_node->type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -149,7 +147,6 @@ acpi_ex_create_alias (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_event
|
||||
|
@ -162,17 +159,13 @@ 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");
|
||||
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
|
||||
if (!obj_desc) {
|
||||
status = AE_NO_MEMORY;
|
||||
|
@ -191,8 +184,9 @@ acpi_ex_create_event (
|
|||
|
||||
/* 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:
|
||||
/*
|
||||
|
@ -203,7 +197,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_mutex
|
||||
|
@ -218,17 +211,13 @@ 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);
|
||||
|
||||
|
||||
/* Create the new mutex object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
|
||||
|
@ -249,13 +238,14 @@ acpi_ex_create_mutex (
|
|||
|
||||
/* 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];
|
||||
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:
|
||||
/*
|
||||
* Remove local reference to the object (on error, will cause deletion
|
||||
|
@ -265,7 +255,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_region
|
||||
|
@ -282,21 +271,17 @@ cleanup:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_create_region (
|
||||
u8 *aml_start,
|
||||
acpi_ex_create_region(u8 * aml_start,
|
||||
u32 aml_length,
|
||||
u8 region_space,
|
||||
struct acpi_walk_state *walk_state)
|
||||
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");
|
||||
|
||||
|
||||
/* Get the Namespace Node */
|
||||
|
||||
node = walk_state->op->common.node;
|
||||
|
@ -315,7 +300,8 @@ acpi_ex_create_region (
|
|||
*/
|
||||
if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
|
||||
(region_space < ACPI_USER_REGION_BEGIN)) {
|
||||
ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space));
|
||||
ACPI_REPORT_ERROR(("Invalid address_space type %X\n",
|
||||
region_space));
|
||||
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
|
||||
}
|
||||
|
||||
|
@ -349,7 +335,6 @@ acpi_ex_create_region (
|
|||
|
||||
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Remove local reference to the object */
|
||||
|
@ -358,7 +343,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_table_region
|
||||
|
@ -371,9 +355,7 @@ 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];
|
||||
|
@ -382,10 +364,8 @@ acpi_ex_create_table_region (
|
|||
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 */
|
||||
|
||||
node = walk_state->op->common.node;
|
||||
|
@ -420,7 +400,8 @@ acpi_ex_create_table_region (
|
|||
/* 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;
|
||||
|
@ -436,15 +417,13 @@ acpi_ex_create_table_region (
|
|||
if (ACPI_FAILURE(status)) {
|
||||
if (status == AE_NOT_EXIST) {
|
||||
status = AE_OK;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Remove local reference to the object */
|
||||
|
@ -453,7 +432,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_processor
|
||||
|
@ -468,18 +446,14 @@ 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);
|
||||
|
||||
|
||||
/* Create the processor object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR);
|
||||
|
@ -490,7 +464,8 @@ acpi_ex_create_processor (
|
|||
/* 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.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 */
|
||||
|
@ -504,7 +479,6 @@ acpi_ex_create_processor (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_power_resource
|
||||
|
@ -519,18 +493,14 @@ 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);
|
||||
|
||||
|
||||
/* Create the power resource object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER);
|
||||
|
@ -541,7 +511,8 @@ acpi_ex_create_power_resource (
|
|||
/* 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 */
|
||||
|
||||
|
@ -555,7 +526,6 @@ acpi_ex_create_power_resource (
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_create_method
|
||||
|
@ -571,20 +541,16 @@ 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);
|
||||
|
||||
|
||||
/* Create a new method object */
|
||||
|
||||
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
|
||||
|
@ -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,16 +581,14 @@ 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 {
|
||||
} else {
|
||||
obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
|
||||
}
|
||||
|
||||
|
@ -640,5 +606,3 @@ acpi_ex_create_method (
|
|||
acpi_ut_remove_reference(operand[1]);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -51,35 +50,25 @@
|
|||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exdump")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
#ifdef ACPI_FUTURE_USAGE
|
||||
static void
|
||||
acpi_ex_out_string (
|
||||
char *title,
|
||||
char *value);
|
||||
|
||||
static void
|
||||
acpi_ex_out_pointer (
|
||||
char *title,
|
||||
void *value);
|
||||
|
||||
static void
|
||||
acpi_ex_out_integer (
|
||||
char *title,
|
||||
u32 value);
|
||||
|
||||
static void
|
||||
acpi_ex_out_address (
|
||||
char *title,
|
||||
acpi_physical_address value);
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
|
||||
/*
|
||||
* 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_pointer(char *title, void *value);
|
||||
|
||||
static void acpi_ex_out_integer(char *title, u32 value);
|
||||
|
||||
static void acpi_ex_out_address(char *title, acpi_physical_address value);
|
||||
|
||||
static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc);
|
||||
|
||||
static void
|
||||
acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index);
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -94,19 +83,16 @@ 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;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -118,7 +104,8 @@ acpi_ex_dump_operand (
|
|||
}
|
||||
|
||||
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_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
|
||||
obj_desc));
|
||||
ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +113,8 @@ acpi_ex_dump_operand (
|
|||
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)));
|
||||
obj_desc,
|
||||
acpi_ut_get_descriptor_name(obj_desc)));
|
||||
ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
|
||||
return;
|
||||
}
|
||||
|
@ -136,8 +124,7 @@ acpi_ex_dump_operand (
|
|||
if (depth > 0) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
|
||||
depth, " ", depth, obj_desc));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
|
||||
}
|
||||
|
||||
|
@ -152,29 +139,27 @@ acpi_ex_dump_operand (
|
|||
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);
|
||||
"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);
|
||||
break;
|
||||
|
||||
|
||||
case AML_REF_OF_OP:
|
||||
|
||||
acpi_os_printf("Reference: (ref_of) %p\n",
|
||||
obj_desc->reference.object);
|
||||
break;
|
||||
|
||||
|
||||
case AML_ARG_OP:
|
||||
|
||||
acpi_os_printf("Reference: Arg%d",
|
||||
|
@ -184,13 +169,14 @@ acpi_ex_dump_operand (
|
|||
/* Value is an Integer */
|
||||
|
||||
acpi_os_printf(" value is [%8.8X%8.8x]",
|
||||
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
|
||||
ACPI_FORMAT_UINT64(obj_desc->
|
||||
integer.
|
||||
value));
|
||||
}
|
||||
|
||||
acpi_os_printf("\n");
|
||||
break;
|
||||
|
||||
|
||||
case AML_LOCAL_OP:
|
||||
|
||||
acpi_os_printf("Reference: Local%d",
|
||||
|
@ -201,20 +187,20 @@ acpi_ex_dump_operand (
|
|||
/* Value is an Integer */
|
||||
|
||||
acpi_os_printf(" value is [%8.8X%8.8x]",
|
||||
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
|
||||
ACPI_FORMAT_UINT64(obj_desc->
|
||||
integer.
|
||||
value));
|
||||
}
|
||||
|
||||
acpi_os_printf("\n");
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_NAMEPATH_OP:
|
||||
|
||||
acpi_os_printf("Reference.Node->Name %X\n",
|
||||
obj_desc->reference.node->name.integer);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Unknown opcode */
|
||||
|
@ -226,11 +212,11 @@ acpi_ex_dump_operand (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
acpi_os_printf("Buffer len %X @ %p \n",
|
||||
obj_desc->buffer.length, obj_desc->buffer.pointer);
|
||||
obj_desc->buffer.length,
|
||||
obj_desc->buffer.pointer);
|
||||
|
||||
length = obj_desc->buffer.length;
|
||||
if (length > 64) {
|
||||
|
@ -243,43 +229,45 @@ acpi_ex_dump_operand (
|
|||
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");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
|
||||
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);
|
||||
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),
|
||||
acpi_ut_get_region_name(obj_desc->region.
|
||||
space_id),
|
||||
obj_desc->region.space_id);
|
||||
|
||||
/*
|
||||
|
@ -288,15 +276,14 @@ acpi_ex_dump_operand (
|
|||
*/
|
||||
if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
|
||||
acpi_os_printf("\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
acpi_os_printf(" base %8.8X%8.8X Length %X\n",
|
||||
ACPI_FORMAT_UINT64 (obj_desc->region.address),
|
||||
ACPI_FORMAT_UINT64(obj_desc->region.
|
||||
address),
|
||||
obj_desc->region.length);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
acpi_os_printf("String length %X @ %p ",
|
||||
|
@ -307,17 +294,15 @@ acpi_ex_dump_operand (
|
|||
acpi_os_printf("\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
|
||||
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",
|
||||
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,
|
||||
|
@ -328,40 +313,35 @@ acpi_ex_dump_operand (
|
|||
acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||
|
||||
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",
|
||||
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) {
|
||||
} 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);
|
||||
} else {
|
||||
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
|
||||
depth + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_EVENT:
|
||||
|
||||
acpi_os_printf("Event\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
|
||||
acpi_os_printf("Method(%X) @ %p:%X\n",
|
||||
|
@ -370,48 +350,42 @@ acpi_ex_dump_operand (
|
|||
obj_desc->method.aml_length);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_MUTEX:
|
||||
|
||||
acpi_os_printf("Mutex\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_DEVICE:
|
||||
|
||||
acpi_os_printf("Device\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_POWER:
|
||||
|
||||
acpi_os_printf("Power\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PROCESSOR:
|
||||
|
||||
acpi_os_printf("Processor\n");
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_THERMAL:
|
||||
|
||||
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,21 +403,16 @@ acpi_ex_dump_operand (
|
|||
******************************************************************************/
|
||||
|
||||
void
|
||||
acpi_ex_dump_operands (
|
||||
union acpi_operand_object **operands,
|
||||
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)
|
||||
char *note, char *module_name, u32 line_number)
|
||||
{
|
||||
acpi_native_uint i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_NAME("ex_dump_operands");
|
||||
|
||||
|
||||
if (!ident) {
|
||||
ident = "?";
|
||||
}
|
||||
|
@ -467,12 +436,11 @@ acpi_ex_dump_operands (
|
|||
}
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||
"************* Stack dump from %s(%d), %s\n",
|
||||
"************* Operand Stack dump from %s(%d), %s\n",
|
||||
module_name, line_number, note));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ACPI_FUTURE_USAGE
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -487,34 +455,22 @@ 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -524,7 +480,6 @@ acpi_ex_out_address (
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_dump_node
|
||||
|
@ -536,17 +491,15 @@ 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();
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -556,18 +509,143 @@ acpi_ex_dump_node (
|
|||
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("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,38 +653,36 @@ 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");
|
||||
|
||||
|
||||
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_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);
|
||||
((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",
|
||||
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;
|
||||
}
|
||||
|
@ -614,7 +690,8 @@ acpi_ex_dump_object_descriptor (
|
|||
/* 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("Reference Count",
|
||||
obj_desc->common.reference_count);
|
||||
acpi_ex_out_integer("Flags", obj_desc->common.flags);
|
||||
|
||||
/* Object-specific Fields */
|
||||
|
@ -626,81 +703,72 @@ acpi_ex_dump_object_descriptor (
|
|||
ACPI_FORMAT_UINT64(obj_desc->integer.value));
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
acpi_ex_out_integer("Length", obj_desc->string.length);
|
||||
|
||||
acpi_os_printf ("%20s : %p ", "Pointer", obj_desc->string.pointer);
|
||||
acpi_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_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("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_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("system_notify",
|
||||
obj_desc->device.system_notify);
|
||||
acpi_ex_out_pointer("device_notify",
|
||||
obj_desc->device.device_notify);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_EVENT:
|
||||
|
||||
acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_METHOD:
|
||||
|
||||
acpi_ex_out_integer ("param_count", obj_desc->method.param_count);
|
||||
acpi_ex_out_integer ("Concurrency", obj_desc->method.concurrency);
|
||||
acpi_ex_out_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("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("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);
|
||||
|
@ -711,66 +779,87 @@ acpi_ex_dump_object_descriptor (
|
|||
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("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_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("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_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,49 +868,46 @@ 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("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);
|
||||
}
|
||||
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_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("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);
|
||||
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_os_printf
|
||||
("ex_dump_object_descriptor: Display not implemented for object type %s\n",
|
||||
acpi_ut_get_object_type_name(obj_desc));
|
||||
break;
|
||||
}
|
||||
|
@ -831,4 +917,3 @@ acpi_ex_dump_object_descriptor (
|
|||
|
||||
#endif /* ACPI_FUTURE_USAGE */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -41,16 +41,13 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exfield")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_read_data_from_field
|
||||
|
@ -65,10 +62,8 @@
|
|||
* Buffer, depending on the size of the field.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_read_data_from_field (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
{
|
||||
|
@ -78,15 +73,16 @@ acpi_ex_read_data_from_field (
|
|||
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);
|
||||
}
|
||||
if (!ret_buffer_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
||||
/*
|
||||
|
@ -99,29 +95,36 @@ acpi_ex_read_data_from_field (
|
|||
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);
|
||||
}
|
||||
|
||||
/* 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_CAST_PTR(acpi_integer,
|
||||
buffer_desc->
|
||||
buffer.pointer),
|
||||
ACPI_READ | (obj_desc->field.
|
||||
attribute << 16));
|
||||
acpi_ex_release_global_lock(locked);
|
||||
goto exit;
|
||||
}
|
||||
|
@ -136,7 +139,8 @@ 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 */
|
||||
|
||||
|
@ -145,8 +149,7 @@ acpi_ex_read_data_from_field (
|
|||
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);
|
||||
|
@ -161,7 +164,8 @@ acpi_ex_read_data_from_field (
|
|||
|
||||
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));
|
||||
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,
|
||||
|
@ -170,26 +174,24 @@ acpi_ex_read_data_from_field (
|
|||
|
||||
/* 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);
|
||||
|
||||
|
||||
exit:
|
||||
if (ACPI_FAILURE(status)) {
|
||||
acpi_ut_remove_reference(buffer_desc);
|
||||
}
|
||||
else if (ret_buffer_desc) {
|
||||
} else {
|
||||
*ret_buffer_desc = buffer_desc;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_write_data_to_field
|
||||
|
@ -205,8 +207,7 @@ exit:
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_write_data_to_field (
|
||||
union acpi_operand_object *source_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)
|
||||
{
|
||||
|
@ -218,10 +219,8 @@ acpi_ex_write_data_to_field (
|
|||
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) {
|
||||
|
@ -239,9 +238,10 @@ acpi_ex_write_data_to_field (
|
|||
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.
|
||||
|
@ -249,21 +249,19 @@ acpi_ex_write_data_to_field (
|
|||
* 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)));
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -274,7 +272,9 @@ acpi_ex_write_data_to_field (
|
|||
|
||||
/* 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
|
||||
|
@ -283,7 +283,8 @@ acpi_ex_write_data_to_field (
|
|||
*/
|
||||
status = acpi_ex_access_region(obj_desc, 0,
|
||||
(acpi_integer *) buffer,
|
||||
ACPI_WRITE | (obj_desc->field.attribute << 16));
|
||||
ACPI_WRITE | (obj_desc->field.
|
||||
attribute << 16));
|
||||
acpi_ex_release_global_lock(locked);
|
||||
|
||||
*result_desc = buffer_desc;
|
||||
|
@ -319,8 +320,8 @@ 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 */
|
||||
|
@ -342,12 +343,15 @@ acpi_ex_write_data_to_field (
|
|||
|
||||
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)),
|
||||
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)),
|
||||
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,
|
||||
|
@ -355,7 +359,8 @@ acpi_ex_write_data_to_field (
|
|||
|
||||
/* 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 */
|
||||
|
||||
|
@ -370,5 +375,3 @@ acpi_ex_write_data_to_field (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,37 +41,29 @@
|
|||
* 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")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_field_datum_io (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
|
||||
u32 field_datum_byte_offset,
|
||||
acpi_integer *value,
|
||||
u32 read_write);
|
||||
acpi_integer * value, u32 read_write);
|
||||
|
||||
static u8
|
||||
acpi_ex_register_overflow (
|
||||
union acpi_operand_object *obj_desc,
|
||||
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,
|
||||
acpi_ex_setup_region(union acpi_operand_object *obj_desc,
|
||||
u32 field_datum_byte_offset);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_setup_region
|
||||
|
@ -89,23 +81,21 @@ acpi_ex_setup_region (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_setup_region (
|
||||
union acpi_operand_object *obj_desc,
|
||||
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);
|
||||
|
||||
|
||||
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_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)));
|
||||
|
||||
|
@ -128,7 +118,6 @@ acpi_ex_setup_region (
|
|||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
#ifdef ACPI_UNDER_DEVELOPMENT
|
||||
/*
|
||||
* If the Field access is any_acc, we can now compute the optimal
|
||||
|
@ -148,7 +137,8 @@ acpi_ex_setup_region (
|
|||
*/
|
||||
if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
|
||||
field_datum_byte_offset +
|
||||
obj_desc->common_field.access_byte_width)) {
|
||||
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
|
||||
|
@ -156,15 +146,17 @@ acpi_ex_setup_region (
|
|||
* access width boundary.
|
||||
*/
|
||||
if (ACPI_ROUND_UP(rgn_desc->region.length,
|
||||
obj_desc->common_field.access_byte_width) >=
|
||||
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)) {
|
||||
(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
|
||||
|
@ -172,9 +164,13 @@ acpi_ex_setup_region (
|
|||
*/
|
||||
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),
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -184,9 +180,11 @@ acpi_ex_setup_region (
|
|||
*/
|
||||
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),
|
||||
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,
|
||||
field_datum_byte_offset,
|
||||
obj_desc->common_field.access_byte_width,
|
||||
acpi_ut_get_node_name(rgn_desc->region.node),
|
||||
rgn_desc->region.length));
|
||||
|
||||
|
@ -196,7 +194,6 @@ acpi_ex_setup_region (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_access_region
|
||||
|
@ -216,20 +213,16 @@ acpi_ex_setup_region (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_access_region (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_access_region(union acpi_operand_object *obj_desc,
|
||||
u32 field_datum_byte_offset,
|
||||
acpi_integer *value,
|
||||
u32 function)
|
||||
acpi_integer * value, u32 function)
|
||||
{
|
||||
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
|
||||
|
@ -248,19 +241,18 @@ 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 {
|
||||
} 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),
|
||||
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,
|
||||
|
@ -271,19 +263,24 @@ acpi_ex_access_region (
|
|||
|
||||
status = acpi_ev_address_space_dispatch(rgn_desc, function,
|
||||
address,
|
||||
ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
|
||||
ACPI_MUL_8(obj_desc->
|
||||
common_field.
|
||||
access_byte_width),
|
||||
value);
|
||||
|
||||
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),
|
||||
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),
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +288,6 @@ acpi_ex_access_region (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_register_overflow
|
||||
|
@ -310,8 +306,7 @@ acpi_ex_access_region (
|
|||
******************************************************************************/
|
||||
|
||||
static u8
|
||||
acpi_ex_register_overflow (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
|
||||
acpi_integer value)
|
||||
{
|
||||
|
||||
|
@ -336,7 +331,6 @@ acpi_ex_register_overflow (
|
|||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_field_datum_io
|
||||
|
@ -356,19 +350,15 @@ acpi_ex_register_overflow (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_field_datum_io (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
|
||||
u32 field_datum_byte_offset,
|
||||
acpi_integer *value,
|
||||
u32 read_write)
|
||||
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);
|
||||
|
||||
|
||||
if (read_write == ACPI_READ) {
|
||||
if (!value) {
|
||||
local_value = 0;
|
||||
|
@ -411,26 +401,26 @@ acpi_ex_field_datum_io (
|
|||
* Length is the field width in bytes.
|
||||
*/
|
||||
ACPI_MEMCPY(value,
|
||||
(obj_desc->buffer_field.buffer_obj)->buffer.pointer +
|
||||
(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 {
|
||||
} 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 +
|
||||
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);
|
||||
field_datum_byte_offset, value,
|
||||
obj_desc->common_field.access_byte_width);
|
||||
}
|
||||
|
||||
status = AE_OK;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
|
||||
/*
|
||||
|
@ -438,7 +428,8 @@ acpi_ex_field_datum_io (
|
|||
* the register
|
||||
*/
|
||||
if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
|
||||
(acpi_integer) obj_desc->bank_field.value)) {
|
||||
(acpi_integer) obj_desc->
|
||||
bank_field.value)) {
|
||||
return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
|
||||
}
|
||||
|
||||
|
@ -446,9 +437,11 @@ acpi_ex_field_datum_io (
|
|||
* 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,
|
||||
status =
|
||||
acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj,
|
||||
&obj_desc->bank_field.value,
|
||||
sizeof (obj_desc->bank_field.value));
|
||||
sizeof(obj_desc->bank_field.
|
||||
value));
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -460,26 +453,25 @@ 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)) {
|
||||
(acpi_integer) obj_desc->
|
||||
index_field.value)) {
|
||||
return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
|
||||
}
|
||||
|
||||
|
@ -491,7 +483,8 @@ acpi_ex_field_datum_io (
|
|||
"Write to Index Register: Value %8.8X\n",
|
||||
field_datum_byte_offset));
|
||||
|
||||
status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
|
||||
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)) {
|
||||
|
@ -505,18 +498,20 @@ acpi_ex_field_datum_io (
|
|||
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",
|
||||
|
@ -530,20 +525,20 @@ acpi_ex_field_datum_io (
|
|||
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 {
|
||||
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));
|
||||
obj_desc->common_field.
|
||||
access_byte_width));
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_write_with_update_rule
|
||||
|
@ -560,8 +555,7 @@ acpi_ex_field_datum_io (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_write_with_update_rule (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
|
||||
acpi_integer mask,
|
||||
acpi_integer field_value,
|
||||
u32 field_datum_byte_offset)
|
||||
|
@ -570,10 +564,8 @@ acpi_ex_write_with_update_rule (
|
|||
acpi_integer merged_value;
|
||||
acpi_integer current_value;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
|
||||
|
||||
|
||||
/* Start with the new bits */
|
||||
|
||||
merged_value = field_value;
|
||||
|
@ -583,20 +575,25 @@ 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) {
|
||||
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,
|
||||
¤t_value, ACPI_READ);
|
||||
status =
|
||||
acpi_ex_field_datum_io(obj_desc,
|
||||
field_datum_byte_offset,
|
||||
¤t_value,
|
||||
ACPI_READ);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -623,7 +620,9 @@ acpi_ex_write_with_update_rule (
|
|||
|
||||
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)));
|
||||
(obj_desc->common_field.
|
||||
field_flags &
|
||||
AML_FIELD_UPDATE_RULE_MASK)));
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
||||
}
|
||||
}
|
||||
|
@ -644,7 +643,6 @@ acpi_ex_write_with_update_rule (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_extract_from_field
|
||||
|
@ -660,10 +658,8 @@ 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;
|
||||
|
@ -675,17 +671,16 @@ acpi_ex_extract_from_field (
|
|||
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)) {
|
||||
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));
|
||||
obj_desc->common_field.bit_length,
|
||||
buffer_length));
|
||||
|
||||
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
|
||||
}
|
||||
|
@ -693,21 +688,24 @@ acpi_ex_extract_from_field (
|
|||
|
||||
/* 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,
|
||||
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);
|
||||
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 */
|
||||
|
||||
|
@ -738,7 +736,8 @@ acpi_ex_extract_from_field (
|
|||
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 */
|
||||
|
@ -758,7 +757,6 @@ acpi_ex_extract_from_field (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_insert_into_field
|
||||
|
@ -774,10 +772,8 @@ 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;
|
||||
|
@ -790,27 +786,29 @@ acpi_ex_insert_into_field (
|
|||
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)) {
|
||||
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));
|
||||
obj_desc->common_field.bit_length,
|
||||
buffer_length));
|
||||
|
||||
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,
|
||||
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 +
|
||||
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);
|
||||
|
||||
|
@ -820,7 +818,8 @@ acpi_ex_insert_into_field (
|
|||
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 */
|
||||
|
||||
|
@ -829,7 +828,8 @@ acpi_ex_insert_into_field (
|
|||
|
||||
merged_datum &= mask;
|
||||
status = acpi_ex_write_with_update_rule(obj_desc, mask,
|
||||
merged_datum, field_offset);
|
||||
merged_datum,
|
||||
field_offset);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -852,7 +852,8 @@ acpi_ex_insert_into_field (
|
|||
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;
|
||||
merged_datum |=
|
||||
raw_datum << obj_desc->common_field.start_field_bit_offset;
|
||||
}
|
||||
|
||||
/* Mask off any extra bits in the last datum */
|
||||
|
@ -868,9 +869,8 @@ acpi_ex_insert_into_field (
|
|||
|
||||
merged_datum &= mask;
|
||||
status = acpi_ex_write_with_update_rule(obj_desc,
|
||||
mask, merged_datum, field_offset);
|
||||
mask, merged_datum,
|
||||
field_offset);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,16 +42,13 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exmisc")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_get_object_reference
|
||||
|
@ -66,20 +63,16 @@
|
|||
* 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,
|
||||
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);
|
||||
|
||||
|
||||
*return_desc = NULL;
|
||||
|
||||
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
||||
|
@ -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));
|
||||
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,18 +110,16 @@ 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)));
|
||||
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);
|
||||
}
|
||||
|
@ -141,12 +130,12 @@ acpi_ex_get_object_reference (
|
|||
|
||||
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));
|
||||
obj_desc, acpi_ut_get_object_type_name(obj_desc),
|
||||
*return_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_concat_template
|
||||
|
@ -163,8 +152,7 @@ acpi_ex_get_object_reference (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_concat_template (
|
||||
union acpi_operand_object *operand0,
|
||||
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)
|
||||
|
@ -176,10 +164,8 @@ acpi_ex_concat_template (
|
|||
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);
|
||||
|
@ -191,8 +177,7 @@ acpi_ex_concat_template (
|
|||
/* 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 */
|
||||
length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */
|
||||
|
||||
/* Create a new buffer object for the result */
|
||||
|
||||
|
@ -219,7 +204,6 @@ acpi_ex_concat_template (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_do_concatenate
|
||||
|
@ -236,8 +220,7 @@ acpi_ex_concat_template (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_do_concatenate (
|
||||
union acpi_operand_object *operand0,
|
||||
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)
|
||||
|
@ -248,10 +231,8 @@ acpi_ex_do_concatenate (
|
|||
acpi_status status;
|
||||
acpi_size new_length;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ex_do_concatenate");
|
||||
|
||||
|
||||
/*
|
||||
* Convert the second operand if necessary. The first operand
|
||||
* determines the type of the second operand, (See the Data Types
|
||||
|
@ -261,7 +242,8 @@ acpi_ex_do_concatenate (
|
|||
*/
|
||||
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:
|
||||
|
@ -302,8 +284,9 @@ acpi_ex_do_concatenate (
|
|||
/* 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;
|
||||
|
@ -345,8 +328,7 @@ acpi_ex_do_concatenate (
|
|||
|
||||
/* Concatenate the strings */
|
||||
|
||||
ACPI_STRCPY (new_buf,
|
||||
operand0->string.pointer);
|
||||
ACPI_STRCPY(new_buf, operand0->string.pointer);
|
||||
ACPI_STRCPY(new_buf + operand0->string.length,
|
||||
local_operand1->string.pointer);
|
||||
break;
|
||||
|
@ -355,9 +337,12 @@ acpi_ex_do_concatenate (
|
|||
|
||||
/* 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;
|
||||
|
@ -368,8 +353,7 @@ acpi_ex_do_concatenate (
|
|||
/* Concatenate the buffers */
|
||||
|
||||
ACPI_MEMCPY(new_buf,
|
||||
operand0->buffer.pointer,
|
||||
operand0->buffer.length);
|
||||
operand0->buffer.pointer, operand0->buffer.length);
|
||||
ACPI_MEMCPY(new_buf + operand0->buffer.length,
|
||||
local_operand1->buffer.pointer,
|
||||
local_operand1->buffer.length);
|
||||
|
@ -394,7 +378,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_do_math_op
|
||||
|
@ -412,61 +395,48 @@ 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();
|
||||
|
||||
|
||||
switch (opcode) {
|
||||
case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
|
||||
|
||||
return (integer0 + integer1);
|
||||
|
||||
|
||||
case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
|
||||
|
||||
return (integer0 & integer1);
|
||||
|
||||
|
||||
case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
|
||||
|
||||
return (~(integer0 & integer1));
|
||||
|
||||
|
||||
case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
|
||||
|
||||
return (integer0 | integer1);
|
||||
|
||||
|
||||
case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
|
||||
|
||||
return (~(integer0 | integer1));
|
||||
|
||||
|
||||
case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
|
||||
|
||||
return (integer0 ^ integer1);
|
||||
|
||||
|
||||
case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
|
||||
|
||||
return (integer0 * integer1);
|
||||
|
||||
|
||||
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) */
|
||||
|
||||
return (integer0 >> integer1);
|
||||
|
||||
|
||||
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,19 +468,15 @@ acpi_ex_do_math_op (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_do_logical_numeric_op (
|
||||
u16 opcode,
|
||||
acpi_ex_do_logical_numeric_op(u16 opcode,
|
||||
acpi_integer integer0,
|
||||
acpi_integer integer1,
|
||||
u8 *logical_result)
|
||||
acpi_integer integer1, u8 * logical_result)
|
||||
{
|
||||
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) */
|
||||
|
||||
|
@ -538,7 +503,6 @@ acpi_ex_do_logical_numeric_op (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_do_logical_op
|
||||
|
@ -566,11 +530,9 @@ acpi_ex_do_logical_numeric_op (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_do_logical_op (
|
||||
u16 opcode,
|
||||
acpi_ex_do_logical_op(u16 opcode,
|
||||
union acpi_operand_object *operand0,
|
||||
union acpi_operand_object *operand1,
|
||||
u8 *logical_result)
|
||||
union acpi_operand_object *operand1, u8 * logical_result)
|
||||
{
|
||||
union acpi_operand_object *local_operand1 = operand1;
|
||||
acpi_integer integer0;
|
||||
|
@ -581,10 +543,8 @@ acpi_ex_do_logical_op (
|
|||
u8 local_result = FALSE;
|
||||
int compare;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ex_do_logical_op");
|
||||
|
||||
|
||||
/*
|
||||
* Convert the second operand if necessary. The first operand
|
||||
* determines the type of the second operand, (See the Data Types
|
||||
|
@ -594,7 +554,8 @@ acpi_ex_do_logical_op (
|
|||
*/
|
||||
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:
|
||||
|
@ -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
|
||||
|
@ -666,7 +626,8 @@ 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,
|
||||
(const char *)local_operand1->buffer.
|
||||
pointer,
|
||||
(length0 > length1) ? length1 : length0);
|
||||
|
||||
switch (opcode) {
|
||||
|
@ -674,8 +635,7 @@ acpi_ex_do_logical_op (
|
|||
|
||||
/* 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;
|
||||
|
@ -735,5 +695,3 @@ cleanup:
|
|||
*logical_result = local_result;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
|
@ -50,13 +49,10 @@
|
|||
ACPI_MODULE_NAME("exmutex")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static void
|
||||
acpi_ex_link_mutex (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
|
||||
struct acpi_thread_state *thread);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_unlink_mutex
|
||||
|
@ -69,13 +65,10 @@ 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;
|
||||
|
||||
|
||||
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,13 +100,11 @@ acpi_ex_unlink_mutex (
|
|||
******************************************************************************/
|
||||
|
||||
static void
|
||||
acpi_ex_link_mutex (
|
||||
union acpi_operand_object *obj_desc,
|
||||
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
|
||||
struct acpi_thread_state *thread)
|
||||
{
|
||||
union acpi_operand_object *list_head;
|
||||
|
||||
|
||||
list_head = thread->acquired_mutex_list;
|
||||
|
||||
/* This object will be the first object in the list */
|
||||
|
@ -134,7 +123,6 @@ acpi_ex_link_mutex (
|
|||
thread->acquired_mutex_list = obj_desc;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_acquire_mutex
|
||||
|
@ -150,17 +138,14 @@ acpi_ex_link_mutex (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_acquire_mutex (
|
||||
union acpi_operand_object *time_desc,
|
||||
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);
|
||||
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -168,8 +153,7 @@ acpi_ex_acquire_mutex (
|
|||
/* 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)));
|
||||
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,9 +162,7 @@ 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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -215,7 +197,8 @@ acpi_ex_acquire_mutex (
|
|||
|
||||
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;
|
||||
|
||||
|
@ -226,7 +209,6 @@ acpi_ex_acquire_mutex (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_release_mutex
|
||||
|
@ -241,16 +223,13 @@ acpi_ex_acquire_mutex (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_release_mutex (
|
||||
union acpi_operand_object *obj_desc,
|
||||
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");
|
||||
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -258,16 +237,14 @@ acpi_ex_release_mutex (
|
|||
/* 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)));
|
||||
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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -275,13 +252,10 @@ acpi_ex_release_mutex (
|
|||
* 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));
|
||||
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,9 +264,7 @@ 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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -316,12 +288,12 @@ acpi_ex_release_mutex (
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_release_all_mutexes
|
||||
|
@ -334,18 +306,14 @@ 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();
|
||||
|
||||
|
||||
/* Traverse the list of owned mutexes, releasing each one */
|
||||
|
||||
while (next) {
|
||||
|
@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes (
|
|||
thread->current_sync_level = this->mutex.original_sync_level;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
@ -51,17 +50,10 @@
|
|||
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,10 +71,7 @@ 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;
|
||||
|
@ -90,7 +79,6 @@ acpi_ex_allocate_name_string (
|
|||
|
||||
ACPI_FUNCTION_TRACE("ex_allocate_name_string");
|
||||
|
||||
|
||||
/*
|
||||
* Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
|
||||
* Also, one byte for the null terminator.
|
||||
|
@ -100,9 +88,9 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -111,8 +99,7 @@ acpi_ex_allocate_name_string (
|
|||
*/
|
||||
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));
|
||||
ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed));
|
||||
return_PTR(NULL);
|
||||
}
|
||||
|
||||
|
@ -122,14 +109,12 @@ 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) {
|
||||
|
@ -137,8 +122,7 @@ acpi_ex_allocate_name_string (
|
|||
|
||||
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
|
||||
*temp_ptr++ = (char)num_name_segs;
|
||||
}
|
||||
else if (2 == num_name_segs) {
|
||||
} else if (2 == num_name_segs) {
|
||||
/* Set up dual prefixes */
|
||||
|
||||
*temp_ptr++ = AML_DUAL_NAME_PREFIX;
|
||||
|
@ -167,20 +151,15 @@ 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");
|
||||
|
||||
|
||||
/*
|
||||
* If first character is a digit, then we know that we aren't looking at a
|
||||
* valid name segment
|
||||
|
@ -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]));
|
||||
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"));
|
||||
|
||||
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]));
|
||||
}
|
||||
|
||||
|
||||
/* Valid name segment */
|
||||
|
||||
if (index == 4) {
|
||||
|
@ -213,13 +192,11 @@ acpi_ex_name_segment (
|
|||
ACPI_STRCAT(name_string, char_buf);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||
"Appended to - %s \n", name_string));
|
||||
}
|
||||
else {
|
||||
} 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.
|
||||
|
@ -228,8 +205,7 @@ acpi_ex_name_segment (
|
|||
"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
|
||||
|
@ -244,7 +220,6 @@ acpi_ex_name_segment (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_get_name_string
|
||||
|
@ -263,11 +238,9 @@ acpi_ex_name_segment (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_get_name_string (
|
||||
acpi_object_type data_type,
|
||||
acpi_ex_get_name_string(acpi_object_type data_type,
|
||||
u8 * in_aml_address,
|
||||
char **out_name_string,
|
||||
u32 *out_name_length)
|
||||
char **out_name_string, u32 * out_name_length)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u8 *aml_address = in_aml_address;
|
||||
|
@ -276,10 +249,8 @@ acpi_ex_get_name_string (
|
|||
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) {
|
||||
|
@ -288,12 +259,11 @@ acpi_ex_get_name_string (
|
|||
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,7 +271,8 @@ acpi_ex_get_name_string (
|
|||
switch (*aml_address) {
|
||||
case AML_ROOT_PREFIX:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||
"root_prefix(\\) at %p\n",
|
||||
aml_address));
|
||||
|
||||
/*
|
||||
|
@ -313,13 +284,13 @@ 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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||
"parent_prefix (^) at %p\n",
|
||||
aml_address));
|
||||
|
||||
aml_address++;
|
||||
|
@ -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",
|
||||
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,16 +329,19 @@ acpi_ex_get_name_string (
|
|||
|
||||
has_prefix = TRUE;
|
||||
|
||||
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);
|
||||
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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||
"multi_name_prefix at %p\n",
|
||||
aml_address));
|
||||
|
||||
/* Fetch count of segments remaining in name path */
|
||||
|
@ -374,7 +349,9 @@ acpi_ex_get_name_string (
|
|||
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,14 +363,14 @@ 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 */
|
||||
|
@ -406,7 +383,8 @@ acpi_ex_get_name_string (
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acparser.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
@ -50,11 +49,9 @@
|
|||
#include <acpi/amlcode.h>
|
||||
#include <acpi/acnamesp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
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
|
||||
|
@ -88,19 +84,14 @@
|
|||
* 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));
|
||||
|
||||
|
||||
/* Examine the AML opcode */
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
|
@ -113,34 +104,33 @@ acpi_ex_opcode_0A_0T_1R (
|
|||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
return_desc->integer.value = acpi_os_get_timer();
|
||||
#endif
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Delete return object on error */
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_1A_0T_0R
|
||||
|
@ -154,18 +144,14 @@ 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));
|
||||
|
||||
|
||||
/* Examine the AML opcode */
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
|
@ -174,41 +160,35 @@ acpi_ex_opcode_1A_0T_0R (
|
|||
status = acpi_ex_release_mutex(operand[0], walk_state);
|
||||
break;
|
||||
|
||||
|
||||
case AML_RESET_OP: /* Reset (event_object) */
|
||||
|
||||
status = acpi_ex_system_reset_event(operand[0]);
|
||||
break;
|
||||
|
||||
|
||||
case AML_SIGNAL_OP: /* Signal (event_object) */
|
||||
|
||||
status = acpi_ex_system_signal_event(operand[0]);
|
||||
break;
|
||||
|
||||
|
||||
case AML_SLEEP_OP: /* Sleep (msec_time) */
|
||||
|
||||
status = acpi_ex_system_do_suspend(operand[0]->integer.value);
|
||||
break;
|
||||
|
||||
|
||||
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) */
|
||||
|
||||
status = acpi_ex_unload_table(operand[0]);
|
||||
break;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -216,7 +196,6 @@ acpi_ex_opcode_1A_0T_0R (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_1A_1T_0R
|
||||
|
@ -230,18 +209,14 @@ 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));
|
||||
|
||||
|
||||
/* Examine the AML opcode */
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
|
@ -252,19 +227,16 @@ acpi_ex_opcode_1A_1T_0R (
|
|||
|
||||
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:
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_1A_1T_1R
|
||||
|
@ -278,9 +250,7 @@ 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];
|
||||
|
@ -291,11 +261,9 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
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 */
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
|
@ -320,7 +288,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
return_desc->integer.value = ~operand[0]->integer.value;
|
||||
break;
|
||||
|
||||
|
||||
case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */
|
||||
|
||||
return_desc->integer.value = operand[0]->integer.value;
|
||||
|
@ -337,7 +304,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
return_desc->integer.value = temp32;
|
||||
break;
|
||||
|
||||
|
||||
case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
|
||||
|
||||
return_desc->integer.value = operand[0]->integer.value;
|
||||
|
@ -357,7 +323,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
(ACPI_INTEGER_BIT_SIZE + 1) - temp32;
|
||||
break;
|
||||
|
||||
|
||||
case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -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,7 +369,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
|
||||
|
||||
return_desc->integer.value = 0;
|
||||
|
@ -410,15 +376,18 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
|
||||
/* 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 */
|
||||
|
@ -426,13 +395,15 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
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_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) */
|
||||
|
||||
/*
|
||||
|
@ -440,7 +411,8 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
* 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
|
||||
|
@ -452,12 +424,14 @@ 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);
|
||||
&return_desc2,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
status = acpi_ex_store (return_desc2, operand[1], walk_state);
|
||||
status =
|
||||
acpi_ex_store(return_desc2, operand[1], walk_state);
|
||||
acpi_ut_remove_reference(return_desc2);
|
||||
|
||||
/* The object exists in the namespace, return TRUE */
|
||||
|
@ -465,14 +439,12 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
return_desc->integer.value = ACPI_INTEGER_MAX;
|
||||
goto cleanup;
|
||||
|
||||
|
||||
default:
|
||||
/* No other opcodes get here */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_STORE_OP: /* Store (Source, Target) */
|
||||
|
||||
/*
|
||||
|
@ -499,17 +471,16 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
|
||||
/*
|
||||
* ACPI 2.0 Opcodes
|
||||
*/
|
||||
case AML_COPY_OP: /* Copy (Source, Target) */
|
||||
|
||||
status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc,
|
||||
status =
|
||||
acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc,
|
||||
walk_state);
|
||||
break;
|
||||
|
||||
|
||||
case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */
|
||||
|
||||
status = acpi_ex_convert_to_string(operand[0], &return_desc,
|
||||
|
@ -520,7 +491,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */
|
||||
|
||||
status = acpi_ex_convert_to_string(operand[0], &return_desc,
|
||||
|
@ -531,7 +501,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */
|
||||
|
||||
status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
|
||||
|
@ -541,7 +510,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */
|
||||
|
||||
status = acpi_ex_convert_to_integer(operand[0], &return_desc,
|
||||
|
@ -552,7 +520,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
}
|
||||
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) */
|
||||
|
||||
|
@ -564,11 +531,9 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
status = AE_SUPPORT;
|
||||
goto cleanup;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -579,7 +544,6 @@ acpi_ex_opcode_1A_1T_1R (
|
|||
status = acpi_ex_store(return_desc, operand[1], walk_state);
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
if (!walk_state->result_obj) {
|
||||
|
@ -595,7 +559,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_1A_0T_1R
|
||||
|
@ -608,9 +571,7 @@ 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;
|
||||
|
@ -619,11 +580,9 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
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) {
|
||||
|
@ -644,7 +603,6 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_DECREMENT_OP: /* Decrement (Operand) */
|
||||
case AML_INCREMENT_OP: /* Increment (Operand) */
|
||||
|
||||
|
@ -663,7 +621,8 @@ 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);
|
||||
|
@ -676,10 +635,14 @@ 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);
|
||||
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_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,10 +653,11 @@ 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 */
|
||||
|
@ -707,7 +671,6 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
status = acpi_ex_store(return_desc, operand[0], walk_state);
|
||||
break;
|
||||
|
||||
|
||||
case AML_TYPE_OP: /* object_type (source_object) */
|
||||
|
||||
/*
|
||||
|
@ -719,7 +682,9 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
|
||||
/* Get the type of the base object */
|
||||
|
||||
status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL);
|
||||
status =
|
||||
acpi_ex_resolve_multiple(walk_state, operand[0], &type,
|
||||
NULL);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -734,7 +699,6 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
return_desc->integer.value = type;
|
||||
break;
|
||||
|
||||
|
||||
case AML_SIZE_OF_OP: /* size_of (source_object) */
|
||||
|
||||
/*
|
||||
|
@ -745,7 +709,8 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
/* Get the base object */
|
||||
|
||||
status = acpi_ex_resolve_multiple(walk_state,
|
||||
operand[0], &type, &temp_desc);
|
||||
operand[0], &type,
|
||||
&temp_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -797,21 +762,22 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
return_desc->integer.value = value;
|
||||
break;
|
||||
|
||||
|
||||
case AML_REF_OF_OP: /* ref_of (source_object) */
|
||||
|
||||
status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state);
|
||||
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) */
|
||||
|
||||
/* Check for a method local or argument, or standalone String */
|
||||
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
|
||||
ACPI_DESC_TYPE_NAMED) {
|
||||
switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
|
||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||
/*
|
||||
|
@ -825,8 +791,9 @@ 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,
|
||||
status =
|
||||
acpi_ds_method_data_get_value
|
||||
(operand[0]->reference.opcode,
|
||||
operand[0]->reference.offset,
|
||||
walk_state, &temp_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
|
@ -845,7 +812,8 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
|
||||
/* Get the object to which the reference refers */
|
||||
|
||||
temp_desc = operand[0]->reference.object;
|
||||
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,
|
||||
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));
|
||||
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),
|
||||
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,45 +919,38 @@ 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]));
|
||||
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;
|
||||
|
@ -986,8 +958,11 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
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! */
|
||||
|
@ -995,11 +970,12 @@ acpi_ex_opcode_1A_0T_1R (
|
|||
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));
|
||||
operand[0],
|
||||
operand[0]->reference.
|
||||
opcode));
|
||||
|
||||
status = AE_TYPE;
|
||||
goto cleanup;
|
||||
|
@ -1007,16 +983,13 @@ 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:
|
||||
|
||||
/* Delete return object on error */
|
||||
|
@ -1028,4 +1001,3 @@ cleanup:
|
|||
walk_state->result_obj = return_desc;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,18 +41,15 @@
|
|||
* 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")
|
||||
|
||||
|
||||
/*!
|
||||
* 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
|
||||
|
@ -90,21 +85,16 @@
|
|||
* 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));
|
||||
|
||||
|
||||
/* Examine the opcode */
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
|
@ -128,7 +118,6 @@ acpi_ex_opcode_2A_0T_0R (
|
|||
status = AE_AML_OPERAND_TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||
/*
|
||||
* GPE method wake/notify check. Here, we want to ensure that we
|
||||
|
@ -144,8 +133,10 @@ 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 (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 */
|
||||
|
||||
|
@ -164,18 +155,15 @@ acpi_ex_opcode_2A_0T_0R (
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_2A_2T_1R
|
||||
|
@ -189,20 +177,16 @@ 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));
|
||||
|
||||
|
||||
/* Execute the opcode */
|
||||
|
||||
switch (walk_state->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;
|
||||
|
@ -233,11 +219,9 @@ acpi_ex_opcode_2A_2T_1R (
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
@ -258,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
|
|||
|
||||
walk_state->result_obj = return_desc1;
|
||||
|
||||
|
||||
cleanup:
|
||||
/*
|
||||
* Since the remainder is not returned indirectly, remove a reference to
|
||||
|
@ -275,7 +258,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_2A_1T_1R
|
||||
|
@ -289,9 +271,7 @@ 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;
|
||||
|
@ -299,11 +279,9 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
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) {
|
||||
|
@ -315,7 +293,8 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
|
||||
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;
|
||||
|
@ -334,18 +313,15 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
|
||||
status = acpi_ut_divide(operand[0]->integer.value,
|
||||
operand[1]->integer.value,
|
||||
NULL,
|
||||
&return_desc->integer.value);
|
||||
NULL, &return_desc->integer.value);
|
||||
break;
|
||||
|
||||
|
||||
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
|
||||
|
||||
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) */
|
||||
|
||||
/*
|
||||
|
@ -388,7 +364,6 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
operand[0]->buffer.pointer, length);
|
||||
break;
|
||||
|
||||
|
||||
case AML_CONCAT_RES_OP:
|
||||
|
||||
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
|
||||
|
@ -397,12 +372,12 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
&return_desc, walk_state);
|
||||
break;
|
||||
|
||||
|
||||
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;
|
||||
|
@ -418,28 +393,30 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
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_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.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_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.target_type =
|
||||
ACPI_TYPE_BUFFER_FIELD;
|
||||
return_desc->reference.object = operand[0];
|
||||
}
|
||||
|
||||
|
@ -463,16 +440,13 @@ acpi_ex_opcode_2A_1T_1R (
|
|||
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:
|
||||
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
|
@ -490,7 +464,6 @@ store_result_to_target:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Delete return object on error */
|
||||
|
@ -502,7 +475,6 @@ cleanup:
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_2A_0T_1R
|
||||
|
@ -515,20 +487,16 @@ 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));
|
||||
|
||||
|
||||
/* Create the internal return object */
|
||||
|
||||
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||
|
@ -543,11 +511,12 @@ acpi_ex_opcode_2A_0T_1R (
|
|||
/* logical_op (Operand0, Operand1) */
|
||||
|
||||
status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
|
||||
operand[0]->integer.value, operand[1]->integer.value,
|
||||
&logical_result);
|
||||
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],
|
||||
|
@ -558,14 +527,14 @@ acpi_ex_opcode_2A_0T_1R (
|
|||
switch (walk_state->opcode) {
|
||||
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 */
|
||||
status = AE_OK;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_WAIT_OP: /* Wait (event_object, Timeout) */
|
||||
|
||||
status = acpi_ex_system_wait_event(operand[1], operand[0]);
|
||||
|
@ -575,16 +544,13 @@ acpi_ex_opcode_2A_0T_1R (
|
|||
}
|
||||
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:
|
||||
/*
|
||||
* Set return value to according to logical_result. logical TRUE (all ones)
|
||||
|
@ -596,7 +562,6 @@ store_logical_result:
|
|||
|
||||
walk_state->result_obj = return_desc;
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* Delete return object on error */
|
||||
|
@ -607,5 +572,3 @@ cleanup:
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,17 +42,14 @@
|
|||
* 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")
|
||||
|
||||
|
||||
/*!
|
||||
* 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
|
||||
|
@ -87,20 +82,15 @@
|
|||
* 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));
|
||||
|
||||
|
||||
switch (walk_state->opcode) {
|
||||
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
|
||||
|
||||
|
@ -110,7 +100,8 @@ acpi_ex_opcode_3A_0T_0R (
|
|||
(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;
|
||||
|
@ -126,22 +117,18 @@ acpi_ex_opcode_3A_0T_0R (
|
|||
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:
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_3A_1T_1R
|
||||
|
@ -154,22 +141,18 @@ 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;
|
||||
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]) */
|
||||
|
||||
|
@ -177,8 +160,9 @@ acpi_ex_opcode_3A_1T_1R (
|
|||
* 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,45 +177,72 @@ 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)) {
|
||||
if (index >= operand[0]->string.length) {
|
||||
length = 0;
|
||||
}
|
||||
|
||||
/* Truncate request if larger than the actual String/Buffer */
|
||||
|
||||
if ((index + length) >
|
||||
operand[0]->string.length) {
|
||||
else if ((index + length) > operand[0]->string.length) {
|
||||
length = (acpi_size) operand[0]->string.length -
|
||||
(acpi_size) index;
|
||||
}
|
||||
|
||||
/* Allocate a new buffer for the String/Buffer */
|
||||
/* Strings always have a sub-pointer, not so for buffers */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
|
||||
case ACPI_TYPE_STRING:
|
||||
|
||||
/* Always allocate a new buffer for the String */
|
||||
|
||||
buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1);
|
||||
if (!buffer) {
|
||||
status = AE_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
||||
/* If the requested length is zero, don't allocate a buffer */
|
||||
|
||||
if (length > 0) {
|
||||
/* Allocate a new buffer for the Buffer */
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -244,16 +255,14 @@ cleanup:
|
|||
|
||||
/* Delete return object on error */
|
||||
|
||||
if (ACPI_FAILURE (status)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,17 +42,14 @@
|
|||
* 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")
|
||||
|
||||
|
||||
/*!
|
||||
* Naming convention for AML interpreter execution routines.
|
||||
*
|
||||
|
@ -74,16 +71,12 @@
|
|||
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
||||
* fully resolved operands.
|
||||
!*/
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static u8
|
||||
acpi_ex_do_match (
|
||||
u32 match_op,
|
||||
acpi_ex_do_match(u32 match_op,
|
||||
union acpi_operand_object *package_obj,
|
||||
union acpi_operand_object *match_obj);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_do_match
|
||||
|
@ -101,15 +94,13 @@ acpi_ex_do_match (
|
|||
******************************************************************************/
|
||||
|
||||
static u8
|
||||
acpi_ex_do_match (
|
||||
u32 match_op,
|
||||
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;
|
||||
|
||||
|
||||
/*
|
||||
* Note: Since the package_obj/match_obj ordering is opposite to that of
|
||||
* the standard logical operators, we have to reverse them when we call
|
||||
|
@ -133,7 +124,8 @@ 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,
|
||||
status =
|
||||
acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
|
||||
&logical_result);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
|
@ -146,7 +138,8 @@ 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,
|
||||
status =
|
||||
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
|
||||
&logical_result);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
|
@ -160,8 +153,9 @@ 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);
|
||||
status =
|
||||
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
|
||||
package_obj, &logical_result);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
@ -173,8 +167,9 @@ 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);
|
||||
status =
|
||||
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
|
||||
package_obj, &logical_result);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
@ -187,7 +182,8 @@ 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,
|
||||
status =
|
||||
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
|
||||
&logical_result);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return (FALSE);
|
||||
|
@ -204,7 +200,6 @@ acpi_ex_do_match (
|
|||
return logical_result;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_opcode_6A_0T_1R
|
||||
|
@ -217,9 +212,7 @@ 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;
|
||||
|
@ -227,11 +220,9 @@ acpi_ex_opcode_6A_0T_1R (
|
|||
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:
|
||||
/*
|
||||
|
@ -243,7 +234,8 @@ acpi_ex_opcode_6A_0T_1R (
|
|||
|
||||
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"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Match operator out of range\n"));
|
||||
status = AE_AML_OPERAND_VALUE;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -254,7 +246,8 @@ acpi_ex_opcode_6A_0T_1R (
|
|||
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_FORMAT_UINT64(index),
|
||||
operand[0]->package.count));
|
||||
status = AE_AML_PACKAGE_LIMIT;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -316,24 +309,20 @@ acpi_ex_opcode_6A_0T_1R (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_LOAD_TABLE_OP:
|
||||
|
||||
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:
|
||||
|
||||
/* Delete return object on error */
|
||||
|
|
|
@ -42,32 +42,24 @@
|
|||
* 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")
|
||||
|
||||
/* 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,10 +84,8 @@ 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;
|
||||
|
@ -107,10 +97,8 @@ acpi_ex_generate_access (
|
|||
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));
|
||||
|
@ -124,7 +112,8 @@ acpi_ex_generate_access (
|
|||
|
||||
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));
|
||||
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,23 +130,29 @@ 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) /
|
||||
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));
|
||||
"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));
|
||||
field_start_offset, field_end_offset,
|
||||
accesses));
|
||||
|
||||
/* Single access is optimal */
|
||||
|
||||
|
@ -175,10 +171,10 @@ acpi_ex_generate_access (
|
|||
minimum_accesses = accesses;
|
||||
minimum_access_width = access_byte_width;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||
"access_width %d end is NOT within region\n", access_byte_width));
|
||||
"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"));
|
||||
|
@ -209,7 +205,6 @@ acpi_ex_generate_access (
|
|||
}
|
||||
#endif /* ACPI_UNDER_DEVELOPMENT */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_decode_field_access
|
||||
|
@ -226,19 +221,15 @@ 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");
|
||||
|
||||
|
||||
access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
|
||||
|
||||
switch (access) {
|
||||
|
@ -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,
|
||||
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 */);
|
||||
0xFFFFFFFF
|
||||
/* Temp until we pass region_length as parameter */
|
||||
);
|
||||
bit_length = byte_alignment * 8;
|
||||
#endif
|
||||
|
||||
|
@ -281,8 +275,7 @@ acpi_ex_decode_field_access (
|
|||
/* Invalid field access type */
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Unknown field access type %X\n",
|
||||
access));
|
||||
"Unknown field access type %X\n", access));
|
||||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
@ -299,7 +292,6 @@ acpi_ex_decode_field_access (
|
|||
return_VALUE(bit_length);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_prep_common_field_object
|
||||
|
@ -322,21 +314,17 @@ acpi_ex_decode_field_access (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_prep_common_field_object (
|
||||
union acpi_operand_object *obj_desc,
|
||||
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 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");
|
||||
|
||||
|
||||
/*
|
||||
* Note: the structure being initialized is the
|
||||
* ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
|
||||
|
@ -394,21 +382,21 @@ acpi_ex_prep_common_field_object (
|
|||
* 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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_prep_field_value
|
||||
|
@ -422,18 +410,14 @@ 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");
|
||||
|
||||
|
||||
/* Parameter validation */
|
||||
|
||||
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
|
||||
|
@ -463,7 +447,9 @@ acpi_ex_prep_field_value (
|
|||
|
||||
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);
|
||||
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);
|
||||
|
@ -474,7 +460,8 @@ 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 */
|
||||
|
||||
|
@ -482,18 +469,19 @@ acpi_ex_prep_field_value (
|
|||
|
||||
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));
|
||||
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.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 */
|
||||
|
||||
|
@ -509,18 +497,18 @@ acpi_ex_prep_field_value (
|
|||
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.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));
|
||||
(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) {
|
||||
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);
|
||||
|
@ -553,12 +541,13 @@ acpi_ex_prep_field_value (
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,15 +42,12 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exregion")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_memory_space_handler
|
||||
|
@ -68,15 +65,12 @@
|
|||
* DESCRIPTION: Handler for the System Memory address space (Op Region)
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_system_memory_space_handler (
|
||||
u32 function,
|
||||
acpi_ex_system_memory_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
void *handler_context, void *region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
void *logical_addr_ptr = NULL;
|
||||
|
@ -89,7 +83,6 @@ acpi_ex_system_memory_space_handler (
|
|||
|
||||
ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
|
||||
|
||||
|
||||
/* Validate and translate the bit width */
|
||||
|
||||
switch (bit_width) {
|
||||
|
@ -110,7 +103,8 @@ acpi_ex_system_memory_space_handler (
|
|||
break;
|
||||
|
||||
default:
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Invalid system_memory width %d\n",
|
||||
bit_width));
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
||||
}
|
||||
|
@ -120,7 +114,8 @@ 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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -160,11 +156,13 @@ 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);
|
||||
(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));
|
||||
ACPI_FORMAT_UINT64(address),
|
||||
(u32) window_size));
|
||||
mem_info->mapped_length = 0;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -185,8 +183,7 @@ acpi_ex_system_memory_space_handler (
|
|||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"system_memory %d (%d width) Address=%8.8X%8.8X\n",
|
||||
function, bit_width,
|
||||
ACPI_FORMAT_UINT64 (address)));
|
||||
function, bit_width, ACPI_FORMAT_UINT64(address)));
|
||||
|
||||
/*
|
||||
* Perform the memory read or write
|
||||
|
@ -259,7 +256,6 @@ acpi_ex_system_memory_space_handler (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_io_space_handler
|
||||
|
@ -279,24 +275,20 @@ acpi_ex_system_memory_space_handler (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_system_io_space_handler (
|
||||
u32 function,
|
||||
acpi_ex_system_io_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
void *handler_context, void *region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
u32 value32;
|
||||
|
||||
|
||||
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)));
|
||||
"system_iO %d (%d width) Address=%8.8X%8.8X\n",
|
||||
function, bit_width, ACPI_FORMAT_UINT64(address)));
|
||||
|
||||
/* Decode the function parameter */
|
||||
|
||||
|
@ -322,7 +314,6 @@ acpi_ex_system_io_space_handler (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_pci_config_space_handler
|
||||
|
@ -342,22 +333,18 @@ acpi_ex_system_io_space_handler (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_pci_config_space_handler (
|
||||
u32 function,
|
||||
acpi_ex_pci_config_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
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");
|
||||
|
||||
|
||||
/*
|
||||
* The arguments to acpi_os(Read|Write)pci_configuration are:
|
||||
*
|
||||
|
@ -375,8 +362,8 @@ acpi_ex_pci_config_space_handler (
|
|||
|
||||
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));
|
||||
function, bit_width, pci_id->segment, pci_id->bus,
|
||||
pci_id->device, pci_id->function, pci_register));
|
||||
|
||||
switch (function) {
|
||||
case ACPI_READ:
|
||||
|
@ -401,7 +388,6 @@ acpi_ex_pci_config_space_handler (
|
|||
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_ex_cmos_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
void *handler_context, void *region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
|
||||
|
||||
|
||||
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_ex_pci_bar_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
void *handler_context, void *region_context)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
|
||||
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_data_table_space_handler
|
||||
|
@ -495,23 +471,19 @@ acpi_ex_pci_bar_space_handler (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_data_table_space_handler (
|
||||
u32 function,
|
||||
acpi_ex_data_table_space_handler(u32 function,
|
||||
acpi_physical_address address,
|
||||
u32 bit_width,
|
||||
acpi_integer * value,
|
||||
void *handler_context,
|
||||
void *region_context)
|
||||
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_FUNCTION_TRACE("ex_data_table_space_handler");
|
||||
|
||||
|
||||
logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
|
||||
|
||||
/* Perform the memory read or write */
|
||||
|
@ -532,5 +504,3 @@ acpi_ex_data_table_space_handler (
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
@ -50,11 +49,9 @@
|
|||
#include <acpi/acparser.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exresnte")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_node_to_value
|
||||
|
@ -80,12 +77,9 @@
|
|||
* ACPI_TYPE_PACKAGE
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_resolve_node_to_value (
|
||||
struct acpi_namespace_node **object_ptr,
|
||||
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;
|
||||
|
@ -93,10 +87,8 @@ acpi_ex_resolve_node_to_value (
|
|||
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.
|
||||
|
@ -106,7 +98,8 @@ acpi_ex_resolve_node_to_value (
|
|||
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)));
|
||||
node, source_desc,
|
||||
acpi_ut_get_type_name(entry_type)));
|
||||
|
||||
if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
|
||||
(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
|
||||
|
@ -129,8 +122,8 @@ acpi_ex_resolve_node_to_value (
|
|||
}
|
||||
|
||||
if (!source_desc) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
|
||||
node));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"No object attached to node %p\n", node));
|
||||
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||
}
|
||||
|
||||
|
@ -142,8 +135,10 @@ acpi_ex_resolve_node_to_value (
|
|||
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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -156,12 +151,13 @@ acpi_ex_resolve_node_to_value (
|
|||
}
|
||||
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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -174,12 +170,13 @@ acpi_ex_resolve_node_to_value (
|
|||
}
|
||||
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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -189,12 +186,13 @@ acpi_ex_resolve_node_to_value (
|
|||
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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -204,7 +202,6 @@ acpi_ex_resolve_node_to_value (
|
|||
acpi_ut_add_reference(obj_desc);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||
|
@ -214,7 +211,9 @@ acpi_ex_resolve_node_to_value (
|
|||
"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 */
|
||||
|
@ -243,7 +242,6 @@ acpi_ex_resolve_node_to_value (
|
|||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
|
||||
|
||||
|
||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||
|
||||
switch (source_desc->reference.opcode) {
|
||||
|
@ -262,13 +260,14 @@ acpi_ex_resolve_node_to_value (
|
|||
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_ps_get_opcode_name(source_desc->
|
||||
reference.
|
||||
opcode)));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Default case is for unknown types */
|
||||
|
@ -281,11 +280,8 @@ acpi_ex_resolve_node_to_value (
|
|||
|
||||
} /* switch (entry_type) */
|
||||
|
||||
|
||||
/* Return the object descriptor */
|
||||
|
||||
*object_ptr = (void *)obj_desc;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/amlcode.h>
|
||||
#include <acpi/acdispat.h>
|
||||
|
@ -50,18 +49,14 @@
|
|||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acparser.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exresolv")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_resolve_object_to_value (
|
||||
union acpi_operand_object **stack_ptr,
|
||||
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
||||
struct acpi_walk_state *walk_state);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_to_value
|
||||
|
@ -78,16 +73,13 @@ acpi_ex_resolve_object_to_value (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_resolve_to_value (
|
||||
union acpi_operand_object **stack_ptr,
|
||||
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);
|
||||
|
||||
|
||||
if (!stack_ptr || !*stack_ptr) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
|
||||
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||
|
@ -105,7 +97,8 @@ acpi_ex_resolve_to_value (
|
|||
}
|
||||
|
||||
if (!*stack_ptr) {
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Internal - null pointer\n"));
|
||||
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||
}
|
||||
}
|
||||
|
@ -115,9 +108,10 @@ acpi_ex_resolve_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);
|
||||
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);
|
||||
}
|
||||
|
@ -127,7 +121,6 @@ acpi_ex_resolve_to_value (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_object_to_value
|
||||
|
@ -143,8 +136,7 @@ acpi_ex_resolve_to_value (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_resolve_object_to_value (
|
||||
union acpi_operand_object **stack_ptr,
|
||||
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
@ -153,10 +145,8 @@ acpi_ex_resolve_object_to_value (
|
|||
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 */
|
||||
|
@ -184,7 +174,6 @@ acpi_ex_resolve_object_to_value (
|
|||
(*stack_ptr) = temp_node;
|
||||
break;
|
||||
|
||||
|
||||
case AML_LOCAL_OP:
|
||||
case AML_ARG_OP:
|
||||
|
||||
|
@ -193,13 +182,18 @@ acpi_ex_resolve_object_to_value (
|
|||
* 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);
|
||||
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
|
||||
|
@ -209,7 +203,6 @@ acpi_ex_resolve_object_to_value (
|
|||
*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;
|
||||
|
@ -231,8 +223,7 @@ acpi_ex_resolve_object_to_value (
|
|||
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
|
||||
|
@ -244,20 +235,16 @@ acpi_ex_resolve_object_to_value (
|
|||
}
|
||||
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:
|
||||
|
@ -277,27 +264,22 @@ acpi_ex_resolve_object_to_value (
|
|||
|
||||
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);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
|
||||
status = acpi_ds_get_package_arguments(stack_desc);
|
||||
break;
|
||||
|
||||
|
||||
/* These cases may never happen here, but just in case.. */
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
|
@ -305,10 +287,14 @@ acpi_ex_resolve_object_to_value (
|
|||
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);
|
||||
status =
|
||||
acpi_ex_read_data_from_field(walk_state, stack_desc,
|
||||
&obj_desc);
|
||||
*stack_ptr = (void *)obj_desc;
|
||||
break;
|
||||
|
||||
|
@ -319,7 +305,6 @@ acpi_ex_resolve_object_to_value (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_multiple
|
||||
|
@ -337,8 +322,7 @@ acpi_ex_resolve_object_to_value (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_resolve_multiple (
|
||||
struct acpi_walk_state *walk_state,
|
||||
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)
|
||||
|
@ -348,10 +332,8 @@ acpi_ex_resolve_multiple (
|
|||
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)) {
|
||||
|
@ -361,13 +343,18 @@ acpi_ex_resolve_multiple (
|
|||
|
||||
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);
|
||||
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);
|
||||
obj_desc =
|
||||
acpi_ns_get_attached_object((struct
|
||||
acpi_namespace_node *)
|
||||
obj_desc);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -397,10 +384,9 @@ 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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -421,7 +407,6 @@ acpi_ex_resolve_multiple (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_INDEX_OP:
|
||||
|
||||
/* Get the type of this reference (index into another object) */
|
||||
|
@ -447,7 +432,6 @@ acpi_ex_resolve_multiple (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_INT_NAMEPATH_OP:
|
||||
|
||||
/* Dereference the reference pointer */
|
||||
|
@ -456,10 +440,9 @@ 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)));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -480,21 +463,33 @@ acpi_ex_resolve_multiple (
|
|||
}
|
||||
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);
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
|
@ -507,7 +502,6 @@ acpi_ex_resolve_multiple (
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_DEBUG_OP:
|
||||
|
||||
/* The Debug Object is of type "debug_object" */
|
||||
|
@ -515,12 +509,9 @@ 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));
|
||||
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
|
||||
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
@ -531,7 +522,6 @@ acpi_ex_resolve_multiple (
|
|||
*/
|
||||
type = ACPI_GET_OBJECT_TYPE(obj_desc);
|
||||
|
||||
|
||||
exit:
|
||||
/* Convert internal types to external types */
|
||||
|
||||
|
@ -561,5 +551,3 @@ exit:
|
|||
}
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,24 +42,18 @@
|
|||
* 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")
|
||||
|
||||
/* 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,14 +70,11 @@ 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");
|
||||
|
||||
|
||||
if (type_needed == ACPI_TYPE_ANY) {
|
||||
/* All types OK, so we don't perform any typechecks */
|
||||
|
||||
|
@ -97,7 +88,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +106,6 @@ acpi_ex_check_object_type (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_operands
|
||||
|
@ -137,8 +128,7 @@ acpi_ex_check_object_type (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_resolve_operands (
|
||||
u16 opcode,
|
||||
acpi_ex_resolve_operands(u16 opcode,
|
||||
union acpi_operand_object ** stack_ptr,
|
||||
struct acpi_walk_state * walk_state)
|
||||
{
|
||||
|
@ -152,10 +142,8 @@ acpi_ex_resolve_operands (
|
|||
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);
|
||||
|
@ -163,8 +151,7 @@ acpi_ex_resolve_operands (
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -182,8 +169,7 @@ acpi_ex_resolve_operands (
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
@ -199,10 +185,10 @@ acpi_ex_resolve_operands (
|
|||
|
||||
/* 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 */
|
||||
|
@ -241,30 +227,39 @@ acpi_ex_resolve_operands (
|
|||
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,
|
||||
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)));
|
||||
(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));
|
||||
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)));
|
||||
obj_desc,
|
||||
acpi_ut_get_descriptor_name
|
||||
(obj_desc)));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
@ -281,8 +276,10 @@ acpi_ex_resolve_operands (
|
|||
switch (this_arg_type) {
|
||||
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
|
||||
|
@ -308,11 +305,13 @@ acpi_ex_resolve_operands (
|
|||
* 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,
|
||||
status =
|
||||
acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
|
||||
object_type, obj_desc);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -327,7 +326,6 @@ acpi_ex_resolve_operands (
|
|||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
case ARGI_DATAREFOBJ: /* Store operator only */
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -403,7 +403,6 @@ acpi_ex_resolve_operands (
|
|||
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
|
||||
break;
|
||||
|
||||
|
||||
/*
|
||||
* The more complex cases allow multiple resolved object types
|
||||
*/
|
||||
|
@ -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);
|
||||
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_ut_get_object_type_name
|
||||
(obj_desc),
|
||||
obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
if (obj_desc != *stack_ptr) {
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
case ARGI_BUFFER:
|
||||
|
||||
|
@ -441,15 +446,20 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc),
|
||||
obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
if (obj_desc != *stack_ptr) {
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
case ARGI_STRING:
|
||||
|
||||
|
@ -464,15 +474,20 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc),
|
||||
obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
if (obj_desc != *stack_ptr) {
|
||||
acpi_ut_remove_reference(obj_desc);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
case ARGI_COMPUTEDATA:
|
||||
|
||||
|
@ -489,13 +504,13 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
case ARGI_BUFFER_OR_STRING:
|
||||
|
||||
/* Need an operand of type STRING or BUFFER */
|
||||
|
@ -511,22 +526,28 @@ acpi_ex_resolve_operands (
|
|||
|
||||
/* Highest priority conversion is to type Buffer */
|
||||
|
||||
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
|
||||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
case ARGI_DATAOBJECT:
|
||||
/*
|
||||
* ARGI_DATAOBJECT is only used by the size_of operator.
|
||||
|
@ -547,13 +568,13 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
case ARGI_COMPLEXOBJ:
|
||||
|
||||
/* Need a buffer or package or (ACPI 2.0) String */
|
||||
|
@ -569,13 +590,13 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
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 */
|
||||
|
@ -592,13 +613,13 @@ acpi_ex_resolve_operands (
|
|||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
case ARGI_DATAREFOBJ:
|
||||
|
||||
/* Used by the Store() operator only */
|
||||
|
@ -637,13 +658,13 @@ acpi_ex_resolve_operands (
|
|||
|
||||
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_ut_get_object_type_name
|
||||
(obj_desc), obj_desc));
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
goto next_operand;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Unknown type */
|
||||
|
@ -660,7 +681,8 @@ acpi_ex_resolve_operands (
|
|||
* required object type (Simple cases only).
|
||||
*/
|
||||
status = acpi_ex_check_object_type(type_needed,
|
||||
ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
|
||||
ACPI_GET_OBJECT_TYPE
|
||||
(*stack_ptr), *stack_ptr);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -677,5 +699,3 @@ next_operand:
|
|||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acdispat.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
@ -50,25 +49,19 @@
|
|||
#include <acpi/acnamesp.h>
|
||||
#include <acpi/acparser.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
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,
|
||||
acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
|
||||
union acpi_operand_object *dest_desc,
|
||||
struct acpi_walk_state *walk_state);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_do_debug_object
|
||||
|
@ -84,17 +77,13 @@ 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;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
|
||||
|
||||
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
|
||||
level, " "));
|
||||
|
||||
|
@ -112,21 +101,25 @@ acpi_ex_do_debug_object (
|
|||
|
||||
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)));
|
||||
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;
|
||||
}
|
||||
}
|
||||
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),
|
||||
"%p, Invalid Internal Object!\n",
|
||||
source_desc));
|
||||
return_VOID;
|
||||
}
|
||||
else {
|
||||
} 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 {
|
||||
return_VOID;
|
||||
}
|
||||
|
||||
|
@ -137,75 +130,86 @@ acpi_ex_do_debug_object (
|
|||
|
||||
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)));
|
||||
(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]",
|
||||
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);
|
||||
(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));
|
||||
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",
|
||||
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),
|
||||
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 {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
|
||||
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
|
||||
acpi_ps_get_opcode_name
|
||||
(source_desc->reference.opcode)));
|
||||
}
|
||||
|
||||
|
||||
if (source_desc->reference.object) {
|
||||
if (ACPI_GET_DESCRIPTOR_TYPE (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,
|
||||
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)));
|
||||
source_desc,
|
||||
acpi_ut_get_object_type_name
|
||||
(source_desc)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -213,7 +217,6 @@ acpi_ex_do_debug_object (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store
|
||||
|
@ -235,18 +238,15 @@ acpi_ex_do_debug_object (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_store (
|
||||
union acpi_operand_object *source_desc,
|
||||
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);
|
||||
|
||||
|
||||
/* Validate parameters */
|
||||
|
||||
if (!source_desc || !dest_desc) {
|
||||
|
@ -262,7 +262,9 @@ acpi_ex_store (
|
|||
* Storing an object into a Named node.
|
||||
*/
|
||||
status = acpi_ex_store_object_to_node(source_desc,
|
||||
(struct acpi_namespace_node *) dest_desc, walk_state,
|
||||
(struct
|
||||
acpi_namespace_node *)
|
||||
dest_desc, walk_state,
|
||||
ACPI_IMPLICIT_CONVERSION);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -290,12 +292,14 @@ acpi_ex_store (
|
|||
|
||||
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_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");
|
||||
2,
|
||||
"Target is not a Reference or Constant object");
|
||||
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
@ -315,29 +319,31 @@ 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);
|
||||
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:
|
||||
|
||||
/*
|
||||
|
@ -346,12 +352,12 @@ acpi_ex_store (
|
|||
*/
|
||||
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)));
|
||||
source_desc,
|
||||
acpi_ut_get_object_type_name(source_desc)));
|
||||
|
||||
acpi_ex_do_debug_object(source_desc, 0, 0);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
|
||||
|
@ -365,7 +371,6 @@ acpi_ex_store (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store_object_to_index
|
||||
|
@ -381,8 +386,7 @@ acpi_ex_store (
|
|||
******************************************************************************/
|
||||
|
||||
static acpi_status
|
||||
acpi_ex_store_object_to_index (
|
||||
union acpi_operand_object *source_desc,
|
||||
acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
|
||||
union acpi_operand_object *index_desc,
|
||||
struct acpi_walk_state *walk_state)
|
||||
{
|
||||
|
@ -392,10 +396,8 @@ acpi_ex_store_object_to_index (
|
|||
u8 value = 0;
|
||||
u32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("ex_store_object_to_index");
|
||||
|
||||
|
||||
/*
|
||||
* Destination must be a reference pointer, and
|
||||
* must point to either a buffer or a package
|
||||
|
@ -413,7 +415,9 @@ 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);
|
||||
status =
|
||||
acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
@ -421,10 +425,9 @@ acpi_ex_store_object_to_index (
|
|||
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++) {
|
||||
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++) {
|
||||
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:
|
||||
|
||||
/*
|
||||
|
@ -491,7 +492,8 @@ acpi_ex_store_object_to_index (
|
|||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Source must be Integer/Buffer/String type, not %s\n",
|
||||
acpi_ut_get_object_type_name (source_desc)));
|
||||
acpi_ut_get_object_type_name
|
||||
(source_desc)));
|
||||
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
|
@ -500,7 +502,6 @@ 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"));
|
||||
|
@ -511,7 +512,6 @@ acpi_ex_store_object_to_index (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store_object_to_node
|
||||
|
@ -539,8 +539,7 @@ acpi_ex_store_object_to_index (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_store_object_to_node (
|
||||
union acpi_operand_object *source_desc,
|
||||
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)
|
||||
|
@ -550,18 +549,17 @@ acpi_ex_store_object_to_node (
|
|||
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);
|
||||
|
||||
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)));
|
||||
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
|
||||
|
@ -574,7 +572,7 @@ acpi_ex_store_object_to_node (
|
|||
|
||||
/* 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;
|
||||
|
@ -594,7 +592,6 @@ acpi_ex_store_object_to_node (
|
|||
&walk_state->result_obj);
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_INTEGER:
|
||||
case ACPI_TYPE_STRING:
|
||||
case ACPI_TYPE_BUFFER:
|
||||
|
@ -605,7 +602,8 @@ 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,
|
||||
status =
|
||||
acpi_ex_store_object_to_object(source_desc, target_desc,
|
||||
&new_desc, walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -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);
|
||||
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)));
|
||||
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));
|
||||
"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));
|
||||
ACPI_GET_OBJECT_TYPE
|
||||
(source_desc));
|
||||
break;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,16 +43,13 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/amlcode.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exstoren")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_resolve_object
|
||||
|
@ -67,20 +64,16 @@
|
|||
* 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_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");
|
||||
|
||||
|
||||
/* Ensure we have a Target that can be stored to */
|
||||
|
||||
switch (target_type) {
|
||||
|
@ -102,10 +95,13 @@ 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);
|
||||
status =
|
||||
acpi_ex_resolve_to_value(source_desc_ptr,
|
||||
walk_state);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
break;
|
||||
}
|
||||
|
@ -122,18 +118,20 @@ acpi_ex_resolve_object (
|
|||
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))) {
|
||||
!((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_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:
|
||||
|
||||
|
@ -143,7 +141,6 @@ acpi_ex_resolve_object (
|
|||
status = AE_AML_INTERNAL;
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_PACKAGE:
|
||||
default:
|
||||
|
||||
|
@ -157,7 +154,6 @@ acpi_ex_resolve_object (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store_object_to_object
|
||||
|
@ -194,8 +190,7 @@ acpi_ex_resolve_object (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_store_object_to_object (
|
||||
union acpi_operand_object *source_desc,
|
||||
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)
|
||||
|
@ -203,10 +198,8 @@ acpi_ex_store_object_to_object (
|
|||
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);
|
||||
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,8 +224,11 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
@ -260,21 +259,20 @@ acpi_ex_store_object_to_object (
|
|||
|
||||
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,
|
||||
status =
|
||||
acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
|
||||
walk_state);
|
||||
break;
|
||||
|
||||
|
@ -282,7 +280,8 @@ acpi_ex_store_object_to_object (
|
|||
/*
|
||||
* All other types come here.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
|
||||
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;
|
||||
|
@ -298,5 +297,3 @@ acpi_ex_store_object_to_object (
|
|||
*new_desc = dest_desc;
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,15 +42,12 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exstorob")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store_buffer_to_buffer
|
||||
|
@ -63,19 +60,15 @@
|
|||
* DESCRIPTION: Copy a buffer object to another buffer object.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_store_buffer_to_buffer (
|
||||
union acpi_operand_object *source_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);
|
||||
|
||||
|
||||
/* We know that source_desc is a buffer by now */
|
||||
|
||||
buffer = (u8 *) source_desc->buffer.pointer;
|
||||
|
@ -100,7 +93,8 @@ 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_MEMSET(target_desc->buffer.pointer, 0,
|
||||
target_desc->buffer.length);
|
||||
ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
|
||||
|
||||
#ifdef ACPI_OBSOLETE_BEHAVIOR
|
||||
|
@ -124,8 +118,7 @@ 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,
|
||||
|
@ -143,7 +136,6 @@ acpi_ex_store_buffer_to_buffer (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_store_string_to_string
|
||||
|
@ -158,17 +150,14 @@ acpi_ex_store_buffer_to_buffer (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_store_string_to_string (
|
||||
union acpi_operand_object *source_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);
|
||||
|
||||
|
||||
/* We know that source_desc is a string by now */
|
||||
|
||||
buffer = (u8 *) source_desc->string.pointer;
|
||||
|
@ -187,8 +176,7 @@ acpi_ex_store_string_to_string (
|
|||
ACPI_MEMSET(target_desc->string.pointer, 0,
|
||||
(acpi_size) target_desc->string.length + 1);
|
||||
ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* Free the current buffer, then allocate a new buffer
|
||||
* large enough to hold the value
|
||||
|
@ -200,8 +188,8 @@ acpi_ex_store_string_to_string (
|
|||
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);
|
||||
}
|
||||
|
@ -215,5 +203,3 @@ acpi_ex_store_string_to_string (
|
|||
target_desc->string.length = length;
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acinterp.h>
|
||||
#include <acpi/acevents.h>
|
||||
|
@ -50,7 +49,6 @@
|
|||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME("exsystem")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_wait_semaphore
|
||||
|
@ -65,19 +63,13 @@
|
|||
* 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_FUNCTION_TRACE("ex_system_wait_semaphore");
|
||||
|
||||
|
||||
status = acpi_os_wait_semaphore(semaphore, 1, 0);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
|
@ -107,7 +99,6 @@ acpi_ex_system_wait_semaphore (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_do_stall
|
||||
|
@ -125,17 +116,13 @@ 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_FUNCTION_ENTRY();
|
||||
|
||||
|
||||
if (how_long > 255) /* 255 microseconds */ {
|
||||
if (how_long > 255) { /* 255 microseconds */
|
||||
/*
|
||||
* Longer than 255 usec, this is an error
|
||||
*
|
||||
|
@ -145,15 +132,13 @@ acpi_ex_system_do_stall (
|
|||
ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n",
|
||||
how_long));
|
||||
status = AE_AML_OPERAND_VALUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
acpi_os_stall(how_long);
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_do_suspend
|
||||
|
@ -167,16 +152,12 @@ 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();
|
||||
|
||||
|
||||
/* Since this thread will sleep, we must release the interpreter */
|
||||
|
||||
acpi_ex_exit_interpreter();
|
||||
|
@ -189,7 +170,6 @@ acpi_ex_system_do_suspend (
|
|||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_acquire_mutex
|
||||
|
@ -206,16 +186,13 @@ acpi_ex_system_do_suspend (
|
|||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ex_system_acquire_mutex (
|
||||
union acpi_operand_object *time_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);
|
||||
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -223,7 +200,8 @@ acpi_ex_system_acquire_mutex (
|
|||
/* 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);
|
||||
status =
|
||||
acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
@ -232,7 +210,6 @@ acpi_ex_system_acquire_mutex (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_release_mutex
|
||||
|
@ -248,16 +225,12 @@ 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");
|
||||
|
||||
|
||||
if (!obj_desc) {
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
@ -273,7 +246,6 @@ acpi_ex_system_release_mutex (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_signal_event
|
||||
|
@ -287,16 +259,12 @@ 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");
|
||||
|
||||
|
||||
if (obj_desc) {
|
||||
status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
|
||||
}
|
||||
|
@ -304,7 +272,6 @@ acpi_ex_system_signal_event (
|
|||
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,
|
||||
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");
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_system_reset_event
|
||||
|
@ -352,22 +317,19 @@ 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();
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
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;
|
||||
|
@ -375,4 +337,3 @@ acpi_ex_system_reset_event (
|
|||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -68,12 +67,7 @@
|
|||
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,15 +83,12 @@ 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");
|
||||
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n"));
|
||||
|
@ -106,7 +97,6 @@ acpi_ex_enter_interpreter (
|
|||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_exit_interpreter
|
||||
|
@ -129,16 +119,12 @@ 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");
|
||||
|
||||
|
||||
status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
ACPI_REPORT_ERROR(("Could not release interpreter mutex\n"));
|
||||
|
@ -147,7 +133,6 @@ acpi_ex_exit_interpreter (
|
|||
return_VOID;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_truncate_for32bit_table
|
||||
|
@ -161,14 +146,11 @@ 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();
|
||||
|
||||
|
||||
/*
|
||||
* Object must be a valid number and we must be executing
|
||||
* a control method
|
||||
|
@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table (
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_acquire_global_lock
|
||||
|
@ -203,17 +184,13 @@ 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");
|
||||
|
||||
|
||||
/* Only attempt lock if the always_lock bit is set */
|
||||
|
||||
if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
|
||||
|
@ -222,8 +199,7 @@ acpi_ex_acquire_global_lock (
|
|||
status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
locked = TRUE;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||
"Could not acquire Global Lock, %s\n",
|
||||
acpi_format_exception(status)));
|
||||
|
@ -233,7 +209,6 @@ acpi_ex_acquire_global_lock (
|
|||
return_VALUE(locked);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_release_global_lock
|
||||
|
@ -247,16 +222,12 @@ 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");
|
||||
|
||||
|
||||
/* Only attempt unlock if the caller locked it */
|
||||
|
||||
if (locked_by_me) {
|
||||
|
@ -266,15 +237,13 @@ acpi_ex_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,18 +258,13 @@ 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");
|
||||
|
||||
|
||||
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
|
||||
|
||||
if (value == 0) {
|
||||
|
@ -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, ¤t_value, NULL);
|
||||
(void)acpi_ut_short_divide(current_value, base, ¤t_value,
|
||||
NULL);
|
||||
num_digits++;
|
||||
}
|
||||
|
||||
return_VALUE(num_digits);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ex_eisa_id_to_string
|
||||
|
@ -334,17 +298,12 @@ 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();
|
||||
|
||||
|
||||
/* Swap ID to big-endian to get contiguous bits */
|
||||
|
||||
eisa_id = acpi_ut_dword_byte_swap(numeric_id);
|
||||
|
@ -359,7 +318,6 @@ acpi_ex_eisa_id_to_string (
|
|||
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();
|
||||
|
||||
|
||||
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);\
|
||||
out_string[count - 1] = (char)('0' + remainder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,14 +34,10 @@
|
|||
#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")
|
||||
|
@ -56,7 +52,7 @@ 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,
|
||||
.ids = "PNP0C0B",
|
||||
.ops = {
|
||||
.add = acpi_fan_add,
|
||||
.remove = acpi_fan_remove,
|
||||
|
@ -67,16 +63,13 @@ struct acpi_fan {
|
|||
acpi_handle handle;
|
||||
};
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
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;
|
||||
|
@ -99,11 +92,8 @@ 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;
|
||||
|
@ -137,9 +127,7 @@ static struct file_operations acpi_fan_state_ops = {
|
|||
.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;
|
||||
|
||||
|
@ -158,7 +146,8 @@ 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",
|
||||
|
@ -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,14 +174,11 @@ 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;
|
||||
|
@ -213,7 +195,7 @@ 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;
|
||||
|
||||
|
@ -239,11 +221,7 @@ end:
|
|||
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;
|
||||
|
||||
|
@ -261,9 +239,7 @@ acpi_fan_remove (
|
|||
return_VALUE(0);
|
||||
}
|
||||
|
||||
|
||||
static int __init
|
||||
acpi_fan_init (void)
|
||||
static int __init acpi_fan_init(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -42,14 +42,11 @@
|
|||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_HARDWARE
|
||||
ACPI_MODULE_NAME("hwacpi")
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_hw_initialize
|
||||
|
@ -62,17 +59,12 @@
|
|||
* the FADT.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_hw_initialize (
|
||||
void)
|
||||
acpi_status acpi_hw_initialize(void)
|
||||
{
|
||||
acpi_status status;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE("hw_initialize");
|
||||
|
||||
|
||||
/* We must have the ACPI tables by the time we get here */
|
||||
|
||||
if (!acpi_gbl_FADT) {
|
||||
|
@ -91,7 +83,6 @@ acpi_hw_initialize (
|
|||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_hw_set_mode
|
||||
|
@ -104,15 +95,12 @@ 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_FUNCTION_TRACE("hw_set_mode");
|
||||
|
||||
/*
|
||||
|
@ -132,8 +120,7 @@ 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"));
|
||||
ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
||||
|
@ -143,8 +130,10 @@ 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"));
|
||||
(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:
|
||||
|
@ -154,7 +143,8 @@ acpi_hw_set_mode (
|
|||
* enable bits to default
|
||||
*/
|
||||
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||
(u32) acpi_gbl_FADT->acpi_disable, 8);
|
||||
(u32) acpi_gbl_FADT->acpi_disable,
|
||||
8);
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Attempting to enable Legacy (non-ACPI) mode\n"));
|
||||
break;
|
||||
|
@ -176,7 +166,8 @@ 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",
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||
"Mode %X successfully enabled\n",
|
||||
mode));
|
||||
return_ACPI_STATUS(AE_OK);
|
||||
}
|
||||
|
@ -188,7 +179,6 @@ acpi_hw_set_mode (
|
|||
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_hw_get_mode
|
||||
|
@ -202,17 +192,13 @@ 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 2.0 clarified that if SMI_CMD in FADT is zero,
|
||||
* system does not support mode transition.
|
||||
|
@ -221,15 +207,15 @@ acpi_hw_get_mode (
|
|||
return_VALUE(ACPI_SYS_MODE_ACPI);
|
||||
}
|
||||
|
||||
status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
|
||||
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 {
|
||||
} else {
|
||||
return_VALUE(ACPI_SYS_MODE_LEGACY);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue