提交 32fb6c17 编写于 作者: L Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (140 commits)
  ACPI: processor: use .notify method instead of installing handler directly
  ACPI: button: use .notify method instead of installing handler directly
  ACPI: support acpi_device_ops .notify methods
  toshiba-acpi: remove MAINTAINERS entry
  ACPI: battery: asynchronous init
  acer-wmi: Update copyright notice & documentation
  acer-wmi: Cleanup the failure cleanup handling
  acer-wmi: Blacklist Acer Aspire One
  video: build fix
  thinkpad-acpi: rework brightness support
  thinkpad-acpi: enhanced debugging messages for the fan subdriver
  thinkpad-acpi: enhanced debugging messages for the hotkey subdriver
  thinkpad-acpi: enhanced debugging messages for rfkill subdrivers
  thinkpad-acpi: restrict access to some firmware LEDs
  thinkpad-acpi: remove HKEY disable functionality
  thinkpad-acpi: add new debug helpers and warn of deprecated atts
  thinkpad-acpi: add missing log levels
  thinkpad-acpi: cleanup debug helpers
  thinkpad-acpi: documentation cleanup
  thinkpad-acpi: drop ibm-acpi alias
  ...
...@@ -260,6 +260,22 @@ and is between 256 and 4096 characters. It is defined in the file ...@@ -260,6 +260,22 @@ and is between 256 and 4096 characters. It is defined in the file
to assume that this machine's pmtimer latches its value to assume that this machine's pmtimer latches its value
and always returns good values. and always returns good values.
acpi_enforce_resources= [ACPI]
{ strict | lax | no }
Check for resource conflicts between native drivers
and ACPI OperationRegions (SystemIO and SystemMemory
only). IO ports and memory declared in ACPI might be
used by the ACPI subsystem in arbitrary AML code and
can interfere with legacy drivers.
strict (default): access to resources claimed by ACPI
is denied; legacy drivers trying to access reserved
resources will fail to bind to device using them.
lax: access to resources claimed by ACPI is allowed;
legacy drivers trying to access reserved resources
will bind successfully but a warning message is logged.
no: ACPI OperationRegions are not marked as reserved,
no further checks are performed.
agp= [AGP] agp= [AGP]
{ off | try_unsupported } { off | try_unsupported }
off: disable AGP support off: disable AGP support
......
Acer Laptop WMI Extras Driver Acer Laptop WMI Extras Driver
http://code.google.com/p/aceracpi http://code.google.com/p/aceracpi
Version 0.2 Version 0.3
18th August 2008 4th April 2009
Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> Copyright 2007-2009 Carlos Corbacho <carlos@strangeworlds.co.uk>
acer-wmi is a driver to allow you to control various parts of your Acer laptop acer-wmi is a driver to allow you to control various parts of your Acer laptop
hardware under Linux which are exposed via ACPI-WMI. hardware under Linux which are exposed via ACPI-WMI.
...@@ -36,6 +36,10 @@ not possible in kernel space from a 64 bit OS. ...@@ -36,6 +36,10 @@ not possible in kernel space from a 64 bit OS.
Supported Hardware Supported Hardware
****************** ******************
NOTE: The Acer Aspire One is not supported hardware. It cannot work with
acer-wmi until Acer fix their ACPI-WMI implementation on them, so has been
blacklisted until that happens.
Please see the website for the current list of known working hardare: Please see the website for the current list of known working hardare:
http://code.google.com/p/aceracpi/wiki/SupportedHardware http://code.google.com/p/aceracpi/wiki/SupportedHardware
......
...@@ -20,7 +20,8 @@ moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel ...@@ -20,7 +20,8 @@ moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel
kernel 2.6.29 and release 0.22. kernel 2.6.29 and release 0.22.
The driver is named "thinkpad-acpi". In some places, like module The driver is named "thinkpad-acpi". In some places, like module
names, "thinkpad_acpi" is used because of userspace issues. names and log messages, "thinkpad_acpi" is used because of userspace
issues.
"tpacpi" is used as a shorthand where "thinkpad-acpi" would be too "tpacpi" is used as a shorthand where "thinkpad-acpi" would be too
long due to length limitations on some Linux kernel versions. long due to length limitations on some Linux kernel versions.
...@@ -37,7 +38,7 @@ detailed description): ...@@ -37,7 +38,7 @@ detailed description):
- ThinkLight on and off - ThinkLight on and off
- limited docking and undocking - limited docking and undocking
- UltraBay eject - UltraBay eject
- CMOS control - CMOS/UCMS control
- LED control - LED control
- ACPI sounds - ACPI sounds
- temperature sensors - temperature sensors
...@@ -46,6 +47,7 @@ detailed description): ...@@ -46,6 +47,7 @@ detailed description):
- Volume control - Volume control
- Fan control and monitoring: fan speed, fan enable/disable - Fan control and monitoring: fan speed, fan enable/disable
- WAN enable and disable - WAN enable and disable
- UWB enable and disable
A compatibility table by model and feature is maintained on the web A compatibility table by model and feature is maintained on the web
site, http://ibm-acpi.sf.net/. I appreciate any success or failure site, http://ibm-acpi.sf.net/. I appreciate any success or failure
...@@ -53,7 +55,7 @@ reports, especially if they add to or correct the compatibility table. ...@@ -53,7 +55,7 @@ reports, especially if they add to or correct the compatibility table.
Please include the following information in your report: Please include the following information in your report:
- ThinkPad model name - ThinkPad model name
- a copy of your DSDT, from /proc/acpi/dsdt - a copy of your ACPI tables, using the "acpidump" utility
- a copy of the output of dmidecode, with serial numbers - a copy of the output of dmidecode, with serial numbers
and UUIDs masked off and UUIDs masked off
- which driver features work and which don't - which driver features work and which don't
...@@ -66,17 +68,18 @@ Installation ...@@ -66,17 +68,18 @@ Installation
------------ ------------
If you are compiling this driver as included in the Linux kernel If you are compiling this driver as included in the Linux kernel
sources, simply enable the CONFIG_THINKPAD_ACPI option, and optionally sources, look for the CONFIG_THINKPAD_ACPI Kconfig option.
enable the CONFIG_THINKPAD_ACPI_BAY option if you want the It is located on the menu path: "Device Drivers" -> "X86 Platform
thinkpad-specific bay functionality. Specific Device Drivers" -> "ThinkPad ACPI Laptop Extras".
Features Features
-------- --------
The driver exports two different interfaces to userspace, which can be The driver exports two different interfaces to userspace, which can be
used to access the features it provides. One is a legacy procfs-based used to access the features it provides. One is a legacy procfs-based
interface, which will be removed at some time in the distant future. interface, which will be removed at some time in the future. The other
The other is a new sysfs-based interface which is not complete yet. is a new sysfs-based interface which is not complete yet.
The procfs interface creates the /proc/acpi/ibm directory. There is a The procfs interface creates the /proc/acpi/ibm directory. There is a
file under that directory for each feature it supports. The procfs file under that directory for each feature it supports. The procfs
...@@ -111,15 +114,17 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver ...@@ -111,15 +114,17 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver
as a driver attribute (see below). as a driver attribute (see below).
Sysfs driver attributes are on the driver's sysfs attribute space, Sysfs driver attributes are on the driver's sysfs attribute space,
for 2.6.23 this is /sys/bus/platform/drivers/thinkpad_acpi/ and for 2.6.23+ this is /sys/bus/platform/drivers/thinkpad_acpi/ and
/sys/bus/platform/drivers/thinkpad_hwmon/ /sys/bus/platform/drivers/thinkpad_hwmon/
Sysfs device attributes are on the thinkpad_acpi device sysfs attribute Sysfs device attributes are on the thinkpad_acpi device sysfs attribute
space, for 2.6.23 this is /sys/devices/platform/thinkpad_acpi/. space, for 2.6.23+ this is /sys/devices/platform/thinkpad_acpi/.
Sysfs device attributes for the sensors and fan are on the Sysfs device attributes for the sensors and fan are on the
thinkpad_hwmon device's sysfs attribute space, but you should locate it thinkpad_hwmon device's sysfs attribute space, but you should locate it
looking for a hwmon device with the name attribute of "thinkpad". looking for a hwmon device with the name attribute of "thinkpad", or
better yet, through libsensors.
Driver version Driver version
-------------- --------------
...@@ -129,6 +134,7 @@ sysfs driver attribute: version ...@@ -129,6 +134,7 @@ sysfs driver attribute: version
The driver name and version. No commands can be written to this file. The driver name and version. No commands can be written to this file.
Sysfs interface version Sysfs interface version
----------------------- -----------------------
...@@ -160,6 +166,7 @@ expect that an attribute might not be there, and deal with it properly ...@@ -160,6 +166,7 @@ expect that an attribute might not be there, and deal with it properly
(an attribute not being there *is* a valid way to make it clear that a (an attribute not being there *is* a valid way to make it clear that a
feature is not available in sysfs). feature is not available in sysfs).
Hot keys Hot keys
-------- --------
...@@ -172,17 +179,14 @@ system. Enabling the hotkey functionality of thinkpad-acpi signals the ...@@ -172,17 +179,14 @@ system. Enabling the hotkey functionality of thinkpad-acpi signals the
firmware that such a driver is present, and modifies how the ThinkPad firmware that such a driver is present, and modifies how the ThinkPad
firmware will behave in many situations. firmware will behave in many situations.
The driver enables the hot key feature automatically when loaded. The The driver enables the HKEY ("hot key") event reporting automatically
feature can later be disabled and enabled back at runtime. The driver when loaded, and disables it when it is removed.
will also restore the hot key feature to its previous state and mask
when it is unloaded.
When the hotkey feature is enabled and the hot key mask is set (see The driver will report HKEY events in the following format:
below), the driver will report HKEY events in the following format:
ibm/hotkey HKEY 00000080 0000xxxx ibm/hotkey HKEY 00000080 0000xxxx
Some of these events refer to hot key presses, but not all. Some of these events refer to hot key presses, but not all of them.
The driver will generate events over the input layer for hot keys and The driver will generate events over the input layer for hot keys and
radio switches, and over the ACPI netlink layer for other events. The radio switches, and over the ACPI netlink layer for other events. The
...@@ -214,13 +218,17 @@ procfs notes: ...@@ -214,13 +218,17 @@ procfs notes:
The following commands can be written to the /proc/acpi/ibm/hotkey file: The following commands can be written to the /proc/acpi/ibm/hotkey file:
echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature
echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature
echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
... any other 8-hex-digit mask ... ... any other 8-hex-digit mask ...
echo reset > /proc/acpi/ibm/hotkey -- restore the original mask echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
The following commands have been deprecated and will cause the kernel
to log a warning:
echo enable > /proc/acpi/ibm/hotkey -- does nothing
echo disable > /proc/acpi/ibm/hotkey -- returns an error
The procfs interface does not support NVRAM polling control. So as to The procfs interface does not support NVRAM polling control. So as to
maintain maximum bug-to-bug compatibility, it does not report any masks, maintain maximum bug-to-bug compatibility, it does not report any masks,
nor does it allow one to manipulate the hot key mask when the firmware nor does it allow one to manipulate the hot key mask when the firmware
...@@ -229,12 +237,9 @@ does not support masks at all, even if NVRAM polling is in use. ...@@ -229,12 +237,9 @@ does not support masks at all, even if NVRAM polling is in use.
sysfs notes: sysfs notes:
hotkey_bios_enabled: hotkey_bios_enabled:
Returns the status of the hot keys feature when DEPRECATED, WILL BE REMOVED SOON.
thinkpad-acpi was loaded. Upon module unload, the hot
key feature status will be restored to this value.
0: hot keys were disabled Returns 0.
1: hot keys were enabled (unusual)
hotkey_bios_mask: hotkey_bios_mask:
Returns the hot keys mask when thinkpad-acpi was loaded. Returns the hot keys mask when thinkpad-acpi was loaded.
...@@ -242,13 +247,10 @@ sysfs notes: ...@@ -242,13 +247,10 @@ sysfs notes:
to this value. to this value.
hotkey_enable: hotkey_enable:
Enables/disables the hot keys feature in the ACPI DEPRECATED, WILL BE REMOVED SOON.
firmware, and reports current status of the hot keys
feature. Has no effect on the NVRAM hot key polling
functionality.
0: disables the hot keys feature / feature disabled 0: returns -EPERM
1: enables the hot keys feature / feature enabled 1: does nothing
hotkey_mask: hotkey_mask:
bit mask to enable driver-handling (and depending on bit mask to enable driver-handling (and depending on
...@@ -618,6 +620,7 @@ For Lenovo models *with* ACPI backlight control: ...@@ -618,6 +620,7 @@ For Lenovo models *with* ACPI backlight control:
and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN. Process and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN. Process
these keys on userspace somehow (e.g. by calling xbacklight). these keys on userspace somehow (e.g. by calling xbacklight).
Bluetooth Bluetooth
--------- ---------
...@@ -628,6 +631,9 @@ sysfs rfkill class: switch "tpacpi_bluetooth_sw" ...@@ -628,6 +631,9 @@ sysfs rfkill class: switch "tpacpi_bluetooth_sw"
This feature shows the presence and current state of a ThinkPad This feature shows the presence and current state of a ThinkPad
Bluetooth device in the internal ThinkPad CDC slot. Bluetooth device in the internal ThinkPad CDC slot.
If the ThinkPad supports it, the Bluetooth state is stored in NVRAM,
so it is kept across reboots and power-off.
Procfs notes: Procfs notes:
If Bluetooth is installed, the following commands can be used: If Bluetooth is installed, the following commands can be used:
...@@ -652,6 +658,7 @@ Sysfs notes: ...@@ -652,6 +658,7 @@ Sysfs notes:
rfkill controller switch "tpacpi_bluetooth_sw": refer to rfkill controller switch "tpacpi_bluetooth_sw": refer to
Documentation/rfkill.txt for details. Documentation/rfkill.txt for details.
Video output control -- /proc/acpi/ibm/video Video output control -- /proc/acpi/ibm/video
-------------------------------------------- --------------------------------------------
...@@ -693,11 +700,8 @@ Fn-F7 from working. This also disables the video output switching ...@@ -693,11 +700,8 @@ Fn-F7 from working. This also disables the video output switching
features of this driver, as it uses the same ACPI methods as features of this driver, as it uses the same ACPI methods as
Fn-F7. Video switching on the console should still work. Fn-F7. Video switching on the console should still work.
UPDATE: There's now a patch for the X.org Radeon driver which UPDATE: refer to https://bugs.freedesktop.org/show_bug.cgi?id=2000
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 ThinkLight control
------------------ ------------------
...@@ -720,10 +724,11 @@ The ThinkLight sysfs interface is documented by the LED class ...@@ -720,10 +724,11 @@ The ThinkLight sysfs interface is documented by the LED class
documentation, in Documentation/leds-class.txt. The ThinkLight LED name documentation, in Documentation/leds-class.txt. The ThinkLight LED name
is "tpacpi::thinklight". is "tpacpi::thinklight".
Due to limitations in the sysfs LED class, if the status of the thinklight Due to limitations in the sysfs LED class, if the status of the ThinkLight
cannot be read or if it is unknown, thinkpad-acpi will report it as "off". cannot be read or if it is unknown, thinkpad-acpi will report it as "off".
It is impossible to know if the status returned through sysfs is valid. It is impossible to know if the status returned through sysfs is valid.
Docking / undocking -- /proc/acpi/ibm/dock Docking / undocking -- /proc/acpi/ibm/dock
------------------------------------------ ------------------------------------------
...@@ -784,6 +789,7 @@ the only docking stations currently supported are the X-series ...@@ -784,6 +789,7 @@ the only docking stations currently supported are the X-series
UltraBase docks and "dumb" port replicators like the Mini Dock (the UltraBase docks and "dumb" port replicators like the Mini Dock (the
latter don't need any ACPI support, actually). latter don't need any ACPI support, actually).
UltraBay eject -- /proc/acpi/ibm/bay UltraBay eject -- /proc/acpi/ibm/bay
------------------------------------ ------------------------------------
...@@ -847,8 +853,9 @@ supported. Use "eject2" instead of "eject" for the second bay. ...@@ -847,8 +853,9 @@ supported. Use "eject2" instead of "eject" for the second bay.
Note: the UltraBay eject support on the 600e/x, A22p and A3x is Note: the UltraBay eject support on the 600e/x, A22p and A3x is
EXPERIMENTAL and may not work as expected. USE WITH CAUTION! EXPERIMENTAL and may not work as expected. USE WITH CAUTION!
CMOS control
------------ CMOS/UCMS control
-----------------
procfs: /proc/acpi/ibm/cmos procfs: /proc/acpi/ibm/cmos
sysfs device attribute: cmos_command sysfs device attribute: cmos_command
...@@ -882,6 +889,7 @@ The cmos command interface is prone to firmware split-brain problems, as ...@@ -882,6 +889,7 @@ The cmos command interface is prone to firmware split-brain problems, as
in newer ThinkPads it is just a compatibility layer. Do not use it, it is in newer ThinkPads it is just a compatibility layer. Do not use it, it is
exported just as a debug tool. exported just as a debug tool.
LED control LED control
----------- -----------
...@@ -893,6 +901,17 @@ some older ThinkPad models, it is possible to query the status of the ...@@ -893,6 +901,17 @@ some older ThinkPad models, it is possible to query the status of the
LED indicators as well. Newer ThinkPads cannot query the real status LED indicators as well. Newer ThinkPads cannot query the real status
of the LED indicators. of the LED indicators.
Because misuse of the LEDs could induce an unaware user to perform
dangerous actions (like undocking or ejecting a bay device while the
buses are still active), or mask an important alarm (such as a nearly
empty battery, or a broken battery), access to most LEDs is
restricted.
Unrestricted access to all LEDs requires that thinkpad-acpi be
compiled with the CONFIG_THINKPAD_ACPI_UNSAFE_LEDS option enabled.
Distributions must never enable this option. Individual users that
are aware of the consequences are welcome to enabling it.
procfs notes: procfs notes:
The available commands are: The available commands are:
...@@ -939,6 +958,7 @@ ThinkPad indicator LED should blink in hardware accelerated mode, use the ...@@ -939,6 +958,7 @@ ThinkPad indicator LED should blink in hardware accelerated mode, use the
"timer" trigger, and leave the delay_on and delay_off parameters set to "timer" trigger, and leave the delay_on and delay_off parameters set to
zero (to request hardware acceleration autodetection). zero (to request hardware acceleration autodetection).
ACPI sounds -- /proc/acpi/ibm/beep ACPI sounds -- /proc/acpi/ibm/beep
---------------------------------- ----------------------------------
...@@ -968,6 +988,7 @@ X40: ...@@ -968,6 +988,7 @@ X40:
16 - one medium-pitched beep repeating constantly, stop with 17 16 - one medium-pitched beep repeating constantly, stop with 17
17 - stop 16 17 - stop 16
Temperature sensors Temperature sensors
------------------- -------------------
...@@ -1115,6 +1136,7 @@ registers contain the current battery capacity, etc. If you experiment ...@@ -1115,6 +1136,7 @@ registers contain the current battery capacity, etc. If you experiment
with this, do send me your results (including some complete dumps with with this, do send me your results (including some complete dumps with
a description of the conditions when they were taken.) a description of the conditions when they were taken.)
LCD brightness control LCD brightness control
---------------------- ----------------------
...@@ -1124,10 +1146,9 @@ sysfs backlight device "thinkpad_screen" ...@@ -1124,10 +1146,9 @@ sysfs backlight device "thinkpad_screen"
This feature allows software control of the LCD brightness on ThinkPad This feature allows software control of the LCD brightness on ThinkPad
models which don't have a hardware brightness slider. models which don't have a hardware brightness slider.
It has some limitations: the LCD backlight cannot be actually turned on or It has some limitations: the LCD backlight cannot be actually turned
off by this interface, and in many ThinkPad models, the "dim while on on or off by this interface, it just controls the backlight brightness
battery" functionality will be enabled by the BIOS when this interface is level.
used, and cannot be controlled.
On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
has eight brightness levels, ranging from 0 to 7. Some of the levels has eight brightness levels, ranging from 0 to 7. Some of the levels
...@@ -1136,10 +1157,15 @@ display backlight brightness control methods have 16 levels, ranging ...@@ -1136,10 +1157,15 @@ display backlight brightness control methods have 16 levels, ranging
from 0 to 15. from 0 to 15.
There are two interfaces to the firmware for direct brightness control, There are two interfaces to the firmware for direct brightness control,
EC and CMOS. To select which one should be used, use the EC and UCMS (or CMOS). To select which one should be used, use the
brightness_mode module parameter: brightness_mode=1 selects EC mode, brightness_mode module parameter: brightness_mode=1 selects EC mode,
brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC
and CMOS. The driver tries to auto-detect which interface to use. mode with NVRAM backing (so that brightness changes are remembered
across shutdown/reboot).
The driver tries to select which interface to use from a table of
defaults for each ThinkPad model. If it makes a wrong choice, please
report this as a bug, so that we can fix it.
When display backlight brightness controls are available through the When display backlight brightness controls are available through the
standard ACPI interface, it is best to use it instead of this direct standard ACPI interface, it is best to use it instead of this direct
...@@ -1201,6 +1227,7 @@ WARNING: ...@@ -1201,6 +1227,7 @@ WARNING:
and maybe reduce the life of the backlight lamps by needlessly kicking and maybe reduce the life of the backlight lamps by needlessly kicking
its level up and down at every change. its level up and down at every change.
Volume control -- /proc/acpi/ibm/volume Volume control -- /proc/acpi/ibm/volume
--------------------------------------- ---------------------------------------
...@@ -1217,6 +1244,11 @@ distinct. The unmute the volume after the mute command, use either the ...@@ -1217,6 +1244,11 @@ distinct. The unmute the volume after the mute command, use either the
up or down command (the level command will not unmute the volume). up or down command (the level command will not unmute the volume).
The current volume level and mute state is shown in the file. The current volume level and mute state is shown in the file.
The ALSA mixer interface to this feature is still missing, but patches
to add it exist. That problem should be addressed in the not so
distant future.
Fan control and monitoring: fan speed, fan enable/disable Fan control and monitoring: fan speed, fan enable/disable
--------------------------------------------------------- ---------------------------------------------------------
...@@ -1383,8 +1415,11 @@ procfs: /proc/acpi/ibm/wan ...@@ -1383,8 +1415,11 @@ procfs: /proc/acpi/ibm/wan
sysfs device attribute: wwan_enable (deprecated) sysfs device attribute: wwan_enable (deprecated)
sysfs rfkill class: switch "tpacpi_wwan_sw" sysfs rfkill class: switch "tpacpi_wwan_sw"
This feature shows the presence and current state of a W-WAN (Sierra This feature shows the presence and current state of the built-in
Wireless EV-DO) device. Wireless WAN device.
If the ThinkPad supports it, the WWAN state is stored in NVRAM,
so it is kept across reboots and power-off.
It was tested on a Lenovo ThinkPad X60. It should probably work on other It was tested on a Lenovo ThinkPad X60. It should probably work on other
ThinkPad models which come with this module installed. ThinkPad models which come with this module installed.
...@@ -1413,6 +1448,7 @@ Sysfs notes: ...@@ -1413,6 +1448,7 @@ Sysfs notes:
rfkill controller switch "tpacpi_wwan_sw": refer to rfkill controller switch "tpacpi_wwan_sw": refer to
Documentation/rfkill.txt for details. Documentation/rfkill.txt for details.
EXPERIMENTAL: UWB EXPERIMENTAL: UWB
----------------- -----------------
...@@ -1431,6 +1467,7 @@ Sysfs notes: ...@@ -1431,6 +1467,7 @@ Sysfs notes:
rfkill controller switch "tpacpi_uwb_sw": refer to rfkill controller switch "tpacpi_uwb_sw": refer to
Documentation/rfkill.txt for details. Documentation/rfkill.txt for details.
Multiple Commands, Module Parameters Multiple Commands, Module Parameters
------------------------------------ ------------------------------------
...@@ -1445,6 +1482,7 @@ for example: ...@@ -1445,6 +1482,7 @@ for example:
modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable modprobe thinkpad_acpi hotkey=enable,0xffff video=auto_disable
Enabling debugging output Enabling debugging output
------------------------- -------------------------
...@@ -1457,8 +1495,15 @@ will enable all debugging output classes. It takes a bitmask, so ...@@ -1457,8 +1495,15 @@ will enable all debugging output classes. It takes a bitmask, so
to enable more than one output class, just add their values. to enable more than one output class, just add their values.
Debug bitmask Description Debug bitmask Description
0x8000 Disclose PID of userspace programs
accessing some functions of the driver
0x0001 Initialization and probing 0x0001 Initialization and probing
0x0002 Removal 0x0002 Removal
0x0004 RF Transmitter control (RFKILL)
(bluetooth, WWAN, UWB...)
0x0008 HKEY event interface, hotkeys
0x0010 Fan control
0x0020 Backlight brightness
There is also a kernel build option to enable more debugging There is also a kernel build option to enable more debugging
information, which may be necessary to debug driver problems. information, which may be necessary to debug driver problems.
...@@ -1467,6 +1512,7 @@ The level of debugging information output by the driver can be changed ...@@ -1467,6 +1512,7 @@ The level of debugging information output by the driver can be changed
at runtime through sysfs, using the driver attribute debug_level. The at runtime through sysfs, using the driver attribute debug_level. The
attribute takes the same bitmask as the debug module parameter above. attribute takes the same bitmask as the debug module parameter above.
Force loading of module Force loading of module
----------------------- -----------------------
...@@ -1505,3 +1551,7 @@ Sysfs interface changelog: ...@@ -1505,3 +1551,7 @@ Sysfs interface changelog:
0x020200: Add poll()/select() support to the following attributes: 0x020200: Add poll()/select() support to the following attributes:
hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason hotkey_radio_sw, wakeup_hotunplug_complete, wakeup_reason
0x020300: hotkey enable/disable support removed, attributes
hotkey_bios_enabled and hotkey_enable deprecated and
marked for removal.
...@@ -1422,6 +1422,11 @@ P: Doug Warzecha ...@@ -1422,6 +1422,11 @@ P: Doug Warzecha
M: Douglas_Warzecha@dell.com M: Douglas_Warzecha@dell.com
S: Maintained S: Maintained
DELL WMI EXTRAS DRIVER
P: Matthew Garrett
M: mjg59@srcf.ucam.org
S: Maintained
DEVICE NUMBER REGISTRY DEVICE NUMBER REGISTRY
P: Torben Mathiasen P: Torben Mathiasen
M: device@lanana.org M: device@lanana.org
...@@ -4401,10 +4406,7 @@ T: quilt http://svn.sourceforge.jp/svnroot/tomoyo/trunk/2.2.x/tomoyo-lsm/patches ...@@ -4401,10 +4406,7 @@ T: quilt http://svn.sourceforge.jp/svnroot/tomoyo/trunk/2.2.x/tomoyo-lsm/patches
S: Maintained S: Maintained
TOSHIBA ACPI EXTRAS DRIVER TOSHIBA ACPI EXTRAS DRIVER
P: John Belmonte S: Orphan
M: toshiba_acpi@memebeam.org
W: http://memebeam.org/toys/ToshibaAcpiDriver
S: Maintained
TOSHIBA SMM DRIVER TOSHIBA SMM DRIVER
P: Jonathan Buzzard P: Jonathan Buzzard
......
...@@ -229,6 +229,35 @@ static void __cpuinit acpi_register_lapic(int id, u8 enabled) ...@@ -229,6 +229,35 @@ static void __cpuinit acpi_register_lapic(int id, u8 enabled)
generic_processor_info(id, ver); generic_processor_info(id, ver);
} }
static int __init
acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
{
struct acpi_madt_local_x2apic *processor = NULL;
processor = (struct acpi_madt_local_x2apic *)header;
if (BAD_MADT_ENTRY(processor, end))
return -EINVAL;
acpi_table_print_madt_entry(header);
#ifdef CONFIG_X86_X2APIC
/*
* We need to register disabled CPU as well to permit
* counting disabled CPUs. This allows us to size
* cpus_possible_map more accurately, to permit
* to not preallocating memory for all NR_CPUS
* when we use CPU hotplug.
*/
acpi_register_lapic(processor->local_apic_id, /* APIC ID */
processor->lapic_flags & ACPI_MADT_ENABLED);
#else
printk(KERN_WARNING PREFIX "x2apic entry ignored\n");
#endif
return 0;
}
static int __init static int __init
acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
{ {
...@@ -288,6 +317,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header, ...@@ -288,6 +317,25 @@ acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
return 0; return 0;
} }
static int __init
acpi_parse_x2apic_nmi(struct acpi_subtable_header *header,
const unsigned long end)
{
struct acpi_madt_local_x2apic_nmi *x2apic_nmi = NULL;
x2apic_nmi = (struct acpi_madt_local_x2apic_nmi *)header;
if (BAD_MADT_ENTRY(x2apic_nmi, end))
return -EINVAL;
acpi_table_print_madt_entry(header);
if (x2apic_nmi->lint != 1)
printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
return 0;
}
static int __init static int __init
acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
{ {
...@@ -793,6 +841,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void) ...@@ -793,6 +841,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
static int __init acpi_parse_madt_lapic_entries(void) static int __init acpi_parse_madt_lapic_entries(void)
{ {
int count; int count;
int x2count = 0;
if (!cpu_has_apic) if (!cpu_has_apic)
return -ENODEV; return -ENODEV;
...@@ -816,22 +865,28 @@ static int __init acpi_parse_madt_lapic_entries(void) ...@@ -816,22 +865,28 @@ static int __init acpi_parse_madt_lapic_entries(void)
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
acpi_parse_sapic, MAX_APICS); acpi_parse_sapic, MAX_APICS);
if (!count) if (!count) {
x2count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
acpi_parse_x2apic, MAX_APICS);
count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
acpi_parse_lapic, MAX_APICS); acpi_parse_lapic, MAX_APICS);
if (!count) { }
if (!count && !x2count) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n"); printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
return -ENODEV; return -ENODEV;
} else if (count < 0) { } else if (count < 0 || x2count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
return count; return count;
} }
x2count =
acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC_NMI,
acpi_parse_x2apic_nmi, 0);
count = count =
acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0); acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
if (count < 0) { if (count < 0 || x2count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
return count; return count;
...@@ -1470,7 +1525,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) ...@@ -1470,7 +1525,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
/* /*
* If your system is blacklisted here, but you find that acpi=force * If your system is blacklisted here, but you find that acpi=force
* works for you, please contact acpi-devel@sourceforge.net * works for you, please contact linux-acpi@vger.kernel.org
*/ */
static struct dmi_system_id __initdata acpi_dmi_table[] = { static struct dmi_system_id __initdata acpi_dmi_table[] = {
/* /*
......
...@@ -682,6 +682,18 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -682,6 +682,18 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
perf->states[i].transition_latency * 1000; perf->states[i].transition_latency * 1000;
} }
/* Check for high latency (>20uS) from buggy BIOSes, like on T42 */
if (perf->control_register.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE &&
policy->cpuinfo.transition_latency > 20 * 1000) {
static int print_once;
policy->cpuinfo.transition_latency = 20 * 1000;
if (!print_once) {
print_once = 1;
printk(KERN_INFO "Capping off P-state tranision latency"
" at 20 uS\n");
}
}
data->max_freq = perf->states[0].core_frequency * 1000; data->max_freq = perf->states[0].core_frequency * 1000;
/* table init */ /* table init */
for (i = 0; i < perf->state_count; i++) { for (i = 0; i < perf->state_count; i++) {
......
...@@ -305,7 +305,7 @@ static void longhaul_setstate(unsigned int table_index) ...@@ -305,7 +305,7 @@ static void longhaul_setstate(unsigned int table_index)
outb(3, 0x22); outb(3, 0x22);
} else if ((pr != NULL) && pr->flags.bm_control) { } else if ((pr != NULL) && pr->flags.bm_control) {
/* Disable bus master arbitration */ /* Disable bus master arbitration */
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
} }
switch (longhaul_version) { switch (longhaul_version) {
...@@ -328,7 +328,7 @@ static void longhaul_setstate(unsigned int table_index) ...@@ -328,7 +328,7 @@ static void longhaul_setstate(unsigned int table_index)
case TYPE_POWERSAVER: case TYPE_POWERSAVER:
if (longhaul_flags & USE_ACPI_C3) { if (longhaul_flags & USE_ACPI_C3) {
/* Don't allow wakeup */ /* Don't allow wakeup */
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
do_powersaver(cx->address, mults_index, dir); do_powersaver(cx->address, mults_index, dir);
} else { } else {
do_powersaver(0, mults_index, dir); do_powersaver(0, mults_index, dir);
...@@ -341,7 +341,7 @@ static void longhaul_setstate(unsigned int table_index) ...@@ -341,7 +341,7 @@ static void longhaul_setstate(unsigned int table_index)
outb(0, 0x22); outb(0, 0x22);
} else if ((pr != NULL) && pr->flags.bm_control) { } else if ((pr != NULL) && pr->flags.bm_control) {
/* Enable bus master arbitration */ /* Enable bus master arbitration */
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
} }
outb(pic2_mask, 0xA1); /* restore mask */ outb(pic2_mask, 0xA1); /* restore mask */
outb(pic1_mask, 0x21); outb(pic1_mask, 0x21);
......
...@@ -116,6 +116,36 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) ...@@ -116,6 +116,36 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
reserve_early(phys, phys + length, "ACPI SLIT"); reserve_early(phys, phys + length, "ACPI SLIT");
} }
/* Callback for Proximity Domain -> x2APIC mapping */
void __init
acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
{
int pxm, node;
int apic_id;
if (srat_disabled())
return;
if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) {
bad_srat();
return;
}
if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
return;
pxm = pa->proximity_domain;
node = setup_node(pxm);
if (node < 0) {
printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
bad_srat();
return;
}
apic_id = pa->apic_id;
apicid_to_node[apic_id] = node;
acpi_numa = 1;
printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n",
pxm, apic_id, node);
}
/* Callback for Proximity Domain -> LAPIC mapping */ /* Callback for Proximity Domain -> LAPIC mapping */
void __init void __init
acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
......
...@@ -11,9 +11,9 @@ menuconfig ACPI ...@@ -11,9 +11,9 @@ menuconfig ACPI
select PNP select PNP
select CPU_IDLE select CPU_IDLE
default y default y
---help--- help
Advanced Configuration and Power Interface (ACPI) support for Advanced Configuration and Power Interface (ACPI) support for
Linux requires an ACPI compliant platform (hardware/firmware), Linux requires an ACPI-compliant platform (hardware/firmware),
and assumes the presence of OS-directed configuration and power and assumes the presence of OS-directed configuration and power
management (OSPM) software. This option will enlarge your management (OSPM) software. This option will enlarge your
kernel by about 70K. kernel by about 70K.
...@@ -23,20 +23,19 @@ menuconfig ACPI ...@@ -23,20 +23,19 @@ menuconfig ACPI
the Plug-and-Play BIOS specification (PnP BIOS), the the Plug-and-Play BIOS specification (PnP BIOS), the
MultiProcessor Specification (MPS), and the Advanced Power MultiProcessor Specification (MPS), and the Advanced Power
Management (APM) specification. If both ACPI and APM support Management (APM) specification. If both ACPI and APM support
are configured, whichever is loaded first shall be used. are configured, ACPI is used.
The ACPI SourceForge project contains the latest source code, The project home page for the Linux ACPI subsystem is here:
documentation, tools, mailing list subscription, and other <http://www.lesswatts.org/projects/acpi/>
information. This project is available at:
<http://sourceforge.net/projects/acpi>
Linux support for ACPI is based on Intel Corporation's ACPI Linux support for ACPI is based on Intel Corporation's ACPI
Component Architecture (ACPI CA). For more information see: Component Architecture (ACPI CA). For more information on the
<http://developer.intel.com/technology/iapc/acpi> ACPI CA, see:
<http://acpica.org/>
ACPI is an open industry specification co-developed by Compaq, ACPI is an open industry specification co-developed by
Intel, Microsoft, Phoenix, and Toshiba. The specification is Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba.
available at: The specification is available at:
<http://www.acpi.info> <http://www.acpi.info>
if ACPI if ACPI
...@@ -49,14 +48,14 @@ config ACPI_SLEEP ...@@ -49,14 +48,14 @@ config ACPI_SLEEP
config ACPI_PROCFS config ACPI_PROCFS
bool "Deprecated /proc/acpi files" bool "Deprecated /proc/acpi files"
depends on PROC_FS depends on PROC_FS
---help--- help
For backwards compatibility, this option allows For backwards compatibility, this option allows
deprecated /proc/acpi/ files to exist, even when deprecated /proc/acpi/ files to exist, even when
they have been replaced by functions in /sys. they have been replaced by functions in /sys.
The deprecated files (and their replacements) include: The deprecated files (and their replacements) include:
/proc/acpi/sleep (/sys/power/state) /proc/acpi/sleep (/sys/power/state)
/proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) /proc/acpi/info (/sys/module/acpi/parameters/acpica_version)
/proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
...@@ -66,11 +65,12 @@ config ACPI_PROCFS ...@@ -66,11 +65,12 @@ config ACPI_PROCFS
and functions which do not yet exist in /sys. and functions which do not yet exist in /sys.
Say N to delete /proc/acpi/ files that have moved to /sys/ Say N to delete /proc/acpi/ files that have moved to /sys/
config ACPI_PROCFS_POWER config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi directories" bool "Deprecated power /proc/acpi directories"
depends on PROC_FS depends on PROC_FS
default y default y
---help--- help
For backwards compatibility, this option allows For backwards compatibility, this option allows
deprecated power /proc/acpi/ directories to exist, even when deprecated power /proc/acpi/ directories to exist, even when
they have been replaced by functions in /sys. they have been replaced by functions in /sys.
...@@ -86,19 +86,19 @@ config ACPI_SYSFS_POWER ...@@ -86,19 +86,19 @@ config ACPI_SYSFS_POWER
bool "Future power /sys interface" bool "Future power /sys interface"
select POWER_SUPPLY select POWER_SUPPLY
default y default y
---help--- help
Say N to disable power /sys interface Say N to disable power /sys interface
config ACPI_PROC_EVENT config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support" bool "Deprecated /proc/acpi/event support"
depends on PROC_FS depends on PROC_FS
default y default y
---help--- help
A user-space daemon, acpi, typically read /proc/acpi/event A user-space daemon, acpid, typically reads /proc/acpi/event
and handled all ACPI sub-system generated events. and handles all ACPI-generated events.
These events are now delivered to user-space via These events are now delivered to user-space either
either the input layer, or as netlink events. via the input layer or as netlink events.
This build option enables the old code for legacy This build option enables the old code for legacy
user-space implementation. After some time, this will user-space implementation. After some time, this will
...@@ -112,10 +112,13 @@ config ACPI_AC ...@@ -112,10 +112,13 @@ config ACPI_AC
depends on X86 depends on X86
default y default y
help help
This driver adds support for the AC Adapter object, which indicates This driver supports the AC Adapter object, which indicates
whether a system is on AC, or not. If you have a system that can whether a system is on AC or not. If you have a system that can
switch between A/C and battery, say Y. switch between A/C and battery, say Y.
To compile this driver as a module, choose M here:
the module will be called ac.
config ACPI_BATTERY config ACPI_BATTERY
tristate "Battery" tristate "Battery"
depends on X86 depends on X86
...@@ -125,15 +128,21 @@ config ACPI_BATTERY ...@@ -125,15 +128,21 @@ config ACPI_BATTERY
/proc/acpi/battery. If you have a mobile system with a battery, /proc/acpi/battery. If you have a mobile system with a battery,
say Y. say Y.
To compile this driver as a module, choose M here:
the module will be called battery.
config ACPI_BUTTON config ACPI_BUTTON
tristate "Button" tristate "Button"
depends on INPUT depends on INPUT
default y default y
help help
This driver handles events on the power, sleep and lid buttons. This driver handles events on the power, sleep, and lid buttons.
A daemon reads /proc/acpi/event and perform user-defined actions A daemon reads /proc/acpi/event and perform user-defined actions
such as shutting down the system. This is necessary for such as shutting down the system. This is necessary for
software controlled poweroff. software-controlled poweroff.
To compile this driver as a module, choose M here:
the module will be called button.
config ACPI_VIDEO config ACPI_VIDEO
tristate "Video" tristate "Video"
...@@ -141,38 +150,45 @@ config ACPI_VIDEO ...@@ -141,38 +150,45 @@ config ACPI_VIDEO
depends on INPUT depends on INPUT
select THERMAL select THERMAL
help help
This driver implement the ACPI Extensions For Display Adapters This driver implements the ACPI Extensions For Display Adapters
for integrated graphics devices on motherboard, as specified in for integrated graphics devices on motherboard, as specified in
ACPI 2.0 Specification, Appendix B, allowing to perform some basic ACPI 2.0 Specification, Appendix B. This supports basic operations
control like defining the video POST device, retrieving EDID information such as defining the video POST device, retrieving EDID information,
or to setup a video output, etc. and setting up a video output.
Note that this is an ref. implementation only. It may or may not work
for your integrated video device. To compile this driver as a module, choose M here:
the module will be called video.
config ACPI_FAN config ACPI_FAN
tristate "Fan" tristate "Fan"
select THERMAL select THERMAL
default y default y
help help
This driver adds support for ACPI fan devices, allowing user-mode This driver supports ACPI fan devices, allowing user-mode
applications to perform basic fan control (on, off, status). applications to perform basic fan control (on, off, status).
To compile this driver as a module, choose M here:
the module will be called fan.
config ACPI_DOCK config ACPI_DOCK
bool "Dock" bool "Dock"
depends on EXPERIMENTAL depends on EXPERIMENTAL
help help
This driver adds support for ACPI controlled docking stations and removable This driver supports ACPI-controlled docking stations and removable
drive bays such as the IBM ultrabay or the Dell Module Bay. drive bays such as the IBM Ultrabay and the Dell Module Bay.
config ACPI_PROCESSOR config ACPI_PROCESSOR
tristate "Processor" tristate "Processor"
select THERMAL select THERMAL
default y default y
help help
This driver installs ACPI as the idle handler for Linux, and uses This driver installs ACPI as the idle handler for Linux and uses
ACPI C2 and C3 processor states to save power, on systems that ACPI C2 and C3 processor states to save power on systems that
support it. It is required by several flavors of cpufreq support it. It is required by several flavors of cpufreq
Performance-state drivers. performance-state drivers.
To compile this driver as a module, choose M here:
the module will be called processor.
config ACPI_HOTPLUG_CPU config ACPI_HOTPLUG_CPU
bool bool
...@@ -186,11 +202,14 @@ config ACPI_THERMAL ...@@ -186,11 +202,14 @@ config ACPI_THERMAL
select THERMAL select THERMAL
default y default y
help help
This driver adds support for ACPI thermal zones. Most mobile and This driver supports ACPI thermal zones. Most mobile and
some desktop systems support ACPI thermal zones. It is HIGHLY some desktop systems support ACPI thermal zones. It is HIGHLY
recommended that this option be enabled, as your processor(s) recommended that this option be enabled, as your processor(s)
may be damaged without it. may be damaged without it.
To compile this driver as a module, choose M here:
the module will be called thermal.
config ACPI_NUMA config ACPI_NUMA
bool "NUMA support" bool "NUMA support"
depends on NUMA depends on NUMA
...@@ -218,7 +237,7 @@ config ACPI_BLACKLIST_YEAR ...@@ -218,7 +237,7 @@ config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32 int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0 default 0
help help
enter a 4-digit year, eg. 2001 to disable ACPI by default Enter a 4-digit year, e.g., 2001, to disable ACPI by default
on platforms with DMI BIOS date before January 1st that year. on platforms with DMI BIOS date before January 1st that year.
"acpi=force" can be used to override this mechanism. "acpi=force" can be used to override this mechanism.
...@@ -249,10 +268,13 @@ config ACPI_PCI_SLOT ...@@ -249,10 +268,13 @@ config ACPI_PCI_SLOT
tristate "PCI slot detection driver" tristate "PCI slot detection driver"
default n default n
help help
This driver will attempt to discover all PCI slots in your system, This driver creates entries in /sys/bus/pci/slots/ for all PCI
and creates entries in /sys/bus/pci/slots/. This feature can slots in the system. This can help correlate PCI bus addresses,
help you correlate PCI bus addresses with the physical geography i.e., segment/bus/device/function tuples, with physical slots in
of your slots. If you are unsure, say N. the system. If you are unsure, say N.
To compile this driver as a module, choose M here:
the module will be called pci_slot.
config X86_PM_TIMER config X86_PM_TIMER
bool "Power Management Timer Support" if EMBEDDED bool "Power Management Timer Support" if EMBEDDED
...@@ -271,43 +293,43 @@ config X86_PM_TIMER ...@@ -271,43 +293,43 @@ config X86_PM_TIMER
systems require this timer. systems require this timer.
config ACPI_CONTAINER config ACPI_CONTAINER
tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" tristate "Container and Module Devices (EXPERIMENTAL)"
depends on EXPERIMENTAL depends on EXPERIMENTAL
default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
---help--- help
This allows _physical_ insertion and removal of CPUs and memory. This driver supports ACPI Container and Module devices (IDs
This can be useful, for example, on NUMA machines that support ACPI0004, PNP0A05, and PNP0A06).
ACPI based physical hotplug of nodes, or non-NUMA machines that
support physical cpu/memory hot-plug.
If one selects "m", this driver can be loaded with This helps support hotplug of nodes, CPUs, and memory.
"modprobe container".
To compile this driver as a module, choose M here:
the module will be called container.
config ACPI_HOTPLUG_MEMORY config ACPI_HOTPLUG_MEMORY
tristate "Memory Hotplug" tristate "Memory Hotplug"
depends on MEMORY_HOTPLUG depends on MEMORY_HOTPLUG
default n default n
help help
This driver adds supports for ACPI Memory Hotplug. This driver This driver supports ACPI memory hotplug. The driver
provides support for fielding notifications on ACPI memory fields notifications on ACPI memory devices (PNP0C80),
devices (PNP0C80) which represent memory ranges that may be which represent memory ranges that may be onlined or
onlined or offlined during runtime. offlined during runtime.
Enabling this driver assumes that your platform hardware If your hardware and firmware do not support adding or
and firmware have support for hot-plugging physical memory. If removing memory devices at runtime, you need not enable
your system does not support physically adding or ripping out this driver.
memory DIMMs at some platform defined granularity (individually
or as a bank) at runtime, then you need not enable this driver.
If one selects "m," this driver can be loaded using the following To compile this driver as a module, choose M here:
command: the module will be called acpi_memhotplug.
$>modprobe acpi_memhotplug
config ACPI_SBS config ACPI_SBS
tristate "Smart Battery System" tristate "Smart Battery System"
depends on X86 depends on X86
help help
This driver adds support for the Smart Battery System, another This driver supports the Smart Battery System, another
type of access to battery information, found on some laptops. type of access to battery information, found on some laptops.
To compile this driver as a module, choose M here:
the modules will be called sbs and sbshc.
endif # ACPI endif # ACPI
...@@ -14,48 +14,50 @@ obj-$(CONFIG_X86) += blacklist.o ...@@ -14,48 +14,50 @@ obj-$(CONFIG_X86) += blacklist.o
# #
# ACPI Core Subsystem (Interpreter) # ACPI Core Subsystem (Interpreter)
# #
obj-y += osl.o utils.o reboot.o\ obj-y += acpi.o \
acpica/ acpica/
# All the builtin files are in the "acpi." module_param namespace.
acpi-y += osl.o utils.o reboot.o
# sleep related files # sleep related files
obj-y += wakeup.o acpi-y += wakeup.o
obj-y += sleep.o acpi-y += sleep.o
obj-$(CONFIG_ACPI_SLEEP) += proc.o acpi-$(CONFIG_ACPI_SLEEP) += proc.o
# #
# ACPI Bus and Device Drivers # ACPI Bus and Device Drivers
# #
processor-objs += processor_core.o processor_throttling.o \ acpi-y += bus.o glue.o
processor_idle.o processor_thermal.o acpi-y += scan.o
ifdef CONFIG_CPU_FREQ acpi-y += ec.o
processor-objs += processor_perflib.o acpi-$(CONFIG_ACPI_DOCK) += dock.o
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
acpi-y += power.o
acpi-y += system.o event.o
acpi-$(CONFIG_ACPI_DEBUG) += debug.o
acpi-$(CONFIG_ACPI_NUMA) += numa.o
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
ifdef CONFIG_ACPI_VIDEO
acpi-y += video_detect.o
endif endif
obj-y += bus.o glue.o # These are (potentially) separate modules
obj-y += scan.o
# Keep EC driver first. Initialization of others depend on it.
obj-y += ec.o
obj-$(CONFIG_ACPI_AC) += ac.o obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o obj-$(CONFIG_ACPI_BUTTON) += button.o
obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_FAN) += fan.o
obj-$(CONFIG_ACPI_DOCK) += dock.o
obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_VIDEO) += video.o
ifdef CONFIG_ACPI_VIDEO
obj-y += video_detect.o
endif
obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_CONTAINER) += container.o obj-$(CONFIG_ACPI_CONTAINER) += container.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-y += power.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += system.o event.o obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_DEBUG) += debug.o
obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbshc.o
obj-$(CONFIG_ACPI_SBS) += sbs.o obj-$(CONFIG_ACPI_SBS) += sbs.o
# processor has its own "processor." module_param namespace
processor-y := processor_core.o processor_throttling.o
processor-y += processor_idle.o processor_thermal.o
processor-$(CONFIG_CPU_FREQ) += processor_perflib.o
...@@ -18,7 +18,7 @@ obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ ...@@ -18,7 +18,7 @@ obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\
excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \
exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o
obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o
obj-$(ACPI_FUTURE_USAGE) += hwtimer.o obj-$(ACPI_FUTURE_USAGE) += hwtimer.o
...@@ -41,4 +41,4 @@ obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o ...@@ -41,4 +41,4 @@ obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
utstate.o utmutex.o utobject.o utresrc.o utstate.o utmutex.o utobject.o utresrc.o utlock.o
...@@ -148,9 +148,12 @@ ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; ...@@ -148,9 +148,12 @@ ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS;
/* These addresses are calculated from FADT address values */ /* These addresses are calculated from the FADT Event Block addresses */
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_status;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_status;
ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
/* /*
...@@ -162,6 +165,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; ...@@ -162,6 +165,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
ACPI_EXTERN u8 acpi_gbl_integer_byte_width; ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
/* Reader/Writer lock is used for namespace walk and dynamic table unload */
ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
/***************************************************************************** /*****************************************************************************
* *
* Mutual exlusion within ACPICA subsystem * Mutual exlusion within ACPICA subsystem
...@@ -245,6 +252,7 @@ ACPI_EXTERN u8 acpi_gbl_step_to_next_call; ...@@ -245,6 +252,7 @@ ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
ACPI_EXTERN u8 acpi_gbl_events_initialized; ACPI_EXTERN u8 acpi_gbl_events_initialized;
ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
ACPI_EXTERN u8 acpi_gbl_osi_data;
#ifndef DEFINE_ACPI_GLOBALS #ifndef DEFINE_ACPI_GLOBALS
...@@ -371,7 +379,6 @@ ACPI_EXTERN char *acpi_gbl_db_buffer; ...@@ -371,7 +379,6 @@ ACPI_EXTERN char *acpi_gbl_db_buffer;
ACPI_EXTERN char *acpi_gbl_db_filename; ACPI_EXTERN char *acpi_gbl_db_filename;
ACPI_EXTERN u32 acpi_gbl_db_debug_level; ACPI_EXTERN u32 acpi_gbl_db_debug_level;
ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;
ACPI_EXTERN struct acpi_table_header *acpi_gbl_db_table_ptr;
ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;
/* /*
......
...@@ -64,13 +64,21 @@ u32 acpi_hw_get_mode(void); ...@@ -64,13 +64,21 @@ u32 acpi_hw_get_mode(void);
*/ */
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
acpi_status acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
acpi_hw_register_read(u32 register_id, u32 * return_value);
acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value);
acpi_status acpi_hw_register_write(u32 register_id, u32 value); acpi_status acpi_hw_register_write(u32 register_id, u32 value);
acpi_status acpi_hw_clear_acpi_status(void); acpi_status acpi_hw_clear_acpi_status(void);
/*
* hwvalid - Port I/O with validation
*/
acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width);
acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);
/* /*
* hwgpe - GPE support * hwgpe - GPE support
*/ */
......
...@@ -108,6 +108,14 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { ...@@ -108,6 +108,14 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = {
#endif #endif
#endif #endif
/* Lock structure for reader/writer interfaces */
struct acpi_rw_lock {
acpi_mutex writer_mutex;
acpi_mutex reader_mutex;
u32 num_readers;
};
/* /*
* Predefined handles for spinlocks used within the subsystem. * Predefined handles for spinlocks used within the subsystem.
* These spinlocks are created by acpi_ut_mutex_initialize * These spinlocks are created by acpi_ut_mutex_initialize
...@@ -772,7 +780,19 @@ struct acpi_bit_register_info { ...@@ -772,7 +780,19 @@ struct acpi_bit_register_info {
* must be preserved. * must be preserved.
*/ */
#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0200 /* Bit 9 (whatever) */
/* Write-only bits must be zeroed by software */
#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
/* For control registers, both ignored and reserved bits must be preserved */
#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0201 /* Bits 9, 0(SCI_EN) */
#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
#define ACPI_PM1_CONTROL_PRESERVED_BITS \
(ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
/* /*
* Register IDs * Register IDs
...@@ -781,12 +801,10 @@ struct acpi_bit_register_info { ...@@ -781,12 +801,10 @@ struct acpi_bit_register_info {
#define ACPI_REGISTER_PM1_STATUS 0x01 #define ACPI_REGISTER_PM1_STATUS 0x01
#define ACPI_REGISTER_PM1_ENABLE 0x02 #define ACPI_REGISTER_PM1_ENABLE 0x02
#define ACPI_REGISTER_PM1_CONTROL 0x03 #define ACPI_REGISTER_PM1_CONTROL 0x03
#define ACPI_REGISTER_PM1A_CONTROL 0x04 #define ACPI_REGISTER_PM2_CONTROL 0x04
#define ACPI_REGISTER_PM1B_CONTROL 0x05 #define ACPI_REGISTER_PM_TIMER 0x05
#define ACPI_REGISTER_PM2_CONTROL 0x06 #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
#define ACPI_REGISTER_PM_TIMER 0x07 #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08
#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09
/* Masks used to access the bit_registers */ /* Masks used to access the bit_registers */
...@@ -818,7 +836,7 @@ struct acpi_bit_register_info { ...@@ -818,7 +836,7 @@ struct acpi_bit_register_info {
#define ACPI_BITMASK_SCI_ENABLE 0x0001 #define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 #define ACPI_BITMASK_SLEEP_TYPE 0x1C00
#define ACPI_BITMASK_SLEEP_ENABLE 0x2000 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
#define ACPI_BITMASK_ARB_DISABLE 0x0001 #define ACPI_BITMASK_ARB_DISABLE 0x0001
...@@ -844,11 +862,35 @@ struct acpi_bit_register_info { ...@@ -844,11 +862,35 @@ struct acpi_bit_register_info {
#define ACPI_BITPOSITION_SCI_ENABLE 0x00 #define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
#define ACPI_BITPOSITION_ARB_DISABLE 0x00 #define ACPI_BITPOSITION_ARB_DISABLE 0x00
/* Structs and definitions for _OSI support and I/O port validation */
#define ACPI_OSI_WIN_2000 0x01
#define ACPI_OSI_WIN_XP 0x02
#define ACPI_OSI_WIN_XP_SP1 0x03
#define ACPI_OSI_WINSRV_2003 0x04
#define ACPI_OSI_WIN_XP_SP2 0x05
#define ACPI_OSI_WINSRV_2003_SP1 0x06
#define ACPI_OSI_WIN_VISTA 0x07
#define ACPI_ALWAYS_ILLEGAL 0x00
struct acpi_interface_info {
char *name;
u8 value;
};
struct acpi_port_info {
char *name;
u16 start;
u16 end;
u8 osi_dependency;
};
/***************************************************************************** /*****************************************************************************
* *
* Resource descriptors * Resource descriptors
......
...@@ -292,10 +292,6 @@ ...@@ -292,10 +292,6 @@
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) #define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
/* Macro to test the object type */
#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)
/* /*
* Macros for the master AML opcode table * Macros for the master AML opcode table
*/ */
......
...@@ -97,7 +97,6 @@ ...@@ -97,7 +97,6 @@
#define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_OBJECT_INITIALIZED 0x08
#define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20 #define AOPOBJ_SINGLE_DATUM 0x20
#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */
/****************************************************************************** /******************************************************************************
* *
......
...@@ -52,41 +52,44 @@ ...@@ -52,41 +52,44 @@
* 1) PTYPE1 packages do not contain sub-packages. * 1) PTYPE1 packages do not contain sub-packages.
* *
* ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types: * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types:
* object type * object type
* count * count
* object type * object type
* count * count
* *
* ACPI_PTYPE1_VAR: Variable length: * ACPI_PTYPE1_VAR: Variable length:
* object type (Int/Buf/Ref) * object type (Int/Buf/Ref)
* *
* ACPI_PTYPE1_OPTION: Package has some required and some optional elements: * ACPI_PTYPE1_OPTION: Package has some required and some optional elements
* Used for _PRW * (Used for _PRW)
* *
* *
* 2) PTYPE2 packages contain a variable number of sub-packages. Each of the * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
* different types describe the contents of each of the sub-packages. * different types describe the contents of each of the sub-packages.
* *
* ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
* object type * object type
* count * count
* object type * object type
* count * count
* (Used for _ALR,_MLS,_PSS,_TRT,_TSS)
* *
* ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
* object type * object type
* (Used for _CSD,_PSD,_TSD)
* *
* ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
* object type * object type
* count * count
* object type * object type
* count * count
* (Used for _CST)
* *
* ACPI_PTYPE2_FIXED: Each subpackage is of fixed length: * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length
* Used for _PRT * (Used for _PRT)
* *
* ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
* Used for _HPX * (Used for _HPX)
* *
*****************************************************************************/ *****************************************************************************/
......
...@@ -49,7 +49,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count); ...@@ -49,7 +49,7 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count);
/* /*
* tbfadt - FADT parse/convert/validate * tbfadt - FADT parse/convert/validate
*/ */
void acpi_tb_parse_fadt(u32 table_index, u8 flags); void acpi_tb_parse_fadt(u32 table_index);
void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length); void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
...@@ -79,7 +79,7 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc); ...@@ -79,7 +79,7 @@ void acpi_tb_delete_table(struct acpi_table_desc *table_desc);
void acpi_tb_terminate(void); void acpi_tb_terminate(void);
void acpi_tb_delete_namespace_by_owner(u32 table_index); acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
acpi_status acpi_tb_allocate_owner_id(u32 table_index); acpi_status acpi_tb_allocate_owner_id(u32 table_index);
...@@ -109,9 +109,8 @@ acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length); ...@@ -109,9 +109,8 @@ acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
void void
acpi_tb_install_table(acpi_physical_address address, acpi_tb_install_table(acpi_physical_address address,
u8 flags, char *signature, u32 table_index); char *signature, u32 table_index);
acpi_status acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags);
#endif /* __ACTABLES_H__ */ #endif /* __ACTABLES_H__ */
...@@ -345,6 +345,21 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, ...@@ -345,6 +345,21 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
acpi_status acpi_status
acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
/*
* utlock - reader/writer locks
*/
acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock);
void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock);
acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock);
acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock);
acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock);
void acpi_ut_release_write_lock(struct acpi_rw_lock *lock);
/* /*
* utobject - internal object create/delete/cache routines * utobject - internal object create/delete/cache routines
*/ */
......
...@@ -180,11 +180,23 @@ acpi_ds_initialize_objects(u32 table_index, ...@@ -180,11 +180,23 @@ acpi_ds_initialize_objects(u32 table_index,
/* Walk entire namespace from the supplied root */ /* Walk entire namespace from the supplied root */
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
acpi_ds_init_one_object, &info, NULL); if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* We don't use acpi_walk_namespace since we do not want to acquire
* the namespace reader lock.
*/
status =
acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object,
&info, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
} }
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
status = acpi_get_table_by_index(table_index, &table); status = acpi_get_table_by_index(table_index, &table);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
......
...@@ -713,6 +713,6 @@ acpi_ds_method_data_get_type(u16 opcode, ...@@ -713,6 +713,6 @@ acpi_ds_method_data_get_type(u16 opcode,
/* Get the object type */ /* Get the object type */
return_VALUE(ACPI_GET_OBJECT_TYPE(object)); return_VALUE(object->type);
} }
#endif #endif
...@@ -565,7 +565,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, ...@@ -565,7 +565,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,
/* Re-type the object according to its argument */ /* Re-type the object according to its argument */
node->type = ACPI_GET_OBJECT_TYPE(obj_desc); node->type = obj_desc->common.type;
/* Attach obj to node */ /* Attach obj to node */
...@@ -619,7 +619,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, ...@@ -619,7 +619,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
/* Perform per-object initialization */ /* Perform per-object initialization */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
...@@ -803,7 +803,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, ...@@ -803,7 +803,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
default: default:
ACPI_ERROR((AE_INFO, "Unimplemented data type: %X", ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE(obj_desc))); obj_desc->common.type));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
......
...@@ -397,30 +397,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) ...@@ -397,30 +397,6 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
extra_desc->extra.aml_length, extra_desc->extra.aml_length,
extra_desc->extra.aml_start); extra_desc->extra.aml_start);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Validate the region address/length via the host OS */
status = acpi_os_validate_address(obj_desc->region.space_id,
obj_desc->region.address,
(acpi_size) obj_desc->region.length,
acpi_ut_get_node_name(node));
if (ACPI_FAILURE(status)) {
/*
* Invalid address/length. We will emit an error message and mark
* the region as invalid, so that it will cause an additional error if
* it is ever used. Then return AE_OK.
*/
ACPI_EXCEPTION((AE_INFO, status,
"During address validation of OpRegion [%4.4s]",
node->name.ascii));
obj_desc->common.flags |= AOPOBJ_INVALID;
status = AE_OK;
}
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -484,7 +460,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, ...@@ -484,7 +460,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Host object must be a Buffer */ /* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Target of Create Field is not a Buffer object - %s", "Target of Create Field is not a Buffer object - %s",
acpi_ut_get_object_type_name(buffer_desc))); acpi_ut_get_object_type_name(buffer_desc)));
...@@ -1365,10 +1341,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, ...@@ -1365,10 +1341,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
if ((ACPI_GET_DESCRIPTOR_TYPE if ((ACPI_GET_DESCRIPTOR_TYPE
(walk_state->results->results.obj_desc[0]) == (walk_state->results->results.obj_desc[0]) ==
ACPI_DESC_TYPE_OPERAND) ACPI_DESC_TYPE_OPERAND)
&& && ((walk_state->results->results.obj_desc[0])->
(ACPI_GET_OBJECT_TYPE common.type == ACPI_TYPE_LOCAL_REFERENCE)
(walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])-> && ((walk_state->results->results.obj_desc[0])->
reference.class != ACPI_REFCLASS_INDEX)) { reference.class != ACPI_REFCLASS_INDEX)) {
status = status =
......
...@@ -816,7 +816,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state) ...@@ -816,7 +816,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state)
goto push_result; goto push_result;
} }
type = ACPI_GET_OBJECT_TYPE(*operand); type = (*operand)->common.type;
status = acpi_ex_resolve_to_value(operand, walk_state); status = acpi_ex_resolve_to_value(operand, walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
......
...@@ -138,11 +138,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, ...@@ -138,11 +138,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
goto cleanup; goto cleanup;
} }
if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { if (local_obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
obj_desc, walk_state, obj_desc, walk_state, obj_desc->common.type));
ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
......
...@@ -183,7 +183,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) ...@@ -183,7 +183,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Install the fixed event handlers and enable the fixed events. * DESCRIPTION: Install the fixed event handlers and disable all fixed events.
* *
******************************************************************************/ ******************************************************************************/
...@@ -200,12 +200,13 @@ static acpi_status acpi_ev_fixed_event_initialize(void) ...@@ -200,12 +200,13 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
acpi_gbl_fixed_event_handlers[i].handler = NULL; acpi_gbl_fixed_event_handlers[i].handler = NULL;
acpi_gbl_fixed_event_handlers[i].context = NULL; acpi_gbl_fixed_event_handlers[i].context = NULL;
/* Enable the fixed event */ /* Disable the fixed event */
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
status = status =
acpi_set_register(acpi_gbl_fixed_event_info[i]. acpi_write_bit_register(acpi_gbl_fixed_event_info
enable_register_id, 0); [i].enable_register_id,
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -288,16 +289,17 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event) ...@@ -288,16 +289,17 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
/* Clear the status bit */ /* Clear the status bit */
(void)acpi_set_register(acpi_gbl_fixed_event_info[event]. (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
status_register_id, 1); status_register_id, ACPI_CLEAR_STATUS);
/* /*
* Make sure we've got a handler. If not, report an error. The event is * Make sure we've got a handler. If not, report an error. The event is
* disabled to prevent further interrupts. * disabled to prevent further interrupts.
*/ */
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
(void)acpi_set_register(acpi_gbl_fixed_event_info[event]. (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 0); enable_register_id,
ACPI_DISABLE_EVENT);
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"No installed handler for fixed event [%08X]", "No installed handler for fixed event [%08X]",
......
...@@ -88,10 +88,10 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) ...@@ -88,10 +88,10 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
status = acpi_ev_disable_gpe(gpe_event_info); status = acpi_ev_disable_gpe(gpe_event_info);
/* Type was validated above */ /* Clear the type bits and insert the new Type */
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK;
gpe_event_info->flags |= type; /* Insert type */ gpe_event_info->flags |= type;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -122,6 +122,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, ...@@ -122,6 +122,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
if (!gpe_register_info) { if (!gpe_register_info) {
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
} }
register_bit = (u8) register_bit = (u8)
(1 << (1 <<
(gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
......
...@@ -104,9 +104,9 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) ...@@ -104,9 +104,9 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
while (gpe_block) { while (gpe_block) {
if ((&gpe_block->event_info[0] <= gpe_event_info) && if ((&gpe_block->event_info[0] <= gpe_event_info) &&
(&gpe_block-> (&gpe_block->event_info[((acpi_size)
event_info[((acpi_size) gpe_block-> gpe_block->
register_count) * 8] > register_count) * 8] >
gpe_event_info)) { gpe_event_info)) {
return (TRUE); return (TRUE);
} }
...@@ -210,10 +210,9 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, ...@@ -210,10 +210,9 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Now look at the individual GPEs in this byte register */ /* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_event_info = gpe_event_info = &gpe_block->event_info[((acpi_size) i *
&gpe_block-> ACPI_GPE_REGISTER_WIDTH)
event_info[((acpi_size) i * + j];
ACPI_GPE_REGISTER_WIDTH) + j];
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) { ACPI_GPE_DISPATCH_HANDLER) {
...@@ -293,8 +292,8 @@ acpi_ev_save_method_info(acpi_handle obj_handle, ...@@ -293,8 +292,8 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
/* Unknown method type, just ignore it! */ /* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", "Ignoring unknown GPE method type: %s "
name)); "(name not of form _Lxx or _Exx)", name));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
...@@ -306,17 +305,16 @@ acpi_ev_save_method_info(acpi_handle obj_handle, ...@@ -306,17 +305,16 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
/* Conversion failed; invalid method, just ignore it */ /* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", "Could not extract GPE number from name: %s "
name)); "(name is not of form _Lxx or _Exx)", name));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* Ensure that we have a valid GPE number for this GPE block */ /* Ensure that we have a valid GPE number for this GPE block */
if ((gpe_number < gpe_block->block_base_number) || if ((gpe_number < gpe_block->block_base_number) ||
(gpe_number >= (gpe_number >= (gpe_block->block_base_number +
(gpe_block->block_base_number + (gpe_block->register_count * 8)))) {
(gpe_block->register_count * 8)))) {
/* /*
* Not valid for this GPE block, just ignore it. However, it may be * Not valid for this GPE block, just ignore it. However, it may be
* valid for a different GPE block, since GPE0 and GPE1 methods both * valid for a different GPE block, since GPE0 and GPE1 methods both
...@@ -408,7 +406,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -408,7 +406,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
*/ */
obj_desc = pkg_desc->package.elements[0]; obj_desc = pkg_desc->package.elements[0];
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
/* Use FADT-defined GPE device (from definition of _PRW) */ /* Use FADT-defined GPE device (from definition of _PRW) */
...@@ -417,15 +415,15 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -417,15 +415,15 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
/* Integer is the GPE number in the FADT described GPE blocks */ /* Integer is the GPE number in the FADT described GPE blocks */
gpe_number = (u32) obj_desc->integer.value; gpe_number = (u32) obj_desc->integer.value;
} else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { } else if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {
/* Package contains a GPE reference and GPE number within a GPE block */ /* Package contains a GPE reference and GPE number within a GPE block */
if ((obj_desc->package.count < 2) || if ((obj_desc->package.count < 2) ||
(ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) != ((obj_desc->package.elements[0])->common.type !=
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE) ||
|| (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) != ((obj_desc->package.elements[1])->common.type !=
ACPI_TYPE_INTEGER)) { ACPI_TYPE_INTEGER)) {
goto cleanup; goto cleanup;
} }
...@@ -450,11 +448,11 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, ...@@ -450,11 +448,11 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
*/ */
if ((gpe_device == target_gpe_device) && if ((gpe_device == target_gpe_device) &&
(gpe_number >= gpe_block->block_base_number) && (gpe_number >= gpe_block->block_base_number) &&
(gpe_number < (gpe_number < gpe_block->block_base_number +
gpe_block->block_base_number + (gpe_block->register_count * 8))) { (gpe_block->register_count * 8))) {
gpe_event_info = gpe_event_info = &gpe_block->event_info[gpe_number -
&gpe_block->event_info[gpe_number - gpe_block->
gpe_block->block_base_number]; block_base_number];
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
...@@ -1033,8 +1031,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -1033,8 +1031,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
* 1) are "runtime" or "run/wake" GPEs, and * 1) are "runtime" or "run/wake" GPEs, and
* 2) have a corresponding _Lxx or _Exx method * 2) have a corresponding _Lxx or _Exx method
* *
* Any other GPEs within this block must be enabled via the acpi_enable_gpe() * Any other GPEs within this block must be enabled via the
* external interface. * acpi_enable_gpe() external interface.
*/ */
wake_gpe_count = 0; wake_gpe_count = 0;
gpe_enabled_count = 0; gpe_enabled_count = 0;
...@@ -1044,14 +1042,13 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, ...@@ -1044,14 +1042,13 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
/* Get the info block for this particular GPE */ /* Get the info block for this particular GPE */
gpe_event_info = gpe_event_info = &gpe_block->event_info[((acpi_size) i *
&gpe_block-> ACPI_GPE_REGISTER_WIDTH)
event_info[((acpi_size) i * + j];
ACPI_GPE_REGISTER_WIDTH) + j];
if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD) ACPI_GPE_DISPATCH_METHOD) &&
&& (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
gpe_enabled_count++; gpe_enabled_count++;
} }
...@@ -1105,8 +1102,8 @@ acpi_status acpi_ev_gpe_initialize(void) ...@@ -1105,8 +1102,8 @@ acpi_status acpi_ev_gpe_initialize(void)
/* /*
* Initialize the GPE Block(s) defined in the FADT * Initialize the GPE Block(s) defined in the FADT
* *
* Why the GPE register block lengths are divided by 2: From the ACPI Spec, * Why the GPE register block lengths are divided by 2: From the ACPI
* section "General-Purpose Event Registers", we have: * Spec, section "General-Purpose Event Registers", we have:
* *
* "Each register block contains two registers of equal length * "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
...@@ -1163,7 +1160,8 @@ acpi_status acpi_ev_gpe_initialize(void) ...@@ -1163,7 +1160,8 @@ acpi_status acpi_ev_gpe_initialize(void)
if ((register_count0) && if ((register_count0) &&
(gpe_number_max >= acpi_gbl_FADT.gpe1_base)) { (gpe_number_max >= acpi_gbl_FADT.gpe1_base)) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", "GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
"(GPE %d to %d) - Ignoring GPE1",
gpe_number_max, acpi_gbl_FADT.gpe1_base, gpe_number_max, acpi_gbl_FADT.gpe1_base,
acpi_gbl_FADT.gpe1_base + acpi_gbl_FADT.gpe1_base +
((register_count1 * ((register_count1 *
......
...@@ -163,10 +163,10 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, ...@@ -163,10 +163,10 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
* 2) Global device notify handler * 2) Global device notify handler
* 3) Per-device notify handler * 3) Per-device notify handler
*/ */
if ((acpi_gbl_system_notify.handler if ((acpi_gbl_system_notify.handler &&
&& (notify_value <= ACPI_MAX_SYS_NOTIFY)) (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
|| (acpi_gbl_device_notify.handler (acpi_gbl_device_notify.handler &&
&& (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) { (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
notify_info = acpi_ut_create_generic_state(); notify_info = acpi_ut_create_generic_state();
if (!notify_info) { if (!notify_info) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
...@@ -174,7 +174,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, ...@@ -174,7 +174,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
if (!handler_obj) { if (!handler_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Executing system notify handler for Notify (%4.4s, %X) node %p\n", "Executing system notify handler for Notify (%4.4s, %X) "
"node %p\n",
acpi_ut_get_node_name(node), acpi_ut_get_node_name(node),
notify_value, node)); notify_value, node));
} }
...@@ -534,8 +535,9 @@ acpi_status acpi_ev_release_global_lock(void) ...@@ -534,8 +535,9 @@ acpi_status acpi_ev_release_global_lock(void)
*/ */
if (pending) { if (pending) {
status = status =
acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE, acpi_write_bit_register
1); (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
ACPI_ENABLE_EVENT);
} }
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
......
...@@ -691,7 +691,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, ...@@ -691,7 +691,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
/* Devices are handled different than regions */ /* Devices are handled different than regions */
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { if (obj_desc->common.type == ACPI_TYPE_DEVICE) {
/* Check if this Device already has a handler for this address space */ /* Check if this Device already has a handler for this address space */
...@@ -703,7 +703,8 @@ acpi_ev_install_handler(acpi_handle obj_handle, ...@@ -703,7 +703,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,
if (next_handler_obj->address_space.space_id == if (next_handler_obj->address_space.space_id ==
handler_obj->address_space.space_id) { handler_obj->address_space.space_id) {
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Found handler for region [%s] in device %p(%p) handler %p\n", "Found handler for region [%s] in device %p(%p) "
"handler %p\n",
acpi_ut_get_region_name acpi_ut_get_region_name
(handler_obj->address_space. (handler_obj->address_space.
space_id), obj_desc, space_id), obj_desc,
......
...@@ -241,7 +241,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, ...@@ -241,7 +241,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
"Could not install PciConfig handler for Root Bridge %4.4s", "Could not install PciConfig handler "
"for Root Bridge %4.4s",
acpi_ut_get_node_name acpi_ut_get_node_name
(pci_root_node))); (pci_root_node)));
} }
...@@ -293,9 +294,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, ...@@ -293,9 +294,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
* Get the PCI device and function numbers from the _ADR object contained * Get the PCI device and function numbers from the _ADR object contained
* in the parent's scope. * in the parent's scope.
*/ */
status = status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR,
acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node, pci_device_node, &pci_value);
&pci_value);
/* /*
* The default is zero, and since the allocation above zeroed the data, * The default is zero, and since the allocation above zeroed the data,
...@@ -308,18 +308,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, ...@@ -308,18 +308,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
/* The PCI segment number comes from the _SEG method */ /* The PCI segment number comes from the _SEG method */
status = status = acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG,
acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node, pci_root_node, &pci_value);
&pci_value);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
pci_id->segment = ACPI_LOWORD(pci_value); pci_id->segment = ACPI_LOWORD(pci_value);
} }
/* The PCI bus number comes from the _BBN method */ /* The PCI bus number comes from the _BBN method */
status = status = acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN,
acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node, pci_root_node, &pci_value);
&pci_value);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
pci_id->bus = ACPI_LOWORD(pci_value); pci_id->bus = ACPI_LOWORD(pci_value);
} }
...@@ -632,8 +630,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, ...@@ -632,8 +630,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
acpi_ns_locked); acpi_ns_locked);
/* /*
* Tell all users that this region is usable by running the _REG * Tell all users that this region is usable by
* method * running the _REG method
*/ */
if (acpi_ns_locked) { if (acpi_ns_locked) {
status = status =
......
...@@ -631,7 +631,8 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ...@@ -631,7 +631,8 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
/* Setup up dispatch flags to indicate handler (vs. method) */ /* Setup up dispatch flags to indicate handler (vs. method) */
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */ gpe_event_info->flags &=
~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER); gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
acpi_os_release_lock(acpi_gbl_gpe_lock, flags); acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
......
...@@ -172,8 +172,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) ...@@ -172,8 +172,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
* register bit) * register bit)
*/ */
status = status =
acpi_set_register(acpi_gbl_fixed_event_info[event]. acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 1); enable_register_id, ACPI_ENABLE_EVENT);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -181,8 +181,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags) ...@@ -181,8 +181,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
/* Make sure that the hardware responded */ /* Make sure that the hardware responded */
status = status =
acpi_get_register(acpi_gbl_fixed_event_info[event]. acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, &value); enable_register_id, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -354,15 +354,15 @@ acpi_status acpi_disable_event(u32 event, u32 flags) ...@@ -354,15 +354,15 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
* register bit) * register bit)
*/ */
status = status =
acpi_set_register(acpi_gbl_fixed_event_info[event]. acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 0); enable_register_id, ACPI_DISABLE_EVENT);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = status =
acpi_get_register(acpi_gbl_fixed_event_info[event]. acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, &value); enable_register_id, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -407,8 +407,8 @@ acpi_status acpi_clear_event(u32 event) ...@@ -407,8 +407,8 @@ acpi_status acpi_clear_event(u32 event)
* register bit) * register bit)
*/ */
status = status =
acpi_set_register(acpi_gbl_fixed_event_info[event]. acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
status_register_id, 1); status_register_id, ACPI_CLEAR_STATUS);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -495,7 +495,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) ...@@ -495,7 +495,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
/* Get the status of the requested fixed event */ /* Get the status of the requested fixed event */
status = status =
acpi_get_register(acpi_gbl_fixed_event_info[event]. acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
enable_register_id, &value); enable_register_id, &value);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -503,7 +503,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) ...@@ -503,7 +503,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
*event_status = value; *event_status = value;
status = status =
acpi_get_register(acpi_gbl_fixed_event_info[event]. acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
status_register_id, &value); status_register_id, &value);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
......
...@@ -193,7 +193,8 @@ acpi_remove_address_space_handler(acpi_handle device, ...@@ -193,7 +193,8 @@ acpi_remove_address_space_handler(acpi_handle device,
/* Matched space_id, first dereference this in the Regions */ /* Matched space_id, first dereference this in the Regions */
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n", "Removing address handler %p(%p) for region %s "
"on Device %p(%p)\n",
handler_obj, handler, handler_obj, handler,
acpi_ut_get_region_name(space_id), acpi_ut_get_region_name(space_id),
node, obj_desc)); node, obj_desc));
......
...@@ -291,7 +291,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, ...@@ -291,7 +291,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
/* Source Object can be either an op_region or a Buffer/Field */ /* Source Object can be either an op_region or a Buffer/Field */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
...@@ -501,7 +501,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) ...@@ -501,7 +501,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
*/ */
if ((!ddb_handle) || if ((!ddb_handle) ||
(ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) { (ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE)) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
...@@ -520,13 +520,14 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) ...@@ -520,13 +520,14 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
} }
} }
/* /* Delete the portion of the namespace owned by this table */
* Delete the entire namespace under this table Node
* (Offset contains the table_id) status = acpi_tb_delete_namespace_by_owner(table_index);
*/ if (ACPI_FAILURE(status)) {
acpi_tb_delete_namespace_by_owner(table_index); return_ACPI_STATUS(status);
(void)acpi_tb_release_owner_id(table_index); }
(void)acpi_tb_release_owner_id(table_index);
acpi_tb_set_table_loaded_flag(table_index, FALSE); acpi_tb_set_table_loaded_flag(table_index, FALSE);
/* Table unloaded, remove a reference to the ddb_handle object */ /* Table unloaded, remove a reference to the ddb_handle object */
......
...@@ -82,7 +82,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, ...@@ -82,7 +82,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* No conversion necessary */ /* No conversion necessary */
...@@ -116,7 +116,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, ...@@ -116,7 +116,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
/* String conversion is different than Buffer conversion */ /* String conversion is different than Buffer conversion */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
...@@ -206,7 +206,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, ...@@ -206,7 +206,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc); ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* No conversion necessary */ /* No conversion necessary */
...@@ -409,7 +409,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, ...@@ -409,7 +409,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc); ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* No conversion necessary */ /* No conversion necessary */
...@@ -605,8 +605,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, ...@@ -605,8 +605,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
default: default:
/* No conversion allowed for these types */ /* No conversion allowed for these types */
if (destination_type != if (destination_type != source_desc->common.type) {
ACPI_GET_OBJECT_TYPE(source_desc)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Explicit operator, will store (%s) over existing type (%s)\n", "Explicit operator, will store (%s) over existing type (%s)\n",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
......
...@@ -350,6 +350,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, ...@@ -350,6 +350,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
break; break;
case ACPI_EXD_TYPE: case ACPI_EXD_TYPE:
acpi_ex_out_string("Type", acpi_ex_out_string("Type",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc)); (obj_desc));
...@@ -422,6 +423,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, ...@@ -422,6 +423,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
break; break;
default: default:
acpi_os_printf("**** Invalid table opcode [%X] ****\n", acpi_os_printf("**** Invalid table opcode [%X] ****\n",
info->opcode); info->opcode);
return; return;
...@@ -492,7 +494,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -492,7 +494,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
/* Decode object type */ /* Decode object type */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("Reference: [%s] ", acpi_os_printf("Reference: [%s] ",
...@@ -527,44 +529,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -527,44 +529,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
type)); type));
break; break;
case ACPI_REFCLASS_ARG: case ACPI_REFCLASS_NAME:
acpi_os_printf("%X", obj_desc->reference.value);
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is an Integer */
acpi_os_printf(" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64(obj_desc->
integer.
value));
}
acpi_os_printf("\n"); acpi_os_printf("- [%4.4s]\n",
obj_desc->reference.node->name.ascii);
break; break;
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL: case ACPI_REFCLASS_LOCAL:
acpi_os_printf("%X", obj_desc->reference.value); acpi_os_printf("%X\n", obj_desc->reference.value);
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
/* Value is an Integer */
acpi_os_printf(" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64(obj_desc->
integer.
value));
}
acpi_os_printf("\n");
break;
case ACPI_REFCLASS_NAME:
acpi_os_printf("- [%4.4s]\n",
obj_desc->reference.node->name.ascii);
break; break;
default: /* Unknown reference class */ default: /* Unknown reference class */
...@@ -661,8 +635,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -661,8 +635,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf acpi_os_printf
("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
obj_desc->field.bit_length, "byte=%X bit=%X of below:\n", obj_desc->field.bit_length,
obj_desc->field.access_byte_width, obj_desc->field.access_byte_width,
obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
...@@ -686,9 +660,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -686,9 +660,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
if (!obj_desc->buffer_field.buffer_obj) { if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n")); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
} else } else if ((obj_desc->buffer_field.buffer_obj)->common.type !=
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) ACPI_TYPE_BUFFER) {
!= ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer*\n"); acpi_os_printf("*not a Buffer*\n");
} else { } else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
...@@ -737,8 +710,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) ...@@ -737,8 +710,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
default: default:
/* Unknown Type */ /* Unknown Type */
acpi_os_printf("Unknown Type %X\n", acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
ACPI_GET_OBJECT_TYPE(obj_desc));
break; break;
} }
...@@ -939,7 +911,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, ...@@ -939,7 +911,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
/* Packages may only contain a few object types */ /* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
acpi_os_printf("[Integer] = %8.8X%8.8X\n", acpi_os_printf("[Integer] = %8.8X%8.8X\n",
...@@ -990,8 +962,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, ...@@ -990,8 +962,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
default: default:
acpi_os_printf("[Unknown Type] %X\n", acpi_os_printf("[Unknown Type] %X\n", obj_desc->common.type);
ACPI_GET_OBJECT_TYPE(obj_desc));
break; break;
} }
} }
......
...@@ -84,7 +84,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -84,7 +84,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* If the buffer_field arguments have not been previously evaluated, * If the buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results. * evaluate them now and save the results.
...@@ -95,9 +95,8 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -95,9 +95,8 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
} else } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) (obj_desc->field.region_obj->region.space_id ==
&& (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) { ACPI_ADR_SPACE_SMBUS)) {
/* /*
* This is an SMBus read. We must create a buffer to hold the data * This is an SMBus read. We must create a buffer to hold the data
...@@ -163,7 +162,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -163,7 +162,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, obj_desc, obj_desc->common.type, buffer,
(u32) length)); (u32) length));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
...@@ -222,7 +221,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -222,7 +221,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* If the buffer_field arguments have not been previously evaluated, * If the buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results. * evaluate them now and save the results.
...@@ -233,9 +232,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -233,9 +232,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
} else } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) (obj_desc->field.region_obj->region.space_id ==
&& (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) { ACPI_ADR_SPACE_SMBUS)) {
/* /*
* This is an SMBus write. We will bypass the entire field mechanism * This is an SMBus write. We will bypass the entire field mechanism
...@@ -243,7 +241,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -243,7 +241,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
* *
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/ */
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { if (source_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"SMBus write requires Buffer, found type %s", "SMBus write requires Buffer, found type %s",
acpi_ut_get_object_type_name(source_desc))); acpi_ut_get_object_type_name(source_desc)));
...@@ -291,7 +289,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -291,7 +289,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
/* Get a pointer to the data to be written */ /* Get a pointer to the data to be written */
switch (ACPI_GET_OBJECT_TYPE(source_desc)) { switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value; buffer = &source_desc->integer.value;
length = sizeof(source_desc->integer.value); length = sizeof(source_desc->integer.value);
...@@ -314,15 +312,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -314,15 +312,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
source_desc, source_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE acpi_ut_get_type_name(source_desc->common.type),
(source_desc)), source_desc->common.type, buffer, length));
ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
obj_desc, obj_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), acpi_ut_get_type_name(obj_desc->common.type),
ACPI_GET_OBJECT_TYPE(obj_desc), obj_desc->common.type,
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset, obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset)); obj_desc->common_field.base_byte_offset));
......
...@@ -94,9 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, ...@@ -94,9 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
/* We must have a valid region */ /* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { if (rgn_desc->common.type != ACPI_TYPE_REGION) {
ACPI_ERROR((AE_INFO, "Needed Region, found type %X (%s)", ACPI_ERROR((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE(rgn_desc), rgn_desc->common.type,
acpi_ut_get_object_type_name(rgn_desc))); acpi_ut_get_object_type_name(rgn_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
...@@ -113,12 +113,6 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, ...@@ -113,12 +113,6 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
} }
} }
/* Exit if Address/Length have been disallowed by the host OS */
if (rgn_desc->common.flags & AOPOBJ_INVALID) {
return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
}
/* /*
* Exit now for SMBus address space, it has a non-linear address space * Exit now for SMBus address space, it has a non-linear address space
* and the request cannot be directly validated * and the request cannot be directly validated
...@@ -390,7 +384,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, ...@@ -390,7 +384,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
* index_field - Write to an Index Register, then read/write from/to a * index_field - Write to an Index Register, then read/write from/to a
* Data Register * Data Register
*/ */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
/* /*
* If the buffer_field arguments have not been previously evaluated, * If the buffer_field arguments have not been previously evaluated,
...@@ -527,7 +521,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, ...@@ -527,7 +521,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
default: default:
ACPI_ERROR((AE_INFO, "Wrong object type in field I/O %X", ACPI_ERROR((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE(obj_desc))); obj_desc->common.type));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
......
...@@ -80,7 +80,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, ...@@ -80,7 +80,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) { if (obj_desc->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
...@@ -260,7 +260,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, ...@@ -260,7 +260,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
* guaranteed to be either Integer/String/Buffer by the operand * guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism. * resolution mechanism.
*/ */
switch (ACPI_GET_OBJECT_TYPE(operand0)) { switch (operand0->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16); acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
...@@ -277,7 +277,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, ...@@ -277,7 +277,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
default: default:
ACPI_ERROR((AE_INFO, "Invalid object type: %X", ACPI_ERROR((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE(operand0))); operand0->common.type));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
} }
...@@ -298,7 +298,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, ...@@ -298,7 +298,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
* 2) Two Strings concatenated to produce a new String * 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer * 3) Two Buffers concatenated to produce a new Buffer
*/ */
switch (ACPI_GET_OBJECT_TYPE(operand0)) { switch (operand0->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Result of two Integers is a Buffer */ /* Result of two Integers is a Buffer */
...@@ -379,7 +379,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, ...@@ -379,7 +379,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Invalid object type, should not happen here */ /* Invalid object type, should not happen here */
ACPI_ERROR((AE_INFO, "Invalid object type: %X", ACPI_ERROR((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE(operand0))); operand0->common.type));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
goto cleanup; goto cleanup;
} }
...@@ -581,7 +581,7 @@ acpi_ex_do_logical_op(u16 opcode, ...@@ -581,7 +581,7 @@ acpi_ex_do_logical_op(u16 opcode,
* guaranteed to be either Integer/String/Buffer by the operand * guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism. * resolution mechanism.
*/ */
switch (ACPI_GET_OBJECT_TYPE(operand0)) { switch (operand0->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
status = status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16); acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
...@@ -608,7 +608,7 @@ acpi_ex_do_logical_op(u16 opcode, ...@@ -608,7 +608,7 @@ acpi_ex_do_logical_op(u16 opcode,
/* /*
* Two cases: 1) Both Integers, 2) Both Strings or Buffers * Two cases: 1) Both Integers, 2) Both Strings or Buffers
*/ */
if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) { if (operand0->common.type == ACPI_TYPE_INTEGER) {
/* /*
* 1) Both operands are of type integer * 1) Both operands are of type integer
* Note: local_operand1 may have changed above * Note: local_operand1 may have changed above
......
...@@ -807,11 +807,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -807,11 +807,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
acpi_namespace_node *) acpi_namespace_node *)
operand[0]); operand[0]);
if (temp_desc if (temp_desc
&& && ((temp_desc->common.type == ACPI_TYPE_STRING)
((ACPI_GET_OBJECT_TYPE(temp_desc) == || (temp_desc->common.type ==
ACPI_TYPE_STRING) ACPI_TYPE_LOCAL_REFERENCE))) {
|| (ACPI_GET_OBJECT_TYPE(temp_desc) ==
ACPI_TYPE_LOCAL_REFERENCE))) {
operand[0] = temp_desc; operand[0] = temp_desc;
acpi_ut_add_reference(temp_desc); acpi_ut_add_reference(temp_desc);
} else { } else {
...@@ -819,7 +817,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -819,7 +817,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
goto cleanup; goto cleanup;
} }
} else { } else {
switch (ACPI_GET_OBJECT_TYPE(operand[0])) { switch ((operand[0])->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
/* /*
* This is a deref_of (local_x | arg_x) * This is a deref_of (local_x | arg_x)
...@@ -877,8 +875,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ...@@ -877,8 +875,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_OBJECT_TYPE(operand[0]) == if ((operand[0])->common.type == ACPI_TYPE_STRING) {
ACPI_TYPE_STRING) {
/* /*
* This is a deref_of (String). The string is a reference * This is a deref_of (String). The string is a reference
* to a named ACPI object. * to a named ACPI object.
......
...@@ -399,7 +399,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -399,7 +399,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
* At this point, the Source operand is a String, Buffer, or Package. * At this point, the Source operand is a String, Buffer, or Package.
* Verify that the index is within range. * Verify that the index is within range.
*/ */
switch (ACPI_GET_OBJECT_TYPE(operand[0])) { switch ((operand[0])->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
if (index >= operand[0]->string.length) { if (index >= operand[0]->string.length) {
......
...@@ -161,9 +161,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -161,9 +161,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
* Create the return object. The Source operand is guaranteed to be * Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type. * either a String or a Buffer, so just use its type.
*/ */
return_desc = return_desc = acpi_ut_create_internal_object((operand[0])->
acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE common.type);
(operand[0]));
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
...@@ -191,7 +190,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) ...@@ -191,7 +190,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
/* Strings always have a sub-pointer, not so for buffers */ /* Strings always have a sub-pointer, not so for buffers */
switch (ACPI_GET_OBJECT_TYPE(operand[0])) { switch ((operand[0])->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* Always allocate a new buffer for the String */ /* Always allocate a new buffer for the String */
......
...@@ -279,7 +279,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, ...@@ -279,7 +279,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
return_UINT32(0); return_UINT32(0);
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
/* /*
* buffer_field access can be on any byte boundary, so the * buffer_field access can be on any byte boundary, so the
* byte_alignment is always 1 byte -- regardless of any byte_alignment * byte_alignment is always 1 byte -- regardless of any byte_alignment
......
...@@ -294,14 +294,14 @@ acpi_ex_system_io_space_handler(u32 function, ...@@ -294,14 +294,14 @@ acpi_ex_system_io_space_handler(u32 function,
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
status = acpi_os_read_port((acpi_io_address) address, status = acpi_hw_read_port((acpi_io_address) address,
&value32, bit_width); &value32, bit_width);
*value = value32; *value = value32;
break; break;
case ACPI_WRITE: case ACPI_WRITE:
status = acpi_os_write_port((acpi_io_address) address, status = acpi_hw_write_port((acpi_io_address) address,
(u32) * value, bit_width); (u32) * value, bit_width);
break; break;
......
...@@ -136,7 +136,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -136,7 +136,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
switch (entry_type) { switch (entry_type) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { if (source_desc->common.type != ACPI_TYPE_PACKAGE) {
ACPI_ERROR((AE_INFO, "Object not a Package, type %s", ACPI_ERROR((AE_INFO, "Object not a Package, type %s",
acpi_ut_get_object_type_name(source_desc))); acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
...@@ -154,7 +154,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -154,7 +154,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { if (source_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO, "Object not a Buffer, type %s", ACPI_ERROR((AE_INFO, "Object not a Buffer, type %s",
acpi_ut_get_object_type_name(source_desc))); acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
...@@ -172,7 +172,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -172,7 +172,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { if (source_desc->common.type != ACPI_TYPE_STRING) {
ACPI_ERROR((AE_INFO, "Object not a String, type %s", ACPI_ERROR((AE_INFO, "Object not a String, type %s",
acpi_ut_get_object_type_name(source_desc))); acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
...@@ -186,7 +186,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, ...@@ -186,7 +186,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { if (source_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, "Object not a Integer, type %s", ACPI_ERROR((AE_INFO, "Object not a Integer, type %s",
acpi_ut_get_object_type_name(source_desc))); acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
......
...@@ -149,7 +149,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, ...@@ -149,7 +149,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
/* This is a union acpi_operand_object */ /* This is a union acpi_operand_object */
switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { switch (stack_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
ref_type = stack_desc->reference.class; ref_type = stack_desc->reference.class;
...@@ -297,8 +297,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, ...@@ -297,8 +297,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"FieldRead SourceDesc=%p Type=%X\n", "FieldRead SourceDesc=%p Type=%X\n",
stack_desc, stack_desc, stack_desc->common.type));
ACPI_GET_OBJECT_TYPE(stack_desc)));
status = status =
acpi_ex_read_data_from_field(walk_state, stack_desc, acpi_ex_read_data_from_field(walk_state, stack_desc,
...@@ -386,7 +385,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -386,7 +385,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
* specification of the object_type and size_of operators). This means * specification of the object_type and size_of operators). This means
* traversing the list of possibly many nested references. * traversing the list of possibly many nested references.
*/ */
while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { while (obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
switch (obj_desc->reference.class) { switch (obj_desc->reference.class) {
case ACPI_REFCLASS_REFOF: case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_NAME: case ACPI_REFCLASS_NAME:
...@@ -518,7 +517,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, ...@@ -518,7 +517,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
* Now we are guaranteed to have an object that has not been created * Now we are guaranteed to have an object that has not been created
* via the ref_of or Index operators. * via the ref_of or Index operators.
*/ */
type = ACPI_GET_OBJECT_TYPE(obj_desc); type = obj_desc->common.type;
exit: exit:
/* Convert internal types to external types */ /* Convert internal types to external types */
......
...@@ -212,7 +212,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -212,7 +212,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* ACPI internal object */ /* ACPI internal object */
object_type = ACPI_GET_OBJECT_TYPE(obj_desc); object_type = obj_desc->common.type;
/* Check for bad acpi_object_type */ /* Check for bad acpi_object_type */
...@@ -287,8 +287,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -287,8 +287,7 @@ acpi_ex_resolve_operands(u16 opcode,
if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
ACPI_DESC_TYPE_OPERAND) ACPI_DESC_TYPE_OPERAND)
&& (ACPI_GET_OBJECT_TYPE(obj_desc) == && (obj_desc->common.type == ACPI_TYPE_STRING)) {
ACPI_TYPE_STRING)) {
/* /*
* String found - the string references a named object and * String found - the string references a named object and
* must be resolved to a node * must be resolved to a node
...@@ -336,7 +335,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -336,7 +335,7 @@ acpi_ex_resolve_operands(u16 opcode,
* -- All others must be resolved below. * -- All others must be resolved below.
*/ */
if ((opcode == AML_STORE_OP) && if ((opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE(*stack_ptr) == ((*stack_ptr)->common.type ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) { && ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) {
goto next_operand; goto next_operand;
...@@ -490,7 +489,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -490,7 +489,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Need an operand of type INTEGER, STRING or BUFFER */ /* Need an operand of type INTEGER, STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -512,7 +511,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -512,7 +511,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Need an operand of type STRING or BUFFER */ /* Need an operand of type STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -553,7 +552,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -553,7 +552,7 @@ acpi_ex_resolve_operands(u16 opcode,
* The only reference allowed here is a direct reference to * The only reference allowed here is a direct reference to
* a namespace node. * a namespace node.
*/ */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -576,7 +575,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -576,7 +575,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Need a buffer or package or (ACPI 2.0) String */ /* Need a buffer or package or (ACPI 2.0) String */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
...@@ -598,7 +597,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -598,7 +597,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
...@@ -619,7 +618,7 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -619,7 +618,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Used by the Store() operator only */ /* Used by the Store() operator only */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
...@@ -677,8 +676,8 @@ acpi_ex_resolve_operands(u16 opcode, ...@@ -677,8 +676,8 @@ acpi_ex_resolve_operands(u16 opcode,
* required object type (Simple cases only). * required object type (Simple cases only).
*/ */
status = acpi_ex_check_object_type(type_needed, status = acpi_ex_check_object_type(type_needed,
ACPI_GET_OBJECT_TYPE (*stack_ptr)->common.type,
(*stack_ptr), *stack_ptr); *stack_ptr);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -129,7 +129,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, ...@@ -129,7 +129,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
/* source_desc is of type ACPI_DESC_TYPE_OPERAND */ /* source_desc is of type ACPI_DESC_TYPE_OPERAND */
switch (ACPI_GET_OBJECT_TYPE(source_desc)) { switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Output correct integer width */ /* Output correct integer width */
...@@ -324,7 +324,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, ...@@ -324,7 +324,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
/* Destination object must be a Reference or a Constant object */ /* Destination object must be a Reference or a Constant object */
switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { switch (dest_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
break; break;
...@@ -460,9 +460,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, ...@@ -460,9 +460,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
*/ */
obj_desc = *(index_desc->reference.where); obj_desc = *(index_desc->reference.where);
if (ACPI_GET_OBJECT_TYPE(source_desc) == if (source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE &&
ACPI_TYPE_LOCAL_REFERENCE source_desc->reference.class == ACPI_REFCLASS_TABLE) {
&& source_desc->reference.class == ACPI_REFCLASS_TABLE) {
/* This is a DDBHandle, just add a reference to it */ /* This is a DDBHandle, just add a reference to it */
...@@ -520,8 +519,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, ...@@ -520,8 +519,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
* by the INDEX_OP code. * by the INDEX_OP code.
*/ */
obj_desc = index_desc->reference.object; obj_desc = index_desc->reference.object;
if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) && if ((obj_desc->common.type != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) { (obj_desc->common.type != ACPI_TYPE_STRING)) {
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
...@@ -529,7 +528,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, ...@@ -529,7 +528,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
* The assignment of the individual elements will be slightly * The assignment of the individual elements will be slightly
* different for each source type. * different for each source type.
*/ */
switch (ACPI_GET_OBJECT_TYPE(source_desc)) { switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
/* Use the least-significant byte of the integer */ /* Use the least-significant byte of the integer */
...@@ -707,8 +706,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, ...@@ -707,8 +706,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
/* No conversions for all other types. Just attach the source object */ /* No conversions for all other types. Just attach the source object */
status = acpi_ns_attach_object(node, source_desc, status = acpi_ns_attach_object(node, source_desc,
ACPI_GET_OBJECT_TYPE source_desc->common.type);
(source_desc));
break; break;
} }
......
...@@ -96,8 +96,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, ...@@ -96,8 +96,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
* are all essentially the same. This case handles the * are all essentially the same. This case handles the
* "interchangeable" types Integer, String, and Buffer. * "interchangeable" types Integer, String, and Buffer.
*/ */
if (ACPI_GET_OBJECT_TYPE(source_desc) == if (source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
ACPI_TYPE_LOCAL_REFERENCE) {
/* Resolve a reference object first */ /* Resolve a reference object first */
...@@ -117,13 +116,11 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, ...@@ -117,13 +116,11 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
/* Must have a Integer, Buffer, or String */ /* Must have a Integer, Buffer, or String */
if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) && if ((source_desc->common.type != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) && (source_desc->common.type != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && (source_desc->common.type != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE(source_desc) == !((source_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
ACPI_TYPE_LOCAL_REFERENCE) (source_desc->reference.class == ACPI_REFCLASS_TABLE))) {
&& (source_desc->reference.class ==
ACPI_REFCLASS_TABLE))) {
/* Conversion successful but still not a valid type */ /* Conversion successful but still not a valid type */
...@@ -218,8 +215,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, ...@@ -218,8 +215,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
if (ACPI_GET_OBJECT_TYPE(source_desc) != if (source_desc->common.type != dest_desc->common.type) {
ACPI_GET_OBJECT_TYPE(dest_desc)) {
/* /*
* The source type does not match the type of the destination. * The source type does not match the type of the destination.
* Perform the "implicit conversion" of the source to the current type * Perform the "implicit conversion" of the source to the current type
...@@ -229,11 +225,10 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, ...@@ -229,11 +225,10 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
* Otherwise, actual_src_desc is a temporary object to hold the * Otherwise, actual_src_desc is a temporary object to hold the
* converted object. * converted object.
*/ */
status = status = acpi_ex_convert_to_target_type(dest_desc->common.type,
acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE source_desc,
(dest_desc), source_desc, &actual_src_desc,
&actual_src_desc, walk_state);
walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -252,7 +247,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, ...@@ -252,7 +247,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
* We now have two objects of identical types, and we can perform a * We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object. * copy of the *value* of the source object.
*/ */
switch (ACPI_GET_OBJECT_TYPE(dest_desc)) { switch (dest_desc->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
dest_desc->integer.value = actual_src_desc->integer.value; dest_desc->integer.value = actual_src_desc->integer.value;
......
...@@ -221,7 +221,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) ...@@ -221,7 +221,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
*/ */
if ((!obj_desc) || if ((!obj_desc) ||
(ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
return; return;
} }
......
...@@ -86,7 +86,8 @@ acpi_status acpi_hw_set_mode(u32 mode) ...@@ -86,7 +86,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
*/ */
if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) { if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"No ACPI mode transition supported in this system (enable/disable both zero)")); "No ACPI mode transition supported in this system "
"(enable/disable both zero)"));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
...@@ -95,7 +96,7 @@ acpi_status acpi_hw_set_mode(u32 mode) ...@@ -95,7 +96,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
/* BIOS should have disabled ALL fixed and GP events */ /* BIOS should have disabled ALL fixed and GP events */
status = acpi_os_write_port(acpi_gbl_FADT.smi_command, status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
(u32) acpi_gbl_FADT.acpi_enable, 8); (u32) acpi_gbl_FADT.acpi_enable, 8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Attempting to enable ACPI mode\n")); "Attempting to enable ACPI mode\n"));
...@@ -107,7 +108,7 @@ acpi_status acpi_hw_set_mode(u32 mode) ...@@ -107,7 +108,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
* BIOS should clear all fixed status bits and restore fixed event * BIOS should clear all fixed status bits and restore fixed event
* enable bits to default * enable bits to default
*/ */
status = acpi_os_write_port(acpi_gbl_FADT.smi_command, status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
(u32) acpi_gbl_FADT.acpi_disable, (u32) acpi_gbl_FADT.acpi_disable,
8); 8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -172,7 +173,7 @@ u32 acpi_hw_get_mode(void) ...@@ -172,7 +173,7 @@ u32 acpi_hw_get_mode(void)
return_UINT32(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} }
status = acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value); status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_UINT32(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
......
...@@ -89,10 +89,9 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) ...@@ -89,10 +89,9 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
/* Clear just the bit that corresponds to this GPE */ /* Clear just the bit that corresponds to this GPE */
ACPI_CLEAR_BIT(enable_mask, ACPI_CLEAR_BIT(enable_mask, ((u32)1 <<
((u32) 1 << (gpe_event_info->gpe_number -
(gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)));
gpe_register_info->base_gpe_number)));
/* Write the updated enable mask */ /* Write the updated enable mask */
...@@ -156,10 +155,9 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) ...@@ -156,10 +155,9 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
register_bit = (u8) register_bit = (u8)(1 <<
(1 << (gpe_event_info->gpe_number -
(gpe_event_info->gpe_number - gpe_event_info->register_info->base_gpe_number));
gpe_event_info->register_info->base_gpe_number));
/* /*
* Write a one to the appropriate bit in the status register to * Write a one to the appropriate bit in the status register to
...@@ -206,10 +204,9 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, ...@@ -206,10 +204,9 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
/* Get the register bitmask for this GPE */ /* Get the register bitmask for this GPE */
register_bit = (u8) register_bit = (u8)(1 <<
(1 << (gpe_event_info->gpe_number -
(gpe_event_info->gpe_number - gpe_event_info->register_info->base_gpe_number));
gpe_event_info->register_info->base_gpe_number));
/* GPE currently enabled? (enabled for runtime?) */ /* GPE currently enabled? (enabled for runtime?) */
......
...@@ -51,6 +51,17 @@ ...@@ -51,6 +51,17 @@
#define _COMPONENT ACPI_HARDWARE #define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwregs") ACPI_MODULE_NAME("hwregs")
/* Local Prototypes */
static acpi_status
acpi_hw_read_multiple(u32 *value,
struct acpi_generic_address *register_a,
struct acpi_generic_address *register_b);
static acpi_status
acpi_hw_write_multiple(u32 value,
struct acpi_generic_address *register_a,
struct acpi_generic_address *register_b);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_hw_clear_acpi_status * FUNCTION: acpi_hw_clear_acpi_status
...@@ -60,9 +71,9 @@ ACPI_MODULE_NAME("hwregs") ...@@ -60,9 +71,9 @@ ACPI_MODULE_NAME("hwregs")
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Clears all fixed and general purpose status bits * DESCRIPTION: Clears all fixed and general purpose status bits
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_hw_clear_acpi_status(void) acpi_status acpi_hw_clear_acpi_status(void)
{ {
acpi_status status; acpi_status status;
...@@ -70,28 +81,20 @@ acpi_status acpi_hw_clear_acpi_status(void) ...@@ -70,28 +81,20 @@ acpi_status acpi_hw_clear_acpi_status(void)
ACPI_FUNCTION_TRACE(hw_clear_acpi_status); ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %0llX\n",
ACPI_BITMASK_ALL_FIXED_STATUS, ACPI_BITMASK_ALL_FIXED_STATUS,
(u16) acpi_gbl_FADT.xpm1a_event_block.address)); acpi_gbl_xpm1a_status.address));
lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
/* Clear the fixed events in PM1 A/B */
status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
ACPI_BITMASK_ALL_FIXED_STATUS); ACPI_BITMASK_ALL_FIXED_STATUS);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
/* Clear the fixed events */
if (acpi_gbl_FADT.xpm1b_event_block.address) {
status = acpi_write(ACPI_BITMASK_ALL_FIXED_STATUS,
&acpi_gbl_FADT.xpm1b_event_block);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
}
/* Clear the GPE Bits in all GPE registers in all GPE blocks */ /* Clear the GPE Bits in all GPE registers in all GPE blocks */
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL); status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
...@@ -126,6 +129,42 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) ...@@ -126,6 +129,42 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
return (&acpi_gbl_bit_register_info[register_id]); return (&acpi_gbl_bit_register_info[register_id]);
} }
/******************************************************************************
*
* FUNCTION: acpi_hw_write_pm1_control
*
* PARAMETERS: pm1a_control - Value to be written to PM1A control
* pm1b_control - Value to be written to PM1B control
*
* RETURN: Status
*
* DESCRIPTION: Write the PM1 A/B control registers. These registers are
* different than than the PM1 A/B status and enable registers
* in that different values can be written to the A/B registers.
* Most notably, the SLP_TYP bits can be different, as per the
* values returned from the _Sx predefined methods.
*
******************************************************************************/
acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
{
acpi_status status;
ACPI_FUNCTION_TRACE(hw_write_pm1_control);
status = acpi_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (acpi_gbl_FADT.xpm1b_control_block.address) {
status =
acpi_write(pm1b_control,
&acpi_gbl_FADT.xpm1b_control_block);
}
return_ACPI_STATUS(status);
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: acpi_hw_register_read * FUNCTION: acpi_hw_register_read
...@@ -141,64 +180,56 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) ...@@ -141,64 +180,56 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
acpi_status acpi_status
acpi_hw_register_read(u32 register_id, u32 * return_value) acpi_hw_register_read(u32 register_id, u32 * return_value)
{ {
u32 value1 = 0; u32 value = 0;
u32 value2 = 0;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE(hw_register_read); ACPI_FUNCTION_TRACE(hw_register_read);
switch (register_id) { switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */
status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_event_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_event_block); status = acpi_hw_read_multiple(&value,
value1 |= value2; &acpi_gbl_xpm1a_status,
&acpi_gbl_xpm1b_status);
break; break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */
status = acpi_read(&value1, &acpi_gbl_xpm1a_enable); status = acpi_hw_read_multiple(&value,
if (ACPI_FAILURE(status)) { &acpi_gbl_xpm1a_enable,
goto exit; &acpi_gbl_xpm1b_enable);
}
/* PM1B is optional */
status = acpi_read(&value2, &acpi_gbl_xpm1b_enable);
value1 |= value2;
break; break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_control_block); status = acpi_hw_read_multiple(&value,
if (ACPI_FAILURE(status)) { &acpi_gbl_FADT.
goto exit; xpm1a_control_block,
} &acpi_gbl_FADT.
xpm1b_control_block);
status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_control_block); /*
value1 |= value2; * Zero the write-only bits. From the ACPI specification, "Hardware
* Write-Only Bits": "Upon reads to registers with write-only bits,
* software masks out all write-only bits."
*/
value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
break; break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = acpi_read(&value1, &acpi_gbl_FADT.xpm2_control_block); status = acpi_read(&value, &acpi_gbl_FADT.xpm2_control_block);
break; break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_read(&value1, &acpi_gbl_FADT.xpm_timer_block); status = acpi_read(&value, &acpi_gbl_FADT.xpm_timer_block);
break; break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
status = status =
acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); acpi_hw_read_port(acpi_gbl_FADT.smi_command, &value, 8);
break; break;
default: default:
...@@ -207,10 +238,8 @@ acpi_hw_register_read(u32 register_id, u32 * return_value) ...@@ -207,10 +238,8 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
break; break;
} }
exit:
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
*return_value = value1; *return_value = value;
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -250,52 +279,42 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -250,52 +279,42 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
ACPI_FUNCTION_TRACE(hw_register_write); ACPI_FUNCTION_TRACE(hw_register_write);
switch (register_id) { switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */
/*
/* Perform a read first to preserve certain bits (per ACPI spec) */ * Handle the "ignored" bit in PM1 Status. According to the ACPI
* specification, ignored bits are to be preserved when writing.
status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, * Normally, this would mean a read/modify/write sequence. However,
&read_value); * preserving a bit in the status register is different. Writing a
if (ACPI_FAILURE(status)) { * one clears the status, and writing a zero preserves the status.
goto exit; * Therefore, we must always write zero to the ignored bit.
} *
* This behavior is clarified in the ACPI 4.0 specification.
/* Insert the bits to be preserved */ */
value &= ~ACPI_PM1_STATUS_PRESERVED_BITS;
ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS,
read_value);
/* Now we can write the data */
status = acpi_write(value, &acpi_gbl_FADT.xpm1a_event_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
status = acpi_write(value, &acpi_gbl_FADT.xpm1b_event_block); status = acpi_hw_write_multiple(value,
&acpi_gbl_xpm1a_status,
&acpi_gbl_xpm1b_status);
break; break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access */
status = acpi_write(value, &acpi_gbl_xpm1a_enable); status = acpi_hw_write_multiple(value,
if (ACPI_FAILURE(status)) { &acpi_gbl_xpm1a_enable,
goto exit; &acpi_gbl_xpm1b_enable);
}
/* PM1B is optional */
status = acpi_write(value, &acpi_gbl_xpm1b_enable);
break; break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
/* /*
* Perform a read first to preserve certain bits (per ACPI spec) * Perform a read first to preserve certain bits (per ACPI spec)
* Note: This includes SCI_EN, we never want to change this bit
*/ */
status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, status = acpi_hw_read_multiple(&read_value,
&read_value); &acpi_gbl_FADT.
xpm1a_control_block,
&acpi_gbl_FADT.
xpm1b_control_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto exit; goto exit;
} }
...@@ -307,25 +326,29 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -307,25 +326,29 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
/* Now we can write the data */ /* Now we can write the data */
status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block); status = acpi_hw_write_multiple(value,
if (ACPI_FAILURE(status)) { &acpi_gbl_FADT.
goto exit; xpm1a_control_block,
} &acpi_gbl_FADT.
xpm1b_control_block);
status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block);
break; break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ /*
* For control registers, all reserved bits must be preserved,
* as per the ACPI spec.
*/
status =
acpi_read(&read_value, &acpi_gbl_FADT.xpm2_control_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block); /* Insert the bits to be preserved */
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS,
read_value);
status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block);
break; break;
...@@ -340,10 +363,11 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -340,10 +363,11 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
/* SMI_CMD is currently always in IO space */ /* SMI_CMD is currently always in IO space */
status = status =
acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); acpi_hw_write_port(acpi_gbl_FADT.smi_command, value, 8);
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
} }
...@@ -351,3 +375,103 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) ...@@ -351,3 +375,103 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
exit: exit:
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/******************************************************************************
*
* FUNCTION: acpi_hw_read_multiple
*
* PARAMETERS: Value - Where the register value is returned
* register_a - First ACPI register (required)
* register_b - Second ACPI register (optional)
*
* RETURN: Status
*
* DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B)
*
******************************************************************************/
static acpi_status
acpi_hw_read_multiple(u32 *value,
struct acpi_generic_address *register_a,
struct acpi_generic_address *register_b)
{
u32 value_a = 0;
u32 value_b = 0;
acpi_status status;
/* The first register is always required */
status = acpi_read(&value_a, register_a);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Second register is optional */
if (register_b->address) {
status = acpi_read(&value_b, register_b);
if (ACPI_FAILURE(status)) {
return (status);
}
}
/*
* OR the two return values together. No shifting or masking is necessary,
* because of how the PM1 registers are defined in the ACPI specification:
*
* "Although the bits can be split between the two register blocks (each
* register block has a unique pointer within the FADT), the bit positions
* are maintained. The register block with unimplemented bits (that is,
* those implemented in the other register block) always returns zeros,
* and writes have no side effects"
*/
*value = (value_a | value_b);
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_write_multiple
*
* PARAMETERS: Value - The value to write
* register_a - First ACPI register (required)
* register_b - Second ACPI register (optional)
*
* RETURN: Status
*
* DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B)
*
******************************************************************************/
static acpi_status
acpi_hw_write_multiple(u32 value,
struct acpi_generic_address *register_a,
struct acpi_generic_address *register_b)
{
acpi_status status;
/* The first register is always required */
status = acpi_write(value, register_a);
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* Second register is optional
*
* No bit shifting or clearing is necessary, because of how the PM1
* registers are defined in the ACPI specification:
*
* "Although the bits can be split between the two register blocks (each
* register block has a unique pointer within the FADT), the bit positions
* are maintained. The register block with unimplemented bits (that is,
* those implemented in the other register block) always returns zeros,
* and writes have no side effects"
*/
if (register_b->address) {
status = acpi_write(value, register_b);
}
return (status);
}
...@@ -90,6 +90,7 @@ acpi_set_firmware_waking_vector(u32 physical_address) ...@@ -90,6 +90,7 @@ acpi_set_firmware_waking_vector(u32 physical_address)
ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
#if ACPI_MACHINE_WIDTH == 64
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_set_firmware_waking_vector64 * FUNCTION: acpi_set_firmware_waking_vector64
...@@ -100,7 +101,8 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) ...@@ -100,7 +101,8 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if
* it exists in the table. * it exists in the table. This function is intended for use with
* 64-bit host operating systems.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
...@@ -124,6 +126,7 @@ acpi_set_firmware_waking_vector64(u64 physical_address) ...@@ -124,6 +126,7 @@ acpi_set_firmware_waking_vector64(u64 physical_address)
} }
ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
#endif
/******************************************************************************* /*******************************************************************************
* *
...@@ -147,9 +150,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) ...@@ -147,9 +150,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep);
/* /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
status = acpi_get_sleep_type_data(sleep_state, status = acpi_get_sleep_type_data(sleep_state,
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_a,
&acpi_gbl_sleep_type_b); &acpi_gbl_sleep_type_b);
...@@ -223,8 +225,8 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) ...@@ -223,8 +225,8 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
******************************************************************************/ ******************************************************************************/
acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
{ {
u32 PM1Acontrol; u32 pm1a_control;
u32 PM1Bcontrol; u32 pm1b_control;
struct acpi_bit_register_info *sleep_type_reg_info; struct acpi_bit_register_info *sleep_type_reg_info;
struct acpi_bit_register_info *sleep_enable_reg_info; struct acpi_bit_register_info *sleep_enable_reg_info;
u32 in_value; u32 in_value;
...@@ -242,13 +244,14 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -242,13 +244,14 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
} }
sleep_type_reg_info = sleep_type_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A); acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
sleep_enable_reg_info = sleep_enable_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE); acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
/* Clear wake status */ /* Clear wake status */
status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1); status =
acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -289,24 +292,25 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -289,24 +292,25 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
/* Get current value of PM1A control */ /* Get current value of PM1A control */
status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
&pm1a_control);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
ACPI_DEBUG_PRINT((ACPI_DB_INIT, ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"Entering sleep state [S%d]\n", sleep_state)); "Entering sleep state [S%d]\n", sleep_state));
/* Clear SLP_EN and SLP_TYP fields */ /* Clear the SLP_EN and SLP_TYP fields */
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | pm1a_control &= ~(sleep_type_reg_info->access_bit_mask |
sleep_enable_reg_info->access_bit_mask); sleep_enable_reg_info->access_bit_mask);
PM1Bcontrol = PM1Acontrol; pm1b_control = pm1a_control;
/* Insert SLP_TYP bits */ /* Insert the SLP_TYP bits */
PM1Acontrol |= pm1a_control |=
(acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position); (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
PM1Bcontrol |= pm1b_control |=
(acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position); (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
/* /*
...@@ -314,37 +318,25 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -314,37 +318,25 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
* poorly implemented hardware. * poorly implemented hardware.
*/ */
/* Write #1: fill in SLP_TYP data */ /* Write #1: write the SLP_TYP data to the PM1 Control registers */
status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL, status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
PM1Acontrol);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL, /* Insert the sleep enable (SLP_EN) bit */
PM1Bcontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Insert SLP_ENABLE bit */ pm1a_control |= sleep_enable_reg_info->access_bit_mask;
pm1b_control |= sleep_enable_reg_info->access_bit_mask;
PM1Acontrol |= sleep_enable_reg_info->access_bit_mask; /* Flush caches, as per ACPI specification */
PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;
/* Write #2: SLP_TYP + SLP_EN */
ACPI_FLUSH_CPU_CACHE(); ACPI_FLUSH_CPU_CACHE();
status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL, /* Write #2: Write both SLP_TYP + SLP_EN */
PM1Acontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL, status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
PM1Bcontrol);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -357,8 +349,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -357,8 +349,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
* Wait ten seconds, then try again. This is to get S4/S5 to work on * Wait ten seconds, then try again. This is to get S4/S5 to work on
* all machines. * all machines.
* *
* We wait so long to allow chipsets that poll this reg very slowly to * We wait so long to allow chipsets that poll this reg very slowly
* still read the right value. Ideally, this block would go * to still read the right value. Ideally, this block would go
* away entirely. * away entirely.
*/ */
acpi_os_stall(10000000); acpi_os_stall(10000000);
...@@ -374,7 +366,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -374,7 +366,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
/* Wait until we enter sleep state */ /* Wait until we enter sleep state */
do { do {
status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS, status = acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS,
&in_value); &in_value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -408,7 +400,10 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) ...@@ -408,7 +400,10 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios);
status = acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1); /* Clear the wake status bit (PM1) */
status =
acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -435,12 +430,13 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) ...@@ -435,12 +430,13 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
ACPI_FLUSH_CPU_CACHE(); ACPI_FLUSH_CPU_CACHE();
status = acpi_os_write_port(acpi_gbl_FADT.smi_command, status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
(u32) acpi_gbl_FADT.S4bios_request, 8); (u32) acpi_gbl_FADT.S4bios_request, 8);
do { do {
acpi_os_stall(1000); acpi_os_stall(1000);
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); status =
acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -471,8 +467,8 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) ...@@ -471,8 +467,8 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
acpi_status status; acpi_status status;
struct acpi_bit_register_info *sleep_type_reg_info; struct acpi_bit_register_info *sleep_type_reg_info;
struct acpi_bit_register_info *sleep_enable_reg_info; struct acpi_bit_register_info *sleep_enable_reg_info;
u32 PM1Acontrol; u32 pm1a_control;
u32 PM1Bcontrol; u32 pm1b_control;
ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
...@@ -486,38 +482,34 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) ...@@ -486,38 +482,34 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
&acpi_gbl_sleep_type_b); &acpi_gbl_sleep_type_b);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
sleep_type_reg_info = sleep_type_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A); acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE);
sleep_enable_reg_info = sleep_enable_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE); acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
/* Get current value of PM1A control */ /* Get current value of PM1A control */
status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
&PM1Acontrol); &pm1a_control);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
/* Clear SLP_EN and SLP_TYP fields */ /* Clear the SLP_EN and SLP_TYP fields */
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | pm1a_control &= ~(sleep_type_reg_info->access_bit_mask |
sleep_enable_reg_info-> sleep_enable_reg_info->
access_bit_mask); access_bit_mask);
PM1Bcontrol = PM1Acontrol; pm1b_control = pm1a_control;
/* Insert SLP_TYP bits */ /* Insert the SLP_TYP bits */
PM1Acontrol |= pm1a_control |= (acpi_gbl_sleep_type_a <<
(acpi_gbl_sleep_type_a << sleep_type_reg_info-> sleep_type_reg_info->bit_position);
bit_position); pm1b_control |= (acpi_gbl_sleep_type_b <<
PM1Bcontrol |= sleep_type_reg_info->bit_position);
(acpi_gbl_sleep_type_b << sleep_type_reg_info->
bit_position);
/* Just ignore any errors */ /* Write the control registers and ignore any errors */
(void)acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL, (void)acpi_hw_write_pm1_control(pm1a_control,
PM1Acontrol); pm1b_control);
(void)acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
PM1Bcontrol);
} }
} }
...@@ -603,19 +595,21 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) ...@@ -603,19 +595,21 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
* it to determine whether the system is rebooting or resuming. Clear * it to determine whether the system is rebooting or resuming. Clear
* it for compatibility. * it for compatibility.
*/ */
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1); acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1);
acpi_gbl_system_awake_and_running = TRUE; acpi_gbl_system_awake_and_running = TRUE;
/* Enable power button */ /* Enable power button */
(void) (void)
acpi_set_register(acpi_gbl_fixed_event_info acpi_write_bit_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_POWER_BUTTON].enable_register_id, 1); [ACPI_EVENT_POWER_BUTTON].
enable_register_id, ACPI_ENABLE_EVENT);
(void) (void)
acpi_set_register(acpi_gbl_fixed_event_info acpi_write_bit_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_POWER_BUTTON].status_register_id, 1); [ACPI_EVENT_POWER_BUTTON].
status_register_id, ACPI_CLEAR_STATUS);
arg.integer.value = ACPI_SST_WORKING; arg.integer.value = ACPI_SST_WORKING;
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
......
/******************************************************************************
*
* Module Name: hwvalid - I/O request validation
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2009, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include "accommon.h"
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwvalid")
/* Local prototypes */
static acpi_status
acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width);
/*
* Protected I/O ports. Some ports are always illegal, and some are
* conditionally illegal. This table must remain ordered by port address.
*
* The table is used to implement the Microsoft port access rules that
* first appeared in Windows XP. Some ports are always illegal, and some
* ports are only illegal if the BIOS calls _OSI with a win_xP string or
* later (meaning that the BIOS itelf is post-XP.)
*
* This provides ACPICA with the desired port protections and
* Microsoft compatibility.
*
* Description of port entries:
* DMA: DMA controller
* PIC0: Programmable Interrupt Controller (8259_a)
* PIT1: System Timer 1
* PIT2: System Timer 2 failsafe
* RTC: Real-time clock
* CMOS: Extended CMOS
* DMA1: DMA 1 page registers
* DMA1L: DMA 1 Ch 0 low page
* DMA2: DMA 2 page registers
* DMA2L: DMA 2 low page refresh
* ARBC: Arbitration control
* SETUP: Reserved system board setup
* POS: POS channel select
* PIC1: Cascaded PIC
* IDMA: ISA DMA
* ELCR: PIC edge/level registers
* PCI: PCI configuration space
*/
static const struct acpi_port_info acpi_protected_ports[] = {
{"DMA", 0x0000, 0x000F, ACPI_OSI_WIN_XP},
{"PIC0", 0x0020, 0x0021, ACPI_ALWAYS_ILLEGAL},
{"PIT1", 0x0040, 0x0043, ACPI_OSI_WIN_XP},
{"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP},
{"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
{"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
{"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP},
{"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP},
{"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP},
{"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP},
{"ARBC", 0x0090, 0x0091, ACPI_OSI_WIN_XP},
{"SETUP", 0x0093, 0x0094, ACPI_OSI_WIN_XP},
{"POS", 0x0096, 0x0097, ACPI_OSI_WIN_XP},
{"PIC1", 0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL},
{"IDMA", 0x00C0, 0x00DF, ACPI_OSI_WIN_XP},
{"ELCR", 0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL},
{"PCI", 0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP}
};
#define ACPI_PORT_INFO_ENTRIES ACPI_ARRAY_LENGTH (acpi_protected_ports)
/******************************************************************************
*
* FUNCTION: acpi_hw_validate_io_request
*
* PARAMETERS: Address Address of I/O port/register
* bit_width Number of bits (8,16,32)
*
* RETURN: Status
*
* DESCRIPTION: Validates an I/O request (address/length). Certain ports are
* always illegal and some ports are only illegal depending on
* the requests the BIOS AML code makes to the predefined
* _OSI method.
*
******************************************************************************/
static acpi_status
acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
{
u32 i;
u32 byte_width;
acpi_io_address last_address;
const struct acpi_port_info *port_info;
ACPI_FUNCTION_TRACE(hw_validate_io_request);
/* Supported widths are 8/16/32 */
if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
return AE_BAD_PARAMETER;
}
port_info = acpi_protected_ports;
byte_width = ACPI_DIV_8(bit_width);
last_address = address + byte_width - 1;
ACPI_DEBUG_PRINT((ACPI_DB_IO, "Address %p LastAddress %p Length %X",
ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void,
last_address),
byte_width));
/* Maximum 16-bit address in I/O space */
if (last_address > ACPI_UINT16_MAX) {
ACPI_ERROR((AE_INFO,
"Illegal I/O port address/length above 64K: 0x%p/%X",
ACPI_CAST_PTR(void, address), byte_width));
return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
}
/* Exit if requested address is not within the protected port table */
if (address > acpi_protected_ports[ACPI_PORT_INFO_ENTRIES - 1].end) {
return_ACPI_STATUS(AE_OK);
}
/* Check request against the list of protected I/O ports */
for (i = 0; i < ACPI_PORT_INFO_ENTRIES; i++, port_info++) {
/*
* Check if the requested address range will write to a reserved
* port. Four cases to consider:
*
* 1) Address range is contained completely in the port address range
* 2) Address range overlaps port range at the port range start
* 3) Address range overlaps port range at the port range end
* 4) Address range completely encompasses the port range
*/
if ((address <= port_info->end)
&& (last_address >= port_info->start)) {
/* Port illegality may depend on the _OSI calls made by the BIOS */
if (acpi_gbl_osi_data >= port_info->osi_dependency) {
ACPI_ERROR((AE_INFO,
"Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
ACPI_CAST_PTR(void, address),
byte_width, port_info->name,
port_info->start, port_info->end));
return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
}
}
/* Finished if address range ends before the end of this port */
if (last_address <= port_info->end) {
break;
}
}
return_ACPI_STATUS(AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_read_port
*
* PARAMETERS: Address Address of I/O port/register to read
* Value Where value is placed
* Width Number of bits
*
* RETURN: Value read from port
*
* DESCRIPTION: Read data from an I/O port or register. This is a front-end
* to acpi_os_read_port that performs validation on both the port
* address and the length.
*
*****************************************************************************/
acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
{
acpi_status status;
status = acpi_hw_validate_io_request(address, width);
if (ACPI_FAILURE(status)) {
return status;
}
status = acpi_os_read_port(address, value, width);
return status;
}
/******************************************************************************
*
* FUNCTION: acpi_hw_write_port
*
* PARAMETERS: Address Address of I/O port/register to write
* Value Value to write
* Width Number of bits
*
* RETURN: None
*
* DESCRIPTION: Write data to an I/O port or register. This is a front-end
* to acpi_os_write_port that performs validation on both the port
* address and the length.
*
*****************************************************************************/
acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
{
acpi_status status;
status = acpi_hw_validate_io_request(address, width);
if (ACPI_FAILURE(status)) {
return status;
}
status = acpi_os_write_port(address, value, width);
return status;
}
...@@ -107,19 +107,18 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) ...@@ -107,19 +107,18 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
ACPI_FUNCTION_NAME(acpi_read); ACPI_FUNCTION_NAME(acpi_read);
/* /*
* Must have a valid pointer to a GAS structure, and * Must have a valid pointer to a GAS structure, and a non-zero address
* a non-zero address within. However, don't return an error * within.
* because the PM1A/B code must not fail if B isn't present.
*/ */
if (!reg) { if (!reg) {
return (AE_OK); return (AE_BAD_PARAMETER);
} }
/* Get a local copy of the address. Handles possible alignment issues */ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64(&address, &reg->address); ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) { if (!address) {
return (AE_OK); return (AE_BAD_ADDRESS);
} }
/* Supported widths are 8/16/32 */ /* Supported widths are 8/16/32 */
...@@ -134,8 +133,8 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) ...@@ -134,8 +133,8 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
*value = 0; *value = 0;
/* /*
* Two address spaces supported: Memory or IO. * Two address spaces supported: Memory or IO. PCI_Config is
* PCI_Config is not supported here because the GAS struct is insufficient * not supported here because the GAS structure is insufficient
*/ */
switch (reg->space_id) { switch (reg->space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_MEMORY:
...@@ -147,7 +146,7 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) ...@@ -147,7 +146,7 @@ acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
status = status =
acpi_os_read_port((acpi_io_address) address, value, width); acpi_hw_read_port((acpi_io_address) address, value, width);
break; break;
default: default:
...@@ -187,19 +186,18 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) ...@@ -187,19 +186,18 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
ACPI_FUNCTION_NAME(acpi_write); ACPI_FUNCTION_NAME(acpi_write);
/* /*
* Must have a valid pointer to a GAS structure, and * Must have a valid pointer to a GAS structure, and a non-zero address
* a non-zero address within. However, don't return an error * within.
* because the PM1A/B code must not fail if B isn't present.
*/ */
if (!reg) { if (!reg) {
return (AE_OK); return (AE_BAD_PARAMETER);
} }
/* Get a local copy of the address. Handles possible alignment issues */ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64(&address, &reg->address); ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) { if (!address) {
return (AE_OK); return (AE_BAD_ADDRESS);
} }
/* Supported widths are 8/16/32 */ /* Supported widths are 8/16/32 */
...@@ -222,7 +220,7 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) ...@@ -222,7 +220,7 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_SYSTEM_IO:
status = acpi_os_write_port((acpi_io_address) address, value, status = acpi_hw_write_port((acpi_io_address) address, value,
width); width);
break; break;
...@@ -244,24 +242,36 @@ ACPI_EXPORT_SYMBOL(acpi_write) ...@@ -244,24 +242,36 @@ ACPI_EXPORT_SYMBOL(acpi_write)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_get_register_unlocked * FUNCTION: acpi_read_bit_register
* *
* PARAMETERS: register_id - ID of ACPI bit_register to access * PARAMETERS: register_id - ID of ACPI Bit Register to access
* return_value - Value that was read from the register * return_value - Value that was read from the register,
* normalized to bit position zero.
* *
* RETURN: Status and the value read from specified Register. Value * RETURN: Status and the value read from the specified Register. Value
* returned is normalized to bit0 (is shifted all the way right) * returned is normalized to bit0 (is shifted all the way right)
* *
* DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock. * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock.
* *
* SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
* PM2 Control.
*
* Note: The hardware lock is not required when reading the ACPI bit registers
* since almost all of them are single bit and it does not matter that
* the parent hardware register can be split across two physical
* registers. The only multi-bit field is SLP_TYP in the PM1 control
* register, but this field does not cross an 8-bit boundary (nor does
* it make much sense to actually read this field.)
*
******************************************************************************/ ******************************************************************************/
acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) acpi_status acpi_read_bit_register(u32 register_id, u32 *return_value)
{ {
u32 register_value = 0;
struct acpi_bit_register_info *bit_reg_info; struct acpi_bit_register_info *bit_reg_info;
u32 register_value;
u32 value;
acpi_status status; acpi_status status;
ACPI_FUNCTION_TRACE(acpi_get_register_unlocked); ACPI_FUNCTION_TRACE_U32(acpi_read_bit_register, register_id);
/* Get the info structure corresponding to the requested ACPI Register */ /* Get the info structure corresponding to the requested ACPI Register */
...@@ -270,209 +280,133 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) ...@@ -270,209 +280,133 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value)
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* Read from the register */ /* Read the entire parent register */
status = acpi_hw_register_read(bit_reg_info->parent_register, status = acpi_hw_register_read(bit_reg_info->parent_register,
&register_value); &register_value);
if (ACPI_FAILURE(status)) {
if (ACPI_SUCCESS(status)) { return_ACPI_STATUS(status);
/* Normalize the value that was read */
register_value =
((register_value & bit_reg_info->access_bit_mask)
>> bit_reg_info->bit_position);
*return_value = register_value;
ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n",
register_value,
bit_reg_info->parent_register));
} }
return_ACPI_STATUS(status); /* Normalize the value that was read, mask off other bits */
}
ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked) value = ((register_value & bit_reg_info->access_bit_mask)
>> bit_reg_info->bit_position);
/******************************************************************************* ACPI_DEBUG_PRINT((ACPI_DB_IO,
* "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n",
* FUNCTION: acpi_get_register register_id, bit_reg_info->parent_register,
* register_value, value));
* PARAMETERS: register_id - ID of ACPI bit_register to access
* return_value - Value that was read from the register
*
* RETURN: Status and the value read from specified Register. Value
* returned is normalized to bit0 (is shifted all the way right)
*
* DESCRIPTION: ACPI bit_register read function.
*
******************************************************************************/
acpi_status acpi_get_register(u32 register_id, u32 *return_value)
{
acpi_status status;
acpi_cpu_flags flags;
flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
status = acpi_get_register_unlocked(register_id, return_value);
acpi_os_release_lock(acpi_gbl_hardware_lock, flags);
return (status); *return_value = value;
return_ACPI_STATUS(AE_OK);
} }
ACPI_EXPORT_SYMBOL(acpi_get_register) ACPI_EXPORT_SYMBOL(acpi_read_bit_register)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_set_register * FUNCTION: acpi_write_bit_register
* *
* PARAMETERS: register_id - ID of ACPI bit_register to access * PARAMETERS: register_id - ID of ACPI Bit Register to access
* Value - (only used on write) value to write to the * Value - Value to write to the register, in bit
* Register, NOT pre-normalized to the bit pos * position zero. The bit is automaticallly
* shifted to the correct position.
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: ACPI Bit Register write function. * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock
* since most operations require a read/modify/write sequence.
*
* SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
* PM2 Control.
*
* Note that at this level, the fact that there may be actually two
* hardware registers (A and B - and B may not exist) is abstracted.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_set_register(u32 register_id, u32 value) acpi_status acpi_write_bit_register(u32 register_id, u32 value)
{ {
u32 register_value = 0;
struct acpi_bit_register_info *bit_reg_info; struct acpi_bit_register_info *bit_reg_info;
acpi_status status;
acpi_cpu_flags lock_flags; acpi_cpu_flags lock_flags;
u32 register_value;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); ACPI_FUNCTION_TRACE_U32(acpi_write_bit_register, register_id);
/* Get the info structure corresponding to the requested ACPI Register */ /* Get the info structure corresponding to the requested ACPI Register */
bit_reg_info = acpi_hw_get_bit_register_info(register_id); bit_reg_info = acpi_hw_get_bit_register_info(register_id);
if (!bit_reg_info) { if (!bit_reg_info) {
ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X",
register_id));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
/* Always do a register read first so we can insert the new bits */
status = acpi_hw_register_read(bit_reg_info->parent_register,
&register_value);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* /*
* Decode the Register ID * At this point, we know that the parent register is one of the
* Register ID = [Register block ID] | [bit ID] * following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control
*
* Check bit ID to fine locate Register offset.
* Check Mask to determine Register offset, and then read-write.
*/ */
switch (bit_reg_info->parent_register) { if (bit_reg_info->parent_register != ACPI_REGISTER_PM1_STATUS) {
case ACPI_REGISTER_PM1_STATUS:
/* /*
* Status Registers are different from the rest. Clear by * 1) Case for PM1 Enable, PM1 Control, and PM2 Control
* writing 1, and writing 0 has no effect. So, the only relevant *
* information is the single bit we're interested in, all others should * Perform a register read to preserve the bits that we are not
* be written as 0 so they will be left unchanged. * interested in
*/ */
value = ACPI_REGISTER_PREPARE_BITS(value, status = acpi_hw_register_read(bit_reg_info->parent_register,
bit_reg_info->bit_position,
bit_reg_info->
access_bit_mask);
if (value) {
status =
acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
(u16) value);
register_value = 0;
}
break;
case ACPI_REGISTER_PM1_ENABLE:
ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position,
bit_reg_info->access_bit_mask,
value);
status = acpi_hw_register_write(ACPI_REGISTER_PM1_ENABLE,
(u16) register_value);
break;
case ACPI_REGISTER_PM1_CONTROL:
/*
* Write the PM1 Control register.
* Note that at this level, the fact that there are actually TWO
* registers (A and B - and B may not exist) is abstracted.
*/
ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n",
register_value));
ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position,
bit_reg_info->access_bit_mask,
value);
status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
(u16) register_value);
break;
case ACPI_REGISTER_PM2_CONTROL:
status = acpi_hw_register_read(ACPI_REGISTER_PM2_CONTROL,
&register_value); &register_value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
ACPI_DEBUG_PRINT((ACPI_DB_IO, /*
"PM2 control: Read %X from %8.8X%8.8X\n", * Insert the input bit into the value that was just read
register_value, * and write the register
ACPI_FORMAT_UINT64(acpi_gbl_FADT. */
xpm2_control_block.
address)));
ACPI_REGISTER_INSERT_VALUE(register_value, ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position, bit_reg_info->bit_position,
bit_reg_info->access_bit_mask, bit_reg_info->access_bit_mask,
value); value);
ACPI_DEBUG_PRINT((ACPI_DB_IO, status = acpi_hw_register_write(bit_reg_info->parent_register,
"About to write %4.4X to %8.8X%8.8X\n", register_value);
register_value, } else {
ACPI_FORMAT_UINT64(acpi_gbl_FADT. /*
xpm2_control_block. * 2) Case for PM1 Status
address))); *
* The Status register is different from the rest. Clear an event
* by writing 1, writing 0 has no effect. So, the only relevant
* information is the single bit we're interested in, all others
* should be written as 0 so they will be left unchanged.
*/
register_value = ACPI_REGISTER_PREPARE_BITS(value,
bit_reg_info->
bit_position,
bit_reg_info->
access_bit_mask);
status = acpi_hw_register_write(ACPI_REGISTER_PM2_CONTROL, /* No need to write the register if value is all zeros */
(u8) (register_value));
break;
default: if (register_value) {
break; status =
acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
register_value);
}
} }
unlock_and_exit: ACPI_DEBUG_PRINT((ACPI_DB_IO,
"BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n",
acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); register_id, bit_reg_info->parent_register, value,
register_value));
/* Normalize the value that was read */
ACPI_DEBUG_EXEC(register_value = unlock_and_exit:
((register_value & bit_reg_info->access_bit_mask) >>
bit_reg_info->bit_position));
ACPI_DEBUG_PRINT((ACPI_DB_IO, acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
"Set bits: %8.8X actual %8.8X register %X\n", value,
register_value, bit_reg_info->parent_register));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
ACPI_EXPORT_SYMBOL(acpi_set_register) ACPI_EXPORT_SYMBOL(acpi_write_bit_register)
/******************************************************************************* /*******************************************************************************
* *
...@@ -534,7 +468,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) ...@@ -534,7 +468,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
/* It must be of type Package */ /* It must be of type Package */
else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { else if (info->return_object->common.type != ACPI_TYPE_PACKAGE) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Sleep State return object is not a Package")); "Sleep State return object is not a Package"));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
...@@ -555,12 +489,13 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) ...@@ -555,12 +489,13 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
/* The first two elements must both be of type Integer */ /* The first two elements must both be of type Integer */
else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) else if (((info->return_object->package.elements[0])->common.type
!= ACPI_TYPE_INTEGER) || != ACPI_TYPE_INTEGER) ||
(ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) ((info->return_object->package.elements[1])->common.type
!= ACPI_TYPE_INTEGER)) { != ACPI_TYPE_INTEGER)) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Sleep State return package elements are not both Integers (%s, %s)", "Sleep State return package elements are not both Integers "
"(%s, %s)",
acpi_ut_get_object_type_name(info->return_object-> acpi_ut_get_object_type_name(info->return_object->
package.elements[0]), package.elements[0]),
acpi_ut_get_object_type_name(info->return_object-> acpi_ut_get_object_type_name(info->return_object->
......
...@@ -118,9 +118,8 @@ acpi_status acpi_ns_root_initialize(void) ...@@ -118,9 +118,8 @@ acpi_status acpi_ns_root_initialize(void)
} }
/* /*
* Name entered successfully. * Name entered successfully. If entry in pre_defined_names[] specifies
* If entry in pre_defined_names[] specifies an * an initial value, create the initial value.
* initial value, create the initial value.
*/ */
if (init_val->val) { if (init_val->val) {
status = acpi_os_predefined_override(init_val, &val); status = acpi_os_predefined_override(init_val, &val);
...@@ -178,9 +177,8 @@ acpi_status acpi_ns_root_initialize(void) ...@@ -178,9 +177,8 @@ acpi_status acpi_ns_root_initialize(void)
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /* Build an object around the static string */
* Build an object around the static string
*/
obj_desc->string.length = obj_desc->string.length =
(u32) ACPI_STRLEN(val); (u32) ACPI_STRLEN(val);
obj_desc->string.pointer = val; obj_desc->string.pointer = val;
...@@ -234,8 +232,7 @@ acpi_status acpi_ns_root_initialize(void) ...@@ -234,8 +232,7 @@ acpi_status acpi_ns_root_initialize(void)
/* Store pointer to value descriptor in the Node */ /* Store pointer to value descriptor in the Node */
status = acpi_ns_attach_object(new_node, obj_desc, status = acpi_ns_attach_object(new_node, obj_desc,
ACPI_GET_OBJECT_TYPE obj_desc->common.type);
(obj_desc));
/* Remove local reference to the object */ /* Remove local reference to the object */
...@@ -315,10 +312,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -315,10 +312,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
return_ACPI_STATUS(AE_NO_NAMESPACE); return_ACPI_STATUS(AE_NO_NAMESPACE);
} }
/* /* Get the prefix scope. A null scope means use the root scope */
* Get the prefix scope.
* A null scope means use the root scope
*/
if ((!scope_info) || (!scope_info->scope.node)) { if ((!scope_info) || (!scope_info->scope.node)) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Null scope prefix, using root node (%p)\n", "Null scope prefix, using root node (%p)\n",
...@@ -338,8 +333,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -338,8 +333,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) {
/* /*
* This node might not be a actual "scope" node (such as a * This node might not be a actual "scope" node (such as a
* Device/Method, etc.) It could be a Package or other object node. * Device/Method, etc.) It could be a Package or other object
* Backup up the tree to find the containing scope node. * node. Backup up the tree to find the containing scope node.
*/ */
while (!acpi_ns_opens_scope(prefix_node->type) && while (!acpi_ns_opens_scope(prefix_node->type) &&
prefix_node->type != ACPI_TYPE_ANY) { prefix_node->type != ACPI_TYPE_ANY) {
...@@ -349,7 +344,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -349,7 +344,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
} }
} }
/* Save type TBD: may be no longer necessary */ /* Save type. TBD: may be no longer necessary */
type_to_check_for = type; type_to_check_for = type;
...@@ -414,6 +409,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -414,6 +409,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
/* Name is fully qualified, no search rules apply */ /* Name is fully qualified, no search rules apply */
search_parent_flag = ACPI_NS_NO_UPSEARCH; search_parent_flag = ACPI_NS_NO_UPSEARCH;
/* /*
* Point past this prefix to the name segment * Point past this prefix to the name segment
* part or the next Parent Prefix * part or the next Parent Prefix
...@@ -429,7 +425,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -429,7 +425,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
/* Current scope has no parent scope */ /* Current scope has no parent scope */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"ACPI path has too many parent prefixes (^) - reached beyond root node")); "ACPI path has too many parent prefixes (^) "
"- reached beyond root node"));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
} }
} }
...@@ -531,9 +528,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -531,9 +528,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
while (num_segments && current_node) { while (num_segments && current_node) {
num_segments--; num_segments--;
if (!num_segments) { if (!num_segments) {
/*
* This is the last segment, enable typechecking /* This is the last segment, enable typechecking */
*/
this_search_type = type; this_search_type = type;
/* /*
...@@ -584,9 +581,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -584,9 +581,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
if (num_segments > 0) { if (num_segments > 0) {
/* /*
* If we have an alias to an object that opens a scope (such as a * If we have an alias to an object that opens a scope (such as a
* device or processor), we need to dereference the alias here so that * device or processor), we need to dereference the alias here so
* we can access any children of the original node (via the remaining * that we can access any children of the original node (via the
* segments). * remaining segments).
*/ */
if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) {
if (!this_node->object) { if (!this_node->object) {
...@@ -594,8 +591,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -594,8 +591,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
} }
if (acpi_ns_opens_scope if (acpi_ns_opens_scope
(((struct acpi_namespace_node *)this_node-> (((struct acpi_namespace_node *)
object)->type)) { this_node->object)->type)) {
this_node = this_node =
(struct acpi_namespace_node *) (struct acpi_namespace_node *)
this_node->object; this_node->object;
...@@ -639,8 +636,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -639,8 +636,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
/* /*
* If this is the last name segment and we are not looking for a * If this is the last name segment and we are not looking for a
* specific type, but the type of found object is known, use that type * specific type, but the type of found object is known, use that
* to (later) see if it opens a scope. * type to (later) see if it opens a scope.
*/ */
if (type == ACPI_TYPE_ANY) { if (type == ACPI_TYPE_ANY) {
type = this_node->type; type = this_node->type;
...@@ -653,9 +650,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, ...@@ -653,9 +650,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
current_node = this_node; current_node = this_node;
} }
/* /* Always check if we need to open a new scope */
* Always check if we need to open a new scope
*/
if (!(flags & ACPI_NS_DONT_OPEN_SCOPE) && (walk_state)) { if (!(flags & ACPI_NS_DONT_OPEN_SCOPE) && (walk_state)) {
/* /*
* If entry is a type which opens a scope, push the new scope on the * If entry is a type which opens a scope, push the new scope on the
......
...@@ -76,8 +76,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) ...@@ -76,8 +76,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
#ifdef ACPI_DBG_TRACK_ALLOCATIONS #ifdef ACPI_DBG_TRACK_ALLOCATIONS
temp = temp = acpi_gbl_ns_node_list->total_allocated -
acpi_gbl_ns_node_list->total_allocated -
acpi_gbl_ns_node_list->total_freed; acpi_gbl_ns_node_list->total_freed;
if (temp > acpi_gbl_ns_node_list->max_occupied) { if (temp > acpi_gbl_ns_node_list->max_occupied) {
acpi_gbl_ns_node_list->max_occupied = temp; acpi_gbl_ns_node_list->max_occupied = temp;
...@@ -145,9 +144,8 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) ...@@ -145,9 +144,8 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
/* /* Detach an object if there is one, then delete the node */
* Detach an object if there is one, then delete the node
*/
acpi_ns_detach_object(node); acpi_ns_detach_object(node);
(void)acpi_os_release_object(acpi_gbl_namespace_cache, node); (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
return_VOID; return_VOID;
...@@ -183,9 +181,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp ...@@ -183,9 +181,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
ACPI_FUNCTION_TRACE(ns_install_node); ACPI_FUNCTION_TRACE(ns_install_node);
/* /*
* Get the owner ID from the Walk state * Get the owner ID from the Walk state. The owner ID is used to track
* The owner ID is used to track table deletion and * table deletion and deletion of objects created by methods.
* deletion of objects created by methods
*/ */
if (walk_state) { if (walk_state) {
owner_id = walk_state->owner_id; owner_id = walk_state->owner_id;
...@@ -260,9 +257,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) ...@@ -260,9 +257,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
return_VOID; return_VOID;
} }
/* /* Deallocate all children at this level */
* Deallocate all children at this level
*/
do { do {
/* Get the things we need */ /* Get the things we need */
...@@ -285,9 +281,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) ...@@ -285,9 +281,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
"Object %p, Remaining %X\n", child_node, "Object %p, Remaining %X\n", child_node,
acpi_gbl_current_node_count)); acpi_gbl_current_node_count));
/* /* Detach an object if there is one, then free the child node */
* Detach an object if there is one, then free the child node
*/
acpi_ns_detach_object(child_node); acpi_ns_detach_object(child_node);
/* Now we can delete the node */ /* Now we can delete the node */
...@@ -304,7 +299,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) ...@@ -304,7 +299,6 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
/* Clear the parent's child pointer */ /* Clear the parent's child pointer */
parent_node->child = NULL; parent_node->child = NULL;
return_VOID; return_VOID;
} }
......
...@@ -181,6 +181,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -181,6 +181,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
} }
this_node = acpi_ns_map_handle_to_node(obj_handle); this_node = acpi_ns_map_handle_to_node(obj_handle);
if (!this_node) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n",
obj_handle));
return (AE_OK);
}
type = this_node->type; type = this_node->type;
/* Check if the owner matches */ /* Check if the owner matches */
...@@ -214,9 +220,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -214,9 +220,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
} }
/* /* Now we can print out the pertinent information */
* Now we can print out the pertinent information
*/
acpi_os_printf(" %-12s %p %2.2X ", acpi_os_printf(" %-12s %p %2.2X ",
acpi_ut_get_type_name(type), this_node, acpi_ut_get_type_name(type), this_node,
this_node->owner_id); this_node->owner_id);
...@@ -509,7 +514,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -509,7 +514,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
obj_type = ACPI_GET_OBJECT_TYPE(obj_desc); obj_type = obj_desc->common.type;
if (obj_type > ACPI_TYPE_LOCAL_MAX) { if (obj_type > ACPI_TYPE_LOCAL_MAX) {
acpi_os_printf acpi_os_printf
...@@ -539,9 +544,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -539,9 +544,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
goto cleanup; goto cleanup;
} }
/* /* Valid object, get the pointer to next level, if any */
* Valid object, get the pointer to next level, if any
*/
switch (obj_type) { switch (obj_type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
...@@ -602,14 +606,14 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, ...@@ -602,14 +606,14 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
* display_type - 0 or ACPI_DISPLAY_SUMMARY * display_type - 0 or ACPI_DISPLAY_SUMMARY
* max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth. * for an effectively unlimited depth.
* owner_id - Dump only objects owned by this ID. Use * owner_id - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners. * ACPI_UINT32_MAX to match all owners.
* start_handle - Where in namespace to start/end search * start_handle - Where in namespace to start/end search
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Dump typed objects within the loaded namespace. * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
* Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. * acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object.
* *
******************************************************************************/ ******************************************************************************/
......
...@@ -155,7 +155,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) ...@@ -155,7 +155,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
} }
ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", ACPI_DUMP_PATHNAME(info->resolved_node, "ACPI: Execute Method",
ACPI_LV_INFO, _COMPONENT); ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
......
...@@ -103,7 +103,8 @@ acpi_status acpi_ns_initialize_objects(void) ...@@ -103,7 +103,8 @@ acpi_status acpi_ns_initialize_objects(void)
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd "
"Buffers %hd/%hd Packages (%hd nodes)\n",
info.op_region_init, info.op_region_count, info.op_region_init, info.op_region_count,
info.field_init, info.field_count, info.field_init, info.field_count,
info.buffer_init, info.buffer_count, info.buffer_init, info.buffer_count,
...@@ -148,7 +149,8 @@ acpi_status acpi_ns_initialize_devices(void) ...@@ -148,7 +149,8 @@ acpi_status acpi_ns_initialize_devices(void)
info.num_INI = 0; info.num_INI = 0;
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"Initializing Device/Processor/Thermal objects by executing _INI methods:")); "Initializing Device/Processor/Thermal objects "
"by executing _INI methods:"));
/* Tree analysis: find all subtrees that contain _INI methods */ /* Tree analysis: find all subtrees that contain _INI methods */
...@@ -180,7 +182,8 @@ acpi_status acpi_ns_initialize_devices(void) ...@@ -180,7 +182,8 @@ acpi_status acpi_ns_initialize_devices(void)
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", "\nExecuted %hd _INI methods requiring %hd _STA executions "
"(examined %hd objects)\n",
info.num_INI, info.num_STA, info.device_count)); info.num_INI, info.num_STA, info.device_count));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
...@@ -263,16 +266,14 @@ acpi_ns_init_one_object(acpi_handle obj_handle, ...@@ -263,16 +266,14 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
return (AE_OK); return (AE_OK);
} }
/* /* If the object is already initialized, nothing else to do */
* If the object is already initialized, nothing else to do
*/
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return (AE_OK); return (AE_OK);
} }
/* /* Must lock the interpreter before executing AML code */
* Must lock the interpreter before executing AML code
*/
acpi_ex_enter_interpreter(); acpi_ex_enter_interpreter();
/* /*
......
...@@ -128,12 +128,12 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) ...@@ -128,12 +128,12 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
* parse trees. * parse trees.
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"**** Begin Table Method Parsing and Object Initialization ****\n")); "**** Begin Table Method Parsing and Object Initialization\n"));
status = acpi_ds_initialize_objects(table_index, node); status = acpi_ds_initialize_objects(table_index, node);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"**** Completed Table Method Parsing and Object Initialization ****\n")); "**** Completed Table Method Parsing and Object Initialization\n"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -209,8 +209,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) ...@@ -209,8 +209,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
obj_desc = node->object; obj_desc = node->object;
if (!obj_desc || if (!obj_desc || (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
(ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
return_VOID; return_VOID;
} }
...@@ -220,8 +219,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) ...@@ -220,8 +219,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node)
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) { if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object; node->object = obj_desc->common.next_object;
if (node->object && if (node->object &&
(ACPI_GET_OBJECT_TYPE(node->object) != ((node->object)->common.type != ACPI_TYPE_LOCAL_DATA)) {
ACPI_TYPE_LOCAL_DATA)) {
node->object = node->object->common.next_object; node->object = node->object->common.next_object;
} }
} }
...@@ -267,7 +265,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct ...@@ -267,7 +265,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND) ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
&& (ACPI_GET_DESCRIPTOR_TYPE(node->object) != && (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
ACPI_DESC_TYPE_NAMED)) ACPI_DESC_TYPE_NAMED))
|| (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) { || ((node->object)->common.type == ACPI_TYPE_LOCAL_DATA)) {
return_PTR(NULL); return_PTR(NULL);
} }
...@@ -294,9 +292,9 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union ...@@ -294,9 +292,9 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union
ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc);
if ((!obj_desc) || if ((!obj_desc) ||
(ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) ||
(!obj_desc->common.next_object) || (!obj_desc->common.next_object) ||
(ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) == ((obj_desc->common.next_object)->common.type ==
ACPI_TYPE_LOCAL_DATA)) { ACPI_TYPE_LOCAL_DATA)) {
return_PTR(NULL); return_PTR(NULL);
} }
...@@ -331,7 +329,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node, ...@@ -331,7 +329,7 @@ acpi_ns_attach_data(struct acpi_namespace_node *node,
prev_obj_desc = NULL; prev_obj_desc = NULL;
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
return (AE_ALREADY_EXISTS); return (AE_ALREADY_EXISTS);
} }
...@@ -385,7 +383,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node, ...@@ -385,7 +383,7 @@ acpi_ns_detach_data(struct acpi_namespace_node * node,
prev_obj_desc = NULL; prev_obj_desc = NULL;
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
if (prev_obj_desc) { if (prev_obj_desc) {
prev_obj_desc->common.next_object = prev_obj_desc->common.next_object =
...@@ -428,7 +426,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node * node, ...@@ -428,7 +426,7 @@ acpi_ns_get_attached_data(struct acpi_namespace_node * node,
obj_desc = node->object; obj_desc = node->object;
while (obj_desc) { while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) { (obj_desc->data.handler == handler)) {
*data = obj_desc->data.pointer; *data = obj_desc->data.pointer;
return (AE_OK); return (AE_OK);
......
...@@ -176,9 +176,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) ...@@ -176,9 +176,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
* performs another complete parse of the AML. * performs another complete parse of the AML.
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
status = status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1,
acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index, table_index, start_node);
start_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
...@@ -193,9 +192,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) ...@@ -193,9 +192,8 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
* parse objects are all cached. * parse objects are all cached.
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
status = status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2,
acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index, table_index, start_node);
start_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -79,7 +79,9 @@ acpi_ns_check_package(char *pathname, ...@@ -79,7 +79,9 @@ acpi_ns_check_package(char *pathname,
static acpi_status static acpi_status
acpi_ns_check_package_elements(char *pathname, acpi_ns_check_package_elements(char *pathname,
union acpi_operand_object **elements, union acpi_operand_object **elements,
u8 type1, u32 count1, u8 type2, u32 count2); u8 type1,
u32 count1,
u8 type2, u32 count2, u32 start_index);
static acpi_status static acpi_status
acpi_ns_check_object_type(char *pathname, acpi_ns_check_object_type(char *pathname,
...@@ -221,7 +223,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, ...@@ -221,7 +223,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
/* For returned Package objects, check the type of all sub-objects */ /* For returned Package objects, check the type of all sub-objects */
if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_PACKAGE) { if (return_object->common.type == ACPI_TYPE_PACKAGE) {
status = status =
acpi_ns_check_package(pathname, return_object_ptr, acpi_ns_check_package(pathname, return_object_ptr,
predefined); predefined);
...@@ -302,7 +304,8 @@ acpi_ns_check_parameter_count(char *pathname, ...@@ -302,7 +304,8 @@ acpi_ns_check_parameter_count(char *pathname,
if ((user_param_count != required_params_current) && if ((user_param_count != required_params_current) &&
(user_param_count != required_params_old)) { (user_param_count != required_params_old)) {
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
"%s: Parameter count mismatch - caller passed %d, ACPI requires %d", "%s: Parameter count mismatch - "
"caller passed %d, ACPI requires %d",
pathname, user_param_count, pathname, user_param_count,
required_params_current)); required_params_current));
} }
...@@ -472,7 +475,7 @@ acpi_ns_check_package(char *pathname, ...@@ -472,7 +475,7 @@ acpi_ns_check_package(char *pathname,
package->ret_info. package->ret_info.
object_type2, object_type2,
package->ret_info. package->ret_info.
count2); count2, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -623,7 +626,7 @@ acpi_ns_check_package(char *pathname, ...@@ -623,7 +626,7 @@ acpi_ns_check_package(char *pathname,
object_type2, object_type2,
package-> package->
ret_info. ret_info.
count2); count2, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -672,7 +675,8 @@ acpi_ns_check_package(char *pathname, ...@@ -672,7 +675,8 @@ acpi_ns_check_package(char *pathname,
object_type1, object_type1,
sub_package-> sub_package->
package. package.
count, 0, 0); count, 0, 0,
0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -710,7 +714,8 @@ acpi_ns_check_package(char *pathname, ...@@ -710,7 +714,8 @@ acpi_ns_check_package(char *pathname,
ret_info. ret_info.
object_type1, object_type1,
(expected_count (expected_count
- 1), 0, 0); - 1), 0, 0,
1);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -758,6 +763,7 @@ acpi_ns_check_package(char *pathname, ...@@ -758,6 +763,7 @@ acpi_ns_check_package(char *pathname,
* Count1 - Count for first group * Count1 - Count for first group
* Type2 - Object type for second group * Type2 - Object type for second group
* Count2 - Count for second group * Count2 - Count for second group
* start_index - Start of the first group of elements
* *
* RETURN: Status * RETURN: Status
* *
...@@ -769,7 +775,9 @@ acpi_ns_check_package(char *pathname, ...@@ -769,7 +775,9 @@ acpi_ns_check_package(char *pathname,
static acpi_status static acpi_status
acpi_ns_check_package_elements(char *pathname, acpi_ns_check_package_elements(char *pathname,
union acpi_operand_object **elements, union acpi_operand_object **elements,
u8 type1, u32 count1, u8 type2, u32 count2) u8 type1,
u32 count1,
u8 type2, u32 count2, u32 start_index)
{ {
union acpi_operand_object **this_element = elements; union acpi_operand_object **this_element = elements;
acpi_status status; acpi_status status;
...@@ -782,7 +790,7 @@ acpi_ns_check_package_elements(char *pathname, ...@@ -782,7 +790,7 @@ acpi_ns_check_package_elements(char *pathname,
*/ */
for (i = 0; i < count1; i++) { for (i = 0; i < count1; i++) {
status = acpi_ns_check_object_type(pathname, this_element, status = acpi_ns_check_object_type(pathname, this_element,
type1, i); type1, i + start_index);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -791,7 +799,8 @@ acpi_ns_check_package_elements(char *pathname, ...@@ -791,7 +799,8 @@ acpi_ns_check_package_elements(char *pathname,
for (i = 0; i < count2; i++) { for (i = 0; i < count2; i++) {
status = acpi_ns_check_object_type(pathname, this_element, status = acpi_ns_check_object_type(pathname, this_element,
type2, (i + count1)); type2,
(i + count1 + start_index));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
...@@ -858,7 +867,7 @@ acpi_ns_check_object_type(char *pathname, ...@@ -858,7 +867,7 @@ acpi_ns_check_object_type(char *pathname,
* from all of the predefined names (including elements of returned * from all of the predefined names (including elements of returned
* packages) * packages)
*/ */
switch (ACPI_GET_OBJECT_TYPE(return_object)) { switch (return_object->common.type) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
return_btype = ACPI_RTYPE_INTEGER; return_btype = ACPI_RTYPE_INTEGER;
break; break;
...@@ -901,7 +910,7 @@ acpi_ns_check_object_type(char *pathname, ...@@ -901,7 +910,7 @@ acpi_ns_check_object_type(char *pathname,
/* For reference objects, check that the reference type is correct */ /* For reference objects, check that the reference type is correct */
if (ACPI_GET_OBJECT_TYPE(return_object) == ACPI_TYPE_LOCAL_REFERENCE) { if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
status = acpi_ns_check_reference(pathname, return_object); status = acpi_ns_check_reference(pathname, return_object);
} }
...@@ -974,7 +983,8 @@ acpi_ns_check_reference(char *pathname, ...@@ -974,7 +983,8 @@ acpi_ns_check_reference(char *pathname,
} }
ACPI_WARNING((AE_INFO, ACPI_WARNING((AE_INFO,
"%s: Return type mismatch - unexpected reference object type [%s] %2.2X", "%s: Return type mismatch - "
"unexpected reference object type [%s] %2.2X",
pathname, acpi_ut_get_reference_name(return_object), pathname, acpi_ut_get_reference_name(return_object),
return_object->reference.class)); return_object->reference.class));
...@@ -1006,7 +1016,7 @@ acpi_ns_repair_object(u32 expected_btypes, ...@@ -1006,7 +1016,7 @@ acpi_ns_repair_object(u32 expected_btypes,
union acpi_operand_object *new_object; union acpi_operand_object *new_object;
acpi_size length; acpi_size length;
switch (ACPI_GET_OBJECT_TYPE(return_object)) { switch (return_object->common.type) {
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
if (!(expected_btypes & ACPI_RTYPE_STRING)) { if (!(expected_btypes & ACPI_RTYPE_STRING)) {
......
...@@ -167,7 +167,8 @@ acpi_ns_search_one_scope(u32 target_name, ...@@ -167,7 +167,8 @@ acpi_ns_search_one_scope(u32 target_name,
/* Searched entire namespace level, not found */ /* Searched entire namespace level, not found */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", "Name [%4.4s] (%s) not found in search in scope [%4.4s] "
"%p first child %p\n",
ACPI_CAST_PTR(char, &target_name), ACPI_CAST_PTR(char, &target_name),
acpi_ut_get_type_name(type), acpi_ut_get_type_name(type),
acpi_ut_get_node_name(parent_node), parent_node, acpi_ut_get_node_name(parent_node), parent_node,
...@@ -239,9 +240,8 @@ acpi_ns_search_parent_tree(u32 target_name, ...@@ -239,9 +240,8 @@ acpi_ns_search_parent_tree(u32 target_name,
acpi_ut_get_node_name(parent_node), acpi_ut_get_node_name(parent_node),
ACPI_CAST_PTR(char, &target_name))); ACPI_CAST_PTR(char, &target_name)));
/* /* Search parents until target is found or we have backed up to the root */
* Search parents until target is found or we have backed up to the root
*/
while (parent_node) { while (parent_node) {
/* /*
* Search parent scope. Use TYPE_ANY because we don't care about the * Search parent scope. Use TYPE_ANY because we don't care about the
...@@ -395,9 +395,9 @@ acpi_ns_search_and_enter(u32 target_name, ...@@ -395,9 +395,9 @@ acpi_ns_search_and_enter(u32 target_name,
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
#ifdef ACPI_ASL_COMPILER #ifdef ACPI_ASL_COMPILER
/*
* Node is an object defined by an External() statement /* Node is an object defined by an External() statement */
*/
if (flags & ACPI_NS_EXTERNAL) { if (flags & ACPI_NS_EXTERNAL) {
new_node->flags |= ANOBJ_IS_EXTERNAL; new_node->flags |= ANOBJ_IS_EXTERNAL;
} }
......
...@@ -325,9 +325,8 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) ...@@ -325,9 +325,8 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
next_external_char++; next_external_char++;
} }
} else { } else {
/* /* Handle Carat prefixes */
* Handle Carat prefixes
*/
while (*next_external_char == '^') { while (*next_external_char == '^') {
info->num_carats++; info->num_carats++;
next_external_char++; next_external_char++;
...@@ -552,9 +551,8 @@ acpi_ns_externalize_name(u32 internal_name_length, ...@@ -552,9 +551,8 @@ acpi_ns_externalize_name(u32 internal_name_length,
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* /* Check for a prefix (one '\' | one or more '^') */
* Check for a prefix (one '\' | one or more '^').
*/
switch (internal_name[0]) { switch (internal_name[0]) {
case '\\': case '\\':
prefix_length = 1; prefix_length = 1;
...@@ -580,7 +578,7 @@ acpi_ns_externalize_name(u32 internal_name_length, ...@@ -580,7 +578,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
} }
/* /*
* Check for object names. Note that there could be 0-255 of these * Check for object names. Note that there could be 0-255 of these
* 4-byte elements. * 4-byte elements.
*/ */
if (prefix_length < internal_name_length) { if (prefix_length < internal_name_length) {
...@@ -637,9 +635,8 @@ acpi_ns_externalize_name(u32 internal_name_length, ...@@ -637,9 +635,8 @@ acpi_ns_externalize_name(u32 internal_name_length,
return_ACPI_STATUS(AE_BAD_PATHNAME); return_ACPI_STATUS(AE_BAD_PATHNAME);
} }
/* /* Build the converted_name */
* Build converted_name
*/
*converted_name = ACPI_ALLOCATE_ZEROED(required_length); *converted_name = ACPI_ALLOCATE_ZEROED(required_length);
if (!(*converted_name)) { if (!(*converted_name)) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
...@@ -685,6 +682,9 @@ acpi_ns_externalize_name(u32 internal_name_length, ...@@ -685,6 +682,9 @@ acpi_ns_externalize_name(u32 internal_name_length,
* and keep all pointers within this subsystem - however this introduces * and keep all pointers within this subsystem - however this introduces
* more (and perhaps unnecessary) overhead. * more (and perhaps unnecessary) overhead.
* *
* The current implemenation is basically a placeholder until such time comes
* that it is needed.
*
******************************************************************************/ ******************************************************************************/
struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
...@@ -692,9 +692,8 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) ...@@ -692,9 +692,8 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
/* /* Parameter validation */
* Simple implementation
*/
if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { if ((!handle) || (handle == ACPI_ROOT_OBJECT)) {
return (acpi_gbl_root_node); return (acpi_gbl_root_node);
} }
...@@ -872,7 +871,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, ...@@ -872,7 +871,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
(flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL,
return_node); return_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s, %s\n",
pathname, acpi_format_exception(status))); pathname, acpi_format_exception(status)));
} }
......
...@@ -135,8 +135,8 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct ...@@ -135,8 +135,8 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct
* starting (and ending) at the node specified by start_handle. * starting (and ending) at the node specified by start_handle.
* The user_function is called whenever a node that matches * The user_function is called whenever a node that matches
* the type parameter is found. If the user function returns * the type parameter is found. If the user function returns
* a non-zero value, the search is terminated immediately and this * a non-zero value, the search is terminated immediately and
* value is returned to the caller. * this value is returned to the caller.
* *
* The point of this procedure is to provide a generic namespace * The point of this procedure is to provide a generic namespace
* walk routine that can be called from multiple places to * walk routine that can be called from multiple places to
...@@ -200,10 +200,10 @@ acpi_ns_walk_namespace(acpi_object_type type, ...@@ -200,10 +200,10 @@ acpi_ns_walk_namespace(acpi_object_type type,
/* /*
* Ignore all temporary namespace nodes (created during control * Ignore all temporary namespace nodes (created during control
* method execution) unless told otherwise. These temporary nodes * method execution) unless told otherwise. These temporary nodes
* can cause a race condition because they can be deleted during the * can cause a race condition because they can be deleted during
* execution of the user function (if the namespace is unlocked before * the execution of the user function (if the namespace is
* invocation of the user function.) Only the debugger namespace dump * unlocked before invocation of the user function.) Only the
* will examine the temporary nodes. * debugger namespace dump will examine the temporary nodes.
*/ */
if ((child_node->flags & ANOBJ_TEMPORARY) && if ((child_node->flags & ANOBJ_TEMPORARY) &&
!(flags & ACPI_NS_WALK_TEMP_NODES)) { !(flags & ACPI_NS_WALK_TEMP_NODES)) {
......
...@@ -387,8 +387,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info) ...@@ -387,8 +387,7 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
/* We are interested in reference objects only */ /* We are interested in reference objects only */
if (ACPI_GET_OBJECT_TYPE(info->return_object) != if ((info->return_object)->common.type != ACPI_TYPE_LOCAL_REFERENCE) {
ACPI_TYPE_LOCAL_REFERENCE) {
return; return;
} }
...@@ -476,21 +475,40 @@ acpi_walk_namespace(acpi_object_type type, ...@@ -476,21 +475,40 @@ acpi_walk_namespace(acpi_object_type type,
} }
/* /*
* Lock the namespace around the walk. * Need to acquire the namespace reader lock to prevent interference
* The namespace will be unlocked/locked around each call * with any concurrent table unloads (which causes the deletion of
* to the user function - since this function * namespace objects). We cannot allow the deletion of a namespace node
* must be allowed to make Acpi calls itself. * while the user function is using it. The exception to this are the
* nodes created and deleted during control method execution -- these
* nodes are marked as temporary nodes and are ignored by the namespace
* walk. Thus, control methods can be executed while holding the
* namespace deletion lock (and the user function can execute control
* methods.)
*/
status = acpi_ut_acquire_read_lock(&acpi_gbl_namespace_rw_lock);
if (ACPI_FAILURE(status)) {
return status;
}
/*
* Lock the namespace around the walk. The namespace will be
* unlocked/locked around each call to the user function - since the user
* function must be allowed to make ACPICA calls itself (for example, it
* will typically execute control methods during device enumeration.)
*/ */
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); goto unlock_and_exit;
} }
status = acpi_ns_walk_namespace(type, start_object, max_depth, status = acpi_ns_walk_namespace(type, start_object, max_depth,
ACPI_NS_WALK_UNLOCK, ACPI_NS_WALK_UNLOCK, user_function,
user_function, context, return_value); context, return_value);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
unlock_and_exit:
(void)acpi_ut_release_read_lock(&acpi_gbl_namespace_rw_lock);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
......
...@@ -557,9 +557,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, ...@@ -557,9 +557,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
table_index++) { table_index++) {
if (*sub_object_list && /* Null object allowed */ if (*sub_object_list && /* Null object allowed */
((ACPI_TYPE_STRING == ((ACPI_TYPE_STRING ==
ACPI_GET_OBJECT_TYPE(*sub_object_list)) || (*sub_object_list)->common.type) ||
((ACPI_TYPE_LOCAL_REFERENCE == ((ACPI_TYPE_LOCAL_REFERENCE ==
ACPI_GET_OBJECT_TYPE(*sub_object_list)) && (*sub_object_list)->common.type) &&
((*sub_object_list)->reference.class == ((*sub_object_list)->reference.class ==
ACPI_REFCLASS_NAME)))) { ACPI_REFCLASS_NAME)))) {
name_found = TRUE; name_found = TRUE;
...@@ -575,8 +575,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, ...@@ -575,8 +575,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
/* Was a String type found? */ /* Was a String type found? */
if (name_found) { if (name_found) {
if (ACPI_GET_OBJECT_TYPE(*sub_object_list) == if ((*sub_object_list)->common.type == ACPI_TYPE_STRING) {
ACPI_TYPE_STRING) {
/* /*
* The length String.Length field does not include the * The length String.Length field does not include the
* terminating NULL, add 1 * terminating NULL, add 1
......
...@@ -212,7 +212,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -212,7 +212,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
/* Each element of the top-level package must also be a package */ /* Each element of the top-level package must also be a package */
if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { if ((*top_object_list)->common.type != ACPI_TYPE_PACKAGE) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"(PRT[%X]) Need sub-package, found %s", "(PRT[%X]) Need sub-package, found %s",
index, index,
...@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -240,7 +240,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
/* 1) First subobject: Dereference the PRT.Address */ /* 1) First subobject: Dereference the PRT.Address */
obj_desc = sub_object_list[0]; obj_desc = sub_object_list[0];
if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"(PRT[%X].Address) Need Integer, found %s", "(PRT[%X].Address) Need Integer, found %s",
index, index,
...@@ -253,7 +253,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -253,7 +253,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
/* 2) Second subobject: Dereference the PRT.Pin */ /* 2) Second subobject: Dereference the PRT.Pin */
obj_desc = sub_object_list[1]; obj_desc = sub_object_list[1];
if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"(PRT[%X].Pin) Need Integer, found %s", "(PRT[%X].Pin) Need Integer, found %s",
index, index,
...@@ -265,7 +265,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -265,7 +265,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
* If BIOS erroneously reversed the _PRT source_name and source_index, * If BIOS erroneously reversed the _PRT source_name and source_index,
* then reverse them back. * then reverse them back.
*/ */
if (ACPI_GET_OBJECT_TYPE(sub_object_list[3]) != if ((sub_object_list[3])->common.type !=
ACPI_TYPE_INTEGER) { ACPI_TYPE_INTEGER) {
if (acpi_gbl_enable_interpreter_slack) { if (acpi_gbl_enable_interpreter_slack) {
source_name_index = 3; source_name_index = 3;
...@@ -291,8 +291,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -291,8 +291,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
* other ACPI implementations. * other ACPI implementations.
*/ */
obj_desc = sub_object_list[3]; obj_desc = sub_object_list[3];
if (!obj_desc if (!obj_desc || (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
|| (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) {
sub_object_list[3] = sub_object_list[2]; sub_object_list[3] = sub_object_list[2];
sub_object_list[2] = obj_desc; sub_object_list[2] = obj_desc;
...@@ -307,7 +306,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -307,7 +306,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
*/ */
obj_desc = sub_object_list[source_name_index]; obj_desc = sub_object_list[source_name_index];
if (obj_desc) { if (obj_desc) {
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (obj_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
if (obj_desc->reference.class != if (obj_desc->reference.class !=
...@@ -380,7 +379,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, ...@@ -380,7 +379,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
/* 4) Fourth subobject: Dereference the PRT.source_index */ /* 4) Fourth subobject: Dereference the PRT.source_index */
obj_desc = sub_object_list[source_index_index]; obj_desc = sub_object_list[source_index_index];
if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) { if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"(PRT[%X].SourceIndex) Need Integer, found %s", "(PRT[%X].SourceIndex) Need Integer, found %s",
index, index,
......
此差异已折叠。
...@@ -103,7 +103,9 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) ...@@ -103,7 +103,9 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: This function is called to add the ACPI table * DESCRIPTION: This function is called to add an ACPI table. It is used to
* dynamically load tables via the Load and load_table AML
* operators.
* *
******************************************************************************/ ******************************************************************************/
...@@ -112,6 +114,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) ...@@ -112,6 +114,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
{ {
u32 i; u32 i;
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_table_header *override_table = NULL;
ACPI_FUNCTION_TRACE(tb_add_table); ACPI_FUNCTION_TRACE(tb_add_table);
...@@ -201,6 +204,29 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) ...@@ -201,6 +204,29 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index)
} }
} }
/*
* ACPI Table Override:
* Allow the host to override dynamically loaded tables.
*/
status = acpi_os_table_override(table_desc->pointer, &override_table);
if (ACPI_SUCCESS(status) && override_table) {
ACPI_INFO((AE_INFO,
"%4.4s @ 0x%p Table override, replaced with:",
table_desc->pointer->signature,
ACPI_CAST_PTR(void, table_desc->address)));
/* We can delete the table that was passed as a parameter */
acpi_tb_delete_table(table_desc);
/* Setup descriptor for the new table */
table_desc->address = ACPI_PTR_TO_PHYSADDR(override_table);
table_desc->pointer = override_table;
table_desc->length = override_table->length;
table_desc->flags = ACPI_TABLE_ORIGIN_OVERRIDE;
}
/* Add the table to the global root table list */ /* Add the table to the global root table list */
status = acpi_tb_store_table(table_desc->address, table_desc->pointer, status = acpi_tb_store_table(table_desc->address, table_desc->pointer,
...@@ -247,8 +273,9 @@ acpi_status acpi_tb_resize_root_table_list(void) ...@@ -247,8 +273,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
/* Increase the Table Array size */ /* Increase the Table Array size */
tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list. tables = ACPI_ALLOCATE_ZEROED(((acpi_size) acpi_gbl_root_table_list.
size + ACPI_ROOT_TABLE_SIZE_INCREMENT) size +
* sizeof(struct acpi_table_desc)); ACPI_ROOT_TABLE_SIZE_INCREMENT) *
sizeof(struct acpi_table_desc));
if (!tables) { if (!tables) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Could not allocate new root table array")); "Could not allocate new root table array"));
...@@ -407,27 +434,56 @@ void acpi_tb_terminate(void) ...@@ -407,27 +434,56 @@ void acpi_tb_terminate(void)
* *
* PARAMETERS: table_index - Table index * PARAMETERS: table_index - Table index
* *
* RETURN: None * RETURN: Status
* *
* DESCRIPTION: Delete all namespace objects created when this table was loaded. * DESCRIPTION: Delete all namespace objects created when this table was loaded.
* *
******************************************************************************/ ******************************************************************************/
void acpi_tb_delete_namespace_by_owner(u32 table_index) acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index)
{ {
acpi_owner_id owner_id; acpi_owner_id owner_id;
acpi_status status;
ACPI_FUNCTION_TRACE(tb_delete_namespace_by_owner);
status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (table_index >= acpi_gbl_root_table_list.count) {
/* The table index does not exist */
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (table_index < acpi_gbl_root_table_list.count) {
owner_id =
acpi_gbl_root_table_list.tables[table_index].owner_id;
} else {
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES); (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
return; return_ACPI_STATUS(AE_NOT_EXIST);
} }
/* Get the owner ID for this table, used to delete namespace nodes */
owner_id = acpi_gbl_root_table_list.tables[table_index].owner_id;
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES); (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
/*
* Need to acquire the namespace writer lock to prevent interference
* with any concurrent namespace walks. The interpreter must be
* released during the deletion since the acquisition of the deletion
* lock may block, and also since the execution of a namespace walk
* must be allowed to use the interpreter.
*/
acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
status = acpi_ut_acquire_write_lock(&acpi_gbl_namespace_rw_lock);
acpi_ns_delete_namespace_by_owner(owner_id); acpi_ns_delete_namespace_by_owner(owner_id);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
acpi_ut_release_write_lock(&acpi_gbl_namespace_rw_lock);
status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
...@@ -535,8 +591,8 @@ u8 acpi_tb_is_table_loaded(u32 table_index) ...@@ -535,8 +591,8 @@ u8 acpi_tb_is_table_loaded(u32 table_index)
(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (table_index < acpi_gbl_root_table_list.count) { if (table_index < acpi_gbl_root_table_list.count) {
is_loaded = (u8) is_loaded = (u8)
(acpi_gbl_root_table_list.tables[table_index]. (acpi_gbl_root_table_list.tables[table_index].flags &
flags & ACPI_TABLE_IS_LOADED); ACPI_TABLE_IS_LOADED);
} }
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES); (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
......
此差异已折叠。
此差异已折叠。
...@@ -75,8 +75,8 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) ...@@ -75,8 +75,8 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
* Note: Sometimes there exists more than one RSDP in memory; the valid * Note: Sometimes there exists more than one RSDP in memory; the valid
* RSDP has a valid checksum, all others have an invalid checksum. * RSDP has a valid checksum, all others have an invalid checksum.
*/ */
if (ACPI_STRNCMP((char *)rsdp, ACPI_SIG_RSDP, sizeof(ACPI_SIG_RSDP) - 1) if (ACPI_STRNCMP((char *)rsdp, ACPI_SIG_RSDP,
!= 0) { sizeof(ACPI_SIG_RSDP) - 1) != 0) {
/* Nope, BAD Signature */ /* Nope, BAD Signature */
......
此差异已折叠。
...@@ -86,7 +86,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ...@@ -86,7 +86,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
* Must delete or free any pointers within the object that are not * Must delete or free any pointers within the object that are not
* actual ACPI objects (for example, a raw buffer pointer). * actual ACPI objects (for example, a raw buffer pointer).
*/ */
switch (ACPI_GET_OBJECT_TYPE(object)) { switch (object->common.type) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
...@@ -382,7 +382,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) ...@@ -382,7 +382,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
object, new_count)); object, new_count));
} }
if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) { if (object->common.type == ACPI_TYPE_METHOD) {
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Method Obj %p Refs=%X, [Decremented]\n", "Method Obj %p Refs=%X, [Decremented]\n",
object, new_count)); object, new_count));
...@@ -469,7 +469,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) ...@@ -469,7 +469,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
* All sub-objects must have their reference count incremented also. * All sub-objects must have their reference count incremented also.
* Different object types have different subobjects. * Different object types have different subobjects.
*/ */
switch (ACPI_GET_OBJECT_TYPE(object)) { switch (object->common.type) {
case ACPI_TYPE_DEVICE: case ACPI_TYPE_DEVICE:
case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
......
此差异已折叠。
...@@ -294,12 +294,9 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { ...@@ -294,12 +294,9 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
/* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL,
ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE,
ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, ACPI_BITMASK_GLOBAL_LOCK_RELEASE},
/* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL,
ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITPOSITION_SLEEP_TYPE,
ACPI_BITMASK_SLEEP_TYPE_X}, ACPI_BITMASK_SLEEP_TYPE},
/* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL,
ACPI_BITPOSITION_SLEEP_TYPE_X,
ACPI_BITMASK_SLEEP_TYPE_X},
/* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL,
ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITPOSITION_SLEEP_ENABLE,
ACPI_BITMASK_SLEEP_ENABLE}, ACPI_BITMASK_SLEEP_ENABLE},
...@@ -476,7 +473,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) ...@@ -476,7 +473,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc)
return ("[NULL Object Descriptor]"); return ("[NULL Object Descriptor]");
} }
return (acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc))); return (acpi_ut_get_type_name(obj_desc->common.type));
} }
/******************************************************************************* /*******************************************************************************
...@@ -749,7 +746,10 @@ acpi_status acpi_ut_init_globals(void) ...@@ -749,7 +746,10 @@ acpi_status acpi_ut_init_globals(void)
for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) { for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++) {
acpi_gbl_owner_id_mask[i] = 0; acpi_gbl_owner_id_mask[i] = 0;
} }
acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
/* Last owner_iD is never valid */
acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
/* GPE support */ /* GPE support */
...@@ -789,6 +789,7 @@ acpi_status acpi_ut_init_globals(void) ...@@ -789,6 +789,7 @@ acpi_status acpi_ut_init_globals(void)
acpi_gbl_trace_dbg_layer = 0; acpi_gbl_trace_dbg_layer = 0;
acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
acpi_gbl_osi_data = 0;
/* Hardware oriented */ /* Hardware oriented */
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册