Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 16:32:11 +0000 (09:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 16:32:11 +0000 (09:32 -0700)
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (119 commits)
  ACPI: don't pass handle for fixed hardware notifications
  ACPI: remove null pointer checks in deferred execution path
  ACPI: simplify deferred execution path
  acerhdf: additional BIOS versions
  acerhdf: convert to dev_pm_ops
  acerhdf: fix fan control for AOA150 model
  thermal: add missing Kconfig dependency
  acpi: switch /proc/acpi/{debug_layer,debug_level} to seq_file
  hp-wmi: fix rfkill memory leak on unload
  ACPI: remove unnecessary #ifdef CONFIG_DMI
  ACPI: linux/acpi.h should not include linux/dmi.h
  hwmon driver for ACPI 4.0 power meters
  topstar-laptop: add new driver for hotkeys support on Topstar N01
  thinkpad_acpi: fix rfkill memory leak on unload
  thinkpad-acpi: report brightness events when required
  thinkpad-acpi: don't poll by default any of the reserved hotkeys
  thinkpad-acpi: Fix procfs hotkey reset command
  thinkpad-acpi: deprecate hotkey_bios_mask
  thinkpad-acpi: hotkey poll fixes
  thinkpad-acpi: be more strict when detecting a ThinkPad
  ...

130 files changed:
Documentation/ABI/stable/sysfs-class-backlight [new file with mode: 0644]
Documentation/ABI/testing/sysfs-class-lcd [new file with mode: 0644]
Documentation/ABI/testing/sysfs-class-led [new file with mode: 0644]
Documentation/ABI/testing/sysfs-platform-asus-laptop [new file with mode: 0644]
Documentation/ABI/testing/sysfs-platform-eeepc-laptop [new file with mode: 0644]
Documentation/hwmon/acpi_power_meter [new file with mode: 0644]
Documentation/laptops/asus-laptop.txt [new file with mode: 0644]
Documentation/laptops/thinkpad-acpi.txt
Documentation/leds-class.txt
MAINTAINERS
arch/ia64/hp/common/sba_iommu.c
arch/x86/include/asm/acpi.h
arch/x86/pci/mmconfig-shared.c
drivers/acpi/Kconfig
drivers/acpi/Makefile
drivers/acpi/ac.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/acpica/Makefile
drivers/acpi/acpica/acconfig.h
drivers/acpi/acpica/acdebug.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/achware.h
drivers/acpi/acpica/acinterp.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acobject.h
drivers/acpi/acpica/acparser.h
drivers/acpi/acpica/acpredef.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/amlcode.h
drivers/acpi/acpica/dsfield.c
drivers/acpi/acpica/dsmethod.c
drivers/acpi/acpica/dsmthdat.c
drivers/acpi/acpica/dsobject.c
drivers/acpi/acpica/dswload.c
drivers/acpi/acpica/evgpe.c
drivers/acpi/acpica/evgpeblk.c
drivers/acpi/acpica/evrgnini.c
drivers/acpi/acpica/exconfig.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/exfield.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exutils.c
drivers/acpi/acpica/hwgpe.c
drivers/acpi/acpica/hwregs.c
drivers/acpi/acpica/hwtimer.c
drivers/acpi/acpica/hwxface.c
drivers/acpi/acpica/nsalloc.c
drivers/acpi/acpica/nsdumpdv.c
drivers/acpi/acpica/nseval.c
drivers/acpi/acpica/nsinit.c
drivers/acpi/acpica/nsload.c
drivers/acpi/acpica/nspredef.c
drivers/acpi/acpica/nsrepair.c [new file with mode: 0644]
drivers/acpi/acpica/nsutils.c
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/acpica/nsxfname.c
drivers/acpi/acpica/psloop.c
drivers/acpi/acpica/psxface.c
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/utdelete.c
drivers/acpi/acpica/uteval.c
drivers/acpi/acpica/utglobal.c
drivers/acpi/acpica/utids.c [new file with mode: 0644]
drivers/acpi/acpica/utinit.c
drivers/acpi/acpica/utmisc.c
drivers/acpi/acpica/utxface.c
drivers/acpi/battery.c
drivers/acpi/blacklist.c
drivers/acpi/bus.c
drivers/acpi/button.c
drivers/acpi/cm_sbs.c
drivers/acpi/container.c
drivers/acpi/debug.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/event.c
drivers/acpi/fan.c
drivers/acpi/glue.c
drivers/acpi/internal.h
drivers/acpi/numa.c
drivers/acpi/osl.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/pci_slot.c
drivers/acpi/power.c
drivers/acpi/power_meter.c [new file with mode: 0644]
drivers/acpi/processor_core.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/processor_throttling.c
drivers/acpi/sbs.c
drivers/acpi/sbshc.c
drivers/acpi/scan.c
drivers/acpi/sleep.c
drivers/acpi/system.c
drivers/acpi/tables.c
drivers/acpi/thermal.c
drivers/acpi/utils.c
drivers/acpi/video.c
drivers/acpi/video_detect.c
drivers/char/agp/hp-agp.c
drivers/ide/ide-acpi.c
drivers/pci/dmar.c
drivers/pci/hotplug/acpiphp_ibm.c
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/acerhdf.c
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/hp-wmi.c
drivers/platform/x86/sony-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/topstar-laptop.c [new file with mode: 0644]
drivers/platform/x86/wmi.c
drivers/pnp/pnpacpi/core.c
drivers/thermal/Kconfig
include/acpi/acpi_bus.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h [new file with mode: 0644]
include/acpi/actypes.h
include/acpi/platform/aclinux.h
include/linux/acpi.h

diff --git a/Documentation/ABI/stable/sysfs-class-backlight b/Documentation/ABI/stable/sysfs-class-backlight
new file mode 100644 (file)
index 0000000..4d637e1
--- /dev/null
@@ -0,0 +1,36 @@
+What:          /sys/class/backlight/<backlight>/bl_power
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Control BACKLIGHT power, values are FB_BLANK_* from fb.h
+                - FB_BLANK_UNBLANK (0)   : power on.
+                - FB_BLANK_POWERDOWN (4) : power off
+Users:         HAL
+
+What:          /sys/class/backlight/<backlight>/brightness
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Control the brightness for this <backlight>. Values
+               are between 0 and max_brightness. This file will also
+               show the brightness level stored in the driver, which
+               may not be the actual brightness (see actual_brightness).
+Users:         HAL
+
+What:          /sys/class/backlight/<backlight>/actual_brightness
+Date:          March 2006
+KernelVersion: 2.6.17
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Show the actual brightness by querying the hardware.
+Users:         HAL
+
+What:          /sys/class/backlight/<backlight>/max_brightness
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Maximum brightness for <backlight>.
+Users:         HAL
diff --git a/Documentation/ABI/testing/sysfs-class-lcd b/Documentation/ABI/testing/sysfs-class-lcd
new file mode 100644 (file)
index 0000000..35906bf
--- /dev/null
@@ -0,0 +1,23 @@
+What:          /sys/class/lcd/<lcd>/lcd_power
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Control LCD power, values are FB_BLANK_* from fb.h
+                - FB_BLANK_UNBLANK (0)   : power on.
+                - FB_BLANK_POWERDOWN (4) : power off
+
+What:          /sys/class/lcd/<lcd>/contrast
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Current contrast of this LCD device. Value is between 0 and
+               /sys/class/lcd/<lcd>/max_contrast.
+
+What:          /sys/class/lcd/<lcd>/max_contrast
+Date:          April 2005
+KernelVersion: 2.6.12
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Maximum contrast for this LCD device.
diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led
new file mode 100644 (file)
index 0000000..9e4541d
--- /dev/null
@@ -0,0 +1,28 @@
+What:          /sys/class/leds/<led>/brightness
+Date:          March 2006
+KernelVersion: 2.6.17
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Set the brightness of the LED. Most LEDs don't
+               have hardware brightness support so will just be turned on for
+               non-zero brightness settings. The value is between 0 and
+               /sys/class/leds/<led>/max_brightness.
+
+What:          /sys/class/leds/<led>/max_brightness
+Date:          March 2006
+KernelVersion: 2.6.17
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Maximum brightness level for this led, default is 255 (LED_FULL).
+
+What:          /sys/class/leds/<led>/trigger
+Date:          March 2006
+KernelVersion: 2.6.17
+Contact:       Richard Purdie <rpurdie@rpsys.net>
+Description:
+               Set the trigger for this LED. A trigger is a kernel based source
+               of led events.
+               You can change triggers in a similar manner to the way an IO
+               scheduler is chosen. Trigger specific parameters can appear in
+               /sys/class/leds/<led> once a given trigger is selected.
+
diff --git a/Documentation/ABI/testing/sysfs-platform-asus-laptop b/Documentation/ABI/testing/sysfs-platform-asus-laptop
new file mode 100644 (file)
index 0000000..a1cb660
--- /dev/null
@@ -0,0 +1,52 @@
+What:          /sys/devices/platform/asus-laptop/display
+Date:          January 2007
+KernelVersion: 2.6.20
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               This file allows display switching. The value
+               is composed by 4 bits and defined as follow:
+               4321
+               |||`- LCD
+               ||`-- CRT
+               |`--- TV
+               `---- DVI
+               Ex: - 0 (0000b) means no display
+                   - 3 (0011b) CRT+LCD.
+
+What:          /sys/devices/platform/asus-laptop/gps
+Date:          January 2007
+KernelVersion: 2.6.20
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Control the gps device. 1 means on, 0 means off.
+Users:         Lapsus
+
+What:          /sys/devices/platform/asus-laptop/ledd
+Date:          January 2007
+KernelVersion: 2.6.20
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Some models like the W1N have a LED display that can be
+               used to display several informations.
+               To control the LED display, use the following :
+                   echo 0x0T000DDD > /sys/devices/platform/asus-laptop/
+               where T control the 3 letters display, and DDD the 3 digits display.
+               The DDD table can be found in Documentation/laptops/asus-laptop.txt
+
+What:          /sys/devices/platform/asus-laptop/bluetooth
+Date:          January 2007
+KernelVersion: 2.6.20
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Control the bluetooth device. 1 means on, 0 means off.
+               This may control the led, the device or both.
+Users:         Lapsus
+
+What:          /sys/devices/platform/asus-laptop/wlan
+Date:          January 2007
+KernelVersion: 2.6.20
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Control the bluetooth device. 1 means on, 0 means off.
+               This may control the led, the device or both.
+Users:         Lapsus
diff --git a/Documentation/ABI/testing/sysfs-platform-eeepc-laptop b/Documentation/ABI/testing/sysfs-platform-eeepc-laptop
new file mode 100644 (file)
index 0000000..7445dfb
--- /dev/null
@@ -0,0 +1,50 @@
+What:          /sys/devices/platform/eeepc-laptop/disp
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               This file allows display switching.
+               - 1 = LCD
+               - 2 = CRT
+               - 3 = LCD+CRT
+               If you run X11, you should use xrandr instead.
+
+What:          /sys/devices/platform/eeepc-laptop/camera
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Control the camera. 1 means on, 0 means off.
+
+What:          /sys/devices/platform/eeepc-laptop/cardr
+Date:          May 2008
+KernelVersion: 2.6.26
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Control the card reader. 1 means on, 0 means off.
+
+What:          /sys/devices/platform/eeepc-laptop/cpufv
+Date:          Jun 2009
+KernelVersion: 2.6.31
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               Change CPU clock configuration.
+               On the Eee PC 1000H there are three available clock configuration:
+                   * 0 -> Super Performance Mode
+                   * 1 -> High Performance Mode
+                   * 2 -> Power Saving Mode
+               On Eee PC 701 there is only 2 available clock configurations.
+               Available configuration are listed in available_cpufv file.
+               Reading this file will show the raw hexadecimal value which
+               is defined as follow:
+               | 8 bit | 8 bit |
+                   |       `---- Current mode
+                   `------------ Availables modes
+               For example, 0x301 means: mode 1 selected, 3 available modes.
+
+What:          /sys/devices/platform/eeepc-laptop/available_cpufv
+Date:          Jun 2009
+KernelVersion: 2.6.31
+Contact:       "Corentin Chary" <corentincj@iksaif.net>
+Description:
+               List available cpufv modes.
diff --git a/Documentation/hwmon/acpi_power_meter b/Documentation/hwmon/acpi_power_meter
new file mode 100644 (file)
index 0000000..c80399a
--- /dev/null
@@ -0,0 +1,51 @@
+Kernel driver power_meter
+=========================
+
+This driver talks to ACPI 4.0 power meters.
+
+Supported systems:
+  * Any recent system with ACPI 4.0.
+    Prefix: 'power_meter'
+    Datasheet: http://acpi.info/, section 10.4.
+
+Author: Darrick J. Wong
+
+Description
+-----------
+
+This driver implements sensor reading support for the power meters exposed in
+the ACPI 4.0 spec (Chapter 10.4).  These devices have a simple set of
+features--a power meter that returns average power use over a configurable
+interval, an optional capping mechanism, and a couple of trip points.  The
+sysfs interface conforms with the specification outlined in the "Power" section
+of Documentation/hwmon/sysfs-interface.
+
+Special Features
+----------------
+
+The power[1-*]_is_battery knob indicates if the power supply is a battery.
+Both power[1-*]_average_{min,max} must be set before the trip points will work.
+When both of them are set, an ACPI event will be broadcast on the ACPI netlink
+socket and a poll notification will be sent to the appropriate
+power[1-*]_average sysfs file.
+
+The power[1-*]_{model_number, serial_number, oem_info} fields display arbitrary
+strings that ACPI provides with the meter.  The measures/ directory contains
+symlinks to the devices that this meter measures.
+
+Some computers have the ability to enforce a power cap in hardware.  If this is
+the case, the power[1-*]_cap and related sysfs files will appear.  When the
+average power consumption exceeds the cap, an ACPI event will be broadcast on
+the netlink event socket and a poll notification will be sent to the
+appropriate power[1-*]_alarm file to indicate that capping has begun, and the
+hardware has taken action to reduce power consumption.  Most likely this will
+result in reduced performance.
+
+There are a few other ACPI notifications that can be sent by the firmware.  In
+all cases the ACPI event will be broadcast on the ACPI netlink event socket as
+well as sent as a poll notification to a sysfs file.  The events are as
+follows:
+
+power[1-*]_cap will be notified if the firmware changes the power cap.
+power[1-*]_interval will be notified if the firmware changes the averaging
+interval.
diff --git a/Documentation/laptops/asus-laptop.txt b/Documentation/laptops/asus-laptop.txt
new file mode 100644 (file)
index 0000000..c1c5be8
--- /dev/null
@@ -0,0 +1,258 @@
+Asus Laptop Extras
+
+Version 0.1
+August 6, 2009
+
+Corentin Chary <corentincj@iksaif.net>
+http://acpi4asus.sf.net/
+
+ This driver provides support for extra features of ACPI-compatible ASUS laptops.
+ It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or
+ VICTOR XP7210 for example). It makes all the extra buttons generate standard
+ ACPI events that go through /proc/acpi/events and input events (like keyboards).
+ On some models adds support for changing the display brightness and output,
+ switching the LCD backlight on and off, and most importantly, allows you to
+ blink those fancy LEDs intended for reporting mail and wireless status.
+
+This driver supercedes the old asus_acpi driver.
+
+Requirements
+------------
+
+  Kernel 2.6.X sources, configured for your computer, with ACPI support.
+  You also need CONFIG_INPUT and CONFIG_ACPI.
+
+Status
+------
+
+ The features currently supported are the following (see below for
+ detailed description):
+
+ - Fn key combinations
+ - Bluetooth enable and disable
+ - Wlan enable and disable
+ - GPS enable and disable
+ - Video output switching
+ - Ambient Light Sensor on and off
+ - LED control
+ - LED Display control
+ - LCD brightness control
+ - LCD on and off
+
+ A compatibility table by model and feature is maintained on the web
+ site, http://acpi4asus.sf.net/.
+
+Usage
+-----
+
+  Try "modprobe asus_acpi". Check your dmesg (simply type dmesg). You should
+  see some lines like this :
+
+      Asus Laptop Extras version 0.42
+        L2D model detected.
+
+  If it is not the output you have on your laptop, send it (and the laptop's
+  DSDT) to me.
+
+  That's all, now, all the events generated by the hotkeys of your laptop
+  should be reported in your /proc/acpi/event entry. You can check with
+  "acpi_listen".
+
+  Hotkeys are also reported as input keys (like keyboards) you can check
+  which key are supported using "xev" under X11.
+
+  You can get informations on the version of your DSDT table by reading the
+  /sys/devices/platform/asus-laptop/infos entry. If you have a question or a
+  bug report to do, please include the output of this entry.
+
+LEDs
+----
+
+  You can modify LEDs be echoing values to /sys/class/leds/asus::*/brightness :
+    echo 1 >  /sys/class/leds/asus::mail/brightness
+  will switch the mail LED on.
+  You can also know if they are on/off by reading their content and use
+  kernel triggers like ide-disk or heartbeat.
+
+Backlight
+---------
+
+  You can control lcd backlight power and brightness with
+  /sys/class/backlight/asus-laptop/. Brightness Values are between 0 and 15.
+
+Wireless devices
+---------------
+
+  You can turn the internal Bluetooth adapter on/off with the bluetooth entry
+  (only on models with Bluetooth). This usually controls the associated LED.
+  Same for Wlan adapter.
+
+Display switching
+-----------------
+
+  Note: the display switching code is currently considered EXPERIMENTAL.
+
+  Switching works for the following models:
+    L3800C
+    A2500H
+    L5800C
+    M5200N
+    W1000N (albeit with some glitches)
+    M6700R
+    A6JC
+    F3J
+
+  Switching doesn't work for the following:
+    M3700N
+    L2X00D (locks the laptop under certain conditions)
+
+  To switch the displays, echo values from 0 to 15 to
+  /sys/devices/platform/asus-laptop/display. The significance of those values
+  is as follows:
+
+  +-------+-----+-----+-----+-----+-----+
+  | Bin   | Val | DVI | TV  | CRT | LCD |
+  +-------+-----+-----+-----+-----+-----+
+  + 0000  +   0 +     +     +     +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 0001  +   1 +     +     +     +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 0010  +   2 +     +     +  X  +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 0011  +   3 +     +     +  X  +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 0100  +   4 +     +  X  +     +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 0101  +   5 +     +  X  +     + X   +
+  +-------+-----+-----+-----+-----+-----+
+  + 0110  +   6 +     +  X  +  X  +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 0111  +   7 +     +  X  +  X  +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 1000  +   8 +  X  +     +     +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 1001  +   9 +  X  +     +     +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 1010  +  10 +  X  +     +  X  +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 1011  +  11 +  X  +     +  X  +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 1100  +  12 +  X  +  X  +     +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 1101  +  13 +  X  +  X  +     +  X  +
+  +-------+-----+-----+-----+-----+-----+
+  + 1110  +  14 +  X  +  X  +  X  +     +
+  +-------+-----+-----+-----+-----+-----+
+  + 1111  +  15 +  X  +  X  +  X  +  X  +
+  +-------+-----+-----+-----+-----+-----+
+
+  In most cases, the appropriate displays must be plugged in for the above
+  combinations to work. TV-Out may need to be initialized at boot time.
+
+  Debugging:
+  1) Check whether the Fn+F8 key:
+     a) does not lock the laptop (try disabling CONFIG_X86_UP_APIC or boot with
+        noapic / nolapic if it does)
+     b) generates events (0x6n, where n is the value corresponding to the
+        configuration above)
+     c) actually works
+     Record the disp value at every configuration.
+  2) Echo values from 0 to 15 to /sys/devices/platform/asus-laptop/display.
+     Record its value, note any change. If nothing changes, try a broader range,
+     up to 65535.
+  3) Send ANY output (both positive and negative reports are needed, unless your
+     machine is already listed above) to the acpi4asus-user mailing list.
+
+  Note: on some machines (e.g. L3C), after the module has been loaded, only 0x6n
+  events are generated and no actual switching occurs. In such a case, a line
+  like:
+
+    echo $((10#$arg-60)) > /sys/devices/platform/asus-laptop/display
+
+  will usually do the trick ($arg is the 0000006n-like event passed to acpid).
+
+  Note: there is currently no reliable way to read display status on xxN
+  (Centrino) models.
+
+LED display
+-----------
+
+  Some models like the W1N have a LED display that can be used to display
+  several informations.
+
+  LED display works for the following models:
+    W1000N
+    W1J
+
+  To control the LED display, use the following :
+
+    echo 0x0T000DDD > /sys/devices/platform/asus-laptop/
+
+  where T control the 3 letters display, and DDD the 3 digits display,
+  according to the tables below.
+
+         DDD (digits)
+         000 to 999 = display digits
+         AAA        = ---
+         BBB to FFF = turn-off
+
+         T  (type)
+         0 = off
+         1 = dvd
+         2 = vcd
+         3 = mp3
+         4 = cd
+         5 = tv
+         6 = cpu
+         7 = vol
+
+  For example "echo 0x01000001 >/sys/devices/platform/asus-laptop/ledd"
+  would display "DVD001".
+
+Driver options:
+---------------
+
+ Options can be passed to the asus-laptop driver using the standard
+ module argument syntax (<param>=<value> when passing the option to the
+ module or asus-laptop.<param>=<value> on the kernel boot line when
+ asus-laptop is statically linked into the kernel).
+
+            wapf: WAPF defines the behavior of the Fn+Fx wlan key
+                  The significance of values is yet to be found, but
+                  most of the time:
+                  - 0x0 should do nothing
+                  - 0x1 should allow to control the device with Fn+Fx key.
+                  - 0x4 should send an ACPI event (0x88) while pressing the Fn+Fx key
+                  - 0x5 like 0x1 or 0x4
+
+ The default value is 0x1.
+
+Unsupported models
+------------------
+
+ These models will never be supported by this module, as they use a completely
+ different mechanism to handle LEDs and extra stuff (meaning we have no clue
+ how it works):
+
+ - ASUS A1300 (A1B), A1370D
+ - ASUS L7300G
+ - ASUS L8400
+
+Patches, Errors, Questions:
+--------------------------
+
+ I appreciate any success or failure
+ reports, especially if they add to or correct the compatibility table.
+ Please include the following information in your report:
+
+ - Asus model name
+ - a copy of your ACPI tables, using the "acpidump" utility
+ - a copy of /sys/devices/platform/asus-laptop/infos
+ - which driver features work and which don't
+ - the observed behavior of non-working features
+
+ Any other comments or patches are also more than welcome.
+
+ acpi4asus-user@lists.sourceforge.net
+ http://sourceforge.net/projects/acpi4asus
+
index e2ddcdeb61b6f5caffa1f80f901ebf5619f93dd7..6d03487ef1c71ea3a3ea6cc30240e2a0c9f9d5d4 100644 (file)
@@ -219,7 +219,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
        echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys
        echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys
        ... any other 8-hex-digit mask ...
-       echo reset > /proc/acpi/ibm/hotkey -- restore the original mask
+       echo reset > /proc/acpi/ibm/hotkey -- restore the recommended mask
 
 The following commands have been deprecated and will cause the kernel
 to log a warning:
@@ -240,9 +240,13 @@ sysfs notes:
                Returns 0.
 
        hotkey_bios_mask:
+               DEPRECATED, DON'T USE, WILL BE REMOVED IN THE FUTURE.
+
                Returns the hot keys mask when thinkpad-acpi was loaded.
                Upon module unload, the hot keys mask will be restored
-               to this value.
+               to this value.   This is always 0x80c, because those are
+               the hotkeys that were supported by ancient firmware
+               without mask support.
 
        hotkey_enable:
                DEPRECATED, WILL BE REMOVED SOON.
index 6399557cdab3d6542a0feea0c0cd2c6b2af5ffad..8fd5ca2ae32dde4d9eb27722942a5d099f4afbc3 100644 (file)
@@ -1,3 +1,4 @@
+
 LED handling under Linux
 ========================
 
@@ -5,10 +6,10 @@ If you're reading this and thinking about keyboard leds, these are
 handled by the input subsystem and the led class is *not* needed.
 
 In its simplest form, the LED class just allows control of LEDs from
-userspace. LEDs appear in /sys/class/leds/. The brightness file will
-set the brightness of the LED (taking a value 0-255). Most LEDs don't
-have hardware brightness support so will just be turned on for non-zero
-brightness settings.
+userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the
+LED is defined in max_brightness file. The brightness file will set the brightness
+of the LED (taking a value 0-max_brightness). Most LEDs don't have hardware
+brightness support so will just be turned on for non-zero brightness settings.
 
 The class also introduces the optional concept of an LED trigger. A trigger
 is a kernel based source of led events. Triggers can either be simple or
index b9a8a365418c08eea734b5a201bde8866970df6d..a44ea122f2adf142c7e4010cce67c356ee60015a 100644 (file)
@@ -5069,6 +5069,11 @@ T:       quilt http://svn.sourceforge.jp/svnroot/tomoyo/trunk/2.2.x/tomoyo-lsm/patches
 S:     Maintained
 F:     security/tomoyo/
 
+TOPSTAR LAPTOP EXTRAS DRIVER
+M:     Herton Ronaldo Krzesinski <herton@mandriva.com.br>
+S:     Maintained
+F:     drivers/platform/x86/topstar-laptop.c
+
 TOSHIBA ACPI EXTRAS DRIVER
 S:     Orphan
 F:     drivers/platform/x86/toshiba_acpi.c
index 8cfb001092ab0f79f0cf2c450c39ef5df77e3fd1..674a8374c6d9ec989616827a20cd1895dd5fbcbb 100644 (file)
@@ -2026,24 +2026,21 @@ acpi_sba_ioc_add(struct acpi_device *device)
        struct ioc *ioc;
        acpi_status status;
        u64 hpa, length;
-       struct acpi_buffer buffer;
        struct acpi_device_info *dev_info;
 
        status = hp_acpi_csr_space(device->handle, &hpa, &length);
        if (ACPI_FAILURE(status))
                return 1;
 
-       buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_get_object_info(device->handle, &buffer);
+       status = acpi_get_object_info(device->handle, &dev_info);
        if (ACPI_FAILURE(status))
                return 1;
-       dev_info = buffer.pointer;
 
        /*
         * For HWP0001, only SBA appears in ACPI namespace.  It encloses the PCI
         * root bridges, and its CSR space includes the IOC function.
         */
-       if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) {
+       if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) {
                hpa += ZX1_IOC_OFFSET;
                /* zx1 based systems default to kernel page size iommu pages */
                if (!iovp_shift)
index 20d1465a2ab046d8956eec43d5f5d4d36a3bd6bb..4518dc50090380b6676074b3f2466709ddea5a4b 100644 (file)
@@ -144,7 +144,6 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
 
 #else /* !CONFIG_ACPI */
 
-#define acpi_disabled 1
 #define acpi_lapic 0
 #define acpi_ioapic 0
 static inline void acpi_noirq_set(void) { }
index 712443ec6d43b46aaf05d75e04f2c249f44d20da..b707a0141d3b32653f13748bf8c6151d46fca060 100644 (file)
@@ -18,6 +18,8 @@
 #include <asm/e820.h>
 #include <asm/pci_x86.h>
 
+#define PREFIX "PCI: "
+
 /* aperture is up to 256MB but BIOS may reserve less */
 #define MMCONFIG_APER_MIN      (2 * 1024*1024)
 #define MMCONFIG_APER_MAX      (256 * 1024*1024)
index 7ec7d88c5999573d169233bbf3c82232f6003dbd..dd8729d674e56ef2dfcdc7a7fa320f399b4542c6 100644 (file)
@@ -60,7 +60,11 @@ config ACPI_PROCFS
          /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
          /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
          /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
-
+         /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
+         /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
+               cpufreq/*)
+         /proc/acpi/processor/*/throttling (/sys/class/thermal/
+               cooling_device*/*)
          This option has no effect on /proc/acpi/ files
          and functions which do not yet exist in /sys.
 
@@ -82,6 +86,17 @@ config ACPI_PROCFS_POWER
 
          Say N to delete power /proc/acpi/ directories that have moved to /sys/
 
+config ACPI_POWER_METER
+       tristate "ACPI 4.0 power meter"
+       depends on HWMON
+       help
+         This driver exposes ACPI 4.0 power meters as hardware monitoring
+         devices.  Say Y (or M) if you have a computer with ACPI 4.0 firmware
+         and a power meter.
+
+         To compile this driver as a module, choose M here:
+         the module will be called power-meter.
+
 config ACPI_SYSFS_POWER
        bool "Future power /sys interface"
        select POWER_SUPPLY
index 03a985be3fe3c6554c13b6549fa7b56aac474e49..82cd49dc603b6a5712a380eddbb54237a33a4ec2 100644 (file)
@@ -56,6 +56,7 @@ obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
 obj-$(CONFIG_ACPI_BATTERY)     += battery.o
 obj-$(CONFIG_ACPI_SBS)         += sbshc.o
 obj-$(CONFIG_ACPI_SBS)         += sbs.o
+obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o
 
 # processor has its own "processor." module_param namespace
 processor-y                    := processor_core.o processor_throttling.o
index 0df8fcb687d6f00ce400c1b4677019a34af236a1..98b9690b0159abdfb7e1a999553fe916dfa5a4c1 100644 (file)
@@ -37,6 +37,8 @@
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
+#define PREFIX "ACPI: "
+
 #define ACPI_AC_CLASS                  "ac_adapter"
 #define ACPI_AC_DEVICE_NAME            "AC Adapter"
 #define ACPI_AC_FILE_STATE             "state"
index 9a62224cc27816b039d116cc1732acad7080fdb2..28ccdbc05ac8326420c76488fd85782cb18560c8 100644 (file)
@@ -53,7 +53,6 @@ MODULE_LICENSE("GPL");
 
 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_start(struct acpi_device *device);
 
 static const struct acpi_device_id memory_device_ids[] = {
        {ACPI_MEMORY_DEVICE_HID, 0},
@@ -68,7 +67,6 @@ static struct acpi_driver acpi_memory_device_driver = {
        .ops = {
                .add = acpi_memory_device_add,
                .remove = acpi_memory_device_remove,
-               .start = acpi_memory_device_start,
                },
 };
 
@@ -431,28 +429,6 @@ static int acpi_memory_device_add(struct acpi_device *device)
 
        printk(KERN_DEBUG "%s \n", acpi_device_name(device));
 
-       return result;
-}
-
-static int acpi_memory_device_remove(struct acpi_device *device, int type)
-{
-       struct acpi_memory_device *mem_device = NULL;
-
-
-       if (!device || !acpi_driver_data(device))
-               return -EINVAL;
-
-       mem_device = acpi_driver_data(device);
-       kfree(mem_device);
-
-       return 0;
-}
-
-static int acpi_memory_device_start (struct acpi_device *device)
-{
-       struct acpi_memory_device *mem_device;
-       int result = 0;
-
        /*
         * Early boot code has recognized memory area by EFI/E820.
         * If DSDT shows these memory devices on boot, hotplug is not necessary
@@ -462,8 +438,6 @@ static int acpi_memory_device_start (struct acpi_device *device)
        if (!acpi_hotmem_initialized)
                return 0;
 
-       mem_device = acpi_driver_data(device);
-
        if (!acpi_memory_check_device(mem_device)) {
                /* call add_memory func */
                result = acpi_memory_enable_device(mem_device);
@@ -474,6 +448,20 @@ static int acpi_memory_device_start (struct acpi_device *device)
        return result;
 }
 
+static int acpi_memory_device_remove(struct acpi_device *device, int type)
+{
+       struct acpi_memory_device *mem_device = NULL;
+
+
+       if (!device || !acpi_driver_data(device))
+               return -EINVAL;
+
+       mem_device = acpi_driver_data(device);
+       kfree(mem_device);
+
+       return 0;
+}
+
 /*
  * Helper function to check for memory device
  */
@@ -481,26 +469,23 @@ static acpi_status is_memory_device(acpi_handle handle)
 {
        char *hardware_id;
        acpi_status status;
-       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct acpi_device_info *info;
 
-
-       status = acpi_get_object_info(handle, &buffer);
+       status = acpi_get_object_info(handle, &info);
        if (ACPI_FAILURE(status))
                return status;
 
-       info = buffer.pointer;
        if (!(info->valid & ACPI_VALID_HID)) {
-               kfree(buffer.pointer);
+               kfree(info);
                return AE_ERROR;
        }
 
-       hardware_id = info->hardware_id.value;
+       hardware_id = info->hardware_id.string;
        if ((hardware_id == NULL) ||
            (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
                status = AE_ERROR;
 
-       kfree(buffer.pointer);
+       kfree(info);
        return status;
 }
 
index 72ac28da14e392267bb885fb19eebee237f7c210..e7973bc16846847d33a9eefb71400907316dc5f8 100644 (file)
@@ -28,7 +28,7 @@ acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
 acpi-y += nsaccess.o  nsload.o    nssearch.o  nsxfeval.o \
         nsalloc.o   nseval.o    nsnames.o   nsutils.o   nsxfname.o \
         nsdump.o    nsinit.o    nsobject.o  nswalk.o    nsxfobj.o  \
-        nsparse.o   nspredef.o
+        nsparse.o   nspredef.o  nsrepair.o
 
 acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
 
@@ -44,4 +44,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
 
 acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
                utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
-               utstate.o utmutex.o utobject.o utresrc.o utlock.o
+               utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o
index e6777fb883d25b59d1e5acac89a7ccd24ab09f21..8e679ef5b23153600523c856f6d046ea26977615 100644 (file)
 
 /* Operation regions */
 
-#define ACPI_NUM_PREDEFINED_REGIONS     8
+#define ACPI_NUM_PREDEFINED_REGIONS     9
 #define ACPI_USER_REGION_BEGIN          0x80
 
 /* Maximum space_ids for Operation Regions */
 #define ACPI_RSDP_CHECKSUM_LENGTH       20
 #define ACPI_RSDP_XCHECKSUM_LENGTH      36
 
-/* SMBus bidirectional buffer size */
+/* SMBus and IPMI bidirectional buffer size */
 
 #define ACPI_SMBUS_BUFFER_SIZE          34
+#define ACPI_IPMI_BUFFER_SIZE           66
+
+/* _sx_d and _sx_w control methods */
+
+#define ACPI_NUM_sx_d_METHODS           4
+#define ACPI_NUM_sx_w_METHODS           5
 
 /******************************************************************************
  *
index 62c59df3b86c049799e78f280d8a743bbed38aac..a4fb001d96f1742065c29a7b16e233871b47c3eb 100644 (file)
@@ -154,10 +154,6 @@ void
 acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
                                struct acpi_walk_state *walk_state);
 
-void acpi_db_check_predefined_names(void);
-
-void acpi_db_batch_execute(void);
-
 /*
  * dbexec - debugger control method execution
  */
index 3d87362d17ed163851c3f5790fb4ecc4976e5c30..29ba66d5a7900ea09ebbcbc1716104aabad361b4 100644 (file)
 #define ACPI_INIT_GLOBAL(a,b) a
 #endif
 
+#ifdef DEFINE_ACPI_GLOBALS
+
+/* Public globals, available from outside ACPICA subsystem */
+
 /*****************************************************************************
  *
  * Runtime configuration (static defaults that can be overriden at runtime)
@@ -78,7 +82,7 @@
  * 5) Allow unresolved references (invalid target name) in package objects
  * 6) Enable warning messages for behavior that is not ACPI spec compliant
  */
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
+u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
 
 /*
  * Automatically serialize ALL control methods? Default is FALSE, meaning
@@ -86,27 +90,36 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);
  * Only change this if the ASL code is poorly written and cannot handle
  * reentrancy even though methods are marked "NotSerialized".
  */
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
+u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);
 
 /*
  * Create the predefined _OSI method in the namespace? Default is TRUE
  * because ACPI CA is fully compatible with other ACPI implementations.
  * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
  */
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
+u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);
 
 /*
  * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and
  * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only
  * be enabled just before going to sleep.
  */
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
+u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
 
 /*
  * Optionally use default values for the ACPI register widths. Set this to
  * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
  */
-ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
+u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
+
+/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
+
+struct acpi_table_fadt acpi_gbl_FADT;
+u32 acpi_current_gpe_count;
+u32 acpi_gbl_trace_flags;
+acpi_name acpi_gbl_trace_method_name;
+
+#endif
 
 /*****************************************************************************
  *
@@ -114,11 +127,6 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
  *
  ****************************************************************************/
 
-/* Runtime configuration of debug print levels */
-
-extern u32 acpi_dbg_level;
-extern u32 acpi_dbg_layer;
-
 /* Procedure nesting level for debug output */
 
 extern u32 acpi_gbl_nesting_level;
@@ -127,10 +135,8 @@ extern u32 acpi_gbl_nesting_level;
 
 ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
 ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
-ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
 ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
 ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
-ACPI_EXTERN u32 acpi_gbl_trace_flags;
 
 /*****************************************************************************
  *
@@ -142,10 +148,8 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags;
  * acpi_gbl_root_table_list is the master list of ACPI tables found in the
  * RSDT/XSDT.
  *
- * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
  */
 ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
-ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
 ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS;
 
 /* These addresses are calculated from the FADT Event Block addresses */
@@ -261,7 +265,8 @@ ACPI_EXTERN u8 acpi_gbl_osi_data;
 extern u8 acpi_gbl_shutdown;
 extern u32 acpi_gbl_startup_flags;
 extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
-extern const char *acpi_gbl_highest_dstate_names[4];
+extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
+extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
 
@@ -290,6 +295,7 @@ extern char const *acpi_gbl_exception_names_ctrl[];
 ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;
 ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;
 ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;
+ACPI_EXTERN union acpi_operand_object *acpi_gbl_module_code_list;
 
 extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
 extern const struct acpi_predefined_names
@@ -340,7 +346,6 @@ ACPI_EXTERN struct acpi_fixed_event_handler
 ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
 ACPI_EXTERN struct acpi_gpe_block_info
 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
-ACPI_EXTERN u32 acpi_current_gpe_count;
 
 /*****************************************************************************
  *
index 4afa3d8e0efb298c6d33970e1d2619cabcdbcf49..36192f142fbb5bdc57997d0600c48284c56878c0 100644 (file)
@@ -62,6 +62,14 @@ u32 acpi_hw_get_mode(void);
 /*
  * hwregs - ACPI Register I/O
  */
+acpi_status
+acpi_hw_validate_register(struct acpi_generic_address *reg,
+                         u8 max_bit_width, u64 *address);
+
+acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg);
+
+acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg);
+
 struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
 
 acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
index e8db7a3143a5c1244ee904152be7187d8e1e2e0b..5db9f2916f7c82fa9d3a85166fadda5331f091b9 100644 (file)
@@ -461,9 +461,9 @@ void acpi_ex_acquire_global_lock(u32 rule);
 
 void acpi_ex_release_global_lock(u32 rule);
 
-void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string);
+void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id);
 
-void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string);
+void acpi_ex_integer_to_string(char *dest, acpi_integer value);
 
 /*
  * exregion - default op_region handlers
index ee986edfa0da32704133b949624aa6ff75f3bea2..81e64f478679be04dafdb1a1786e34e72906c310 100644 (file)
@@ -369,6 +369,19 @@ union acpi_predefined_info {
        struct acpi_package_info3 ret_info3;
 };
 
+/* Data block used during object validation */
+
+struct acpi_predefined_data {
+       char *pathname;
+       const union acpi_predefined_info *predefined;
+       u32 flags;
+       u8 node_flags;
+};
+
+/* Defines for Flags field above */
+
+#define ACPI_OBJECT_REPAIRED    1
+
 /*
  * Bitmapped return value types
  * Note: the actual data types must be contiguous, a loop in nspredef.c
@@ -885,6 +898,9 @@ struct acpi_bit_register_info {
 #define ACPI_OSI_WIN_XP_SP2             0x05
 #define ACPI_OSI_WINSRV_2003_SP1        0x06
 #define ACPI_OSI_WIN_VISTA              0x07
+#define ACPI_OSI_WINSRV_2008            0x08
+#define ACPI_OSI_WIN_VISTA_SP1          0x09
+#define ACPI_OSI_WIN_7                  0x0A
 
 #define ACPI_ALWAYS_ILLEGAL             0x00
 
index 91ac7d7b4402a07bf9409cd2c7ef97fae9981e3b..3acd9c6760ea59977262d479f00b99798b1c45c5 100644 (file)
  */
 #define ACPI_ERROR_NAMESPACE(s, e)      acpi_ns_report_error (AE_INFO, s, e);
 #define ACPI_ERROR_METHOD(s, n, p, e)   acpi_ns_report_method_error (AE_INFO, s, n, p, e);
+#define ACPI_WARN_PREDEFINED(plist)     acpi_ut_predefined_warning plist
 
 #else
 
 
 #define ACPI_ERROR_NAMESPACE(s, e)
 #define ACPI_ERROR_METHOD(s, n, p, e)
+#define ACPI_WARN_PREDEFINED(plist)
 #endif         /* ACPI_NO_ERROR_MESSAGES */
 
 /*
index 94cdc2b8cb9385d6814005933810afd6d81e8d72..09a2764c734ba9d8aa6ae95677feb446f9f8d941 100644 (file)
 #define ACPI_NS_WALK_UNLOCK         0x01
 #define ACPI_NS_WALK_TEMP_NODES     0x02
 
+/* Object is not a package element */
+
+#define ACPI_NOT_PACKAGE_ELEMENT    ACPI_UINT32_MAX
+
+/* Always emit warning message, not dependent on node flags */
+
+#define ACPI_WARN_ALWAYS            0
+
 /*
  * nsinit - Namespace initialization
  */
@@ -144,6 +152,8 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name);
 
 void acpi_ns_delete_node(struct acpi_namespace_node *node);
 
+void acpi_ns_remove_node(struct acpi_namespace_node *node);
+
 void
 acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
 
@@ -186,6 +196,8 @@ acpi_ns_dump_objects(acpi_object_type type,
  */
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 
+void acpi_ns_exec_module_code_list(void);
+
 /*
  * nspredef - Support for predefined/reserved names
  */
@@ -259,6 +271,19 @@ acpi_status
 acpi_ns_get_attached_data(struct acpi_namespace_node *node,
                          acpi_object_handler handler, void **data);
 
+/*
+ * nsrepair - return object repair for predefined methods/objects
+ */
+acpi_status
+acpi_ns_repair_object(struct acpi_predefined_data *data,
+                     u32 expected_btypes,
+                     u32 package_index,
+                     union acpi_operand_object **return_object_ptr);
+
+acpi_status
+acpi_ns_repair_package_list(struct acpi_predefined_data *data,
+                           union acpi_operand_object **obj_desc_ptr);
+
 /*
  * nssearch - Namespace searching and entry
  */
index eb6f038b03d9f23d8479fe1a2caa40bab2ee2cb3..b39d682a2140291509423ef6624e3d785d66f639 100644 (file)
@@ -98,6 +98,7 @@
 #define AOPOBJ_SETUP_COMPLETE       0x10
 #define AOPOBJ_SINGLE_DATUM         0x20
 #define AOPOBJ_INVALID              0x40       /* Used if host OS won't allow an op_region address */
+#define AOPOBJ_MODULE_LEVEL         0x80
 
 /******************************************************************************
  *
index 23ee0fbf561970e92c59d6c9e2f8e8324f17d3c0..22881e8ce22983ab71d11ee9177141c4429a9c2e 100644 (file)
@@ -62,6 +62,8 @@
 #define ACPI_PARSE_DEFERRED_OP          0x0100
 #define ACPI_PARSE_DISASSEMBLE          0x0200
 
+#define ACPI_PARSE_MODULE_LEVEL         0x0400
+
 /******************************************************************************
  *
  * Parser interfaces
index 63f656ae3604d6c4acb06049416c9abc3bdcb52d..cd80d1dd195093fc726bc9253a8f1423dc79d4a2 100644 (file)
@@ -64,8 +64,8 @@
  *      (Used for _PRW)
  *
  *
- * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
- *    different types describe the contents of each of the sub-packages.
+ * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each
+ *    of the different types describe the contents of each of the sub-packages.
  *
  * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
  *      object type
@@ -91,6 +91,9 @@
  * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
  *      (Used for _HPX)
  *
+ * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
+ *      (Used for _ART, _FPS)
+ *
  *****************************************************************************/
 
 enum acpi_return_package_types {
@@ -101,9 +104,11 @@ enum acpi_return_package_types {
        ACPI_PTYPE2_COUNT = 5,
        ACPI_PTYPE2_PKG_COUNT = 6,
        ACPI_PTYPE2_FIXED = 7,
-       ACPI_PTYPE2_MIN = 8
+       ACPI_PTYPE2_MIN = 8,
+       ACPI_PTYPE2_REV_FIXED = 9
 };
 
+#ifdef ACPI_CREATE_PREDEFINED_TABLE
 /*
  * Predefined method/object information table.
  *
@@ -136,239 +141,384 @@ enum acpi_return_package_types {
  * is saved here (rather than in a separate table) in order to minimize the
  * overall size of the stored data.
  */
-static const union acpi_predefined_info predefined_names[] = {
-       {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */
-       {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
-       {.info = {"_BCM", 1, 0}},
-       {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_BFS", 1, 0}},
-       {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
-                                         9,
-                                         ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}},        /* fixed (9 Int),(4 Str) */
-       {.info = {"_BLT", 3, 0}},
-       {.info = {"_BMC", 1, 0}},
-       {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},   /* fixed (5 Int) */
-       {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
-       {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}},
-       {.info = {"_BTP", 1, 0}},
-       {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}},      /* see PCI firmware spec 3.0 */
-       {.info = {"_CID", 0,
-        ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}},
-       {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}},    /* variable (Ints/Strs) */
-       {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},   /* variable (1 Int(n), n-1 Int) */
-       {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT,
-                                         ACPI_RTYPE_BUFFER, 1,
-                                         ACPI_RTYPE_INTEGER, 3, 0}},   /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */
-       {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}},
-       {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
-       {.info = {"_DDN", 0, ACPI_RTYPE_STRING}},
-       {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_DIS", 0, 0}},
-       {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
-       {.info = {"_DOS", 1, 0}},
-       {.info = {"_DSM", 4, ACPI_RTYPE_ALL}},  /* Must return a type, but it can be of any type */
-       {.info = {"_DSS", 1, 0}},
-       {.info = {"_DSW", 3, 0}},
-       {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_EJ0", 1, 0}},
-       {.info = {"_EJ1", 1, 0}},
-       {.info = {"_EJ2", 1, 0}},
-       {.info = {"_EJ3", 1, 0}},
-       {.info = {"_EJ4", 1, 0}},
-       {.info = {"_EJD", 0, ACPI_RTYPE_STRING}},
-       {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}},  /* fixed (16 Int) */
-       {.info = {"_FDM", 1, 0}},
-       {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},     /* variable (Ints) */
-       {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}},      /* _GPE method, not _GPE scope */
-       {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_GTS", 1, 0}},
-       {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
-       {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
+static const union acpi_predefined_info predefined_names[] =
+{
+       {{"_AC0", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC1", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC2", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC3", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC4", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC5", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC6", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC7", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC8", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AC9", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ADR", 0, ACPI_RTYPE_INTEGER}},
+       {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_ALC", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ALI", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ALP", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */
+                         {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}},
+
+       {{"_ALT", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ART", 0, ACPI_RTYPE_PACKAGE}},      /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */
+       {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER},
+         11, 0}},
+
+       {{"_BBN", 0, ACPI_RTYPE_INTEGER}},
+       {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+       {{"_BCM", 1, 0}},
+       {{"_BCT", 1, ACPI_RTYPE_INTEGER}},
+       {{"_BDN", 0, ACPI_RTYPE_INTEGER}},
+       {{"_BFS", 1, 0}},
+       {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}},
+
+       {{"_BIX", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (16 Int),(4 Str) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4,
+         0}},
+
+       {{"_BLT", 3, 0}},
+       {{"_BMA", 1, ACPI_RTYPE_INTEGER}},
+       {{"_BMC", 1, 0}},
+       {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+       {{"_BMS", 1, ACPI_RTYPE_INTEGER}},
+       {{"_BQC", 0, ACPI_RTYPE_INTEGER}},
+       {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
+
+       {{"_BTM", 1, ACPI_RTYPE_INTEGER}},
+       {{"_BTP", 1, 0}},
+       {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */
+       {{"_CDM", 0, ACPI_RTYPE_INTEGER}},
+       {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}},
+
+       {{"_CRS", 0, ACPI_RTYPE_BUFFER}},
+       {{"_CRT", 0, ACPI_RTYPE_INTEGER}},
+       {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */
+                         {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+       {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
+                         {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}},
+
+       {{"_DCK", 1, ACPI_RTYPE_INTEGER}},
+       {{"_DCS", 0, ACPI_RTYPE_INTEGER}},
+       {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
+       {{"_DDN", 0, ACPI_RTYPE_STRING}},
+       {{"_DGS", 0, ACPI_RTYPE_INTEGER}},
+       {{"_DIS", 0, 0}},
+       {{"_DMA", 0, ACPI_RTYPE_BUFFER}},
+       {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+       {{"_DOS", 1, 0}},
+       {{"_DSM", 4, ACPI_RTYPE_ALL}},     /* Must return a type, but it can be of any type */
+       {{"_DSS", 1, 0}},
+       {{"_DSW", 3, 0}},
+       {{"_DTI", 1, 0}},
+       {{"_EC_", 0, ACPI_RTYPE_INTEGER}},
+       {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_EJ0", 1, 0}},
+       {{"_EJ1", 1, 0}},
+       {{"_EJ2", 1, 0}},
+       {{"_EJ3", 1, 0}},
+       {{"_EJ4", 1, 0}},
+       {{"_EJD", 0, ACPI_RTYPE_STRING}},
+       {{"_FDE", 0, ACPI_RTYPE_BUFFER}},
+       {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}},
+
+       {{"_FDM", 1, 0}},
+       {{"_FIF", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (4 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0}, 0, 0}},
+
+       {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}},
+
+       {{"_FPS", 0, ACPI_RTYPE_PACKAGE}},      /* Variable-length (1 Int(rev), n Pkg (5 Int) */
+       {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0}, 0, 0}},
+
+       {{"_FSL", 1, 0}},
+       {{"_FST", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (3 Int) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}},
+
+       {{"_GAI", 0, ACPI_RTYPE_INTEGER}},
+       {{"_GHL", 0, ACPI_RTYPE_INTEGER}},
+       {{"_GLK", 0, ACPI_RTYPE_INTEGER}},
+       {{"_GPD", 0, ACPI_RTYPE_INTEGER}},
+       {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
+       {{"_GSB", 0, ACPI_RTYPE_INTEGER}},
+       {{"_GTF", 0, ACPI_RTYPE_BUFFER}},
+       {{"_GTM", 0, ACPI_RTYPE_BUFFER}},
+       {{"_GTS", 1, 0}},
+       {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+       {{"_HOT", 0, ACPI_RTYPE_INTEGER}},
+       {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
 
        /*
-        * For _HPX, a single package is returned, containing a variable number of sub-packages.
-        * Each sub-package contains a PCI record setting. There are several different type of
-        * record settings, of different lengths, but all elements of all settings are Integers.
+        * For _HPX, a single package is returned, containing a Variable-length number
+        * of sub-packages. Each sub-package contains a PCI record setting.
+        * There are several different type of record settings, of different
+        * lengths, but all elements of all settings are Integers.
         */
-       {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},     /* variable (Pkgs) each (var Ints) */
-       {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}},      /* see IPMI spec */
-       {.info = {"_INI", 0, 0}},
-       {.info = {"_IRC", 0, 0}},
-       {.info = {"_LCK", 1, 0}},
-       {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}},  /* variable (Pkgs) each (2 Str) */
-       {.info = {"_MSG", 1, 0}},
-       {.info = {"_OFF", 0, 0}},
-       {.info = {"_ON_", 0, 0}},
-       {.info = {"_OS_", 0, ACPI_RTYPE_STRING}},
-       {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}},
-       {.info = {"_OST", 3, 0}},
-       {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}},    /* fixed (2 Buf) */
-       {.info = {"_PDC", 1, 0}},
-       {.info = {"_PIC", 1, 0}},
-       {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}},      /* variable (Bufs) */
-       {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}},      /* see dig64 spec */
-       {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}},
+       {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */
+                         {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+       {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
+       {{"_INI", 0, 0}},
+       {{"_IRC", 0, 0}},
+       {{"_LCK", 1, 0}},
+       {{"_LID", 0, ACPI_RTYPE_INTEGER}},
+       {{"_MAT", 0, ACPI_RTYPE_BUFFER}},
+       {{"_MBM", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (8 Int) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}},
+
+       {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */
+                         {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}},
+
+       {{"_MSG", 1, 0}},
+       {{"_MSM", 4, ACPI_RTYPE_INTEGER}},
+       {{"_NTT", 0, ACPI_RTYPE_INTEGER}},
+       {{"_OFF", 0, 0}},
+       {{"_ON_", 0, 0}},
+       {{"_OS_", 0, ACPI_RTYPE_STRING}},
+       {{"_OSC", 4, ACPI_RTYPE_BUFFER}},
+       {{"_OST", 3, 0}},
+       {{"_PAI", 1, ACPI_RTYPE_INTEGER}},
+       {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
+
+       {{"_PDC", 1, 0}},
+       {{"_PDL", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PIC", 1, 0}},
+       {{"_PIF", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (3 Int),(3 Str) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3, 0}},
+
+       {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}},
+
+       {{"_PMC", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (11 Int),(3 Str) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3,
+         0}},
+
+       {{"_PMD", 0, ACPI_RTYPE_PACKAGE}},      /* Variable-length (Refs) */
+       {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
+
+       {{"_PMM", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PPC", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */
+       {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_PR3", 0, ACPI_RTYPE_PACKAGE}},      /* Variable-length (Refs) */
+       {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
+
+       {{"_PRL", 0, ACPI_RTYPE_PACKAGE}},      /* Variable-length (Refs) */
+       {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}},
+
+       {{"_PRS", 0, ACPI_RTYPE_BUFFER}},
 
        /*
-        * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
-        * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
-        * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
-        * type to the 2nd element (index 1) in the statement below.
+        * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source
+        * and source_index). This bug is so prevalent that there is code in the
+        * ACPICA Resource Manager to detect this and switch them back. For now,
+        * do not allow and issue a warning. To allow this and eliminate the
+        * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3)
+        * in the statement below.
         */
-       {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4,
-                                         ACPI_RTYPE_INTEGER,
-                                         ACPI_RTYPE_INTEGER,
-                                         ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}},      /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */
-
-       {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2,
-                                         ACPI_RTYPE_INTEGER |
-                                         ACPI_RTYPE_PACKAGE,
-                                         ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}},        /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */
-
-       {.info = {"_PS0", 0, 0}},
-       {.info = {"_PS1", 0, 0}},
-       {.info = {"_PS2", 0, 0}},
-       {.info = {"_PS3", 0, 0}},
-       {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}},   /* variable (Pkgs) each (5 Int) with count */
-       {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */
-       {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_PSW", 1, 0}},
-       {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}},    /* fixed (2 Buf) */
-       {.info = {"_PTS", 1, 0}},
-       {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_REG", 2, 0}},
-       {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}},
-       {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */
+                         {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER},
+                         ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE,
+                         ACPI_RTYPE_INTEGER}},
+
+       {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */
+                         {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE,
+                         ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}},
+
+       {{"_PS0", 0, 0}},
+       {{"_PS1", 0, 0}},
+       {{"_PS2", 0, 0}},
+       {{"_PS3", 0, 0}},
+       {{"_PSC", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */
+                         {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}},
+
+       {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_PSR", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */
+                         {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}},
+
+       {{"_PSV", 0, ACPI_RTYPE_INTEGER}},
+       {{"_PSW", 1, 0}},
+       {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}},
+
+       {{"_PTP", 2, ACPI_RTYPE_INTEGER}},
+       {{"_PTS", 1, 0}},
+       {{"_PUR", 0, ACPI_RTYPE_PACKAGE}},      /* Fixed-length (2 Int) */
+       {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0}, 0, 0}},
+
+       {{"_PXM", 0, ACPI_RTYPE_INTEGER}},
+       {{"_REG", 2, 0}},
+       {{"_REV", 0, ACPI_RTYPE_INTEGER}},
+       {{"_RMV", 0, ACPI_RTYPE_INTEGER}},
+       {{"_ROM", 2, ACPI_RTYPE_BUFFER}},
+       {{"_RTV", 0, ACPI_RTYPE_INTEGER}},
 
        /*
-        * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer,
-        * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length",
-        * but all elements must be Integers.
+        * For _S0_ through _S5_, the ACPI spec defines a return Package
+        * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers.
+        * Allow this by making the objects "Variable-length length", but all elements
+        * must be Integers.
         */
-       {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-       {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-       {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-       {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-       {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-       {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}},     /* fixed (1 Int) */
-
-       {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_SCP", 0x13, 0}},    /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
-       /* Note: the 3-arg definition may be removed for ACPI 4.0 */
-       {.info = {"_SDD", 1, 0}},
-       {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}},
-       {.info = {"_SRS", 1, 0}},
-       {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}},      /* see IPMI spec */
-       {.info = {"_SST", 1, 0}},
-       {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_STM", 3, 0}},
-       {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}},
-       {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TPT", 1, 0}},
-       {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2,
-                                         ACPI_RTYPE_INTEGER, 6, 0}},   /* variable (Pkgs) each 2_ref/6_int */
-       {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}},   /* variable (Pkgs) each 5_int with count */
-       {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */
-       {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_TTS", 1, 0}},
-       {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}},   /* variable (Refs) */
-       {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}},
-       {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
-       {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}},   /* fixed (4 Int) */
-       {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}},
-       {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}},
+
+       {{"_S1D", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S2D", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S3D", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S4D", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S0W", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S1W", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S2W", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S3W", 0, ACPI_RTYPE_INTEGER}},
+       {{"_S4W", 0, ACPI_RTYPE_INTEGER}},
+       {{"_SBS", 0, ACPI_RTYPE_INTEGER}},
+       {{"_SCP", 0x13, 0}},               /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
+                          /* Note: the 3-arg definition may be removed for ACPI 4.0 */
+       {{"_SDD", 1, 0}},
+       {{"_SEG", 0, ACPI_RTYPE_INTEGER}},
+       {{"_SHL", 1, ACPI_RTYPE_INTEGER}},
+       {{"_SLI", 0, ACPI_RTYPE_BUFFER}},
+       {{"_SPD", 1, ACPI_RTYPE_INTEGER}},
+       {{"_SRS", 1, 0}},
+       {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */
+       {{"_SST", 1, 0}},
+       {{"_STA", 0, ACPI_RTYPE_INTEGER}},
+       {{"_STM", 3, 0}},
+       {{"_STP", 2, ACPI_RTYPE_INTEGER}},
+       {{"_STR", 0, ACPI_RTYPE_BUFFER}},
+       {{"_STV", 2, ACPI_RTYPE_INTEGER}},
+       {{"_SUN", 0, ACPI_RTYPE_INTEGER}},
+       {{"_SWS", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TC1", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TC2", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TIP", 1, ACPI_RTYPE_INTEGER}},
+       {{"_TIV", 1, ACPI_RTYPE_INTEGER}},
+       {{"_TMP", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TPC", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TPT", 1, 0}},
+       {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2_ref/6_int */
+                         {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}},
+
+       {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int with count */
+                         {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+       {{"_TSP", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int */
+                         {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}},
+
+       {{"_TST", 0, ACPI_RTYPE_INTEGER}},
+       {{"_TTS", 1, 0}},
+       {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */
+                         {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}},
+
+       {{"_TZM", 0, ACPI_RTYPE_REFERENCE}},
+       {{"_TZP", 0, ACPI_RTYPE_INTEGER}},
+       {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
+       {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */
+                         {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}},
+
+       {{"_UPD", 0, ACPI_RTYPE_INTEGER}},
+       {{"_UPP", 0, ACPI_RTYPE_INTEGER}},
+       {{"_VPO", 0, ACPI_RTYPE_INTEGER}},
 
        /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
 
-       {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
-       {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}},      /* fixed (2 Int), but is optional */
-       {.ret_info = {0, 0, 0, 0, 0, 0}}        /* Table terminator */
+       {{"_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 */
+
+       {{{0,0,0,0}, 0,0}} /* Table terminator */
 };
 
 #if 0
        /* Not implemented */
 
-{
-"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */
+       {{"_WDG", 0, ACPI_RTYPE_BUFFER}},  /* MS Extension */
+       {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
 
-{
-"_WED", 1, ACPI_RTYPE_PACKAGE},        /* MS Extension */
+       /* This is an internally implemented control method, no need to check */
+       {{"_OSI", 1, ACPI_RTYPE_INTEGER}},
 
-    /* This is an internally implemented control method, no need to check */
-{
-"_OSI", 1, ACPI_RTYPE_INTEGER},
+       /* TBD: */
+
+       _PRT - currently ignore reversed entries. attempt to fix here?
+       think about possibly fixing package elements like _BIF, etc.
+#endif
 
-    /* TBD: */
-    _PRT - currently ignore reversed entries.attempt to fix here ?
-    think about code that attempts to fix package elements like _BIF, etc.
 #endif
 #endif
index 897810ba0ccc46462f39e8d8b50a3dc9e0835a77..863a264b829e4234bed3ed9db92eaf4c8f6c2edc 100644 (file)
@@ -324,26 +324,30 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
 acpi_status
 acpi_ut_evaluate_numeric_object(char *object_name,
                                struct acpi_namespace_node *device_node,
-                               acpi_integer * address);
+                               acpi_integer *value);
 
 acpi_status
-acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
-                   struct acpica_device_id *hid);
+acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
 
 acpi_status
-acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
-                   struct acpi_compatible_id_list **return_cid_list);
+acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
+                             const char **method_names,
+                             u8 method_count, u8 *out_values);
 
+/*
+ * utids - device ID support
+ */
 acpi_status
-acpi_ut_execute_STA(struct acpi_namespace_node *device_node,
-                   u32 * status_flags);
+acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
+                   struct acpica_device_id **return_id);
 
 acpi_status
 acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
-                   struct acpica_device_id *uid);
+                   struct acpica_device_id **return_id);
 
 acpi_status
-acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest);
+acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
+                   struct acpica_device_id_list **return_cid_list);
 
 /*
  * utlock - reader/writer locks
@@ -445,6 +449,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
  */
 const char *acpi_ut_validate_exception(acpi_status status);
 
+u8 acpi_ut_is_pci_root_bridge(char *id);
+
 u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
 
 acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
@@ -469,6 +475,12 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position);
 acpi_status
 acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer);
 
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_predefined_warning(const char *module_name,
+                          u32 line_number,
+                          char *pathname,
+                          u8 node_flags, const char *format, ...);
+
 /* Values for Base above (16=Hex, 10=Decimal) */
 
 #define ACPI_ANY_BASE        0
index 067f967eb389cf720b2ee7d9a25b840ca3477443..4940249f252427ef093e2fb93f2d9497c4f07ca6 100644 (file)
@@ -404,6 +404,7 @@ typedef enum {
        REGION_SMBUS,
        REGION_CMOS,
        REGION_PCI_BAR,
+       REGION_IPMI,
        REGION_DATA_TABLE,      /* Internal use only */
        REGION_FIXED_HW = 0x7F
 } AML_REGION_TYPES;
index 53e27bc5a734214cb9b76e2db9fec5cea0fbdf26..54a225e56a64f33188a8cdd05d31ad157431fb9b 100644 (file)
@@ -123,9 +123,12 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
                flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
                    ACPI_NS_ERROR_IF_FOUND;
 
-               /* Mark node temporary if we are executing a method */
-
-               if (walk_state->method_node) {
+               /*
+                * Mark node temporary if we are executing a normal control
+                * method. (Don't mark if this is a module-level code method)
+                */
+               if (walk_state->method_node &&
+                   !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                        flags |= ACPI_NS_TEMPORARY;
                }
 
@@ -456,9 +459,12 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
        flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
            ACPI_NS_ERROR_IF_FOUND;
 
-       /* Mark node(s) temporary if we are executing a method */
-
-       if (walk_state->method_node) {
+       /*
+        * Mark node(s) temporary if we are executing a normal control
+        * method. (Don't mark if this is a module-level code method)
+        */
+       if (walk_state->method_node &&
+           !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
                flags |= ACPI_NS_TEMPORARY;
        }
 
index 14b8b8ed802367c15c814f87695372856d3ca1af..567a4899a0186a2667295bba73a0918ecbb33b1b 100644 (file)
@@ -578,10 +578,15 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
                }
 
                /*
-                * Delete any namespace objects created anywhere within
-                * the namespace by the execution of this method
+                * Delete any namespace objects created anywhere within the
+                * namespace by the execution of this method. Unless this method
+                * is a module-level executable code method, in which case we
+                * want make the objects permanent.
                 */
-               acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id);
+               if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) {
+                       acpi_ns_delete_namespace_by_owner(method_desc->method.
+                                                         owner_id);
+               }
        }
 
        /* Decrement the thread count on the method */
@@ -622,7 +627,9 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
 
                /* No more threads, we can free the owner_id */
 
-               acpi_ut_release_owner_id(&method_desc->method.owner_id);
+               if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) {
+                       acpi_ut_release_owner_id(&method_desc->method.owner_id);
+               }
        }
 
        return_VOID;
index 22b1a3ce2c942361ede66d348137edee3ef4d2d9..7d077bb2f525c1190f291ee9536e37d0c1d3cea4 100644 (file)
@@ -433,10 +433,10 @@ acpi_ds_method_data_get_value(u8 type,
 
                        case ACPI_REFCLASS_LOCAL:
 
-                               ACPI_ERROR((AE_INFO,
-                                           "Uninitialized Local[%d] at node %p",
-                                           index, node));
-
+                               /*
+                                * No error message for this case, will be trapped again later to
+                                * detect and ignore cases of Store(local_x,local_x)
+                                */
                                return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
                        default:
index 02e6caad4a7610718bb4d52df924a86ef5bf10e4..507e1f0bbdfd942eec8bb0d1b0ecdc2c4b7896e1 100644 (file)
@@ -482,14 +482,27 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
        if (arg) {
                /*
                 * num_elements was exhausted, but there are remaining elements in the
-                * package_list.
+                * package_list. Truncate the package to num_elements.
                 *
                 * Note: technically, this is an error, from ACPI spec: "It is an error
                 * for NumElements to be less than the number of elements in the
-                * PackageList". However, for now, we just print an error message and
-                * no exception is returned.
+                * PackageList". However, we just print an error message and
+                * no exception is returned. This provides Windows compatibility. Some
+                * BIOSs will alter the num_elements on the fly, creating this type
+                * of ill-formed package object.
                 */
                while (arg) {
+                       /*
+                        * We must delete any package elements that were created earlier
+                        * and are not going to be used because of the package truncation.
+                        */
+                       if (arg->common.node) {
+                               acpi_ut_remove_reference(ACPI_CAST_PTR
+                                                        (union
+                                                         acpi_operand_object,
+                                                         arg->common.node));
+                               arg->common.node = NULL;
+                       }
 
                        /* Find out how many elements there really are */
 
@@ -498,7 +511,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
                }
 
                ACPI_WARNING((AE_INFO,
-                           "Package List length (%X) larger than NumElements count (%X), truncated\n",
+                           "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n",
                            i, element_count));
        } else if (i < element_count) {
                /*
@@ -506,7 +519,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
                 * Note: this is not an error, the package is padded out with NULLs.
                 */
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n",
+                                 "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n",
                                  i, element_count));
        }
 
index 3023ceaa8d544d8d0c52a53d0dff2dc13facbd6c..6de3a99d4cd4efa3b54fd154ce89bbba0e76b94f 100644 (file)
@@ -581,21 +581,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
                if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
                     (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
                    (!(walk_state->op_info->flags & AML_NAMED))) {
-#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
-                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-                           (walk_state->op_info->class == AML_CLASS_CONTROL)) {
-                               ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                                 "Begin/EXEC: %s (fl %8.8X)\n",
-                                                 walk_state->op_info->name,
-                                                 walk_state->op_info->flags));
-
-                               /* Executing a type1 or type2 opcode outside of a method */
-
-                               status =
-                                   acpi_ds_exec_begin_op(walk_state, out_op);
-                               return_ACPI_STATUS(status);
-                       }
-#endif
                        return_ACPI_STATUS(AE_OK);
                }
 
@@ -768,7 +753,13 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
 
                        /* Execution mode, node cannot already exist, node is temporary */
 
-                       flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
+                       flags |= ACPI_NS_ERROR_IF_FOUND;
+
+                       if (!
+                           (walk_state->
+                            parse_flags & ACPI_PARSE_MODULE_LEVEL)) {
+                               flags |= ACPI_NS_TEMPORARY;
+                       }
                }
 
                /* Add new entry or lookup existing entry */
@@ -851,24 +842,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
        /* Check if opcode had an associated namespace object */
 
        if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
-#ifndef ACPI_NO_METHOD_EXECUTION
-#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
-               /* No namespace object. Executable opcode? */
-
-               if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-                   (walk_state->op_info->class == AML_CLASS_CONTROL)) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                                         "End/EXEC:   %s (fl %8.8X)\n",
-                                         walk_state->op_info->name,
-                                         walk_state->op_info->flags));
-
-                       /* Executing a type1 or type2 opcode outside of a method */
-
-                       status = acpi_ds_exec_end_op(walk_state);
-                       return_ACPI_STATUS(status);
-               }
-#endif
-#endif
                return_ACPI_STATUS(AE_OK);
        }
 
index b9d8ee69ca6c8d28bd02cd18f813d9a50cc21134..afacf4416c738941287f944d599dd13011b6caf6 100644 (file)
@@ -424,8 +424,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                        /* Read the Status Register */
 
                        status =
-                           acpi_read(&status_reg,
-                                     &gpe_register_info->status_address);
+                           acpi_hw_read(&status_reg,
+                                        &gpe_register_info->status_address);
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
@@ -433,8 +433,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
                        /* Read the Enable Register */
 
                        status =
-                           acpi_read(&enable_reg,
-                                     &gpe_register_info->enable_address);
+                           acpi_hw_read(&enable_reg,
+                                        &gpe_register_info->enable_address);
                        if (ACPI_FAILURE(status)) {
                                goto unlock_and_exit;
                        }
index 7b3463639422f387115dd2f07c53110216ac2a53..a60aaa7635f36857777acdc3fd906246c4da56ec 100644 (file)
@@ -843,14 +843,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
 
                /* Disable all GPEs within this register */
 
-               status = acpi_write(0x00, &this_register->enable_address);
+               status = acpi_hw_write(0x00, &this_register->enable_address);
                if (ACPI_FAILURE(status)) {
                        goto error_exit;
                }
 
                /* Clear any pending GPE events within this register */
 
-               status = acpi_write(0xFF, &this_register->status_address);
+               status = acpi_hw_write(0xFF, &this_register->status_address);
                if (ACPI_FAILURE(status)) {
                        goto error_exit;
                }
index 284a7becbe96ae814f9dc376a6679ebc75467668..cf29c4953028dbeaf2cd33a25c1a0c8dd184826b 100644 (file)
@@ -50,8 +50,6 @@
 ACPI_MODULE_NAME("evrgnini")
 
 /* Local prototypes */
-static u8 acpi_ev_match_pci_root_bridge(char *id);
-
 static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node);
 
 /*******************************************************************************
@@ -330,37 +328,6 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
        return_ACPI_STATUS(AE_OK);
 }
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ev_match_pci_root_bridge
- *
- * PARAMETERS:  Id              - The HID/CID in string format
- *
- * RETURN:      TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
- *
- * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
- *
- ******************************************************************************/
-
-static u8 acpi_ev_match_pci_root_bridge(char *id)
-{
-
-       /*
-        * Check if this is a PCI root.
-        * ACPI 3.0+: check for a PCI Express root also.
-        */
-       if (!(ACPI_STRNCMP(id,
-                          PCI_ROOT_HID_STRING,
-                          sizeof(PCI_ROOT_HID_STRING))) ||
-           !(ACPI_STRNCMP(id,
-                          PCI_EXPRESS_ROOT_HID_STRING,
-                          sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) {
-               return (TRUE);
-       }
-
-       return (FALSE);
-}
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ev_is_pci_root_bridge
@@ -377,9 +344,10 @@ static u8 acpi_ev_match_pci_root_bridge(char *id)
 static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
 {
        acpi_status status;
-       struct acpica_device_id hid;
-       struct acpi_compatible_id_list *cid;
+       struct acpica_device_id *hid;
+       struct acpica_device_id_list *cid;
        u32 i;
+       u8 match;
 
        /* Get the _HID and check for a PCI Root Bridge */
 
@@ -388,7 +356,10 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
                return (FALSE);
        }
 
-       if (acpi_ev_match_pci_root_bridge(hid.value)) {
+       match = acpi_ut_is_pci_root_bridge(hid->string);
+       ACPI_FREE(hid);
+
+       if (match) {
                return (TRUE);
        }
 
@@ -402,7 +373,7 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
        /* Check all _CIDs in the returned list */
 
        for (i = 0; i < cid->count; i++) {
-               if (acpi_ev_match_pci_root_bridge(cid->id[i].value)) {
+               if (acpi_ut_is_pci_root_bridge(cid->ids[i].string)) {
                        ACPI_FREE(cid);
                        return (TRUE);
                }
index 277fd609611aec1a92eb5717c21724425ce4f61a..24afef81af39af0781b0735e61d1b4cc96b7c059 100644 (file)
@@ -110,8 +110,15 @@ acpi_ex_add_table(u32 table_index,
        if (ACPI_FAILURE(status)) {
                acpi_ut_remove_reference(obj_desc);
                *ddb_handle = NULL;
+               return_ACPI_STATUS(status);
        }
 
+       /* Execute any module-level code that was found in the table */
+
+       acpi_ex_exit_interpreter();
+       acpi_ns_exec_module_code_list();
+       acpi_ex_enter_interpreter();
+
        return_ACPI_STATUS(status);
 }
 
index ec524614e7087c42e3337614b319e2a2f67278ca..de3446372ddc04cf4c7aa037703a82fa8d022ae8 100644 (file)
@@ -418,9 +418,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
                case ACPI_EXD_REFERENCE:
 
                        acpi_ex_out_string("Class Name",
-                                          (char *)
-                                          acpi_ut_get_reference_name
-                                          (obj_desc));
+                                          ACPI_CAST_PTR(char,
+                                                        acpi_ut_get_reference_name
+                                                        (obj_desc)));
                        acpi_ex_dump_reference_obj(obj_desc);
                        break;
 
index 546dcdd8678562b3795c31eb3e0248caa5c828ab..0b33d6c887b91a3600e9b26bdee1b2e1d825f112 100644 (file)
@@ -72,6 +72,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
        union acpi_operand_object *buffer_desc;
        acpi_size length;
        void *buffer;
+       u32 function;
 
        ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc);
 
@@ -97,13 +98,27 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
                }
        } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
                   (obj_desc->field.region_obj->region.space_id ==
-                   ACPI_ADR_SPACE_SMBUS)) {
+                   ACPI_ADR_SPACE_SMBUS
+                   || obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_IPMI)) {
                /*
-                * This is an SMBus read.  We must create a buffer to hold the data
-                * and directly access the region handler.
+                * This is an SMBus or IPMI read. We must create a buffer to hold
+                * the data and then directly access the region handler.
+                *
+                * Note: Smbus protocol value is passed in upper 16-bits of Function
                 */
-               buffer_desc =
-                   acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
+               if (obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_SMBUS) {
+                       length = ACPI_SMBUS_BUFFER_SIZE;
+                       function =
+                           ACPI_READ | (obj_desc->field.attribute << 16);
+               } else {        /* IPMI */
+
+                       length = ACPI_IPMI_BUFFER_SIZE;
+                       function = ACPI_READ;
+               }
+
+               buffer_desc = acpi_ut_create_buffer_object(length);
                if (!buffer_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
@@ -112,16 +127,13 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
 
                acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
 
-               /*
-                * Perform the read.
-                * Note: Smbus protocol value is passed in upper 16-bits of Function
-                */
+               /* Call the region handler for the read */
+
                status = acpi_ex_access_region(obj_desc, 0,
                                               ACPI_CAST_PTR(acpi_integer,
                                                             buffer_desc->
                                                             buffer.pointer),
-                                              ACPI_READ | (obj_desc->field.
-                                                           attribute << 16));
+                                              function);
                acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
                goto exit;
        }
@@ -212,6 +224,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
        u32 length;
        void *buffer;
        union acpi_operand_object *buffer_desc;
+       u32 function;
 
        ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc);
 
@@ -234,39 +247,56 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
                }
        } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
                   (obj_desc->field.region_obj->region.space_id ==
-                   ACPI_ADR_SPACE_SMBUS)) {
+                   ACPI_ADR_SPACE_SMBUS
+                   || obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_IPMI)) {
                /*
-                * This is an SMBus write.  We will bypass the entire field mechanism
-                * and handoff the buffer directly to the handler.
+                * This is an SMBus or IPMI write. We will bypass the entire field
+                * mechanism and handoff the buffer directly to the handler. For
+                * these address spaces, the buffer is bi-directional; on a write,
+                * return data is returned in the same buffer.
+                *
+                * Source must be a buffer of sufficient size:
+                * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE.
                 *
-                * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
+                * Note: SMBus protocol type is passed in upper 16-bits of Function
                 */
                if (source_desc->common.type != ACPI_TYPE_BUFFER) {
                        ACPI_ERROR((AE_INFO,
-                                   "SMBus write requires Buffer, found type %s",
+                                   "SMBus or IPMI write requires Buffer, found type %s",
                                    acpi_ut_get_object_type_name(source_desc)));
 
                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
 
-               if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
+               if (obj_desc->field.region_obj->region.space_id ==
+                   ACPI_ADR_SPACE_SMBUS) {
+                       length = ACPI_SMBUS_BUFFER_SIZE;
+                       function =
+                           ACPI_WRITE | (obj_desc->field.attribute << 16);
+               } else {        /* IPMI */
+
+                       length = ACPI_IPMI_BUFFER_SIZE;
+                       function = ACPI_WRITE;
+               }
+
+               if (source_desc->buffer.length < length) {
                        ACPI_ERROR((AE_INFO,
-                                   "SMBus write requires Buffer of length %X, found length %X",
-                                   ACPI_SMBUS_BUFFER_SIZE,
-                                   source_desc->buffer.length));
+                                   "SMBus or IPMI write requires Buffer of length %X, found length %X",
+                                   length, source_desc->buffer.length));
 
                        return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
                }
 
-               buffer_desc =
-                   acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
+               /* Create the bi-directional buffer */
+
+               buffer_desc = acpi_ut_create_buffer_object(length);
                if (!buffer_desc) {
                        return_ACPI_STATUS(AE_NO_MEMORY);
                }
 
                buffer = buffer_desc->buffer.pointer;
-               ACPI_MEMCPY(buffer, source_desc->buffer.pointer,
-                           ACPI_SMBUS_BUFFER_SIZE);
+               ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length);
 
                /* Lock entire transaction if requested */
 
@@ -275,12 +305,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
                /*
                 * Perform the write (returns status and perhaps data in the
                 * same buffer)
-                * Note: SMBus protocol type is passed in upper 16-bits of Function.
                 */
                status = acpi_ex_access_region(obj_desc, 0,
                                               (acpi_integer *) buffer,
-                                              ACPI_WRITE | (obj_desc->field.
-                                                            attribute << 16));
+                                              function);
                acpi_ex_release_global_lock(obj_desc->common_field.field_flags);
 
                *result_desc = buffer_desc;
index 6687be167f5f67c6d6b30c5c6b24d3cfd19a7346..d7b3b418fb45739e82efdc20a6a2477270511842 100644 (file)
@@ -120,12 +120,13 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
        }
 
        /*
-        * Exit now for SMBus address space, it has a non-linear address space
+        * Exit now for SMBus or IPMI address space, it has a non-linear address space
         * and the request cannot be directly validated
         */
-       if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
+       if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS ||
+           rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) {
 
-               /* SMBus has a non-linear address space */
+               /* SMBus or IPMI has a non-linear address space */
 
                return_ACPI_STATUS(AE_OK);
        }
index 87730e944132b9b11455c31cd363a0d51418fcfb..7d41f99f70522b4683803c84485b74c081da2724 100644 (file)
@@ -358,50 +358,67 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
  *
  * FUNCTION:    acpi_ex_eisa_id_to_string
  *
- * PARAMETERS:  numeric_id      - EISA ID to be converted
+ * PARAMETERS:  compressed_id   - EISAID to be converted
  *              out_string      - Where to put the converted string (8 bytes)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Convert a numeric EISA ID to string representation
+ * DESCRIPTION: Convert a numeric EISAID to string representation. Return
+ *              buffer must be large enough to hold the string. The string
+ *              returned is always exactly of length ACPI_EISAID_STRING_SIZE
+ *              (includes null terminator). The EISAID is always 32 bits.
  *
  ******************************************************************************/
 
-void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string)
+void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id)
 {
-       u32 eisa_id;
+       u32 swapped_id;
 
        ACPI_FUNCTION_ENTRY();
 
+       /* The EISAID should be a 32-bit integer */
+
+       if (compressed_id > ACPI_UINT32_MAX) {
+               ACPI_WARNING((AE_INFO,
+                             "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating",
+                             ACPI_FORMAT_UINT64(compressed_id)));
+       }
+
        /* Swap ID to big-endian to get contiguous bits */
 
-       eisa_id = acpi_ut_dword_byte_swap(numeric_id);
+       swapped_id = acpi_ut_dword_byte_swap((u32)compressed_id);
 
-       out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f));
-       out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f));
-       out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f));
-       out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12);
-       out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8);
-       out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4);
-       out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0);
+       /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */
+
+       out_string[0] =
+           (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F));
+       out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F));
+       out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F));
+       out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12);
+       out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8);
+       out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4);
+       out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0);
        out_string[7] = 0;
 }
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ex_unsigned_integer_to_string
+ * FUNCTION:    acpi_ex_integer_to_string
  *
- * PARAMETERS:  Value           - Value to be converted
- *              out_string      - Where to put the converted string (8 bytes)
+ * PARAMETERS:  out_string      - Where to put the converted string. At least
+ *                                21 bytes are needed to hold the largest
+ *                                possible 64-bit integer.
+ *              Value           - Value to be converted
  *
  * RETURN:      None, string
  *
- * DESCRIPTION: Convert a number to string representation. Assumes string
- *              buffer is large enough to hold the string.
+ * DESCRIPTION: Convert a 64-bit integer to decimal string representation.
+ *              Assumes string buffer is large enough to hold the string. The
+ *              largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1).
  *
  ******************************************************************************/
 
-void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string)
+void acpi_ex_integer_to_string(char *out_string, acpi_integer value)
 {
        u32 count;
        u32 digits_needed;
index d3b7e37c9eedb0f64df524be51d597fad1e8eba8..c28c41b3180bc585dd182aa983cda8abc46ba419 100644 (file)
@@ -82,7 +82,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
        /* Get current value of the enable register that contains this GPE */
 
-       status = acpi_read(&enable_mask, &gpe_register_info->enable_address);
+       status = acpi_hw_read(&enable_mask, &gpe_register_info->enable_address);
        if (ACPI_FAILURE(status)) {
                return (status);
        }
@@ -95,7 +95,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
 
        /* Write the updated enable mask */
 
-       status = acpi_write(enable_mask, &gpe_register_info->enable_address);
+       status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
        return (status);
 }
 
@@ -130,8 +130,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
 
        /* Write the entire GPE (runtime) enable register */
 
-       status = acpi_write(gpe_register_info->enable_for_run,
-                           &gpe_register_info->enable_address);
+       status = acpi_hw_write(gpe_register_info->enable_for_run,
+                              &gpe_register_info->enable_address);
 
        return (status);
 }
@@ -163,8 +163,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
         * Write a one to the appropriate bit in the status register to
         * clear this GPE.
         */
-       status = acpi_write(register_bit,
-                           &gpe_event_info->register_info->status_address);
+       status = acpi_hw_write(register_bit,
+                              &gpe_event_info->register_info->status_address);
 
        return (status);
 }
@@ -222,7 +222,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
 
        /* GPE currently active (status bit == 1)? */
 
-       status = acpi_read(&in_byte, &gpe_register_info->status_address);
+       status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
        if (ACPI_FAILURE(status)) {
                goto unlock_and_exit;
        }
@@ -266,8 +266,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                /* Disable all GPEs in this register */
 
                status =
-                   acpi_write(0x00,
-                              &gpe_block->register_info[i].enable_address);
+                   acpi_hw_write(0x00,
+                                 &gpe_block->register_info[i].enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -303,8 +303,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
                /* Clear status on all GPEs in this register */
 
                status =
-                   acpi_write(0xFF,
-                              &gpe_block->register_info[i].status_address);
+                   acpi_hw_write(0xFF,
+                                 &gpe_block->register_info[i].status_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -345,9 +345,9 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                /* Enable all "runtime" GPEs in this register */
 
-               status = acpi_write(gpe_block->register_info[i].enable_for_run,
-                                   &gpe_block->register_info[i].
-                                   enable_address);
+               status =
+                   acpi_hw_write(gpe_block->register_info[i].enable_for_run,
+                                 &gpe_block->register_info[i].enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -387,9 +387,9 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 
                /* Enable all "wake" GPEs in this register */
 
-               status = acpi_write(gpe_block->register_info[i].enable_for_wake,
-                                   &gpe_block->register_info[i].
-                                   enable_address);
+               status =
+                   acpi_hw_write(gpe_block->register_info[i].enable_for_wake,
+                                 &gpe_block->register_info[i].enable_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
index 23d5505cb1f779cf551730065e36e84580852975..15c9ed2be85326f7fa9bd9d72cdcd70eefed9469 100644 (file)
@@ -62,6 +62,184 @@ acpi_hw_write_multiple(u32 value,
                       struct acpi_generic_address *register_a,
                       struct acpi_generic_address *register_b);
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_validate_register
+ *
+ * PARAMETERS:  Reg                 - GAS register structure
+ *              max_bit_width       - Max bit_width supported (32 or 64)
+ *              Address             - Pointer to where the gas->address
+ *                                    is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS
+ *              pointer, Address, space_id, bit_width, and bit_offset.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_hw_validate_register(struct acpi_generic_address *reg,
+                         u8 max_bit_width, u64 *address)
+{
+
+       /* Must have a valid pointer to a GAS structure */
+
+       if (!reg) {
+               return (AE_BAD_PARAMETER);
+       }
+
+       /*
+        * Copy the target address. This handles possible alignment issues.
+        * Address must not be null. A null address also indicates an optional
+        * ACPI register that is not supported, so no error message.
+        */
+       ACPI_MOVE_64_TO_64(address, &reg->address);
+       if (!(*address)) {
+               return (AE_BAD_ADDRESS);
+       }
+
+       /* Validate the space_iD */
+
+       if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
+           (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
+               ACPI_ERROR((AE_INFO,
+                           "Unsupported address space: 0x%X", reg->space_id));
+               return (AE_SUPPORT);
+       }
+
+       /* Validate the bit_width */
+
+       if ((reg->bit_width != 8) &&
+           (reg->bit_width != 16) &&
+           (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
+               ACPI_ERROR((AE_INFO,
+                           "Unsupported register bit width: 0x%X",
+                           reg->bit_width));
+               return (AE_SUPPORT);
+       }
+
+       /* Validate the bit_offset. Just a warning for now. */
+
+       if (reg->bit_offset != 0) {
+               ACPI_WARNING((AE_INFO,
+                             "Unsupported register bit offset: 0x%X",
+                             reg->bit_offset));
+       }
+
+       return (AE_OK);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_read
+ *
+ * PARAMETERS:  Value               - Where the value is returned
+ *              Reg                 - GAS register structure
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max
+ *              version of acpi_read, used internally since the overhead of
+ *              64-bit values is not needed.
+ *
+ * LIMITATIONS: <These limitations also apply to acpi_hw_write>
+ *      bit_width must be exactly 8, 16, or 32.
+ *      space_iD must be system_memory or system_iO.
+ *      bit_offset and access_width are currently ignored, as there has
+ *          not been a need to implement these.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
+{
+       u64 address;
+       acpi_status status;
+
+       ACPI_FUNCTION_NAME(hw_read);
+
+       /* Validate contents of the GAS register */
+
+       status = acpi_hw_validate_register(reg, 32, &address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       /* Initialize entire 32-bit return value to zero */
+
+       *value = 0;
+
+       /*
+        * Two address spaces supported: Memory or IO. PCI_Config is
+        * not supported here because the GAS structure is insufficient
+        */
+       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+               status = acpi_os_read_memory((acpi_physical_address)
+                                            address, value, reg->bit_width);
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+               status = acpi_hw_read_port((acpi_io_address)
+                                          address, value, reg->bit_width);
+       }
+
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
+                         *value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->space_id)));
+
+       return (status);
+}
+
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_hw_write
+ *
+ * PARAMETERS:  Value               - Value to be written
+ *              Reg                 - GAS register structure
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max
+ *              version of acpi_write, used internally since the overhead of
+ *              64-bit values is not needed.
+ *
+ ******************************************************************************/
+
+acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
+{
+       u64 address;
+       acpi_status status;
+
+       ACPI_FUNCTION_NAME(hw_write);
+
+       /* Validate contents of the GAS register */
+
+       status = acpi_hw_validate_register(reg, 32, &address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       /*
+        * Two address spaces supported: Memory or IO. PCI_Config is
+        * not supported here because the GAS structure is insufficient
+        */
+       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+               status = acpi_os_write_memory((acpi_physical_address)
+                                             address, value, reg->bit_width);
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+               status = acpi_hw_write_port((acpi_io_address)
+                                           address, value, reg->bit_width);
+       }
+
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
+                         value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+                         acpi_ut_get_region_name(reg->space_id)));
+
+       return (status);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_hw_clear_acpi_status
@@ -152,15 +330,16 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
 
        ACPI_FUNCTION_TRACE(hw_write_pm1_control);
 
-       status = acpi_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
+       status =
+           acpi_hw_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
        if (acpi_gbl_FADT.xpm1b_control_block.address) {
                status =
-                   acpi_write(pm1b_control,
-                              &acpi_gbl_FADT.xpm1b_control_block);
+                   acpi_hw_write(pm1b_control,
+                                 &acpi_gbl_FADT.xpm1b_control_block);
        }
        return_ACPI_STATUS(status);
 }
@@ -218,12 +397,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
 
        case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
 
-               status = acpi_read(&value, &acpi_gbl_FADT.xpm2_control_block);
+               status =
+                   acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block);
                break;
 
        case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
 
-               status = acpi_read(&value, &acpi_gbl_FADT.xpm_timer_block);
+               status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block);
                break;
 
        case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
@@ -340,7 +520,8 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
                 * as per the ACPI spec.
                 */
                status =
-                   acpi_read(&read_value, &acpi_gbl_FADT.xpm2_control_block);
+                   acpi_hw_read(&read_value,
+                                &acpi_gbl_FADT.xpm2_control_block);
                if (ACPI_FAILURE(status)) {
                        goto exit;
                }
@@ -350,12 +531,13 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
                ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS,
                                 read_value);
 
-               status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block);
+               status =
+                   acpi_hw_write(value, &acpi_gbl_FADT.xpm2_control_block);
                break;
 
        case ACPI_REGISTER_PM_TIMER:    /* 32-bit access */
 
-               status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block);
+               status = acpi_hw_write(value, &acpi_gbl_FADT.xpm_timer_block);
                break;
 
        case ACPI_REGISTER_SMI_COMMAND_BLOCK:   /* 8-bit access */
@@ -401,7 +583,7 @@ acpi_hw_read_multiple(u32 *value,
 
        /* The first register is always required */
 
-       status = acpi_read(&value_a, register_a);
+       status = acpi_hw_read(&value_a, register_a);
        if (ACPI_FAILURE(status)) {
                return (status);
        }
@@ -409,7 +591,7 @@ acpi_hw_read_multiple(u32 *value,
        /* Second register is optional */
 
        if (register_b->address) {
-               status = acpi_read(&value_b, register_b);
+               status = acpi_hw_read(&value_b, register_b);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
@@ -452,7 +634,7 @@ acpi_hw_write_multiple(u32 value,
 
        /* The first register is always required */
 
-       status = acpi_write(value, register_a);
+       status = acpi_hw_write(value, register_a);
        if (ACPI_FAILURE(status)) {
                return (status);
        }
@@ -470,7 +652,7 @@ acpi_hw_write_multiple(u32 value,
         * and writes have no side effects"
         */
        if (register_b->address) {
-               status = acpi_write(value, register_b);
+               status = acpi_hw_write(value, register_b);
        }
 
        return (status);
index b7f522c8f023d48686d40d7267196d6d296b6e44..6b282e85d039553a60e507d8241b36ea78cecd2e 100644 (file)
@@ -100,7 +100,7 @@ acpi_status acpi_get_timer(u32 * ticks)
        }
 
        status =
-           acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block);
+           acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
 
        return_ACPI_STATUS(status);
 }
index 9829979f2bddf6b71c4b1d23a31f6db303535832..647c7b6e675616a13fbfd16f5a368a620bf3b9ec 100644 (file)
@@ -78,9 +78,22 @@ acpi_status acpi_reset(void)
                return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
-       /* Write the reset value to the reset register */
+       if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
+               /*
+                * For I/O space, write directly to the OSL. This bypasses the port
+                * validation mechanism, which may block a valid write to the reset
+                * register.
+                */
+               status =
+                   acpi_os_write_port((acpi_io_address) reset_reg->address,
+                                      acpi_gbl_FADT.reset_value,
+                                      reset_reg->bit_width);
+       } else {
+               /* Write the reset value to the reset register */
+
+               status = acpi_hw_write(acpi_gbl_FADT.reset_value, reset_reg);
+       }
 
-       status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg);
        return_ACPI_STATUS(status);
 }
 
@@ -97,67 +110,92 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
  *
  * DESCRIPTION: Read from either memory or IO space.
  *
+ * LIMITATIONS: <These limitations also apply to acpi_write>
+ *      bit_width must be exactly 8, 16, 32, or 64.
+ *      space_iD must be system_memory or system_iO.
+ *      bit_offset and access_width are currently ignored, as there has
+ *          not been a need to implement these.
+ *
  ******************************************************************************/
-acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
+acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
 {
+       u32 value;
        u32 width;
        u64 address;
        acpi_status status;
 
        ACPI_FUNCTION_NAME(acpi_read);
 
-       /*
-        * Must have a valid pointer to a GAS structure, and a non-zero address
-        * within.
-        */
-       if (!reg) {
+       if (!return_value) {
                return (AE_BAD_PARAMETER);
        }
 
-       /* Get a local copy of the address. Handles possible alignment issues */
+       /* Validate contents of the GAS register. Allow 64-bit transfers */
 
-       ACPI_MOVE_64_TO_64(&address, &reg->address);
-       if (!address) {
-               return (AE_BAD_ADDRESS);
+       status = acpi_hw_validate_register(reg, 64, &address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-       /* Supported widths are 8/16/32 */
-
        width = reg->bit_width;
-       if ((width != 8) && (width != 16) && (width != 32)) {
-               return (AE_SUPPORT);
+       if (width == 64) {
+               width = 32;     /* Break into two 32-bit transfers */
        }
 
-       /* Initialize entire 32-bit return value to zero */
+       /* Initialize entire 64-bit return value to zero */
 
-       *value = 0;
+       *return_value = 0;
+       value = 0;
 
        /*
         * Two address spaces supported: Memory or IO. PCI_Config is
         * not supported here because the GAS structure is insufficient
         */
-       switch (reg->space_id) {
-       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+               status = acpi_os_read_memory((acpi_physical_address)
+                                            address, &value, width);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+               *return_value = value;
 
-               status = acpi_os_read_memory((acpi_physical_address) address,
-                                            value, width);
-               break;
+               if (reg->bit_width == 64) {
 
-       case ACPI_ADR_SPACE_SYSTEM_IO:
+                       /* Read the top 32 bits */
 
-               status =
-                   acpi_hw_read_port((acpi_io_address) address, value, width);
-               break;
+                       status = acpi_os_read_memory((acpi_physical_address)
+                                                    (address + 4), &value, 32);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       *return_value |= ((u64)value << 32);
+               }
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
-       default:
-               ACPI_ERROR((AE_INFO,
-                           "Unsupported address space: %X", reg->space_id));
-               return (AE_BAD_PARAMETER);
+               status = acpi_hw_read_port((acpi_io_address)
+                                          address, &value, width);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+               *return_value = value;
+
+               if (reg->bit_width == 64) {
+
+                       /* Read the top 32 bits */
+
+                       status = acpi_hw_read_port((acpi_io_address)
+                                                  (address + 4), &value, 32);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       *return_value |= ((u64)value << 32);
+               }
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                         "Read:  %8.8X width %2d from %8.8X%8.8X (%s)\n",
-                         *value, width, ACPI_FORMAT_UINT64(address),
+                         "Read:  %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n",
+                         ACPI_FORMAT_UINT64(*return_value), reg->bit_width,
+                         ACPI_FORMAT_UINT64(address),
                          acpi_ut_get_region_name(reg->space_id)));
 
        return (status);
@@ -169,7 +207,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
  *
  * FUNCTION:    acpi_write
  *
- * PARAMETERS:  Value               - To be written
+ * PARAMETERS:  Value               - Value to be written
  *              Reg                 - GAS register structure
  *
  * RETURN:      Status
@@ -177,7 +215,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
  * DESCRIPTION: Write to either memory or IO space.
  *
  ******************************************************************************/
-acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
+acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
 {
        u32 width;
        u64 address;
@@ -185,54 +223,61 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
 
        ACPI_FUNCTION_NAME(acpi_write);
 
-       /*
-        * Must have a valid pointer to a GAS structure, and a non-zero address
-        * within.
-        */
-       if (!reg) {
-               return (AE_BAD_PARAMETER);
-       }
-
-       /* Get a local copy of the address. Handles possible alignment issues */
+       /* Validate contents of the GAS register. Allow 64-bit transfers */
 
-       ACPI_MOVE_64_TO_64(&address, &reg->address);
-       if (!address) {
-               return (AE_BAD_ADDRESS);
+       status = acpi_hw_validate_register(reg, 64, &address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
        }
 
-       /* Supported widths are 8/16/32 */
-
        width = reg->bit_width;
-       if ((width != 8) && (width != 16) && (width != 32)) {
-               return (AE_SUPPORT);
+       if (width == 64) {
+               width = 32;     /* Break into two 32-bit transfers */
        }
 
        /*
-        * Two address spaces supported: Memory or IO.
-        * PCI_Config is not supported here because the GAS struct is insufficient
+        * Two address spaces supported: Memory or IO. PCI_Config is
+        * not supported here because the GAS structure is insufficient
         */
-       switch (reg->space_id) {
-       case ACPI_ADR_SPACE_SYSTEM_MEMORY:
-
-               status = acpi_os_write_memory((acpi_physical_address) address,
-                                             value, width);
-               break;
+       if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+               status = acpi_os_write_memory((acpi_physical_address)
+                                             address, ACPI_LODWORD(value),
+                                             width);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
 
-       case ACPI_ADR_SPACE_SYSTEM_IO:
+               if (reg->bit_width == 64) {
+                       status = acpi_os_write_memory((acpi_physical_address)
+                                                     (address + 4),
+                                                     ACPI_HIDWORD(value), 32);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+               }
+       } else {                /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
 
-               status = acpi_hw_write_port((acpi_io_address) address, value,
+               status = acpi_hw_write_port((acpi_io_address)
+                                           address, ACPI_LODWORD(value),
                                            width);
-               break;
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
 
-       default:
-               ACPI_ERROR((AE_INFO,
-                           "Unsupported address space: %X", reg->space_id));
-               return (AE_BAD_PARAMETER);
+               if (reg->bit_width == 64) {
+                       status = acpi_hw_write_port((acpi_io_address)
+                                                   (address + 4),
+                                                   ACPI_HIDWORD(value), 32);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+               }
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                         "Wrote: %8.8X width %2d   to %8.8X%8.8X (%s)\n",
-                         value, width, ACPI_FORMAT_UINT64(address),
+                         "Wrote: %8.8X%8.8X width %2d   to %8.8X%8.8X (%s)\n",
+                         ACPI_FORMAT_UINT64(value), reg->bit_width,
+                         ACPI_FORMAT_UINT64(address),
                          acpi_ut_get_region_name(reg->space_id)));
 
        return (status);
index efc971ab7d6512dbc47607bd25d6d976f28ddff6..8a58a1b85aa097cd34d5204c6ef1b0dbc043f7df 100644 (file)
@@ -96,17 +96,68 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
  *
  * RETURN:      None
  *
- * DESCRIPTION: Delete a namespace node
+ * DESCRIPTION: Delete a namespace node. All node deletions must come through
+ *              here. Detaches any attached objects, including any attached
+ *              data. If a handler is associated with attached data, it is
+ *              invoked before the node is deleted.
  *
  ******************************************************************************/
 
 void acpi_ns_delete_node(struct acpi_namespace_node *node)
+{
+       union acpi_operand_object *obj_desc;
+
+       ACPI_FUNCTION_NAME(ns_delete_node);
+
+       /* Detach an object if there is one */
+
+       acpi_ns_detach_object(node);
+
+       /*
+        * Delete an attached data object if present (an object that was created
+        * and attached via acpi_attach_data). Note: After any normal object is
+        * detached above, the only possible remaining object is a data object.
+        */
+       obj_desc = node->object;
+       if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
+
+               /* Invoke the attached data deletion handler if present */
+
+               if (obj_desc->data.handler) {
+                       obj_desc->data.handler(node, obj_desc->data.pointer);
+               }
+
+               acpi_ut_remove_reference(obj_desc);
+       }
+
+       /* Now we can delete the node */
+
+       (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
+
+       ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
+       ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n",
+                         node, acpi_gbl_current_node_count));
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_remove_node
+ *
+ * PARAMETERS:  Node            - Node to be removed/deleted
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Remove (unlink) and delete a namespace node
+ *
+ ******************************************************************************/
+
+void acpi_ns_remove_node(struct acpi_namespace_node *node)
 {
        struct acpi_namespace_node *parent_node;
        struct acpi_namespace_node *prev_node;
        struct acpi_namespace_node *next_node;
 
-       ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node);
+       ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node);
 
        parent_node = acpi_ns_get_parent_node(node);
 
@@ -142,12 +193,9 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
                }
        }
 
-       ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
-
-       /* Detach an object if there is one, then delete the node */
+       /* Delete the node and any attached objects */
 
-       acpi_ns_detach_object(node);
-       (void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
+       acpi_ns_delete_node(node);
        return_VOID;
 }
 
@@ -273,25 +321,11 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
                                    parent_node, child_node));
                }
 
-               /* Now we can free this child object */
-
-               ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
-
-               ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
-                                 "Object %p, Remaining %X\n", child_node,
-                                 acpi_gbl_current_node_count));
-
-               /* Detach an object if there is one, then free the child node */
-
-               acpi_ns_detach_object(child_node);
-
-               /* Now we can delete the node */
-
-               (void)acpi_os_release_object(acpi_gbl_namespace_cache,
-                                            child_node);
-
-               /* And move on to the next child in the list */
-
+               /*
+                * Delete this child node and move on to the next child in the list.
+                * No need to unlink the node since we are deleting the entire branch.
+                */
+               acpi_ns_delete_node(child_node);
                child_node = next_node;
 
        } while (!(flags & ANOBJ_END_OF_PEER_LIST));
@@ -433,7 +467,7 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
 
                if (deletion_node) {
                        acpi_ns_delete_children(deletion_node);
-                       acpi_ns_delete_node(deletion_node);
+                       acpi_ns_remove_node(deletion_node);
                        deletion_node = NULL;
                }
 
index 41994fe7fbb8a20c95e4505ad6878938a5381a7f..0fe87f1aef16eeda12bb34545bb44ddeeb5fdf21 100644 (file)
@@ -70,7 +70,6 @@ static acpi_status
 acpi_ns_dump_one_device(acpi_handle obj_handle,
                        u32 level, void *context, void **return_value)
 {
-       struct acpi_buffer buffer;
        struct acpi_device_info *info;
        acpi_status status;
        u32 i;
@@ -80,17 +79,15 @@ acpi_ns_dump_one_device(acpi_handle obj_handle,
        status =
            acpi_ns_dump_one_object(obj_handle, level, context, return_value);
 
-       buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-       status = acpi_get_object_info(obj_handle, &buffer);
+       status = acpi_get_object_info(obj_handle, &info);
        if (ACPI_SUCCESS(status)) {
-               info = buffer.pointer;
                for (i = 0; i < level; i++) {
                        ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
                }
 
                ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
                                      "    HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
-                                     info->hardware_id.value,
+                                     info->hardware_id.string,
                                      ACPI_FORMAT_UINT64(info->address),
                                      info->current_status));
                ACPI_FREE(info);
index 8e7dec1176c9f06c9d39bc7a16cb7bbbace8d149..846d1132feb1133faf08cbc8f65124d30f783308 100644 (file)
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nseval")
 
+/* Local prototypes */
+static void
+acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
+                        struct acpi_evaluate_info *info);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_evaluate
@@ -76,6 +81,7 @@ ACPI_MODULE_NAME("nseval")
  * MUTEX:       Locks interpreter
  *
  ******************************************************************************/
+
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 {
        acpi_status status;
@@ -276,3 +282,134 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
         */
        return_ACPI_STATUS(status);
 }
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_exec_module_code_list
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None. Exceptions during method execution are ignored, since
+ *              we cannot abort a table load.
+ *
+ * DESCRIPTION: Execute all elements of the global module-level code list.
+ *              Each element is executed as a single control method.
+ *
+ ******************************************************************************/
+
+void acpi_ns_exec_module_code_list(void)
+{
+       union acpi_operand_object *prev;
+       union acpi_operand_object *next;
+       struct acpi_evaluate_info *info;
+       u32 method_count = 0;
+
+       ACPI_FUNCTION_TRACE(ns_exec_module_code_list);
+
+       /* Exit now if the list is empty */
+
+       next = acpi_gbl_module_code_list;
+       if (!next) {
+               return_VOID;
+       }
+
+       /* Allocate the evaluation information block */
+
+       info = ACPI_ALLOCATE(sizeof(struct acpi_evaluate_info));
+       if (!info) {
+               return_VOID;
+       }
+
+       /* Walk the list, executing each "method" */
+
+       while (next) {
+               prev = next;
+               next = next->method.mutex;
+
+               /* Clear the link field and execute the method */
+
+               prev->method.mutex = NULL;
+               acpi_ns_exec_module_code(prev, info);
+               method_count++;
+
+               /* Delete the (temporary) method object */
+
+               acpi_ut_remove_reference(prev);
+       }
+
+       ACPI_INFO((AE_INFO,
+                  "Executed %u blocks of module-level executable AML code",
+                  method_count));
+
+       ACPI_FREE(info);
+       acpi_gbl_module_code_list = NULL;
+       return_VOID;
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_exec_module_code
+ *
+ * PARAMETERS:  method_obj          - Object container for the module-level code
+ *              Info                - Info block for method evaluation
+ *
+ * RETURN:      None. Exceptions during method execution are ignored, since
+ *              we cannot abort a table load.
+ *
+ * DESCRIPTION: Execute a control method containing a block of module-level
+ *              executable AML code. The control method is temporarily
+ *              installed to the root node, then evaluated.
+ *
+ ******************************************************************************/
+
+static void
+acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
+                        struct acpi_evaluate_info *info)
+{
+       union acpi_operand_object *root_obj;
+       acpi_status status;
+
+       ACPI_FUNCTION_TRACE(ns_exec_module_code);
+
+       /* Initialize the evaluation information block */
+
+       ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
+       info->prefix_node = acpi_gbl_root_node;
+
+       /*
+        * Get the currently attached root object. Add a reference, because the
+        * ref count will be decreased when the method object is installed to
+        * the root node.
+        */
+       root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node);
+       acpi_ut_add_reference(root_obj);
+
+       /* Install the method (module-level code) in the root node */
+
+       status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj,
+                                      ACPI_TYPE_METHOD);
+       if (ACPI_FAILURE(status)) {
+               goto exit;
+       }
+
+       /* Execute the root node as a control method */
+
+       status = acpi_ns_evaluate(info);
+
+       ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n",
+                         method_obj->method.aml_start));
+
+       /* Detach the temporary method object */
+
+       acpi_ns_detach_object(acpi_gbl_root_node);
+
+       /* Restore the original root object */
+
+       status =
+           acpi_ns_attach_object(acpi_gbl_root_node, root_obj,
+                                 ACPI_TYPE_DEVICE);
+
+      exit:
+       acpi_ut_remove_reference(root_obj);
+       return_VOID;
+}
index 2adfcf329e159c16795948dde91cc293fb3b35a5..1d5b360eb25be101ff0402f301cfbb163adc7240 100644 (file)
@@ -170,6 +170,21 @@ acpi_status acpi_ns_initialize_devices(void)
                goto error_exit;
        }
 
+       /*
+        * Execute the "global" _INI method that may appear at the root. This
+        * support is provided for Windows compatibility (Vista+) and is not
+        * part of the ACPI specification.
+        */
+       info.evaluate_info->prefix_node = acpi_gbl_root_node;
+       info.evaluate_info->pathname = METHOD_NAME__INI;
+       info.evaluate_info->parameters = NULL;
+       info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+       status = acpi_ns_evaluate(info.evaluate_info);
+       if (ACPI_SUCCESS(status)) {
+               info.num_INI++;
+       }
+
        /* Walk namespace to execute all _INIs on present devices */
 
        status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
index dcd7a6adbbbcc196c7b8d12a6a57714e85617769..a7234e60e9858c29fbf80cd10bf06a649ee9e898 100644 (file)
@@ -270,8 +270,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
 
        /* Now delete the starting object, and we are done */
 
-       acpi_ns_delete_node(child_handle);
-
+       acpi_ns_remove_node(child_handle);
        return_ACPI_STATUS(AE_OK);
 }
 
index 7f8e066b12a3d20b79a986a7e771d65eef3a332c..f8427afeebdfb2017043e753888a9aa8d0250ad7 100644 (file)
@@ -42,6 +42,8 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
+#define ACPI_CREATE_PREDEFINED_TABLE
+
 #include <acpi/acpi.h>
 #include "accommon.h"
 #include "acnamesp.h"
@@ -72,30 +74,31 @@ ACPI_MODULE_NAME("nspredef")
  ******************************************************************************/
 /* Local prototypes */
 static acpi_status
-acpi_ns_check_package(char *pathname,
-                     union acpi_operand_object **return_object_ptr,
-                     const union acpi_predefined_info *predefined);
+acpi_ns_check_package(struct acpi_predefined_data *data,
+                     union acpi_operand_object **return_object_ptr);
+
+static acpi_status
+acpi_ns_check_package_list(struct acpi_predefined_data *data,
+                          const union acpi_predefined_info *package,
+                          union acpi_operand_object **elements, u32 count);
 
 static acpi_status
-acpi_ns_check_package_elements(char *pathname,
+acpi_ns_check_package_elements(struct acpi_predefined_data *data,
                               union acpi_operand_object **elements,
                               u8 type1,
                               u32 count1,
                               u8 type2, u32 count2, u32 start_index);
 
 static acpi_status
-acpi_ns_check_object_type(char *pathname,
+acpi_ns_check_object_type(struct acpi_predefined_data *data,
                          union acpi_operand_object **return_object_ptr,
                          u32 expected_btypes, u32 package_index);
 
 static acpi_status
-acpi_ns_check_reference(char *pathname,
+acpi_ns_check_reference(struct acpi_predefined_data *data,
                        union acpi_operand_object *return_object);
 
-static acpi_status
-acpi_ns_repair_object(u32 expected_btypes,
-                     u32 package_index,
-                     union acpi_operand_object **return_object_ptr);
+static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes);
 
 /*
  * Names for the types that can be returned by the predefined objects.
@@ -109,13 +112,13 @@ static const char *acpi_rtype_names[] = {
        "/Reference",
 };
 
-#define ACPI_NOT_PACKAGE    ACPI_UINT32_MAX
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_predefined_names
  *
  * PARAMETERS:  Node            - Namespace node for the method/object
+ *              user_param_count - Number of parameters actually passed
+ *              return_status   - Status from the object evaluation
  *              return_object_ptr - Pointer to the object returned from the
  *                                evaluation of a method or object
  *
@@ -135,12 +138,13 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
        acpi_status status = AE_OK;
        const union acpi_predefined_info *predefined;
        char *pathname;
+       struct acpi_predefined_data *data;
 
        /* Match the name for this method/object against the predefined list */
 
        predefined = acpi_ns_check_for_predefined_name(node);
 
-       /* Get the full pathname to the object, for use in error messages */
+       /* Get the full pathname to the object, for use in warning messages */
 
        pathname = acpi_ns_get_external_pathname(node);
        if (!pathname) {
@@ -158,28 +162,17 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
        /* If not a predefined name, we cannot validate the return object */
 
        if (!predefined) {
-               goto exit;
-       }
-
-       /* If the method failed, we cannot validate the return object */
-
-       if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
-               goto exit;
+               goto cleanup;
        }
 
        /*
-        * Only validate the return value on the first successful evaluation of
-        * the method. This ensures that any warnings will only be emitted during
-        * the very first evaluation of the method/object.
+        * If the method failed or did not actually return an object, we cannot
+        * validate the return object
         */
-       if (node->flags & ANOBJ_EVALUATED) {
-               goto exit;
+       if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) {
+               goto cleanup;
        }
 
-       /* Mark the node as having been successfully evaluated */
-
-       node->flags |= ANOBJ_EVALUATED;
-
        /*
         * If there is no return value, check if we require a return value for
         * this predefined name. Either one return value is expected, or none,
@@ -190,46 +183,67 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
        if (!return_object) {
                if ((predefined->info.expected_btypes) &&
                    (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) {
-                       ACPI_ERROR((AE_INFO,
-                                   "%s: Missing expected return value",
-                                   pathname));
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Missing expected return value"));
 
                        status = AE_AML_NO_RETURN_VALUE;
                }
-               goto exit;
+               goto cleanup;
        }
 
        /*
-        * We have a return value, but if one wasn't expected, just exit, this is
-        * not a problem
+        * 1) We have a return value, but if one wasn't expected, just exit, this is
+        * not a problem. For example, if the "Implicit Return" feature is
+        * enabled, methods will always return a value.
         *
-        * For example, if the "Implicit Return" feature is enabled, methods will
-        * always return a value
+        * 2) If the return value can be of any type, then we cannot perform any
+        * validation, exit.
         */
-       if (!predefined->info.expected_btypes) {
-               goto exit;
+       if ((!predefined->info.expected_btypes) ||
+           (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) {
+               goto cleanup;
        }
 
+       /* Create the parameter data block for object validation */
+
+       data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data));
+       if (!data) {
+               goto cleanup;
+       }
+       data->predefined = predefined;
+       data->node_flags = node->flags;
+       data->pathname = pathname;
+
        /*
         * Check that the type of the return object is what is expected for
         * this predefined name
         */
-       status = acpi_ns_check_object_type(pathname, return_object_ptr,
+       status = acpi_ns_check_object_type(data, return_object_ptr,
                                           predefined->info.expected_btypes,
-                                          ACPI_NOT_PACKAGE);
+                                          ACPI_NOT_PACKAGE_ELEMENT);
        if (ACPI_FAILURE(status)) {
-               goto exit;
+               goto check_validation_status;
        }
 
        /* For returned Package objects, check the type of all sub-objects */
 
        if (return_object->common.type == ACPI_TYPE_PACKAGE) {
-               status =
-                   acpi_ns_check_package(pathname, return_object_ptr,
-                                         predefined);
+               status = acpi_ns_check_package(data, return_object_ptr);
+       }
+
+check_validation_status:
+       /*
+        * If the object validation failed or if we successfully repaired one
+        * or more objects, mark the parent node to suppress further warning
+        * messages during the next evaluation of the same method/object.
+        */
+       if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) {
+               node->flags |= ANOBJ_EVALUATED;
        }
+       ACPI_FREE(data);
 
-      exit:
+cleanup:
        ACPI_FREE(pathname);
        return (status);
 }
@@ -268,64 +282,58 @@ acpi_ns_check_parameter_count(char *pathname,
                param_count = node->object->method.param_count;
        }
 
-       /* Argument count check for non-predefined methods/objects */
-
        if (!predefined) {
                /*
+                * Check the parameter count for non-predefined methods/objects.
+                *
                 * Warning if too few or too many arguments have been passed by the
                 * caller. An incorrect number of arguments may not cause the method
                 * to fail. However, the method will fail if there are too few
                 * arguments and the method attempts to use one of the missing ones.
                 */
                if (user_param_count < param_count) {
-                       ACPI_WARNING((AE_INFO,
-                                     "%s: Insufficient arguments - needs %d, found %d",
-                                     pathname, param_count, user_param_count));
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Insufficient arguments - needs %u, found %u",
+                                             param_count, user_param_count));
                } else if (user_param_count > param_count) {
-                       ACPI_WARNING((AE_INFO,
-                                     "%s: Excess arguments - needs %d, found %d",
-                                     pathname, param_count, user_param_count));
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Excess arguments - needs %u, found %u",
+                                             param_count, user_param_count));
                }
                return;
        }
 
-       /* Allow two different legal argument counts (_SCP, etc.) */
-
+       /*
+        * Validate the user-supplied parameter count.
+        * Allow two different legal argument counts (_SCP, etc.)
+        */
        required_params_current = predefined->info.param_count & 0x0F;
        required_params_old = predefined->info.param_count >> 4;
 
        if (user_param_count != ACPI_UINT32_MAX) {
-
-               /* Validate the user-supplied parameter count */
-
                if ((user_param_count != required_params_current) &&
                    (user_param_count != required_params_old)) {
-                       ACPI_WARNING((AE_INFO,
-                                     "%s: Parameter count mismatch - "
-                                     "caller passed %d, ACPI requires %d",
-                                     pathname, user_param_count,
-                                     required_params_current));
+                       ACPI_WARN_PREDEFINED((AE_INFO, pathname,
+                                             ACPI_WARN_ALWAYS,
+                                             "Parameter count mismatch - "
+                                             "caller passed %u, ACPI requires %u",
+                                             user_param_count,
+                                             required_params_current));
                }
        }
 
-       /*
-        * Only validate the argument count on the first successful evaluation of
-        * the method. This ensures that any warnings will only be emitted during
-        * the very first evaluation of the method/object.
-        */
-       if (node->flags & ANOBJ_EVALUATED) {
-               return;
-       }
-
        /*
         * Check that the ASL-defined parameter count is what is expected for
-        * this predefined name.
+        * this predefined name (parameter count as defined by the ACPI
+        * specification)
         */
        if ((param_count != required_params_current) &&
            (param_count != required_params_old)) {
-               ACPI_WARNING((AE_INFO,
-                             "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d",
-                             pathname, param_count, required_params_current));
+               ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags,
+                                     "Parameter count mismatch - ASL declared %u, ACPI requires %u",
+                                     param_count, required_params_current));
        }
 }
 
@@ -358,9 +366,6 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
        this_name = predefined_names;
        while (this_name->info.name[0]) {
                if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) {
-
-                       /* Return pointer to this table entry */
-
                        return (this_name);
                }
 
@@ -375,17 +380,16 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
                this_name++;
        }
 
-       return (NULL);
+       return (NULL);          /* Not found */
 }
 
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_check_package
  *
- * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ * PARAMETERS:  Data            - Pointer to validation data structure
  *              return_object_ptr - Pointer to the object returned from the
  *                                evaluation of a method or object
- *              Predefined      - Pointer to entry in predefined name table
  *
  * RETURN:      Status
  *
@@ -395,30 +399,26 @@ const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_package(char *pathname,
-                     union acpi_operand_object **return_object_ptr,
-                     const union acpi_predefined_info *predefined)
+acpi_ns_check_package(struct acpi_predefined_data *data,
+                     union acpi_operand_object **return_object_ptr)
 {
        union acpi_operand_object *return_object = *return_object_ptr;
        const union acpi_predefined_info *package;
-       union acpi_operand_object *sub_package;
        union acpi_operand_object **elements;
-       union acpi_operand_object **sub_elements;
-       acpi_status status;
+       acpi_status status = AE_OK;
        u32 expected_count;
        u32 count;
        u32 i;
-       u32 j;
 
        ACPI_FUNCTION_NAME(ns_check_package);
 
        /* The package info for this name is in the next table entry */
 
-       package = predefined + 1;
+       package = data->predefined + 1;
 
        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
                          "%s Validating return Package of Type %X, Count %X\n",
-                         pathname, package->ret_info.type,
+                         data->pathname, package->ret_info.type,
                          return_object->package.count));
 
        /* Extract package count and elements array */
@@ -429,9 +429,8 @@ acpi_ns_check_package(char *pathname,
        /* The package must have at least one element, else invalid */
 
        if (!count) {
-               ACPI_WARNING((AE_INFO,
-                             "%s: Return Package has no elements (empty)",
-                             pathname));
+               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                                     "Return Package has no elements (empty)"));
 
                return (AE_AML_OPERAND_VALUE);
        }
@@ -456,15 +455,16 @@ acpi_ns_check_package(char *pathname,
                if (count < expected_count) {
                        goto package_too_small;
                } else if (count > expected_count) {
-                       ACPI_WARNING((AE_INFO,
-                                     "%s: Return Package is larger than needed - "
-                                     "found %u, expected %u", pathname, count,
-                                     expected_count));
+                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
+                                             data->node_flags,
+                                             "Return Package is larger than needed - "
+                                             "found %u, expected %u", count,
+                                             expected_count));
                }
 
                /* Validate all elements of the returned package */
 
-               status = acpi_ns_check_package_elements(pathname, elements,
+               status = acpi_ns_check_package_elements(data, elements,
                                                        package->ret_info.
                                                        object_type1,
                                                        package->ret_info.
@@ -473,9 +473,6 @@ acpi_ns_check_package(char *pathname,
                                                        object_type2,
                                                        package->ret_info.
                                                        count2, 0);
-               if (ACPI_FAILURE(status)) {
-                       return (status);
-               }
                break;
 
        case ACPI_PTYPE1_VAR:
@@ -485,7 +482,7 @@ acpi_ns_check_package(char *pathname,
                 * elements must be of the same type
                 */
                for (i = 0; i < count; i++) {
-                       status = acpi_ns_check_object_type(pathname, elements,
+                       status = acpi_ns_check_object_type(data, elements,
                                                           package->ret_info.
                                                           object_type1, i);
                        if (ACPI_FAILURE(status)) {
@@ -517,8 +514,7 @@ acpi_ns_check_package(char *pathname,
                                /* These are the required package elements (0, 1, or 2) */
 
                                status =
-                                   acpi_ns_check_object_type(pathname,
-                                                             elements,
+                                   acpi_ns_check_object_type(data, elements,
                                                              package->
                                                              ret_info3.
                                                              object_type[i],
@@ -530,8 +526,7 @@ acpi_ns_check_package(char *pathname,
                                /* These are the optional package elements */
 
                                status =
-                                   acpi_ns_check_object_type(pathname,
-                                                             elements,
+                                   acpi_ns_check_object_type(data, elements,
                                                              package->
                                                              ret_info3.
                                                              tail_object_type,
@@ -544,11 +539,30 @@ acpi_ns_check_package(char *pathname,
                }
                break;
 
+       case ACPI_PTYPE2_REV_FIXED:
+
+               /* First element is the (Integer) revision */
+
+               status = acpi_ns_check_object_type(data, elements,
+                                                  ACPI_RTYPE_INTEGER, 0);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
+
+               elements++;
+               count--;
+
+               /* Examine the sub-packages */
+
+               status =
+                   acpi_ns_check_package_list(data, package, elements, count);
+               break;
+
        case ACPI_PTYPE2_PKG_COUNT:
 
                /* First element is the (Integer) count of sub-packages to follow */
 
-               status = acpi_ns_check_object_type(pathname, elements,
+               status = acpi_ns_check_object_type(data, elements,
                                                   ACPI_RTYPE_INTEGER, 0);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -566,9 +580,11 @@ acpi_ns_check_package(char *pathname,
                count = expected_count;
                elements++;
 
-               /* Now we can walk the sub-packages */
+               /* Examine the sub-packages */
 
-               /*lint -fallthrough */
+               status =
+                   acpi_ns_check_package_list(data, package, elements, count);
+               break;
 
        case ACPI_PTYPE2:
        case ACPI_PTYPE2_FIXED:
@@ -576,176 +592,240 @@ acpi_ns_check_package(char *pathname,
        case ACPI_PTYPE2_COUNT:
 
                /*
-                * These types all return a single package that consists of a variable
-                * number of sub-packages
+                * These types all return a single Package that consists of a
+                * variable number of sub-Packages.
+                *
+                * First, ensure that the first element is a sub-Package. If not,
+                * the BIOS may have incorrectly returned the object as a single
+                * package instead of a Package of Packages (a common error if
+                * there is only one entry). We may be able to repair this by
+                * wrapping the returned Package with a new outer Package.
                 */
-               for (i = 0; i < count; i++) {
-                       sub_package = *elements;
-                       sub_elements = sub_package->package.elements;
+               if ((*elements)->common.type != ACPI_TYPE_PACKAGE) {
 
-                       /* Each sub-object must be of type Package */
+                       /* Create the new outer package and populate it */
 
                        status =
-                           acpi_ns_check_object_type(pathname, &sub_package,
-                                                     ACPI_RTYPE_PACKAGE, i);
+                           acpi_ns_repair_package_list(data,
+                                                       return_object_ptr);
                        if (ACPI_FAILURE(status)) {
                                return (status);
                        }
 
-                       /* Examine the different types of sub-packages */
+                       /* Update locals to point to the new package (of 1 element) */
 
-                       switch (package->ret_info.type) {
-                       case ACPI_PTYPE2:
-                       case ACPI_PTYPE2_PKG_COUNT:
+                       return_object = *return_object_ptr;
+                       elements = return_object->package.elements;
+                       count = 1;
+               }
 
-                               /* Each subpackage has a fixed number of elements */
+               /* Examine the sub-packages */
 
-                               expected_count =
-                                   package->ret_info.count1 +
-                                   package->ret_info.count2;
-                               if (sub_package->package.count !=
-                                   expected_count) {
-                                       count = sub_package->package.count;
-                                       goto package_too_small;
-                               }
+               status =
+                   acpi_ns_check_package_list(data, package, elements, count);
+               break;
 
-                               status =
-                                   acpi_ns_check_package_elements(pathname,
-                                                                  sub_elements,
-                                                                  package->
-                                                                  ret_info.
-                                                                  object_type1,
-                                                                  package->
-                                                                  ret_info.
-                                                                  count1,
-                                                                  package->
-                                                                  ret_info.
-                                                                  object_type2,
-                                                                  package->
-                                                                  ret_info.
-                                                                  count2, 0);
-                               if (ACPI_FAILURE(status)) {
-                                       return (status);
-                               }
-                               break;
+       default:
 
-                       case ACPI_PTYPE2_FIXED:
+               /* Should not get here if predefined info table is correct */
 
-                               /* Each sub-package has a fixed length */
+               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                                     "Invalid internal return type in table entry: %X",
+                                     package->ret_info.type));
 
-                               expected_count = package->ret_info2.count;
-                               if (sub_package->package.count < expected_count) {
-                                       count = sub_package->package.count;
-                                       goto package_too_small;
-                               }
+               return (AE_AML_INTERNAL);
+       }
 
-                               /* Check the type of each sub-package element */
+       return (status);
 
-                               for (j = 0; j < expected_count; j++) {
-                                       status =
-                                           acpi_ns_check_object_type(pathname,
-                                               &sub_elements[j],
-                                               package->ret_info2.object_type[j], j);
-                                       if (ACPI_FAILURE(status)) {
-                                               return (status);
-                                       }
-                               }
-                               break;
+package_too_small:
 
-                       case ACPI_PTYPE2_MIN:
+       /* Error exit for the case with an incorrect package count */
 
-                               /* Each sub-package has a variable but minimum length */
+       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                             "Return Package is too small - found %u elements, expected %u",
+                             count, expected_count));
 
-                               expected_count = package->ret_info.count1;
-                               if (sub_package->package.count < expected_count) {
-                                       count = sub_package->package.count;
-                                       goto package_too_small;
-                               }
+       return (AE_AML_OPERAND_VALUE);
+}
 
-                               /* Check the type of each sub-package element */
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_check_package_list
+ *
+ * PARAMETERS:  Data            - Pointer to validation data structure
+ *              Package         - Pointer to package-specific info for method
+ *              Elements        - Element list of parent package. All elements
+ *                                of this list should be of type Package.
+ *              Count           - Count of subpackages
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Examine a list of subpackages
+ *
+ ******************************************************************************/
 
-                               status =
-                                   acpi_ns_check_package_elements(pathname,
-                                                                  sub_elements,
-                                                                  package->
-                                                                  ret_info.
-                                                                  object_type1,
-                                                                  sub_package->
-                                                                  package.
-                                                                  count, 0, 0,
-                                                                  0);
-                               if (ACPI_FAILURE(status)) {
-                                       return (status);
-                               }
-                               break;
+static acpi_status
+acpi_ns_check_package_list(struct acpi_predefined_data *data,
+                          const union acpi_predefined_info *package,
+                          union acpi_operand_object **elements, u32 count)
+{
+       union acpi_operand_object *sub_package;
+       union acpi_operand_object **sub_elements;
+       acpi_status status;
+       u32 expected_count;
+       u32 i;
+       u32 j;
 
-                       case ACPI_PTYPE2_COUNT:
+       /* Validate each sub-Package in the parent Package */
 
-                               /* First element is the (Integer) count of elements to follow */
+       for (i = 0; i < count; i++) {
+               sub_package = *elements;
+               sub_elements = sub_package->package.elements;
 
-                               status =
-                                   acpi_ns_check_object_type(pathname,
-                                                             sub_elements,
-                                                             ACPI_RTYPE_INTEGER,
-                                                             0);
-                               if (ACPI_FAILURE(status)) {
-                                       return (status);
-                               }
+               /* Each sub-object must be of type Package */
 
-                               /* Make sure package is large enough for the Count */
+               status = acpi_ns_check_object_type(data, &sub_package,
+                                                  ACPI_RTYPE_PACKAGE, i);
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
 
-                               expected_count =
-                                   (u32) (*sub_elements)->integer.value;
-                               if (sub_package->package.count < expected_count) {
-                                       count = sub_package->package.count;
-                                       goto package_too_small;
-                               }
+               /* Examine the different types of expected sub-packages */
+
+               switch (package->ret_info.type) {
+               case ACPI_PTYPE2:
+               case ACPI_PTYPE2_PKG_COUNT:
+               case ACPI_PTYPE2_REV_FIXED:
+
+                       /* Each subpackage has a fixed number of elements */
+
+                       expected_count =
+                           package->ret_info.count1 + package->ret_info.count2;
+                       if (sub_package->package.count < expected_count) {
+                               goto package_too_small;
+                       }
+
+                       status =
+                           acpi_ns_check_package_elements(data, sub_elements,
+                                                          package->ret_info.
+                                                          object_type1,
+                                                          package->ret_info.
+                                                          count1,
+                                                          package->ret_info.
+                                                          object_type2,
+                                                          package->ret_info.
+                                                          count2, 0);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       break;
 
-                               /* Check the type of each sub-package element */
+               case ACPI_PTYPE2_FIXED:
 
+                       /* Each sub-package has a fixed length */
+
+                       expected_count = package->ret_info2.count;
+                       if (sub_package->package.count < expected_count) {
+                               goto package_too_small;
+                       }
+
+                       /* Check the type of each sub-package element */
+
+                       for (j = 0; j < expected_count; j++) {
                                status =
-                                   acpi_ns_check_package_elements(pathname,
-                                                                  (sub_elements
-                                                                   + 1),
-                                                                  package->
-                                                                  ret_info.
-                                                                  object_type1,
-                                                                  (expected_count
-                                                                   - 1), 0, 0,
-                                                                  1);
+                                   acpi_ns_check_object_type(data,
+                                                             &sub_elements[j],
+                                                             package->
+                                                             ret_info2.
+                                                             object_type[j],
+                                                             j);
                                if (ACPI_FAILURE(status)) {
                                        return (status);
                                }
-                               break;
+                       }
+                       break;
+
+               case ACPI_PTYPE2_MIN:
 
-                       default:
-                               break;
+                       /* Each sub-package has a variable but minimum length */
+
+                       expected_count = package->ret_info.count1;
+                       if (sub_package->package.count < expected_count) {
+                               goto package_too_small;
                        }
 
-                       elements++;
-               }
-               break;
+                       /* Check the type of each sub-package element */
 
-       default:
+                       status =
+                           acpi_ns_check_package_elements(data, sub_elements,
+                                                          package->ret_info.
+                                                          object_type1,
+                                                          sub_package->package.
+                                                          count, 0, 0, 0);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       break;
 
-               /* Should not get here if predefined info table is correct */
+               case ACPI_PTYPE2_COUNT:
+
+                       /*
+                        * First element is the (Integer) count of elements, including
+                        * the count field.
+                        */
+                       status = acpi_ns_check_object_type(data, sub_elements,
+                                                          ACPI_RTYPE_INTEGER,
+                                                          0);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
 
-               ACPI_WARNING((AE_INFO,
-                             "%s: Invalid internal return type in table entry: %X",
-                             pathname, package->ret_info.type));
+                       /*
+                        * Make sure package is large enough for the Count and is
+                        * is as large as the minimum size
+                        */
+                       expected_count = (u32)(*sub_elements)->integer.value;
+                       if (sub_package->package.count < expected_count) {
+                               goto package_too_small;
+                       }
+                       if (sub_package->package.count <
+                           package->ret_info.count1) {
+                               expected_count = package->ret_info.count1;
+                               goto package_too_small;
+                       }
 
-               return (AE_AML_INTERNAL);
+                       /* Check the type of each sub-package element */
+
+                       status =
+                           acpi_ns_check_package_elements(data,
+                                                          (sub_elements + 1),
+                                                          package->ret_info.
+                                                          object_type1,
+                                                          (expected_count - 1),
+                                                          0, 0, 1);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
+                       break;
+
+               default:        /* Should not get here, type was validated by caller */
+
+                       return (AE_AML_INTERNAL);
+               }
+
+               elements++;
        }
 
        return (AE_OK);
 
-      package_too_small:
+package_too_small:
 
-       /* Error exit for the case with an incorrect package count */
+       /* The sub-package count was smaller than required */
 
-       ACPI_WARNING((AE_INFO, "%s: Return Package is too small - "
-                     "found %u, expected %u", pathname, count,
-                     expected_count));
+       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                             "Return Sub-Package[%u] is too small - found %u elements, expected %u",
+                             i, sub_package->package.count, expected_count));
 
        return (AE_AML_OPERAND_VALUE);
 }
@@ -754,7 +834,7 @@ acpi_ns_check_package(char *pathname,
  *
  * FUNCTION:    acpi_ns_check_package_elements
  *
- * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ * PARAMETERS:  Data            - Pointer to validation data structure
  *              Elements        - Pointer to the package elements array
  *              Type1           - Object type for first group
  *              Count1          - Count for first group
@@ -770,7 +850,7 @@ acpi_ns_check_package(char *pathname,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_package_elements(char *pathname,
+acpi_ns_check_package_elements(struct acpi_predefined_data *data,
                               union acpi_operand_object **elements,
                               u8 type1,
                               u32 count1,
@@ -786,7 +866,7 @@ acpi_ns_check_package_elements(char *pathname,
         * The second group can have a count of zero.
         */
        for (i = 0; i < count1; i++) {
-               status = acpi_ns_check_object_type(pathname, this_element,
+               status = acpi_ns_check_object_type(data, this_element,
                                                   type1, i + start_index);
                if (ACPI_FAILURE(status)) {
                        return (status);
@@ -795,7 +875,7 @@ acpi_ns_check_package_elements(char *pathname,
        }
 
        for (i = 0; i < count2; i++) {
-               status = acpi_ns_check_object_type(pathname, this_element,
+               status = acpi_ns_check_object_type(data, this_element,
                                                   type2,
                                                   (i + count1 + start_index));
                if (ACPI_FAILURE(status)) {
@@ -811,12 +891,13 @@ acpi_ns_check_package_elements(char *pathname,
  *
  * FUNCTION:    acpi_ns_check_object_type
  *
- * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ * PARAMETERS:  Data            - Pointer to validation data structure
  *              return_object_ptr - Pointer to the object returned from the
  *                                evaluation of a method or object
  *              expected_btypes - Bitmap of expected return type(s)
  *              package_index   - Index of object within parent package (if
- *                                applicable - ACPI_NOT_PACKAGE otherwise)
+ *                                applicable - ACPI_NOT_PACKAGE_ELEMENT
+ *                                otherwise)
  *
  * RETURN:      Status
  *
@@ -826,7 +907,7 @@ acpi_ns_check_package_elements(char *pathname,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_object_type(char *pathname,
+acpi_ns_check_object_type(struct acpi_predefined_data *data,
                          union acpi_operand_object **return_object_ptr,
                          u32 expected_btypes, u32 package_index)
 {
@@ -834,9 +915,6 @@ acpi_ns_check_object_type(char *pathname,
        acpi_status status = AE_OK;
        u32 return_btype;
        char type_buffer[48];   /* Room for 5 types */
-       u32 this_rtype;
-       u32 i;
-       u32 j;
 
        /*
         * If we get a NULL return_object here, it is a NULL package element,
@@ -849,10 +927,11 @@ acpi_ns_check_object_type(char *pathname,
        /* A Namespace node should not get here, but make sure */
 
        if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) {
-               ACPI_WARNING((AE_INFO,
-                             "%s: Invalid return type - Found a Namespace node [%4.4s] type %s",
-                             pathname, return_object->node.name.ascii,
-                             acpi_ut_get_type_name(return_object->node.type)));
+               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                                     "Invalid return type - Found a Namespace node [%4.4s] type %s",
+                                     return_object->node.name.ascii,
+                                     acpi_ut_get_type_name(return_object->node.
+                                                           type)));
                return (AE_AML_OPERAND_TYPE);
        }
 
@@ -897,10 +976,11 @@ acpi_ns_check_object_type(char *pathname,
 
                /* Type mismatch -- attempt repair of the returned object */
 
-               status = acpi_ns_repair_object(expected_btypes, package_index,
+               status = acpi_ns_repair_object(data, expected_btypes,
+                                              package_index,
                                               return_object_ptr);
                if (ACPI_SUCCESS(status)) {
-                       return (status);
+                       return (AE_OK); /* Repair was successful */
                }
                goto type_error_exit;
        }
@@ -908,7 +988,7 @@ acpi_ns_check_object_type(char *pathname,
        /* For reference objects, check that the reference type is correct */
 
        if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
-               status = acpi_ns_check_reference(pathname, return_object);
+               status = acpi_ns_check_reference(data, return_object);
        }
 
        return (status);
@@ -917,33 +997,19 @@ acpi_ns_check_object_type(char *pathname,
 
        /* Create a string with all expected types for this predefined object */
 
-       j = 1;
-       type_buffer[0] = 0;
-       this_rtype = ACPI_RTYPE_INTEGER;
-
-       for (i = 0; i < ACPI_NUM_RTYPES; i++) {
-
-               /* If one of the expected types, concatenate the name of this type */
-
-               if (expected_btypes & this_rtype) {
-                       ACPI_STRCAT(type_buffer, &acpi_rtype_names[i][j]);
-                       j = 0;  /* Use name separator from now on */
-               }
-               this_rtype <<= 1;       /* Next Rtype */
-       }
+       acpi_ns_get_expected_types(type_buffer, expected_btypes);
 
-       if (package_index == ACPI_NOT_PACKAGE) {
-               ACPI_WARNING((AE_INFO,
-                             "%s: Return type mismatch - found %s, expected %s",
-                             pathname,
-                             acpi_ut_get_object_type_name(return_object),
-                             type_buffer));
+       if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
+               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                                     "Return type mismatch - found %s, expected %s",
+                                     acpi_ut_get_object_type_name
+                                     (return_object), type_buffer));
        } else {
-               ACPI_WARNING((AE_INFO,
-                             "%s: Return Package type mismatch at index %u - "
-                             "found %s, expected %s", pathname, package_index,
-                             acpi_ut_get_object_type_name(return_object),
-                             type_buffer));
+               ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                                     "Return Package type mismatch at index %u - "
+                                     "found %s, expected %s", package_index,
+                                     acpi_ut_get_object_type_name
+                                     (return_object), type_buffer));
        }
 
        return (AE_AML_OPERAND_TYPE);
@@ -953,7 +1019,7 @@ acpi_ns_check_object_type(char *pathname,
  *
  * FUNCTION:    acpi_ns_check_reference
  *
- * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
+ * PARAMETERS:  Data            - Pointer to validation data structure
  *              return_object   - Object returned from the evaluation of a
  *                                method or object
  *
@@ -966,7 +1032,7 @@ acpi_ns_check_object_type(char *pathname,
  ******************************************************************************/
 
 static acpi_status
-acpi_ns_check_reference(char *pathname,
+acpi_ns_check_reference(struct acpi_predefined_data *data,
                        union acpi_operand_object *return_object)
 {
 
@@ -979,94 +1045,46 @@ acpi_ns_check_reference(char *pathname,
                return (AE_OK);
        }
 
-       ACPI_WARNING((AE_INFO,
-                     "%s: Return type mismatch - "
-                     "unexpected reference object type [%s] %2.2X",
-                     pathname, acpi_ut_get_reference_name(return_object),
-                     return_object->reference.class));
+       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                             "Return type mismatch - unexpected reference object type [%s] %2.2X",
+                             acpi_ut_get_reference_name(return_object),
+                             return_object->reference.class));
 
        return (AE_AML_OPERAND_TYPE);
 }
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_ns_repair_object
+ * FUNCTION:    acpi_ns_get_expected_types
  *
- * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
- *              package_index   - Used to determine if target is in a package
- *              return_object_ptr - Pointer to the object returned from the
- *                                evaluation of a method or object
+ * PARAMETERS:  Buffer          - Pointer to where the string is returned
+ *              expected_btypes - Bitmap of expected return type(s)
  *
- * RETURN:      Status. AE_OK if repair was successful.
+ * RETURN:      Buffer is populated with type names.
  *
- * DESCRIPTION: Attempt to repair/convert a return object of a type that was
- *              not expected.
+ * DESCRIPTION: Translate the expected types bitmap into a string of ascii
+ *              names of expected types, for use in warning messages.
  *
  ******************************************************************************/
 
-static acpi_status
-acpi_ns_repair_object(u32 expected_btypes,
-                     u32 package_index,
-                     union acpi_operand_object **return_object_ptr)
+static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes)
 {
-       union acpi_operand_object *return_object = *return_object_ptr;
-       union acpi_operand_object *new_object;
-       acpi_size length;
-
-       switch (return_object->common.type) {
-       case ACPI_TYPE_BUFFER:
-
-               if (!(expected_btypes & ACPI_RTYPE_STRING)) {
-                       return (AE_AML_OPERAND_TYPE);
-               }
-
-               /*
-                * Have a Buffer, expected a String, convert. Use a to_string
-                * conversion, no transform performed on the buffer data. The best
-                * example of this is the _BIF method, where the string data from
-                * the battery is often (incorrectly) returned as buffer object(s).
-                */
-               length = 0;
-               while ((length < return_object->buffer.length) &&
-                      (return_object->buffer.pointer[length])) {
-                       length++;
-               }
-
-               /* Allocate a new string object */
-
-               new_object = acpi_ut_create_string_object(length);
-               if (!new_object) {
-                       return (AE_NO_MEMORY);
-               }
+       u32 this_rtype;
+       u32 i;
+       u32 j;
 
-               /*
-                * Copy the raw buffer data with no transform. String is already NULL
-                * terminated at Length+1.
-                */
-               ACPI_MEMCPY(new_object->string.pointer,
-                           return_object->buffer.pointer, length);
+       j = 1;
+       buffer[0] = 0;
+       this_rtype = ACPI_RTYPE_INTEGER;
 
-               /* Install the new return object */
+       for (i = 0; i < ACPI_NUM_RTYPES; i++) {
 
-               acpi_ut_remove_reference(return_object);
-               *return_object_ptr = new_object;
+               /* If one of the expected types, concatenate the name of this type */
 
-               /*
-                * If the object is a package element, we need to:
-                * 1. Decrement the reference count of the orignal object, it was
-                *    incremented when building the package
-                * 2. Increment the reference count of the new object, it will be
-                *    decremented when releasing the package
-                */
-               if (package_index != ACPI_NOT_PACKAGE) {
-                       acpi_ut_remove_reference(return_object);
-                       acpi_ut_add_reference(new_object);
+               if (expected_btypes & this_rtype) {
+                       ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]);
+                       j = 0;  /* Use name separator from now on */
                }
-               return (AE_OK);
-
-       default:
-               break;
+               this_rtype <<= 1;       /* Next Rtype */
        }
-
-       return (AE_AML_OPERAND_TYPE);
 }
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
new file mode 100644 (file)
index 0000000..db2b2a9
--- /dev/null
@@ -0,0 +1,203 @@
+/******************************************************************************
+ *
+ * Module Name: nsrepair - Repair for objects returned by predefined methods
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2009, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acpredef.h"
+
+#define _COMPONENT          ACPI_NAMESPACE
+ACPI_MODULE_NAME("nsrepair")
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_repair_object
+ *
+ * PARAMETERS:  Data                - Pointer to validation data structure
+ *              expected_btypes     - Object types expected
+ *              package_index       - Index of object within parent package (if
+ *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT
+ *                                    otherwise)
+ *              return_object_ptr   - Pointer to the object returned from the
+ *                                    evaluation of a method or object
+ *
+ * RETURN:      Status. AE_OK if repair was successful.
+ *
+ * DESCRIPTION: Attempt to repair/convert a return object of a type that was
+ *              not expected.
+ *
+ ******************************************************************************/
+acpi_status
+acpi_ns_repair_object(struct acpi_predefined_data *data,
+                     u32 expected_btypes,
+                     u32 package_index,
+                     union acpi_operand_object **return_object_ptr)
+{
+       union acpi_operand_object *return_object = *return_object_ptr;
+       union acpi_operand_object *new_object;
+       acpi_size length;
+
+       switch (return_object->common.type) {
+       case ACPI_TYPE_BUFFER:
+
+               /* Does the method/object legally return a string? */
+
+               if (!(expected_btypes & ACPI_RTYPE_STRING)) {
+                       return (AE_AML_OPERAND_TYPE);
+               }
+
+               /*
+                * Have a Buffer, expected a String, convert. Use a to_string
+                * conversion, no transform performed on the buffer data. The best
+                * example of this is the _BIF method, where the string data from
+                * the battery is often (incorrectly) returned as buffer object(s).
+                */
+               length = 0;
+               while ((length < return_object->buffer.length) &&
+                      (return_object->buffer.pointer[length])) {
+                       length++;
+               }
+
+               /* Allocate a new string object */
+
+               new_object = acpi_ut_create_string_object(length);
+               if (!new_object) {
+                       return (AE_NO_MEMORY);
+               }
+
+               /*
+                * Copy the raw buffer data with no transform. String is already NULL
+                * terminated at Length+1.
+                */
+               ACPI_MEMCPY(new_object->string.pointer,
+                           return_object->buffer.pointer, length);
+
+               /*
+                * If the original object is a package element, we need to:
+                * 1. Set the reference count of the new object to match the
+                *    reference count of the old object.
+                * 2. Decrement the reference count of the original object.
+                */
+               if (package_index != ACPI_NOT_PACKAGE_ELEMENT) {
+                       new_object->common.reference_count =
+                           return_object->common.reference_count;
+
+                       if (return_object->common.reference_count > 1) {
+                               return_object->common.reference_count--;
+                       }
+
+                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
+                                             data->node_flags,
+                                             "Converted Buffer to expected String at index %u",
+                                             package_index));
+               } else {
+                       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
+                                             data->node_flags,
+                                             "Converted Buffer to expected String"));
+               }
+
+               /* Delete old object, install the new return object */
+
+               acpi_ut_remove_reference(return_object);
+               *return_object_ptr = new_object;
+               data->flags |= ACPI_OBJECT_REPAIRED;
+               return (AE_OK);
+
+       default:
+               break;
+       }
+
+       return (AE_AML_OPERAND_TYPE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_repair_package_list
+ *
+ * PARAMETERS:  Data                - Pointer to validation data structure
+ *              obj_desc_ptr        - Pointer to the object to repair. The new
+ *                                    package object is returned here,
+ *                                    overwriting the old object.
+ *
+ * RETURN:      Status, new object in *obj_desc_ptr
+ *
+ * DESCRIPTION: Repair a common problem with objects that are defined to return
+ *              a variable-length Package of Packages. If the variable-length
+ *              is one, some BIOS code mistakenly simply declares a single
+ *              Package instead of a Package with one sub-Package. This
+ *              function attempts to repair this error by wrapping a Package
+ *              object around the original Package, creating the correct
+ *              Package with one sub-Package.
+ *
+ *              Names that can be repaired in this manner include:
+ *              _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ns_repair_package_list(struct acpi_predefined_data *data,
+                           union acpi_operand_object **obj_desc_ptr)
+{
+       union acpi_operand_object *pkg_obj_desc;
+
+       /*
+        * Create the new outer package and populate it. The new package will
+        * have a single element, the lone subpackage.
+        */
+       pkg_obj_desc = acpi_ut_create_package_object(1);
+       if (!pkg_obj_desc) {
+               return (AE_NO_MEMORY);
+       }
+
+       pkg_obj_desc->package.elements[0] = *obj_desc_ptr;
+
+       /* Return the new object in the object pointer */
+
+       *obj_desc_ptr = pkg_obj_desc;
+       data->flags |= ACPI_OBJECT_REPAIRED;
+
+       ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
+                             "Incorrectly formed Package, attempting repair"));
+
+       return (AE_OK);
+}
index 78277ed0833948baffeaabf6fcc9961e2fd4913a..ea55ab4f984924937feca72f00cb056d02bc1993 100644 (file)
@@ -88,7 +88,8 @@ acpi_ns_report_error(const char *module_name,
 
                /* There is a non-ascii character in the name */
 
-               ACPI_MOVE_32_TO_32(&bad_name, internal_name);
+               ACPI_MOVE_32_TO_32(&bad_name,
+                                  ACPI_CAST_PTR(u32, internal_name));
                acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
        } else {
                /* Convert path to external format */
@@ -836,7 +837,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
        acpi_status status;
        char *internal_path;
 
-       ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname);
+       ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
 
        if (!pathname) {
                *return_node = prefix_node;
index daf4ad37896d1f13c627229070fb6893fc9e8474..4929dbdbc8f0f5082ca157965451a1e413d9f539 100644 (file)
@@ -535,10 +535,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
        acpi_status status;
        struct acpi_namespace_node *node;
        u32 flags;
-       struct acpica_device_id hid;
-       struct acpi_compatible_id_list *cid;
+       struct acpica_device_id *hid;
+       struct acpica_device_id_list *cid;
        u32 i;
-       int found;
+       u8 found;
+       int no_match;
 
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
@@ -582,10 +583,14 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
                        return (AE_CTRL_DEPTH);
                }
 
-               if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
-
-                       /* Get the list of Compatible IDs */
+               no_match = ACPI_STRCMP(hid->string, info->hid);
+               ACPI_FREE(hid);
 
+               if (no_match) {
+                       /*
+                        * HID does not match, attempt match within the
+                        * list of Compatible IDs (CIDs)
+                        */
                        status = acpi_ut_execute_CID(node, &cid);
                        if (status == AE_NOT_FOUND) {
                                return (AE_OK);
@@ -597,10 +602,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 
                        found = 0;
                        for (i = 0; i < cid->count; i++) {
-                               if (ACPI_STRNCMP(cid->id[i].value, info->hid,
-                                                sizeof(struct
-                                                       acpi_compatible_id)) ==
-                                   0) {
+                               if (ACPI_STRCMP(cid->ids[i].string, info->hid)
+                                   == 0) {
                                        found = 1;
                                        break;
                                }
index f23593d6add4857f146527e29b130fed13c47ff9..ddc84af6336e727d5eaa1ec4799e4c38e49a9333 100644 (file)
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsxfname")
 
+/* Local prototypes */
+static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
+                                   struct acpica_device_id *source,
+                                   char *string_area);
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_get_handle
@@ -68,6 +73,7 @@ ACPI_MODULE_NAME("nsxfname")
  *              namespace handle.
  *
  ******************************************************************************/
+
 acpi_status
 acpi_get_handle(acpi_handle parent,
                acpi_string pathname, acpi_handle * ret_handle)
@@ -208,12 +214,40 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
 
 ACPI_EXPORT_SYMBOL(acpi_get_name)
 
+/******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_copy_device_id
+ *
+ * PARAMETERS:  Dest                - Pointer to the destination DEVICE_ID
+ *              Source              - Pointer to the source DEVICE_ID
+ *              string_area         - Pointer to where to copy the dest string
+ *
+ * RETURN:      Pointer to the next string area
+ *
+ * DESCRIPTION: Copy a single DEVICE_ID, including the string data.
+ *
+ ******************************************************************************/
+static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
+                                   struct acpica_device_id *source,
+                                   char *string_area)
+{
+       /* Create the destination DEVICE_ID */
+
+       dest->string = string_area;
+       dest->length = source->length;
+
+       /* Copy actual string and return a pointer to the next string area */
+
+       ACPI_MEMCPY(string_area, source->string, source->length);
+       return (string_area + source->length);
+}
+
 /******************************************************************************
  *
  * FUNCTION:    acpi_get_object_info
  *
- * PARAMETERS:  Handle          - Object Handle
- *              Buffer          - Where the info is returned
+ * PARAMETERS:  Handle              - Object Handle
+ *              return_buffer       - Where the info is returned
  *
  * RETURN:      Status
  *
@@ -221,33 +255,37 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
  *              namespace node and possibly by running several standard
  *              control methods (Such as in the case of a device.)
  *
+ * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
+ * _ADR, _sx_w, and _sx_d methods.
+ *
+ * Note: Allocates the return buffer, must be freed by the caller.
+ *
  ******************************************************************************/
+
 acpi_status
-acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
+acpi_get_object_info(acpi_handle handle,
+                    struct acpi_device_info **return_buffer)
 {
-       acpi_status status;
        struct acpi_namespace_node *node;
        struct acpi_device_info *info;
-       struct acpi_device_info *return_info;
-       struct acpi_compatible_id_list *cid_list = NULL;
-       acpi_size size;
+       struct acpica_device_id_list *cid_list = NULL;
+       struct acpica_device_id *hid = NULL;
+       struct acpica_device_id *uid = NULL;
+       char *next_id_string;
+       acpi_object_type type;
+       acpi_name name;
+       u8 param_count = 0;
+       u8 valid = 0;
+       u32 info_size;
+       u32 i;
+       acpi_status status;
 
        /* Parameter validation */
 
-       if (!handle || !buffer) {
+       if (!handle || !return_buffer) {
                return (AE_BAD_PARAMETER);
        }
 
-       status = acpi_ut_validate_buffer(buffer);
-       if (ACPI_FAILURE(status)) {
-               return (status);
-       }
-
-       info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info));
-       if (!info) {
-               return (AE_NO_MEMORY);
-       }
-
        status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
                goto cleanup;
@@ -256,66 +294,91 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
        node = acpi_ns_map_handle_to_node(handle);
        if (!node) {
                (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-               status = AE_BAD_PARAMETER;
-               goto cleanup;
+               return (AE_BAD_PARAMETER);
        }
 
-       /* Init return structure */
-
-       size = sizeof(struct acpi_device_info);
+       /* Get the namespace node data while the namespace is locked */
 
-       info->type = node->type;
-       info->name = node->name.integer;
-       info->valid = 0;
+       info_size = sizeof(struct acpi_device_info);
+       type = node->type;
+       name = node->name.integer;
 
        if (node->type == ACPI_TYPE_METHOD) {
-               info->param_count = node->object->method.param_count;
+               param_count = node->object->method.param_count;
        }
 
        status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        if (ACPI_FAILURE(status)) {
-               goto cleanup;
+               return (status);
        }
 
-       /* If not a device, we are all done */
-
-       if (info->type == ACPI_TYPE_DEVICE) {
+       if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
                /*
-                * Get extra info for ACPI Devices objects only:
-                * Run the Device _HID, _UID, _CID, _STA, _ADR and _sx_d methods.
+                * Get extra info for ACPI Device/Processor objects only:
+                * Run the Device _HID, _UID, and _CID methods.
                 *
                 * Note: none of these methods are required, so they may or may
-                * not be present for this device.  The Info->Valid bitfield is used
-                * to indicate which methods were found and ran successfully.
+                * not be present for this device. The Info->Valid bitfield is used
+                * to indicate which methods were found and run successfully.
                 */
 
                /* Execute the Device._HID method */
 
-               status = acpi_ut_execute_HID(node, &info->hardware_id);
+               status = acpi_ut_execute_HID(node, &hid);
                if (ACPI_SUCCESS(status)) {
-                       info->valid |= ACPI_VALID_HID;
+                       info_size += hid->length;
+                       valid |= ACPI_VALID_HID;
                }
 
                /* Execute the Device._UID method */
 
-               status = acpi_ut_execute_UID(node, &info->unique_id);
+               status = acpi_ut_execute_UID(node, &uid);
                if (ACPI_SUCCESS(status)) {
-                       info->valid |= ACPI_VALID_UID;
+                       info_size += uid->length;
+                       valid |= ACPI_VALID_UID;
                }
 
                /* Execute the Device._CID method */
 
                status = acpi_ut_execute_CID(node, &cid_list);
                if (ACPI_SUCCESS(status)) {
-                       size += cid_list->size;
-                       info->valid |= ACPI_VALID_CID;
+
+                       /* Add size of CID strings and CID pointer array */
+
+                       info_size +=
+                           (cid_list->list_size -
+                            sizeof(struct acpica_device_id_list));
+                       valid |= ACPI_VALID_CID;
                }
+       }
+
+       /*
+        * Now that we have the variable-length data, we can allocate the
+        * return buffer
+        */
+       info = ACPI_ALLOCATE_ZEROED(info_size);
+       if (!info) {
+               status = AE_NO_MEMORY;
+               goto cleanup;
+       }
+
+       /* Get the fixed-length data */
+
+       if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
+               /*
+                * Get extra info for ACPI Device/Processor objects only:
+                * Run the _STA, _ADR and, sx_w, and _sx_d methods.
+                *
+                * Note: none of these methods are required, so they may or may
+                * not be present for this device. The Info->Valid bitfield is used
+                * to indicate which methods were found and run successfully.
+                */
 
                /* Execute the Device._STA method */
 
                status = acpi_ut_execute_STA(node, &info->current_status);
                if (ACPI_SUCCESS(status)) {
-                       info->valid |= ACPI_VALID_STA;
+                       valid |= ACPI_VALID_STA;
                }
 
                /* Execute the Device._ADR method */
@@ -323,36 +386,100 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
                status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
                                                         &info->address);
                if (ACPI_SUCCESS(status)) {
-                       info->valid |= ACPI_VALID_ADR;
+                       valid |= ACPI_VALID_ADR;
+               }
+
+               /* Execute the Device._sx_w methods */
+
+               status = acpi_ut_execute_power_methods(node,
+                                                      acpi_gbl_lowest_dstate_names,
+                                                      ACPI_NUM_sx_w_METHODS,
+                                                      info->lowest_dstates);
+               if (ACPI_SUCCESS(status)) {
+                       valid |= ACPI_VALID_SXWS;
                }
 
                /* Execute the Device._sx_d methods */
 
-               status = acpi_ut_execute_sxds(node, info->highest_dstates);
+               status = acpi_ut_execute_power_methods(node,
+                                                      acpi_gbl_highest_dstate_names,
+                                                      ACPI_NUM_sx_d_METHODS,
+                                                      info->highest_dstates);
                if (ACPI_SUCCESS(status)) {
-                       info->valid |= ACPI_VALID_SXDS;
+                       valid |= ACPI_VALID_SXDS;
                }
        }
 
-       /* Validate/Allocate/Clear caller buffer */
+       /*
+        * Create a pointer to the string area of the return buffer.
+        * Point to the end of the base struct acpi_device_info structure.
+        */
+       next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
+       if (cid_list) {
 
-       status = acpi_ut_initialize_buffer(buffer, size);
-       if (ACPI_FAILURE(status)) {
-               goto cleanup;
+               /* Point past the CID DEVICE_ID array */
+
+               next_id_string +=
+                   ((acpi_size) cid_list->count *
+                    sizeof(struct acpica_device_id));
        }
 
-       /* Populate the return buffer */
+       /*
+        * Copy the HID, UID, and CIDs to the return 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.
+        */
+       if (hid) {
+               next_id_string = acpi_ns_copy_device_id(&info->hardware_id,
+                                                       hid, next_id_string);
+
+               if (acpi_ut_is_pci_root_bridge(hid->string)) {
+                       info->flags |= ACPI_PCI_ROOT_BRIDGE;
+               }
+       }
 
-       return_info = buffer->pointer;
-       ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
+       if (uid) {
+               next_id_string = acpi_ns_copy_device_id(&info->unique_id,
+                                                       uid, next_id_string);
+       }
 
        if (cid_list) {
-               ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
-                           cid_list->size);
+               info->compatible_id_list.count = cid_list->count;
+               info->compatible_id_list.list_size = cid_list->list_size;
+
+               /* Copy each CID */
+
+               for (i = 0; i < cid_list->count; i++) {
+                       next_id_string =
+                           acpi_ns_copy_device_id(&info->compatible_id_list.
+                                                  ids[i], &cid_list->ids[i],
+                                                  next_id_string);
+
+                       if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) {
+                               info->flags |= ACPI_PCI_ROOT_BRIDGE;
+                       }
+               }
        }
 
+       /* Copy the fixed-length data */
+
+       info->info_size = info_size;
+       info->type = type;
+       info->name = name;
+       info->param_count = param_count;
+       info->valid = valid;
+
+       *return_buffer = info;
+       status = AE_OK;
+
       cleanup:
-       ACPI_FREE(info);
+       if (hid) {
+               ACPI_FREE(hid);
+       }
+       if (uid) {
+               ACPI_FREE(uid);
+       }
        if (cid_list) {
                ACPI_FREE(cid_list);
        }
index c5f6ce19a4019ae87c683f07cc0fbc1ee3b4563d..cd7995b3aed4a3c06096a4e2ae0d56f4a3a3c9c3 100644 (file)
@@ -86,6 +86,9 @@ static acpi_status
 acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
                          union acpi_parse_object *op, acpi_status status);
 
+static void
+acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id);
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_get_aml_opcode
@@ -390,6 +393,7 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
 {
        acpi_status status = AE_OK;
        union acpi_parse_object *arg = NULL;
+       const struct acpi_opcode_info *op_info;
 
        ACPI_FUNCTION_TRACE_PTR(ps_get_arguments, walk_state);
 
@@ -449,13 +453,11 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
                        INCREMENT_ARG_LIST(walk_state->arg_types);
                }
 
-               /* Special processing for certain opcodes */
-
-               /* TBD (remove): Temporary mechanism to disable this code if needed */
-
-#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
-
-               if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
+               /*
+                * Handle executable code at "module-level". This refers to
+                * executable opcodes that appear outside of any control method.
+                */
+               if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) &&
                    ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
                        /*
                         * We want to skip If/Else/While constructs during Pass1 because we
@@ -469,6 +471,23 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
                        case AML_ELSE_OP:
                        case AML_WHILE_OP:
 
+                               /*
+                                * Currently supported module-level opcodes are:
+                                * IF/ELSE/WHILE. These appear to be the most common,
+                                * and easiest to support since they open an AML
+                                * package.
+                                */
+                               if (walk_state->pass_number ==
+                                   ACPI_IMODE_LOAD_PASS1) {
+                                       acpi_ps_link_module_code(aml_op_start,
+                                                                walk_state->
+                                                                parser_state.
+                                                                pkg_end -
+                                                                aml_op_start,
+                                                                walk_state->
+                                                                owner_id);
+                               }
+
                                ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
                                                  "Pass1: Skipping an If/Else/While body\n"));
 
@@ -480,10 +499,34 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
                                break;
 
                        default:
+                               /*
+                                * Check for an unsupported executable opcode at module
+                                * level. We must be in PASS1, the parent must be a SCOPE,
+                                * The opcode class must be EXECUTE, and the opcode must
+                                * not be an argument to another opcode.
+                                */
+                               if ((walk_state->pass_number ==
+                                    ACPI_IMODE_LOAD_PASS1)
+                                   && (op->common.parent->common.aml_opcode ==
+                                       AML_SCOPE_OP)) {
+                                       op_info =
+                                           acpi_ps_get_opcode_info(op->common.
+                                                                   aml_opcode);
+                                       if ((op_info->class ==
+                                            AML_CLASS_EXECUTE) && (!arg)) {
+                                               ACPI_WARNING((AE_INFO,
+                                                             "Detected an unsupported executable opcode "
+                                                             "at module-level: [0x%.4X] at table offset 0x%.4X",
+                                                             op->common.aml_opcode,
+                                                             (u32)((aml_op_start - walk_state->parser_state.aml_start)
+                                                               + sizeof(struct acpi_table_header))));
+                                       }
+                               }
                                break;
                        }
                }
-#endif
+
+               /* Special processing for certain opcodes */
 
                switch (op->common.aml_opcode) {
                case AML_METHOD_OP:
@@ -551,6 +594,66 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
        return_ACPI_STATUS(AE_OK);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ps_link_module_code
+ *
+ * PARAMETERS:  aml_start           - Pointer to the AML
+ *              aml_length          - Length of executable AML
+ *              owner_id            - owner_id of module level code
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Wrap the module-level code with a method object and link the
+ *              object to the global list. Note, the mutex field of the method
+ *              object is used to link multiple module-level code objects.
+ *
+ ******************************************************************************/
+
+static void
+acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id)
+{
+       union acpi_operand_object *prev;
+       union acpi_operand_object *next;
+       union acpi_operand_object *method_obj;
+
+       /* Get the tail of the list */
+
+       prev = next = acpi_gbl_module_code_list;
+       while (next) {
+               prev = next;
+               next = next->method.mutex;
+       }
+
+       /*
+        * Insert the module level code into the list. Merge it if it is
+        * adjacent to the previous element.
+        */
+       if (!prev ||
+           ((prev->method.aml_start + prev->method.aml_length) != aml_start)) {
+
+               /* Create, initialize, and link a new temporary method object */
+
+               method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
+               if (!method_obj) {
+                       return;
+               }
+
+               method_obj->method.aml_start = aml_start;
+               method_obj->method.aml_length = aml_length;
+               method_obj->method.owner_id = owner_id;
+               method_obj->method.flags |= AOPOBJ_MODULE_LEVEL;
+
+               if (!prev) {
+                       acpi_gbl_module_code_list = method_obj;
+               } else {
+                       prev->method.mutex = method_obj;
+               }
+       } else {
+               prev->method.aml_length += aml_length;
+       }
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ps_complete_op
index ff06032c0f061eb0fba27442a13fe5dbb559c214..dd9731c29a79b125a9ea31359822d4b48413df31 100644 (file)
@@ -280,6 +280,10 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
                goto cleanup;
        }
 
+       if (info->obj_desc->method.flags & AOPOBJ_MODULE_LEVEL) {
+               walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL;
+       }
+
        /* Invoke an internal method if necessary */
 
        if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
index ef7d2c2d8f0b0067fabf069e547a456afde52fc9..1f15497f00d10dd4319317a0a312ac8be4d2f2f5 100644 (file)
 ACPI_MODULE_NAME("tbutils")
 
 /* Local prototypes */
+static void acpi_tb_fix_string(char *string, acpi_size length);
+
+static void
+acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
+                            struct acpi_table_header *header);
+
 static acpi_physical_address
 acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
@@ -159,6 +165,59 @@ u8 acpi_tb_tables_loaded(void)
        return (FALSE);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_fix_string
+ *
+ * PARAMETERS:  String              - String to be repaired
+ *              Length              - Maximum length
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
+ *              with a question mark '?'.
+ *
+ ******************************************************************************/
+
+static void acpi_tb_fix_string(char *string, acpi_size length)
+{
+
+       while (length && *string) {
+               if (!ACPI_IS_PRINT(*string)) {
+                       *string = '?';
+               }
+               string++;
+               length--;
+       }
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_cleanup_table_header
+ *
+ * PARAMETERS:  out_header          - Where the cleaned header is returned
+ *              Header              - Input ACPI table header
+ *
+ * RETURN:      Returns the cleaned header in out_header
+ *
+ * DESCRIPTION: Copy the table header and ensure that all "string" fields in
+ *              the header consist of printable characters.
+ *
+ ******************************************************************************/
+
+static void
+acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
+                            struct acpi_table_header *header)
+{
+
+       ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
+
+       acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
+       acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
+       acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+       acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_print_table_header
@@ -176,6 +235,7 @@ void
 acpi_tb_print_table_header(acpi_physical_address address,
                           struct acpi_table_header *header)
 {
+       struct acpi_table_header local_header;
 
        /*
         * The reason that the Address is cast to a void pointer is so that we
@@ -192,6 +252,11 @@ acpi_tb_print_table_header(acpi_physical_address address,
 
                /* RSDP has no common fields */
 
+               ACPI_MEMCPY(local_header.oem_id,
+                           ACPI_CAST_PTR(struct acpi_table_rsdp,
+                                         header)->oem_id, ACPI_OEM_ID_SIZE);
+               acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
+
                ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
                           ACPI_CAST_PTR (void, address),
                           (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
@@ -200,18 +265,21 @@ acpi_tb_print_table_header(acpi_physical_address address,
                                               header)->length : 20,
                           ACPI_CAST_PTR(struct acpi_table_rsdp,
                                         header)->revision,
-                          ACPI_CAST_PTR(struct acpi_table_rsdp,
-                                        header)->oem_id));
+                          local_header.oem_id));
        } else {
                /* Standard ACPI table with full common header */
 
+               acpi_tb_cleanup_table_header(&local_header, header);
+
                ACPI_INFO((AE_INFO,
                           "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
-                          header->signature, ACPI_CAST_PTR (void, address),
-                          header->length, header->revision, header->oem_id,
-                          header->oem_table_id, header->oem_revision,
-                          header->asl_compiler_id,
-                          header->asl_compiler_revision));
+                          local_header.signature, ACPI_CAST_PTR(void, address),
+                          local_header.length, local_header.revision,
+                          local_header.oem_id, local_header.oem_table_id,
+                          local_header.oem_revision,
+                          local_header.asl_compiler_id,
+                          local_header.asl_compiler_revision));
+
        }
 }
 
index bc1710315088a7304cfaa86bc9237f7ca0afd75f..96e26e70c63debb1087fe55f0bb7849e49739301 100644 (file)
@@ -215,6 +215,12 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
                ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
                                  "***** Region %p\n", object));
 
+               /* Invalidate the region address/length via the host OS */
+
+               acpi_os_invalidate_address(object->region.space_id,
+                                         object->region.address,
+                                         (acpi_size) object->region.length);
+
                second_desc = acpi_ns_get_secondary_object(object);
                if (second_desc) {
                        /*
index 006b16c260176d36a1ff445137ff48678ff8be5c..5d54e36ab4536eb151acf54cf4a11c89dd9796de 100644 (file)
 #include <acpi/acpi.h>
 #include "accommon.h"
 #include "acnamesp.h"
-#include "acinterp.h"
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("uteval")
 
-/* Local prototypes */
-static void
-acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
-
-static acpi_status
-acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
-                         struct acpi_compatible_id *one_cid);
-
 /*
  * Strings supported by the _OSI predefined (internal) method.
  *
@@ -78,6 +69,9 @@ static struct acpi_interface_info acpi_interfaces_supported[] = {
        {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2},      /* Windows XP SP2 */
        {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1},       /* Windows Server 2003 SP1 - Added 03/2006 */
        {"Windows 2006", ACPI_OSI_WIN_VISTA},   /* Windows Vista - Added 03/2006 */
+       {"Windows 2006.1", ACPI_OSI_WINSRV_2008},       /* Windows Server 2008 - Added 09/2009 */
+       {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1},   /* Windows Vista SP1 - Added 09/2009 */
+       {"Windows 2009", ACPI_OSI_WIN_7},       /* Windows 7 and Server 2008 R2 - Added 09/2009 */
 
        /* Feature Group Strings */
 
@@ -213,7 +207,7 @@ acpi_status acpi_osi_invalidate(char *interface)
  * RETURN:      Status
  *
  * DESCRIPTION: Evaluates a namespace object and verifies the type of the
- *              return object.  Common code that simplifies accessing objects
+ *              return object. Common code that simplifies accessing objects
  *              that have required return objects of fixed types.
  *
  *              NOTE: Internal function, no parameter validation
@@ -298,7 +292,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
 
        if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) {
                /*
-                * We received a return object, but one was not expected.  This can
+                * We received a return object, but one was not expected. This can
                 * happen frequently if the "implicit return" feature is enabled.
                 * Just delete the return object and return AE_OK.
                 */
@@ -340,12 +334,12 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
  *
  * PARAMETERS:  object_name         - Object name to be evaluated
  *              device_node         - Node for the device
- *              Address             - Where the value is returned
+ *              Value               - Where the value is returned
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Evaluates a numeric namespace object for a selected device
- *              and stores result in *Address.
+ *              and stores result in *Value.
  *
  *              NOTE: Internal function, no parameter validation
  *
@@ -354,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
 acpi_status
 acpi_ut_evaluate_numeric_object(char *object_name,
                                struct acpi_namespace_node *device_node,
-                               acpi_integer * address)
+                               acpi_integer *value)
 {
        union acpi_operand_object *obj_desc;
        acpi_status status;
@@ -369,295 +363,7 @@ acpi_ut_evaluate_numeric_object(char *object_name,
 
        /* Get the returned Integer */
 
-       *address = obj_desc->integer.value;
-
-       /* On exit, we must delete the return object */
-
-       acpi_ut_remove_reference(obj_desc);
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_copy_id_string
- *
- * PARAMETERS:  Destination         - Where to copy the string
- *              Source              - Source string
- *              max_length          - Length of the destination buffer
- *
- * RETURN:      None
- *
- * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
- *              Performs removal of a leading asterisk if present -- workaround
- *              for a known issue on a bunch of machines.
- *
- ******************************************************************************/
-
-static void
-acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length)
-{
-
-       /*
-        * Workaround for ID strings that have a leading asterisk. This construct
-        * is not allowed by the ACPI specification  (ID strings must be
-        * alphanumeric), but enough existing machines have this embedded in their
-        * ID strings that the following code is useful.
-        */
-       if (*source == '*') {
-               source++;
-       }
-
-       /* Do the actual copy */
-
-       ACPI_STRNCPY(destination, source, max_length);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_execute_HID
- *
- * PARAMETERS:  device_node         - Node for the device
- *              Hid                 - Where the HID is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Executes the _HID control method that returns the hardware
- *              ID of the device.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
-                   struct acpica_device_id *hid)
-{
-       union acpi_operand_object *obj_desc;
-       acpi_status status;
-
-       ACPI_FUNCTION_TRACE(ut_execute_HID);
-
-       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
-                                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
-                                        &obj_desc);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
-
-               /* Convert the Numeric HID to string */
-
-               acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
-                                         hid->value);
-       } else {
-               /* Copy the String HID from the returned object */
-
-               acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer,
-                                      sizeof(hid->value));
-       }
-
-       /* On exit, we must delete the return object */
-
-       acpi_ut_remove_reference(obj_desc);
-       return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_translate_one_cid
- *
- * PARAMETERS:  obj_desc            - _CID object, must be integer or string
- *              one_cid             - Where the CID string is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Return a numeric or string _CID value as a string.
- *              (Compatible ID)
- *
- *              NOTE:  Assumes a maximum _CID string length of
- *                     ACPI_MAX_CID_LENGTH.
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
-                         struct acpi_compatible_id *one_cid)
-{
-
-       switch (obj_desc->common.type) {
-       case ACPI_TYPE_INTEGER:
-
-               /* Convert the Numeric CID to string */
-
-               acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
-                                         one_cid->value);
-               return (AE_OK);
-
-       case ACPI_TYPE_STRING:
-
-               if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) {
-                       return (AE_AML_STRING_LIMIT);
-               }
-
-               /* Copy the String CID from the returned object */
-
-               acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer,
-                                      ACPI_MAX_CID_LENGTH);
-               return (AE_OK);
-
-       default:
-
-               return (AE_TYPE);
-       }
-}
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ut_execute_CID
- *
- * PARAMETERS:  device_node         - Node for the device
- *              return_cid_list     - Where the CID list is returned
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Executes the _CID control method that returns one or more
- *              compatible hardware IDs for the device.
- *
- *              NOTE: Internal function, no parameter validation
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
-                   struct acpi_compatible_id_list ** return_cid_list)
-{
-       union acpi_operand_object *obj_desc;
-       acpi_status status;
-       u32 count;
-       u32 size;
-       struct acpi_compatible_id_list *cid_list;
-       u32 i;
-
-       ACPI_FUNCTION_TRACE(ut_execute_CID);
-
-       /* Evaluate the _CID method for this device */
-
-       status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID,
-                                        ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING
-                                        | ACPI_BTYPE_PACKAGE, &obj_desc);
-       if (ACPI_FAILURE(status)) {
-               return_ACPI_STATUS(status);
-       }
-
-       /* Get the number of _CIDs returned */