mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-07 23:04:55 +00:00
ACPI and power management updates for 3.8-rc1
* Introduction of device PM QoS flags. * ACPI device power management update allowing subsystems other than PCI to use it more easily. * ACPI device enumeration rework allowing additional kinds of devices to be enumerated via ACPI. From Mika Westerberg, Adrian Hunter, Mathias Nyman, Andy Shevchenko, and Rafael J. Wysocki. * ACPICA update to version 20121018 from Bob Moore and Lv Zheng. * ACPI memory hotplug update from Wen Congyang and Yasuaki Ishimatsu. * Introduction of acpi_handle_<level>() messaging macros and ACPI-based CPU hot-remove support from Toshi Kani. * ACPI EC updates from Feng Tang. * cpufreq updates from Viresh Kumar, Fabio Baltieri and others. * cpuidle changes to quickly notice governor prediction failure from Youquan Song. * Support for using multiple cpuidle drivers at the same time and cpuidle cleanups from Daniel Lezcano. * devfreq updates from Nishanth Menon and others. * cpupower update from Thomas Renninger. * Fixes and small cleanups all over the place. -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJQxxevAAoJEKhOf7ml8uNsHacQAK2xoQozDddPBAaTCf1OWW/G J4E2qMn+gy4AtFmQ0/xeZVvvylOCn9eu/kv3QJ/bFlVoUsqTgfPwQBjT6HjF1Acn 7yVFdr9H/tn2wi9nW2Gv6Tl2Hr/kFLpo0f5Kd40Z+P8SV5sKX5ktJcVpJ/I/P4Vh Qw2nWtj7hQktZDERzgG4ZpMbQToNhbLhbKWB9ad3/XQSSA9JkfgvBFgrTEGHcZD5 bwsggjNdOAWNGeDdzRsQSDn0Alld5ILVdSJ5xKimO1O70WvKc7fqA1IdYRIeKL90 yz4bcoYKzl9iktlw8+x5o1U9mrc8TFV5p4+zV+t5Z6pzS/J3kWvnsW4zu9sCrxFv Wic3SKyiem7s2dxrYyj4ZXAci3GK4ouRTrCLqk7/00tEGdwAQD1ZNfsUJp6jKayz FvtZUgItcOyrlQ6B4nh951OY6dI3AUYJ2NuWWNr5NZkgVAvQGV8zTGOImbeVeL2+ pMiw14zScO3ylYilVcjTKDDMj2sDZ68mw5PIcbmksvWsCLo26jDBVDtLVmtYWyd4 ek3WnOrQZr0R3agvOLLssMKXompvpP+N4Klf4rV+GtqGsWtHryYKys2Laju9FwFj yYLchxYlxhGTzqq8LjF90HDL0TWpPe6cPi+B5ow9g/SXLexbMKNQGhv3Jovm2yR3 j54tKBWy7e9AAYEDPirX =6OEP -----END PGP SIGNATURE----- Merge tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI and power management updates from Rafael Wysocki: - Introduction of device PM QoS flags. - ACPI device power management update allowing subsystems other than PCI to use it more easily. - ACPI device enumeration rework allowing additional kinds of devices to be enumerated via ACPI. From Mika Westerberg, Adrian Hunter, Mathias Nyman, Andy Shevchenko, and Rafael J. Wysocki. - ACPICA update to version 20121018 from Bob Moore and Lv Zheng. - ACPI memory hotplug update from Wen Congyang and Yasuaki Ishimatsu. - Introduction of acpi_handle_<level>() messaging macros and ACPI-based CPU hot-remove support from Toshi Kani. - ACPI EC updates from Feng Tang. - cpufreq updates from Viresh Kumar, Fabio Baltieri and others. - cpuidle changes to quickly notice governor prediction failure from Youquan Song. - Support for using multiple cpuidle drivers at the same time and cpuidle cleanups from Daniel Lezcano. - devfreq updates from Nishanth Menon and others. - cpupower update from Thomas Renninger. - Fixes and small cleanups all over the place. * tag 'pm+acpi-for-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (196 commits) mmc: sdhci-acpi: enable runtime-pm for device HID INT33C6 ACPI: add Haswell LPSS devices to acpi_platform_device_ids list ACPI: add documentation about ACPI 5 enumeration pnpacpi: fix incorrect TEST_ALPHA() test ACPI / PM: Fix header of acpi_dev_pm_detach() in acpi.h ACPI / video: ignore BIOS initial backlight value for HP Folio 13-2000 ACPI : do not use Lid and Sleep button for S5 wakeup ACPI / PNP: Do not crash due to stale pointer use during system resume ACPI / video: Add "Asus UL30VT" to ACPI video detect blacklist ACPI: do acpisleep dmi check when CONFIG_ACPI_SLEEP is set spi / ACPI: add ACPI enumeration support gpio / ACPI: add ACPI support PM / devfreq: remove compiler error with module governors (2) cpupower: IvyBridge (0x3a and 0x3e models) support cpupower: Provide -c param for cpupower monitor to schedule process on all cores cpupower tools: Fix warning and a bug with the cpu package count cpupower tools: Fix malloc of cpu_info structure cpupower tools: Fix issues with sysfs_topology_read_file cpupower tools: Fix minor warnings cpupower tools: Update .gitignore for files created in the debug directories ...
This commit is contained in:
commit
bad73c5aa0
233 changed files with 9505 additions and 3361 deletions
|
@ -11,7 +11,7 @@ What: /sys/class/devfreq/.../governor
|
||||||
Date: September 2011
|
Date: September 2011
|
||||||
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
||||||
Description:
|
Description:
|
||||||
The /sys/class/devfreq/.../governor shows the name of the
|
The /sys/class/devfreq/.../governor show or set the name of the
|
||||||
governor used by the corresponding devfreq object.
|
governor used by the corresponding devfreq object.
|
||||||
|
|
||||||
What: /sys/class/devfreq/.../cur_freq
|
What: /sys/class/devfreq/.../cur_freq
|
||||||
|
@ -19,15 +19,16 @@ Date: September 2011
|
||||||
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
||||||
Description:
|
Description:
|
||||||
The /sys/class/devfreq/.../cur_freq shows the current
|
The /sys/class/devfreq/.../cur_freq shows the current
|
||||||
frequency of the corresponding devfreq object.
|
frequency of the corresponding devfreq object. Same as
|
||||||
|
target_freq when get_cur_freq() is not implemented by
|
||||||
|
devfreq driver.
|
||||||
|
|
||||||
What: /sys/class/devfreq/.../central_polling
|
What: /sys/class/devfreq/.../target_freq
|
||||||
Date: September 2011
|
Date: September 2012
|
||||||
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
Contact: Rajagopal Venkat <rajagopal.venkat@linaro.org>
|
||||||
Description:
|
Description:
|
||||||
The /sys/class/devfreq/.../central_polling shows whether
|
The /sys/class/devfreq/.../target_freq shows the next governor
|
||||||
the devfreq ojbect is using devfreq-provided central
|
predicted target frequency of the corresponding devfreq object.
|
||||||
polling mechanism or not.
|
|
||||||
|
|
||||||
What: /sys/class/devfreq/.../polling_interval
|
What: /sys/class/devfreq/.../polling_interval
|
||||||
Date: September 2011
|
Date: September 2011
|
||||||
|
@ -43,6 +44,17 @@ Description:
|
||||||
(/sys/class/devfreq/.../central_polling is 0), this value
|
(/sys/class/devfreq/.../central_polling is 0), this value
|
||||||
may be useless.
|
may be useless.
|
||||||
|
|
||||||
|
What: /sys/class/devfreq/.../trans_stat
|
||||||
|
Date: October 2012
|
||||||
|
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
||||||
|
Descrtiption:
|
||||||
|
This ABI shows the statistics of devfreq behavior on a
|
||||||
|
specific device. It shows the time spent in each state and
|
||||||
|
the number of transitions between states.
|
||||||
|
In order to activate this ABI, the devfreq target device
|
||||||
|
driver should provide the list of available frequencies
|
||||||
|
with its profile.
|
||||||
|
|
||||||
What: /sys/class/devfreq/.../userspace/set_freq
|
What: /sys/class/devfreq/.../userspace/set_freq
|
||||||
Date: September 2011
|
Date: September 2011
|
||||||
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
Contact: MyungJoo Ham <myungjoo.ham@samsung.com>
|
||||||
|
@ -50,3 +62,19 @@ Description:
|
||||||
The /sys/class/devfreq/.../userspace/set_freq shows and
|
The /sys/class/devfreq/.../userspace/set_freq shows and
|
||||||
sets the requested frequency for the devfreq object if
|
sets the requested frequency for the devfreq object if
|
||||||
userspace governor is in effect.
|
userspace governor is in effect.
|
||||||
|
|
||||||
|
What: /sys/class/devfreq/.../available_frequencies
|
||||||
|
Date: October 2012
|
||||||
|
Contact: Nishanth Menon <nm@ti.com>
|
||||||
|
Description:
|
||||||
|
The /sys/class/devfreq/.../available_frequencies shows
|
||||||
|
the available frequencies of the corresponding devfreq object.
|
||||||
|
This is a snapshot of available frequencies and not limited
|
||||||
|
by the min/max frequency restrictions.
|
||||||
|
|
||||||
|
What: /sys/class/devfreq/.../available_governors
|
||||||
|
Date: October 2012
|
||||||
|
Contact: Nishanth Menon <nm@ti.com>
|
||||||
|
Description:
|
||||||
|
The /sys/class/devfreq/.../available_governors shows
|
||||||
|
currently available governors in the system.
|
||||||
|
|
|
@ -204,3 +204,34 @@ Description:
|
||||||
|
|
||||||
This attribute has no effect on system-wide suspend/resume and
|
This attribute has no effect on system-wide suspend/resume and
|
||||||
hibernation.
|
hibernation.
|
||||||
|
|
||||||
|
What: /sys/devices/.../power/pm_qos_no_power_off
|
||||||
|
Date: September 2012
|
||||||
|
Contact: Rafael J. Wysocki <rjw@sisk.pl>
|
||||||
|
Description:
|
||||||
|
The /sys/devices/.../power/pm_qos_no_power_off attribute
|
||||||
|
is used for manipulating the PM QoS "no power off" flag. If
|
||||||
|
set, this flag indicates to the kernel that power should not
|
||||||
|
be removed entirely from the device.
|
||||||
|
|
||||||
|
Not all drivers support this attribute. If it isn't supported,
|
||||||
|
it is not present.
|
||||||
|
|
||||||
|
This attribute has no effect on system-wide suspend/resume and
|
||||||
|
hibernation.
|
||||||
|
|
||||||
|
What: /sys/devices/.../power/pm_qos_remote_wakeup
|
||||||
|
Date: September 2012
|
||||||
|
Contact: Rafael J. Wysocki <rjw@sisk.pl>
|
||||||
|
Description:
|
||||||
|
The /sys/devices/.../power/pm_qos_remote_wakeup attribute
|
||||||
|
is used for manipulating the PM QoS "remote wakeup required"
|
||||||
|
flag. If set, this flag indicates to the kernel that the
|
||||||
|
device is a source of user events that have to be signaled from
|
||||||
|
its low-power states.
|
||||||
|
|
||||||
|
Not all drivers support this attribute. If it isn't supported,
|
||||||
|
it is not present.
|
||||||
|
|
||||||
|
This attribute has no effect on system-wide suspend/resume and
|
||||||
|
hibernation.
|
||||||
|
|
14
Documentation/ABI/testing/sysfs-devices-sun
Normal file
14
Documentation/ABI/testing/sysfs-devices-sun
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
Whatt: /sys/devices/.../sun
|
||||||
|
Date: October 2012
|
||||||
|
Contact: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
|
||||||
|
Description:
|
||||||
|
The file contains a Slot-unique ID which provided by the _SUN
|
||||||
|
method in the ACPI namespace. The value is written in Advanced
|
||||||
|
Configuration and Power Interface Specification as follows:
|
||||||
|
|
||||||
|
"The _SUN value is required to be unique among the slots of
|
||||||
|
the same type. It is also recommended that this number match
|
||||||
|
the slot number printed on the physical slot whenever possible."
|
||||||
|
|
||||||
|
So reading the sysfs file, we can identify a physical position
|
||||||
|
of the slot in the system.
|
227
Documentation/acpi/enumeration.txt
Normal file
227
Documentation/acpi/enumeration.txt
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
ACPI based device enumeration
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
ACPI 5 introduced a set of new resources (UartTSerialBus, I2cSerialBus,
|
||||||
|
SpiSerialBus, GpioIo and GpioInt) which can be used in enumerating slave
|
||||||
|
devices behind serial bus controllers.
|
||||||
|
|
||||||
|
In addition we are starting to see peripherals integrated in the
|
||||||
|
SoC/Chipset to appear only in ACPI namespace. These are typically devices
|
||||||
|
that are accessed through memory-mapped registers.
|
||||||
|
|
||||||
|
In order to support this and re-use the existing drivers as much as
|
||||||
|
possible we decided to do following:
|
||||||
|
|
||||||
|
o Devices that have no bus connector resource are represented as
|
||||||
|
platform devices.
|
||||||
|
|
||||||
|
o Devices behind real busses where there is a connector resource
|
||||||
|
are represented as struct spi_device or struct i2c_device
|
||||||
|
(standard UARTs are not busses so there is no struct uart_device).
|
||||||
|
|
||||||
|
As both ACPI and Device Tree represent a tree of devices (and their
|
||||||
|
resources) this implementation follows the Device Tree way as much as
|
||||||
|
possible.
|
||||||
|
|
||||||
|
The ACPI implementation enumerates devices behind busses (platform, SPI and
|
||||||
|
I2C), creates the physical devices and binds them to their ACPI handle in
|
||||||
|
the ACPI namespace.
|
||||||
|
|
||||||
|
This means that when ACPI_HANDLE(dev) returns non-NULL the device was
|
||||||
|
enumerated from ACPI namespace. This handle can be used to extract other
|
||||||
|
device-specific configuration. There is an example of this below.
|
||||||
|
|
||||||
|
Platform bus support
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Since we are using platform devices to represent devices that are not
|
||||||
|
connected to any physical bus we only need to implement a platform driver
|
||||||
|
for the device and add supported ACPI IDs. If this same IP-block is used on
|
||||||
|
some other non-ACPI platform, the driver might work out of the box or needs
|
||||||
|
some minor changes.
|
||||||
|
|
||||||
|
Adding ACPI support for an existing driver should be pretty
|
||||||
|
straightforward. Here is the simplest example:
|
||||||
|
|
||||||
|
#ifdef CONFIG_ACPI
|
||||||
|
static struct acpi_device_id mydrv_acpi_match[] = {
|
||||||
|
/* ACPI IDs here */
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(acpi, mydrv_acpi_match);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct platform_driver my_driver = {
|
||||||
|
...
|
||||||
|
.driver = {
|
||||||
|
.acpi_match_table = ACPI_PTR(mydrv_acpi_match),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
If the driver needs to perform more complex initialization like getting and
|
||||||
|
configuring GPIOs it can get its ACPI handle and extract this information
|
||||||
|
from ACPI tables.
|
||||||
|
|
||||||
|
Currently the kernel is not able to automatically determine from which ACPI
|
||||||
|
device it should make the corresponding platform device so we need to add
|
||||||
|
the ACPI device explicitly to acpi_platform_device_ids list defined in
|
||||||
|
drivers/acpi/scan.c. This limitation is only for the platform devices, SPI
|
||||||
|
and I2C devices are created automatically as described below.
|
||||||
|
|
||||||
|
SPI serial bus support
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Slave devices behind SPI bus have SpiSerialBus resource attached to them.
|
||||||
|
This is extracted automatically by the SPI core and the slave devices are
|
||||||
|
enumerated once spi_register_master() is called by the bus driver.
|
||||||
|
|
||||||
|
Here is what the ACPI namespace for a SPI slave might look like:
|
||||||
|
|
||||||
|
Device (EEP0)
|
||||||
|
{
|
||||||
|
Name (_ADR, 1)
|
||||||
|
Name (_CID, Package() {
|
||||||
|
"ATML0025",
|
||||||
|
"AT25",
|
||||||
|
})
|
||||||
|
...
|
||||||
|
Method (_CRS, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
SPISerialBus(1, PolarityLow, FourWireMode, 8,
|
||||||
|
ControllerInitiated, 1000000, ClockPolarityLow,
|
||||||
|
ClockPhaseFirst, "\\_SB.PCI0.SPI1",)
|
||||||
|
}
|
||||||
|
...
|
||||||
|
|
||||||
|
The SPI device drivers only need to add ACPI IDs in a similar way than with
|
||||||
|
the platform device drivers. Below is an example where we add ACPI support
|
||||||
|
to at25 SPI eeprom driver (this is meant for the above ACPI snippet):
|
||||||
|
|
||||||
|
#ifdef CONFIG_ACPI
|
||||||
|
static struct acpi_device_id at25_acpi_match[] = {
|
||||||
|
{ "AT25", 0 },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(acpi, at25_acpi_match);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct spi_driver at25_driver = {
|
||||||
|
.driver = {
|
||||||
|
...
|
||||||
|
.acpi_match_table = ACPI_PTR(at25_acpi_match),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
Note that this driver actually needs more information like page size of the
|
||||||
|
eeprom etc. but at the time writing this there is no standard way of
|
||||||
|
passing those. One idea is to return this in _DSM method like:
|
||||||
|
|
||||||
|
Device (EEP0)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
Method (_DSM, 4, NotSerialized)
|
||||||
|
{
|
||||||
|
Store (Package (6)
|
||||||
|
{
|
||||||
|
"byte-len", 1024,
|
||||||
|
"addr-mode", 2,
|
||||||
|
"page-size, 32
|
||||||
|
}, Local0)
|
||||||
|
|
||||||
|
// Check UUIDs etc.
|
||||||
|
|
||||||
|
Return (Local0)
|
||||||
|
}
|
||||||
|
|
||||||
|
Then the at25 SPI driver can get this configation by calling _DSM on its
|
||||||
|
ACPI handle like:
|
||||||
|
|
||||||
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
|
struct acpi_object_list input;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
/* Fill in the input buffer */
|
||||||
|
|
||||||
|
status = acpi_evaluate_object(ACPI_HANDLE(&spi->dev), "_DSM",
|
||||||
|
&input, &output);
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
/* Handle the error */
|
||||||
|
|
||||||
|
/* Extract the data here */
|
||||||
|
|
||||||
|
kfree(output.pointer);
|
||||||
|
|
||||||
|
I2C serial bus support
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
The slaves behind I2C bus controller only need to add the ACPI IDs like
|
||||||
|
with the platform and SPI drivers. However the I2C bus controller driver
|
||||||
|
needs to call acpi_i2c_register_devices() after it has added the adapter.
|
||||||
|
|
||||||
|
An I2C bus (controller) driver does:
|
||||||
|
|
||||||
|
...
|
||||||
|
ret = i2c_add_numbered_adapter(adapter);
|
||||||
|
if (ret)
|
||||||
|
/* handle error */
|
||||||
|
|
||||||
|
of_i2c_register_devices(adapter);
|
||||||
|
/* Enumerate the slave devices behind this bus via ACPI */
|
||||||
|
acpi_i2c_register_devices(adapter);
|
||||||
|
|
||||||
|
Below is an example of how to add ACPI support to the existing mpu3050
|
||||||
|
input driver:
|
||||||
|
|
||||||
|
#ifdef CONFIG_ACPI
|
||||||
|
static struct acpi_device_id mpu3050_acpi_match[] = {
|
||||||
|
{ "MPU3050", 0 },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(acpi, mpu3050_acpi_match);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct i2c_driver mpu3050_i2c_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "mpu3050",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.pm = &mpu3050_pm,
|
||||||
|
.of_match_table = mpu3050_of_match,
|
||||||
|
.acpi_match_table ACPI_PTR(mpu3050_acpi_match),
|
||||||
|
},
|
||||||
|
.probe = mpu3050_probe,
|
||||||
|
.remove = __devexit_p(mpu3050_remove),
|
||||||
|
.id_table = mpu3050_ids,
|
||||||
|
};
|
||||||
|
|
||||||
|
GPIO support
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
ACPI 5 introduced two new resources to describe GPIO connections: GpioIo
|
||||||
|
and GpioInt. These resources are used be used to pass GPIO numbers used by
|
||||||
|
the device to the driver. For example:
|
||||||
|
|
||||||
|
Method (_CRS, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
Name (SBUF, ResourceTemplate()
|
||||||
|
{
|
||||||
|
GpioIo (Exclusive, PullDefault, 0x0000, 0x0000,
|
||||||
|
IoRestrictionOutputOnly, "\\_SB.PCI0.GPI0",
|
||||||
|
0x00, ResourceConsumer,,)
|
||||||
|
{
|
||||||
|
// Pin List
|
||||||
|
0x0055
|
||||||
|
}
|
||||||
|
...
|
||||||
|
|
||||||
|
Return (SBUF)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0"
|
||||||
|
specifies the path to the controller. In order to use these GPIOs in Linux
|
||||||
|
we need to translate them to the Linux GPIO numbers.
|
||||||
|
|
||||||
|
The driver can do this by including <linux/acpi_gpio.h> and then calling
|
||||||
|
acpi_get_gpio(path, gpio). This will return the Linux GPIO number or
|
||||||
|
negative errno if there was no translation found.
|
||||||
|
|
||||||
|
Other GpioIo parameters must be converted first by the driver to be
|
||||||
|
suitable to the gpiolib before passing them.
|
||||||
|
|
||||||
|
In case of GpioInt resource an additional call to gpio_to_irq() must be
|
||||||
|
done before calling request_irq().
|
42
Documentation/devicetree/bindings/cpufreq/cpufreq-spear.txt
Normal file
42
Documentation/devicetree/bindings/cpufreq/cpufreq-spear.txt
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
SPEAr cpufreq driver
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
SPEAr SoC cpufreq driver for CPU frequency scaling.
|
||||||
|
It supports both uniprocessor (UP) and symmetric multiprocessor (SMP) systems
|
||||||
|
which share clock across all CPUs.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- cpufreq_tbl: Table of frequencies CPU could be transitioned into, in the
|
||||||
|
increasing order.
|
||||||
|
|
||||||
|
Optional properties:
|
||||||
|
- clock-latency: Specify the possible maximum transition latency for clock, in
|
||||||
|
unit of nanoseconds.
|
||||||
|
|
||||||
|
Both required and optional properties listed above must be defined under node
|
||||||
|
/cpus/cpu@0.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
--------
|
||||||
|
cpus {
|
||||||
|
|
||||||
|
<...>
|
||||||
|
|
||||||
|
cpu@0 {
|
||||||
|
compatible = "arm,cortex-a9";
|
||||||
|
reg = <0>;
|
||||||
|
|
||||||
|
<...>
|
||||||
|
|
||||||
|
cpufreq_tbl = < 166000
|
||||||
|
200000
|
||||||
|
250000
|
||||||
|
300000
|
||||||
|
400000
|
||||||
|
500000
|
||||||
|
600000 >;
|
||||||
|
};
|
||||||
|
|
||||||
|
<...>
|
||||||
|
|
||||||
|
};
|
|
@ -99,7 +99,7 @@ reading the aggregated value does not require any locking mechanism.
|
||||||
|
|
||||||
From kernel mode the use of this interface is the following:
|
From kernel mode the use of this interface is the following:
|
||||||
|
|
||||||
int dev_pm_qos_add_request(device, handle, value):
|
int dev_pm_qos_add_request(device, handle, type, value):
|
||||||
Will insert an element into the list for that identified device with the
|
Will insert an element into the list for that identified device with the
|
||||||
target value. Upon change to this list the new target is recomputed and any
|
target value. Upon change to this list the new target is recomputed and any
|
||||||
registered notifiers are called only if the target value is now different.
|
registered notifiers are called only if the target value is now different.
|
||||||
|
|
|
@ -908,6 +908,7 @@ config ARCH_NOMADIK
|
||||||
|
|
||||||
config PLAT_SPEAR
|
config PLAT_SPEAR
|
||||||
bool "ST SPEAr"
|
bool "ST SPEAr"
|
||||||
|
select ARCH_HAS_CPUFREQ
|
||||||
select ARCH_REQUIRE_GPIOLIB
|
select ARCH_REQUIRE_GPIOLIB
|
||||||
select ARM_AMBA
|
select ARM_AMBA
|
||||||
select CLKDEV_LOOKUP
|
select CLKDEV_LOOKUP
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
#define _ASM_IA64_DEVICE_H
|
#define _ASM_IA64_DEVICE_H
|
||||||
|
|
||||||
struct dev_archdata {
|
struct dev_archdata {
|
||||||
#ifdef CONFIG_ACPI
|
|
||||||
void *acpi_handle;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_INTEL_IOMMU
|
#ifdef CONFIG_INTEL_IOMMU
|
||||||
void *iommu; /* hook for IOMMU specific extension */
|
void *iommu; /* hook for IOMMU specific extension */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -633,6 +633,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
|
||||||
ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
|
ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
|
||||||
IOSAPIC_LEVEL);
|
IOSAPIC_LEVEL);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpi_register_gsi);
|
||||||
|
|
||||||
void acpi_unregister_gsi(u32 gsi)
|
void acpi_unregister_gsi(u32 gsi)
|
||||||
{
|
{
|
||||||
|
@ -644,6 +645,7 @@ void acpi_unregister_gsi(u32 gsi)
|
||||||
|
|
||||||
iosapic_unregister_intr(gsi);
|
iosapic_unregister_intr(gsi);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
|
||||||
|
|
||||||
static int __init acpi_parse_fadt(struct acpi_table_header *table)
|
static int __init acpi_parse_fadt(struct acpi_table_header *table)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ static struct cpuidle_state *cpuidle_state_table;
|
||||||
static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
|
static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
|
||||||
{
|
{
|
||||||
|
|
||||||
*kt_before = ktime_get_real();
|
*kt_before = ktime_get();
|
||||||
*in_purr = mfspr(SPRN_PURR);
|
*in_purr = mfspr(SPRN_PURR);
|
||||||
/*
|
/*
|
||||||
* Indicate to the HV that we are idle. Now would be
|
* Indicate to the HV that we are idle. Now would be
|
||||||
|
@ -50,7 +50,7 @@ static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before)
|
||||||
get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
|
get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
|
||||||
get_lppaca()->idle = 0;
|
get_lppaca()->idle = 0;
|
||||||
|
|
||||||
return ktime_to_us(ktime_sub(ktime_get_real(), kt_before));
|
return ktime_to_us(ktime_sub(ktime_get(), kt_before));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snooze_loop(struct cpuidle_device *dev,
|
static int snooze_loop(struct cpuidle_device *dev,
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
#define _ASM_X86_DEVICE_H
|
#define _ASM_X86_DEVICE_H
|
||||||
|
|
||||||
struct dev_archdata {
|
struct dev_archdata {
|
||||||
#ifdef CONFIG_ACPI
|
|
||||||
void *acpi_handle;
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_X86_DEV_DMA_OPS
|
#ifdef CONFIG_X86_DEV_DMA_OPS
|
||||||
struct dma_map_ops *dma_ops;
|
struct dma_map_ops *dma_ops;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -574,6 +574,12 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
|
||||||
|
|
||||||
return irq;
|
return irq;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpi_register_gsi);
|
||||||
|
|
||||||
|
void acpi_unregister_gsi(u32 gsi)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
|
||||||
|
|
||||||
void __init acpi_set_irq_model_pic(void)
|
void __init acpi_set_irq_model_pic(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,6 +101,8 @@ static int __init acpi_sleep_setup(char *str)
|
||||||
#endif
|
#endif
|
||||||
if (strncmp(str, "nonvs", 5) == 0)
|
if (strncmp(str, "nonvs", 5) == 0)
|
||||||
acpi_nvs_nosave();
|
acpi_nvs_nosave();
|
||||||
|
if (strncmp(str, "nonvs_s3", 8) == 0)
|
||||||
|
acpi_nvs_nosave_s3();
|
||||||
if (strncmp(str, "old_ordering", 12) == 0)
|
if (strncmp(str, "old_ordering", 12) == 0)
|
||||||
acpi_old_suspend_ordering();
|
acpi_old_suspend_ordering();
|
||||||
str = strchr(str, ',');
|
str = strchr(str, ',');
|
||||||
|
|
|
@ -181,6 +181,12 @@ config ACPI_DOCK
|
||||||
This driver supports ACPI-controlled docking stations and removable
|
This driver supports ACPI-controlled docking stations and removable
|
||||||
drive bays such as the IBM Ultrabay and the Dell Module Bay.
|
drive bays such as the IBM Ultrabay and the Dell Module Bay.
|
||||||
|
|
||||||
|
config ACPI_I2C
|
||||||
|
def_tristate I2C
|
||||||
|
depends on I2C
|
||||||
|
help
|
||||||
|
ACPI I2C enumeration support.
|
||||||
|
|
||||||
config ACPI_PROCESSOR
|
config ACPI_PROCESSOR
|
||||||
tristate "Processor"
|
tristate "Processor"
|
||||||
select THERMAL
|
select THERMAL
|
||||||
|
|
|
@ -21,9 +21,10 @@ obj-y += acpi.o \
|
||||||
acpi-y += osl.o utils.o reboot.o
|
acpi-y += osl.o utils.o reboot.o
|
||||||
acpi-y += nvs.o
|
acpi-y += nvs.o
|
||||||
|
|
||||||
# sleep related files
|
# Power management related files
|
||||||
acpi-y += wakeup.o
|
acpi-y += wakeup.o
|
||||||
acpi-y += sleep.o
|
acpi-y += sleep.o
|
||||||
|
acpi-$(CONFIG_PM) += device_pm.o
|
||||||
acpi-$(CONFIG_ACPI_SLEEP) += proc.o
|
acpi-$(CONFIG_ACPI_SLEEP) += proc.o
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,10 +33,12 @@ acpi-$(CONFIG_ACPI_SLEEP) += proc.o
|
||||||
#
|
#
|
||||||
acpi-y += bus.o glue.o
|
acpi-y += bus.o glue.o
|
||||||
acpi-y += scan.o
|
acpi-y += scan.o
|
||||||
|
acpi-y += resource.o
|
||||||
acpi-y += processor_core.o
|
acpi-y += processor_core.o
|
||||||
acpi-y += ec.o
|
acpi-y += ec.o
|
||||||
acpi-$(CONFIG_ACPI_DOCK) += dock.o
|
acpi-$(CONFIG_ACPI_DOCK) += dock.o
|
||||||
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
|
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
|
||||||
|
acpi-y += acpi_platform.o
|
||||||
acpi-y += power.o
|
acpi-y += power.o
|
||||||
acpi-y += event.o
|
acpi-y += event.o
|
||||||
acpi-y += sysfs.o
|
acpi-y += sysfs.o
|
||||||
|
@ -67,6 +70,7 @@ obj-$(CONFIG_ACPI_HED) += hed.o
|
||||||
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
|
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
|
||||||
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
|
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
|
||||||
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
|
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
|
||||||
|
obj-$(CONFIG_ACPI_I2C) += acpi_i2c.o
|
||||||
|
|
||||||
# processor has its own "processor." module_param namespace
|
# processor has its own "processor." module_param namespace
|
||||||
processor-y := processor_driver.o processor_throttling.o
|
processor-y := processor_driver.o processor_throttling.o
|
||||||
|
|
103
drivers/acpi/acpi_i2c.c
Normal file
103
drivers/acpi/acpi_i2c.c
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* ACPI I2C enumeration support
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, Intel Corporation
|
||||||
|
* Author: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/acpi.h>
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/export.h>
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/ioport.h>
|
||||||
|
|
||||||
|
ACPI_MODULE_NAME("i2c");
|
||||||
|
|
||||||
|
static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
|
||||||
|
{
|
||||||
|
struct i2c_board_info *info = data;
|
||||||
|
|
||||||
|
if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
|
||||||
|
struct acpi_resource_i2c_serialbus *sb;
|
||||||
|
|
||||||
|
sb = &ares->data.i2c_serial_bus;
|
||||||
|
if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) {
|
||||||
|
info->addr = sb->slave_address;
|
||||||
|
if (sb->access_mode == ACPI_I2C_10BIT_MODE)
|
||||||
|
info->flags |= I2C_CLIENT_TEN;
|
||||||
|
}
|
||||||
|
} else if (info->irq < 0) {
|
||||||
|
struct resource r;
|
||||||
|
|
||||||
|
if (acpi_dev_resource_interrupt(ares, 0, &r))
|
||||||
|
info->irq = r.start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tell the ACPI core to skip this resource */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
|
||||||
|
void *data, void **return_value)
|
||||||
|
{
|
||||||
|
struct i2c_adapter *adapter = data;
|
||||||
|
struct list_head resource_list;
|
||||||
|
struct i2c_board_info info;
|
||||||
|
struct acpi_device *adev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (acpi_bus_get_device(handle, &adev))
|
||||||
|
return AE_OK;
|
||||||
|
if (acpi_bus_get_status(adev) || !adev->status.present)
|
||||||
|
return AE_OK;
|
||||||
|
|
||||||
|
memset(&info, 0, sizeof(info));
|
||||||
|
info.acpi_node.handle = handle;
|
||||||
|
info.irq = -1;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&resource_list);
|
||||||
|
ret = acpi_dev_get_resources(adev, &resource_list,
|
||||||
|
acpi_i2c_add_resource, &info);
|
||||||
|
acpi_dev_free_resource_list(&resource_list);
|
||||||
|
|
||||||
|
if (ret < 0 || !info.addr)
|
||||||
|
return AE_OK;
|
||||||
|
|
||||||
|
strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type));
|
||||||
|
if (!i2c_new_device(adapter, &info)) {
|
||||||
|
dev_err(&adapter->dev,
|
||||||
|
"failed to add I2C device %s from ACPI\n",
|
||||||
|
dev_name(&adev->dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
return AE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acpi_i2c_register_devices - enumerate I2C slave devices behind adapter
|
||||||
|
* @adapter: pointer to adapter
|
||||||
|
*
|
||||||
|
* Enumerate all I2C slave devices behind this adapter by walking the ACPI
|
||||||
|
* namespace. When a device is found it will be added to the Linux device
|
||||||
|
* model and bound to the corresponding ACPI handle.
|
||||||
|
*/
|
||||||
|
void acpi_i2c_register_devices(struct i2c_adapter *adapter)
|
||||||
|
{
|
||||||
|
acpi_handle handle;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
handle = ACPI_HANDLE(&adapter->dev);
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
|
||||||
|
acpi_i2c_add_device, NULL,
|
||||||
|
adapter, NULL);
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
dev_warn(&adapter->dev, "failed to enumerate I2C slaves\n");
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(acpi_i2c_register_devices);
|
|
@ -31,6 +31,7 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/memory_hotplug.h>
|
#include <linux/memory_hotplug.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/acpi.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
#define ACPI_MEMORY_DEVICE_CLASS "memory"
|
#define ACPI_MEMORY_DEVICE_CLASS "memory"
|
||||||
|
@ -78,6 +79,7 @@ struct acpi_memory_info {
|
||||||
unsigned short caching; /* memory cache attribute */
|
unsigned short caching; /* memory cache attribute */
|
||||||
unsigned short write_protect; /* memory read/write attribute */
|
unsigned short write_protect; /* memory read/write attribute */
|
||||||
unsigned int enabled:1;
|
unsigned int enabled:1;
|
||||||
|
unsigned int failed:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_memory_device {
|
struct acpi_memory_device {
|
||||||
|
@ -86,8 +88,6 @@ struct acpi_memory_device {
|
||||||
struct list_head res_list;
|
struct list_head res_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int acpi_hotmem_initialized;
|
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_memory_get_resource(struct acpi_resource *resource, void *context)
|
acpi_memory_get_resource(struct acpi_resource *resource, void *context)
|
||||||
{
|
{
|
||||||
|
@ -125,12 +125,20 @@ acpi_memory_get_resource(struct acpi_resource *resource, void *context)
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
acpi_memory_free_device_resources(struct acpi_memory_device *mem_device)
|
||||||
|
{
|
||||||
|
struct acpi_memory_info *info, *n;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(info, n, &mem_device->res_list, list)
|
||||||
|
kfree(info);
|
||||||
|
INIT_LIST_HEAD(&mem_device->res_list);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_memory_info *info, *n;
|
|
||||||
|
|
||||||
|
|
||||||
if (!list_empty(&mem_device->res_list))
|
if (!list_empty(&mem_device->res_list))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -138,9 +146,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||||
status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
|
status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
|
||||||
acpi_memory_get_resource, mem_device);
|
acpi_memory_get_resource, mem_device);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
list_for_each_entry_safe(info, n, &mem_device->res_list, list)
|
acpi_memory_free_device_resources(mem_device);
|
||||||
kfree(info);
|
|
||||||
INIT_LIST_HEAD(&mem_device->res_list);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +176,7 @@ acpi_memory_get_device(acpi_handle handle,
|
||||||
/* Get the parent device */
|
/* Get the parent device */
|
||||||
result = acpi_bus_get_device(phandle, &pdevice);
|
result = acpi_bus_get_device(phandle, &pdevice);
|
||||||
if (result) {
|
if (result) {
|
||||||
printk(KERN_WARNING PREFIX "Cannot get acpi bus device");
|
acpi_handle_warn(phandle, "Cannot get acpi bus device\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,14 +186,14 @@ acpi_memory_get_device(acpi_handle handle,
|
||||||
*/
|
*/
|
||||||
result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
|
result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
|
||||||
if (result) {
|
if (result) {
|
||||||
printk(KERN_WARNING PREFIX "Cannot add acpi bus");
|
acpi_handle_warn(handle, "Cannot add acpi bus\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
*mem_device = acpi_driver_data(device);
|
*mem_device = acpi_driver_data(device);
|
||||||
if (!(*mem_device)) {
|
if (!(*mem_device)) {
|
||||||
printk(KERN_ERR "\n driver data not found");
|
dev_err(&device->dev, "driver data not found\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +230,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||||
/* Get the range from the _CRS */
|
/* Get the range from the _CRS */
|
||||||
result = acpi_memory_get_device_resources(mem_device);
|
result = acpi_memory_get_device_resources(mem_device);
|
||||||
if (result) {
|
if (result) {
|
||||||
printk(KERN_ERR PREFIX "get_device_resources failed\n");
|
dev_err(&mem_device->device->dev,
|
||||||
|
"get_device_resources failed\n");
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
mem_device->state = MEMORY_INVALID_STATE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -251,13 +258,27 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||||
node = memory_add_physaddr_to_nid(info->start_addr);
|
node = memory_add_physaddr_to_nid(info->start_addr);
|
||||||
|
|
||||||
result = add_memory(node, info->start_addr, info->length);
|
result = add_memory(node, info->start_addr, info->length);
|
||||||
if (result)
|
|
||||||
|
/*
|
||||||
|
* If the memory block has been used by the kernel, add_memory()
|
||||||
|
* returns -EEXIST. If add_memory() returns the other error, it
|
||||||
|
* means that this memory block is not used by the kernel.
|
||||||
|
*/
|
||||||
|
if (result && result != -EEXIST) {
|
||||||
|
info->failed = 1;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result)
|
||||||
info->enabled = 1;
|
info->enabled = 1;
|
||||||
|
/*
|
||||||
|
* Add num_enable even if add_memory() returns -EEXIST, so the
|
||||||
|
* device is bound to this driver.
|
||||||
|
*/
|
||||||
num_enabled++;
|
num_enabled++;
|
||||||
}
|
}
|
||||||
if (!num_enabled) {
|
if (!num_enabled) {
|
||||||
printk(KERN_ERR PREFIX "add_memory failed\n");
|
dev_err(&mem_device->device->dev, "add_memory failed\n");
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
mem_device->state = MEMORY_INVALID_STATE;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -272,68 +293,31 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
int result = 0;
|
||||||
struct acpi_object_list arg_list;
|
|
||||||
union acpi_object arg;
|
|
||||||
unsigned long long current_status;
|
|
||||||
|
|
||||||
|
|
||||||
/* Issue the _EJ0 command */
|
|
||||||
arg_list.count = 1;
|
|
||||||
arg_list.pointer = &arg;
|
|
||||||
arg.type = ACPI_TYPE_INTEGER;
|
|
||||||
arg.integer.value = 1;
|
|
||||||
status = acpi_evaluate_object(mem_device->device->handle,
|
|
||||||
"_EJ0", &arg_list, NULL);
|
|
||||||
/* Return on _EJ0 failure */
|
|
||||||
if (ACPI_FAILURE(status)) {
|
|
||||||
ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed"));
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Evalute _STA to check if the device is disabled */
|
|
||||||
status = acpi_evaluate_integer(mem_device->device->handle, "_STA",
|
|
||||||
NULL, ¤t_status);
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* Check for device status. Device should be disabled */
|
|
||||||
if (current_status & ACPI_STA_DEVICE_ENABLED)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
struct acpi_memory_info *info, *n;
|
struct acpi_memory_info *info, *n;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ask the VM to offline this memory range.
|
|
||||||
* Note: Assume that this function returns zero on success
|
|
||||||
*/
|
|
||||||
list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
|
list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
|
||||||
if (info->enabled) {
|
if (info->failed)
|
||||||
|
/* The kernel does not use this memory block */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!info->enabled)
|
||||||
|
/*
|
||||||
|
* The kernel uses this memory block, but it may be not
|
||||||
|
* managed by us.
|
||||||
|
*/
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
result = remove_memory(info->start_addr, info->length);
|
result = remove_memory(info->start_addr, info->length);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
|
list_del(&info->list);
|
||||||
kfree(info);
|
kfree(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Power-off and eject the device */
|
|
||||||
result = acpi_memory_powerdown_device(mem_device);
|
|
||||||
if (result) {
|
|
||||||
/* Set the status of the device to invalid */
|
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
mem_device->state = MEMORY_POWER_OFF_STATE;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,6 +325,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
{
|
{
|
||||||
struct acpi_memory_device *mem_device;
|
struct acpi_memory_device *mem_device;
|
||||||
struct acpi_device *device;
|
struct acpi_device *device;
|
||||||
|
struct acpi_eject_event *ej_event = NULL;
|
||||||
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
|
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
@ -353,7 +338,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"\nReceived DEVICE CHECK notification for device\n"));
|
"\nReceived DEVICE CHECK notification for device\n"));
|
||||||
if (acpi_memory_get_device(handle, &mem_device)) {
|
if (acpi_memory_get_device(handle, &mem_device)) {
|
||||||
printk(KERN_ERR PREFIX "Cannot find driver data\n");
|
acpi_handle_err(handle, "Cannot find driver data\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +346,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (acpi_memory_enable_device(mem_device)) {
|
if (acpi_memory_enable_device(mem_device)) {
|
||||||
printk(KERN_ERR PREFIX "Cannot enable memory device\n");
|
acpi_handle_err(handle,"Cannot enable memory device\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,40 +358,28 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
"\nReceived EJECT REQUEST notification for device\n"));
|
"\nReceived EJECT REQUEST notification for device\n"));
|
||||||
|
|
||||||
if (acpi_bus_get_device(handle, &device)) {
|
if (acpi_bus_get_device(handle, &device)) {
|
||||||
printk(KERN_ERR PREFIX "Device doesn't exist\n");
|
acpi_handle_err(handle, "Device doesn't exist\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mem_device = acpi_driver_data(device);
|
mem_device = acpi_driver_data(device);
|
||||||
if (!mem_device) {
|
if (!mem_device) {
|
||||||
printk(KERN_ERR PREFIX "Driver Data is NULL\n");
|
acpi_handle_err(handle, "Driver Data is NULL\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
|
||||||
* Currently disabling memory device from kernel mode
|
if (!ej_event) {
|
||||||
* TBD: Can also be disabled from user mode scripts
|
pr_err(PREFIX "No memory, dropping EJECT\n");
|
||||||
* TBD: Can also be disabled by Callback registration
|
|
||||||
* with generic sysfs driver
|
|
||||||
*/
|
|
||||||
if (acpi_memory_disable_device(mem_device)) {
|
|
||||||
printk(KERN_ERR PREFIX "Disable memory device\n");
|
|
||||||
/*
|
|
||||||
* If _EJ0 was called but failed, _OST is not
|
|
||||||
* necessary.
|
|
||||||
*/
|
|
||||||
if (mem_device->state == MEMORY_INVALID_STATE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
ej_event->handle = handle;
|
||||||
* TBD: Invoke acpi_bus_remove to cleanup data structures
|
ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
|
||||||
*/
|
acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
|
||||||
|
(void *)ej_event);
|
||||||
|
|
||||||
/* _EJ0 succeeded; _OST is not necessary */
|
/* eject is performed asynchronously */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Unsupported event [0x%x]\n", event));
|
"Unsupported event [0x%x]\n", event));
|
||||||
|
@ -420,6 +393,15 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void acpi_memory_device_free(struct acpi_memory_device *mem_device)
|
||||||
|
{
|
||||||
|
if (!mem_device)
|
||||||
|
return;
|
||||||
|
|
||||||
|
acpi_memory_free_device_resources(mem_device);
|
||||||
|
kfree(mem_device);
|
||||||
|
}
|
||||||
|
|
||||||
static int acpi_memory_device_add(struct acpi_device *device)
|
static int acpi_memory_device_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -449,23 +431,16 @@ static int acpi_memory_device_add(struct acpi_device *device)
|
||||||
/* Set the device state */
|
/* Set the device state */
|
||||||
mem_device->state = MEMORY_POWER_ON_STATE;
|
mem_device->state = MEMORY_POWER_ON_STATE;
|
||||||
|
|
||||||
printk(KERN_DEBUG "%s \n", acpi_device_name(device));
|
pr_debug("%s\n", acpi_device_name(device));
|
||||||
|
|
||||||
/*
|
|
||||||
* Early boot code has recognized memory area by EFI/E820.
|
|
||||||
* If DSDT shows these memory devices on boot, hotplug is not necessary
|
|
||||||
* for them. So, it just returns until completion of this driver's
|
|
||||||
* start up.
|
|
||||||
*/
|
|
||||||
if (!acpi_hotmem_initialized)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!acpi_memory_check_device(mem_device)) {
|
if (!acpi_memory_check_device(mem_device)) {
|
||||||
/* call add_memory func */
|
/* call add_memory func */
|
||||||
result = acpi_memory_enable_device(mem_device);
|
result = acpi_memory_enable_device(mem_device);
|
||||||
if (result)
|
if (result) {
|
||||||
printk(KERN_ERR PREFIX
|
dev_err(&device->dev,
|
||||||
"Error in acpi_memory_enable_device\n");
|
"Error in acpi_memory_enable_device\n");
|
||||||
|
acpi_memory_device_free(mem_device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -473,13 +448,18 @@ static int acpi_memory_device_add(struct acpi_device *device)
|
||||||
static int acpi_memory_device_remove(struct acpi_device *device, int type)
|
static int acpi_memory_device_remove(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
struct acpi_memory_device *mem_device = NULL;
|
struct acpi_memory_device *mem_device = NULL;
|
||||||
|
int result;
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
mem_device = acpi_driver_data(device);
|
mem_device = acpi_driver_data(device);
|
||||||
kfree(mem_device);
|
|
||||||
|
result = acpi_memory_remove_memory(mem_device);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
acpi_memory_device_free(mem_device);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -568,7 +548,6 @@ static int __init acpi_memory_device_init(void)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_hotmem_initialized = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ static ssize_t acpi_pad_rrtime_store(struct device *dev,
|
||||||
struct device_attribute *attr, const char *buf, size_t count)
|
struct device_attribute *attr, const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
if (strict_strtoul(buf, 0, &num))
|
if (kstrtoul(buf, 0, &num))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (num < 1 || num >= 100)
|
if (num < 1 || num >= 100)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -309,7 +309,7 @@ static ssize_t acpi_pad_idlepct_store(struct device *dev,
|
||||||
struct device_attribute *attr, const char *buf, size_t count)
|
struct device_attribute *attr, const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
if (strict_strtoul(buf, 0, &num))
|
if (kstrtoul(buf, 0, &num))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (num < 1 || num >= 100)
|
if (num < 1 || num >= 100)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -332,7 +332,7 @@ static ssize_t acpi_pad_idlecpus_store(struct device *dev,
|
||||||
struct device_attribute *attr, const char *buf, size_t count)
|
struct device_attribute *attr, const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
if (strict_strtoul(buf, 0, &num))
|
if (kstrtoul(buf, 0, &num))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
mutex_lock(&isolated_cpus_lock);
|
mutex_lock(&isolated_cpus_lock);
|
||||||
acpi_pad_idle_cpus(num);
|
acpi_pad_idle_cpus(num);
|
||||||
|
@ -457,7 +457,7 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
|
||||||
dev_name(&device->dev), event, 0);
|
dev_name(&device->dev), event, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_WARNING "Unsupported event [0x%x]\n", event);
|
pr_warn("Unsupported event [0x%x]\n", event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
104
drivers/acpi/acpi_platform.c
Normal file
104
drivers/acpi/acpi_platform.c
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
* ACPI support for platform bus type.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012, Intel Corporation
|
||||||
|
* Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
|
||||||
|
* Mathias Nyman <mathias.nyman@linux.intel.com>
|
||||||
|
* Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/acpi.h>
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
ACPI_MODULE_NAME("platform");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* acpi_create_platform_device - Create platform device for ACPI device node
|
||||||
|
* @adev: ACPI device node to create a platform device for.
|
||||||
|
*
|
||||||
|
* Check if the given @adev can be represented as a platform device and, if
|
||||||
|
* that's the case, create and register a platform device, populate its common
|
||||||
|
* resources and returns a pointer to it. Otherwise, return %NULL.
|
||||||
|
*
|
||||||
|
* The platform device's name will be taken from the @adev's _HID and _UID.
|
||||||
|
*/
|
||||||
|
struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev = NULL;
|
||||||
|
struct acpi_device *acpi_parent;
|
||||||
|
struct platform_device_info pdevinfo;
|
||||||
|
struct resource_list_entry *rentry;
|
||||||
|
struct list_head resource_list;
|
||||||
|
struct resource *resources;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
/* If the ACPI node already has a physical device attached, skip it. */
|
||||||
|
if (adev->physical_node_count)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&resource_list);
|
||||||
|
count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
|
||||||
|
if (count <= 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL);
|
||||||
|
if (!resources) {
|
||||||
|
dev_err(&adev->dev, "No memory for resources\n");
|
||||||
|
acpi_dev_free_resource_list(&resource_list);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
count = 0;
|
||||||
|
list_for_each_entry(rentry, &resource_list, node)
|
||||||
|
resources[count++] = rentry->res;
|
||||||
|
|
||||||
|
acpi_dev_free_resource_list(&resource_list);
|
||||||
|
|
||||||
|
memset(&pdevinfo, 0, sizeof(pdevinfo));
|
||||||
|
/*
|
||||||
|
* If the ACPI node has a parent and that parent has a physical device
|
||||||
|
* attached to it, that physical device should be the parent of the
|
||||||
|
* platform device we are about to create.
|
||||||
|
*/
|
||||||
|
pdevinfo.parent = NULL;
|
||||||
|
acpi_parent = adev->parent;
|
||||||
|
if (acpi_parent) {
|
||||||
|
struct acpi_device_physical_node *entry;
|
||||||
|
struct list_head *list;
|
||||||
|
|
||||||
|
mutex_lock(&acpi_parent->physical_node_lock);
|
||||||
|
list = &acpi_parent->physical_node_list;
|
||||||
|
if (!list_empty(list)) {
|
||||||
|
entry = list_first_entry(list,
|
||||||
|
struct acpi_device_physical_node,
|
||||||
|
node);
|
||||||
|
pdevinfo.parent = entry->dev;
|
||||||
|
}
|
||||||
|
mutex_unlock(&acpi_parent->physical_node_lock);
|
||||||
|
}
|
||||||
|
pdevinfo.name = dev_name(&adev->dev);
|
||||||
|
pdevinfo.id = -1;
|
||||||
|
pdevinfo.res = resources;
|
||||||
|
pdevinfo.num_res = count;
|
||||||
|
pdevinfo.acpi_node.handle = adev->handle;
|
||||||
|
pdev = platform_device_register_full(&pdevinfo);
|
||||||
|
if (IS_ERR(pdev)) {
|
||||||
|
dev_err(&adev->dev, "platform device creation failed: %ld\n",
|
||||||
|
PTR_ERR(pdev));
|
||||||
|
pdev = NULL;
|
||||||
|
} else {
|
||||||
|
dev_dbg(&adev->dev, "created platform device %s\n",
|
||||||
|
dev_name(&pdev->dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
kfree(resources);
|
||||||
|
return pdev;
|
||||||
|
}
|
|
@ -161,3 +161,6 @@ acpi-y += \
|
||||||
utxfinit.o \
|
utxfinit.o \
|
||||||
utxferror.o \
|
utxferror.o \
|
||||||
utxfmutex.o
|
utxfmutex.o
|
||||||
|
|
||||||
|
acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o
|
||||||
|
|
||||||
|
|
|
@ -44,17 +44,28 @@
|
||||||
#ifndef __ACDEBUG_H__
|
#ifndef __ACDEBUG_H__
|
||||||
#define __ACDEBUG_H__
|
#define __ACDEBUG_H__
|
||||||
|
|
||||||
#define ACPI_DEBUG_BUFFER_SIZE 4196
|
#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
|
||||||
|
|
||||||
struct command_info {
|
struct acpi_db_command_info {
|
||||||
char *name; /* Command Name */
|
char *name; /* Command Name */
|
||||||
u8 min_args; /* Minimum arguments required */
|
u8 min_args; /* Minimum arguments required */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct argument_info {
|
struct acpi_db_command_help {
|
||||||
|
u8 line_count; /* Number of help lines */
|
||||||
|
char *invocation; /* Command Invocation */
|
||||||
|
char *description; /* Command Description */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct acpi_db_argument_info {
|
||||||
char *name; /* Argument Name */
|
char *name; /* Argument Name */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct acpi_db_execute_walk {
|
||||||
|
u32 count;
|
||||||
|
u32 max_count;
|
||||||
|
};
|
||||||
|
|
||||||
#define PARAM_LIST(pl) pl
|
#define PARAM_LIST(pl) pl
|
||||||
#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
|
#define DBTEST_OUTPUT_LEVEL(lvl) if (acpi_gbl_db_opt_verbose)
|
||||||
#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
|
#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
|
||||||
|
@ -77,43 +88,19 @@ acpi_db_single_step(struct acpi_walk_state *walk_state,
|
||||||
/*
|
/*
|
||||||
* dbcmds - debug commands and output routines
|
* dbcmds - debug commands and output routines
|
||||||
*/
|
*/
|
||||||
acpi_status acpi_db_disassemble_method(char *name);
|
struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string);
|
||||||
|
|
||||||
void acpi_db_display_table_info(char *table_arg);
|
void acpi_db_display_table_info(char *table_arg);
|
||||||
|
|
||||||
void acpi_db_unload_acpi_table(char *table_arg, char *instance_arg);
|
void acpi_db_display_template(char *buffer_arg);
|
||||||
|
|
||||||
void
|
void acpi_db_unload_acpi_table(char *name);
|
||||||
acpi_db_set_method_breakpoint(char *location,
|
|
||||||
struct acpi_walk_state *walk_state,
|
|
||||||
union acpi_parse_object *op);
|
|
||||||
|
|
||||||
void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
|
|
||||||
|
|
||||||
void acpi_db_get_bus_info(void);
|
|
||||||
|
|
||||||
void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
|
|
||||||
|
|
||||||
void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
|
|
||||||
|
|
||||||
void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
|
|
||||||
|
|
||||||
void acpi_db_send_notify(char *name, u32 value);
|
void acpi_db_send_notify(char *name, u32 value);
|
||||||
|
|
||||||
void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
|
|
||||||
|
|
||||||
acpi_status
|
|
||||||
acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
|
|
||||||
|
|
||||||
void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
|
void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
|
||||||
|
|
||||||
acpi_status acpi_db_find_name_in_namespace(char *name_arg);
|
acpi_status acpi_db_sleep(char *object_arg);
|
||||||
|
|
||||||
void acpi_db_set_scope(char *name);
|
|
||||||
|
|
||||||
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_db_sleep(char *object_arg))
|
|
||||||
|
|
||||||
void acpi_db_find_references(char *object_arg);
|
|
||||||
|
|
||||||
void acpi_db_display_locks(void);
|
void acpi_db_display_locks(void);
|
||||||
|
|
||||||
|
@ -121,15 +108,51 @@ void acpi_db_display_resources(char *object_arg);
|
||||||
|
|
||||||
ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
|
ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
|
||||||
|
|
||||||
void acpi_db_check_integrity(void);
|
void acpi_db_display_handlers(void);
|
||||||
|
|
||||||
ACPI_HW_DEPENDENT_RETURN_VOID(void
|
ACPI_HW_DEPENDENT_RETURN_VOID(void
|
||||||
acpi_db_generate_gpe(char *gpe_arg,
|
acpi_db_generate_gpe(char *gpe_arg,
|
||||||
char *block_arg))
|
char *block_arg))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dbmethod - control method commands
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
acpi_db_set_method_breakpoint(char *location,
|
||||||
|
struct acpi_walk_state *walk_state,
|
||||||
|
union acpi_parse_object *op);
|
||||||
|
|
||||||
|
void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
|
||||||
|
|
||||||
|
void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
|
||||||
|
|
||||||
|
acpi_status acpi_db_disassemble_method(char *name);
|
||||||
|
|
||||||
|
void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
|
||||||
|
|
||||||
|
void acpi_db_batch_execute(char *count_arg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dbnames - namespace commands
|
||||||
|
*/
|
||||||
|
void acpi_db_set_scope(char *name);
|
||||||
|
|
||||||
|
void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
|
||||||
|
|
||||||
|
void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
|
||||||
|
|
||||||
|
acpi_status acpi_db_find_name_in_namespace(char *name_arg);
|
||||||
|
|
||||||
void acpi_db_check_predefined_names(void);
|
void acpi_db_check_predefined_names(void);
|
||||||
|
|
||||||
void acpi_db_batch_execute(void);
|
acpi_status
|
||||||
|
acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
|
||||||
|
|
||||||
|
void acpi_db_check_integrity(void);
|
||||||
|
|
||||||
|
void acpi_db_find_references(char *object_arg);
|
||||||
|
|
||||||
|
void acpi_db_get_bus_info(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dbdisply - debug display commands
|
* dbdisply - debug display commands
|
||||||
|
@ -161,7 +184,8 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
|
||||||
/*
|
/*
|
||||||
* dbexec - debugger control method execution
|
* dbexec - debugger control method execution
|
||||||
*/
|
*/
|
||||||
void acpi_db_execute(char *name, char **args, u32 flags);
|
void
|
||||||
|
acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags);
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_db_create_execution_threads(char *num_threads_arg,
|
acpi_db_create_execution_threads(char *num_threads_arg,
|
||||||
|
@ -175,7 +199,8 @@ u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
|
||||||
* dbfileio - Debugger file I/O commands
|
* dbfileio - Debugger file I/O commands
|
||||||
*/
|
*/
|
||||||
acpi_object_type
|
acpi_object_type
|
||||||
acpi_db_match_argument(char *user_argument, struct argument_info *arguments);
|
acpi_db_match_argument(char *user_argument,
|
||||||
|
struct acpi_db_argument_info *arguments);
|
||||||
|
|
||||||
void acpi_db_close_debug_file(void);
|
void acpi_db_close_debug_file(void);
|
||||||
|
|
||||||
|
@ -208,6 +233,11 @@ acpi_db_command_dispatch(char *input_buffer,
|
||||||
|
|
||||||
void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
|
void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
|
||||||
|
|
||||||
|
acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op);
|
||||||
|
|
||||||
|
char *acpi_db_get_next_token(char *string,
|
||||||
|
char **next, acpi_object_type * return_type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dbstats - Generation and display of ACPI table statistics
|
* dbstats - Generation and display of ACPI table statistics
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -309,9 +309,12 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
|
acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
|
||||||
|
|
||||||
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
|
struct acpi_walk_state * acpi_ds_create_walk_state(acpi_owner_id owner_id,
|
||||||
*origin, union acpi_operand_object
|
union acpi_parse_object
|
||||||
*mth_desc, struct acpi_thread_state
|
*origin,
|
||||||
|
union acpi_operand_object
|
||||||
|
*mth_desc,
|
||||||
|
struct acpi_thread_state
|
||||||
*thread);
|
*thread);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
|
|
|
@ -84,9 +84,11 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
|
||||||
|
|
||||||
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||||
|
|
||||||
acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
|
acpi_status
|
||||||
|
acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
|
||||||
|
|
||||||
acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
|
acpi_status
|
||||||
|
acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
|
||||||
|
|
||||||
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
||||||
u32 gpe_number);
|
u32 gpe_number);
|
||||||
|
|
|
@ -153,26 +153,6 @@ u8 acpi_gbl_reduced_hardware;
|
||||||
|
|
||||||
ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
|
ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_no_resource_disassembly, FALSE);
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* Debug support
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Procedure nesting level for debug output */
|
|
||||||
|
|
||||||
extern u32 acpi_gbl_nesting_level;
|
|
||||||
|
|
||||||
ACPI_EXTERN u32 acpi_gpe_count;
|
|
||||||
ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
|
|
||||||
|
|
||||||
/* Support for dynamic control method tracing mechanism */
|
|
||||||
|
|
||||||
ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
|
|
||||||
ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
|
|
||||||
ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
|
|
||||||
ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* ACPI Table globals
|
* ACPI Table globals
|
||||||
|
@ -259,15 +239,6 @@ ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE reg
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
|
||||||
|
|
||||||
/* Lists for tracking memory allocations */
|
|
||||||
|
|
||||||
ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
|
|
||||||
ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
|
|
||||||
ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Object caches */
|
/* Object caches */
|
||||||
|
|
||||||
ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
|
ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;
|
||||||
|
@ -326,6 +297,15 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
||||||
|
|
||||||
|
/* Lists for tracking memory allocations */
|
||||||
|
|
||||||
|
ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
|
||||||
|
ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
|
||||||
|
ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Namespace globals
|
* Namespace globals
|
||||||
|
@ -396,11 +376,33 @@ ACPI_EXTERN struct acpi_gpe_block_info
|
||||||
#if (!ACPI_REDUCED_HARDWARE)
|
#if (!ACPI_REDUCED_HARDWARE)
|
||||||
|
|
||||||
ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;
|
ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;
|
||||||
ACPI_EXTERN ACPI_GBL_EVENT_HANDLER acpi_gbl_global_event_handler;
|
ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler;
|
||||||
ACPI_EXTERN void *acpi_gbl_global_event_handler_context;
|
ACPI_EXTERN void *acpi_gbl_global_event_handler_context;
|
||||||
|
|
||||||
#endif /* !ACPI_REDUCED_HARDWARE */
|
#endif /* !ACPI_REDUCED_HARDWARE */
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Debug support
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Procedure nesting level for debug output */
|
||||||
|
|
||||||
|
extern u32 acpi_gbl_nesting_level;
|
||||||
|
|
||||||
|
/* Event counters */
|
||||||
|
|
||||||
|
ACPI_EXTERN u32 acpi_gpe_count;
|
||||||
|
ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
|
||||||
|
|
||||||
|
/* Support for dynamic control method tracing mechanism */
|
||||||
|
|
||||||
|
ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
|
||||||
|
ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
|
||||||
|
ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
|
||||||
|
ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Debugger globals
|
* Debugger globals
|
||||||
|
@ -426,10 +428,11 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
|
||||||
ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
|
ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
|
||||||
|
|
||||||
ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
|
ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
|
||||||
ACPI_EXTERN char acpi_gbl_db_line_buf[80];
|
ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS];
|
||||||
ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];
|
ACPI_EXTERN char acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE];
|
||||||
ACPI_EXTERN char acpi_gbl_db_scope_buf[40];
|
ACPI_EXTERN char acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE];
|
||||||
ACPI_EXTERN char acpi_gbl_db_debug_filename[40];
|
ACPI_EXTERN char acpi_gbl_db_scope_buf[80];
|
||||||
|
ACPI_EXTERN char acpi_gbl_db_debug_filename[80];
|
||||||
ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
|
ACPI_EXTERN u8 acpi_gbl_db_output_to_file;
|
||||||
ACPI_EXTERN char *acpi_gbl_db_buffer;
|
ACPI_EXTERN char *acpi_gbl_db_buffer;
|
||||||
ACPI_EXTERN char *acpi_gbl_db_filename;
|
ACPI_EXTERN char *acpi_gbl_db_filename;
|
||||||
|
|
|
@ -262,7 +262,7 @@ struct acpi_create_field_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
|
acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bitmapped ACPI types. Used internally only
|
* Bitmapped ACPI types. Used internally only
|
||||||
|
@ -486,8 +486,10 @@ struct acpi_gpe_device_info {
|
||||||
struct acpi_namespace_node *gpe_device;
|
struct acpi_namespace_node *gpe_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
|
||||||
struct acpi_gpe_block_info *gpe_block, void *context);
|
gpe_xrupt_info,
|
||||||
|
struct acpi_gpe_block_info *gpe_block,
|
||||||
|
void *context);
|
||||||
|
|
||||||
/* Information about each particular fixed event */
|
/* Information about each particular fixed event */
|
||||||
|
|
||||||
|
@ -645,7 +647,7 @@ union acpi_generic_state {
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);
|
typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state);
|
||||||
|
|
||||||
/* Address Range info block */
|
/* Address Range info block */
|
||||||
|
|
||||||
|
@ -1031,6 +1033,7 @@ struct acpi_db_method_info {
|
||||||
acpi_handle method;
|
acpi_handle method;
|
||||||
acpi_handle main_thread_gate;
|
acpi_handle main_thread_gate;
|
||||||
acpi_handle thread_complete_gate;
|
acpi_handle thread_complete_gate;
|
||||||
|
acpi_handle info_gate;
|
||||||
acpi_thread_id *threads;
|
acpi_thread_id *threads;
|
||||||
u32 num_threads;
|
u32 num_threads;
|
||||||
u32 num_created;
|
u32 num_created;
|
||||||
|
@ -1041,6 +1044,7 @@ struct acpi_db_method_info {
|
||||||
u32 num_loops;
|
u32 num_loops;
|
||||||
char pathname[128];
|
char pathname[128];
|
||||||
char **args;
|
char **args;
|
||||||
|
acpi_object_type *types;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arguments to be passed to method for the command
|
* Arguments to be passed to method for the command
|
||||||
|
|
|
@ -196,18 +196,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Macros based on machine integer width */
|
|
||||||
|
|
||||||
#if ACPI_MACHINE_WIDTH == 32
|
|
||||||
#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
|
|
||||||
|
|
||||||
#elif ACPI_MACHINE_WIDTH == 64
|
|
||||||
#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#error unknown ACPI_MACHINE_WIDTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fast power-of-two math macros for non-optimized compilers
|
* Fast power-of-two math macros for non-optimized compilers
|
||||||
*/
|
*/
|
||||||
|
@ -355,7 +343,6 @@
|
||||||
* Ascii error messages can be configured out
|
* Ascii error messages can be configured out
|
||||||
*/
|
*/
|
||||||
#ifndef ACPI_NO_ERROR_MESSAGES
|
#ifndef ACPI_NO_ERROR_MESSAGES
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error reporting. Callers module and line number are inserted by AE_INFO,
|
* Error reporting. Callers module and line number are inserted by AE_INFO,
|
||||||
* the plist contains a set of parens to allow variable-length lists.
|
* the plist contains a set of parens to allow variable-length lists.
|
||||||
|
@ -381,12 +368,9 @@
|
||||||
* Debug macros that are conditionally compiled
|
* Debug macros that are conditionally compiled
|
||||||
*/
|
*/
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function entry tracing
|
* Function entry tracing
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_ACPI_DEBUG_FUNC_TRACE
|
|
||||||
|
|
||||||
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
|
#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
|
||||||
acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
|
acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
|
||||||
#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
|
#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
|
||||||
|
@ -464,45 +448,19 @@
|
||||||
|
|
||||||
#endif /* ACPI_SIMPLE_RETURN_MACROS */
|
#endif /* ACPI_SIMPLE_RETURN_MACROS */
|
||||||
|
|
||||||
#else /* !CONFIG_ACPI_DEBUG_FUNC_TRACE */
|
|
||||||
|
|
||||||
#define ACPI_FUNCTION_TRACE(a)
|
|
||||||
#define ACPI_FUNCTION_TRACE_PTR(a,b)
|
|
||||||
#define ACPI_FUNCTION_TRACE_U32(a,b)
|
|
||||||
#define ACPI_FUNCTION_TRACE_STR(a,b)
|
|
||||||
#define ACPI_FUNCTION_EXIT
|
|
||||||
#define ACPI_FUNCTION_STATUS_EXIT(s)
|
|
||||||
#define ACPI_FUNCTION_VALUE_EXIT(s)
|
|
||||||
#define ACPI_FUNCTION_TRACE(a)
|
|
||||||
#define ACPI_FUNCTION_ENTRY()
|
|
||||||
|
|
||||||
#define return_VOID return
|
|
||||||
#define return_ACPI_STATUS(s) return(s)
|
|
||||||
#define return_VALUE(s) return(s)
|
|
||||||
#define return_UINT8(s) return(s)
|
|
||||||
#define return_UINT32(s) return(s)
|
|
||||||
#define return_PTR(s) return(s)
|
|
||||||
|
|
||||||
#endif /* CONFIG_ACPI_DEBUG_FUNC_TRACE */
|
|
||||||
|
|
||||||
/* Conditional execution */
|
/* Conditional execution */
|
||||||
|
|
||||||
#define ACPI_DEBUG_EXEC(a) a
|
#define ACPI_DEBUG_EXEC(a) a
|
||||||
#define ACPI_NORMAL_EXEC(a)
|
|
||||||
|
|
||||||
#define ACPI_DEBUG_DEFINE(a) a;
|
|
||||||
#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
|
#define ACPI_DEBUG_ONLY_MEMBERS(a) a;
|
||||||
#define _VERBOSE_STRUCTURES
|
#define _VERBOSE_STRUCTURES
|
||||||
|
|
||||||
/* Stack and buffer dumping */
|
/* Various object display routines for debug */
|
||||||
|
|
||||||
#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
|
#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
|
||||||
#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c)
|
#define ACPI_DUMP_OPERANDS(a, b ,c) acpi_ex_dump_operands(a, b, c)
|
||||||
|
|
||||||
#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
|
#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
|
||||||
#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
|
#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
|
||||||
#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
|
#define ACPI_DUMP_BUFFER(a, b) acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
|
||||||
#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
|
@ -510,25 +468,23 @@
|
||||||
* leaving no executable debug code!
|
* leaving no executable debug code!
|
||||||
*/
|
*/
|
||||||
#define ACPI_DEBUG_EXEC(a)
|
#define ACPI_DEBUG_EXEC(a)
|
||||||
#define ACPI_NORMAL_EXEC(a) a;
|
#define ACPI_DEBUG_ONLY_MEMBERS(a)
|
||||||
|
#define ACPI_FUNCTION_TRACE(a)
|
||||||
#define ACPI_DEBUG_DEFINE(a) do { } while(0)
|
#define ACPI_FUNCTION_TRACE_PTR(a, b)
|
||||||
#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
|
#define ACPI_FUNCTION_TRACE_U32(a, b)
|
||||||
#define ACPI_FUNCTION_TRACE(a) do { } while(0)
|
#define ACPI_FUNCTION_TRACE_STR(a, b)
|
||||||
#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0)
|
#define ACPI_FUNCTION_EXIT
|
||||||
#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0)
|
#define ACPI_FUNCTION_STATUS_EXIT(s)
|
||||||
#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0)
|
#define ACPI_FUNCTION_VALUE_EXIT(s)
|
||||||
#define ACPI_FUNCTION_EXIT do { } while(0)
|
#define ACPI_FUNCTION_ENTRY()
|
||||||
#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
|
#define ACPI_DUMP_STACK_ENTRY(a)
|
||||||
#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
|
#define ACPI_DUMP_OPERANDS(a, b, c)
|
||||||
#define ACPI_FUNCTION_ENTRY() do { } while(0)
|
#define ACPI_DUMP_ENTRY(a, b)
|
||||||
#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
|
#define ACPI_DUMP_TABLES(a, b)
|
||||||
#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0)
|
#define ACPI_DUMP_PATHNAME(a, b, c, d)
|
||||||
#define ACPI_DUMP_ENTRY(a, b) do { } while(0)
|
#define ACPI_DUMP_BUFFER(a, b)
|
||||||
#define ACPI_DUMP_TABLES(a, b) do { } while(0)
|
#define ACPI_DEBUG_PRINT(pl)
|
||||||
#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
|
#define ACPI_DEBUG_PRINT_RAW(pl)
|
||||||
#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
|
|
||||||
#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
|
|
||||||
|
|
||||||
#define return_VOID return
|
#define return_VOID return
|
||||||
#define return_ACPI_STATUS(s) return(s)
|
#define return_ACPI_STATUS(s) return(s)
|
||||||
|
@ -556,18 +512,6 @@
|
||||||
#define ACPI_DEBUGGER_EXEC(a)
|
#define ACPI_DEBUGGER_EXEC(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
|
||||||
/*
|
|
||||||
* 1) Set name to blanks
|
|
||||||
* 2) Copy the object name
|
|
||||||
*/
|
|
||||||
#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->common.name, ' ', sizeof (a->common.name));\
|
|
||||||
ACPI_STRNCPY (a->common.name, acpi_gbl_ns_type_names[b], sizeof (a->common.name))
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define ACPI_ADD_OBJECT_NAME(a,b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory allocation tracking (DEBUG ONLY)
|
* Memory allocation tracking (DEBUG ONLY)
|
||||||
*/
|
*/
|
||||||
|
@ -578,13 +522,13 @@
|
||||||
/* Memory allocation */
|
/* Memory allocation */
|
||||||
|
|
||||||
#ifndef ACPI_ALLOCATE
|
#ifndef ACPI_ALLOCATE
|
||||||
#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS)
|
#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size) (a), ACPI_MEM_PARAMETERS)
|
||||||
#endif
|
#endif
|
||||||
#ifndef ACPI_ALLOCATE_ZEROED
|
#ifndef ACPI_ALLOCATE_ZEROED
|
||||||
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS)
|
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size) (a), ACPI_MEM_PARAMETERS)
|
||||||
#endif
|
#endif
|
||||||
#ifndef ACPI_FREE
|
#ifndef ACPI_FREE
|
||||||
#define ACPI_FREE(a) acpio_os_free(a)
|
#define ACPI_FREE(a) acpi_os_free(a)
|
||||||
#endif
|
#endif
|
||||||
#define ACPI_MEM_TRACKING(a)
|
#define ACPI_MEM_TRACKING(a)
|
||||||
|
|
||||||
|
@ -592,16 +536,25 @@
|
||||||
|
|
||||||
/* Memory allocation */
|
/* Memory allocation */
|
||||||
|
|
||||||
#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
|
#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
|
||||||
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
|
#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS)
|
||||||
#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
|
#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
|
||||||
#define ACPI_MEM_TRACKING(a) a
|
#define ACPI_MEM_TRACKING(a) a
|
||||||
|
|
||||||
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
|
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
|
||||||
|
|
||||||
/* Preemption point */
|
/*
|
||||||
#ifndef ACPI_PREEMPTION_POINT
|
* Macros used for ACPICA utilities only
|
||||||
#define ACPI_PREEMPTION_POINT() /* no preemption */
|
*/
|
||||||
#endif
|
|
||||||
|
/* Generate a UUID */
|
||||||
|
|
||||||
|
#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
|
(a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
|
||||||
|
(b) & 0xFF, ((b) >> 8) & 0xFF, \
|
||||||
|
(c) & 0xFF, ((c) >> 8) & 0xFF, \
|
||||||
|
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
|
||||||
|
|
||||||
|
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
|
||||||
|
|
||||||
#endif /* ACMACROS_H */
|
#endif /* ACMACROS_H */
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
|
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
|
||||||
|
@ -179,7 +178,7 @@ struct acpi_object_method {
|
||||||
union acpi_operand_object *mutex;
|
union acpi_operand_object *mutex;
|
||||||
u8 *aml_start;
|
u8 *aml_start;
|
||||||
union {
|
union {
|
||||||
ACPI_INTERNAL_METHOD implementation;
|
acpi_internal_method implementation;
|
||||||
union acpi_operand_object *handler;
|
union acpi_operand_object *handler;
|
||||||
} dispatch;
|
} dispatch;
|
||||||
|
|
||||||
|
|
|
@ -150,8 +150,7 @@ u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
|
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
|
||||||
union acpi_parse_object **op,
|
union acpi_parse_object **op, u32 *arg_list, u32 *arg_count);
|
||||||
u32 * arg_list, u32 * arg_count);
|
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
|
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
|
||||||
|
|
|
@ -150,8 +150,7 @@ enum acpi_return_package_types {
|
||||||
* is saved here (rather than in a separate table) in order to minimize the
|
* is saved here (rather than in a separate table) in order to minimize the
|
||||||
* overall size of the stored data.
|
* overall size of the stored data.
|
||||||
*/
|
*/
|
||||||
static const union acpi_predefined_info predefined_names[] =
|
static const union acpi_predefined_info predefined_names[] = {
|
||||||
{
|
|
||||||
{{"_AC0", 0, ACPI_RTYPE_INTEGER}},
|
{{"_AC0", 0, ACPI_RTYPE_INTEGER}},
|
||||||
{{"_AC1", 0, ACPI_RTYPE_INTEGER}},
|
{{"_AC1", 0, ACPI_RTYPE_INTEGER}},
|
||||||
{{"_AC2", 0, ACPI_RTYPE_INTEGER}},
|
{{"_AC2", 0, ACPI_RTYPE_INTEGER}},
|
||||||
|
@ -538,7 +537,8 @@ static const union acpi_predefined_info predefined_names[] =
|
||||||
|
|
||||||
/* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
|
/* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
|
||||||
|
|
||||||
{{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
|
{{"_WAK", 1,
|
||||||
|
ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
|
||||||
{{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
|
{{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
|
||||||
|
|
||||||
/* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
|
/* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
|
||||||
|
@ -551,11 +551,12 @@ static const union acpi_predefined_info predefined_names[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/* This is an internally implemented control method, no need to check */
|
/* This is an internally implemented control method, no need to check */
|
||||||
{{"_OSI", 1, ACPI_RTYPE_INTEGER}},
|
{ {
|
||||||
|
"_OSI", 1, ACPI_RTYPE_INTEGER}},
|
||||||
|
|
||||||
/* TBD: */
|
/* TBD: */
|
||||||
|
|
||||||
_PRT - currently ignore reversed entries. attempt to fix here?
|
_PRT - currently ignore reversed entries. attempt to fix here?
|
||||||
think about possibly fixing package elements like _BIF, etc.
|
think about possibly fixing package elements like _BIF, etc.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -69,6 +69,22 @@ extern const char *acpi_gbl_siz_decode[];
|
||||||
extern const char *acpi_gbl_trs_decode[];
|
extern const char *acpi_gbl_trs_decode[];
|
||||||
extern const char *acpi_gbl_ttp_decode[];
|
extern const char *acpi_gbl_ttp_decode[];
|
||||||
extern const char *acpi_gbl_typ_decode[];
|
extern const char *acpi_gbl_typ_decode[];
|
||||||
|
extern const char *acpi_gbl_ppc_decode[];
|
||||||
|
extern const char *acpi_gbl_ior_decode[];
|
||||||
|
extern const char *acpi_gbl_dts_decode[];
|
||||||
|
extern const char *acpi_gbl_ct_decode[];
|
||||||
|
extern const char *acpi_gbl_sbt_decode[];
|
||||||
|
extern const char *acpi_gbl_am_decode[];
|
||||||
|
extern const char *acpi_gbl_sm_decode[];
|
||||||
|
extern const char *acpi_gbl_wm_decode[];
|
||||||
|
extern const char *acpi_gbl_cph_decode[];
|
||||||
|
extern const char *acpi_gbl_cpo_decode[];
|
||||||
|
extern const char *acpi_gbl_dp_decode[];
|
||||||
|
extern const char *acpi_gbl_ed_decode[];
|
||||||
|
extern const char *acpi_gbl_bpb_decode[];
|
||||||
|
extern const char *acpi_gbl_sb_decode[];
|
||||||
|
extern const char *acpi_gbl_fc_decode[];
|
||||||
|
extern const char *acpi_gbl_pt_decode[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Types for Resource descriptor entries */
|
/* Types for Resource descriptor entries */
|
||||||
|
@ -79,14 +95,14 @@ extern const char *acpi_gbl_typ_decode[];
|
||||||
#define ACPI_SMALL_VARIABLE_LENGTH 3
|
#define ACPI_SMALL_VARIABLE_LENGTH 3
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
acpi_status(*acpi_walk_aml_callback) (u8 * aml,
|
acpi_status(*acpi_walk_aml_callback) (u8 *aml,
|
||||||
u32 length,
|
u32 length,
|
||||||
u32 offset,
|
u32 offset,
|
||||||
u8 resource_index, void **context);
|
u8 resource_index, void **context);
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
acpi_status(*acpi_pkg_callback) (u8 object_type,
|
acpi_status(*acpi_pkg_callback) (u8 object_type,
|
||||||
union acpi_operand_object * source_object,
|
union acpi_operand_object *source_object,
|
||||||
union acpi_generic_state * state,
|
union acpi_generic_state * state,
|
||||||
void *context);
|
void *context);
|
||||||
|
|
||||||
|
@ -202,7 +218,9 @@ extern const u8 _acpi_ctype[];
|
||||||
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
|
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
|
||||||
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
|
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
|
||||||
|
|
||||||
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
|
#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
|
||||||
|
|
||||||
|
#define ACPI_IS_ASCII(c) ((c) < 0x80)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* utcopy - Object construction and conversion interfaces
|
* utcopy - Object construction and conversion interfaces
|
||||||
|
@ -210,11 +228,11 @@ extern const u8 _acpi_ctype[];
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_build_simple_object(union acpi_operand_object *obj,
|
acpi_ut_build_simple_object(union acpi_operand_object *obj,
|
||||||
union acpi_object *user_obj,
|
union acpi_object *user_obj,
|
||||||
u8 * data_space, u32 * buffer_space_used);
|
u8 *data_space, u32 *buffer_space_used);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_build_package_object(union acpi_operand_object *obj,
|
acpi_ut_build_package_object(union acpi_operand_object *obj,
|
||||||
u8 * buffer, u32 * space_used);
|
u8 *buffer, u32 *space_used);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
|
acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
|
||||||
|
@ -287,9 +305,10 @@ acpi_ut_ptr_exit(u32 line_number,
|
||||||
const char *function_name,
|
const char *function_name,
|
||||||
const char *module_name, u32 component_id, u8 *ptr);
|
const char *module_name, u32 component_id, u8 *ptr);
|
||||||
|
|
||||||
void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id);
|
void
|
||||||
|
acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id);
|
||||||
|
|
||||||
void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display);
|
void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset);
|
||||||
|
|
||||||
void acpi_ut_report_error(char *module_name, u32 line_number);
|
void acpi_ut_report_error(char *module_name, u32 line_number);
|
||||||
|
|
||||||
|
@ -337,15 +356,19 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
|
||||||
*/
|
*/
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id **return_id);
|
struct acpi_pnp_device_id ** return_id);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id **return_id);
|
struct acpi_pnp_device_id ** return_id);
|
||||||
|
|
||||||
|
acpi_status
|
||||||
|
acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
|
||||||
|
struct acpi_pnp_device_id **return_id);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id_list **return_cid_list);
|
struct acpi_pnp_device_id_list ** return_cid_list);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* utlock - reader/writer locks
|
* utlock - reader/writer locks
|
||||||
|
@ -479,15 +502,19 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
|
||||||
|
|
||||||
void acpi_ut_strupr(char *src_string);
|
void acpi_ut_strupr(char *src_string);
|
||||||
|
|
||||||
|
void acpi_ut_strlwr(char *src_string);
|
||||||
|
|
||||||
|
int acpi_ut_stricmp(char *string1, char *string2);
|
||||||
|
|
||||||
void acpi_ut_print_string(char *string, u8 max_length);
|
void acpi_ut_print_string(char *string, u8 max_length);
|
||||||
|
|
||||||
u8 acpi_ut_valid_acpi_name(u32 name);
|
u8 acpi_ut_valid_acpi_name(u32 name);
|
||||||
|
|
||||||
acpi_name acpi_ut_repair_name(char *name);
|
void acpi_ut_repair_name(char *name);
|
||||||
|
|
||||||
u8 acpi_ut_valid_acpi_char(char character, u32 position);
|
u8 acpi_ut_valid_acpi_char(char character, u32 position);
|
||||||
|
|
||||||
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer);
|
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
|
||||||
|
|
||||||
/* Values for Base above (16=Hex, 10=Decimal) */
|
/* Values for Base above (16=Hex, 10=Decimal) */
|
||||||
|
|
||||||
|
@ -508,12 +535,12 @@ acpi_ut_display_init_pathname(u8 type,
|
||||||
* utresrc
|
* utresrc
|
||||||
*/
|
*/
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_walk_aml_resources(u8 * aml,
|
acpi_ut_walk_aml_resources(u8 *aml,
|
||||||
acpi_size aml_length,
|
acpi_size aml_length,
|
||||||
acpi_walk_aml_callback user_function,
|
acpi_walk_aml_callback user_function,
|
||||||
void **context);
|
void **context);
|
||||||
|
|
||||||
acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index);
|
acpi_status acpi_ut_validate_resource(void *aml, u8 *return_index);
|
||||||
|
|
||||||
u32 acpi_ut_get_descriptor_length(void *aml);
|
u32 acpi_ut_get_descriptor_length(void *aml);
|
||||||
|
|
||||||
|
@ -524,8 +551,7 @@ u8 acpi_ut_get_resource_header_length(void *aml);
|
||||||
u8 acpi_ut_get_resource_type(void *aml);
|
u8 acpi_ut_get_resource_type(void *aml);
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc,
|
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);
|
||||||
u8 ** end_tag);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* utmutex - mutex support
|
* utmutex - mutex support
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: amlresrc.h - AML resource descriptors
|
* Module Name: amlresrc.h - AML resource descriptors
|
||||||
|
|
|
@ -649,7 +649,8 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
|
||||||
((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
|
((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
|
||||||
(op->common.parent->common.aml_opcode !=
|
(op->common.parent->common.aml_opcode !=
|
||||||
AML_VAR_PACKAGE_OP)
|
AML_VAR_PACKAGE_OP)
|
||||||
&& (op->common.parent->common.aml_opcode != AML_NAME_OP))) {
|
&& (op->common.parent->common.aml_opcode !=
|
||||||
|
AML_NAME_OP))) {
|
||||||
walk_state->result_obj = obj_desc;
|
walk_state->result_obj = obj_desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,7 +560,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
|
||||||
* indicate this to the interpreter, set the
|
* indicate this to the interpreter, set the
|
||||||
* object to the root
|
* object to the root
|
||||||
*/
|
*/
|
||||||
obj_desc = ACPI_CAST_PTR(union
|
obj_desc =
|
||||||
|
ACPI_CAST_PTR(union
|
||||||
acpi_operand_object,
|
acpi_operand_object,
|
||||||
acpi_gbl_root_node);
|
acpi_gbl_root_node);
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
|
|
|
@ -57,7 +57,7 @@ ACPI_MODULE_NAME("dswexec")
|
||||||
/*
|
/*
|
||||||
* Dispatch table for opcode classes
|
* Dispatch table for opcode classes
|
||||||
*/
|
*/
|
||||||
static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = {
|
static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
|
||||||
acpi_ex_opcode_0A_0T_1R,
|
acpi_ex_opcode_0A_0T_1R,
|
||||||
acpi_ex_opcode_1A_0T_0R,
|
acpi_ex_opcode_1A_0T_0R,
|
||||||
acpi_ex_opcode_1A_0T_1R,
|
acpi_ex_opcode_1A_0T_1R,
|
||||||
|
|
|
@ -254,7 +254,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
|
||||||
acpi_ut_get_type_name(node->type),
|
acpi_ut_get_type_name(node->type),
|
||||||
acpi_ut_get_node_name(node)));
|
acpi_ut_get_node_name(node)));
|
||||||
|
|
||||||
return (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
|
||||||
region_space,
|
region_space,
|
||||||
walk_state);
|
walk_state);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ex_exit_interpreter();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
|
@ -51,8 +51,9 @@
|
||||||
ACPI_MODULE_NAME("dswstate")
|
ACPI_MODULE_NAME("dswstate")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *ws);
|
static acpi_status
|
||||||
static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *ws);
|
acpi_ds_result_stack_push(struct acpi_walk_state *walk_state);
|
||||||
|
static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -536,9 +537,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
|
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
|
||||||
*origin, union acpi_operand_object
|
union acpi_parse_object
|
||||||
*method_desc, struct acpi_thread_state
|
*origin,
|
||||||
|
union acpi_operand_object
|
||||||
|
*method_desc,
|
||||||
|
struct acpi_thread_state
|
||||||
*thread)
|
*thread)
|
||||||
{
|
{
|
||||||
struct acpi_walk_state *walk_state;
|
struct acpi_walk_state *walk_state;
|
||||||
|
@ -704,13 +708,13 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
|
||||||
ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state);
|
ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state);
|
||||||
|
|
||||||
if (!walk_state) {
|
if (!walk_state) {
|
||||||
return;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
|
if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
|
||||||
ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
|
ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
|
||||||
walk_state));
|
walk_state));
|
||||||
return;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There should not be any open scopes */
|
/* There should not be any open scopes */
|
||||||
|
|
|
@ -89,7 +89,8 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
/* Set the mask bit only if there are references to this GPE */
|
/* Set the mask bit only if there are references to this GPE */
|
||||||
|
|
||||||
if (gpe_event_info->runtime_count) {
|
if (gpe_event_info->runtime_count) {
|
||||||
ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit);
|
ACPI_SET_BIT(gpe_register_info->enable_for_run,
|
||||||
|
(u8)register_bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
@ -106,8 +107,7 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
* DESCRIPTION: Clear a GPE of stale events and enable it.
|
* DESCRIPTION: Clear a GPE of stale events and enable it.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
acpi_status
|
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
@ -131,8 +131,8 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable the requested GPE */
|
/* Enable the requested GPE */
|
||||||
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
|
|
||||||
|
|
||||||
|
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,8 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
|
acpi_status
|
||||||
|
acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
@ -191,7 +192,8 @@ acpi_status acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
|
acpi_status
|
||||||
|
acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
@ -208,7 +210,8 @@ acpi_status acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_i
|
||||||
|
|
||||||
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
status = acpi_hw_low_set_gpe(gpe_event_info,
|
status =
|
||||||
|
acpi_hw_low_set_gpe(gpe_event_info,
|
||||||
ACPI_GPE_DISABLE);
|
ACPI_GPE_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +309,8 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
||||||
|
|
||||||
/* A Non-NULL gpe_device means this is a GPE Block Device */
|
/* A Non-NULL gpe_device means this is a GPE Block Device */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *)
|
obj_desc =
|
||||||
|
acpi_ns_get_attached_object((struct acpi_namespace_node *)
|
||||||
gpe_device);
|
gpe_device);
|
||||||
if (!obj_desc || !obj_desc->device.gpe_block) {
|
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
|
@ -486,7 +486,8 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_EXCEPTION((AE_INFO, status,
|
ACPI_EXCEPTION((AE_INFO, status,
|
||||||
"Could not enable GPE 0x%02X",
|
"Could not enable GPE 0x%02X",
|
||||||
gpe_index + gpe_block->block_base_number));
|
gpe_index +
|
||||||
|
gpe_block->block_base_number));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,8 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
gpe_event_info->dispatch.handler = NULL;
|
gpe_event_info->dispatch.handler = NULL;
|
||||||
gpe_event_info->flags &=
|
gpe_event_info->flags &=
|
||||||
~ACPI_GPE_DISPATCH_MASK;
|
~ACPI_GPE_DISPATCH_MASK;
|
||||||
} else if ((gpe_event_info->
|
} else
|
||||||
|
if ((gpe_event_info->
|
||||||
flags & ACPI_GPE_DISPATCH_MASK) ==
|
flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||||
ACPI_GPE_DISPATCH_NOTIFY) {
|
ACPI_GPE_DISPATCH_NOTIFY) {
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
||||||
|
|
||||||
/* Install a handler for this PCI root bridge */
|
/* Install a handler for this PCI root bridge */
|
||||||
|
|
||||||
status =
|
status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
||||||
acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_SAME_HANDLER) {
|
if (status == AE_SAME_HANDLER) {
|
||||||
/*
|
/*
|
||||||
|
@ -350,8 +349,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
|
||||||
static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
|
static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpica_device_id *hid;
|
struct acpi_pnp_device_id *hid;
|
||||||
struct acpica_device_id_list *cid;
|
struct acpi_pnp_device_id_list *cid;
|
||||||
u32 i;
|
u32 i;
|
||||||
u8 match;
|
u8 match;
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_global_event_handler(ACPI_GBL_EVENT_HANDLER handler, void *context)
|
acpi_install_global_event_handler(acpi_gbl_event_handler handler, void *context)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,8 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device,
|
||||||
if (wake_device == ACPI_ROOT_OBJECT) {
|
if (wake_device == ACPI_ROOT_OBJECT) {
|
||||||
device_node = acpi_gbl_root_node;
|
device_node = acpi_gbl_root_node;
|
||||||
} else {
|
} else {
|
||||||
device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
|
device_node =
|
||||||
|
ACPI_CAST_PTR(struct acpi_namespace_node, wake_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate WakeDevice is of type Device */
|
/* Validate WakeDevice is of type Device */
|
||||||
|
@ -324,7 +325,8 @@ ACPI_EXPORT_SYMBOL(acpi_setup_gpe_for_wake)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
acpi_status
|
||||||
|
acpi_set_gpe_wake_mask(acpi_handle gpe_device, u32 gpe_number, u8 action)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
@ -567,7 +569,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
|
||||||
|
|
||||||
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 (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_validate_handle(gpe_device);
|
node = acpi_ns_validate_handle(gpe_device);
|
||||||
|
@ -650,7 +652,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
||||||
|
|
||||||
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 (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_validate_handle(gpe_device);
|
node = acpi_ns_validate_handle(gpe_device);
|
||||||
|
@ -694,8 +696,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
|
||||||
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
|
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
acpi_status
|
acpi_status acpi_get_gpe_device(u32 index, acpi_handle * gpe_device)
|
||||||
acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_device_info info;
|
struct acpi_gpe_device_info info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
|
@ -516,8 +516,8 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
|
||||||
string_length--;
|
string_length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_desc = acpi_ut_create_string_object((acpi_size)
|
return_desc =
|
||||||
string_length);
|
acpi_ut_create_string_object((acpi_size) string_length);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS(AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,8 +243,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
|
||||||
|
|
||||||
/* Init object and attach to NS node */
|
/* Init object and attach to NS node */
|
||||||
|
|
||||||
obj_desc->mutex.sync_level =
|
obj_desc->mutex.sync_level = (u8)walk_state->operands[1]->integer.value;
|
||||||
(u8) walk_state->operands[1]->integer.value;
|
|
||||||
obj_desc->mutex.node =
|
obj_desc->mutex.node =
|
||||||
(struct acpi_namespace_node *)walk_state->operands[0];
|
(struct acpi_namespace_node *)walk_state->operands[0];
|
||||||
|
|
||||||
|
|
|
@ -145,10 +145,10 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length);
|
acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length);
|
||||||
acpi_ut_dump_buffer2(source_desc->buffer.pointer,
|
acpi_ut_dump_buffer(source_desc->buffer.pointer,
|
||||||
(source_desc->buffer.length < 256) ?
|
(source_desc->buffer.length < 256) ?
|
||||||
source_desc->buffer.length : 256,
|
source_desc->buffer.length : 256,
|
||||||
DB_BYTE_DISPLAY);
|
DB_BYTE_DISPLAY, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
@ -190,7 +190,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
|
||||||
|
|
||||||
acpi_os_printf("Table Index 0x%X\n",
|
acpi_os_printf("Table Index 0x%X\n",
|
||||||
source_desc->reference.value);
|
source_desc->reference.value);
|
||||||
return;
|
return_VOID;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -464,7 +464,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME(ex_dump_operand)
|
ACPI_FUNCTION_NAME(ex_dump_operand)
|
||||||
|
|
||||||
if (!((ACPI_LV_EXEC & acpi_dbg_level)
|
if (!
|
||||||
|
((ACPI_LV_EXEC & acpi_dbg_level)
|
||||||
&& (_COMPONENT & acpi_dbg_layer))) {
|
&& (_COMPONENT & acpi_dbg_layer))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -810,7 +811,8 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
|
||||||
ACPI_FUNCTION_ENTRY();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
if (!flags) {
|
if (!flags) {
|
||||||
if (!((ACPI_LV_OBJECTS & acpi_dbg_level)
|
if (!
|
||||||
|
((ACPI_LV_OBJECTS & acpi_dbg_level)
|
||||||
&& (_COMPONENT & acpi_dbg_layer))) {
|
&& (_COMPONENT & acpi_dbg_layer))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -940,8 +942,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
|
||||||
acpi_os_printf("[Buffer] Length %.2X = ",
|
acpi_os_printf("[Buffer] Length %.2X = ",
|
||||||
obj_desc->buffer.length);
|
obj_desc->buffer.length);
|
||||||
if (obj_desc->buffer.length) {
|
if (obj_desc->buffer.length) {
|
||||||
acpi_ut_dump_buffer(ACPI_CAST_PTR
|
acpi_ut_debug_dump_buffer(ACPI_CAST_PTR
|
||||||
(u8, obj_desc->buffer.pointer),
|
(u8,
|
||||||
|
obj_desc->buffer.pointer),
|
||||||
obj_desc->buffer.length,
|
obj_desc->buffer.length,
|
||||||
DB_DWORD_DISPLAY, _COMPONENT);
|
DB_DWORD_DISPLAY, _COMPONENT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -996,7 +999,8 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!flags) {
|
if (!flags) {
|
||||||
if (!((ACPI_LV_OBJECTS & acpi_dbg_level)
|
if (!
|
||||||
|
((ACPI_LV_OBJECTS & acpi_dbg_level)
|
||||||
&& (_COMPONENT & acpi_dbg_layer))) {
|
&& (_COMPONENT & acpi_dbg_layer))) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,7 @@ ACPI_MODULE_NAME("exfldio")
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
|
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
|
||||||
u32 field_datum_byte_offset,
|
u32 field_datum_byte_offset, u64 *value, u32 read_write);
|
||||||
u64 *value, u32 read_write);
|
|
||||||
|
|
||||||
static u8
|
static u8
|
||||||
acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value);
|
acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
|
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exmutex - ASL Mutex Acquire/Release functions
|
* Module Name: exmutex - ASL Mutex Acquire/Release functions
|
||||||
|
@ -305,7 +304,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc)
|
||||||
ACPI_FUNCTION_TRACE(ex_release_mutex_object);
|
ACPI_FUNCTION_TRACE(ex_release_mutex_object);
|
||||||
|
|
||||||
if (obj_desc->mutex.acquisition_depth == 0) {
|
if (obj_desc->mutex.acquisition_depth == 0) {
|
||||||
return (AE_NOT_ACQUIRED);
|
return_ACPI_STATUS(AE_NOT_ACQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match multiple Acquires with multiple Releases */
|
/* Match multiple Acquires with multiple Releases */
|
||||||
|
@ -462,7 +461,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
|
||||||
union acpi_operand_object *next = thread->acquired_mutex_list;
|
union acpi_operand_object *next = thread->acquired_mutex_list;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY();
|
ACPI_FUNCTION_NAME(ex_release_all_mutexes);
|
||||||
|
|
||||||
/* Traverse the list of owned mutexes, releasing each one */
|
/* Traverse the list of owned mutexes, releasing each one */
|
||||||
|
|
||||||
|
@ -474,6 +473,10 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
|
||||||
obj_desc->mutex.next = NULL;
|
obj_desc->mutex.next = NULL;
|
||||||
obj_desc->mutex.acquisition_depth = 0;
|
obj_desc->mutex.acquisition_depth = 0;
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
|
"Force-releasing held mutex: %p\n",
|
||||||
|
obj_desc));
|
||||||
|
|
||||||
/* Release the mutex, special case for Global Lock */
|
/* Release the mutex, special case for Global Lock */
|
||||||
|
|
||||||
if (obj_desc == acpi_gbl_global_lock_mutex) {
|
if (obj_desc == acpi_gbl_global_lock_mutex) {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exnames - interpreter/scanner name load/execute
|
* Module Name: exnames - interpreter/scanner name load/execute
|
||||||
|
@ -53,8 +52,7 @@ ACPI_MODULE_NAME("exnames")
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
|
static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ex_name_segment(u8 **in_aml_address, char *name_string);
|
||||||
acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -178,7 +176,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
||||||
|
|
||||||
for (index = 0; (index < ACPI_NAME_SIZE)
|
for (index = 0;
|
||||||
|
(index < ACPI_NAME_SIZE)
|
||||||
&& (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
|
&& (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) {
|
||||||
char_buf[index] = *aml_address++;
|
char_buf[index] = *aml_address++;
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
|
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
|
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
|
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
|
||||||
|
@ -198,7 +197,7 @@ acpi_ex_do_match(u32 match_op,
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return logical_result;
|
return (logical_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
|
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exregion - ACPI default op_region (address space) handlers
|
* Module Name: exregion - ACPI default op_region (address space) handlers
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exresnte - AML Interpreter object resolution
|
* Module Name: exresnte - AML Interpreter object resolution
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exresolv - AML Interpreter object resolution
|
* Module Name: exresolv - AML Interpreter object resolution
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exresop - AML Interpreter operand/object resolution
|
* Module Name: exresop - AML Interpreter operand/object resolution
|
||||||
|
@ -337,7 +336,8 @@ acpi_ex_resolve_operands(u16 opcode,
|
||||||
if ((opcode == AML_STORE_OP) &&
|
if ((opcode == AML_STORE_OP) &&
|
||||||
((*stack_ptr)->common.type ==
|
((*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;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exstoren - AML Interpreter object store support,
|
* Module Name: exstoren - AML Interpreter object store support,
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exstorob - AML Interpreter object store support, store to object
|
* Module Name: exstorob - AML Interpreter object store support, store to object
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exsystem - Interface to OS services
|
* Module Name: exsystem - Interface to OS services
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: exutils - interpreter/scanner utilities
|
* Module Name: exutils - interpreter/scanner utilities
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
|
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
|
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
|
||||||
|
@ -339,7 +338,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
struct acpi_gpe_block_info *gpe_block, void *context)
|
struct acpi_gpe_block_info * gpe_block,
|
||||||
|
void *context)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
|
@ -259,7 +259,7 @@ acpi_hw_process_pci_list(struct acpi_pci_id *pci_id,
|
||||||
status = acpi_hw_get_pci_device_info(pci_id, info->device,
|
status = acpi_hw_get_pci_device_info(pci_id, info->device,
|
||||||
&bus_number, &is_bridge);
|
&bus_number, &is_bridge);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS(status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
info = info->next;
|
info = info->next;
|
||||||
|
@ -271,7 +271,7 @@ acpi_hw_process_pci_list(struct acpi_pci_id *pci_id,
|
||||||
pci_id->segment, pci_id->bus, pci_id->device,
|
pci_id->segment, pci_id->bus, pci_id->device,
|
||||||
pci_id->function, status, bus_number, is_bridge));
|
pci_id->function, status, bus_number, is_bridge));
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: hwregs - Read/write access functions for the various ACPI
|
* Module Name: hwregs - Read/write access functions for the various ACPI
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Name: hwtimer.c - ACPI Power Management Timer Interface
|
* Name: hwtimer.c - ACPI Power Management Timer Interface
|
||||||
|
@ -101,8 +100,7 @@ acpi_status acpi_get_timer(u32 * ticks)
|
||||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status =
|
status = acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
|
||||||
acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
|
|
||||||
|
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: hwvalid - I/O request validation
|
* Module Name: hwvalid - I/O request validation
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Module Name: hwxface - Public ACPICA hardware interfaces
|
* Module Name: hwxface - Public ACPICA hardware interfaces
|
||||||
|
|
|
@ -49,8 +49,7 @@
|
||||||
ACPI_MODULE_NAME("hwxfsleep")
|
ACPI_MODULE_NAME("hwxfsleep")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static acpi_status
|
static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
|
||||||
acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch table used to efficiently branch to the various sleep
|
* Dispatch table used to efficiently branch to the various sleep
|
||||||
|
@ -234,8 +233,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
|
||||||
* function.
|
* function.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static acpi_status
|
static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
|
||||||
acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_sleep_functions *sleep_functions =
|
struct acpi_sleep_functions *sleep_functions =
|
||||||
|
@ -369,8 +367,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
|
||||||
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
status =
|
status = acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
|
||||||
acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
|
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,8 +393,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
|
||||||
ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
|
ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
|
||||||
|
|
||||||
status =
|
status =
|
||||||
acpi_hw_sleep_dispatch(sleep_state,
|
acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_PREP_FUNCTION_ID);
|
||||||
ACPI_WAKE_PREP_FUNCTION_ID);
|
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,11 +110,11 @@ acpi_status acpi_ns_root_initialize(void)
|
||||||
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
|
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
|
||||||
ACPI_IMODE_LOAD_PASS2,
|
ACPI_IMODE_LOAD_PASS2,
|
||||||
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
|
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
|
|
||||||
ACPI_EXCEPTION((AE_INFO, status,
|
ACPI_EXCEPTION((AE_INFO, status,
|
||||||
"Could not create predefined name %s",
|
"Could not create predefined name %s",
|
||||||
init_val->name));
|
init_val->name));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -179,8 +179,7 @@ acpi_status acpi_ns_root_initialize(void)
|
||||||
|
|
||||||
/* 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;
|
||||||
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
|
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -209,14 +209,6 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
|
||||||
"Invalid ACPI Object Type 0x%08X", type));
|
"Invalid ACPI Object Type 0x%08X", type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
|
|
||||||
this_node->name.integer =
|
|
||||||
acpi_ut_repair_name(this_node->name.ascii);
|
|
||||||
|
|
||||||
ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
|
|
||||||
this_node->name.integer));
|
|
||||||
}
|
|
||||||
|
|
||||||
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
|
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ acpi_status acpi_ns_initialize_objects(void)
|
||||||
/* Walk entire namespace from the supplied root */
|
/* Walk entire namespace from the supplied root */
|
||||||
|
|
||||||
status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX, acpi_ns_init_one_object, NULL,
|
ACPI_UINT32_MAX, acpi_ns_init_one_object,
|
||||||
&info, NULL);
|
NULL, &info, NULL);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
|
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
|
||||||
ACPI_ERROR((AE_INFO,
|
ACPI_ERROR((AE_INFO,
|
||||||
"Invalid Namespace Node (%p) while traversing namespace",
|
"Invalid Namespace Node (%p) while traversing namespace",
|
||||||
next_node));
|
next_node));
|
||||||
return 0;
|
return (0);
|
||||||
}
|
}
|
||||||
size += ACPI_PATH_SEGMENT_LENGTH;
|
size += ACPI_PATH_SEGMENT_LENGTH;
|
||||||
next_node = next_node->parent;
|
next_node = next_node->parent;
|
||||||
|
|
|
@ -314,23 +314,8 @@ acpi_ns_search_and_enter(u32 target_name,
|
||||||
* this problem, and we want to be able to enable ACPI support for them,
|
* this problem, and we want to be able to enable ACPI support for them,
|
||||||
* even though there are a few bad names.
|
* even though there are a few bad names.
|
||||||
*/
|
*/
|
||||||
if (!acpi_ut_valid_acpi_name(target_name)) {
|
|
||||||
target_name =
|
|
||||||
acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
|
acpi_ut_repair_name(ACPI_CAST_PTR(char, &target_name));
|
||||||
|
|
||||||
/* Report warning only if in strict mode or debug mode */
|
|
||||||
|
|
||||||
if (!acpi_gbl_enable_interpreter_slack) {
|
|
||||||
ACPI_WARNING((AE_INFO,
|
|
||||||
"Found bad character(s) in name, repaired: [%4.4s]\n",
|
|
||||||
ACPI_CAST_PTR(char, &target_name)));
|
|
||||||
} else {
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
||||||
"Found bad character(s) in name, repaired: [%4.4s]\n",
|
|
||||||
ACPI_CAST_PTR(char, &target_name)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to find the name in the namespace level specified by the caller */
|
/* Try to find the name in the namespace level specified by the caller */
|
||||||
|
|
||||||
*return_node = ACPI_ENTRY_NOT_FOUND;
|
*return_node = ACPI_ENTRY_NOT_FOUND;
|
||||||
|
|
|
@ -557,10 +557,14 @@ acpi_ns_externalize_name(u32 internal_name_length,
|
||||||
(*converted_name)[j++] = '.';
|
(*converted_name)[j++] = '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
(*converted_name)[j++] = internal_name[names_index++];
|
/* Copy and validate the 4-char name segment */
|
||||||
(*converted_name)[j++] = internal_name[names_index++];
|
|
||||||
(*converted_name)[j++] = internal_name[names_index++];
|
ACPI_MOVE_NAME(&(*converted_name)[j],
|
||||||
(*converted_name)[j++] = internal_name[names_index++];
|
&internal_name[names_index]);
|
||||||
|
acpi_ut_repair_name(&(*converted_name)[j]);
|
||||||
|
|
||||||
|
j += ACPI_NAME_SIZE;
|
||||||
|
names_index += ACPI_NAME_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -542,15 +542,15 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
struct acpica_device_id *hid;
|
struct acpi_pnp_device_id *hid;
|
||||||
struct acpica_device_id_list *cid;
|
struct acpi_pnp_device_id_list *cid;
|
||||||
u32 i;
|
u32 i;
|
||||||
u8 found;
|
u8 found;
|
||||||
int no_match;
|
int no_match;
|
||||||
|
|
||||||
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 (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_validate_handle(obj_handle);
|
node = acpi_ns_validate_handle(obj_handle);
|
||||||
|
|
|
@ -53,8 +53,8 @@
|
||||||
ACPI_MODULE_NAME("nsxfname")
|
ACPI_MODULE_NAME("nsxfname")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
|
static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
|
||||||
struct acpica_device_id *source,
|
struct acpi_pnp_device_id *source,
|
||||||
char *string_area);
|
char *string_area);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -202,8 +202,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
|
||||||
|
|
||||||
/* Just copy the ACPI name from the Node and zero terminate it */
|
/* Just copy the ACPI name from the Node and zero terminate it */
|
||||||
|
|
||||||
ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
|
ACPI_MOVE_NAME(buffer->pointer, acpi_ut_get_node_name(node));
|
||||||
ACPI_NAME_SIZE);
|
|
||||||
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
|
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
|
|
||||||
|
@ -219,20 +218,21 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_copy_device_id
|
* FUNCTION: acpi_ns_copy_device_id
|
||||||
*
|
*
|
||||||
* PARAMETERS: dest - Pointer to the destination DEVICE_ID
|
* PARAMETERS: dest - Pointer to the destination PNP_DEVICE_ID
|
||||||
* source - Pointer to the source DEVICE_ID
|
* source - Pointer to the source PNP_DEVICE_ID
|
||||||
* string_area - Pointer to where to copy the dest string
|
* string_area - Pointer to where to copy the dest string
|
||||||
*
|
*
|
||||||
* RETURN: Pointer to the next string area
|
* RETURN: Pointer to the next string area
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Copy a single DEVICE_ID, including the string data.
|
* DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
|
static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
|
||||||
struct acpica_device_id *source,
|
struct acpi_pnp_device_id *source,
|
||||||
char *string_area)
|
char *string_area)
|
||||||
{
|
{
|
||||||
/* Create the destination DEVICE_ID */
|
|
||||||
|
/* Create the destination PNP_DEVICE_ID */
|
||||||
|
|
||||||
dest->string = string_area;
|
dest->string = string_area;
|
||||||
dest->length = source->length;
|
dest->length = source->length;
|
||||||
|
@ -256,8 +256,8 @@ static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
|
||||||
* namespace node and possibly by running several standard
|
* namespace node and possibly by running several standard
|
||||||
* control methods (Such as in the case of a device.)
|
* control methods (Such as in the case of a device.)
|
||||||
*
|
*
|
||||||
* For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
|
* For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
|
||||||
* _ADR, _sx_w, and _sx_d methods.
|
* _STA, _ADR, _sx_w, and _sx_d methods.
|
||||||
*
|
*
|
||||||
* Note: Allocates the return buffer, must be freed by the caller.
|
* Note: Allocates the return buffer, must be freed by the caller.
|
||||||
*
|
*
|
||||||
|
@ -269,9 +269,10 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
struct acpi_device_info *info;
|
struct acpi_device_info *info;
|
||||||
struct acpica_device_id_list *cid_list = NULL;
|
struct acpi_pnp_device_id_list *cid_list = NULL;
|
||||||
struct acpica_device_id *hid = NULL;
|
struct acpi_pnp_device_id *hid = NULL;
|
||||||
struct acpica_device_id *uid = NULL;
|
struct acpi_pnp_device_id *uid = NULL;
|
||||||
|
struct acpi_pnp_device_id *sub = NULL;
|
||||||
char *next_id_string;
|
char *next_id_string;
|
||||||
acpi_object_type type;
|
acpi_object_type type;
|
||||||
acpi_name name;
|
acpi_name name;
|
||||||
|
@ -316,7 +317,7 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
|
if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
|
||||||
/*
|
/*
|
||||||
* Get extra info for ACPI Device/Processor objects only:
|
* Get extra info for ACPI Device/Processor objects only:
|
||||||
* Run the Device _HID, _UID, and _CID methods.
|
* Run the Device _HID, _UID, _SUB, and _CID methods.
|
||||||
*
|
*
|
||||||
* Note: none of these methods are required, so they may or may
|
* Note: none of these methods are required, so they may or may
|
||||||
* not be present for this device. The Info->Valid bitfield is used
|
* not be present for this device. The Info->Valid bitfield is used
|
||||||
|
@ -339,6 +340,14 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
valid |= ACPI_VALID_UID;
|
valid |= ACPI_VALID_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Execute the Device._SUB method */
|
||||||
|
|
||||||
|
status = acpi_ut_execute_SUB(node, &sub);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
info_size += sub->length;
|
||||||
|
valid |= ACPI_VALID_SUB;
|
||||||
|
}
|
||||||
|
|
||||||
/* Execute the Device._CID method */
|
/* Execute the Device._CID method */
|
||||||
|
|
||||||
status = acpi_ut_execute_CID(node, &cid_list);
|
status = acpi_ut_execute_CID(node, &cid_list);
|
||||||
|
@ -348,7 +357,7 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
|
|
||||||
info_size +=
|
info_size +=
|
||||||
(cid_list->list_size -
|
(cid_list->list_size -
|
||||||
sizeof(struct acpica_device_id_list));
|
sizeof(struct acpi_pnp_device_id_list));
|
||||||
valid |= ACPI_VALID_CID;
|
valid |= ACPI_VALID_CID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,16 +427,17 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
|
next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
|
||||||
if (cid_list) {
|
if (cid_list) {
|
||||||
|
|
||||||
/* Point past the CID DEVICE_ID array */
|
/* Point past the CID PNP_DEVICE_ID array */
|
||||||
|
|
||||||
next_id_string +=
|
next_id_string +=
|
||||||
((acpi_size) cid_list->count *
|
((acpi_size) cid_list->count *
|
||||||
sizeof(struct acpica_device_id));
|
sizeof(struct acpi_pnp_device_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the HID, UID, and CIDs to the return buffer. The variable-length
|
* Copy the HID, UID, SUB, and CIDs to the return buffer.
|
||||||
* strings are copied to the reserved area at the end of the buffer.
|
* The variable-length strings are copied to the reserved area
|
||||||
|
* at the end of the buffer.
|
||||||
*
|
*
|
||||||
* For HID and CID, check if the ID is a PCI Root Bridge.
|
* For HID and CID, check if the ID is a PCI Root Bridge.
|
||||||
*/
|
*/
|
||||||
|
@ -445,6 +455,11 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
uid, next_id_string);
|
uid, next_id_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sub) {
|
||||||
|
next_id_string = acpi_ns_copy_device_id(&info->subsystem_id,
|
||||||
|
sub, next_id_string);
|
||||||
|
}
|
||||||
|
|
||||||
if (cid_list) {
|
if (cid_list) {
|
||||||
info->compatible_id_list.count = cid_list->count;
|
info->compatible_id_list.count = cid_list->count;
|
||||||
info->compatible_id_list.list_size = cid_list->list_size;
|
info->compatible_id_list.list_size = cid_list->list_size;
|
||||||
|
@ -481,6 +496,9 @@ acpi_get_object_info(acpi_handle handle,
|
||||||
if (uid) {
|
if (uid) {
|
||||||
ACPI_FREE(uid);
|
ACPI_FREE(uid);
|
||||||
}
|
}
|
||||||
|
if (sub) {
|
||||||
|
ACPI_FREE(sub);
|
||||||
|
}
|
||||||
if (cid_list) {
|
if (cid_list) {
|
||||||
ACPI_FREE(cid_list);
|
ACPI_FREE(cid_list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,18 +133,46 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
|
||||||
|
|
||||||
case AML_CLASS_UNKNOWN:
|
case AML_CLASS_UNKNOWN:
|
||||||
|
|
||||||
/* The opcode is unrecognized. Just skip unknown opcodes */
|
/* The opcode is unrecognized. Complain and skip unknown opcodes */
|
||||||
|
|
||||||
|
if (walk_state->pass_number == 2) {
|
||||||
ACPI_ERROR((AE_INFO,
|
ACPI_ERROR((AE_INFO,
|
||||||
"Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring",
|
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
|
||||||
walk_state->opcode, walk_state->parser_state.aml,
|
walk_state->opcode,
|
||||||
walk_state->aml_offset));
|
(u32)(walk_state->aml_offset +
|
||||||
|
sizeof(struct acpi_table_header))));
|
||||||
|
|
||||||
ACPI_DUMP_BUFFER(walk_state->parser_state.aml, 128);
|
ACPI_DUMP_BUFFER(walk_state->parser_state.aml - 16, 48);
|
||||||
|
|
||||||
/* Assume one-byte bad opcode */
|
#ifdef ACPI_ASL_COMPILER
|
||||||
|
/*
|
||||||
|
* This is executed for the disassembler only. Output goes
|
||||||
|
* to the disassembled ASL output file.
|
||||||
|
*/
|
||||||
|
acpi_os_printf
|
||||||
|
("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
|
||||||
|
walk_state->opcode,
|
||||||
|
(u32)(walk_state->aml_offset +
|
||||||
|
sizeof(struct acpi_table_header)));
|
||||||
|
|
||||||
|
/* Dump the context surrounding the invalid opcode */
|
||||||
|
|
||||||
|
acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
|
||||||
|
aml - 16), 48, DB_BYTE_DISPLAY,
|
||||||
|
walk_state->aml_offset +
|
||||||
|
sizeof(struct acpi_table_header) -
|
||||||
|
16);
|
||||||
|
acpi_os_printf(" */\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Increment past one-byte or two-byte opcode */
|
||||||
|
|
||||||
walk_state->parser_state.aml++;
|
walk_state->parser_state.aml++;
|
||||||
|
if (walk_state->opcode > 0xFF) { /* Can only happen if first byte is 0x5B */
|
||||||
|
walk_state->parser_state.aml++;
|
||||||
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
|
return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -519,11 +547,18 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
|
||||||
if ((op_info->class ==
|
if ((op_info->class ==
|
||||||
AML_CLASS_EXECUTE) && (!arg)) {
|
AML_CLASS_EXECUTE) && (!arg)) {
|
||||||
ACPI_WARNING((AE_INFO,
|
ACPI_WARNING((AE_INFO,
|
||||||
"Detected an unsupported executable opcode "
|
"Unsupported module-level executable opcode "
|
||||||
"at module-level: [0x%.4X] at table offset 0x%.4X",
|
"0x%.2X at table offset 0x%.4X",
|
||||||
op->common.aml_opcode,
|
op->common.
|
||||||
(u32)((aml_op_start - walk_state->parser_state.aml_start)
|
aml_opcode,
|
||||||
+ sizeof(struct acpi_table_header))));
|
(u32)
|
||||||
|
(ACPI_PTR_DIFF
|
||||||
|
(aml_op_start,
|
||||||
|
walk_state->
|
||||||
|
parser_state.
|
||||||
|
aml_start) +
|
||||||
|
sizeof(struct
|
||||||
|
acpi_table_header))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -843,8 +878,6 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state,
|
||||||
*op = NULL;
|
*op = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_PREEMPTION_POINT();
|
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,10 +392,12 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
|
||||||
AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
|
AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
|
||||||
/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
|
/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
|
||||||
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
|
||||||
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
|
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
|
||||||
|
AML_CONSTANT),
|
||||||
/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
|
/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
|
||||||
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
|
||||||
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
|
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
|
||||||
|
AML_CONSTANT),
|
||||||
/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
|
/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
|
||||||
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
|
||||||
AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
|
AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
|
||||||
|
@ -495,7 +497,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
|
||||||
AML_NSNODE | AML_NAMED | AML_DEFER),
|
AML_NSNODE | AML_NAMED | AML_DEFER),
|
||||||
/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
|
/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
|
||||||
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
|
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
|
||||||
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
|
AML_FIELD),
|
||||||
/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
|
/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
|
||||||
ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
|
ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
|
||||||
AML_TYPE_NAMED_NO_OBJ,
|
AML_TYPE_NAMED_NO_OBJ,
|
||||||
|
@ -519,12 +522,13 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
|
||||||
/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
|
/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
|
||||||
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
|
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
|
||||||
AML_TYPE_NAMED_FIELD,
|
AML_TYPE_NAMED_FIELD,
|
||||||
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
|
AML_FIELD),
|
||||||
/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
|
/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
|
||||||
ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT,
|
ACPI_TYPE_LOCAL_BANK_FIELD,
|
||||||
AML_TYPE_NAMED_FIELD,
|
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
|
||||||
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD |
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
AML_DEFER),
|
AML_FIELD | AML_DEFER),
|
||||||
|
|
||||||
/* Internal opcodes that map to invalid AML opcodes */
|
/* Internal opcodes that map to invalid AML opcodes */
|
||||||
|
|
||||||
|
@ -632,7 +636,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
|
||||||
/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
|
/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
|
||||||
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
|
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
|
||||||
AML_TYPE_NAMED_NO_OBJ,
|
AML_TYPE_NAMED_NO_OBJ,
|
||||||
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
|
AML_NSNODE),
|
||||||
|
|
||||||
/* ACPI 3.0 opcodes */
|
/* ACPI 3.0 opcodes */
|
||||||
|
|
||||||
|
|
|
@ -459,8 +459,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
|
||||||
|
|
||||||
/* Executing a control method - additional cleanup */
|
/* Executing a control method - additional cleanup */
|
||||||
|
|
||||||
acpi_ds_terminate_control_method(
|
acpi_ds_terminate_control_method(walk_state->
|
||||||
walk_state->method_desc, walk_state);
|
method_desc,
|
||||||
|
walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ds_delete_walk_state(walk_state);
|
acpi_ds_delete_walk_state(walk_state);
|
||||||
|
|
|
@ -457,6 +457,15 @@ acpi_rs_get_list_length(u8 * aml_buffer,
|
||||||
* Get the number of vendor data bytes
|
* Get the number of vendor data bytes
|
||||||
*/
|
*/
|
||||||
extra_struct_bytes = resource_length;
|
extra_struct_bytes = resource_length;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There is already one byte included in the minimum
|
||||||
|
* descriptor size. If there are extra struct bytes,
|
||||||
|
* subtract one from the count.
|
||||||
|
*/
|
||||||
|
if (extra_struct_bytes) {
|
||||||
|
extra_struct_bytes--;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_RESOURCE_NAME_END_TAG:
|
case ACPI_RESOURCE_NAME_END_TAG:
|
||||||
|
@ -664,8 +673,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
|
||||||
(*sub_object_list)->string.
|
(*sub_object_list)->string.
|
||||||
length + 1);
|
length + 1);
|
||||||
} else {
|
} else {
|
||||||
temp_size_needed +=
|
temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
|
||||||
acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -109,7 +109,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml,
|
||||||
ACPI_ERROR((AE_INFO,
|
ACPI_ERROR((AE_INFO,
|
||||||
"Invalid/unsupported resource descriptor: Type 0x%2.2X",
|
"Invalid/unsupported resource descriptor: Type 0x%2.2X",
|
||||||
resource_index));
|
resource_index));
|
||||||
return (AE_AML_INVALID_RESOURCE_TYPE);
|
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the AML byte stream resource to a local resource struct */
|
/* Convert the AML byte stream resource to a local resource struct */
|
||||||
|
@ -200,7 +200,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
|
||||||
ACPI_ERROR((AE_INFO,
|
ACPI_ERROR((AE_INFO,
|
||||||
"Invalid/unsupported resource descriptor: Type 0x%2.2X",
|
"Invalid/unsupported resource descriptor: Type 0x%2.2X",
|
||||||
resource->type));
|
resource->type));
|
||||||
return (AE_AML_INVALID_RESOURCE_TYPE);
|
return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_rs_convert_resource_to_aml(resource,
|
status = acpi_rs_convert_resource_to_aml(resource,
|
||||||
|
|
|
@ -77,7 +77,7 @@ acpi_tb_find_table(char *signature,
|
||||||
/* Normalize the input strings */
|
/* Normalize the input strings */
|
||||||
|
|
||||||
ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
|
ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
|
||||||
ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE);
|
ACPI_MOVE_NAME(header.signature, signature);
|
||||||
ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
|
ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
|
||||||
ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
|
ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,8 @@ void acpi_tb_terminate(void)
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
||||||
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
|
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
|
||||||
|
|
||||||
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -354,7 +354,7 @@ u8 acpi_tb_checksum(u8 *buffer, u32 length)
|
||||||
sum = (u8) (sum + *(buffer++));
|
sum = (u8) (sum + *(buffer++));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sum;
|
return (sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -236,7 +236,7 @@ acpi_get_table_header(char *signature,
|
||||||
sizeof(struct
|
sizeof(struct
|
||||||
acpi_table_header));
|
acpi_table_header));
|
||||||
if (!header) {
|
if (!header) {
|
||||||
return AE_NO_MEMORY;
|
return (AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
ACPI_MEMCPY(out_table_header, header,
|
ACPI_MEMCPY(out_table_header, header,
|
||||||
sizeof(struct acpi_table_header));
|
sizeof(struct acpi_table_header));
|
||||||
|
@ -244,7 +244,7 @@ acpi_get_table_header(char *signature,
|
||||||
sizeof(struct
|
sizeof(struct
|
||||||
acpi_table_header));
|
acpi_table_header));
|
||||||
} else {
|
} else {
|
||||||
return AE_NOT_FOUND;
|
return (AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ACPI_MEMCPY(out_table_header,
|
ACPI_MEMCPY(out_table_header,
|
||||||
|
|
|
@ -211,7 +211,7 @@ static acpi_status acpi_tb_load_namespace(void)
|
||||||
* DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
|
* DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
|
||||||
* be a valid ACPI table with a valid ACPI table header.
|
* be a valid ACPI table with a valid ACPI table header.
|
||||||
* Note1: Mainly intended to support hotplug addition of SSDTs.
|
* Note1: Mainly intended to support hotplug addition of SSDTs.
|
||||||
* Note2: Does not copy the incoming table. User is reponsible
|
* Note2: Does not copy the incoming table. User is responsible
|
||||||
* to ensure that the table is not deleted or unmapped.
|
* to ensure that the table is not deleted or unmapped.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
|
@ -67,7 +67,6 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
|
||||||
|
|
||||||
static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
|
static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_ENTRY();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The signature and checksum must both be correct
|
* The signature and checksum must both be correct
|
||||||
|
|
323
drivers/acpi/acpica/utcache.c
Normal file
323
drivers/acpi/acpica/utcache.c
Normal file
|
@ -0,0 +1,323 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Module Name: utcache - local cache allocation routines
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2000 - 2012, 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_UTILITIES
|
||||||
|
ACPI_MODULE_NAME("utcache")
|
||||||
|
|
||||||
|
#ifdef ACPI_USE_LOCAL_CACHE
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_os_create_cache
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache_name - Ascii name for the cache
|
||||||
|
* object_size - Size of each cached object
|
||||||
|
* max_depth - Maximum depth of the cache (in objects)
|
||||||
|
* return_cache - Where the new cache object is returned
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Create a cache object
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
acpi_status
|
||||||
|
acpi_os_create_cache(char *cache_name,
|
||||||
|
u16 object_size,
|
||||||
|
u16 max_depth, struct acpi_memory_list ** return_cache)
|
||||||
|
{
|
||||||
|
struct acpi_memory_list *cache;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
if (!cache_name || !return_cache || (object_size < 16)) {
|
||||||
|
return (AE_BAD_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the cache object */
|
||||||
|
|
||||||
|
cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
|
||||||
|
if (!cache) {
|
||||||
|
return (AE_NO_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Populate the cache object and return it */
|
||||||
|
|
||||||
|
ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
|
||||||
|
cache->link_offset = 8;
|
||||||
|
cache->list_name = cache_name;
|
||||||
|
cache->object_size = object_size;
|
||||||
|
cache->max_depth = max_depth;
|
||||||
|
|
||||||
|
*return_cache = cache;
|
||||||
|
return (AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_os_purge_cache
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache - Handle to cache object
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Free all objects within the requested cache.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
|
||||||
|
{
|
||||||
|
char *next;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
if (!cache) {
|
||||||
|
return (AE_BAD_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Walk the list of objects in this cache */
|
||||||
|
|
||||||
|
while (cache->list_head) {
|
||||||
|
|
||||||
|
/* Delete and unlink one cached state object */
|
||||||
|
|
||||||
|
next = *(ACPI_CAST_INDIRECT_PTR(char,
|
||||||
|
&(((char *)cache->
|
||||||
|
list_head)[cache->
|
||||||
|
link_offset])));
|
||||||
|
ACPI_FREE(cache->list_head);
|
||||||
|
|
||||||
|
cache->list_head = next;
|
||||||
|
cache->current_depth--;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
|
||||||
|
return (AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_os_delete_cache
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache - Handle to cache object
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Free all objects within the requested cache and delete the
|
||||||
|
* cache object.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_status acpi_os_delete_cache(struct acpi_memory_list * cache)
|
||||||
|
{
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
/* Purge all objects in the cache */
|
||||||
|
|
||||||
|
status = acpi_os_purge_cache(cache);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now we can delete the cache object */
|
||||||
|
|
||||||
|
acpi_os_free(cache);
|
||||||
|
return (AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_os_release_object
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache - Handle to cache object
|
||||||
|
* object - The object to be released
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Release an object to the specified cache. If cache is full,
|
||||||
|
* the object is deleted.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_status
|
||||||
|
acpi_os_release_object(struct acpi_memory_list * cache, void *object)
|
||||||
|
{
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
if (!cache || !object) {
|
||||||
|
return (AE_BAD_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If cache is full, just free this object */
|
||||||
|
|
||||||
|
if (cache->current_depth >= cache->max_depth) {
|
||||||
|
ACPI_FREE(object);
|
||||||
|
ACPI_MEM_TRACKING(cache->total_freed++);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise put this object back into the cache */
|
||||||
|
|
||||||
|
else {
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mark the object as cached */
|
||||||
|
|
||||||
|
ACPI_MEMSET(object, 0xCA, cache->object_size);
|
||||||
|
ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
|
||||||
|
|
||||||
|
/* Put the object at the head of the cache list */
|
||||||
|
|
||||||
|
*(ACPI_CAST_INDIRECT_PTR(char,
|
||||||
|
&(((char *)object)[cache->
|
||||||
|
link_offset]))) =
|
||||||
|
cache->list_head;
|
||||||
|
cache->list_head = object;
|
||||||
|
cache->current_depth++;
|
||||||
|
|
||||||
|
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_os_acquire_object
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache - Handle to cache object
|
||||||
|
*
|
||||||
|
* RETURN: the acquired object. NULL on error
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Get an object from the specified cache. If cache is empty,
|
||||||
|
* the object is allocated.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void *acpi_os_acquire_object(struct acpi_memory_list *cache)
|
||||||
|
{
|
||||||
|
acpi_status status;
|
||||||
|
void *object;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME(os_acquire_object);
|
||||||
|
|
||||||
|
if (!cache) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_CACHES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_MEM_TRACKING(cache->requests++);
|
||||||
|
|
||||||
|
/* Check the cache first */
|
||||||
|
|
||||||
|
if (cache->list_head) {
|
||||||
|
|
||||||
|
/* There is an object available, use it */
|
||||||
|
|
||||||
|
object = cache->list_head;
|
||||||
|
cache->list_head = *(ACPI_CAST_INDIRECT_PTR(char,
|
||||||
|
&(((char *)
|
||||||
|
object)[cache->
|
||||||
|
link_offset])));
|
||||||
|
|
||||||
|
cache->current_depth--;
|
||||||
|
|
||||||
|
ACPI_MEM_TRACKING(cache->hits++);
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
|
"Object %p from %s cache\n", object,
|
||||||
|
cache->list_name));
|
||||||
|
|
||||||
|
status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clear (zero) the previously used Object */
|
||||||
|
|
||||||
|
ACPI_MEMSET(object, 0, cache->object_size);
|
||||||
|
} else {
|
||||||
|
/* The cache is empty, create a new object */
|
||||||
|
|
||||||
|
ACPI_MEM_TRACKING(cache->total_allocated++);
|
||||||
|
|
||||||
|
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
||||||
|
if ((cache->total_allocated - cache->total_freed) >
|
||||||
|
cache->max_occupied) {
|
||||||
|
cache->max_occupied =
|
||||||
|
cache->total_allocated - cache->total_freed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
|
||||||
|
|
||||||
|
status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
object = ACPI_ALLOCATE_ZEROED(cache->object_size);
|
||||||
|
if (!object) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (object);
|
||||||
|
}
|
||||||
|
#endif /* ACPI_USE_LOCAL_CACHE */
|
749
drivers/acpi/acpica/utclib.c
Normal file
749
drivers/acpi/acpica/utclib.c
Normal file
|
@ -0,0 +1,749 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Module Name: cmclib - Local implementation of C library functions
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2000 - 2012, 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"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These implementations of standard C Library routines can optionally be
|
||||||
|
* used if a C library is not available. In general, they are less efficient
|
||||||
|
* than an inline or assembly implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _COMPONENT ACPI_UTILITIES
|
||||||
|
ACPI_MODULE_NAME("cmclib")
|
||||||
|
|
||||||
|
#ifndef ACPI_USE_SYSTEM_CLIBRARY
|
||||||
|
#define NEGATIVE 1
|
||||||
|
#define POSITIVE 0
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_memcmp (memcmp)
|
||||||
|
*
|
||||||
|
* PARAMETERS: buffer1 - First Buffer
|
||||||
|
* buffer2 - Second Buffer
|
||||||
|
* count - Maximum # of bytes to compare
|
||||||
|
*
|
||||||
|
* RETURN: Index where Buffers mismatched, or 0 if Buffers matched
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Compare two Buffers, with a maximum length
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count)
|
||||||
|
{
|
||||||
|
|
||||||
|
return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 -
|
||||||
|
(unsigned char)*buffer2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_memcpy (memcpy)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dest - Target of the copy
|
||||||
|
* src - Source buffer to copy
|
||||||
|
* count - Number of bytes to copy
|
||||||
|
*
|
||||||
|
* RETURN: Dest
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Copy arbitrary bytes of memory
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count)
|
||||||
|
{
|
||||||
|
char *new = (char *)dest;
|
||||||
|
char *old = (char *)src;
|
||||||
|
|
||||||
|
while (count) {
|
||||||
|
*new = *old;
|
||||||
|
new++;
|
||||||
|
old++;
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_memset (memset)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dest - Buffer to set
|
||||||
|
* value - Value to set each byte of memory
|
||||||
|
* count - Number of bytes to set
|
||||||
|
*
|
||||||
|
* RETURN: Dest
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Initialize a buffer to a known value.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void *acpi_ut_memset(void *dest, u8 value, acpi_size count)
|
||||||
|
{
|
||||||
|
char *new = (char *)dest;
|
||||||
|
|
||||||
|
while (count) {
|
||||||
|
*new = (char)value;
|
||||||
|
new++;
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strlen (strlen)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string - Null terminated string
|
||||||
|
*
|
||||||
|
* RETURN: Length
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Returns the length of the input string
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_size acpi_ut_strlen(const char *string)
|
||||||
|
{
|
||||||
|
u32 length = 0;
|
||||||
|
|
||||||
|
/* Count the string until a null is encountered */
|
||||||
|
|
||||||
|
while (*string) {
|
||||||
|
length++;
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strcpy (strcpy)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dst_string - Target of the copy
|
||||||
|
* src_string - The source string to copy
|
||||||
|
*
|
||||||
|
* RETURN: dst_string
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Copy a null terminated string
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strcpy(char *dst_string, const char *src_string)
|
||||||
|
{
|
||||||
|
char *string = dst_string;
|
||||||
|
|
||||||
|
/* Move bytes brute force */
|
||||||
|
|
||||||
|
while (*src_string) {
|
||||||
|
*string = *src_string;
|
||||||
|
|
||||||
|
string++;
|
||||||
|
src_string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Null terminate */
|
||||||
|
|
||||||
|
*string = 0;
|
||||||
|
return (dst_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strncpy (strncpy)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dst_string - Target of the copy
|
||||||
|
* src_string - The source string to copy
|
||||||
|
* count - Maximum # of bytes to copy
|
||||||
|
*
|
||||||
|
* RETURN: dst_string
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Copy a null terminated string, with a maximum length
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count)
|
||||||
|
{
|
||||||
|
char *string = dst_string;
|
||||||
|
|
||||||
|
/* Copy the string */
|
||||||
|
|
||||||
|
for (string = dst_string;
|
||||||
|
count && (count--, (*string++ = *src_string++));) {;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pad with nulls if necessary */
|
||||||
|
|
||||||
|
while (count--) {
|
||||||
|
*string = 0;
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return original pointer */
|
||||||
|
|
||||||
|
return (dst_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strcmp (strcmp)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string1 - First string
|
||||||
|
* string2 - Second string
|
||||||
|
*
|
||||||
|
* RETURN: Index where strings mismatched, or 0 if strings matched
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Compare two null terminated strings
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int acpi_ut_strcmp(const char *string1, const char *string2)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (; (*string1 == *string2); string2++) {
|
||||||
|
if (!*string1++) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((unsigned char)*string1 - (unsigned char)*string2);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
||||||
|
/* Not used at this time */
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strchr (strchr)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string - Search string
|
||||||
|
* ch - character to search for
|
||||||
|
*
|
||||||
|
* RETURN: Ptr to char or NULL if not found
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Search a string for a character
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strchr(const char *string, int ch)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (; (*string); string++) {
|
||||||
|
if ((*string) == (char)ch) {
|
||||||
|
return ((char *)string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strncmp (strncmp)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string1 - First string
|
||||||
|
* string2 - Second string
|
||||||
|
* count - Maximum # of bytes to compare
|
||||||
|
*
|
||||||
|
* RETURN: Index where strings mismatched, or 0 if strings matched
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Compare two null terminated strings, with a maximum length
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (; count-- && (*string1 == *string2); string2++) {
|
||||||
|
if (!*string1++) {
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 -
|
||||||
|
(unsigned char)*string2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strcat (Strcat)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dst_string - Target of the copy
|
||||||
|
* src_string - The source string to copy
|
||||||
|
*
|
||||||
|
* RETURN: dst_string
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Append a null terminated string to a null terminated string
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strcat(char *dst_string, const char *src_string)
|
||||||
|
{
|
||||||
|
char *string;
|
||||||
|
|
||||||
|
/* Find end of the destination string */
|
||||||
|
|
||||||
|
for (string = dst_string; *string++;) {;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Concatenate the string */
|
||||||
|
|
||||||
|
for (--string; (*string++ = *src_string++);) {;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dst_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strncat (strncat)
|
||||||
|
*
|
||||||
|
* PARAMETERS: dst_string - Target of the copy
|
||||||
|
* src_string - The source string to copy
|
||||||
|
* count - Maximum # of bytes to copy
|
||||||
|
*
|
||||||
|
* RETURN: dst_string
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Append a null terminated string to a null terminated string,
|
||||||
|
* with a maximum count.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count)
|
||||||
|
{
|
||||||
|
char *string;
|
||||||
|
|
||||||
|
if (count) {
|
||||||
|
|
||||||
|
/* Find end of the destination string */
|
||||||
|
|
||||||
|
for (string = dst_string; *string++;) {;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Concatenate the string */
|
||||||
|
|
||||||
|
for (--string; (*string++ = *src_string++) && --count;) {;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Null terminate if necessary */
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
*string = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (dst_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strstr (strstr)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string1 - Target string
|
||||||
|
* string2 - Substring to search for
|
||||||
|
*
|
||||||
|
* RETURN: Where substring match starts, Null if no match found
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Checks if String2 occurs in String1. This is not really a
|
||||||
|
* full implementation of strstr, only sufficient for command
|
||||||
|
* matching
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
char *acpi_ut_strstr(char *string1, char *string2)
|
||||||
|
{
|
||||||
|
char *string;
|
||||||
|
|
||||||
|
if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Walk entire string, comparing the letters */
|
||||||
|
|
||||||
|
for (string = string1; *string2;) {
|
||||||
|
if (*string2 != *string) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
string2++;
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (string1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strtoul (strtoul)
|
||||||
|
*
|
||||||
|
* PARAMETERS: string - Null terminated string
|
||||||
|
* terminater - Where a pointer to the terminating byte is
|
||||||
|
* returned
|
||||||
|
* base - Radix of the string
|
||||||
|
*
|
||||||
|
* RETURN: Converted value
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Convert a string into a 32-bit unsigned value.
|
||||||
|
* Note: use acpi_ut_strtoul64 for 64-bit integers.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base)
|
||||||
|
{
|
||||||
|
u32 converted = 0;
|
||||||
|
u32 index;
|
||||||
|
u32 sign;
|
||||||
|
const char *string_start;
|
||||||
|
u32 return_value = 0;
|
||||||
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save the value of the pointer to the buffer's first
|
||||||
|
* character, save the current errno value, and then
|
||||||
|
* skip over any white space in the buffer:
|
||||||
|
*/
|
||||||
|
string_start = string;
|
||||||
|
while (ACPI_IS_SPACE(*string) || *string == '\t') {
|
||||||
|
++string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The buffer may contain an optional plus or minus sign.
|
||||||
|
* If it does, then skip over it but remember what is was:
|
||||||
|
*/
|
||||||
|
if (*string == '-') {
|
||||||
|
sign = NEGATIVE;
|
||||||
|
++string;
|
||||||
|
} else if (*string == '+') {
|
||||||
|
++string;
|
||||||
|
sign = POSITIVE;
|
||||||
|
} else {
|
||||||
|
sign = POSITIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the input parameter Base is zero, then we need to
|
||||||
|
* determine if it is octal, decimal, or hexadecimal:
|
||||||
|
*/
|
||||||
|
if (base == 0) {
|
||||||
|
if (*string == '0') {
|
||||||
|
if (acpi_ut_to_lower(*(++string)) == 'x') {
|
||||||
|
base = 16;
|
||||||
|
++string;
|
||||||
|
} else {
|
||||||
|
base = 8;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
base = 10;
|
||||||
|
}
|
||||||
|
} else if (base < 2 || base > 36) {
|
||||||
|
/*
|
||||||
|
* The specified Base parameter is not in the domain of
|
||||||
|
* this function:
|
||||||
|
*/
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For octal and hexadecimal bases, skip over the leading
|
||||||
|
* 0 or 0x, if they are present.
|
||||||
|
*/
|
||||||
|
if (base == 8 && *string == '0') {
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base == 16 &&
|
||||||
|
*string == '0' && acpi_ut_to_lower(*(++string)) == 'x') {
|
||||||
|
string++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main loop: convert the string to an unsigned long:
|
||||||
|
*/
|
||||||
|
while (*string) {
|
||||||
|
if (ACPI_IS_DIGIT(*string)) {
|
||||||
|
index = (u32)((u8)*string - '0');
|
||||||
|
} else {
|
||||||
|
index = (u32)acpi_ut_to_upper(*string);
|
||||||
|
if (ACPI_IS_UPPER(index)) {
|
||||||
|
index = index - 'A' + 10;
|
||||||
|
} else {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index >= base) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to see if value is out of range:
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) {
|
||||||
|
status = AE_ERROR;
|
||||||
|
return_value = 0; /* reset */
|
||||||
|
} else {
|
||||||
|
return_value *= base;
|
||||||
|
return_value += index;
|
||||||
|
converted = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
++string;
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
/*
|
||||||
|
* If appropriate, update the caller's pointer to the next
|
||||||
|
* unconverted character in the buffer.
|
||||||
|
*/
|
||||||
|
if (terminator) {
|
||||||
|
if (converted == 0 && return_value == 0 && string != NULL) {
|
||||||
|
*terminator = (char *)string_start;
|
||||||
|
} else {
|
||||||
|
*terminator = (char *)string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == AE_ERROR) {
|
||||||
|
return_value = ACPI_UINT32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a minus sign was present, then "the conversion is negated":
|
||||||
|
*/
|
||||||
|
if (sign == NEGATIVE) {
|
||||||
|
return_value = (ACPI_UINT32_MAX - return_value) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (return_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_to_upper (TOUPPER)
|
||||||
|
*
|
||||||
|
* PARAMETERS: c - Character to convert
|
||||||
|
*
|
||||||
|
* RETURN: Converted character as an int
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Convert character to uppercase
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int acpi_ut_to_upper(int c)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_to_lower (TOLOWER)
|
||||||
|
*
|
||||||
|
* PARAMETERS: c - Character to convert
|
||||||
|
*
|
||||||
|
* RETURN: Converted character as an int
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Convert character to lowercase
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int acpi_ut_to_lower(int c)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: is* functions
|
||||||
|
*
|
||||||
|
* DESCRIPTION: is* functions use the ctype table below
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
const u8 _acpi_ctype[257] = {
|
||||||
|
_ACPI_CN, /* 0x00 0 NUL */
|
||||||
|
_ACPI_CN, /* 0x01 1 SOH */
|
||||||
|
_ACPI_CN, /* 0x02 2 STX */
|
||||||
|
_ACPI_CN, /* 0x03 3 ETX */
|
||||||
|
_ACPI_CN, /* 0x04 4 EOT */
|
||||||
|
_ACPI_CN, /* 0x05 5 ENQ */
|
||||||
|
_ACPI_CN, /* 0x06 6 ACK */
|
||||||
|
_ACPI_CN, /* 0x07 7 BEL */
|
||||||
|
_ACPI_CN, /* 0x08 8 BS */
|
||||||
|
_ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */
|
||||||
|
_ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */
|
||||||
|
_ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */
|
||||||
|
_ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */
|
||||||
|
_ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */
|
||||||
|
_ACPI_CN, /* 0x0E 14 SO */
|
||||||
|
_ACPI_CN, /* 0x0F 15 SI */
|
||||||
|
_ACPI_CN, /* 0x10 16 DLE */
|
||||||
|
_ACPI_CN, /* 0x11 17 DC1 */
|
||||||
|
_ACPI_CN, /* 0x12 18 DC2 */
|
||||||
|
_ACPI_CN, /* 0x13 19 DC3 */
|
||||||
|
_ACPI_CN, /* 0x14 20 DC4 */
|
||||||
|
_ACPI_CN, /* 0x15 21 NAK */
|
||||||
|
_ACPI_CN, /* 0x16 22 SYN */
|
||||||
|
_ACPI_CN, /* 0x17 23 ETB */
|
||||||
|
_ACPI_CN, /* 0x18 24 CAN */
|
||||||
|
_ACPI_CN, /* 0x19 25 EM */
|
||||||
|
_ACPI_CN, /* 0x1A 26 SUB */
|
||||||
|
_ACPI_CN, /* 0x1B 27 ESC */
|
||||||
|
_ACPI_CN, /* 0x1C 28 FS */
|
||||||
|
_ACPI_CN, /* 0x1D 29 GS */
|
||||||
|
_ACPI_CN, /* 0x1E 30 RS */
|
||||||
|
_ACPI_CN, /* 0x1F 31 US */
|
||||||
|
_ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */
|
||||||
|
_ACPI_PU, /* 0x21 33 '!' */
|
||||||
|
_ACPI_PU, /* 0x22 34 '"' */
|
||||||
|
_ACPI_PU, /* 0x23 35 '#' */
|
||||||
|
_ACPI_PU, /* 0x24 36 '$' */
|
||||||
|
_ACPI_PU, /* 0x25 37 '%' */
|
||||||
|
_ACPI_PU, /* 0x26 38 '&' */
|
||||||
|
_ACPI_PU, /* 0x27 39 ''' */
|
||||||
|
_ACPI_PU, /* 0x28 40 '(' */
|
||||||
|
_ACPI_PU, /* 0x29 41 ')' */
|
||||||
|
_ACPI_PU, /* 0x2A 42 '*' */
|
||||||
|
_ACPI_PU, /* 0x2B 43 '+' */
|
||||||
|
_ACPI_PU, /* 0x2C 44 ',' */
|
||||||
|
_ACPI_PU, /* 0x2D 45 '-' */
|
||||||
|
_ACPI_PU, /* 0x2E 46 '.' */
|
||||||
|
_ACPI_PU, /* 0x2F 47 '/' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */
|
||||||
|
_ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */
|
||||||
|
_ACPI_PU, /* 0x3A 58 ':' */
|
||||||
|
_ACPI_PU, /* 0x3B 59 ';' */
|
||||||
|
_ACPI_PU, /* 0x3C 60 '<' */
|
||||||
|
_ACPI_PU, /* 0x3D 61 '=' */
|
||||||
|
_ACPI_PU, /* 0x3E 62 '>' */
|
||||||
|
_ACPI_PU, /* 0x3F 63 '?' */
|
||||||
|
_ACPI_PU, /* 0x40 64 '@' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */
|
||||||
|
_ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */
|
||||||
|
_ACPI_UP, /* 0x47 71 'G' */
|
||||||
|
_ACPI_UP, /* 0x48 72 'H' */
|
||||||
|
_ACPI_UP, /* 0x49 73 'I' */
|
||||||
|
_ACPI_UP, /* 0x4A 74 'J' */
|
||||||
|
_ACPI_UP, /* 0x4B 75 'K' */
|
||||||
|
_ACPI_UP, /* 0x4C 76 'L' */
|
||||||
|
_ACPI_UP, /* 0x4D 77 'M' */
|
||||||
|
_ACPI_UP, /* 0x4E 78 'N' */
|
||||||
|
_ACPI_UP, /* 0x4F 79 'O' */
|
||||||
|
_ACPI_UP, /* 0x50 80 'P' */
|
||||||
|
_ACPI_UP, /* 0x51 81 'Q' */
|
||||||
|
_ACPI_UP, /* 0x52 82 'R' */
|
||||||
|
_ACPI_UP, /* 0x53 83 'S' */
|
||||||
|
_ACPI_UP, /* 0x54 84 'T' */
|
||||||
|
_ACPI_UP, /* 0x55 85 'U' */
|
||||||
|
_ACPI_UP, /* 0x56 86 'V' */
|
||||||
|
_ACPI_UP, /* 0x57 87 'W' */
|
||||||
|
_ACPI_UP, /* 0x58 88 'X' */
|
||||||
|
_ACPI_UP, /* 0x59 89 'Y' */
|
||||||
|
_ACPI_UP, /* 0x5A 90 'Z' */
|
||||||
|
_ACPI_PU, /* 0x5B 91 '[' */
|
||||||
|
_ACPI_PU, /* 0x5C 92 '\' */
|
||||||
|
_ACPI_PU, /* 0x5D 93 ']' */
|
||||||
|
_ACPI_PU, /* 0x5E 94 '^' */
|
||||||
|
_ACPI_PU, /* 0x5F 95 '_' */
|
||||||
|
_ACPI_PU, /* 0x60 96 '`' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */
|
||||||
|
_ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */
|
||||||
|
_ACPI_LO, /* 0x67 103 'g' */
|
||||||
|
_ACPI_LO, /* 0x68 104 'h' */
|
||||||
|
_ACPI_LO, /* 0x69 105 'i' */
|
||||||
|
_ACPI_LO, /* 0x6A 106 'j' */
|
||||||
|
_ACPI_LO, /* 0x6B 107 'k' */
|
||||||
|
_ACPI_LO, /* 0x6C 108 'l' */
|
||||||
|
_ACPI_LO, /* 0x6D 109 'm' */
|
||||||
|
_ACPI_LO, /* 0x6E 110 'n' */
|
||||||
|
_ACPI_LO, /* 0x6F 111 'o' */
|
||||||
|
_ACPI_LO, /* 0x70 112 'p' */
|
||||||
|
_ACPI_LO, /* 0x71 113 'q' */
|
||||||
|
_ACPI_LO, /* 0x72 114 'r' */
|
||||||
|
_ACPI_LO, /* 0x73 115 's' */
|
||||||
|
_ACPI_LO, /* 0x74 116 't' */
|
||||||
|
_ACPI_LO, /* 0x75 117 'u' */
|
||||||
|
_ACPI_LO, /* 0x76 118 'v' */
|
||||||
|
_ACPI_LO, /* 0x77 119 'w' */
|
||||||
|
_ACPI_LO, /* 0x78 120 'x' */
|
||||||
|
_ACPI_LO, /* 0x79 121 'y' */
|
||||||
|
_ACPI_LO, /* 0x7A 122 'z' */
|
||||||
|
_ACPI_PU, /* 0x7B 123 '{' */
|
||||||
|
_ACPI_PU, /* 0x7C 124 '|' */
|
||||||
|
_ACPI_PU, /* 0x7D 125 '}' */
|
||||||
|
_ACPI_PU, /* 0x7E 126 '~' */
|
||||||
|
_ACPI_CN, /* 0x7F 127 DEL */
|
||||||
|
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */
|
||||||
|
0 /* 0x100 */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
|
|
@ -47,8 +47,9 @@
|
||||||
|
|
||||||
#define _COMPONENT ACPI_UTILITIES
|
#define _COMPONENT ACPI_UTILITIES
|
||||||
ACPI_MODULE_NAME("utdebug")
|
ACPI_MODULE_NAME("utdebug")
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
static acpi_thread_id acpi_gbl_prev_thread_id;
|
static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF;
|
||||||
static char *acpi_gbl_fn_entry_str = "----Entry";
|
static char *acpi_gbl_fn_entry_str = "----Entry";
|
||||||
static char *acpi_gbl_fn_exit_str = "----Exit-";
|
static char *acpi_gbl_fn_exit_str = "----Exit-";
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ void acpi_ut_track_stack_ptr(void)
|
||||||
* RETURN: Updated pointer to the function name
|
* RETURN: Updated pointer to the function name
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
|
* DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
|
||||||
* This allows compiler macros such as __func__ to be used
|
* This allows compiler macros such as __FUNCTION__ to be used
|
||||||
* with no change to the debug output.
|
* with no change to the debug output.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -299,6 +300,7 @@ acpi_ut_trace_ptr(u32 line_number,
|
||||||
const char *function_name,
|
const char *function_name,
|
||||||
const char *module_name, u32 component_id, void *pointer)
|
const char *module_name, u32 component_id, void *pointer)
|
||||||
{
|
{
|
||||||
|
|
||||||
acpi_gbl_nesting_level++;
|
acpi_gbl_nesting_level++;
|
||||||
acpi_ut_track_stack_ptr();
|
acpi_ut_track_stack_ptr();
|
||||||
|
|
||||||
|
@ -511,7 +513,7 @@ acpi_ut_ptr_exit(u32 line_number,
|
||||||
* PARAMETERS: buffer - Buffer to dump
|
* PARAMETERS: buffer - Buffer to dump
|
||||||
* count - Amount to dump, in bytes
|
* count - Amount to dump, in bytes
|
||||||
* display - BYTE, WORD, DWORD, or QWORD display
|
* display - BYTE, WORD, DWORD, or QWORD display
|
||||||
* component_ID - Caller's component ID
|
* offset - Beginning buffer offset (display only)
|
||||||
*
|
*
|
||||||
* RETURN: None
|
* RETURN: None
|
||||||
*
|
*
|
||||||
|
@ -519,7 +521,7 @@ acpi_ut_ptr_exit(u32 line_number,
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
|
void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
|
||||||
{
|
{
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
u32 j;
|
u32 j;
|
||||||
|
@ -541,7 +543,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
|
||||||
|
|
||||||
/* Print current offset */
|
/* Print current offset */
|
||||||
|
|
||||||
acpi_os_printf("%6.4X: ", i);
|
acpi_os_printf("%6.4X: ", (base_offset + i));
|
||||||
|
|
||||||
/* Print 16 hex chars */
|
/* Print 16 hex chars */
|
||||||
|
|
||||||
|
@ -623,7 +625,7 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ut_dump_buffer
|
* FUNCTION: acpi_ut_debug_dump_buffer
|
||||||
*
|
*
|
||||||
* PARAMETERS: buffer - Buffer to dump
|
* PARAMETERS: buffer - Buffer to dump
|
||||||
* count - Amount to dump, in bytes
|
* count - Amount to dump, in bytes
|
||||||
|
@ -636,7 +638,8 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
|
void
|
||||||
|
acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Only dump the buffer if tracing is enabled */
|
/* Only dump the buffer if tracing is enabled */
|
||||||
|
@ -646,5 +649,5 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ut_dump_buffer2(buffer, count, display);
|
acpi_ut_dump_buffer(buffer, count, display, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,10 @@ ACPI_MODULE_NAME("utids")
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id **return_id)
|
struct acpi_pnp_device_id **return_id)
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpica_device_id *hid;
|
struct acpi_pnp_device_id *hid;
|
||||||
u32 length;
|
u32 length;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
@ -94,16 +94,17 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
|
||||||
/* Allocate a buffer for the HID */
|
/* Allocate a buffer for the HID */
|
||||||
|
|
||||||
hid =
|
hid =
|
||||||
ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
|
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
|
||||||
(acpi_size) length);
|
(acpi_size) length);
|
||||||
if (!hid) {
|
if (!hid) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Area for the string starts after DEVICE_ID struct */
|
/* Area for the string starts after PNP_DEVICE_ID struct */
|
||||||
|
|
||||||
hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id));
|
hid->string =
|
||||||
|
ACPI_ADD_PTR(char, hid, sizeof(struct acpi_pnp_device_id));
|
||||||
|
|
||||||
/* Convert EISAID to a string or simply copy existing string */
|
/* Convert EISAID to a string or simply copy existing string */
|
||||||
|
|
||||||
|
@ -124,6 +125,73 @@ cleanup:
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_execute_SUB
|
||||||
|
*
|
||||||
|
* PARAMETERS: device_node - Node for the device
|
||||||
|
* return_id - Where the _SUB is returned
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Executes the _SUB control method that returns the subsystem
|
||||||
|
* ID of the device. The _SUB value is always a string containing
|
||||||
|
* either a valid PNP or ACPI ID.
|
||||||
|
*
|
||||||
|
* NOTE: Internal function, no parameter validation
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_status
|
||||||
|
acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
|
||||||
|
struct acpi_pnp_device_id **return_id)
|
||||||
|
{
|
||||||
|
union acpi_operand_object *obj_desc;
|
||||||
|
struct acpi_pnp_device_id *sub;
|
||||||
|
u32 length;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE(ut_execute_SUB);
|
||||||
|
|
||||||
|
status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB,
|
||||||
|
ACPI_BTYPE_STRING, &obj_desc);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the size of the String to be returned, includes null terminator */
|
||||||
|
|
||||||
|
length = obj_desc->string.length + 1;
|
||||||
|
|
||||||
|
/* Allocate a buffer for the SUB */
|
||||||
|
|
||||||
|
sub =
|
||||||
|
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
|
||||||
|
(acpi_size) length);
|
||||||
|
if (!sub) {
|
||||||
|
status = AE_NO_MEMORY;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Area for the string starts after PNP_DEVICE_ID struct */
|
||||||
|
|
||||||
|
sub->string =
|
||||||
|
ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id));
|
||||||
|
|
||||||
|
/* Simply copy existing string */
|
||||||
|
|
||||||
|
ACPI_STRCPY(sub->string, obj_desc->string.pointer);
|
||||||
|
sub->length = length;
|
||||||
|
*return_id = sub;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
|
||||||
|
/* On exit, we must delete the return object */
|
||||||
|
|
||||||
|
acpi_ut_remove_reference(obj_desc);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ut_execute_UID
|
* FUNCTION: acpi_ut_execute_UID
|
||||||
|
@ -144,10 +212,10 @@ cleanup:
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id **return_id)
|
struct acpi_pnp_device_id **return_id)
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpica_device_id *uid;
|
struct acpi_pnp_device_id *uid;
|
||||||
u32 length;
|
u32 length;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
@ -171,16 +239,17 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
|
||||||
/* Allocate a buffer for the UID */
|
/* Allocate a buffer for the UID */
|
||||||
|
|
||||||
uid =
|
uid =
|
||||||
ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) +
|
ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
|
||||||
(acpi_size) length);
|
(acpi_size) length);
|
||||||
if (!uid) {
|
if (!uid) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Area for the string starts after DEVICE_ID struct */
|
/* Area for the string starts after PNP_DEVICE_ID struct */
|
||||||
|
|
||||||
uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id));
|
uid->string =
|
||||||
|
ACPI_ADD_PTR(char, uid, sizeof(struct acpi_pnp_device_id));
|
||||||
|
|
||||||
/* Convert an Integer to string, or just copy an existing string */
|
/* Convert an Integer to string, or just copy an existing string */
|
||||||
|
|
||||||
|
@ -226,11 +295,11 @@ cleanup:
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
||||||
struct acpica_device_id_list **return_cid_list)
|
struct acpi_pnp_device_id_list **return_cid_list)
|
||||||
{
|
{
|
||||||
union acpi_operand_object **cid_objects;
|
union acpi_operand_object **cid_objects;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpica_device_id_list *cid_list;
|
struct acpi_pnp_device_id_list *cid_list;
|
||||||
char *next_id_string;
|
char *next_id_string;
|
||||||
u32 string_area_size;
|
u32 string_area_size;
|
||||||
u32 length;
|
u32 length;
|
||||||
|
@ -288,11 +357,12 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
||||||
/*
|
/*
|
||||||
* Now that we know the length of the CIDs, allocate return buffer:
|
* Now that we know the length of the CIDs, allocate return buffer:
|
||||||
* 1) Size of the base structure +
|
* 1) Size of the base structure +
|
||||||
* 2) Size of the CID DEVICE_ID array +
|
* 2) Size of the CID PNP_DEVICE_ID array +
|
||||||
* 3) Size of the actual CID strings
|
* 3) Size of the actual CID strings
|
||||||
*/
|
*/
|
||||||
cid_list_size = sizeof(struct acpica_device_id_list) +
|
cid_list_size = sizeof(struct acpi_pnp_device_id_list) +
|
||||||
((count - 1) * sizeof(struct acpica_device_id)) + string_area_size;
|
((count - 1) * sizeof(struct acpi_pnp_device_id)) +
|
||||||
|
string_area_size;
|
||||||
|
|
||||||
cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
|
cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
|
||||||
if (!cid_list) {
|
if (!cid_list) {
|
||||||
|
@ -300,10 +370,10 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Area for CID strings starts after the CID DEVICE_ID array */
|
/* Area for CID strings starts after the CID PNP_DEVICE_ID array */
|
||||||
|
|
||||||
next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
|
next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
|
||||||
((acpi_size) count * sizeof(struct acpica_device_id));
|
((acpi_size) count * sizeof(struct acpi_pnp_device_id));
|
||||||
|
|
||||||
/* Copy/convert the CIDs to the return buffer */
|
/* Copy/convert the CIDs to the return buffer */
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include "accommon.h"
|
#include "accommon.h"
|
||||||
#include "acnamesp.h"
|
#include "acnamesp.h"
|
||||||
|
@ -201,8 +199,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
|
||||||
*/
|
*/
|
||||||
acpi_gbl_owner_id_mask[j] |= (1 << k);
|
acpi_gbl_owner_id_mask[j] |= (1 << k);
|
||||||
|
|
||||||
acpi_gbl_last_owner_id_index = (u8) j;
|
acpi_gbl_last_owner_id_index = (u8)j;
|
||||||
acpi_gbl_next_owner_id_offset = (u8) (k + 1);
|
acpi_gbl_next_owner_id_offset = (u8)(k + 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Construct encoded ID from the index and bit position
|
* Construct encoded ID from the index and bit position
|
||||||
|
@ -339,6 +337,73 @@ void acpi_ut_strupr(char *src_string)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ACPI_ASL_COMPILER
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_strlwr (strlwr)
|
||||||
|
*
|
||||||
|
* PARAMETERS: src_string - The source string to convert
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Convert string to lowercase
|
||||||
|
*
|
||||||
|
* NOTE: This is not a POSIX function, so it appears here, not in utclib.c
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void acpi_ut_strlwr(char *src_string)
|
||||||
|
{
|
||||||
|
char *string;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
if (!src_string) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Walk entire string, lowercasing the letters */
|
||||||
|
|
||||||
|
for (string = src_string; *string; string++) {
|
||||||
|
*string = (char)ACPI_TOLOWER(*string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_stricmp
|
||||||
|
*
|
||||||
|
* PARAMETERS: string1 - first string to compare
|
||||||
|
* string2 - second string to compare
|
||||||
|
*
|
||||||
|
* RETURN: int that signifies string relationship. Zero means strings
|
||||||
|
* are equal.
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Implementation of the non-ANSI stricmp function (compare
|
||||||
|
* strings with no case sensitivity)
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
int acpi_ut_stricmp(char *string1, char *string2)
|
||||||
|
{
|
||||||
|
int c1;
|
||||||
|
int c2;
|
||||||
|
|
||||||
|
do {
|
||||||
|
c1 = tolower((int)*string1);
|
||||||
|
c2 = tolower((int)*string2);
|
||||||
|
|
||||||
|
string1++;
|
||||||
|
string2++;
|
||||||
|
}
|
||||||
|
while ((c1 == c2) && (c1));
|
||||||
|
|
||||||
|
return (c1 - c2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ut_print_string
|
* FUNCTION: acpi_ut_print_string
|
||||||
|
@ -638,29 +703,59 @@ u8 acpi_ut_valid_acpi_name(u32 name)
|
||||||
* RETURN: Repaired version of the name
|
* RETURN: Repaired version of the name
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
|
* DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
|
||||||
* return the new name.
|
* return the new name. NOTE: the Name parameter must reside in
|
||||||
|
* read/write memory, cannot be a const.
|
||||||
|
*
|
||||||
|
* An ACPI Name must consist of valid ACPI characters. We will repair the name
|
||||||
|
* if necessary because we don't want to abort because of this, but we want
|
||||||
|
* all namespace names to be printable. A warning message is appropriate.
|
||||||
|
*
|
||||||
|
* This issue came up because there are in fact machines that exhibit
|
||||||
|
* this problem, and we want to be able to enable ACPI support for them,
|
||||||
|
* even though there are a few bad names.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_name acpi_ut_repair_name(char *name)
|
void acpi_ut_repair_name(char *name)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
char new_name[ACPI_NAME_SIZE];
|
u8 found_bad_char = FALSE;
|
||||||
|
u32 original_name;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME(ut_repair_name);
|
||||||
|
|
||||||
|
ACPI_MOVE_NAME(&original_name, name);
|
||||||
|
|
||||||
|
/* Check each character in the name */
|
||||||
|
|
||||||
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
||||||
new_name[i] = name[i];
|
if (acpi_ut_valid_acpi_char(name[i], i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace a bad character with something printable, yet technically
|
* Replace a bad character with something printable, yet technically
|
||||||
* still invalid. This prevents any collisions with existing "good"
|
* still invalid. This prevents any collisions with existing "good"
|
||||||
* names in the namespace.
|
* names in the namespace.
|
||||||
*/
|
*/
|
||||||
if (!acpi_ut_valid_acpi_char(name[i], i)) {
|
name[i] = '*';
|
||||||
new_name[i] = '*';
|
found_bad_char = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*(u32 *) new_name);
|
if (found_bad_char) {
|
||||||
|
|
||||||
|
/* Report warning only if in strict mode or debug mode */
|
||||||
|
|
||||||
|
if (!acpi_gbl_enable_interpreter_slack) {
|
||||||
|
ACPI_WARNING((AE_INFO,
|
||||||
|
"Found bad character(s) in name, repaired: [%4.4s]\n",
|
||||||
|
name));
|
||||||
|
} else {
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
|
"Found bad character(s) in name, repaired: [%4.4s]\n",
|
||||||
|
name));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -681,7 +776,7 @@ acpi_name acpi_ut_repair_name(char *name)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
|
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
|
||||||
{
|
{
|
||||||
u32 this_digit = 0;
|
u32 this_digit = 0;
|
||||||
u64 return_value = 0;
|
u64 return_value = 0;
|
||||||
|
@ -754,14 +849,14 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
|
||||||
|
|
||||||
/* Convert ASCII 0-9 to Decimal value */
|
/* Convert ASCII 0-9 to Decimal value */
|
||||||
|
|
||||||
this_digit = ((u8) * string) - '0';
|
this_digit = ((u8)*string) - '0';
|
||||||
} else if (base == 10) {
|
} else if (base == 10) {
|
||||||
|
|
||||||
/* Digit is out of range; possible in to_integer case only */
|
/* Digit is out of range; possible in to_integer case only */
|
||||||
|
|
||||||
term = 1;
|
term = 1;
|
||||||
} else {
|
} else {
|
||||||
this_digit = (u8) ACPI_TOUPPER(*string);
|
this_digit = (u8)ACPI_TOUPPER(*string);
|
||||||
if (ACPI_IS_XDIGIT((char)this_digit)) {
|
if (ACPI_IS_XDIGIT((char)this_digit)) {
|
||||||
|
|
||||||
/* Convert ASCII Hex char to value */
|
/* Convert ASCII Hex char to value */
|
||||||
|
@ -788,7 +883,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
|
||||||
|
|
||||||
valid_digits++;
|
valid_digits++;
|
||||||
|
|
||||||
if (sign_of0x && ((valid_digits > 16)
|
if (sign_of0x
|
||||||
|
&& ((valid_digits > 16)
|
||||||
|| ((valid_digits > 8) && mode32))) {
|
|| ((valid_digits > 8) && mode32))) {
|
||||||
/*
|
/*
|
||||||
* This is to_integer operation case.
|
* This is to_integer operation case.
|
||||||
|
@ -800,7 +896,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer)
|
||||||
|
|
||||||
/* Divide the digit into the correct position */
|
/* Divide the digit into the correct position */
|
||||||
|
|
||||||
(void)acpi_ut_short_divide((dividend - (u64) this_digit),
|
(void)acpi_ut_short_divide((dividend - (u64)this_digit),
|
||||||
base, "ient, NULL);
|
base, "ient, NULL);
|
||||||
|
|
||||||
if (return_value > quotient) {
|
if (return_value > quotient) {
|
||||||
|
@ -890,7 +986,7 @@ acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
|
acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
|
||||||
void *target_object,
|
void *target_object,
|
||||||
acpi_pkg_callback walk_callback, void *context)
|
acpi_pkg_callback walk_callback, void *context)
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,6 +193,8 @@ static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
|
||||||
|
|
||||||
acpi_gbl_mutex_info[mutex_id].mutex = NULL;
|
acpi_gbl_mutex_info[mutex_id].mutex = NULL;
|
||||||
acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
|
acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
|
||||||
|
|
||||||
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
692
drivers/acpi/acpica/uttrack.c
Normal file
692
drivers/acpi/acpica/uttrack.c
Normal file
|
@ -0,0 +1,692 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Module Name: uttrack - Memory allocation tracking routines (debug only)
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2000 - 2012, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These procedures are used for tracking memory leaks in the subsystem, and
|
||||||
|
* they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
|
||||||
|
*
|
||||||
|
* Each memory allocation is tracked via a doubly linked list. Each
|
||||||
|
* element contains the caller's component, module name, function name, and
|
||||||
|
* line number. acpi_ut_allocate and acpi_ut_allocate_zeroed call
|
||||||
|
* acpi_ut_track_allocation to add an element to the list; deletion
|
||||||
|
* occurs in the body of acpi_ut_free.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <acpi/acpi.h>
|
||||||
|
#include "accommon.h"
|
||||||
|
|
||||||
|
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
|
||||||
|
|
||||||
|
#define _COMPONENT ACPI_UTILITIES
|
||||||
|
ACPI_MODULE_NAME("uttrack")
|
||||||
|
|
||||||
|
/* Local prototypes */
|
||||||
|
static struct acpi_debug_mem_block *acpi_ut_find_allocation(struct
|
||||||
|
acpi_debug_mem_block
|
||||||
|
*allocation);
|
||||||
|
|
||||||
|
static acpi_status
|
||||||
|
acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
|
||||||
|
acpi_size size,
|
||||||
|
u8 alloc_type,
|
||||||
|
u32 component, const char *module, u32 line);
|
||||||
|
|
||||||
|
static acpi_status
|
||||||
|
acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
|
||||||
|
u32 component, const char *module, u32 line);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_create_list
|
||||||
|
*
|
||||||
|
* PARAMETERS: cache_name - Ascii name for the cache
|
||||||
|
* object_size - Size of each cached object
|
||||||
|
* return_cache - Where the new cache object is returned
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Create a local memory list for tracking purposed
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
acpi_status
|
||||||
|
acpi_ut_create_list(char *list_name,
|
||||||
|
u16 object_size, struct acpi_memory_list **return_cache)
|
||||||
|
{
|
||||||
|
struct acpi_memory_list *cache;
|
||||||
|
|
||||||
|
cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
|
||||||
|
if (!cache) {
|
||||||
|
return (AE_NO_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
|
||||||
|
|
||||||
|
cache->list_name = list_name;
|
||||||
|
cache->object_size = object_size;
|
||||||
|
|
||||||
|
*return_cache = cache;
|
||||||
|
return (AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_allocate_and_track
|
||||||
|
*
|
||||||
|
* PARAMETERS: size - Size of the allocation
|
||||||
|
* component - Component type of caller
|
||||||
|
* module - Source file name of caller
|
||||||
|
* line - Line number of caller
|
||||||
|
*
|
||||||
|
* RETURN: Address of the allocated memory on success, NULL on failure.
|
||||||
|
*
|
||||||
|
* DESCRIPTION: The subsystem's equivalent of malloc.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void *acpi_ut_allocate_and_track(acpi_size size,
|
||||||
|
u32 component, const char *module, u32 line)
|
||||||
|
{
|
||||||
|
struct acpi_debug_mem_block *allocation;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
allocation =
|
||||||
|
acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
|
||||||
|
component, module, line);
|
||||||
|
if (!allocation) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = acpi_ut_track_allocation(allocation, size,
|
||||||
|
ACPI_MEM_MALLOC, component, module,
|
||||||
|
line);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_os_free(allocation);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
acpi_gbl_global_list->total_allocated++;
|
||||||
|
acpi_gbl_global_list->total_size += (u32)size;
|
||||||
|
acpi_gbl_global_list->current_total_size += (u32)size;
|
||||||
|
if (acpi_gbl_global_list->current_total_size >
|
||||||
|
acpi_gbl_global_list->max_occupied) {
|
||||||
|
acpi_gbl_global_list->max_occupied =
|
||||||
|
acpi_gbl_global_list->current_total_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((void *)&allocation->user_space);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_allocate_zeroed_and_track
|
||||||
|
*
|
||||||
|
* PARAMETERS: size - Size of the allocation
|
||||||
|
* component - Component type of caller
|
||||||
|
* module - Source file name of caller
|
||||||
|
* line - Line number of caller
|
||||||
|
*
|
||||||
|
* RETURN: Address of the allocated memory on success, NULL on failure.
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Subsystem equivalent of calloc.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
|
||||||
|
u32 component,
|
||||||
|
const char *module, u32 line)
|
||||||
|
{
|
||||||
|
struct acpi_debug_mem_block *allocation;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
allocation =
|
||||||
|
acpi_ut_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header),
|
||||||
|
component, module, line);
|
||||||
|
if (!allocation) {
|
||||||
|
|
||||||
|
/* Report allocation error */
|
||||||
|
|
||||||
|
ACPI_ERROR((module, line,
|
||||||
|
"Could not allocate size %u", (u32)size));
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = acpi_ut_track_allocation(allocation, size,
|
||||||
|
ACPI_MEM_CALLOC, component, module,
|
||||||
|
line);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_os_free(allocation);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
acpi_gbl_global_list->total_allocated++;
|
||||||
|
acpi_gbl_global_list->total_size += (u32)size;
|
||||||
|
acpi_gbl_global_list->current_total_size += (u32)size;
|
||||||
|
if (acpi_gbl_global_list->current_total_size >
|
||||||
|
acpi_gbl_global_list->max_occupied) {
|
||||||
|
acpi_gbl_global_list->max_occupied =
|
||||||
|
acpi_gbl_global_list->current_total_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((void *)&allocation->user_space);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_free_and_track
|
||||||
|
*
|
||||||
|
* PARAMETERS: allocation - Address of the memory to deallocate
|
||||||
|
* component - Component type of caller
|
||||||
|
* module - Source file name of caller
|
||||||
|
* line - Line number of caller
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Frees the memory at Allocation
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
acpi_ut_free_and_track(void *allocation,
|
||||||
|
u32 component, const char *module, u32 line)
|
||||||
|
{
|
||||||
|
struct acpi_debug_mem_block *debug_block;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR(ut_free, allocation);
|
||||||
|
|
||||||
|
if (NULL == allocation) {
|
||||||
|
ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
|
||||||
|
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
|
||||||
|
(((char *)allocation) -
|
||||||
|
sizeof(struct acpi_debug_mem_header)));
|
||||||
|
|
||||||
|
acpi_gbl_global_list->total_freed++;
|
||||||
|
acpi_gbl_global_list->current_total_size -= debug_block->size;
|
||||||
|
|
||||||
|
status = acpi_ut_remove_allocation(debug_block,
|
||||||
|
component, module, line);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
|
||||||
|
}
|
||||||
|
|
||||||
|
acpi_os_free(debug_block);
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_find_allocation
|
||||||
|
*
|
||||||
|
* PARAMETERS: allocation - Address of allocated memory
|
||||||
|
*
|
||||||
|
* RETURN: Three cases:
|
||||||
|
* 1) List is empty, NULL is returned.
|
||||||
|
* 2) Element was found. Returns Allocation parameter.
|
||||||
|
* 3) Element was not found. Returns position where it should be
|
||||||
|
* inserted into the list.
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Searches for an element in the global allocation tracking list.
|
||||||
|
* If the element is not found, returns the location within the
|
||||||
|
* list where the element should be inserted.
|
||||||
|
*
|
||||||
|
* Note: The list is ordered by larger-to-smaller addresses.
|
||||||
|
*
|
||||||
|
* This global list is used to detect memory leaks in ACPICA as
|
||||||
|
* well as other issues such as an attempt to release the same
|
||||||
|
* internal object more than once. Although expensive as far
|
||||||
|
* as cpu time, this list is much more helpful for finding these
|
||||||
|
* types of issues than using memory leak detectors outside of
|
||||||
|
* the ACPICA code.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
static struct acpi_debug_mem_block *acpi_ut_find_allocation(struct
|
||||||
|
acpi_debug_mem_block
|
||||||
|
*allocation)
|
||||||
|
{
|
||||||
|
struct acpi_debug_mem_block *element;
|
||||||
|
|
||||||
|
element = acpi_gbl_global_list->list_head;
|
||||||
|
if (!element) {
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search for the address.
|
||||||
|
*
|
||||||
|
* Note: List is ordered by larger-to-smaller addresses, on the
|
||||||
|
* assumption that a new allocation usually has a larger address
|
||||||
|
* than previous allocations.
|
||||||
|
*/
|
||||||
|
while (element > allocation) {
|
||||||
|
|
||||||
|
/* Check for end-of-list */
|
||||||
|
|
||||||
|
if (!element->next) {
|
||||||
|
return (element);
|
||||||
|
}
|
||||||
|
|
||||||
|
element = element->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element == allocation) {
|
||||||
|
return (element);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (element->previous);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_track_allocation
|
||||||
|
*
|
||||||
|
* PARAMETERS: allocation - Address of allocated memory
|
||||||
|
* size - Size of the allocation
|
||||||
|
* alloc_type - MEM_MALLOC or MEM_CALLOC
|
||||||
|
* component - Component type of caller
|
||||||
|
* module - Source file name of caller
|
||||||
|
* line - Line number of caller
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Inserts an element into the global allocation tracking list.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
static acpi_status
|
||||||
|
acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
|
||||||
|
acpi_size size,
|
||||||
|
u8 alloc_type,
|
||||||
|
u32 component, const char *module, u32 line)
|
||||||
|
{
|
||||||
|
struct acpi_memory_list *mem_list;
|
||||||
|
struct acpi_debug_mem_block *element;
|
||||||
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR(ut_track_allocation, allocation);
|
||||||
|
|
||||||
|
if (acpi_gbl_disable_mem_tracking) {
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_list = acpi_gbl_global_list;
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search the global list for this address to make sure it is not
|
||||||
|
* already present. This will catch several kinds of problems.
|
||||||
|
*/
|
||||||
|
element = acpi_ut_find_allocation(allocation);
|
||||||
|
if (element == allocation) {
|
||||||
|
ACPI_ERROR((AE_INFO,
|
||||||
|
"UtTrackAllocation: Allocation (%p) already present in global list!",
|
||||||
|
allocation));
|
||||||
|
goto unlock_and_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fill in the instance data */
|
||||||
|
|
||||||
|
allocation->size = (u32)size;
|
||||||
|
allocation->alloc_type = alloc_type;
|
||||||
|
allocation->component = component;
|
||||||
|
allocation->line = line;
|
||||||
|
|
||||||
|
ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
|
||||||
|
allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
|
||||||
|
|
||||||
|
if (!element) {
|
||||||
|
|
||||||
|
/* Insert at list head */
|
||||||
|
|
||||||
|
if (mem_list->list_head) {
|
||||||
|
((struct acpi_debug_mem_block *)(mem_list->list_head))->
|
||||||
|
previous = allocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
allocation->next = mem_list->list_head;
|
||||||
|
allocation->previous = NULL;
|
||||||
|
|
||||||
|
mem_list->list_head = allocation;
|
||||||
|
} else {
|
||||||
|
/* Insert after element */
|
||||||
|
|
||||||
|
allocation->next = element->next;
|
||||||
|
allocation->previous = element;
|
||||||
|
|
||||||
|
if (element->next) {
|
||||||
|
(element->next)->previous = allocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
element->next = allocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
|
status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_remove_allocation
|
||||||
|
*
|
||||||
|
* PARAMETERS: allocation - Address of allocated memory
|
||||||
|
* component - Component type of caller
|
||||||
|
* module - Source file name of caller
|
||||||
|
* line - Line number of caller
|
||||||
|
*
|
||||||
|
* RETURN: Status
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Deletes an element from the global allocation tracking list.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
static acpi_status
|
||||||
|
acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
|
||||||
|
u32 component, const char *module, u32 line)
|
||||||
|
{
|
||||||
|
struct acpi_memory_list *mem_list;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE(ut_remove_allocation);
|
||||||
|
|
||||||
|
if (acpi_gbl_disable_mem_tracking) {
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_list = acpi_gbl_global_list;
|
||||||
|
if (NULL == mem_list->list_head) {
|
||||||
|
|
||||||
|
/* No allocations! */
|
||||||
|
|
||||||
|
ACPI_ERROR((module, line,
|
||||||
|
"Empty allocation list, nothing to free!"));
|
||||||
|
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unlink */
|
||||||
|
|
||||||
|
if (allocation->previous) {
|
||||||
|
(allocation->previous)->next = allocation->next;
|
||||||
|
} else {
|
||||||
|
mem_list->list_head = allocation->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allocation->next) {
|
||||||
|
(allocation->next)->previous = allocation->previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mark the segment as deleted */
|
||||||
|
|
||||||
|
ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
|
||||||
|
allocation->size));
|
||||||
|
|
||||||
|
status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_dump_allocation_info
|
||||||
|
*
|
||||||
|
* PARAMETERS: None
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Print some info about the outstanding allocations.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void acpi_ut_dump_allocation_info(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
struct acpi_memory_list *mem_list;
|
||||||
|
*/
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE(ut_dump_allocation_info);
|
||||||
|
|
||||||
|
/*
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Current allocations",
|
||||||
|
mem_list->current_count,
|
||||||
|
ROUND_UP_TO_1K (mem_list->current_size)));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
|
||||||
|
mem_list->max_concurrent_count,
|
||||||
|
ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
|
||||||
|
running_object_count,
|
||||||
|
ROUND_UP_TO_1K (running_object_size)));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
|
||||||
|
running_alloc_count,
|
||||||
|
ROUND_UP_TO_1K (running_alloc_size)));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Current Nodes",
|
||||||
|
acpi_gbl_current_node_count,
|
||||||
|
ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
|
||||||
|
("%30s: %4d (%3d Kb)\n", "Max Nodes",
|
||||||
|
acpi_gbl_max_concurrent_node_count,
|
||||||
|
ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
|
||||||
|
sizeof (struct acpi_namespace_node)))));
|
||||||
|
*/
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* FUNCTION: acpi_ut_dump_allocations
|
||||||
|
*
|
||||||
|
* PARAMETERS: component - Component(s) to dump info for.
|
||||||
|
* module - Module to dump info for. NULL means all.
|
||||||
|
*
|
||||||
|
* RETURN: None
|
||||||
|
*
|
||||||
|
* DESCRIPTION: Print a list of all outstanding allocations.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
void acpi_ut_dump_allocations(u32 component, const char *module)
|
||||||
|
{
|
||||||
|
struct acpi_debug_mem_block *element;
|
||||||
|
union acpi_descriptor *descriptor;
|
||||||
|
u32 num_outstanding = 0;
|
||||||
|
u8 descriptor_type;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE(ut_dump_allocations);
|
||||||
|
|
||||||
|
if (acpi_gbl_disable_mem_tracking) {
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Walk the allocation list.
|
||||||
|
*/
|
||||||
|
if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
element = acpi_gbl_global_list->list_head;
|
||||||
|
while (element) {
|
||||||
|
if ((element->component & component) &&
|
||||||
|
((module == NULL)
|
||||||
|
|| (0 == ACPI_STRCMP(module, element->module)))) {
|
||||||
|
descriptor =
|
||||||
|
ACPI_CAST_PTR(union acpi_descriptor,
|
||||||
|
&element->user_space);
|
||||||
|
|
||||||
|
if (element->size <
|
||||||
|
sizeof(struct acpi_common_descriptor)) {
|
||||||
|
acpi_os_printf("%p Length 0x%04X %9.9s-%u "
|
||||||
|
"[Not a Descriptor - too small]\n",
|
||||||
|
descriptor, element->size,
|
||||||
|
element->module, element->line);
|
||||||
|
} else {
|
||||||
|
/* Ignore allocated objects that are in a cache */
|
||||||
|
|
||||||
|
if (ACPI_GET_DESCRIPTOR_TYPE(descriptor) !=
|
||||||
|
ACPI_DESC_TYPE_CACHED) {
|
||||||
|
acpi_os_printf
|
||||||
|
("%p Length 0x%04X %9.9s-%u [%s] ",
|
||||||
|
descriptor, element->size,
|
||||||
|
element->module, element->line,
|
||||||
|
acpi_ut_get_descriptor_name
|
||||||
|
(descriptor));
|
||||||
|
|
||||||
|
/* Validate the descriptor type using Type field and length */
|
||||||
|
|
||||||
|
descriptor_type = 0; /* Not a valid descriptor type */
|
||||||
|
|
||||||
|
switch (ACPI_GET_DESCRIPTOR_TYPE
|
||||||
|
(descriptor)) {
|
||||||
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
|
if (element->size ==
|
||||||
|
sizeof(union
|
||||||
|
acpi_operand_object))
|
||||||
|
{
|
||||||
|
descriptor_type =
|
||||||
|
ACPI_DESC_TYPE_OPERAND;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACPI_DESC_TYPE_PARSER:
|
||||||
|
if (element->size ==
|
||||||
|
sizeof(union
|
||||||
|
acpi_parse_object)) {
|
||||||
|
descriptor_type =
|
||||||
|
ACPI_DESC_TYPE_PARSER;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
|
if (element->size ==
|
||||||
|
sizeof(struct
|
||||||
|
acpi_namespace_node))
|
||||||
|
{
|
||||||
|
descriptor_type =
|
||||||
|
ACPI_DESC_TYPE_NAMED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Display additional info for the major descriptor types */
|
||||||
|
|
||||||
|
switch (descriptor_type) {
|
||||||
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
|
acpi_os_printf
|
||||||
|
("%12.12s RefCount 0x%04X\n",
|
||||||
|
acpi_ut_get_type_name
|
||||||
|
(descriptor->object.common.
|
||||||
|
type),
|
||||||
|
descriptor->object.common.
|
||||||
|
reference_count);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACPI_DESC_TYPE_PARSER:
|
||||||
|
acpi_os_printf
|
||||||
|
("AmlOpcode 0x%04hX\n",
|
||||||
|
descriptor->op.asl.
|
||||||
|
aml_opcode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
|
acpi_os_printf("%4.4s\n",
|
||||||
|
acpi_ut_get_node_name
|
||||||
|
(&descriptor->
|
||||||
|
node));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
acpi_os_printf("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
num_outstanding++;
|
||||||
|
}
|
||||||
|
|
||||||
|
element = element->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
|
||||||
|
|
||||||
|
/* Print summary */
|
||||||
|
|
||||||
|
if (!num_outstanding) {
|
||||||
|
ACPI_INFO((AE_INFO, "No outstanding allocations"));
|
||||||
|
} else {
|
||||||
|
ACPI_ERROR((AE_INFO, "%u(0x%X) Outstanding allocations",
|
||||||
|
num_outstanding, num_outstanding));
|
||||||
|
}
|
||||||
|
|
||||||
|
return_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
|
|
@ -238,7 +238,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_gbl_init_handler = handler;
|
acpi_gbl_init_handler = handler;
|
||||||
return AE_OK;
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
|
ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
|
||||||
|
@ -263,6 +263,7 @@ acpi_status acpi_purge_cached_objects(void)
|
||||||
(void)acpi_os_purge_cache(acpi_gbl_operand_cache);
|
(void)acpi_os_purge_cache(acpi_gbl_operand_cache);
|
||||||
(void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
|
(void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
|
||||||
(void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
|
(void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ acpi_ut_namespace_error(const char *module_name,
|
||||||
|
|
||||||
ACPI_MOVE_32_TO_32(&bad_name,
|
ACPI_MOVE_32_TO_32(&bad_name,
|
||||||
ACPI_CAST_PTR(u32, internal_name));
|
ACPI_CAST_PTR(u32, internal_name));
|
||||||
acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
|
acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name);
|
||||||
} else {
|
} else {
|
||||||
/* Convert path to external format */
|
/* Convert path to external format */
|
||||||
|
|
||||||
|
|
|
@ -994,7 +994,7 @@ err:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devexit ghes_remove(struct platform_device *ghes_dev)
|
static int ghes_remove(struct platform_device *ghes_dev)
|
||||||
{
|
{
|
||||||
struct ghes *ghes;
|
struct ghes *ghes;
|
||||||
struct acpi_hest_generic *generic;
|
struct acpi_hest_generic *generic;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
@ -95,6 +96,18 @@ enum {
|
||||||
ACPI_BATTERY_ALARM_PRESENT,
|
ACPI_BATTERY_ALARM_PRESENT,
|
||||||
ACPI_BATTERY_XINFO_PRESENT,
|
ACPI_BATTERY_XINFO_PRESENT,
|
||||||
ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY,
|
ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY,
|
||||||
|
/* On Lenovo Thinkpad models from 2010 and 2011, the power unit
|
||||||
|
switches between mWh and mAh depending on whether the system
|
||||||
|
is running on battery or not. When mAh is the unit, most
|
||||||
|
reported values are incorrect and need to be adjusted by
|
||||||
|
10000/design_voltage. Verified on x201, t410, t410s, and x220.
|
||||||
|
Pre-2010 and 2012 models appear to always report in mWh and
|
||||||
|
are thus unaffected (tested with t42, t61, t500, x200, x300,
|
||||||
|
and x230). Also, in mid-2012 Lenovo issued a BIOS update for
|
||||||
|
the 2011 models that fixes the issue (tested on x220 with a
|
||||||
|
post-1.29 BIOS), but as of Nov. 2012, no such update is
|
||||||
|
available for the 2010 models. */
|
||||||
|
ACPI_BATTERY_QUIRK_THINKPAD_MAH,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery {
|
struct acpi_battery {
|
||||||
|
@ -438,6 +451,21 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
|
if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
|
||||||
battery->full_charge_capacity = battery->design_capacity;
|
battery->full_charge_capacity = battery->design_capacity;
|
||||||
|
if (test_bit(ACPI_BATTERY_QUIRK_THINKPAD_MAH, &battery->flags) &&
|
||||||
|
battery->power_unit && battery->design_voltage) {
|
||||||
|
battery->design_capacity = battery->design_capacity *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
battery->full_charge_capacity = battery->full_charge_capacity *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
battery->design_capacity_warning =
|
||||||
|
battery->design_capacity_warning *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
/* Curiously, design_capacity_low, unlike the rest of them,
|
||||||
|
is correct. */
|
||||||
|
/* capacity_granularity_* equal 1 on the systems tested, so
|
||||||
|
it's impossible to tell if they would need an adjustment
|
||||||
|
or not if their values were higher. */
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,6 +514,11 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
|
||||||
&& battery->capacity_now >= 0 && battery->capacity_now <= 100)
|
&& battery->capacity_now >= 0 && battery->capacity_now <= 100)
|
||||||
battery->capacity_now = (battery->capacity_now *
|
battery->capacity_now = (battery->capacity_now *
|
||||||
battery->full_charge_capacity) / 100;
|
battery->full_charge_capacity) / 100;
|
||||||
|
if (test_bit(ACPI_BATTERY_QUIRK_THINKPAD_MAH, &battery->flags) &&
|
||||||
|
battery->power_unit && battery->design_voltage) {
|
||||||
|
battery->capacity_now = battery->capacity_now *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,6 +628,24 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
|
||||||
mutex_unlock(&battery->sysfs_lock);
|
mutex_unlock(&battery->sysfs_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void find_battery(const struct dmi_header *dm, void *private)
|
||||||
|
{
|
||||||
|
struct acpi_battery *battery = (struct acpi_battery *)private;
|
||||||
|
/* Note: the hardcoded offsets below have been extracted from
|
||||||
|
the source code of dmidecode. */
|
||||||
|
if (dm->type == DMI_ENTRY_PORTABLE_BATTERY && dm->length >= 8) {
|
||||||
|
const u8 *dmi_data = (const u8 *)(dm + 1);
|
||||||
|
int dmi_capacity = get_unaligned((const u16 *)(dmi_data + 6));
|
||||||
|
if (dm->length >= 18)
|
||||||
|
dmi_capacity *= dmi_data[17];
|
||||||
|
if (battery->design_capacity * battery->design_voltage / 1000
|
||||||
|
!= dmi_capacity &&
|
||||||
|
battery->design_capacity * 10 == dmi_capacity)
|
||||||
|
set_bit(ACPI_BATTERY_QUIRK_THINKPAD_MAH,
|
||||||
|
&battery->flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* According to the ACPI spec, some kinds of primary batteries can
|
* According to the ACPI spec, some kinds of primary batteries can
|
||||||
* report percentage battery remaining capacity directly to OS.
|
* report percentage battery remaining capacity directly to OS.
|
||||||
|
@ -620,6 +671,32 @@ static void acpi_battery_quirks(struct acpi_battery *battery)
|
||||||
battery->capacity_now = (battery->capacity_now *
|
battery->capacity_now = (battery->capacity_now *
|
||||||
battery->full_charge_capacity) / 100;
|
battery->full_charge_capacity) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (test_bit(ACPI_BATTERY_QUIRK_THINKPAD_MAH, &battery->flags))
|
||||||
|
return ;
|
||||||
|
|
||||||
|
if (battery->power_unit && dmi_name_in_vendors("LENOVO")) {
|
||||||
|
const char *s;
|
||||||
|
s = dmi_get_system_info(DMI_PRODUCT_VERSION);
|
||||||
|
if (s && !strnicmp(s, "ThinkPad", 8)) {
|
||||||
|
dmi_walk(find_battery, battery);
|
||||||
|
if (test_bit(ACPI_BATTERY_QUIRK_THINKPAD_MAH,
|
||||||
|
&battery->flags) &&
|
||||||
|
battery->design_voltage) {
|
||||||
|
battery->design_capacity =
|
||||||
|
battery->design_capacity *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
battery->full_charge_capacity =
|
||||||
|
battery->full_charge_capacity *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
battery->design_capacity_warning =
|
||||||
|
battery->design_capacity_warning *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
battery->capacity_now = battery->capacity_now *
|
||||||
|
10000 / battery->design_voltage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_battery_update(struct acpi_battery *battery)
|
static int acpi_battery_update(struct acpi_battery *battery)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue