From 7c9ff25bf61f32b0fb303e0c44fda763eb45900c Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 28 Apr 2008 16:33:48 -0600 Subject: [PATCH] --- yaml --- r: 95542 b: refs/heads/master c: 1bd17e63a068db6f464925a79b1cc4b27a8b1af9 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/laptops/thinkpad-acpi.txt | 139 +--- trunk/Documentation/thermal/sysfs-api.txt | 33 +- trunk/MAINTAINERS | 7 - trunk/arch/frv/kernel/pm.c | 8 + trunk/arch/mips/au1000/common/power.c | 35 +- trunk/arch/x86/kernel/apm_32.c | 16 + trunk/drivers/acpi/Kconfig | 3 - trunk/drivers/acpi/bay.c | 2 - trunk/drivers/acpi/dispatcher/dsfield.c | 173 ++-- trunk/drivers/acpi/dispatcher/dsinit.c | 2 +- trunk/drivers/acpi/dispatcher/dsmethod.c | 57 +- trunk/drivers/acpi/dispatcher/dsmthdat.c | 2 +- trunk/drivers/acpi/dispatcher/dsobject.c | 101 +-- trunk/drivers/acpi/dispatcher/dsopcode.c | 260 +----- trunk/drivers/acpi/dispatcher/dsutils.c | 167 +--- trunk/drivers/acpi/dispatcher/dswexec.c | 78 +- trunk/drivers/acpi/dispatcher/dswload.c | 37 +- trunk/drivers/acpi/dispatcher/dswscope.c | 2 +- trunk/drivers/acpi/dispatcher/dswstate.c | 517 +++++++++--- trunk/drivers/acpi/ec.c | 240 +++--- trunk/drivers/acpi/events/evevent.c | 2 +- trunk/drivers/acpi/events/evgpe.c | 6 +- trunk/drivers/acpi/events/evgpeblk.c | 2 +- trunk/drivers/acpi/events/evmisc.c | 92 ++- trunk/drivers/acpi/events/evregion.c | 4 +- trunk/drivers/acpi/events/evrgnini.c | 2 +- trunk/drivers/acpi/events/evsci.c | 2 +- trunk/drivers/acpi/events/evxface.c | 23 +- trunk/drivers/acpi/events/evxfevnt.c | 2 +- trunk/drivers/acpi/events/evxfregn.c | 2 +- trunk/drivers/acpi/executer/exconfig.c | 105 +-- trunk/drivers/acpi/executer/exconvrt.c | 2 +- trunk/drivers/acpi/executer/excreate.c | 117 ++- trunk/drivers/acpi/executer/exdump.c | 69 +- trunk/drivers/acpi/executer/exfield.c | 63 +- trunk/drivers/acpi/executer/exfldio.c | 46 +- trunk/drivers/acpi/executer/exmisc.c | 2 +- trunk/drivers/acpi/executer/exmutex.c | 237 ++---- trunk/drivers/acpi/executer/exnames.c | 2 +- trunk/drivers/acpi/executer/exoparg1.c | 25 +- trunk/drivers/acpi/executer/exoparg2.c | 21 +- trunk/drivers/acpi/executer/exoparg3.c | 3 +- trunk/drivers/acpi/executer/exoparg6.c | 10 +- trunk/drivers/acpi/executer/exprep.c | 17 +- trunk/drivers/acpi/executer/exregion.c | 10 +- trunk/drivers/acpi/executer/exresnte.c | 12 +- trunk/drivers/acpi/executer/exresolv.c | 55 +- trunk/drivers/acpi/executer/exresop.c | 13 +- trunk/drivers/acpi/executer/exstore.c | 119 +-- trunk/drivers/acpi/executer/exstoren.c | 2 +- trunk/drivers/acpi/executer/exstorob.c | 2 +- trunk/drivers/acpi/executer/exsystem.c | 3 +- trunk/drivers/acpi/executer/exutils.c | 67 +- trunk/drivers/acpi/fan.c | 35 +- trunk/drivers/acpi/glue.c | 20 - trunk/drivers/acpi/hardware/hwacpi.c | 2 +- trunk/drivers/acpi/hardware/hwgpe.c | 2 +- trunk/drivers/acpi/hardware/hwregs.c | 2 +- trunk/drivers/acpi/hardware/hwsleep.c | 16 +- trunk/drivers/acpi/hardware/hwtimer.c | 2 +- trunk/drivers/acpi/namespace/nsaccess.c | 101 +-- trunk/drivers/acpi/namespace/nsalloc.c | 2 +- trunk/drivers/acpi/namespace/nsdump.c | 11 +- trunk/drivers/acpi/namespace/nsdumpdv.c | 2 +- trunk/drivers/acpi/namespace/nseval.c | 2 +- trunk/drivers/acpi/namespace/nsinit.c | 12 +- trunk/drivers/acpi/namespace/nsload.c | 6 +- trunk/drivers/acpi/namespace/nsnames.c | 8 +- trunk/drivers/acpi/namespace/nsobject.c | 2 +- trunk/drivers/acpi/namespace/nsparse.c | 33 +- trunk/drivers/acpi/namespace/nssearch.c | 2 +- trunk/drivers/acpi/namespace/nsutils.c | 2 +- trunk/drivers/acpi/namespace/nswalk.c | 6 +- trunk/drivers/acpi/namespace/nsxfeval.c | 15 +- trunk/drivers/acpi/namespace/nsxfname.c | 2 +- trunk/drivers/acpi/namespace/nsxfobj.c | 2 +- trunk/drivers/acpi/osl.c | 1 - trunk/drivers/acpi/parser/psargs.c | 63 +- trunk/drivers/acpi/parser/psloop.c | 61 +- trunk/drivers/acpi/parser/psopcode.c | 38 +- trunk/drivers/acpi/parser/psparse.c | 45 +- trunk/drivers/acpi/parser/psscope.c | 2 +- trunk/drivers/acpi/parser/pstree.c | 4 +- trunk/drivers/acpi/parser/psutils.c | 2 +- trunk/drivers/acpi/parser/pswalk.c | 2 +- trunk/drivers/acpi/parser/psxface.c | 2 +- trunk/drivers/acpi/power.c | 2 +- trunk/drivers/acpi/processor_core.c | 31 +- trunk/drivers/acpi/processor_idle.c | 18 +- trunk/drivers/acpi/resources/rsaddr.c | 2 +- trunk/drivers/acpi/resources/rscalc.c | 26 +- trunk/drivers/acpi/resources/rscreate.c | 2 +- trunk/drivers/acpi/resources/rsdump.c | 10 +- trunk/drivers/acpi/resources/rsinfo.c | 2 +- trunk/drivers/acpi/resources/rsio.c | 41 +- trunk/drivers/acpi/resources/rsirq.c | 45 +- trunk/drivers/acpi/resources/rslist.c | 2 +- trunk/drivers/acpi/resources/rsmemory.c | 2 +- trunk/drivers/acpi/resources/rsmisc.c | 13 +- trunk/drivers/acpi/resources/rsutils.c | 8 +- trunk/drivers/acpi/resources/rsxface.c | 2 +- trunk/drivers/acpi/scan.c | 63 +- trunk/drivers/acpi/sleep/main.c | 42 +- trunk/drivers/acpi/tables/tbfadt.c | 2 +- trunk/drivers/acpi/tables/tbfind.c | 34 +- trunk/drivers/acpi/tables/tbinstal.c | 24 +- trunk/drivers/acpi/tables/tbutils.c | 4 +- trunk/drivers/acpi/tables/tbxface.c | 91 +-- trunk/drivers/acpi/tables/tbxfroot.c | 2 +- trunk/drivers/acpi/thermal.c | 20 +- trunk/drivers/acpi/utilities/utalloc.c | 4 +- trunk/drivers/acpi/utilities/utcache.c | 2 +- trunk/drivers/acpi/utilities/utcopy.c | 61 +- trunk/drivers/acpi/utilities/utdebug.c | 19 +- trunk/drivers/acpi/utilities/utdelete.c | 23 +- trunk/drivers/acpi/utilities/uteval.c | 2 +- trunk/drivers/acpi/utilities/utglobal.c | 49 +- trunk/drivers/acpi/utilities/utinit.c | 5 +- trunk/drivers/acpi/utilities/utmath.c | 4 +- trunk/drivers/acpi/utilities/utmisc.c | 6 +- trunk/drivers/acpi/utilities/utmutex.c | 2 +- trunk/drivers/acpi/utilities/utobject.c | 8 +- trunk/drivers/acpi/utilities/utresrc.c | 2 +- trunk/drivers/acpi/utilities/utstate.c | 2 +- trunk/drivers/acpi/utilities/utxface.c | 41 +- trunk/drivers/acpi/utils.c | 2 +- trunk/drivers/acpi/video.c | 316 ++++---- trunk/drivers/misc/Kconfig | 21 +- trunk/drivers/misc/Makefile | 3 +- trunk/drivers/misc/eeepc-laptop.c | 666 --------------- trunk/drivers/misc/intel_menlow.c | 28 +- trunk/drivers/misc/thinkpad_acpi.c | 765 +++++------------- trunk/drivers/pnp/isapnp/Makefile | 4 + trunk/drivers/pnp/pnpacpi/Makefile | 4 + trunk/drivers/pnp/pnpacpi/core.c | 2 +- trunk/drivers/pnp/pnpbios/Makefile | 4 + trunk/drivers/thermal/Kconfig | 4 +- trunk/drivers/thermal/Makefile | 2 +- .../thermal/{thermal_sys.c => thermal.c} | 165 +--- trunk/include/acpi/acconfig.h | 15 +- trunk/include/acpi/acdebug.h | 2 +- trunk/include/acpi/acdisasm.h | 38 +- trunk/include/acpi/acdispat.h | 31 +- trunk/include/acpi/acevents.h | 2 +- trunk/include/acpi/acexcep.h | 2 +- trunk/include/acpi/acglobal.h | 38 +- trunk/include/acpi/achware.h | 2 +- trunk/include/acpi/acinterp.h | 15 +- trunk/include/acpi/aclocal.h | 10 +- trunk/include/acpi/acmacros.h | 71 +- trunk/include/acpi/acnames.h | 2 +- trunk/include/acpi/acnamesp.h | 5 +- trunk/include/acpi/acobject.h | 5 +- trunk/include/acpi/acopcode.h | 6 +- trunk/include/acpi/acoutput.h | 2 +- trunk/include/acpi/acparser.h | 4 +- trunk/include/acpi/acpi.h | 2 +- trunk/include/acpi/acpiosxf.h | 2 +- trunk/include/acpi/acpixf.h | 7 +- trunk/include/acpi/acresrc.h | 3 +- trunk/include/acpi/acstruct.h | 5 +- trunk/include/acpi/actables.h | 2 +- trunk/include/acpi/actbl.h | 2 +- trunk/include/acpi/actbl1.h | 561 +------------ trunk/include/acpi/actypes.h | 93 +-- trunk/include/acpi/acutils.h | 4 +- trunk/include/acpi/amlcode.h | 2 +- trunk/include/acpi/amlresrc.h | 2 +- trunk/include/acpi/platform/acenv.h | 2 +- trunk/include/acpi/platform/acgcc.h | 2 +- trunk/include/acpi/platform/aclinux.h | 2 +- trunk/include/linux/thermal.h | 39 +- trunk/kernel/power/Kconfig | 10 + trunk/kernel/power/Makefile | 1 + trunk/kernel/power/pm.c | 205 +++++ 176 files changed, 2391 insertions(+), 5036 deletions(-) delete mode 100644 trunk/drivers/misc/eeepc-laptop.c rename trunk/drivers/thermal/{thermal_sys.c => thermal.c} (81%) create mode 100644 trunk/kernel/power/pm.c diff --git a/[refs] b/[refs] index f746b87d1a79..c3860deaa474 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 96916090f488986a4ebb8e9ffa6a3b50881d5ccd +refs/heads/master: 1bd17e63a068db6f464925a79b1cc4b27a8b1af9 diff --git a/trunk/Documentation/laptops/thinkpad-acpi.txt b/trunk/Documentation/laptops/thinkpad-acpi.txt index 01c6c3d8a7e3..76cb428435da 100644 --- a/trunk/Documentation/laptops/thinkpad-acpi.txt +++ b/trunk/Documentation/laptops/thinkpad-acpi.txt @@ -1,7 +1,7 @@ ThinkPad ACPI Extras Driver - Version 0.20 - April 09th, 2008 + Version 0.19 + January 06th, 2008 Borislav Deianov Henrique de Moraes Holschuh @@ -18,11 +18,6 @@ This driver used to be named ibm-acpi until kernel 2.6.21 and release moved to the drivers/misc tree and renamed to thinkpad-acpi for kernel 2.6.22, and release 0.14. -The driver is named "thinkpad-acpi". In some places, like module -names, "thinkpad_acpi" is used because of userspace issues. - -"tpacpi" is used as a shorthand where "thinkpad-acpi" would be too -long due to length limitations on some Linux kernel versions. Status ------ @@ -576,47 +571,6 @@ netlink interface and the input layer interface, and don't bother at all with hotkey_report_mode. -Brightness hotkey notes: - -These are the current sane choices for brightness key mapping in -thinkpad-acpi: - -For IBM and Lenovo models *without* ACPI backlight control (the ones on -which thinkpad-acpi will autoload its backlight interface by default, -and on which ACPI video does not export a backlight interface): - -1. Don't enable or map the brightness hotkeys in thinkpad-acpi, as - these older firmware versions unfortunately won't respect the hotkey - mask for brightness keys anyway, and always reacts to them. This - usually work fine, unless X.org drivers are doing something to block - the BIOS. In that case, use (3) below. This is the default mode of - operation. - -2. Enable the hotkeys, but map them to something else that is NOT - KEY_BRIGHTNESS_UP/DOWN or any other keycode that would cause - userspace to try to change the backlight level, and use that as an - on-screen-display hint. - -3. IF AND ONLY IF X.org drivers find a way to block the firmware from - automatically changing the brightness, enable the hotkeys and map - them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN, and feed that to - something that calls xbacklight. thinkpad-acpi will not be able to - change brightness in that case either, so you should disable its - backlight interface. - -For Lenovo models *with* ACPI backlight control: - -1. Load up ACPI video and use that. ACPI video will report ACPI - events for brightness change keys. Do not mess with thinkpad-acpi - defaults in this case. thinkpad-acpi should not have anything to do - with backlight events in a scenario where ACPI video is loaded: - brightness hotkeys must be disabled, and the backlight interface is - to be kept disabled as well. This is the default mode of operation. - -2. Do *NOT* load up ACPI video, enable the hotkeys in thinkpad-acpi, - and map them to KEY_BRIGHTNESS_UP and KEY_BRIGHTNESS_DOWN. Process - these keys on userspace somehow (e.g. by calling xbacklight). - Bluetooth --------- @@ -693,31 +647,16 @@ while others are still having problems. For more information: https://bugs.freedesktop.org/show_bug.cgi?id=2000 -ThinkLight control ------------------- - -procfs: /proc/acpi/ibm/light -sysfs attributes: as per LED class, for the "tpacpi::thinklight" LED - -procfs notes: +ThinkLight control -- /proc/acpi/ibm/light +------------------------------------------ -The ThinkLight status can be read and set through the procfs interface. A -few models which do not make the status available will show the ThinkLight -status as "unknown". The available commands are: +The current status of the ThinkLight can be found in this file. A few +models which do not make the status available will show it as +"unknown". The available commands are: echo on > /proc/acpi/ibm/light echo off > /proc/acpi/ibm/light -sysfs notes: - -The ThinkLight sysfs interface is documented by the LED class -documentation, in Documentation/leds-class.txt. The ThinkLight LED name -is "tpacpi::thinklight". - -Due to limitations in the sysfs LED class, if the status of the thinklight -cannot be read or if it is unknown, thinkpad-acpi will report it as "off". -It is impossible to know if the status returned through sysfs is valid. - Docking / undocking -- /proc/acpi/ibm/dock ------------------------------------------ @@ -876,63 +815,28 @@ The cmos command interface is prone to firmware split-brain problems, as in newer ThinkPads it is just a compatibility layer. Do not use it, it is exported just as a debug tool. -LED control ------------ - -procfs: /proc/acpi/ibm/led -sysfs attributes: as per LED class, see below for names - -Some of the LED indicators can be controlled through this feature. On -some older ThinkPad models, it is possible to query the status of the -LED indicators as well. Newer ThinkPads cannot query the real status -of the LED indicators. +LED control -- /proc/acpi/ibm/led +--------------------------------- -procfs notes: - -The available commands are: +Some of the LED indicators can be controlled through this feature. The +available commands are: - echo ' on' >/proc/acpi/ibm/led - echo ' off' >/proc/acpi/ibm/led - echo ' blink' >/proc/acpi/ibm/led + echo ' on' >/proc/acpi/ibm/led + echo ' off' >/proc/acpi/ibm/led + echo ' blink' >/proc/acpi/ibm/led -The range is 0 to 7. The set of LEDs that can be -controlled varies from model to model. Here is the common ThinkPad -mapping: +The range is 0 to 7. The set of LEDs that can be +controlled varies from model to model. Here is the mapping on the X40: 0 - power 1 - battery (orange) 2 - battery (green) - 3 - UltraBase/dock + 3 - UltraBase 4 - UltraBay - 5 - UltraBase battery slot - 6 - (unknown) 7 - standby All of the above can be turned on and off and can be made to blink. -sysfs notes: - -The ThinkPad LED sysfs interface is described in detail by the LED class -documentation, in Documentation/leds-class.txt. - -The leds are named (in LED ID order, from 0 to 7): -"tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt", -"tpacpi::dock_active", "tpacpi::bay_active", "tpacpi::dock_batt", -"tpacpi::unknown_led", "tpacpi::standby". - -Due to limitations in the sysfs LED class, if the status of the LED -indicators cannot be read due to an error, thinkpad-acpi will report it as -a brightness of zero (same as LED off). - -If the thinkpad firmware doesn't support reading the current status, -trying to read the current LED brightness will just return whatever -brightness was last written to that attribute. - -These LEDs can blink using hardware acceleration. To request that a -ThinkPad indicator LED should blink in hardware accelerated mode, use the -"timer" trigger, and leave the delay_on and delay_off parameters set to -zero (to request hardware acceleration autodetection). - ACPI sounds -- /proc/acpi/ibm/beep ---------------------------------- @@ -1186,15 +1090,6 @@ it there will be the following attributes: dim the display. -WARNING: - - Whatever you do, do NOT ever call thinkpad-acpi backlight-level change - interface and the ACPI-based backlight level change interface - (available on newer BIOSes, and driven by the Linux ACPI video driver) - at the same time. The two will interact in bad ways, do funny things, - and maybe reduce the life of the backlight lamps by needlessly kicking - its level up and down at every change. - Volume control -- /proc/acpi/ibm/volume --------------------------------------- diff --git a/trunk/Documentation/thermal/sysfs-api.txt b/trunk/Documentation/thermal/sysfs-api.txt index 70d68ce8640a..d9f28be75403 100644 --- a/trunk/Documentation/thermal/sysfs-api.txt +++ b/trunk/Documentation/thermal/sysfs-api.txt @@ -108,12 +108,10 @@ and throttle appropriate devices. RO read only value RW read/write value -Thermal sysfs attributes will be represented under /sys/class/thermal. -Hwmon sysfs I/F extension is also available under /sys/class/hwmon -if hwmon is compiled in or built as a module. +All thermal sysfs attributes will be represented under /sys/class/thermal Thermal zone device sys I/F, created once it's registered: -/sys/class/thermal/thermal_zone[0-*]: +|thermal_zone[0-*]: |-----type: Type of the thermal zone |-----temp: Current temperature |-----mode: Working mode of the thermal zone @@ -121,7 +119,7 @@ Thermal zone device sys I/F, created once it's registered: |-----trip_point_[0-*]_type: Trip point type Thermal cooling device sys I/F, created once it's registered: -/sys/class/thermal/cooling_device[0-*]: +|cooling_device[0-*]: |-----type : Type of the cooling device(processor/fan/...) |-----max_state: Maximum cooling state of the cooling device |-----cur_state: Current cooling state of the cooling device @@ -132,19 +130,10 @@ They represent the relationship between a thermal zone and its associated coolin They are created/removed for each thermal_zone_bind_cooling_device/thermal_zone_unbind_cooling_device successful execution. -/sys/class/thermal/thermal_zone[0-*] +|thermal_zone[0-*] |-----cdev[0-*]: The [0-*]th cooling device in the current thermal zone |-----cdev[0-*]_trip_point: Trip point that cdev[0-*] is associated with -Besides the thermal zone device sysfs I/F and cooling device sysfs I/F, -the generic thermal driver also creates a hwmon sysfs I/F for each _type_ of -thermal zone device. E.g. the generic thermal driver registers one hwmon class device -and build the associated hwmon sysfs I/F for all the registered ACPI thermal zones. -/sys/class/hwmon/hwmon[0-*]: - |-----name: The type of the thermal zone devices. - |-----temp[1-*]_input: The current temperature of thermal zone [1-*]. - |-----temp[1-*]_critical: The critical trip point of thermal zone [1-*]. -Please read Documentation/hwmon/sysfs-interface for additional information. *************************** * Thermal zone attributes * @@ -152,10 +141,7 @@ Please read Documentation/hwmon/sysfs-interface for additional information. type Strings which represent the thermal zone type. This is given by thermal zone driver as part of registration. - Eg: "acpitz" indicates it's an ACPI thermal device. - In order to keep it consistent with hwmon sys attribute, - this should be a short, lowercase string, - not containing spaces nor dashes. + Eg: "ACPI thermal zone" indicates it's a ACPI thermal device RO Required @@ -232,7 +218,7 @@ the sys I/F structure will be built like this: /sys/class/thermal: |thermal_zone1: - |-----type: acpitz + |-----type: ACPI thermal zone |-----temp: 37000 |-----mode: kernel |-----trip_point_0_temp: 100000 @@ -257,10 +243,3 @@ the sys I/F structure will be built like this: |-----type: Fan |-----max_state: 2 |-----cur_state: 0 - -/sys/class/hwmon: - -|hwmon0: - |-----name: acpitz - |-----temp1_input: 37000 - |-----temp1_crit: 100000 diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 37debda36661..c1dd1ae7b133 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1531,13 +1531,6 @@ L: bluesmoke-devel@lists.sourceforge.net W: bluesmoke.sourceforge.net S: Maintained -EEEPC LAPTOP EXTRAS DRIVER -P: Corentin Chary -M: corentincj@iksaif.net -L: acpi4asus-user@lists.sourceforge.net -W: http://sourceforge.net/projects/acpi4asus -S: Maintained - EEPRO100 NETWORK DRIVER P: Andrey V. Savochkin M: saw@saw.sw.com.sg diff --git a/trunk/arch/frv/kernel/pm.c b/trunk/arch/frv/kernel/pm.c index 73f3aeefd203..c57ce3f1f2e2 100644 --- a/trunk/arch/frv/kernel/pm.c +++ b/trunk/arch/frv/kernel/pm.c @@ -163,11 +163,14 @@ static int sysctl_pm_do_suspend(ctl_table *ctl, int write, struct file *filp, if ((mode != 1) && (mode != 5)) return -EINVAL; + retval = pm_send_all(PM_SUSPEND, (void *)3); + if (retval == 0) { if (mode == 5) retval = pm_do_bus_sleep(); else retval = pm_do_suspend(); + pm_send_all(PM_RESUME, (void *)0); } return retval; @@ -180,6 +183,9 @@ static int try_set_cmode(int new_cmode) if (!(clock_cmodes_permitted & (1< 0x100) + set_system_power_state(APM_STATE_REJECT); + err = -EBUSY; + ignore_sys_suspend = 0; + printk(KERN_WARNING "apm: suspend was vetoed.\n"); + goto out; + } + printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n"); + } + device_suspend(PMSG_SUSPEND); local_irq_disable(); device_power_down(PMSG_SUSPEND); @@ -1214,7 +1227,9 @@ static int suspend(int vetoable) device_power_up(); local_irq_enable(); device_resume(); + pm_send_all(PM_RESUME, (void *)0); queue_event(APM_NORMAL_RESUME, NULL); + out: spin_lock(&user_list_lock); for (as = user_list; as != NULL; as = as->next) { as->suspend_wait = 0; @@ -1325,6 +1340,7 @@ static void check_events(void) if ((event != APM_NORMAL_RESUME) || (ignore_normal_resume == 0)) { device_resume(); + pm_send_all(PM_RESUME, (void *)0); queue_event(event, NULL); } ignore_normal_resume = 0; diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index c52fca833268..b4f5e8542829 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -140,7 +140,6 @@ config ACPI_VIDEO tristate "Video" depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL depends on INPUT - select THERMAL help This driver implement the ACPI Extensions For Display Adapters for integrated graphics devices on motherboard, as specified in @@ -152,7 +151,6 @@ config ACPI_VIDEO config ACPI_FAN tristate "Fan" - select THERMAL default y help This driver adds support for ACPI fan devices, allowing user-mode @@ -174,7 +172,6 @@ config ACPI_BAY config ACPI_PROCESSOR tristate "Processor" - select THERMAL default y help This driver installs ACPI as the idle handler for Linux, and uses diff --git a/trunk/drivers/acpi/bay.c b/trunk/drivers/acpi/bay.c index d2fc94161848..1fa86811b8ee 100644 --- a/trunk/drivers/acpi/bay.c +++ b/trunk/drivers/acpi/bay.c @@ -201,7 +201,6 @@ static int is_ejectable_bay(acpi_handle handle) return 0; } -#if 0 /** * eject_removable_drive - try to eject this drive * @dev : the device structure of the drive @@ -226,7 +225,6 @@ int eject_removable_drive(struct device *dev) return 0; } EXPORT_SYMBOL_GPL(eject_removable_drive); -#endif /* 0 */ static int acpi_bay_add_fs(struct bay *bay) { diff --git a/trunk/drivers/acpi/dispatcher/dsfield.c b/trunk/drivers/acpi/dispatcher/dsfield.c index c78078315be9..f049639bac35 100644 --- a/trunk/drivers/acpi/dispatcher/dsfield.c +++ b/trunk/drivers/acpi/dispatcher/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,16 +89,12 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, ACPI_FUNCTION_TRACE(ds_create_buffer_field); - /* - * Get the name_string argument (name of the new buffer_field) - */ - if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { - - /* For create_field, name is the 4th argument */ + /* Get the name_string argument */ + if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { arg = acpi_ps_get_arg(op, 3); } else { - /* For all other create_xXXField operators, name is the 3rd argument */ + /* Create Bit/Byte/Word/Dword field */ arg = acpi_ps_get_arg(op, 2); } @@ -111,30 +107,26 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, node = walk_state->deferred_node; status = AE_OK; } else { - /* Execute flag should always be set when this function is entered */ - - if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) { - return_ACPI_STATUS(AE_AML_INTERNAL); - } - - /* Creating new namespace node, should not already exist */ - - 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) { - flags |= ACPI_NS_TEMPORARY; + /* + * During the load phase, we want to enter the name of the field into + * the namespace. During the execute phase (when we evaluate the size + * operand), we want to lookup the name + */ + if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) { + flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; + } else { + flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND; } - /* Enter the name_string into the namespace */ - + /* + * Enter the name_string into the namespace + */ status = acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, flags, walk_state, - &node); + &(node)); if (ACPI_FAILURE(status)) { ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); @@ -144,13 +136,13 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, /* * We could put the returned object (Node) on the object stack for later, * but for now, we will put it in the "op" object that the parser uses, - * so we can get it again at the end of this scope. + * so we can get it again at the end of this scope */ op->common.node = node; /* * If there is no object attached to the node, this node was just created - * and we need to create the field object. Otherwise, this was a lookup + * and we need to create the field object. Otherwise, this was a lookup * of an existing node and we don't want to create the field object again. */ obj_desc = acpi_ns_get_attached_object(node); @@ -172,8 +164,9 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, } /* - * Remember location in AML stream of the field unit opcode and operands -- - * since the buffer and index operands must be evaluated. + * Remember location in AML stream of the field unit + * opcode and operands -- since the buffer and index + * operands must be evaluated. */ second_desc = obj_desc->common.next_object; second_desc->extra.aml_start = op->named.data; @@ -268,7 +261,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, case AML_INT_NAMEDFIELD_OP: - /* Lookup the name, it should already exist */ + /* Lookup the name */ status = acpi_ns_lookup(walk_state->scope_info, (char *)&arg->named.name, @@ -279,23 +272,20 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, if (ACPI_FAILURE(status)) { ACPI_ERROR_NAMESPACE((char *)&arg->named.name, status); - return_ACPI_STATUS(status); + if (status != AE_ALREADY_EXISTS) { + return_ACPI_STATUS(status); + } + + /* Already exists, ignore error */ } else { arg->common.node = info->field_node; info->field_bit_length = arg->common.value.size; - /* - * If there is no object attached to the node, this node was - * just created and we need to create the field object. - * Otherwise, this was a lookup of an existing node and we - * don't want to create the field object again. - */ - if (!acpi_ns_get_attached_object - (info->field_node)) { - status = acpi_ex_prep_field_value(info); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + /* Create and initialize an object for the new Field Node */ + + status = acpi_ex_prep_field_value(info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } @@ -409,27 +399,9 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, union acpi_parse_object *arg = NULL; struct acpi_namespace_node *node; u8 type = 0; - u32 flags; ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); - /* Execute flag should always be set when this function is entered */ - - if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) { - if (walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP) { - - /* bank_field Op is deferred, just return OK */ - - return_ACPI_STATUS(AE_OK); - } - - return_ACPI_STATUS(AE_AML_INTERNAL); - } - - /* - * Get the field_list argument for this opcode. This is the start of the - * list of field elements. - */ switch (walk_state->opcode) { case AML_FIELD_OP: arg = acpi_ps_get_arg(op, 2); @@ -450,33 +422,20 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, return_ACPI_STATUS(AE_BAD_PARAMETER); } - if (!arg) { - return_ACPI_STATUS(AE_AML_NO_OPERAND); - } - - /* Creating new namespace node(s), should not already exist */ - - 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) { - flags |= ACPI_NS_TEMPORARY; - } - /* * Walk the list of entries in the field_list */ while (arg) { - /* - * Ignore OFFSET and ACCESSAS terms here; we are only interested in the - * field names in order to enter them into the namespace. - */ + + /* Ignore OFFSET and ACCESSAS terms here */ + if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { status = acpi_ns_lookup(walk_state->scope_info, - (char *)&arg->named.name, type, - ACPI_IMODE_LOAD_PASS1, flags, + (char *)&arg->named.name, + type, ACPI_IMODE_LOAD_PASS1, + ACPI_NS_NO_UPSEARCH | + ACPI_NS_DONT_OPEN_SCOPE | + ACPI_NS_ERROR_IF_FOUND, walk_state, &node); if (ACPI_FAILURE(status)) { ACPI_ERROR_NAMESPACE((char *)&arg->named.name, @@ -493,7 +452,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, arg->common.node = node; } - /* Get the next field element in the list */ + /* Move to next field in the list */ arg = arg->common.next; } @@ -507,7 +466,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, * * PARAMETERS: Op - Op containing the Field definition and args * region_node - Object for the containing Operation Region - * walk_state - Current method state + * ` walk_state - Current method state * * RETURN: Status * @@ -554,13 +513,36 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, return_ACPI_STATUS(status); } - /* - * Third arg is the bank_value - * This arg is a term_arg, not a constant - * It will be evaluated later, by acpi_ds_eval_bank_field_operands - */ + /* Third arg is the bank_value */ + + /* TBD: This arg is a term_arg, not a constant, and must be evaluated */ + arg = arg->common.next; + /* Currently, only the following constants are supported */ + + switch (arg->common.aml_opcode) { + case AML_ZERO_OP: + info.bank_value = 0; + break; + + case AML_ONE_OP: + info.bank_value = 1; + break; + + case AML_BYTE_OP: + case AML_WORD_OP: + case AML_DWORD_OP: + case AML_QWORD_OP: + info.bank_value = (u32) arg->common.value.integer; + break; + + default: + info.bank_value = 0; + ACPI_ERROR((AE_INFO, + "Non-constant BankValue for BankField is not implemented")); + } + /* Fourth arg is the field flags */ arg = arg->common.next; @@ -571,17 +553,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; info.region_node = region_node; - /* - * Use Info.data_register_node to store bank_field Op - * It's safe because data_register_node will never be used when create bank field - * We store aml_start and aml_length in the bank_field Op for late evaluation - * Used in acpi_ex_prep_field_value(Info) - * - * TBD: Or, should we add a field in struct acpi_create_field_info, like "void *ParentOp"? - */ - info.data_register_node = (struct acpi_namespace_node *)op; - status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); + return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/dispatcher/dsinit.c b/trunk/drivers/acpi/dispatcher/dsinit.c index 610b1ee102b0..af923c388520 100644 --- a/trunk/drivers/acpi/dispatcher/dsinit.c +++ b/trunk/drivers/acpi/dispatcher/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/dispatcher/dsmethod.c b/trunk/drivers/acpi/dispatcher/dsmethod.c index e48a3ea03117..1cbe61905824 100644 --- a/trunk/drivers/acpi/dispatcher/dsmethod.c +++ b/trunk/drivers/acpi/dispatcher/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,6 +42,7 @@ */ #include +#include #include #include #include @@ -101,7 +102,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) walk_state->opcode, walk_state->aml_offset, NULL); - acpi_ex_enter_interpreter(); + (void)acpi_ex_enter_interpreter(); } #ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE(status)) { @@ -231,9 +232,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, * recursive call. */ if (!walk_state || - !obj_desc->method.mutex->mutex.thread_id || - (walk_state->thread->thread_id != - obj_desc->method.mutex->mutex.thread_id)) { + !obj_desc->method.mutex->mutex.owner_thread || + (walk_state->thread != + obj_desc->method.mutex->mutex.owner_thread)) { /* * Acquire the method mutex. This releases the interpreter if we * block (and reacquires it before it returns) @@ -253,8 +254,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, original_sync_level = walk_state->thread->current_sync_level; - obj_desc->method.mutex->mutex.thread_id = - walk_state->thread->thread_id; + obj_desc->method.mutex->mutex.owner_thread = + walk_state->thread; walk_state->thread->current_sync_level = obj_desc->method.sync_level; } else { @@ -534,6 +535,8 @@ void acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, struct acpi_walk_state *walk_state) { + struct acpi_namespace_node *method_node; + acpi_status status; ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); @@ -548,26 +551,34 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, /* Delete all arguments and locals */ acpi_ds_method_data_delete_all(walk_state); + } - /* - * If method is serialized, release the mutex and restore the - * current sync level for this thread - */ - if (method_desc->method.mutex) { + /* + * If method is serialized, release the mutex and restore the + * current sync level for this thread + */ + if (method_desc->method.mutex) { - /* Acquisition Depth handles recursive calls */ + /* Acquisition Depth handles recursive calls */ - method_desc->method.mutex->mutex.acquisition_depth--; - if (!method_desc->method.mutex->mutex.acquisition_depth) { - walk_state->thread->current_sync_level = - method_desc->method.mutex->mutex. - original_sync_level; + method_desc->method.mutex->mutex.acquisition_depth--; + if (!method_desc->method.mutex->mutex.acquisition_depth) { + walk_state->thread->current_sync_level = + method_desc->method.mutex->mutex. + original_sync_level; - acpi_os_release_mutex(method_desc->method. - mutex->mutex.os_mutex); - method_desc->method.mutex->mutex.thread_id = 0; - } + acpi_os_release_mutex(method_desc->method.mutex->mutex. + os_mutex); + method_desc->method.mutex->mutex.owner_thread = NULL; } + } + + if (walk_state) { + /* + * Delete any objects created by this method during execution. + * The method Node is stored in the walk state + */ + method_node = walk_state->method_node; /* * Delete any namespace objects created anywhere within @@ -609,7 +620,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, */ if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) && (!method_desc->method.mutex)) { - (void)acpi_ds_create_method_mutex(method_desc); + status = acpi_ds_create_method_mutex(method_desc); } /* No more threads, we can free the owner_id */ diff --git a/trunk/drivers/acpi/dispatcher/dsmthdat.c b/trunk/drivers/acpi/dispatcher/dsmthdat.c index 13c43eac35db..ba4626e06a5e 100644 --- a/trunk/drivers/acpi/dispatcher/dsmthdat.c +++ b/trunk/drivers/acpi/dispatcher/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/dispatcher/dsobject.c b/trunk/drivers/acpi/dispatcher/dsobject.c index 1022e38994c2..954ac8ce958a 100644 --- a/trunk/drivers/acpi/dispatcher/dsobject.c +++ b/trunk/drivers/acpi/dispatcher/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -157,9 +157,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, * will remain as named references. This behavior is not described * in the ACPI spec, but it appears to be an oversight. */ - obj_desc = - ACPI_CAST_PTR(union acpi_operand_object, - op->common.node); + obj_desc = (union acpi_operand_object *)op->common.node; status = acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR @@ -174,19 +172,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, switch (op->common.node->type) { /* * For these types, we need the actual node, not the subobject. - * However, the subobject did not get an extra reference count above. - * - * TBD: should ex_resolve_node_to_value be changed to fix this? - */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - - acpi_ut_add_reference(op->common.node->object); - - /*lint -fallthrough */ - /* - * For these types, we need the actual node, not the subobject. - * The subobject got an extra reference count in ex_resolve_node_to_value. + * However, the subobject got an extra reference count above. */ case ACPI_TYPE_MUTEX: case ACPI_TYPE_METHOD: @@ -194,15 +180,25 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: case ACPI_TYPE_REGION: + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: - /* We will create a reference object for these types below */ + obj_desc = + (union acpi_operand_object *)op->common. + node; break; default: - /* - * All other types - the node was resolved to an actual - * object, we are done. - */ + break; + } + + /* + * If above resolved to an operand object, we are done. Otherwise, + * we have a NS node, we must create the package entry as a named + * reference. + */ + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != + ACPI_DESC_TYPE_NAMED) { goto exit; } } @@ -227,7 +223,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, exit: *obj_desc_ptr = obj_desc; - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -373,9 +369,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, union acpi_parse_object *parent; union acpi_operand_object *obj_desc = NULL; acpi_status status = AE_OK; - unsigned i; - u16 index; - u16 reference_count; + acpi_native_uint i; ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); @@ -453,60 +447,13 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, package. elements[i]); } - - if (*obj_desc_ptr) { - - /* Existing package, get existing reference count */ - - reference_count = - (*obj_desc_ptr)->common.reference_count; - if (reference_count > 1) { - - /* Make new element ref count match original ref count */ - - for (index = 0; index < (reference_count - 1); - index++) { - acpi_ut_add_reference((obj_desc-> - package. - elements[i])); - } - } - } - arg = arg->common.next; } - /* Check for match between num_elements and actual length of package_list */ - - if (arg) { - /* - * num_elements was exhausted, but there are remaining elements in the - * package_list. - * - * 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. - */ - while (arg) { - - /* Find out how many elements there really are */ - - i++; - arg = arg->common.next; - } - - ACPI_ERROR((AE_INFO, - "Package List length (%X) larger than NumElements count (%X), truncated\n", - i, element_count)); - } else if (i < element_count) { - /* - * Arg list (elements) was exhausted, but we did not reach num_elements count. - * Note: this is not an error, the package is padded out with NULLs. - */ + if (!arg) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", - i, element_count)); + "Package List length larger than NumElements count (%X), truncated\n", + element_count)); } obj_desc->package.flags |= AOPOBJ_DATA_VALID; @@ -774,8 +721,6 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, /* Node was saved in Op */ obj_desc->reference.node = op->common.node; - obj_desc->reference.object = - op->common.node->object; } obj_desc->reference.opcode = opcode; diff --git a/trunk/drivers/acpi/dispatcher/dsopcode.c b/trunk/drivers/acpi/dispatcher/dsopcode.c index a818e0ddb996..f501e083aac7 100644 --- a/trunk/drivers/acpi/dispatcher/dsopcode.c +++ b/trunk/drivers/acpi/dispatcher/dsopcode.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,6 @@ #include #include #include -#include #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsopcode") @@ -218,50 +217,6 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) return_ACPI_STATUS(status); } -/******************************************************************************* - * - * FUNCTION: acpi_ds_get_bank_field_arguments - * - * PARAMETERS: obj_desc - A valid bank_field object - * - * RETURN: Status. - * - * DESCRIPTION: Get bank_field bank_value. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -acpi_status -acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc) -{ - union acpi_operand_object *extra_desc; - struct acpi_namespace_node *node; - acpi_status status; - - ACPI_FUNCTION_TRACE_PTR(ds_get_bank_field_arguments, obj_desc); - - if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { - return_ACPI_STATUS(AE_OK); - } - - /* Get the AML pointer (method object) and bank_field node */ - - extra_desc = acpi_ns_get_secondary_object(obj_desc); - node = obj_desc->bank_field.node; - - ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname - (ACPI_TYPE_LOCAL_BANK_FIELD, node, NULL)); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", - acpi_ut_get_node_name(node))); - - /* Execute the AML code for the term_arg arguments */ - - status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), - extra_desc->extra.aml_length, - extra_desc->extra.aml_start); - return_ACPI_STATUS(status); -} - /******************************************************************************* * * FUNCTION: acpi_ds_get_buffer_arguments @@ -815,109 +770,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", obj_desc, - ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), - obj_desc->region.length)); - - /* Now the address and length are valid for this opregion */ - - obj_desc->region.flags |= AOPOBJ_DATA_VALID; - - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ds_eval_table_region_operands - * - * PARAMETERS: walk_state - Current walk - * Op - A valid region Op object - * - * RETURN: Status - * - * DESCRIPTION: Get region address and length - * Called from acpi_ds_exec_end_op during data_table_region parse tree walk - * - ******************************************************************************/ - -acpi_status -acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, - union acpi_parse_object *op) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_operand_object **operand; - struct acpi_namespace_node *node; - union acpi_parse_object *next_op; - acpi_native_uint table_index; - struct acpi_table_header *table; - - ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); - - /* - * This is where we evaluate the signature_string and oem_iDString - * and oem_table_iDString of the data_table_region declaration - */ - node = op->common.node; - - /* next_op points to signature_string op */ - - next_op = op->common.value.arg; - - /* - * Evaluate/create the signature_string and oem_iDString - * and oem_table_iDString operands - */ - status = acpi_ds_create_operands(walk_state, next_op); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* - * Resolve the signature_string and oem_iDString - * and oem_table_iDString operands - */ - status = acpi_ex_resolve_operands(op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name(op->common.aml_opcode), - 1, "after AcpiExResolveOperands"); - - operand = &walk_state->operands[0]; - - /* Find the ACPI table */ - - status = acpi_tb_find_table(operand[0]->string.pointer, - operand[1]->string.pointer, - operand[2]->string.pointer, &table_index); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - acpi_ut_remove_reference(operand[0]); - acpi_ut_remove_reference(operand[1]); - acpi_ut_remove_reference(operand[2]); - - status = acpi_get_table_by_index(table_index, &table); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NOT_EXIST); - } - - obj_desc->region.address = - (acpi_physical_address) ACPI_TO_INTEGER(table); - obj_desc->region.length = table->length; - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, - ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), + ACPI_FORMAT_UINT64(obj_desc->region.address), obj_desc->region.length)); /* Now the address and length are valid for this opregion */ @@ -955,12 +808,6 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, /* The first operand (for all of these data objects) is the length */ - /* - * Set proper index into operand stack for acpi_ds_obj_stack_push - * invoked inside acpi_ds_create_operand. - */ - walk_state->operand_index = walk_state->num_operands; - status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -1029,106 +876,6 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); } -/******************************************************************************* - * - * FUNCTION: acpi_ds_eval_bank_field_operands - * - * PARAMETERS: walk_state - Current walk - * Op - A valid bank_field Op object - * - * RETURN: Status - * - * DESCRIPTION: Get bank_field bank_value - * Called from acpi_ds_exec_end_op during bank_field parse tree walk - * - ******************************************************************************/ - -acpi_status -acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, - union acpi_parse_object *op) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_operand_object *operand_desc; - struct acpi_namespace_node *node; - union acpi_parse_object *next_op; - union acpi_parse_object *arg; - - ACPI_FUNCTION_TRACE_PTR(ds_eval_bank_field_operands, op); - - /* - * This is where we evaluate the bank_value field of the - * bank_field declaration - */ - - /* next_op points to the op that holds the Region */ - - next_op = op->common.value.arg; - - /* next_op points to the op that holds the Bank Register */ - - next_op = next_op->common.next; - - /* next_op points to the op that holds the Bank Value */ - - next_op = next_op->common.next; - - /* - * Set proper index into operand stack for acpi_ds_obj_stack_push - * invoked inside acpi_ds_create_operand. - * - * We use walk_state->Operands[0] to store the evaluated bank_value - */ - walk_state->operand_index = 0; - - status = acpi_ds_create_operand(walk_state, next_op, 0); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_ex_resolve_to_value(&walk_state->operands[0], walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - acpi_ps_get_opcode_name(op->common.aml_opcode), - 1, "after AcpiExResolveOperands"); - - /* - * Get the bank_value operand and save it - * (at Top of stack) - */ - operand_desc = walk_state->operands[0]; - - /* Arg points to the start Bank Field */ - - arg = acpi_ps_get_arg(op, 4); - while (arg) { - - /* Ignore OFFSET and ACCESSAS terms here */ - - if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { - node = arg->common.node; - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NOT_EXIST); - } - - obj_desc->bank_field.value = - (u32) operand_desc->integer.value; - } - - /* Move to next field in the list */ - - arg = arg->common.next; - } - - acpi_ut_remove_reference(operand_desc); - return_ACPI_STATUS(status); -} - /******************************************************************************* * * FUNCTION: acpi_ds_exec_begin_control_op @@ -1323,7 +1070,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, * is set to anything other than zero! */ walk_state->return_desc = walk_state->operands[0]; - } else if (walk_state->result_count) { + } else if ((walk_state->results) && + (walk_state->results->results.num_results > 0)) { /* Since we have a real Return(), delete any implicit return */ diff --git a/trunk/drivers/acpi/dispatcher/dsutils.c b/trunk/drivers/acpi/dispatcher/dsutils.c index b398982f0d8b..71503c036f7c 100644 --- a/trunk/drivers/acpi/dispatcher/dsutils.c +++ b/trunk/drivers/acpi/dispatcher/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -278,9 +278,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, AML_VAR_PACKAGE_OP) || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) || (op->common.parent->common.aml_opcode == - AML_INT_EVAL_SUBTREE_OP) - || (op->common.parent->common.aml_opcode == - AML_BANK_FIELD_OP)) { + AML_INT_EVAL_SUBTREE_OP)) { /* * These opcodes allow term_arg(s) as operands and therefore * the operands can be method calls. The result is used. @@ -474,8 +472,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, /* A valid name must be looked up in the namespace */ if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && - (arg->common.value.string) && - !(arg->common.flags & ACPI_PARSEOP_IN_STACK)) { + (arg->common.value.string)) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg)); @@ -598,8 +595,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, } else { /* Check for null name case */ - if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && - !(arg->common.flags & ACPI_PARSEOP_IN_STACK)) { + if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) { /* * If the name is null, this means that this is an * optional result parameter that was not specified @@ -621,8 +617,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } - if ((op_info->flags & AML_HAS_RETVAL) - || (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { + if (op_info->flags & AML_HAS_RETVAL) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Argument previously created, already stacked\n")); @@ -635,7 +630,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, * Use value that was already previously returned * by the evaluation of this argument */ - status = acpi_ds_result_pop(&obj_desc, walk_state); + status = + acpi_ds_result_pop_from_bottom(&obj_desc, + walk_state); if (ACPI_FAILURE(status)) { /* * Only error is underflow, and this indicates @@ -701,52 +698,27 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, { acpi_status status = AE_OK; union acpi_parse_object *arg; - union acpi_parse_object *arguments[ACPI_OBJ_NUM_OPERANDS]; u32 arg_count = 0; - u32 index = walk_state->num_operands; - u32 i; ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); - /* Get all arguments in the list */ + /* For all arguments in the list... */ arg = first_arg; while (arg) { - if (index >= ACPI_OBJ_NUM_OPERANDS) { - return_ACPI_STATUS(AE_BAD_DATA); + status = acpi_ds_create_operand(walk_state, arg, arg_count); + if (ACPI_FAILURE(status)) { + goto cleanup; } - arguments[index] = arg; - walk_state->operands[index] = NULL; + ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, + "Arg #%d (%p) done, Arg1=%p\n", arg_count, + arg, first_arg)); /* Move on to next argument, if any */ arg = arg->common.next; arg_count++; - index++; - } - - index--; - - /* It is the appropriate order to get objects from the Result stack */ - - for (i = 0; i < arg_count; i++) { - arg = arguments[index]; - - /* Force the filling of the operand stack in inverse order */ - - walk_state->operand_index = (u8) index; - - status = acpi_ds_create_operand(walk_state, arg, index); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - - index--; - - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "Arg #%d (%p) done, Arg1=%p\n", index, arg, - first_arg)); } return_ACPI_STATUS(status); @@ -757,112 +729,9 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, * pop everything off of the operand stack and delete those * objects */ - acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); - - ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", index)); - return_ACPI_STATUS(status); -} - -/***************************************************************************** - * - * FUNCTION: acpi_ds_evaluate_name_path - * - * PARAMETERS: walk_state - Current state of the parse tree walk, - * the opcode of current operation should be - * AML_INT_NAMEPATH_OP - * - * RETURN: Status - * - * DESCRIPTION: Translate the -name_path- parse tree object to the equivalent - * interpreter object, convert it to value, if needed, duplicate - * it, if needed, and push it onto the current result stack. - * - ****************************************************************************/ - -acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state) -{ - acpi_status status = AE_OK; - union acpi_parse_object *op = walk_state->op; - union acpi_operand_object **operand = &walk_state->operands[0]; - union acpi_operand_object *new_obj_desc; - u8 type; - - ACPI_FUNCTION_TRACE_PTR(ds_evaluate_name_path, walk_state); - - if (!op->common.parent) { - - /* This happens after certain exception processing */ - - goto exit; - } - - if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || - (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) || - (op->common.parent->common.aml_opcode == AML_REF_OF_OP)) { - - /* TBD: Should we specify this feature as a bit of op_info->Flags of these opcodes? */ - - goto exit; - } - - status = acpi_ds_create_operand(walk_state, op, 0); - if (ACPI_FAILURE(status)) { - goto exit; - } - - if (op->common.flags & ACPI_PARSEOP_TARGET) { - new_obj_desc = *operand; - goto push_result; - } - - type = ACPI_GET_OBJECT_TYPE(*operand); - - status = acpi_ex_resolve_to_value(operand, walk_state); - if (ACPI_FAILURE(status)) { - goto exit; - } - - if (type == ACPI_TYPE_INTEGER) { - - /* It was incremented by acpi_ex_resolve_to_value */ - - acpi_ut_remove_reference(*operand); - - status = - acpi_ut_copy_iobject_to_iobject(*operand, &new_obj_desc, - walk_state); - if (ACPI_FAILURE(status)) { - goto exit; - } - } else { - /* - * The object either was anew created or is - * a Namespace node - don't decrement it. - */ - new_obj_desc = *operand; - } - - /* Cleanup for name-path operand */ - - status = acpi_ds_obj_stack_pop(1, walk_state); - if (ACPI_FAILURE(status)) { - walk_state->result_obj = new_obj_desc; - goto exit; - } - - push_result: - - walk_state->result_obj = new_obj_desc; - - status = acpi_ds_result_push(walk_state->result_obj, walk_state); - if (ACPI_SUCCESS(status)) { - - /* Force to take it from stack */ - - op->common.flags |= ACPI_PARSEOP_IN_STACK; - } - - exit: + (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); + ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", + (arg_count + 1))); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/dispatcher/dswexec.c b/trunk/drivers/acpi/dispatcher/dswexec.c index b246b9657ead..69693fa07224 100644 --- a/trunk/drivers/acpi/dispatcher/dswexec.c +++ b/trunk/drivers/acpi/dispatcher/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -285,6 +285,11 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, switch (opcode_class) { case AML_CLASS_CONTROL: + status = acpi_ds_result_stack_push(walk_state); + if (ACPI_FAILURE(status)) { + goto error_exit; + } + status = acpi_ds_exec_begin_control_op(walk_state, op); break; @@ -300,11 +305,20 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, status = acpi_ds_load2_begin_op(walk_state, NULL); } + if (op->common.aml_opcode == AML_REGION_OP) { + status = acpi_ds_result_stack_push(walk_state); + } break; case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: - + /* + * Most operators with arguments (except create_xxx_field operators) + * Start a new result/operand state + */ + if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) { + status = acpi_ds_result_stack_push(walk_state); + } break; default: @@ -360,7 +374,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) /* Init the walk state */ walk_state->num_operands = 0; - walk_state->operand_index = 0; walk_state->return_desc = NULL; walk_state->result_obj = NULL; @@ -375,17 +388,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) /* Decode the Opcode Class */ switch (op_class) { - case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ - - if (walk_state->opcode == AML_INT_NAMEPATH_OP) { - status = acpi_ds_evaluate_name_path(walk_state); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - } + case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ break; - case AML_CLASS_EXECUTE: /* Most operators with arguments */ + case AML_CLASS_EXECUTE: /* most operators with arguments */ /* Build resolved operand stack */ @@ -394,6 +400,13 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) goto cleanup; } + /* Done with this result state (Now that operand stack is built) */ + + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + /* * All opcodes require operand resolution, with the only exceptions * being the object_type and size_of operators. @@ -474,6 +487,16 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_exec_end_control_op(walk_state, op); + /* Make sure to properly pop the result stack */ + + if (ACPI_SUCCESS(status)) { + status = acpi_ds_result_stack_pop(walk_state); + } else if (status == AE_CTRL_PENDING) { + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_PENDING; + } + } break; case AML_TYPE_METHOD_CALL: @@ -493,7 +516,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) op->common.node = (struct acpi_namespace_node *)op->asl.value. - arg->asl.node; + arg->asl.node->object; acpi_ut_add_reference(op->asl.value.arg->asl. node->object); return_ACPI_STATUS(AE_OK); @@ -609,6 +632,13 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) break; } + /* Done with result state (Now that operand stack is built) */ + + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + /* * If a result object was returned from above, push it on the * current result stack @@ -641,28 +671,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status)) { break; } - } else if (op->common.aml_opcode == AML_DATA_REGION_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Executing DataTableRegion Strings Op=%p\n", - op)); - - status = - acpi_ds_eval_table_region_operands - (walk_state, op); - if (ACPI_FAILURE(status)) { - break; - } - } else if (op->common.aml_opcode == AML_BANK_FIELD_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Executing BankField Op=%p\n", - op)); - status = - acpi_ds_eval_bank_field_operands(walk_state, - op); - if (ACPI_FAILURE(status)) { - break; - } + status = acpi_ds_result_stack_pop(walk_state); } break; diff --git a/trunk/drivers/acpi/dispatcher/dswload.c b/trunk/drivers/acpi/dispatcher/dswload.c index dff7a3e445a8..8ab9d1b29a4c 100644 --- a/trunk/drivers/acpi/dispatcher/dswload.c +++ b/trunk/drivers/acpi/dispatcher/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -443,15 +443,6 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - } else if (op->common.aml_opcode == AML_DATA_REGION_OP) { - status = - acpi_ex_create_region(op->named.data, - op->named.length, - REGION_DATA_TABLE, - walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } } } #endif @@ -776,12 +767,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, acpi_ns_lookup(walk_state->scope_info, buffer_ptr, object_type, ACPI_IMODE_LOAD_PASS2, flags, walk_state, &node); - - if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) { - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, - "***New Node [%4.4s] %p is temporary\n", - acpi_ut_get_node_name(node), node)); - } break; } @@ -838,7 +823,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) struct acpi_namespace_node *new_node; #ifndef ACPI_NO_METHOD_EXECUTION u32 i; - u8 region_space; #endif ACPI_FUNCTION_TRACE(ds_load2_end_op); @@ -1019,6 +1003,11 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ex_create_event(walk_state); break; + case AML_DATA_REGION_OP: + + status = acpi_ex_create_table_region(walk_state); + break; + case AML_ALIAS_OP: status = acpi_ex_create_alias(walk_state); @@ -1046,15 +1035,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) switch (op->common.aml_opcode) { #ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: - case AML_DATA_REGION_OP: - - if (op->common.aml_opcode == AML_REGION_OP) { - region_space = (acpi_adr_space_type) - ((op->common.value.arg)->common.value. - integer); - } else { - region_space = REGION_DATA_TABLE; - } /* * If we are executing a method, initialize the region @@ -1063,7 +1043,10 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ex_create_region(op->named.data, op->named.length, - region_space, + (acpi_adr_space_type) + ((op->common.value. + arg)->common.value. + integer), walk_state); if (ACPI_FAILURE(status)) { return (status); diff --git a/trunk/drivers/acpi/dispatcher/dswscope.c b/trunk/drivers/acpi/dispatcher/dswscope.c index 9e6073265873..3927c495e4bf 100644 --- a/trunk/drivers/acpi/dispatcher/dswscope.c +++ b/trunk/drivers/acpi/dispatcher/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/dispatcher/dswstate.c b/trunk/drivers/acpi/dispatcher/dswstate.c index 1386ced332ec..5afcdd9c7449 100644 --- a/trunk/drivers/acpi/dispatcher/dswstate.c +++ b/trunk/drivers/acpi/dispatcher/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,80 +49,211 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dswstate") - /* Local prototypes */ -static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *ws); -static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *ws); +/* Local prototypes */ +#ifdef ACPI_OBSOLETE_FUNCTIONS +acpi_status +acpi_ds_result_insert(void *object, + u32 index, struct acpi_walk_state *walk_state); + +acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state); +acpi_status +acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); + +void *acpi_ds_obj_stack_get_value(u32 index, + struct acpi_walk_state *walk_state); +#endif + +#ifdef ACPI_FUTURE_USAGE /******************************************************************************* * - * FUNCTION: acpi_ds_result_pop + * FUNCTION: acpi_ds_result_remove * * PARAMETERS: Object - Where to return the popped object + * Index - Where to extract the object * walk_state - Current Walk state * * RETURN: Status * - * DESCRIPTION: Pop an object off the top of this walk's result stack + * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In + * other words, this is a FIFO. * ******************************************************************************/ acpi_status -acpi_ds_result_pop(union acpi_operand_object **object, - struct acpi_walk_state *walk_state) +acpi_ds_result_remove(union acpi_operand_object **object, + u32 index, struct acpi_walk_state *walk_state) { - acpi_native_uint index; union acpi_generic_state *state; - acpi_status status; - ACPI_FUNCTION_NAME(ds_result_pop); + ACPI_FUNCTION_NAME(ds_result_remove); state = walk_state->results; + if (!state) { + ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", + walk_state)); + return (AE_NOT_EXIST); + } - /* Incorrect state of result stack */ - - if (state && !walk_state->result_count) { - ACPI_ERROR((AE_INFO, "No results on result stack")); - return (AE_AML_INTERNAL); + if (index >= ACPI_OBJ_MAX_OPERAND) { + ACPI_ERROR((AE_INFO, + "Index out of range: %X State=%p Num=%X", + index, walk_state, state->results.num_results)); } - if (!state && walk_state->result_count) { - ACPI_ERROR((AE_INFO, "No result state for result stack")); - return (AE_AML_INTERNAL); + /* Check for a valid result object */ + + if (!state->results.obj_desc[index]) { + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X, Index=%X", + walk_state, state->results.num_results, index)); + return (AE_AML_NO_RETURN_VALUE); } - /* Empty result stack */ + /* Remove the object */ + + state->results.num_results--; + + *object = state->results.obj_desc[index]; + state->results.obj_desc[index] = NULL; + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", + *object, + (*object) ? acpi_ut_get_object_type_name(*object) : + "NULL", index, walk_state, + state->results.num_results)); + + return (AE_OK); +} +#endif /* ACPI_FUTURE_USAGE */ + +/******************************************************************************* + * + * FUNCTION: acpi_ds_result_pop + * + * PARAMETERS: Object - Where to return the popped object + * walk_state - Current Walk state + * + * RETURN: Status + * + * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In + * other words, this is a FIFO. + * + ******************************************************************************/ + +acpi_status +acpi_ds_result_pop(union acpi_operand_object ** object, + struct acpi_walk_state * walk_state) +{ + acpi_native_uint index; + union acpi_generic_state *state; + + ACPI_FUNCTION_NAME(ds_result_pop); + state = walk_state->results; if (!state) { + return (AE_OK); + } + + if (!state->results.num_results) { ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p", walk_state)); return (AE_AML_NO_RETURN_VALUE); } - /* Return object of the top element and clean that top element result stack */ + /* Remove top element */ - walk_state->result_count--; - index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; + state->results.num_results--; - *object = state->results.obj_desc[index]; - if (!*object) { + for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { + + /* Check for a valid result object */ + + if (state->results.obj_desc[index - 1]) { + *object = state->results.obj_desc[index - 1]; + state->results.obj_desc[index - 1] = NULL; + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", + *object, + (*object) ? + acpi_ut_get_object_type_name(*object) + : "NULL", (u32) index - 1, walk_state, + state->results.num_results)); + + return (AE_OK); + } + } + + ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state)); + return (AE_AML_NO_RETURN_VALUE); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ds_result_pop_from_bottom + * + * PARAMETERS: Object - Where to return the popped object + * walk_state - Current Walk state + * + * RETURN: Status + * + * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In + * other words, this is a FIFO. + * + ******************************************************************************/ + +acpi_status +acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, + struct acpi_walk_state * walk_state) +{ + acpi_native_uint index; + union acpi_generic_state *state; + + ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); + + state = walk_state->results; + if (!state) { ACPI_ERROR((AE_INFO, - "No result objects on result stack, State=%p", + "No result object pushed! State=%p", walk_state)); + return (AE_NOT_EXIST); + } + + if (!state->results.num_results) { + ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state)); return (AE_AML_NO_RETURN_VALUE); } - state->results.obj_desc[index] = NULL; - if (index == 0) { - status = acpi_ds_result_stack_pop(walk_state); - if (ACPI_FAILURE(status)) { - return (status); - } + /* Remove Bottom element */ + + *object = state->results.obj_desc[0]; + + /* Push entire stack down one element */ + + for (index = 0; index < state->results.num_results; index++) { + state->results.obj_desc[index] = + state->results.obj_desc[index + 1]; } - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", *object, - acpi_ut_get_object_type_name(*object), - (u32) index, walk_state, walk_state->result_count)); + state->results.num_results--; + + /* Check for a valid result object */ + + if (!*object) { + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X Index=%X", + walk_state, state->results.num_results, + (u32) index)); + return (AE_AML_NO_RETURN_VALUE); + } + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", + *object, + (*object) ? acpi_ut_get_object_type_name(*object) : + "NULL", state, walk_state)); return (AE_OK); } @@ -145,56 +276,39 @@ acpi_ds_result_push(union acpi_operand_object * object, struct acpi_walk_state * walk_state) { union acpi_generic_state *state; - acpi_status status; - acpi_native_uint index; ACPI_FUNCTION_NAME(ds_result_push); - if (walk_state->result_count > walk_state->result_size) { - ACPI_ERROR((AE_INFO, "Result stack is full")); - return (AE_AML_INTERNAL); - } else if (walk_state->result_count == walk_state->result_size) { - - /* Extend the result stack */ - - status = acpi_ds_result_stack_push(walk_state); - if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, - "Failed to extend the result stack")); - return (status); - } - } - - if (!(walk_state->result_count < walk_state->result_size)) { - ACPI_ERROR((AE_INFO, "No free elements in result stack")); - return (AE_AML_INTERNAL); - } - state = walk_state->results; if (!state) { ACPI_ERROR((AE_INFO, "No result stack frame during push")); return (AE_AML_INTERNAL); } + if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { + ACPI_ERROR((AE_INFO, + "Result stack overflow: Obj=%p State=%p Num=%X", + object, walk_state, state->results.num_results)); + return (AE_STACK_OVERFLOW); + } + if (!object) { ACPI_ERROR((AE_INFO, "Null Object! Obj=%p State=%p Num=%X", - object, walk_state, walk_state->result_count)); + object, walk_state, state->results.num_results)); return (AE_BAD_PARAMETER); } - /* Assign the address of object to the top free element of result stack */ - - index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; - state->results.obj_desc[index] = object; - walk_state->result_count++; + state->results.obj_desc[state->results.num_results] = object; + state->results.num_results++; ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", object, + object ? acpi_ut_get_object_type_name((union acpi_operand_object *) - object), walk_state, - walk_state->result_count, + object) : "NULL", + walk_state, state->results.num_results, walk_state->current_result)); return (AE_OK); @@ -208,25 +322,16 @@ acpi_ds_result_push(union acpi_operand_object * object, * * RETURN: Status * - * DESCRIPTION: Push an object onto the walk_state result stack + * DESCRIPTION: Push an object onto the walk_state result stack. * ******************************************************************************/ -static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state) +acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) { union acpi_generic_state *state; ACPI_FUNCTION_NAME(ds_result_stack_push); - /* Check for stack overflow */ - - if (((u32) walk_state->result_size + ACPI_RESULTS_FRAME_OBJ_NUM) > - ACPI_RESULTS_OBJ_NUM_MAX) { - ACPI_ERROR((AE_INFO, "Result stack overflow: State=%p Num=%X", - walk_state, walk_state->result_size)); - return (AE_STACK_OVERFLOW); - } - state = acpi_ut_create_generic_state(); if (!state) { return (AE_NO_MEMORY); @@ -235,10 +340,6 @@ static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state) state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; acpi_ut_push_generic_state(&walk_state->results, state); - /* Increase the length of the result stack by the length of frame */ - - walk_state->result_size += ACPI_RESULTS_FRAME_OBJ_NUM; - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", state, walk_state)); @@ -253,11 +354,11 @@ static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state) * * RETURN: Status * - * DESCRIPTION: Pop an object off of the walk_state result stack + * DESCRIPTION: Pop an object off of the walk_state result stack. * ******************************************************************************/ -static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state) +acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) { union acpi_generic_state *state; @@ -266,27 +367,18 @@ static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state) /* Check for stack underflow */ if (walk_state->results == NULL) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Result stack underflow - State=%p\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Underflow - State=%p\n", walk_state)); return (AE_AML_NO_OPERAND); } - if (walk_state->result_size < ACPI_RESULTS_FRAME_OBJ_NUM) { - ACPI_ERROR((AE_INFO, "Insufficient result stack size")); - return (AE_AML_INTERNAL); - } - state = acpi_ut_pop_generic_state(&walk_state->results); - acpi_ut_delete_generic_state(state); - - /* Decrease the length of result stack by the length of frame */ - - walk_state->result_size -= ACPI_RESULTS_FRAME_OBJ_NUM; ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Result=%p RemainingResults=%X State=%p\n", - state, walk_state->result_count, walk_state)); + state, state->results.num_results, walk_state)); + + acpi_ut_delete_generic_state(state); return (AE_OK); } @@ -320,13 +412,9 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) /* Put the object onto the stack */ - walk_state->operands[walk_state->operand_index] = object; + walk_state->operands[walk_state->num_operands] = object; walk_state->num_operands++; - /* For the usual order of filling the operand stack */ - - walk_state->operand_index++; - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", object, acpi_ut_get_object_type_name((union @@ -396,36 +484,43 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) * ******************************************************************************/ -void +acpi_status acpi_ds_obj_stack_pop_and_delete(u32 pop_count, - struct acpi_walk_state *walk_state) + struct acpi_walk_state * walk_state) { - acpi_native_int i; + u32 i; union acpi_operand_object *obj_desc; ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); - if (pop_count == 0) { - return; - } + for (i = 0; i < pop_count; i++) { + + /* Check for stack underflow */ - for (i = (acpi_native_int) (pop_count - 1); i >= 0; i--) { if (walk_state->num_operands == 0) { - return; + ACPI_ERROR((AE_INFO, + "Object stack underflow! Count=%X State=%p #Ops=%X", + pop_count, walk_state, + walk_state->num_operands)); + return (AE_STACK_UNDERFLOW); } /* Pop the stack and delete an object if present in this stack entry */ walk_state->num_operands--; - obj_desc = walk_state->operands[i]; + obj_desc = walk_state->operands[walk_state->num_operands]; if (obj_desc) { - acpi_ut_remove_reference(walk_state->operands[i]); - walk_state->operands[i] = NULL; + acpi_ut_remove_reference(walk_state-> + operands[walk_state-> + num_operands]); + walk_state->operands[walk_state->num_operands] = NULL; } } ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", pop_count, walk_state, walk_state->num_operands)); + + return (AE_OK); } /******************************************************************************* @@ -465,7 +560,7 @@ struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state * * RETURN: None * - * DESCRIPTION: Place the Thread state at the head of the state list + * DESCRIPTION: Place the Thread state at the head of the state list. * ******************************************************************************/ @@ -541,6 +636,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union *thread) { struct acpi_walk_state *walk_state; + acpi_status status; ACPI_FUNCTION_TRACE(ds_create_walk_state); @@ -563,6 +659,14 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_ds_method_data_init(walk_state); #endif + /* Create an initial result stack entry */ + + status = acpi_ds_result_stack_push(walk_state); + if (ACPI_FAILURE(status)) { + ACPI_FREE(walk_state); + return_PTR(NULL); + } + /* Put the new state at the head of the walk list */ if (thread) { @@ -756,3 +860,190 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) ACPI_FREE(walk_state); return_VOID; } + +#ifdef ACPI_OBSOLETE_FUNCTIONS +/******************************************************************************* + * + * FUNCTION: acpi_ds_result_insert + * + * PARAMETERS: Object - Object to push + * Index - Where to insert the object + * walk_state - Current Walk state + * + * RETURN: Status + * + * DESCRIPTION: Insert an object onto this walk's result stack + * + ******************************************************************************/ + +acpi_status +acpi_ds_result_insert(void *object, + u32 index, struct acpi_walk_state *walk_state) +{ + union acpi_generic_state *state; + + ACPI_FUNCTION_NAME(ds_result_insert); + + state = walk_state->results; + if (!state) { + ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", + walk_state)); + return (AE_NOT_EXIST); + } + + if (index >= ACPI_OBJ_NUM_OPERANDS) { + ACPI_ERROR((AE_INFO, + "Index out of range: %X Obj=%p State=%p Num=%X", + index, object, walk_state, + state->results.num_results)); + return (AE_BAD_PARAMETER); + } + + if (!object) { + ACPI_ERROR((AE_INFO, + "Null Object! Index=%X Obj=%p State=%p Num=%X", + index, object, walk_state, + state->results.num_results)); + return (AE_BAD_PARAMETER); + } + + state->results.obj_desc[index] = object; + state->results.num_results++; + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Obj=%p [%s] State=%p Num=%X Cur=%X\n", + object, + object ? + acpi_ut_get_object_type_name((union + acpi_operand_object *) + object) : "NULL", + walk_state, state->results.num_results, + walk_state->current_result)); + + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ds_obj_stack_delete_all + * + * PARAMETERS: walk_state - Current Walk state + * + * RETURN: Status + * + * DESCRIPTION: Clear the object stack by deleting all objects that are on it. + * Should be used with great care, if at all! + * + ******************************************************************************/ + +acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) +{ + u32 i; + + ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); + + /* The stack size is configurable, but fixed */ + + for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { + if (walk_state->operands[i]) { + acpi_ut_remove_reference(walk_state->operands[i]); + walk_state->operands[i] = NULL; + } + } + + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ds_obj_stack_pop_object + * + * PARAMETERS: Object - Where to return the popped object + * walk_state - Current Walk state + * + * RETURN: Status + * + * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT + * deleted by this routine. + * + ******************************************************************************/ + +acpi_status +acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, + struct acpi_walk_state *walk_state) +{ + ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); + + /* Check for stack underflow */ + + if (walk_state->num_operands == 0) { + ACPI_ERROR((AE_INFO, + "Missing operand/stack empty! State=%p #Ops=%X", + walk_state, walk_state->num_operands)); + *object = NULL; + return (AE_AML_NO_OPERAND); + } + + /* Pop the stack */ + + walk_state->num_operands--; + + /* Check for a valid operand */ + + if (!walk_state->operands[walk_state->num_operands]) { + ACPI_ERROR((AE_INFO, + "Null operand! State=%p #Ops=%X", + walk_state, walk_state->num_operands)); + *object = NULL; + return (AE_AML_NO_OPERAND); + } + + /* Get operand and set stack entry to null */ + + *object = walk_state->operands[walk_state->num_operands]; + walk_state->operands[walk_state->num_operands] = NULL; + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", + *object, acpi_ut_get_object_type_name(*object), + walk_state, walk_state->num_operands)); + + return (AE_OK); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ds_obj_stack_get_value + * + * PARAMETERS: Index - Stack index whose value is desired. Based + * on the top of the stack (index=0 == top) + * walk_state - Current Walk state + * + * RETURN: Pointer to the requested operand + * + * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must + * be within the range of the current stack pointer. + * + ******************************************************************************/ + +void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) +{ + + ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); + + /* Can't do it if the stack is empty */ + + if (walk_state->num_operands == 0) { + return_PTR(NULL); + } + + /* or if the index is past the top of the stack */ + + if (index > (walk_state->num_operands - (u32) 1)) { + return_PTR(NULL); + } + + return_PTR(walk_state-> + operands[(acpi_native_uint) (walk_state->num_operands - 1) - + index]); +} +#endif diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index 3d9362140831..7222a18a0319 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -73,14 +73,38 @@ enum ec_event { #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ -#define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ enum { EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ EC_FLAGS_QUERY_PENDING, /* Query is pending */ EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ - EC_FLAGS_NO_GPE, /* Don't use GPE mode */ - EC_FLAGS_RESCHEDULE_POLL /* Re-schedule poll */ + EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ + EC_FLAGS_ADDRESS, /* Address is being written */ + EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */ + EC_FLAGS_WDATA, /* Data is being written */ + EC_FLAGS_NO_OBF1_GPE, /* Don't expect GPE before read */ +}; + +static int acpi_ec_remove(struct acpi_device *device, int type); +static int acpi_ec_start(struct acpi_device *device); +static int acpi_ec_stop(struct acpi_device *device, int type); +static int acpi_ec_add(struct acpi_device *device); + +static const struct acpi_device_id ec_device_ids[] = { + {"PNP0C09", 0}, + {"", 0}, +}; + +static struct acpi_driver acpi_ec_driver = { + .name = "ec", + .class = ACPI_EC_CLASS, + .ids = ec_device_ids, + .ops = { + .add = acpi_ec_add, + .remove = acpi_ec_remove, + .start = acpi_ec_start, + .stop = acpi_ec_stop, + }, }; /* If we find an EC via the ECDT, we need to keep a ptr to its context */ @@ -105,8 +129,6 @@ static struct acpi_ec { struct mutex lock; wait_queue_head_t wait; struct list_head list; - struct delayed_work work; - atomic_t irq_count; u8 handlers_installed; } *boot_ec, *first_ec; @@ -155,52 +177,65 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) return 0; } -static void ec_schedule_ec_poll(struct acpi_ec *ec) -{ - if (test_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags)) - schedule_delayed_work(&ec->work, - msecs_to_jiffies(ACPI_EC_DELAY)); -} - -static void ec_switch_to_poll_mode(struct acpi_ec *ec) -{ - set_bit(EC_FLAGS_NO_GPE, &ec->flags); - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); - acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); - set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); -} - static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) { - atomic_set(&ec->irq_count, 0); + int ret = 0; + + if (unlikely(event == ACPI_EC_EVENT_OBF_1 && + test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) + force_poll = 1; + if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && + test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) + force_poll = 1; + if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) && + test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags))) + force_poll = 1; if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && likely(!force_poll)) { if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), msecs_to_jiffies(ACPI_EC_DELAY))) - return 0; + goto end; clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); if (acpi_ec_check_status(ec, event)) { - /* missing GPEs, switch back to poll mode */ - if (printk_ratelimit()) - pr_info(PREFIX "missing confirmations, " + if (event == ACPI_EC_EVENT_OBF_1) { + /* miss OBF_1 GPE, don't expect it */ + pr_info(PREFIX "missing OBF confirmation, " + "don't expect it any longer.\n"); + set_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags); + } else if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { + /* miss address GPE, don't expect it anymore */ + pr_info(PREFIX "missing address confirmation, " + "don't expect it any longer.\n"); + set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); + } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) { + /* miss write data GPE, don't expect it */ + pr_info(PREFIX "missing write data confirmation, " + "don't expect it any longer.\n"); + set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags); + } else { + /* missing GPEs, switch back to poll mode */ + if (printk_ratelimit()) + pr_info(PREFIX "missing confirmations, " "switch off interrupt mode.\n"); - ec_switch_to_poll_mode(ec); - ec_schedule_ec_poll(ec); - return 0; + clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); + } + goto end; } } else { unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); while (time_before(jiffies, delay)) { if (acpi_ec_check_status(ec, event)) - return 0; - udelay(ACPI_EC_UDELAY); + goto end; } } - pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", - acpi_ec_read_status(ec), - (event == ACPI_EC_EVENT_OBF_1) ? "\"b0=1\"" : "\"b1=0\""); - return -ETIME; + pr_err(PREFIX "acpi_ec_wait timeout," + " status = %d, expect_event = %d\n", + acpi_ec_read_status(ec), event); + ret = -ETIME; + end: + clear_bit(EC_FLAGS_ADDRESS, &ec->flags); + return ret; } static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, @@ -210,8 +245,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, { int result = 0; set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); - pr_debug(PREFIX "transaction start\n"); acpi_ec_write_cmd(ec, command); + pr_debug(PREFIX "transaction start\n"); for (; wdata_len > 0; --wdata_len) { result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); if (result) { @@ -219,11 +254,15 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, "write_cmd timeout, command = %d\n", command); goto end; } + /* mark the address byte written to EC */ + if (rdata_len + wdata_len > 1) + set_bit(EC_FLAGS_ADDRESS, &ec->flags); set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); acpi_ec_write_data(ec, *(wdata++)); } if (!rdata_len) { + set_bit(EC_FLAGS_WDATA, &ec->flags); result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); if (result) { pr_err(PREFIX @@ -488,50 +527,46 @@ static u32 acpi_ec_gpe_handler(void *data) { acpi_status status = AE_OK; struct acpi_ec *ec = data; - u8 state = acpi_ec_read_status(ec); pr_debug(PREFIX "~~~> interrupt\n"); - atomic_inc(&ec->irq_count); - if (atomic_read(&ec->irq_count) > 5) { - pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); - ec_switch_to_poll_mode(ec); - goto end; - } clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) wake_up(&ec->wait); - if (state & ACPI_EC_FLAG_SCI) { + if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); - } else if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && - !test_bit(EC_FLAGS_NO_GPE, &ec->flags) && - in_interrupt()) { + } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { /* this is non-query, must be confirmation */ if (printk_ratelimit()) pr_info(PREFIX "non-query interrupt received," " switching to interrupt mode\n"); set_bit(EC_FLAGS_GPE_MODE, &ec->flags); - clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); } -end: - ec_schedule_ec_poll(ec); + return ACPI_SUCCESS(status) ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } -static void do_ec_poll(struct work_struct *work) -{ - struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work); - atomic_set(&ec->irq_count, 0); - (void)acpi_ec_gpe_handler(ec); -} - /* -------------------------------------------------------------------------- Address Space Management -------------------------------------------------------------------------- */ +static acpi_status +acpi_ec_space_setup(acpi_handle region_handle, + u32 function, void *handler_context, void **return_context) +{ + /* + * The EC object is in the handler context and is needed + * when calling the acpi_ec_space_handler. + */ + *return_context = (function != ACPI_REGION_DEACTIVATE) ? + handler_context : NULL; + + return AE_OK; +} + static acpi_status acpi_ec_space_handler(u32 function, acpi_physical_address address, u32 bits, acpi_integer *value, @@ -674,8 +709,6 @@ static struct acpi_ec *make_acpi_ec(void) mutex_init(&ec->lock); init_waitqueue_head(&ec->wait); INIT_LIST_HEAD(&ec->list); - INIT_DELAYED_WORK_DEFERRABLE(&ec->work, do_ec_poll); - atomic_set(&ec->irq_count, 0); return ec; } @@ -708,21 +741,17 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); if (ACPI_FAILURE(status)) return status; + /* Find and register all query methods */ + acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, + acpi_ec_register_query_methods, ec, NULL); /* Use the global lock for all EC transactions? */ acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); ec->handle = handle; return AE_CTRL_TERMINATE; } -static void ec_poll_stop(struct acpi_ec *ec) -{ - clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); - cancel_delayed_work(&ec->work); -} - static void ec_remove_handlers(struct acpi_ec *ec) { - ec_poll_stop(ec); if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) pr_err(PREFIX "failed to remove space handler\n"); @@ -742,28 +771,31 @@ static int acpi_ec_add(struct acpi_device *device) strcpy(acpi_device_class(device), ACPI_EC_CLASS); /* Check for boot EC */ - if (boot_ec && - (boot_ec->handle == device->handle || - boot_ec->handle == ACPI_ROOT_OBJECT)) { - ec = boot_ec; - boot_ec = NULL; - } else { - ec = make_acpi_ec(); - if (!ec) - return -ENOMEM; - if (ec_parse_device(device->handle, 0, ec, NULL) != - AE_CTRL_TERMINATE) { - kfree(ec); - return -EINVAL; + if (boot_ec) { + if (boot_ec->handle == device->handle) { + /* Pre-loaded EC from DSDT, just move pointer */ + ec = boot_ec; + boot_ec = NULL; + goto end; + } else if (boot_ec->handle == ACPI_ROOT_OBJECT) { + /* ECDT-based EC, time to shut it down */ + ec_remove_handlers(boot_ec); + kfree(boot_ec); + first_ec = boot_ec = NULL; } } - ec->handle = device->handle; - - /* Find and register all query methods */ - acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, - acpi_ec_register_query_methods, ec, NULL); + ec = make_acpi_ec(); + if (!ec) + return -ENOMEM; + if (ec_parse_device(device->handle, 0, ec, NULL) != + AE_CTRL_TERMINATE) { + kfree(ec); + return -EINVAL; + } + ec->handle = device->handle; + end: if (!first_ec) first_ec = ec; acpi_driver_data(device) = ec; @@ -838,7 +870,7 @@ static int ec_install_handlers(struct acpi_ec *ec) status = acpi_install_address_space_handler(ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, - NULL, ec); + &acpi_ec_space_setup, ec); if (ACPI_FAILURE(status)) { acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); return -ENODEV; @@ -865,7 +897,6 @@ static int acpi_ec_start(struct acpi_device *device) /* EC is fully operational, allow queries */ clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); - ec_schedule_ec_poll(ec); return ret; } @@ -893,11 +924,6 @@ int __init acpi_boot_ec_enable(void) return -EFAULT; } -static const struct acpi_device_id ec_device_ids[] = { - {"PNP0C09", 0}, - {"", 0}, -}; - int __init acpi_ec_ecdt_probe(void) { int ret; @@ -918,7 +944,6 @@ int __init acpi_ec_ecdt_probe(void) boot_ec->data_addr = ecdt_ptr->data.address; boot_ec->gpe = ecdt_ptr->gpe; boot_ec->handle = ACPI_ROOT_OBJECT; - acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); } else { /* This workaround is needed only on some broken machines, * which require early EC, but fail to provide ECDT */ @@ -948,39 +973,6 @@ int __init acpi_ec_ecdt_probe(void) return -ENODEV; } -static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) -{ - struct acpi_ec *ec = acpi_driver_data(device); - /* Stop using GPE */ - set_bit(EC_FLAGS_NO_GPE, &ec->flags); - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); - acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); - return 0; -} - -static int acpi_ec_resume(struct acpi_device *device) -{ - struct acpi_ec *ec = acpi_driver_data(device); - /* Enable use of GPE back */ - clear_bit(EC_FLAGS_NO_GPE, &ec->flags); - acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); - return 0; -} - -static struct acpi_driver acpi_ec_driver = { - .name = "ec", - .class = ACPI_EC_CLASS, - .ids = ec_device_ids, - .ops = { - .add = acpi_ec_add, - .remove = acpi_ec_remove, - .start = acpi_ec_start, - .stop = acpi_ec_stop, - .suspend = acpi_ec_suspend, - .resume = acpi_ec_resume, - }, -}; - static int __init acpi_ec_init(void) { int result = 0; diff --git a/trunk/drivers/acpi/events/evevent.c b/trunk/drivers/acpi/events/evevent.c index 5d30e5be1b1c..3048801a37b5 100644 --- a/trunk/drivers/acpi/events/evevent.c +++ b/trunk/drivers/acpi/events/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evgpe.c b/trunk/drivers/acpi/events/evgpe.c index 5354be44f876..0dadd2adc800 100644 --- a/trunk/drivers/acpi/events/evgpe.c +++ b/trunk/drivers/acpi/events/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -248,6 +248,10 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) ACPI_FUNCTION_TRACE(ev_disable_gpe); + if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { + return_ACPI_STATUS(AE_OK); + } + /* Make sure HW enable masks are updated */ status = diff --git a/trunk/drivers/acpi/events/evgpeblk.c b/trunk/drivers/acpi/events/evgpeblk.c index e6c4d4c49e79..361ebe6c4a6f 100644 --- a/trunk/drivers/acpi/events/evgpeblk.c +++ b/trunk/drivers/acpi/events/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evmisc.c b/trunk/drivers/acpi/events/evmisc.c index 2113e58e2221..21cb749d0c75 100644 --- a/trunk/drivers/acpi/events/evmisc.c +++ b/trunk/drivers/acpi/events/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,22 @@ #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME("evmisc") +/* Names for Notify() values, used for debug output */ +#ifdef ACPI_DEBUG_OUTPUT +static const char *acpi_notify_value_names[] = { + "Bus Check", + "Device Check", + "Device Wake", + "Eject Request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault" +}; +#endif + /* Pointer to FACS needed for the Global Lock */ + static struct acpi_table_facs *facs = NULL; /* Local prototypes */ @@ -79,6 +94,7 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_POWER: case ACPI_TYPE_THERMAL: /* * These are the ONLY objects that can receive ACPI notifications @@ -123,9 +139,17 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", - acpi_ut_get_node_name(node), node, notify_value, - acpi_ut_get_notify_name(notify_value))); + "Dispatching Notify(%X) on node %p\n", notify_value, + node)); + + if (notify_value <= 7) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n", + acpi_notify_value_names[notify_value])); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Notify value: 0x%2.2X **Device Specific**\n", + notify_value)); + } /* Get the notify object attached to the NS Node */ @@ -135,12 +159,10 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, /* We have the notify object, Get the right handler */ switch (node->type) { - - /* Notify allowed only on these types */ - case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_POWER: if (notify_value <= ACPI_MAX_SYS_NOTIFY) { handler_obj = @@ -157,13 +179,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, } } - /* - * If there is any handler to run, schedule the dispatcher. - * Check for: - * 1) Global system notify handler - * 2) Global device notify handler - * 3) Per-device notify handler - */ + /* If there is any handler to run, schedule the dispatcher */ + if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || (acpi_gbl_device_notify.handler @@ -173,13 +190,6 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, return (AE_NO_MEMORY); } - if (!handler_obj) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Executing system notify handler for Notify (%4.4s, %X) node %p\n", - acpi_ut_get_node_name(node), - notify_value, node)); - } - notify_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_NOTIFY; notify_info->notify.node = node; @@ -192,12 +202,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, if (ACPI_FAILURE(status)) { acpi_ut_delete_generic_state(notify_info); } - } else { + } + + if (!handler_obj) { /* - * There is no notify handler (per-device or system) for this device. + * There is no per-device notify handler for this device. + * This may or may not be a problem. */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "No notify handler for Notify (%4.4s, %X) node %p\n", + "No notify handler for Notify(%4.4s, %X) node %p\n", acpi_ut_get_node_name(node), notify_value, node)); } @@ -336,10 +349,9 @@ acpi_status acpi_ev_init_global_lock_handler(void) ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); - status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &facs)); + status = + acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + (struct acpi_table_header **)&facs); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -427,8 +439,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) * Only one thread can acquire the GL at a time, the global_lock_mutex * enforces this. This interface releases the interpreter if we must wait. */ - status = acpi_ex_system_wait_mutex( - acpi_gbl_global_lock_mutex->mutex.os_mutex, 0); + status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); if (status == AE_TIME) { if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { acpi_ev_global_lock_acquired++; @@ -437,9 +448,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) } if (ACPI_FAILURE(status)) { - status = acpi_ex_system_wait_mutex( - acpi_gbl_global_lock_mutex->mutex.os_mutex, - timeout); + status = + acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, + timeout); } if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -448,19 +459,6 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) acpi_ev_global_lock_thread_id = acpi_os_get_thread_id(); acpi_ev_global_lock_acquired++; - /* - * Update the global lock handle and check for wraparound. The handle is - * only used for the external global lock interfaces, but it is updated - * here to properly handle the case where a single thread may acquire the - * lock via both the AML and the acpi_acquire_global_lock interfaces. The - * handle is therefore updated on the first acquire from a given thread - * regardless of where the acquisition request originated. - */ - acpi_gbl_global_lock_handle++; - if (acpi_gbl_global_lock_handle == 0) { - acpi_gbl_global_lock_handle = 1; - } - /* * Make sure that a global lock actually exists. If not, just treat * the lock as a standard mutex. @@ -557,7 +555,7 @@ acpi_status acpi_ev_release_global_lock(void) /* Release the local GL mutex */ acpi_ev_global_lock_thread_id = NULL; acpi_ev_global_lock_acquired = 0; - acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); + acpi_os_release_mutex(acpi_gbl_global_lock_mutex); return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/events/evregion.c b/trunk/drivers/acpi/events/evregion.c index 1628f5934752..58ad09725dd2 100644 --- a/trunk/drivers/acpi/events/evregion.c +++ b/trunk/drivers/acpi/events/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -394,7 +394,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", ®ion_obj->region.handler->address_space, handler, - ACPI_FORMAT_NATIVE_UINT(address), + ACPI_FORMAT_UINT64(address), acpi_ut_get_region_name(region_obj->region. space_id))); diff --git a/trunk/drivers/acpi/events/evrgnini.c b/trunk/drivers/acpi/events/evrgnini.c index 2e3d2c5e4f4d..b1aaa0e84588 100644 --- a/trunk/drivers/acpi/events/evrgnini.c +++ b/trunk/drivers/acpi/events/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evsci.c b/trunk/drivers/acpi/events/evsci.c index 2a8b77877610..7e5d15ce2395 100644 --- a/trunk/drivers/acpi/events/evsci.c +++ b/trunk/drivers/acpi/events/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evxface.c b/trunk/drivers/acpi/events/evxface.c index 94a6efe020be..6d866a01f5f4 100644 --- a/trunk/drivers/acpi/events/evxface.c +++ b/trunk/drivers/acpi/events/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -758,12 +758,6 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) * * DESCRIPTION: Acquire the ACPI Global Lock * - * Note: Allows callers with the same thread ID to acquire the global lock - * multiple times. In other words, externally, the behavior of the global lock - * is identical to an AML mutex. On the first acquire, a new handle is - * returned. On any subsequent calls to acquire by the same thread, the same - * handle is returned. - * ******************************************************************************/ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) { @@ -776,19 +770,14 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) /* Must lock interpreter to prevent race conditions */ acpi_ex_enter_interpreter(); - - status = acpi_ex_acquire_mutex_object(timeout, - acpi_gbl_global_lock_mutex, - acpi_os_get_thread_id()); + status = acpi_ev_acquire_global_lock(timeout); + acpi_ex_exit_interpreter(); if (ACPI_SUCCESS(status)) { - - /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */ - + acpi_gbl_global_lock_handle++; *handle = acpi_gbl_global_lock_handle; } - acpi_ex_exit_interpreter(); return (status); } @@ -809,11 +798,11 @@ acpi_status acpi_release_global_lock(u32 handle) { acpi_status status; - if (!handle || (handle != acpi_gbl_global_lock_handle)) { + if (handle != acpi_gbl_global_lock_handle) { return (AE_NOT_ACQUIRED); } - status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); + status = acpi_ev_release_global_lock(); return (status); } diff --git a/trunk/drivers/acpi/events/evxfevnt.c b/trunk/drivers/acpi/events/evxfevnt.c index 99a7502e6a87..9cbd3414a574 100644 --- a/trunk/drivers/acpi/events/evxfevnt.c +++ b/trunk/drivers/acpi/events/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/events/evxfregn.c b/trunk/drivers/acpi/events/evxfregn.c index e8750807e57d..7bf09c5fb242 100644 --- a/trunk/drivers/acpi/events/evxfregn.c +++ b/trunk/drivers/acpi/events/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exconfig.c b/trunk/drivers/acpi/executer/exconfig.c index 24da921d13e3..25802f302ffe 100644 --- a/trunk/drivers/acpi/executer/exconfig.c +++ b/trunk/drivers/acpi/executer/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -137,14 +138,6 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE(ex_load_table_op); - /* Validate lengths for the signature_string, OEMIDString, OEMtable_iD */ - - if ((operand[0]->string.length > ACPI_NAME_SIZE) || - (operand[1]->string.length > ACPI_OEM_ID_SIZE) || - (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - /* Find the ACPI table in the RSDT/XSDT */ status = acpi_tb_find_table(operand[0]->string.pointer, @@ -236,18 +229,11 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, status = acpi_get_table_by_index(table_index, &table); if (ACPI_SUCCESS(status)) { ACPI_INFO((AE_INFO, - "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", + "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", table->signature, table->oem_id, table->oem_table_id)); } - /* Invoke table handler if present */ - - if (acpi_gbl_table_handler) { - (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table, - acpi_gbl_table_handler_context); - } - *return_desc = ddb_handle; return_ACPI_STATUS(status); } @@ -282,7 +268,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, struct acpi_table_desc table_desc; acpi_native_uint table_index; acpi_status status; - u32 length; ACPI_FUNCTION_TRACE(ex_load_op); @@ -293,16 +278,16 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", - obj_desc, - acpi_ut_get_object_type_name(obj_desc))); - /* Region must be system_memory (from ACPI spec) */ if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", + obj_desc, + acpi_ut_get_object_type_name(obj_desc))); + /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. @@ -314,11 +299,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, } } - /* - * We will simply map the memory region for the table. However, the - * memory region is technically not guaranteed to remain stable and - * we may eventually have to copy the table to a local buffer. - */ table_desc.address = obj_desc->region.address; table_desc.length = obj_desc->region.length; table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; @@ -326,41 +306,18 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ + /* Simply extract the buffer from the buffer object */ + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n", obj_desc, acpi_ut_get_object_type_name(obj_desc))); - length = obj_desc->buffer.length; - - /* Must have at least an ACPI table header */ - - if (length < sizeof(struct acpi_table_header)) { - return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); - } - - /* Validate checksum here. It won't get validated in tb_add_table */ - - status = - acpi_tb_verify_checksum(ACPI_CAST_PTR - (struct acpi_table_header, - obj_desc->buffer.pointer), length); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* - * We need to copy the buffer since the original buffer could be - * changed or deleted in the future - */ - table_desc.pointer = ACPI_ALLOCATE(length); - if (!table_desc.pointer) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, - length); - table_desc.length = length; + table_desc.pointer = ACPI_CAST_PTR(struct acpi_table_header, + obj_desc->buffer.pointer); + table_desc.length = table_desc.pointer->length; table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; + + obj_desc->buffer.pointer = NULL; break; default: @@ -376,8 +333,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, } status = - acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, - &ddb_handle); + acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle); if (ACPI_FAILURE(status)) { /* On error, table_ptr was deallocated above */ @@ -393,23 +349,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, /* table_ptr was deallocated above */ - acpi_ut_remove_reference(ddb_handle); return_ACPI_STATUS(status); } - /* Invoke table handler if present */ - - if (acpi_gbl_table_handler) { - (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, - table_desc.pointer, - acpi_gbl_table_handler_context); - } - cleanup: if (ACPI_FAILURE(status)) { - - /* Delete allocated buffer or mapping */ - acpi_tb_delete_table(&table_desc); } return_ACPI_STATUS(status); @@ -432,7 +376,6 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) acpi_status status = AE_OK; union acpi_operand_object *table_desc = ddb_handle; acpi_native_uint table_index; - struct acpi_table_header *table; ACPI_FUNCTION_TRACE(ex_unload_table); @@ -452,25 +395,17 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) table_index = (acpi_native_uint) table_desc->reference.object; - /* Invoke table handler if present */ - - if (acpi_gbl_table_handler) { - status = acpi_get_table_by_index(table_index, &table); - if (ACPI_SUCCESS(status)) { - (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, - table, - acpi_gbl_table_handler_context); - } - } - /* * Delete the entire namespace under this table Node * (Offset contains the table_id) */ acpi_tb_delete_namespace_by_owner(table_index); - (void)acpi_tb_release_owner_id(table_index); + acpi_tb_release_owner_id(table_index); acpi_tb_set_table_loaded_flag(table_index, FALSE); - return_ACPI_STATUS(AE_OK); + /* Delete the table descriptor (ddb_handle) */ + + acpi_ut_remove_reference(table_desc); + return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exconvrt.c b/trunk/drivers/acpi/executer/exconvrt.c index fd954b4ed83d..79f2c0d42c06 100644 --- a/trunk/drivers/acpi/executer/exconvrt.c +++ b/trunk/drivers/acpi/executer/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/excreate.c b/trunk/drivers/acpi/executer/excreate.c index 60e62c4f0577..6e9a23e47fef 100644 --- a/trunk/drivers/acpi/executer/excreate.c +++ b/trunk/drivers/acpi/executer/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,28 +96,16 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) * to the original Node. */ switch (target_node->type) { - - /* For these types, the sub-object can change dynamically via a Store */ - case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_BUFFER_FIELD: - /* - * These types open a new scope, so we need the NS node in order to access - * any children. - */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_LOCAL_SCOPE: - /* * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. + * NS node, not the object itself. This is because for these + * types, the object can change dynamically via a Store. */ alias_node->type = ACPI_TYPE_LOCAL_ALIAS; alias_node->object = @@ -127,7 +115,9 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) case ACPI_TYPE_METHOD: /* - * Control method aliases need to be differentiated + * The new alias has the type ALIAS and points to the original + * NS node, not the object itself. This is because for these + * types, the object can change dynamically via a Store. */ alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; alias_node->object = @@ -350,6 +340,101 @@ acpi_ex_create_region(u8 * aml_start, return_ACPI_STATUS(status); } +/******************************************************************************* + * + * FUNCTION: acpi_ex_create_table_region + * + * PARAMETERS: walk_state - Current state + * + * RETURN: Status + * + * DESCRIPTION: Create a new data_table_region object + * + ******************************************************************************/ + +acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) +{ + acpi_status status; + union acpi_operand_object **operand = &walk_state->operands[0]; + union acpi_operand_object *obj_desc; + struct acpi_namespace_node *node; + union acpi_operand_object *region_obj2; + acpi_native_uint table_index; + struct acpi_table_header *table; + + ACPI_FUNCTION_TRACE(ex_create_table_region); + + /* Get the Node from the object stack */ + + node = walk_state->op->common.node; + + /* + * If the region object is already attached to this node, + * just return + */ + if (acpi_ns_get_attached_object(node)) { + return_ACPI_STATUS(AE_OK); + } + + /* Find the ACPI table */ + + status = acpi_tb_find_table(operand[1]->string.pointer, + operand[2]->string.pointer, + operand[3]->string.pointer, &table_index); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Create the region descriptor */ + + obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); + if (!obj_desc) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + region_obj2 = obj_desc->common.next_object; + region_obj2->extra.region_context = NULL; + + status = acpi_get_table_by_index(table_index, &table); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Init the region from the operands */ + + obj_desc->region.space_id = REGION_DATA_TABLE; + obj_desc->region.address = + (acpi_physical_address) ACPI_TO_INTEGER(table); + obj_desc->region.length = table->length; + obj_desc->region.node = node; + obj_desc->region.flags = AOPOBJ_DATA_VALID; + + /* Install the new region object in the parent Node */ + + status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); + if (ACPI_FAILURE(status)) { + goto cleanup; + } + + status = acpi_ev_initialize_region(obj_desc, FALSE); + if (ACPI_FAILURE(status)) { + if (status == AE_NOT_EXIST) { + status = AE_OK; + } else { + goto cleanup; + } + } + + obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; + + cleanup: + + /* Remove local reference to the object */ + + acpi_ut_remove_reference(obj_desc); + return_ACPI_STATUS(status); +} + /******************************************************************************* * * FUNCTION: acpi_ex_create_processor diff --git a/trunk/drivers/acpi/executer/exdump.c b/trunk/drivers/acpi/executer/exdump.c index 74f1b22601b3..51c9c29987c3 100644 --- a/trunk/drivers/acpi/executer/exdump.c +++ b/trunk/drivers/acpi/executer/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -500,28 +500,25 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) acpi_os_printf("Reference: Debug\n"); break; - case AML_INDEX_OP: + case AML_NAME_OP: - acpi_os_printf("Reference: Index %p\n", - obj_desc->reference.object); + ACPI_DUMP_PATHNAME(obj_desc->reference.object, + "Reference: Name: ", ACPI_LV_INFO, + _COMPONENT); + ACPI_DUMP_ENTRY(obj_desc->reference.object, + ACPI_LV_INFO); break; - case AML_LOAD_OP: + case AML_INDEX_OP: - acpi_os_printf("Reference: [DdbHandle] TableIndex %p\n", + acpi_os_printf("Reference: Index %p\n", obj_desc->reference.object); break; case AML_REF_OF_OP: - acpi_os_printf("Reference: (RefOf) %p [%s]\n", - obj_desc->reference.object, - acpi_ut_get_type_name(((union - acpi_operand_object - *)obj_desc-> - reference. - object)->common. - type)); + acpi_os_printf("Reference: (RefOf) %p\n", + obj_desc->reference.object); break; case AML_ARG_OP: @@ -562,9 +559,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) case AML_INT_NAMEPATH_OP: - acpi_os_printf("Reference: Namepath %X [%4.4s]\n", - obj_desc->reference.node->name.integer, - obj_desc->reference.node->name.ascii); + acpi_os_printf("Reference.Node->Name %X\n", + obj_desc->reference.node->name.integer); break; default: @@ -644,8 +640,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) acpi_os_printf("\n"); } else { acpi_os_printf(" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_NATIVE_UINT(obj_desc->region. - address), + ACPI_FORMAT_UINT64(obj_desc->region. + address), obj_desc->region.length); } break; @@ -881,43 +877,20 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { - acpi_os_printf(" Named Object %p ", obj_desc->reference.node); + acpi_os_printf("Named Object %p ", obj_desc->reference.node); status = acpi_ns_handle_to_pathname(obj_desc->reference.node, &ret_buf); if (ACPI_FAILURE(status)) { - acpi_os_printf(" Could not convert name to pathname\n"); + acpi_os_printf("Could not convert name to pathname\n"); } else { acpi_os_printf("%s\n", (char *)ret_buf.pointer); ACPI_FREE(ret_buf.pointer); } } else if (obj_desc->reference.object) { - if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == - ACPI_DESC_TYPE_OPERAND) { - acpi_os_printf(" Target: %p", - obj_desc->reference.object); - if (obj_desc->reference.opcode == AML_LOAD_OP) { - /* - * For DDBHandle reference, - * obj_desc->Reference.Object is the table index - */ - acpi_os_printf(" [DDBHandle]\n"); - } else { - acpi_os_printf(" [%s]\n", - acpi_ut_get_type_name(((union - acpi_operand_object - *) - obj_desc-> - reference. - object)-> - common. - type)); - } - } else { - acpi_os_printf(" Target: %p\n", - obj_desc->reference.object); - } + acpi_os_printf("\nReferenced Object: %p\n", + obj_desc->reference.object); } } @@ -1003,9 +976,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, case ACPI_TYPE_LOCAL_REFERENCE: - acpi_os_printf("[Object Reference] %s", - (acpi_ps_get_opcode_info - (obj_desc->reference.opcode))->name); + acpi_os_printf("[Object Reference] "); acpi_ex_dump_reference_obj(obj_desc); break; diff --git a/trunk/drivers/acpi/executer/exfield.c b/trunk/drivers/acpi/executer/exfield.c index 3e440d84226a..2d88a3d8d1ad 100644 --- a/trunk/drivers/acpi/executer/exfield.c +++ b/trunk/drivers/acpi/executer/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,6 +71,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, union acpi_operand_object *buffer_desc; acpi_size length; void *buffer; + u8 locked; ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); @@ -110,7 +111,9 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, /* Lock entire transaction if requested */ - acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field. + field_flags); /* * Perform the read. @@ -122,7 +125,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, buffer.pointer), ACPI_READ | (obj_desc->field. attribute << 16)); - acpi_ex_release_global_lock(obj_desc->common_field.field_flags); + acpi_ex_release_global_lock(locked); goto exit; } @@ -172,12 +175,13 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, /* Lock entire transaction if requested */ - acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); /* Read from the field */ status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); - acpi_ex_release_global_lock(obj_desc->common_field.field_flags); + acpi_ex_release_global_lock(locked); exit: if (ACPI_FAILURE(status)) { @@ -210,7 +214,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, { acpi_status status; u32 length; + u32 required_length; void *buffer; + void *new_buffer; + u8 locked; union acpi_operand_object *buffer_desc; ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); @@ -271,7 +278,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, /* Lock entire transaction if requested */ - acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field. + field_flags); /* * Perform the write (returns status and perhaps data in the @@ -282,7 +291,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, (acpi_integer *) buffer, ACPI_WRITE | (obj_desc->field. attribute << 16)); - acpi_ex_release_global_lock(obj_desc->common_field.field_flags); + acpi_ex_release_global_lock(locked); *result_desc = buffer_desc; return_ACPI_STATUS(status); @@ -310,6 +319,35 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } + /* + * We must have a buffer that is at least as long as the field + * we are writing to. This is because individual fields are + * indivisible and partial writes are not supported -- as per + * the ACPI specification. + */ + new_buffer = NULL; + required_length = + ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); + + if (length < required_length) { + + /* We need to create a new buffer */ + + new_buffer = ACPI_ALLOCATE_ZEROED(required_length); + if (!new_buffer) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* + * Copy the original data to the new buffer, starting + * at Byte zero. All unused (upper) bytes of the + * buffer will be 0. + */ + ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length); + buffer = new_buffer; + length = required_length; + } + ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", source_desc, @@ -328,12 +366,19 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, /* Lock entire transaction if requested */ - acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); + locked = + acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); /* Write to the field */ status = acpi_ex_insert_into_field(obj_desc, buffer, length); - acpi_ex_release_global_lock(obj_desc->common_field.field_flags); + acpi_ex_release_global_lock(locked); + + /* Free temporary buffer if we used one */ + + if (new_buffer) { + ACPI_FREE(new_buffer); + } return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exfldio.c b/trunk/drivers/acpi/executer/exfldio.c index e336b5dc7a50..65a48b6170ee 100644 --- a/trunk/drivers/acpi/executer/exfldio.c +++ b/trunk/drivers/acpi/executer/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -263,8 +263,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, rgn_desc->region.space_id, obj_desc->common_field.access_byte_width, obj_desc->common_field.base_byte_offset, - field_datum_byte_offset, ACPI_CAST_PTR(void, - address))); + field_datum_byte_offset, (void *)address)); /* Invoke the appropriate address_space/op_region handler */ @@ -806,39 +805,18 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, u32 datum_count; u32 field_datum_count; u32 i; - u32 required_length; - void *new_buffer; ACPI_FUNCTION_TRACE(ex_insert_into_field); /* Validate input buffer */ - new_buffer = NULL; - required_length = - ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); - /* - * We must have a buffer that is at least as long as the field - * we are writing to. This is because individual fields are - * indivisible and partial writes are not supported -- as per - * the ACPI specification. - */ - if (buffer_length < required_length) { - - /* We need to create a new buffer */ - - new_buffer = ACPI_ALLOCATE_ZEROED(required_length); - if (!new_buffer) { - return_ACPI_STATUS(AE_NO_MEMORY); - } + if (buffer_length < + ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { + ACPI_ERROR((AE_INFO, + "Field size %X (bits) is too large for buffer (%X)", + obj_desc->common_field.bit_length, buffer_length)); - /* - * Copy the original data to the new buffer, starting - * at Byte zero. All unused (upper) bytes of the - * buffer will be 0. - */ - ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length); - buffer = new_buffer; - buffer_length = required_length; + return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } /* @@ -888,7 +866,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, merged_datum, field_offset); if (ACPI_FAILURE(status)) { - goto exit; + return_ACPI_STATUS(status); } field_offset += obj_desc->common_field.access_byte_width; @@ -946,11 +924,5 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, mask, merged_datum, field_offset); - exit: - /* Free temporary buffer if we used one */ - - if (new_buffer) { - ACPI_FREE(new_buffer); - } return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exmisc.c b/trunk/drivers/acpi/executer/exmisc.c index cc956a5b5267..f13d1cec2d6d 100644 --- a/trunk/drivers/acpi/executer/exmisc.c +++ b/trunk/drivers/acpi/executer/exmisc.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exmutex.c b/trunk/drivers/acpi/executer/exmutex.c index c873ab40cd0e..6748e3ef0997 100644 --- a/trunk/drivers/acpi/executer/exmutex.c +++ b/trunk/drivers/acpi/executer/exmutex.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,79 +124,6 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, thread->acquired_mutex_list = obj_desc; } -/******************************************************************************* - * - * FUNCTION: acpi_ex_acquire_mutex_object - * - * PARAMETERS: time_desc - Timeout in milliseconds - * obj_desc - Mutex object - * Thread - Current thread state - * - * RETURN: Status - * - * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common - * path that supports multiple acquires by the same thread. - * - * MUTEX: Interpreter must be locked - * - * NOTE: This interface is called from three places: - * 1) From acpi_ex_acquire_mutex, via an AML Acquire() operator - * 2) From acpi_ex_acquire_global_lock when an AML Field access requires the - * global lock - * 3) From the external interface, acpi_acquire_global_lock - * - ******************************************************************************/ - -acpi_status -acpi_ex_acquire_mutex_object(u16 timeout, - union acpi_operand_object *obj_desc, - acpi_thread_id thread_id) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); - - if (!obj_desc) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - /* Support for multiple acquires by the owning thread */ - - if (obj_desc->mutex.thread_id == thread_id) { - /* - * The mutex is already owned by this thread, just increment the - * acquisition depth - */ - obj_desc->mutex.acquisition_depth++; - return_ACPI_STATUS(AE_OK); - } - - /* Acquire the mutex, wait if necessary. Special case for Global Lock */ - - if (obj_desc == acpi_gbl_global_lock_mutex) { - status = acpi_ev_acquire_global_lock(timeout); - } else { - status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, - timeout); - } - - if (ACPI_FAILURE(status)) { - - /* Includes failure from a timeout on time_desc */ - - return_ACPI_STATUS(status); - } - - /* Acquired the mutex: update mutex object */ - - obj_desc->mutex.thread_id = thread_id; - obj_desc->mutex.acquisition_depth = 1; - obj_desc->mutex.original_sync_level = 0; - obj_desc->mutex.owner_thread = NULL; /* Used only for AML Acquire() */ - - return_ACPI_STATUS(AE_OK); -} - /******************************************************************************* * * FUNCTION: acpi_ex_acquire_mutex @@ -224,7 +151,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, return_ACPI_STATUS(AE_BAD_PARAMETER); } - /* Must have a valid thread ID */ + /* Sanity check: we must have a valid thread ID */ if (!walk_state->thread) { ACPI_ERROR((AE_INFO, @@ -234,7 +161,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, } /* - * Current sync level must be less than or equal to the sync level of the + * Current Sync must be less than or equal to the sync level of the * mutex. This mechanism provides some deadlock prevention */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { @@ -245,89 +172,51 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } - status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, - obj_desc, - walk_state->thread->thread_id); - if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { - - /* Save Thread object, original/current sync levels */ - - obj_desc->mutex.owner_thread = walk_state->thread; - obj_desc->mutex.original_sync_level = - walk_state->thread->current_sync_level; - walk_state->thread->current_sync_level = - obj_desc->mutex.sync_level; - - /* Link the mutex to the current thread for force-unlock at method exit */ + /* Support for multiple acquires by the owning thread */ - acpi_ex_link_mutex(obj_desc, walk_state->thread); + if (obj_desc->mutex.owner_thread) { + if (obj_desc->mutex.owner_thread->thread_id == + walk_state->thread->thread_id) { + /* + * The mutex is already owned by this thread, just increment the + * acquisition depth + */ + obj_desc->mutex.acquisition_depth++; + return_ACPI_STATUS(AE_OK); + } } - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_release_mutex_object - * - * PARAMETERS: obj_desc - The object descriptor for this op - * - * RETURN: Status - * - * DESCRIPTION: Release a previously acquired Mutex, low level interface. - * Provides a common path that supports multiple releases (after - * previous multiple acquires) by the same thread. - * - * MUTEX: Interpreter must be locked - * - * NOTE: This interface is called from three places: - * 1) From acpi_ex_release_mutex, via an AML Acquire() operator - * 2) From acpi_ex_release_global_lock when an AML Field access requires the - * global lock - * 3) From the external interface, acpi_release_global_lock - * - ******************************************************************************/ - -acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) -{ - acpi_status status = AE_OK; - - ACPI_FUNCTION_TRACE(ex_release_mutex_object); + /* Acquire the mutex, wait if necessary. Special case for Global Lock */ - if (obj_desc->mutex.acquisition_depth == 0) { - return (AE_NOT_ACQUIRED); + if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { + status = + acpi_ev_acquire_global_lock((u16) time_desc->integer.value); + } else { + status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, + (u16) time_desc->integer. + value); } - /* Match multiple Acquires with multiple Releases */ - - obj_desc->mutex.acquisition_depth--; - if (obj_desc->mutex.acquisition_depth != 0) { + if (ACPI_FAILURE(status)) { - /* Just decrement the depth and return */ + /* Includes failure from a timeout on time_desc */ - return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(status); } - if (obj_desc->mutex.owner_thread) { - - /* Unlink the mutex from the owner's list */ + /* Have the mutex: update mutex and walk info and save the sync_level */ - acpi_ex_unlink_mutex(obj_desc); - obj_desc->mutex.owner_thread = NULL; - } - - /* Release the mutex, special case for Global Lock */ + obj_desc->mutex.owner_thread = walk_state->thread; + obj_desc->mutex.acquisition_depth = 1; + obj_desc->mutex.original_sync_level = + walk_state->thread->current_sync_level; - if (obj_desc == acpi_gbl_global_lock_mutex) { - status = acpi_ev_release_global_lock(); - } else { - acpi_os_release_mutex(obj_desc->mutex.os_mutex); - } + walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; - /* Clear mutex info */ + /* Link the mutex to the current thread for force-unlock at method exit */ - obj_desc->mutex.thread_id = 0; - return_ACPI_STATUS(status); + acpi_ex_link_mutex(obj_desc, walk_state->thread); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -364,13 +253,22 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); } + /* Sanity check: we must have a valid thread ID */ + + if (!walk_state->thread) { + ACPI_ERROR((AE_INFO, + "Cannot release Mutex [%4.4s], null thread info", + acpi_ut_get_node_name(obj_desc->mutex.node))); + return_ACPI_STATUS(AE_AML_INTERNAL); + } + /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release */ if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) - && (obj_desc != acpi_gbl_global_lock_mutex)) { + && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { ACPI_ERROR((AE_INFO, "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", (unsigned long)walk_state->thread->thread_id, @@ -380,37 +278,45 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_AML_NOT_OWNER); } - /* Must have a valid thread ID */ - - if (!walk_state->thread) { - ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], null thread info", - acpi_ut_get_node_name(obj_desc->mutex.node))); - return_ACPI_STATUS(AE_AML_INTERNAL); - } - /* * The sync level of the mutex must be less than or equal to the current * sync level */ if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", - acpi_ut_get_node_name(obj_desc->mutex.node), - obj_desc->mutex.sync_level, - walk_state->thread->current_sync_level)); + "Cannot release Mutex [%4.4s], incorrect SyncLevel", + acpi_ut_get_node_name(obj_desc->mutex.node))); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } - status = acpi_ex_release_mutex_object(obj_desc); + /* Match multiple Acquires with multiple Releases */ + + obj_desc->mutex.acquisition_depth--; + if (obj_desc->mutex.acquisition_depth != 0) { + + /* Just decrement the depth and return */ + + return_ACPI_STATUS(AE_OK); + } + + /* Unlink the mutex from the owner's list */ - if (obj_desc->mutex.acquisition_depth == 0) { + acpi_ex_unlink_mutex(obj_desc); - /* Restore the original sync_level */ + /* Release the mutex, special case for Global Lock */ - walk_state->thread->current_sync_level = - obj_desc->mutex.original_sync_level; + if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { + status = acpi_ev_release_global_lock(); + } else { + acpi_os_release_mutex(obj_desc->mutex.os_mutex); } + + /* Update the mutex and restore sync_level */ + + obj_desc->mutex.owner_thread = NULL; + walk_state->thread->current_sync_level = + obj_desc->mutex.original_sync_level; + return_ACPI_STATUS(status); } @@ -451,7 +357,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) /* Release the mutex, special case for Global Lock */ - if (obj_desc == acpi_gbl_global_lock_mutex) { + if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { /* Ignore errors */ @@ -463,7 +369,6 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) /* Mark mutex unowned */ obj_desc->mutex.owner_thread = NULL; - obj_desc->mutex.thread_id = 0; /* Update Thread sync_level (Last mutex is the important one) */ diff --git a/trunk/drivers/acpi/executer/exnames.c b/trunk/drivers/acpi/executer/exnames.c index 817e67be3697..308eae52dc05 100644 --- a/trunk/drivers/acpi/executer/exnames.c +++ b/trunk/drivers/acpi/executer/exnames.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exoparg1.c b/trunk/drivers/acpi/executer/exoparg1.c index 7c3bea575e02..252f10acbbcc 100644 --- a/trunk/drivers/acpi/executer/exoparg1.c +++ b/trunk/drivers/acpi/executer/exoparg1.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,7 +121,6 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) if ((ACPI_FAILURE(status)) || walk_state->result_obj) { acpi_ut_remove_reference(return_desc); - walk_state->result_obj = NULL; } else { /* Save the return value */ @@ -740,38 +739,26 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) value = acpi_gbl_integer_byte_width; break; - case ACPI_TYPE_STRING: - value = temp_desc->string.length; - break; - case ACPI_TYPE_BUFFER: - - /* Buffer arguments may not be evaluated at this point */ - - status = acpi_ds_get_buffer_arguments(temp_desc); value = temp_desc->buffer.length; break; - case ACPI_TYPE_PACKAGE: - - /* Package arguments may not be evaluated at this point */ + case ACPI_TYPE_STRING: + value = temp_desc->string.length; + break; - status = acpi_ds_get_package_arguments(temp_desc); + case ACPI_TYPE_PACKAGE: value = temp_desc->package.count; break; default: ACPI_ERROR((AE_INFO, - "Operand must be Buffer/Integer/String/Package - found type %s", + "Operand is not Buf/Int/Str/Pkg - found type %s", acpi_ut_get_type_name(type))); status = AE_AML_OPERAND_TYPE; goto cleanup; } - if (ACPI_FAILURE(status)) { - goto cleanup; - } - /* * Now that we have the size of the object, create a result * object to hold the value diff --git a/trunk/drivers/acpi/executer/exoparg2.c b/trunk/drivers/acpi/executer/exoparg2.c index 8e8bbb6ccebd..17e652e65379 100644 --- a/trunk/drivers/acpi/executer/exoparg2.c +++ b/trunk/drivers/acpi/executer/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -241,6 +241,10 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) goto cleanup; } + /* Return the remainder */ + + walk_state->result_obj = return_desc1; + cleanup: /* * Since the remainder is not returned indirectly, remove a reference to @@ -255,12 +259,6 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) acpi_ut_remove_reference(return_desc1); } - /* Save return object (the remainder) on success */ - - else { - walk_state->result_obj = return_desc1; - } - return_ACPI_STATUS(status); } @@ -492,7 +490,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status)) { acpi_ut_remove_reference(return_desc); - walk_state->result_obj = NULL; } return_ACPI_STATUS(status); @@ -586,6 +583,8 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) return_desc->integer.value = ACPI_INTEGER_MAX; } + walk_state->result_obj = return_desc; + cleanup: /* Delete return object on error */ @@ -594,11 +593,5 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) acpi_ut_remove_reference(return_desc); } - /* Save return object on success */ - - else { - walk_state->result_obj = return_desc; - } - return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exoparg3.c b/trunk/drivers/acpi/executer/exoparg3.c index 9cb4197681af..7fe67cf82cee 100644 --- a/trunk/drivers/acpi/executer/exoparg3.c +++ b/trunk/drivers/acpi/executer/exoparg3.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -260,7 +260,6 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) if (ACPI_FAILURE(status) || walk_state->result_obj) { acpi_ut_remove_reference(return_desc); - walk_state->result_obj = NULL; } /* Set the return object and exit */ diff --git a/trunk/drivers/acpi/executer/exoparg6.c b/trunk/drivers/acpi/executer/exoparg6.c index 67d48737af53..bd80a9cb3d65 100644 --- a/trunk/drivers/acpi/executer/exoparg6.c +++ b/trunk/drivers/acpi/executer/exoparg6.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -322,6 +322,8 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) goto cleanup; } + walk_state->result_obj = return_desc; + cleanup: /* Delete return object on error */ @@ -330,11 +332,5 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) acpi_ut_remove_reference(return_desc); } - /* Save return object on success */ - - else { - walk_state->result_obj = return_desc; - } - return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/executer/exprep.c b/trunk/drivers/acpi/executer/exprep.c index 3a2f8cd4c62a..efe5d4b461a4 100644 --- a/trunk/drivers/acpi/executer/exprep.c +++ b/trunk/drivers/acpi/executer/exprep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -412,7 +412,6 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) { union acpi_operand_object *obj_desc; - union acpi_operand_object *second_desc = NULL; u32 type; acpi_status status; @@ -495,20 +494,6 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) obj_desc->field.access_byte_width, obj_desc->bank_field.region_obj, obj_desc->bank_field.bank_obj)); - - /* - * Remember location in AML stream of the field unit - * opcode and operands -- since the bank_value - * operands must be evaluated. - */ - second_desc = obj_desc->common.next_object; - second_desc->extra.aml_start = - ((union acpi_parse_object *)(info->data_register_node))-> - named.data; - second_desc->extra.aml_length = - ((union acpi_parse_object *)(info->data_register_node))-> - named.length; - break; case ACPI_TYPE_LOCAL_INDEX_FIELD: diff --git a/trunk/drivers/acpi/executer/exregion.c b/trunk/drivers/acpi/executer/exregion.c index 7cd8bb54fa01..3f51b7e84a17 100644 --- a/trunk/drivers/acpi/executer/exregion.c +++ b/trunk/drivers/acpi/executer/exregion.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -160,7 +160,7 @@ acpi_ex_system_memory_space_handler(u32 function, if (!mem_info->mapped_logical_address) { ACPI_ERROR((AE_INFO, "Could not map memory at %8.8X%8.8X, size %X", - ACPI_FORMAT_NATIVE_UINT(address), + ACPI_FORMAT_UINT64(address), (u32) window_size)); mem_info->mapped_length = 0; return_ACPI_STATUS(AE_NO_MEMORY); @@ -182,8 +182,7 @@ acpi_ex_system_memory_space_handler(u32 function, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", - bit_width, function, - ACPI_FORMAT_NATIVE_UINT(address))); + bit_width, function, ACPI_FORMAT_UINT64(address))); /* * Perform the memory read or write @@ -285,8 +284,7 @@ acpi_ex_system_io_space_handler(u32 function, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", - bit_width, function, - ACPI_FORMAT_NATIVE_UINT(address))); + bit_width, function, ACPI_FORMAT_UINT64(address))); /* Decode the function parameter */ diff --git a/trunk/drivers/acpi/executer/exresnte.c b/trunk/drivers/acpi/executer/exresnte.c index 5596f42c9676..2b3a01cc4929 100644 --- a/trunk/drivers/acpi/executer/exresnte.c +++ b/trunk/drivers/acpi/executer/exresnte.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,11 +116,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, * Several object types require no further processing: * 1) Device/Thermal objects don't have a "real" subobject, return the Node * 2) Method locals and arguments have a pseudo-Node - * 3) 10/2007: Added method type to assist with Package construction. */ if ((entry_type == ACPI_TYPE_DEVICE) || (entry_type == ACPI_TYPE_THERMAL) || - (entry_type == ACPI_TYPE_METHOD) || (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { return_ACPI_STATUS(AE_OK); } @@ -216,6 +214,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: @@ -239,12 +238,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, case ACPI_TYPE_LOCAL_REFERENCE: switch (source_desc->reference.opcode) { - case AML_LOAD_OP: /* This is a ddb_handle */ - case AML_REF_OF_OP: - case AML_INDEX_OP: + case AML_LOAD_OP: + /* This is a ddb_handle */ /* Return an additional reference to the object */ + case AML_REF_OF_OP: + obj_desc = source_desc; acpi_ut_add_reference(obj_desc); break; diff --git a/trunk/drivers/acpi/executer/exresolv.c b/trunk/drivers/acpi/executer/exresolv.c index b35f7c817acf..6c64e55dab0e 100644 --- a/trunk/drivers/acpi/executer/exresolv.c +++ b/trunk/drivers/acpi/executer/exresolv.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -140,6 +140,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, { acpi_status status = AE_OK; union acpi_operand_object *stack_desc; + void *temp_node; union acpi_operand_object *obj_desc = NULL; u16 opcode; @@ -155,6 +156,23 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, opcode = stack_desc->reference.opcode; switch (opcode) { + case AML_NAME_OP: + + /* + * Convert name reference to a namespace node + * Then, acpi_ex_resolve_node_to_value can be used to get the value + */ + temp_node = stack_desc->reference.object; + + /* Delete the Reference Object */ + + acpi_ut_remove_reference(stack_desc); + + /* Return the namespace node */ + + (*stack_ptr) = temp_node; + break; + case AML_LOCAL_OP: case AML_ARG_OP: @@ -189,25 +207,15 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, switch (stack_desc->reference.target_type) { case ACPI_TYPE_BUFFER_FIELD: - /* Just return - do not dereference */ + /* Just return - leave the Reference on the stack */ break; case ACPI_TYPE_PACKAGE: - /* If method call or copy_object - do not dereference */ - - if ((walk_state->opcode == - AML_INT_METHODCALL_OP) - || (walk_state->opcode == AML_COPY_OP)) { - break; - } - - /* Otherwise, dereference the package_index to a package element */ - obj_desc = *stack_desc->reference.where; if (obj_desc) { /* - * Valid object descriptor, copy pointer to return value + * Valid obj descriptor, copy pointer to return value * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ @@ -216,11 +224,11 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, *stack_ptr = obj_desc; } else { /* - * A NULL object descriptor means an uninitialized element of + * A NULL object descriptor means an unitialized element of * the package, can't dereference it */ ACPI_ERROR((AE_INFO, - "Attempt to dereference an Index to NULL package element Idx=%p", + "Attempt to deref an Index to NULL pkg element Idx=%p", stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -231,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, /* Invalid reference object */ ACPI_ERROR((AE_INFO, - "Unknown TargetType %X in Index/Reference object %p", + "Unknown TargetType %X in Index/Reference obj %p", stack_desc->reference.target_type, stack_desc)); status = AE_AML_INTERNAL; @@ -243,7 +251,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, case AML_DEBUG_OP: case AML_LOAD_OP: - /* Just leave the object as-is, do not dereference */ + /* Just leave the object as-is */ break; @@ -382,10 +390,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, } /* - * For reference objects created via the ref_of, Index, or Load/load_table - * operators, we need to get to the base object (as per the ACPI - * specification of the object_type and size_of operators). This means - * traversing the list of possibly many nested references. + * For reference objects created via the ref_of or Index operators, + * we need to get to the base object (as per the ACPI specification + * of the object_type and size_of operators). This means traversing + * the list of possibly many nested references. */ while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { switch (obj_desc->reference.opcode) { @@ -455,11 +463,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, } break; - case AML_LOAD_OP: - - type = ACPI_TYPE_DDB_HANDLE; - goto exit; - case AML_LOCAL_OP: case AML_ARG_OP: diff --git a/trunk/drivers/acpi/executer/exresop.c b/trunk/drivers/acpi/executer/exresop.c index 73e29e566a70..09d897b3f6d5 100644 --- a/trunk/drivers/acpi/executer/exresop.c +++ b/trunk/drivers/acpi/executer/exresop.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -137,6 +137,7 @@ acpi_ex_resolve_operands(u16 opcode, union acpi_operand_object *obj_desc; acpi_status status = AE_OK; u8 object_type; + void *temp_node; u32 arg_types; const struct acpi_opcode_info *op_info; u32 this_arg_type; @@ -238,6 +239,7 @@ acpi_ex_resolve_operands(u16 opcode, /*lint -fallthrough */ + case AML_NAME_OP: case AML_INDEX_OP: case AML_REF_OF_OP: case AML_ARG_OP: @@ -330,6 +332,15 @@ acpi_ex_resolve_operands(u16 opcode, if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } + + if (obj_desc->reference.opcode == AML_NAME_OP) { + + /* Convert a named reference to the actual named object */ + + temp_node = obj_desc->reference.object; + acpi_ut_remove_reference(obj_desc); + (*stack_ptr) = temp_node; + } goto next_operand; case ARGI_DATAREFOBJ: /* Store operator only */ diff --git a/trunk/drivers/acpi/executer/exstore.c b/trunk/drivers/acpi/executer/exstore.c index 76c875bc3154..f4b69a637820 100644 --- a/trunk/drivers/acpi/executer/exstore.c +++ b/trunk/drivers/acpi/executer/exstore.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,12 +84,8 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); - /* Print line header as long as we are not in the middle of an object display */ - - if (!((level > 0) && index == 0)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - level, " ")); - } + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", + level, " ")); /* Display index for package output only */ @@ -99,12 +95,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, } if (!source_desc) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "\n")); return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s ", + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ", acpi_ut_get_object_type_name (source_desc))); @@ -127,8 +123,6 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, return_VOID; } - /* source_desc is of type ACPI_DESC_TYPE_OPERAND */ - switch (ACPI_GET_OBJECT_TYPE(source_desc)) { case ACPI_TYPE_INTEGER: @@ -153,7 +147,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, (u32) source_desc->buffer.length)); ACPI_DUMP_BUFFER(source_desc->buffer.pointer, (source_desc->buffer.length < - 256) ? source_desc->buffer.length : 256); + 32) ? source_desc->buffer.length : 32); break; case ACPI_TYPE_STRING: @@ -166,7 +160,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, case ACPI_TYPE_PACKAGE: ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, - "[Contains 0x%.2X Elements]\n", + "[0x%.2X Elements]\n", source_desc->package.count)); /* Output the entire contents of the package */ @@ -186,59 +180,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, (source_desc->reference.opcode), source_desc->reference.offset)); } else { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]", + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n", acpi_ps_get_opcode_name (source_desc->reference.opcode))); } - if (source_desc->reference.opcode == AML_LOAD_OP) { /* Load and load_table */ - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, - " Table OwnerId %p\n", - source_desc->reference.object)); - break; - } - - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " ")); - - /* Check for valid node first, then valid object */ - - if (source_desc->reference.node) { - if (ACPI_GET_DESCRIPTOR_TYPE - (source_desc->reference.node) != - ACPI_DESC_TYPE_NAMED) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, - " %p - Not a valid namespace node\n", - source_desc->reference. - node)); - } else { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, - "Node %p [%4.4s] ", - source_desc->reference. - node, - (source_desc->reference. - node)->name.ascii)); - - switch ((source_desc->reference.node)->type) { - - /* These types have no attached object */ - - case ACPI_TYPE_DEVICE: - acpi_os_printf("Device\n"); - break; - - case ACPI_TYPE_THERMAL: - acpi_os_printf("Thermal Zone\n"); - break; - - default: - acpi_ex_do_debug_object((source_desc-> - reference. - node)->object, - level + 4, 0); - break; - } - } - } else if (source_desc->reference.object) { + if (source_desc->reference.object) { if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == ACPI_DESC_TYPE_NAMED) { @@ -251,13 +198,18 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, acpi_ex_do_debug_object(source_desc->reference. object, level + 4, 0); } + } else if (source_desc->reference.node) { + acpi_ex_do_debug_object((source_desc->reference.node)-> + object, level + 4, 0); } break; default: - ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p\n", - source_desc)); + ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n", + source_desc, + acpi_ut_get_object_type_name + (source_desc))); break; } @@ -361,6 +313,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, * 4) Store to the debug object */ switch (ref_desc->reference.opcode) { + case AML_NAME_OP: case AML_REF_OF_OP: /* Storing an object into a Name "container" */ @@ -462,24 +415,11 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, */ obj_desc = *(index_desc->reference.where); - if (ACPI_GET_OBJECT_TYPE(source_desc) == - ACPI_TYPE_LOCAL_REFERENCE - && source_desc->reference.opcode == AML_LOAD_OP) { - - /* This is a DDBHandle, just add a reference to it */ - - acpi_ut_add_reference(source_desc); - new_desc = source_desc; - } else { - /* Normal object, copy it */ - - status = - acpi_ut_copy_iobject_to_iobject(source_desc, - &new_desc, - walk_state); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + status = + acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } if (obj_desc) { @@ -631,17 +571,10 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, /* If no implicit conversion, drop into the default case below */ - if ((!implicit_conversion) || - ((walk_state->opcode == AML_COPY_OP) && - (target_type != ACPI_TYPE_LOCAL_REGION_FIELD) && - (target_type != ACPI_TYPE_LOCAL_BANK_FIELD) && - (target_type != ACPI_TYPE_LOCAL_INDEX_FIELD))) { - /* - * Force execution of default (no implicit conversion). Note: - * copy_object does not perform an implicit conversion, as per the ACPI - * spec -- except in case of region/bank/index fields -- because these - * objects must retain their original type permanently. - */ + if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { + + /* Force execution of default (no implicit conversion) */ + target_type = ACPI_TYPE_ANY; } diff --git a/trunk/drivers/acpi/executer/exstoren.c b/trunk/drivers/acpi/executer/exstoren.c index a6d2168b81f9..1d622c625c64 100644 --- a/trunk/drivers/acpi/executer/exstoren.c +++ b/trunk/drivers/acpi/executer/exstoren.c @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exstorob.c b/trunk/drivers/acpi/executer/exstorob.c index 9a75ff09fb0c..8233d40178ee 100644 --- a/trunk/drivers/acpi/executer/exstorob.c +++ b/trunk/drivers/acpi/executer/exstorob.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/executer/exsystem.c b/trunk/drivers/acpi/executer/exsystem.c index 68990f1df371..9460baff3032 100644 --- a/trunk/drivers/acpi/executer/exsystem.c +++ b/trunk/drivers/acpi/executer/exsystem.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exsystem") diff --git a/trunk/drivers/acpi/executer/exutils.c b/trunk/drivers/acpi/executer/exutils.c index 86c03880b523..6b0aeccbb69b 100644 --- a/trunk/drivers/acpi/executer/exutils.c +++ b/trunk/drivers/acpi/executer/exutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,7 @@ #include #include #include +#include #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exutils") @@ -216,10 +217,9 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) /* * Object must be a valid number and we must be executing - * a control method. NS node could be there for AML_INT_NAMEPATH_OP. + * a control method */ if ((!obj_desc) || - (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { return; } @@ -240,73 +240,72 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) * PARAMETERS: field_flags - Flags with Lock rule: * always_lock or never_lock * - * RETURN: None + * RETURN: TRUE/FALSE indicating whether the lock was actually acquired * - * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field - * flags specifiy that it is to be obtained before field access. + * DESCRIPTION: Obtain the global lock and keep track of this fact via two + * methods. A global variable keeps the state of the lock, and + * the state is returned to the caller. * ******************************************************************************/ -void acpi_ex_acquire_global_lock(u32 field_flags) +u8 acpi_ex_acquire_global_lock(u32 field_flags) { + u8 locked = FALSE; acpi_status status; ACPI_FUNCTION_TRACE(ex_acquire_global_lock); - /* Only use the lock if the always_lock bit is set */ - - if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { - return_VOID; - } + /* Only attempt lock if the always_lock bit is set */ - /* Attempt to get the global lock, wait forever */ + if (field_flags & AML_FIELD_LOCK_RULE_MASK) { - status = acpi_ex_acquire_mutex_object(ACPI_WAIT_FOREVER, - acpi_gbl_global_lock_mutex, - acpi_os_get_thread_id()); + /* We should attempt to get the lock, wait forever */ - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Could not acquire Global Lock")); + status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); + if (ACPI_SUCCESS(status)) { + locked = TRUE; + } else { + ACPI_EXCEPTION((AE_INFO, status, + "Could not acquire Global Lock")); + } } - return_VOID; + return_UINT8(locked); } /******************************************************************************* * * FUNCTION: acpi_ex_release_global_lock * - * PARAMETERS: field_flags - Flags with Lock rule: - * always_lock or never_lock + * PARAMETERS: locked_by_me - Return value from corresponding call to + * acquire_global_lock. * * RETURN: None * - * DESCRIPTION: Release the ACPI hardware Global Lock + * DESCRIPTION: Release the global lock if it is locked. * ******************************************************************************/ -void acpi_ex_release_global_lock(u32 field_flags) +void acpi_ex_release_global_lock(u8 locked_by_me) { acpi_status status; ACPI_FUNCTION_TRACE(ex_release_global_lock); - /* Only use the lock if the always_lock bit is set */ + /* Only attempt unlock if the caller locked it */ - if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { - return_VOID; - } + if (locked_by_me) { - /* Release the global lock */ + /* OK, now release the lock */ - status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); - if (ACPI_FAILURE(status)) { + status = acpi_ev_release_global_lock(); + if (ACPI_FAILURE(status)) { - /* Report the error, but there isn't much else we can do */ + /* Report the error, but there isn't much else we can do */ - ACPI_EXCEPTION((AE_INFO, status, - "Could not release Global Lock")); + ACPI_EXCEPTION((AE_INFO, status, + "Could not release ACPI Global Lock")); + } } return_VOID; diff --git a/trunk/drivers/acpi/fan.c b/trunk/drivers/acpi/fan.c index cf635cde836b..c8e3cba423ef 100644 --- a/trunk/drivers/acpi/fan.c +++ b/trunk/drivers/acpi/fan.c @@ -260,23 +260,24 @@ static int acpi_fan_add(struct acpi_device *device) result = PTR_ERR(cdev); goto end; } - - printk(KERN_INFO PREFIX - "%s is registered as cooling_device%d\n", - device->dev.bus_id, cdev->id); - - acpi_driver_data(device) = cdev; - result = sysfs_create_link(&device->dev.kobj, - &cdev->device.kobj, - "thermal_cooling"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); - - result = sysfs_create_link(&cdev->device.kobj, - &device->dev.kobj, - "device"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); + if (cdev) { + printk(KERN_INFO PREFIX + "%s is registered as cooling_device%d\n", + device->dev.bus_id, cdev->id); + + acpi_driver_data(device) = cdev; + result = sysfs_create_link(&device->dev.kobj, + &cdev->device.kobj, + "thermal_cooling"); + if (result) + return result; + + result = sysfs_create_link(&cdev->device.kobj, + &device->dev.kobj, + "device"); + if (result) + return result; + } result = acpi_fan_add_fs(device); if (result) diff --git a/trunk/drivers/acpi/glue.c b/trunk/drivers/acpi/glue.c index 06f8634fe58b..eda0978b57c6 100644 --- a/trunk/drivers/acpi/glue.c +++ b/trunk/drivers/acpi/glue.c @@ -142,7 +142,6 @@ EXPORT_SYMBOL(acpi_get_physical_device); static int acpi_bind_one(struct device *dev, acpi_handle handle) { - struct acpi_device *acpi_dev; acpi_status status; if (dev->archdata.acpi_handle) { @@ -158,16 +157,6 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) } dev->archdata.acpi_handle = handle; - status = acpi_bus_get_device(handle, &acpi_dev); - if (!ACPI_FAILURE(status)) { - int ret; - - ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, - "firmware_node"); - ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, - "physical_node"); - } - return 0; } @@ -176,17 +165,8 @@ static int acpi_unbind_one(struct device *dev) if (!dev->archdata.acpi_handle) return 0; if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { - struct acpi_device *acpi_dev; - /* acpi_get_physical_device increase refcnt by one */ put_device(dev); - - if (!acpi_bus_get_device(dev->archdata.acpi_handle, - &acpi_dev)) { - sysfs_remove_link(&dev->kobj, "firmware_node"); - sysfs_remove_link(&acpi_dev->dev.kobj, "physical_node"); - } - acpi_detach_data(dev->archdata.acpi_handle, acpi_glue_data_handler); dev->archdata.acpi_handle = NULL; diff --git a/trunk/drivers/acpi/hardware/hwacpi.c b/trunk/drivers/acpi/hardware/hwacpi.c index 816894ea839e..6031ca13dd2f 100644 --- a/trunk/drivers/acpi/hardware/hwacpi.c +++ b/trunk/drivers/acpi/hardware/hwacpi.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/hardware/hwgpe.c b/trunk/drivers/acpi/hardware/hwgpe.c index 14bc4f456ae8..117a05cadaaa 100644 --- a/trunk/drivers/acpi/hardware/hwgpe.c +++ b/trunk/drivers/acpi/hardware/hwgpe.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/hardware/hwregs.c b/trunk/drivers/acpi/hardware/hwregs.c index ddf792adcf96..73f9c5fb1ba7 100644 --- a/trunk/drivers/acpi/hardware/hwregs.c +++ b/trunk/drivers/acpi/hardware/hwregs.c @@ -7,7 +7,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/hardware/hwsleep.c b/trunk/drivers/acpi/hardware/hwsleep.c index d9937e05ec6a..4290e0193097 100644 --- a/trunk/drivers/acpi/hardware/hwsleep.c +++ b/trunk/drivers/acpi/hardware/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,10 +70,9 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) /* Get the FACS */ - status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &facs)); + status = + acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + (struct acpi_table_header **)&facs); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -125,10 +124,9 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) /* Get the FACS */ - status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR(struct - acpi_table_header, - &facs)); + status = + acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, + (struct acpi_table_header **)&facs); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/hardware/hwtimer.c b/trunk/drivers/acpi/hardware/hwtimer.c index b53d575491b9..c32eab696acd 100644 --- a/trunk/drivers/acpi/hardware/hwtimer.c +++ b/trunk/drivers/acpi/hardware/hwtimer.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsaccess.c b/trunk/drivers/acpi/namespace/nsaccess.c index c39a7f68b889..57faf598bad8 100644 --- a/trunk/drivers/acpi/namespace/nsaccess.c +++ b/trunk/drivers/acpi/namespace/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -208,7 +208,8 @@ acpi_status acpi_ns_root_initialize(void) /* Special case for ACPI Global Lock */ if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { - acpi_gbl_global_lock_mutex = obj_desc; + acpi_gbl_global_lock_mutex = + obj_desc->mutex.os_mutex; /* Create additional counting semaphore for global lock */ @@ -581,68 +582,44 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, return_ACPI_STATUS(status); } - /* More segments to follow? */ - - if (num_segments > 0) { - /* - * If we have an alias to an object that opens a scope (such as a - * device or processor), we need to dereference the alias here so that - * we can access any children of the original node (via the remaining - * segments). - */ - if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { - if (acpi_ns_opens_scope - (((struct acpi_namespace_node *)this_node-> - object)->type)) { - this_node = - (struct acpi_namespace_node *) - this_node->object; - } - } + /* + * Sanity typecheck of the target object: + * + * If 1) This is the last segment (num_segments == 0) + * 2) And we are looking for a specific type + * (Not checking for TYPE_ANY) + * 3) Which is not an alias + * 4) Which is not a local type (TYPE_SCOPE) + * 5) And the type of target object is known (not TYPE_ANY) + * 6) And target object does not match what we are looking for + * + * Then we have a type mismatch. Just warn and ignore it. + */ + if ((num_segments == 0) && + (type_to_check_for != ACPI_TYPE_ANY) && + (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && + (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && + (this_node->type != ACPI_TYPE_ANY) && + (this_node->type != type_to_check_for)) { + + /* Complain about a type mismatch */ + + ACPI_WARNING((AE_INFO, + "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR(char, &simple_name), + acpi_ut_get_type_name(this_node->type), + acpi_ut_get_type_name + (type_to_check_for))); } - /* Special handling for the last segment (num_segments == 0) */ - - else { - /* - * Sanity typecheck of the target object: - * - * If 1) This is the last segment (num_segments == 0) - * 2) And we are looking for a specific type - * (Not checking for TYPE_ANY) - * 3) Which is not an alias - * 4) Which is not a local type (TYPE_SCOPE) - * 5) And the type of target object is known (not TYPE_ANY) - * 6) And target object does not match what we are looking for - * - * Then we have a type mismatch. Just warn and ignore it. - */ - if ((type_to_check_for != ACPI_TYPE_ANY) && - (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && - (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) - && (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) - && (this_node->type != ACPI_TYPE_ANY) - && (this_node->type != type_to_check_for)) { - - /* Complain about a type mismatch */ - - ACPI_WARNING((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", - ACPI_CAST_PTR(char, &simple_name), - acpi_ut_get_type_name(this_node-> - type), - acpi_ut_get_type_name - (type_to_check_for))); - } - - /* - * If this is the last name segment and we are not looking for a - * specific type, but the type of found object is known, use that type - * to (later) see if it opens a scope. - */ - if (type == ACPI_TYPE_ANY) { - type = this_node->type; - } + /* + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that type + * to see if it opens a scope. + */ + if ((num_segments == 0) && (type == ACPI_TYPE_ANY)) { + type = this_node->type; } /* Point to next name segment and make this node current */ diff --git a/trunk/drivers/acpi/namespace/nsalloc.c b/trunk/drivers/acpi/namespace/nsalloc.c index 3a1740ac2edc..1d693d8ad2d8 100644 --- a/trunk/drivers/acpi/namespace/nsalloc.c +++ b/trunk/drivers/acpi/namespace/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsdump.c b/trunk/drivers/acpi/namespace/nsdump.c index 5445751b8a3e..1fc4f86676e1 100644 --- a/trunk/drivers/acpi/namespace/nsdump.c +++ b/trunk/drivers/acpi/namespace/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -249,9 +249,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, acpi_os_printf("ID %X Len %.4X Addr %p\n", obj_desc->processor.proc_id, obj_desc->processor.length, - ACPI_CAST_PTR(void, - obj_desc->processor. - address)); + (char *)obj_desc->processor.address); break; case ACPI_TYPE_DEVICE: @@ -322,8 +320,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, space_id)); if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_NATIVE_UINT - (obj_desc->region.address), + ACPI_FORMAT_UINT64(obj_desc-> + region. + address), obj_desc->region.length); } else { acpi_os_printf diff --git a/trunk/drivers/acpi/namespace/nsdumpdv.c b/trunk/drivers/acpi/namespace/nsdumpdv.c index 428f50fde11a..5097e167939e 100644 --- a/trunk/drivers/acpi/namespace/nsdumpdv.c +++ b/trunk/drivers/acpi/namespace/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nseval.c b/trunk/drivers/acpi/namespace/nseval.c index 14bdfa92bea0..97b2ac57c16b 100644 --- a/trunk/drivers/acpi/namespace/nseval.c +++ b/trunk/drivers/acpi/namespace/nseval.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsinit.c b/trunk/drivers/acpi/namespace/nsinit.c index 6d6d930c8e18..33db2241044e 100644 --- a/trunk/drivers/acpi/namespace/nsinit.c +++ b/trunk/drivers/acpi/namespace/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -244,10 +244,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle, info->field_count++; break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - info->field_count++; - break; - case ACPI_TYPE_BUFFER: info->buffer_count++; break; @@ -291,12 +287,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle, status = acpi_ds_get_buffer_field_arguments(obj_desc); break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - - info->field_init++; - status = acpi_ds_get_bank_field_arguments(obj_desc); - break; - case ACPI_TYPE_BUFFER: info->buffer_init++; diff --git a/trunk/drivers/acpi/namespace/nsload.c b/trunk/drivers/acpi/namespace/nsload.c index 2c92f6cf5ce1..d4f9654fd20f 100644 --- a/trunk/drivers/acpi/namespace/nsload.c +++ b/trunk/drivers/acpi/namespace/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,11 +107,11 @@ acpi_ns_load_table(acpi_native_uint table_index, goto unlock; } - status = acpi_ns_parse_table(table_index, node); + status = acpi_ns_parse_table(table_index, node->child); if (ACPI_SUCCESS(status)) { acpi_tb_set_table_loaded_flag(table_index, TRUE); } else { - (void)acpi_tb_release_owner_id(table_index); + acpi_tb_release_owner_id(table_index); } unlock: diff --git a/trunk/drivers/acpi/namespace/nsnames.c b/trunk/drivers/acpi/namespace/nsnames.c index cffef1bcbdbc..cbd94af08cc5 100644 --- a/trunk/drivers/acpi/namespace/nsnames.c +++ b/trunk/drivers/acpi/namespace/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -180,12 +180,6 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) next_node = node; while (next_node && (next_node != acpi_gbl_root_node)) { - if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { - ACPI_ERROR((AE_INFO, - "Invalid NS Node (%p) while traversing path", - next_node)); - return 0; - } size += ACPI_PATH_SEGMENT_LENGTH; next_node = acpi_ns_get_parent_node(next_node); } diff --git a/trunk/drivers/acpi/namespace/nsobject.c b/trunk/drivers/acpi/namespace/nsobject.c index 15fe09e24f71..d9d7377bc6e6 100644 --- a/trunk/drivers/acpi/namespace/nsobject.c +++ b/trunk/drivers/acpi/namespace/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsparse.c b/trunk/drivers/acpi/namespace/nsparse.c index 46a79b0103b6..e696aa847990 100644 --- a/trunk/drivers/acpi/namespace/nsparse.c +++ b/trunk/drivers/acpi/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,8 +64,7 @@ ACPI_MODULE_NAME("nsparse") ******************************************************************************/ acpi_status acpi_ns_one_complete_parse(acpi_native_uint pass_number, - acpi_native_uint table_index, - struct acpi_namespace_node * start_node) + acpi_native_uint table_index) { union acpi_parse_object *parse_root; acpi_status status; @@ -112,25 +111,14 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, aml_start = (u8 *) table + sizeof(struct acpi_table_header); aml_length = table->length - sizeof(struct acpi_table_header); status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, - aml_start, (u32) aml_length, - NULL, (u8) pass_number); + aml_start, aml_length, NULL, + (u8) pass_number); } if (ACPI_FAILURE(status)) { acpi_ds_delete_walk_state(walk_state); - goto cleanup; - } - - /* start_node is the default location to load the table */ - - if (start_node && start_node != acpi_gbl_root_node) { - status = - acpi_ds_scope_stack_push(start_node, ACPI_TYPE_METHOD, - walk_state); - if (ACPI_FAILURE(status)) { - acpi_ds_delete_walk_state(walk_state); - goto cleanup; - } + acpi_ps_delete_parse_tree(parse_root); + return_ACPI_STATUS(status); } /* Parse the AML */ @@ -139,7 +127,6 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, (unsigned)pass_number)); status = acpi_ps_parse_aml(walk_state); - cleanup: acpi_ps_delete_parse_tree(parse_root); return_ACPI_STATUS(status); } @@ -176,9 +163,7 @@ acpi_ns_parse_table(acpi_native_uint table_index, * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); - status = - acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index, - start_node); + status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -193,9 +178,7 @@ acpi_ns_parse_table(acpi_native_uint table_index, * parse objects are all cached. */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); - status = - acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index, - start_node); + status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/trunk/drivers/acpi/namespace/nssearch.c b/trunk/drivers/acpi/namespace/nssearch.c index 8399276cba1e..e863be665ce8 100644 --- a/trunk/drivers/acpi/namespace/nssearch.c +++ b/trunk/drivers/acpi/namespace/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsutils.c b/trunk/drivers/acpi/namespace/nsutils.c index 64c039843ed2..90fd059615ff 100644 --- a/trunk/drivers/acpi/namespace/nsutils.c +++ b/trunk/drivers/acpi/namespace/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nswalk.c b/trunk/drivers/acpi/namespace/nswalk.c index 3c905ce26d7d..280b8357c46c 100644 --- a/trunk/drivers/acpi/namespace/nswalk.c +++ b/trunk/drivers/acpi/namespace/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,7 +77,9 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct /* It's really the parent's _scope_ that we want */ - next_node = parent_node->child; + if (parent_node->child) { + next_node = parent_node->child; + } } else { diff --git a/trunk/drivers/acpi/namespace/nsxfeval.c b/trunk/drivers/acpi/namespace/nsxfeval.c index a8d549187c84..b92133faf5b7 100644 --- a/trunk/drivers/acpi/namespace/nsxfeval.c +++ b/trunk/drivers/acpi/namespace/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -467,13 +467,10 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, return (AE_CTRL_DEPTH); } - if (!(flags & ACPI_STA_DEVICE_PRESENT) && - !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { - /* - * Don't examine the children of the device only when the - * device is neither present nor functional. See ACPI spec, - * description of _STA for more information. - */ + if (!(flags & ACPI_STA_DEVICE_PRESENT)) { + + /* Don't examine children of the device if not present */ + return (AE_CTRL_DEPTH); } @@ -542,7 +539,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, * value is returned to the caller. * * This is a wrapper for walk_namespace, but the callback performs - * additional filtering. Please see acpi_ns_get_device_callback. + * additional filtering. Please see acpi_get_device_callback. * ******************************************************************************/ diff --git a/trunk/drivers/acpi/namespace/nsxfname.c b/trunk/drivers/acpi/namespace/nsxfname.c index a287ed550f54..b489781b22a8 100644 --- a/trunk/drivers/acpi/namespace/nsxfname.c +++ b/trunk/drivers/acpi/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/namespace/nsxfobj.c b/trunk/drivers/acpi/namespace/nsxfobj.c index 2b375ee80cef..faa375887201 100644 --- a/trunk/drivers/acpi/namespace/nsxfobj.c +++ b/trunk/drivers/acpi/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 235a1386888a..a498a6cc68fe 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -742,7 +742,6 @@ EXPORT_SYMBOL(acpi_os_execute); void acpi_os_wait_events_complete(void *context) { flush_workqueue(kacpid_wq); - flush_workqueue(kacpi_notify_wq); } EXPORT_SYMBOL(acpi_os_wait_events_complete); diff --git a/trunk/drivers/acpi/parser/psargs.c b/trunk/drivers/acpi/parser/psargs.c index f1e8bf65e24e..c2b9835c890b 100644 --- a/trunk/drivers/acpi/parser/psargs.c +++ b/trunk/drivers/acpi/parser/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -230,12 +230,12 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, struct acpi_parse_state *parser_state, union acpi_parse_object *arg, u8 possible_method_call) { - acpi_status status; char *path; union acpi_parse_object *name_op; + acpi_status status; union acpi_operand_object *method_desc; struct acpi_namespace_node *node; - u8 *start = parser_state->aml; + union acpi_generic_state scope_info; ACPI_FUNCTION_TRACE(ps_get_next_namepath); @@ -249,18 +249,25 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, return_ACPI_STATUS(AE_OK); } + /* Setup search scope info */ + + scope_info.scope.node = NULL; + node = parser_state->start_node; + if (node) { + scope_info.scope.node = node; + } + /* - * Lookup the name in the internal namespace, starting with the current - * scope. We don't want to add anything new to the namespace here, - * however, so we use MODE_EXECUTE. + * Lookup the name in the internal namespace. We don't want to add + * anything new to the namespace here, however, so we use MODE_EXECUTE. * Allow searching of the parent tree, but don't open a new scope - * we just want to lookup the object (must be mode EXECUTE to perform * the upsearch) */ - status = acpi_ns_lookup(walk_state->scope_info, path, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &node); + status = + acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &node); /* * If this name is a control method invocation, we must @@ -268,16 +275,6 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, */ if (ACPI_SUCCESS(status) && possible_method_call && (node->type == ACPI_TYPE_METHOD)) { - if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { - /* - * acpi_ps_get_next_namestring has increased the AML pointer, - * so we need to restore the saved AML pointer for method call. - */ - walk_state->parser_state.aml = start; - walk_state->arg_count = 1; - acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); - return_ACPI_STATUS(AE_OK); - } /* This name is actually a control method invocation */ @@ -689,29 +686,9 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, return_ACPI_STATUS(AE_NO_MEMORY); } - /* To support super_name arg of Unload */ - - if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { - status = - acpi_ps_get_next_namepath(walk_state, - parser_state, arg, - 1); - - /* - * If the super_name arg of Unload is a method call, - * we have restored the AML pointer, just free this Arg - */ - if (arg->common.aml_opcode == - AML_INT_METHODCALL_OP) { - acpi_ps_free_op(arg); - arg = NULL; - } - } else { - status = - acpi_ps_get_next_namepath(walk_state, - parser_state, arg, - 0); - } + status = + acpi_ps_get_next_namepath(walk_state, parser_state, + arg, 0); } else { /* Single complex argument, nothing returned */ diff --git a/trunk/drivers/acpi/parser/psloop.c b/trunk/drivers/acpi/parser/psloop.c index c06238e55d98..773aee82fbb8 100644 --- a/trunk/drivers/acpi/parser/psloop.c +++ b/trunk/drivers/acpi/parser/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -182,7 +182,6 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); unnamed_op->common.value.arg = NULL; - unnamed_op->common.arg_list_length = 0; unnamed_op->common.aml_opcode = walk_state->opcode; /* @@ -242,8 +241,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, acpi_ps_append_arg(*op, unnamed_op->common.value.arg); acpi_gbl_depth++; - if ((*op)->common.aml_opcode == AML_REGION_OP || - (*op)->common.aml_opcode == AML_DATA_REGION_OP) { + if ((*op)->common.aml_opcode == AML_REGION_OP) { /* * Defer final parsing of an operation_region body, because we don't * have enough info in the first pass to parse it correctly (i.e., @@ -282,9 +280,6 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state, acpi_status status = AE_OK; union acpi_parse_object *op; union acpi_parse_object *named_op = NULL; - union acpi_parse_object *parent_scope; - u8 argument_count; - const struct acpi_opcode_info *op_info; ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); @@ -325,32 +320,8 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state, op->named.length = 0; } - if (walk_state->opcode == AML_BANK_FIELD_OP) { - /* - * Backup to beginning of bank_field declaration - * body_length is unknown until we parse the body - */ - op->named.data = aml_op_start; - op->named.length = 0; - } - - parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state)); - acpi_ps_append_arg(parent_scope, op); - - if (parent_scope) { - op_info = - acpi_ps_get_opcode_info(parent_scope->common.aml_opcode); - if (op_info->flags & AML_HAS_TARGET) { - argument_count = - acpi_ps_get_argument_count(op_info->type); - if (parent_scope->common.arg_list_length > - argument_count) { - op->common.flags |= ACPI_PARSEOP_TARGET; - } - } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) { - op->common.flags |= ACPI_PARSEOP_TARGET; - } - } + acpi_ps_append_arg(acpi_ps_get_parent_scope + (&(walk_state->parser_state)), op); if (walk_state->descending_callback != NULL) { /* @@ -632,6 +603,13 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state, acpi_ps_pop_scope(&(walk_state->parser_state), op, &walk_state->arg_types, &walk_state->arg_count); + + if ((*op)->common.aml_opcode != AML_WHILE_OP) { + status2 = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); + } + } } /* Close this iteration of the While loop */ @@ -662,6 +640,10 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state, if (ACPI_FAILURE(status2)) { return_ACPI_STATUS(status2); } + status2 = acpi_ds_result_stack_pop(walk_state); + if (ACPI_FAILURE(status2)) { + return_ACPI_STATUS(status2); + } acpi_ut_delete_generic_state (acpi_ut_pop_generic_state @@ -1023,8 +1005,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) acpi_gbl_depth--; } - if (op->common.aml_opcode == AML_REGION_OP || - op->common.aml_opcode == AML_DATA_REGION_OP) { + if (op->common.aml_opcode == AML_REGION_OP) { /* * Skip parsing of control method or opregion body, * because we don't have enough info in the first pass @@ -1049,16 +1030,6 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) (u32) (parser_state->aml - op->named.data); } - if (op->common.aml_opcode == AML_BANK_FIELD_OP) { - /* - * Backup to beginning of bank_field declaration - * - * body_length is unknown until we parse the body - */ - op->named.length = - (u32) (parser_state->aml - op->named.data); - } - /* This op complete, notify the dispatcher */ if (walk_state->ascending_callback != NULL) { diff --git a/trunk/drivers/acpi/parser/psopcode.c b/trunk/drivers/acpi/parser/psopcode.c index f425ab30eae8..9296e86761d7 100644 --- a/trunk/drivers/acpi/parser/psopcode.c +++ b/trunk/drivers/acpi/parser/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,9 +49,6 @@ #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME("psopcode") -static const u8 acpi_gbl_argument_count[] = - { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 }; - /******************************************************************************* * * NAME: acpi_gbl_aml_op_info @@ -62,7 +59,6 @@ static const u8 acpi_gbl_argument_count[] = * the operand type. * ******************************************************************************/ - /* * Summary of opcode types/flags * @@ -180,7 +176,6 @@ static const u8 acpi_gbl_argument_count[] = AML_CREATE_QWORD_FIELD_OP ******************************************************************************/ - /* * Master Opcode information table. A summary of everything we know about each * opcode, all in one place. @@ -520,10 +515,9 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, - ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, + ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | - AML_DEFER), + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), /* Internal opcodes that map to invalid AML opcodes */ @@ -625,9 +619,9 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, - AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED | AML_DEFER), + AML_NSNODE | AML_NAMED), /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, @@ -785,25 +779,3 @@ char *acpi_ps_get_opcode_name(u16 opcode) #endif } - -/******************************************************************************* - * - * FUNCTION: acpi_ps_get_argument_count - * - * PARAMETERS: op_type - Type associated with the AML opcode - * - * RETURN: Argument count - * - * DESCRIPTION: Obtain the number of expected arguments for an AML opcode - * - ******************************************************************************/ - -u8 acpi_ps_get_argument_count(u32 op_type) -{ - - if (op_type <= AML_TYPE_EXEC_6A_0T_1R) { - return (acpi_gbl_argument_count[op_type]); - } - - return (0); -} diff --git a/trunk/drivers/acpi/parser/psparse.c b/trunk/drivers/acpi/parser/psparse.c index 15e1702e48d6..5d63f48e56b5 100644 --- a/trunk/drivers/acpi/parser/psparse.c +++ b/trunk/drivers/acpi/parser/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -204,8 +204,6 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, AML_BUFFER_OP) || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) - || (op->common.parent->common.aml_opcode == - AML_BANK_FIELD_OP) || (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { replacement_op = @@ -351,13 +349,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, parser_state->aml = walk_state->aml_last_while; walk_state->control_state->common.value = FALSE; - status = AE_CTRL_BREAK; + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_BREAK; + } break; case AE_CTRL_CONTINUE: parser_state->aml = walk_state->aml_last_while; - status = AE_CTRL_CONTINUE; + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_CONTINUE; + } break; case AE_CTRL_PENDING: @@ -379,7 +383,10 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, * Just close out this package */ parser_state->aml = acpi_ps_get_next_package_end(parser_state); - status = AE_CTRL_PENDING; + status = acpi_ds_result_stack_pop(walk_state); + if (ACPI_SUCCESS(status)) { + status = AE_CTRL_PENDING; + } break; case AE_CTRL_FALSE: @@ -534,7 +541,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) if ((status == AE_ALREADY_EXISTS) && (!walk_state->method_desc->method.mutex)) { ACPI_INFO((AE_INFO, - "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", + "Marking method %4.4s as Serialized", walk_state->method_node->name. ascii)); @@ -594,30 +601,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) * The object is deleted */ if (!previous_walk_state->return_desc) { - /* - * In slack mode execution, if there is no return value - * we should implicitly return zero (0) as a default value. - */ - if (acpi_gbl_enable_interpreter_slack && - !previous_walk_state-> - implicit_return_obj) { - previous_walk_state-> - implicit_return_obj = - acpi_ut_create_internal_object - (ACPI_TYPE_INTEGER); - if (!previous_walk_state-> - implicit_return_obj) { - return_ACPI_STATUS - (AE_NO_MEMORY); - } - - previous_walk_state-> - implicit_return_obj-> - integer.value = 0; - } - - /* Restart the calling control method */ - status = acpi_ds_restart_control_method (walk_state, diff --git a/trunk/drivers/acpi/parser/psscope.c b/trunk/drivers/acpi/parser/psscope.c index ee50e67c9443..77cfa4ed0cfe 100644 --- a/trunk/drivers/acpi/parser/psscope.c +++ b/trunk/drivers/acpi/parser/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/pstree.c b/trunk/drivers/acpi/parser/pstree.c index 1dd355ddd182..966e7ea2a0c4 100644 --- a/trunk/drivers/acpi/parser/pstree.c +++ b/trunk/drivers/acpi/parser/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -171,8 +171,6 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) while (arg) { arg->common.parent = op; arg = arg->common.next; - - op->common.arg_list_length++; } } diff --git a/trunk/drivers/acpi/parser/psutils.c b/trunk/drivers/acpi/parser/psutils.c index 7cf1f65cd5bb..8ca52002db55 100644 --- a/trunk/drivers/acpi/parser/psutils.c +++ b/trunk/drivers/acpi/parser/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/pswalk.c b/trunk/drivers/acpi/parser/pswalk.c index 8b86ad5a3201..49f9757434e4 100644 --- a/trunk/drivers/acpi/parser/pswalk.c +++ b/trunk/drivers/acpi/parser/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/parser/psxface.c b/trunk/drivers/acpi/parser/psxface.c index 52581454c47c..94103bced75e 100644 --- a/trunk/drivers/acpi/parser/psxface.c +++ b/trunk/drivers/acpi/parser/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/power.c b/trunk/drivers/acpi/power.c index f2a76acecfcd..76bf6d90c700 100644 --- a/trunk/drivers/acpi/power.c +++ b/trunk/drivers/acpi/power.c @@ -121,7 +121,7 @@ acpi_power_get_context(acpi_handle handle, } *resource = acpi_driver_data(device); - if (!*resource) + if (!resource) return -ENODEV; return 0; diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index ea5f628dcc15..a825b431b64f 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -674,21 +674,22 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) result = PTR_ERR(pr->cdev); goto end; } - - printk(KERN_INFO PREFIX - "%s is registered as cooling_device%d\n", - device->dev.bus_id, pr->cdev->id); - - result = sysfs_create_link(&device->dev.kobj, - &pr->cdev->device.kobj, - "thermal_cooling"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); - result = sysfs_create_link(&pr->cdev->device.kobj, - &device->dev.kobj, - "device"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); + if (pr->cdev) { + printk(KERN_INFO PREFIX + "%s is registered as cooling_device%d\n", + device->dev.bus_id, pr->cdev->id); + + result = sysfs_create_link(&device->dev.kobj, + &pr->cdev->device.kobj, + "thermal_cooling"); + if (result) + return result; + result = sysfs_create_link(&pr->cdev->device.kobj, + &device->dev.kobj, + "device"); + if (result) + return result; + } if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index 55d69dce47c4..0d90ff5fd117 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -847,7 +847,6 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) /* all processors need to support C1 */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; pr->power.states[ACPI_STATE_C1].valid = 1; - pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT; } /* the C0 state only exists as a filler in our array */ pr->power.states[ACPI_STATE_C0].valid = 1; @@ -960,9 +959,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) cx.address); } - if (cx.type == ACPI_STATE_C1) { - cx.valid = 1; - } obj = &(element->package.elements[2]); if (obj->type != ACPI_TYPE_INTEGER) @@ -1298,8 +1294,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int result = 0; - if (boot_option_idle_override) - return 0; if (!pr) return -EINVAL; @@ -1739,9 +1733,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int ret; - if (boot_option_idle_override) - return 0; - if (!pr) return -EINVAL; @@ -1772,8 +1763,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, struct proc_dir_entry *entry = NULL; unsigned int i; - if (boot_option_idle_override) - return 0; if (!first_run) { dmi_check_system(processor_power_dmi_table); @@ -1809,7 +1798,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, * Note that we use previously set idle handler will be used on * platforms that only support C1. */ - if (pr->flags.power) { + if ((pr->flags.power) && (!boot_option_idle_override)) { #ifdef CONFIG_CPU_IDLE acpi_processor_setup_cpuidle(pr); pr->power.dev.cpu = pr->id; @@ -1849,11 +1838,8 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) { - if (boot_option_idle_override) - return 0; - #ifdef CONFIG_CPU_IDLE - if (pr->flags.power) + if ((pr->flags.power) && (!boot_option_idle_override)) cpuidle_unregister_device(&pr->power.dev); #endif pr->flags.power_setup_done = 0; diff --git a/trunk/drivers/acpi/resources/rsaddr.c b/trunk/drivers/acpi/resources/rsaddr.c index 7f96332822bf..271e61509eeb 100644 --- a/trunk/drivers/acpi/resources/rsaddr.c +++ b/trunk/drivers/acpi/resources/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/resources/rscalc.c b/trunk/drivers/acpi/resources/rscalc.c index 8a112d11d491..0dd2ce8a3475 100644 --- a/trunk/drivers/acpi/resources/rscalc.c +++ b/trunk/drivers/acpi/resources/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,7 +73,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); static u8 acpi_rs_count_set_bits(u16 bit_field) { - acpi_native_uint bits_set; + u8 bits_set; ACPI_FUNCTION_ENTRY(); @@ -81,10 +81,10 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) /* Zero the least significant bit that is set */ - bit_field &= (u16) (bit_field - 1); + bit_field &= (bit_field - 1); } - return ((u8) bits_set); + return (bits_set); } /******************************************************************************* @@ -211,24 +211,6 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) * variable-length fields */ switch (resource->type) { - case ACPI_RESOURCE_TYPE_IRQ: - - /* Length can be 3 or 2 */ - - if (resource->data.irq.descriptor_length == 2) { - total_size--; - } - break; - - case ACPI_RESOURCE_TYPE_START_DEPENDENT: - - /* Length can be 1 or 0 */ - - if (resource->data.irq.descriptor_length == 0) { - total_size--; - } - break; - case ACPI_RESOURCE_TYPE_VENDOR: /* * Vendor Defined Resource: diff --git a/trunk/drivers/acpi/resources/rscreate.c b/trunk/drivers/acpi/resources/rscreate.c index faddaee1bc07..50da494c3ee2 100644 --- a/trunk/drivers/acpi/resources/rscreate.c +++ b/trunk/drivers/acpi/resources/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/resources/rsdump.c b/trunk/drivers/acpi/resources/rsdump.c index 6bbbb7b8941a..46da116a4030 100644 --- a/trunk/drivers/acpi/resources/rsdump.c +++ b/trunk/drivers/acpi/resources/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,10 +87,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); * ******************************************************************************/ -struct acpi_rsdump_info acpi_rs_dump_irq[7] = { +struct acpi_rsdump_info acpi_rs_dump_irq[6] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length), - "Descriptor Length", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", acpi_gbl_he_decode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", @@ -117,11 +115,9 @@ struct acpi_rsdump_info acpi_rs_dump_dma[6] = { NULL} }; -struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = { +struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), "Start-Dependent-Functions", NULL}, - {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length), - "Descriptor Length", NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), "Compatibility Priority", acpi_gbl_config_decode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), diff --git a/trunk/drivers/acpi/resources/rsinfo.c b/trunk/drivers/acpi/resources/rsinfo.c index 3f0a1fedbe0e..2c2adb6292c1 100644 --- a/trunk/drivers/acpi/resources/rsinfo.c +++ b/trunk/drivers/acpi/resources/rsinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/resources/rsio.c b/trunk/drivers/acpi/resources/rsio.c index b66d42e7402e..b297bc3e4419 100644 --- a/trunk/drivers/acpi/resources/rsio.c +++ b/trunk/drivers/acpi/resources/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -185,7 +185,7 @@ struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { * ******************************************************************************/ -struct acpi_rsconvert_info acpi_rs_get_start_dpf[6] = { +struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, ACPI_RS_SIZE(struct acpi_resource_start_dependent), ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, @@ -196,12 +196,6 @@ struct acpi_rsconvert_info acpi_rs_get_start_dpf[6] = { ACPI_ACCEPTABLE_CONFIGURATION, 2}, - /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */ - - {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.start_dpf.descriptor_length), - AML_OFFSET(start_dpf.descriptor_type), - 0}, - /* All done if there is no flag byte present in the descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, @@ -225,9 +219,7 @@ struct acpi_rsconvert_info acpi_rs_get_start_dpf[6] = { * ******************************************************************************/ -struct acpi_rsconvert_info acpi_rs_set_start_dpf[10] = { - /* Start with a default descriptor of length 1 */ - +struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, sizeof(struct aml_resource_start_dependent), ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, @@ -243,33 +235,6 @@ struct acpi_rsconvert_info acpi_rs_set_start_dpf[10] = { ACPI_RS_OFFSET(data.start_dpf.performance_robustness), AML_OFFSET(start_dpf.flags), 2}, - /* - * All done if the output descriptor length is required to be 1 - * (i.e., optimization to 0 bytes cannot be attempted) - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.start_dpf.descriptor_length), - 1}, - - /* Set length to 0 bytes (no flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, - sizeof(struct aml_resource_start_dependent_noprio)}, - - /* - * All done if the output descriptor length is required to be 0. - * - * TBD: Perhaps we should check for error if input flags are not - * compatible with a 0-byte descriptor. - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.start_dpf.descriptor_length), - 0}, - - /* Reset length to 1 byte (descriptor with flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_start_dependent)}, - /* * All done if flags byte is necessary -- if either priority value * is not ACPI_ACCEPTABLE_CONFIGURATION diff --git a/trunk/drivers/acpi/resources/rsirq.c b/trunk/drivers/acpi/resources/rsirq.c index a8805efc0366..5657f7b95039 100644 --- a/trunk/drivers/acpi/resources/rsirq.c +++ b/trunk/drivers/acpi/resources/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,7 +52,7 @@ ACPI_MODULE_NAME("rsirq") * acpi_rs_get_irq * ******************************************************************************/ -struct acpi_rsconvert_info acpi_rs_get_irq[8] = { +struct acpi_rsconvert_info acpi_rs_get_irq[7] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, ACPI_RS_SIZE(struct acpi_resource_irq), ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, @@ -69,12 +69,6 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = { ACPI_EDGE_SENSITIVE, 1}, - /* Get the descriptor length (2 or 3 for IRQ descriptor) */ - - {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.descriptor_length), - AML_OFFSET(irq.descriptor_type), - 0}, - /* All done if no flag byte present in descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, @@ -100,9 +94,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = { * ******************************************************************************/ -struct acpi_rsconvert_info acpi_rs_set_irq[13] = { - /* Start with a default descriptor of length 3 */ - +struct acpi_rsconvert_info acpi_rs_set_irq[9] = { {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, sizeof(struct aml_resource_irq), ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, @@ -113,7 +105,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { AML_OFFSET(irq.irq_mask), ACPI_RS_OFFSET(data.irq.interrupt_count)}, - /* Set the flags byte */ + /* Set the flags byte by default */ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), AML_OFFSET(irq.flags), @@ -126,33 +118,6 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), AML_OFFSET(irq.flags), 4}, - - /* - * All done if the output descriptor length is required to be 3 - * (i.e., optimization to 2 bytes cannot be attempted) - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.irq.descriptor_length), - 3}, - - /* Set length to 2 bytes (no flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)}, - - /* - * All done if the output descriptor length is required to be 2. - * - * TBD: Perhaps we should check for error if input flags are not - * compatible with a 2-byte descriptor. - */ - {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, - ACPI_RS_OFFSET(data.irq.descriptor_length), - 2}, - - /* Reset length to 3 bytes (descriptor with flags byte) */ - - {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq)}, - /* * Check if the flags byte is necessary. Not needed if the flags are: * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE @@ -169,7 +134,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = { ACPI_RS_OFFSET(data.irq.sharable), ACPI_EXCLUSIVE}, - /* We can optimize to a 2-byte irq_no_flags() descriptor */ + /* irq_no_flags() descriptor can be used */ {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} }; diff --git a/trunk/drivers/acpi/resources/rslist.c b/trunk/drivers/acpi/resources/rslist.c index b78c7e797a19..ca21e4660c79 100644 --- a/trunk/drivers/acpi/resources/rslist.c +++ b/trunk/drivers/acpi/resources/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/resources/rsmemory.c b/trunk/drivers/acpi/resources/rsmemory.c index 63b21abd90bb..521eab7dd8df 100644 --- a/trunk/drivers/acpi/resources/rsmemory.c +++ b/trunk/drivers/acpi/resources/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/resources/rsmisc.c b/trunk/drivers/acpi/resources/rsmisc.c index de1ac3881b22..c7081afa893a 100644 --- a/trunk/drivers/acpi/resources/rsmisc.c +++ b/trunk/drivers/acpi/resources/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -497,17 +497,6 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, } break; - case ACPI_RSC_EXIT_EQ: - /* - * Control - Exit conversion if equal - */ - if (*ACPI_ADD_PTR(u8, resource, - COMPARE_TARGET(info)) == - COMPARE_VALUE(info)) { - goto exit; - } - break; - default: ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); diff --git a/trunk/drivers/acpi/resources/rsutils.c b/trunk/drivers/acpi/resources/rsutils.c index befe2302f41b..11c0bd7b9cfd 100644 --- a/trunk/drivers/acpi/resources/rsutils.c +++ b/trunk/drivers/acpi/resources/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,17 +97,17 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) u16 acpi_rs_encode_bitmask(u8 * list, u8 count) { acpi_native_uint i; - acpi_native_uint mask; + u16 mask; ACPI_FUNCTION_ENTRY(); /* Encode the list into a single bitmask */ for (i = 0, mask = 0; i < count; i++) { - mask |= (0x1 << list[i]); + mask |= (0x0001 << list[i]); } - return ((u16) mask); + return (mask); } /******************************************************************************* diff --git a/trunk/drivers/acpi/resources/rsxface.c b/trunk/drivers/acpi/resources/rsxface.c index f59f4c4e034c..4c3fd4cdaf73 100644 --- a/trunk/drivers/acpi/resources/rsxface.c +++ b/trunk/drivers/acpi/resources/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index 6d85289f1c12..e6ce262b5d44 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -677,8 +677,9 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, device->wakeup.resources.count = package->package.count - 2; for (i = 0; i < device->wakeup.resources.count; i++) { element = &(package->package.elements[i + 2]); - if (element->type != ACPI_TYPE_LOCAL_REFERENCE) + if (element->type != ACPI_TYPE_ANY) { return AE_BAD_DATA; + } device->wakeup.resources.handles[i] = element->reference.handle; } @@ -691,9 +692,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) acpi_status status = 0; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *package = NULL; - union acpi_object in_arg[3]; - struct acpi_object_list arg_list = { 3, in_arg }; - acpi_status psw_status = AE_OK; struct acpi_device_id button_device_ids[] = { {"PNP0C0D", 0}, @@ -702,6 +700,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) {"", 0}, }; + /* _PRW */ status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); if (ACPI_FAILURE(status)) { @@ -719,45 +718,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) kfree(buffer.pointer); device->wakeup.flags.valid = 1; - /* Call _PSW/_DSW object to disable its ability to wake the sleeping - * system for the ACPI device with the _PRW object. - * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. - * So it is necessary to call _DSW object first. Only when it is not - * present will the _PSW object used. - */ - /* - * Three agruments are needed for the _DSW object. - * Argument 0: enable/disable the wake capabilities - * When _DSW object is called to disable the wake capabilities, maybe - * the first argument is filled. The value of the other two agruments - * is meaningless. - */ - in_arg[0].type = ACPI_TYPE_INTEGER; - in_arg[0].integer.value = 0; - in_arg[1].type = ACPI_TYPE_INTEGER; - in_arg[1].integer.value = 0; - in_arg[2].type = ACPI_TYPE_INTEGER; - in_arg[2].integer.value = 0; - psw_status = acpi_evaluate_object(device->handle, "_DSW", - &arg_list, NULL); - if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); - /* - * When the _DSW object is not present, OSPM will call _PSW object. - */ - if (psw_status == AE_NOT_FOUND) { - /* - * Only one agruments is required for the _PSW object. - * agrument 0: enable/disable the wake capabilities - */ - arg_list.count = 1; - in_arg[0].integer.value = 0; - psw_status = acpi_evaluate_object(device->handle, "_PSW", - &arg_list, NULL); - if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " - "evaluate _PSW\n")); - } /* Power button, Lid switch always enable wakeup */ if (!acpi_match_device_ids(device, button_device_ids)) device->wakeup.flags.run_wake = 1; @@ -922,7 +882,10 @@ static void acpi_device_get_busid(struct acpi_device *device, static int acpi_video_bus_match(struct acpi_device *device) { - acpi_handle h_dummy; + acpi_handle h_dummy1; + acpi_handle h_dummy2; + acpi_handle h_dummy3; + if (!device) return -EINVAL; @@ -932,18 +895,18 @@ acpi_video_bus_match(struct acpi_device *device) */ /* Does this device able to support video switching ? */ - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && - ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && + ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) return 0; /* Does this device able to retrieve a video ROM ? */ - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) return 0; /* Does this device able to configure which video head to be POSTed ? */ - if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && - ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && - ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) + if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && + ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && + ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) return 0; return -ENODEV; diff --git a/trunk/drivers/acpi/sleep/main.c b/trunk/drivers/acpi/sleep/main.c index c3b0cd88d09f..71183eea7906 100644 --- a/trunk/drivers/acpi/sleep/main.c +++ b/trunk/drivers/acpi/sleep/main.c @@ -51,7 +51,7 @@ static int acpi_sleep_prepare(u32 acpi_state) } #ifdef CONFIG_SUSPEND -static struct platform_suspend_ops acpi_suspend_ops; +static struct platform_suspend_ops acpi_pm_ops; extern void do_suspend_lowlevel(void); @@ -65,11 +65,11 @@ static u32 acpi_suspend_states[] = { static int init_8259A_after_S1; /** - * acpi_suspend_begin - Set the target system sleep state to the state + * acpi_pm_begin - Set the target system sleep state to the state * associated with given @pm_state, if supported. */ -static int acpi_suspend_begin(suspend_state_t pm_state) +static int acpi_pm_begin(suspend_state_t pm_state) { u32 acpi_state = acpi_suspend_states[pm_state]; int error = 0; @@ -85,13 +85,13 @@ static int acpi_suspend_begin(suspend_state_t pm_state) } /** - * acpi_suspend_prepare - Do preliminary suspend work. + * acpi_pm_prepare - Do preliminary suspend work. * * If necessary, set the firmware waking vector and do arch-specific * nastiness to get the wakeup code to the waking vector. */ -static int acpi_suspend_prepare(void) +static int acpi_pm_prepare(void) { int error = acpi_sleep_prepare(acpi_target_sleep_state); @@ -104,7 +104,7 @@ static int acpi_suspend_prepare(void) } /** - * acpi_suspend_enter - Actually enter a sleep state. + * acpi_pm_enter - Actually enter a sleep state. * @pm_state: ignored * * Flush caches and go to sleep. For STR we have to call arch-specific @@ -112,7 +112,7 @@ static int acpi_suspend_prepare(void) * It's unfortunate, but it works. Please fix if you're feeling frisky. */ -static int acpi_suspend_enter(suspend_state_t pm_state) +static int acpi_pm_enter(suspend_state_t pm_state) { acpi_status status = AE_OK; unsigned long flags = 0; @@ -169,13 +169,13 @@ static int acpi_suspend_enter(suspend_state_t pm_state) } /** - * acpi_suspend_finish - Instruct the platform to leave a sleep state. + * acpi_pm_finish - Instruct the platform to leave a sleep state. * * This is called after we wake back up (or if entering the sleep state * failed). */ -static void acpi_suspend_finish(void) +static void acpi_pm_finish(void) { u32 acpi_state = acpi_target_sleep_state; @@ -196,19 +196,19 @@ static void acpi_suspend_finish(void) } /** - * acpi_suspend_end - Finish up suspend sequence. + * acpi_pm_end - Finish up suspend sequence. */ -static void acpi_suspend_end(void) +static void acpi_pm_end(void) { /* - * This is necessary in case acpi_suspend_finish() is not called during a + * This is necessary in case acpi_pm_finish() is not called during a * failing transition to a sleep state. */ acpi_target_sleep_state = ACPI_STATE_S0; } -static int acpi_suspend_state_valid(suspend_state_t pm_state) +static int acpi_pm_state_valid(suspend_state_t pm_state) { u32 acpi_state; @@ -224,13 +224,13 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) } } -static struct platform_suspend_ops acpi_suspend_ops = { - .valid = acpi_suspend_state_valid, - .begin = acpi_suspend_begin, - .prepare = acpi_suspend_prepare, - .enter = acpi_suspend_enter, - .finish = acpi_suspend_finish, - .end = acpi_suspend_end, +static struct platform_suspend_ops acpi_pm_ops = { + .valid = acpi_pm_state_valid, + .begin = acpi_pm_begin, + .prepare = acpi_pm_prepare, + .enter = acpi_pm_enter, + .finish = acpi_pm_finish, + .end = acpi_pm_end, }; /* @@ -492,7 +492,7 @@ int __init acpi_sleep_init(void) } } - suspend_set_ops(&acpi_suspend_ops); + suspend_set_ops(&acpi_pm_ops); #endif #ifdef CONFIG_HIBERNATION diff --git a/trunk/drivers/acpi/tables/tbfadt.c b/trunk/drivers/acpi/tables/tbfadt.c index 949d4114eb9f..002bb33003af 100644 --- a/trunk/drivers/acpi/tables/tbfadt.c +++ b/trunk/drivers/acpi/tables/tbfadt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/tables/tbfind.c b/trunk/drivers/acpi/tables/tbfind.c index 9ca3afc98c80..058c064948e1 100644 --- a/trunk/drivers/acpi/tables/tbfind.c +++ b/trunk/drivers/acpi/tables/tbfind.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,22 +70,12 @@ acpi_tb_find_table(char *signature, { acpi_native_uint i; acpi_status status; - struct acpi_table_header header; ACPI_FUNCTION_TRACE(tb_find_table); - /* Normalize the input strings */ - - ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); - ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE); - ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); - ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); - - /* Search for the table */ - for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), - header.signature, ACPI_NAME_SIZE)) { + signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -114,24 +104,20 @@ acpi_tb_find_table(char *signature, if (!ACPI_MEMCMP (acpi_gbl_root_table_list.tables[i].pointer->signature, - header.signature, ACPI_NAME_SIZE) && (!oem_id[0] - || - !ACPI_MEMCMP - (acpi_gbl_root_table_list. - tables[i].pointer-> - oem_id, - header.oem_id, - ACPI_OEM_ID_SIZE)) + signature, ACPI_NAME_SIZE) && (!oem_id[0] + || + !ACPI_MEMCMP + (acpi_gbl_root_table_list. + tables[i].pointer->oem_id, + oem_id, ACPI_OEM_ID_SIZE)) && (!oem_table_id[0] || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. - pointer->oem_table_id, - header.oem_table_id, + pointer->oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE))) { *table_index = i; ACPI_DEBUG_PRINT((ACPI_DB_TABLES, - "Found table [%4.4s]\n", - header.signature)); + "Found table [%4.4s]\n", signature)); return_ACPI_STATUS(AE_OK); } } diff --git a/trunk/drivers/acpi/tables/tbinstal.c b/trunk/drivers/acpi/tables/tbinstal.c index 402f93e1ff20..3bc0c67a9283 100644 --- a/trunk/drivers/acpi/tables/tbinstal.c +++ b/trunk/drivers/acpi/tables/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,20 +125,13 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, /* The table must be either an SSDT or a PSDT or an OEMx */ - if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&& - !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&& - strncmp(table_desc->pointer->signature, "OEM", 3)) { - /* Check for a printable name */ - if (acpi_ut_valid_acpi_name( - *(u32 *) table_desc->pointer->signature)) { - ACPI_ERROR((AE_INFO, "Table has invalid signature " - "[%4.4s], must be SSDT or PSDT", - table_desc->pointer->signature)); - } else { - ACPI_ERROR((AE_INFO, "Table has invalid signature " - "(0x%8.8X), must be SSDT or PSDT", - *(u32 *) table_desc->pointer->signature)); - } + if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) + && + (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)) + && (strncmp(table_desc->pointer->signature, "OEM", 3))) { + ACPI_ERROR((AE_INFO, + "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", + table_desc->pointer->signature)); return_ACPI_STATUS(AE_BAD_SIGNATURE); } @@ -169,7 +162,6 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, acpi_tb_delete_table(table_desc); *table_index = i; - status = AE_ALREADY_EXISTS; goto release; } diff --git a/trunk/drivers/acpi/tables/tbutils.c b/trunk/drivers/acpi/tables/tbutils.c index bc019b9b6a68..010f19652f80 100644 --- a/trunk/drivers/acpi/tables/tbutils.c +++ b/trunk/drivers/acpi/tables/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -212,7 +212,7 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) if (checksum) { ACPI_WARNING((AE_INFO, - "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", + "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", table->signature, table->checksum, (u8) (table->checksum - checksum))); diff --git a/trunk/drivers/acpi/tables/tbxface.c b/trunk/drivers/acpi/tables/tbxface.c index fb57b93c2495..a9e3331fee5d 100644 --- a/trunk/drivers/acpi/tables/tbxface.c +++ b/trunk/drivers/acpi/tables/tbxface.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -635,95 +635,6 @@ acpi_status acpi_load_tables(void) ACPI_EXPORT_SYMBOL(acpi_load_tables) -/******************************************************************************* - * - * FUNCTION: acpi_install_table_handler - * - * PARAMETERS: Handler - Table event handler - * Context - Value passed to the handler on each event - * - * RETURN: Status - * - * DESCRIPTION: Install table event handler - * - ******************************************************************************/ -acpi_status -acpi_install_table_handler(acpi_tbl_handler handler, void *context) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_install_table_handler); - - if (!handler) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Don't allow more than one handler */ - - if (acpi_gbl_table_handler) { - status = AE_ALREADY_EXISTS; - goto cleanup; - } - - /* Install the handler */ - - acpi_gbl_table_handler = handler; - acpi_gbl_table_handler_context = context; - - cleanup: - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - return_ACPI_STATUS(status); -} - -ACPI_EXPORT_SYMBOL(acpi_install_table_handler) - -/******************************************************************************* - * - * FUNCTION: acpi_remove_table_handler - * - * PARAMETERS: Handler - Table event handler that was installed - * previously. - * - * RETURN: Status - * - * DESCRIPTION: Remove table event handler - * - ******************************************************************************/ -acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_remove_table_handler); - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Make sure that the installed handler is the same */ - - if (!handler || handler != acpi_gbl_table_handler) { - status = AE_BAD_PARAMETER; - goto cleanup; - } - - /* Remove the handler */ - - acpi_gbl_table_handler = NULL; - - cleanup: - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - return_ACPI_STATUS(status); -} - -ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) - - static int __init acpi_no_auto_ssdt_setup(char *s) { printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); diff --git a/trunk/drivers/acpi/tables/tbxfroot.c b/trunk/drivers/acpi/tables/tbxfroot.c index b8c0dfa084f6..9ecb4b6c1e7d 100644 --- a/trunk/drivers/acpi/tables/tbxfroot.c +++ b/trunk/drivers/acpi/tables/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index 782c2250443e..766bd25d3376 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -884,15 +884,10 @@ static void acpi_thermal_check(void *data) static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) { struct acpi_thermal *tz = thermal->devdata; - int result; if (!tz) return -EINVAL; - result = acpi_thermal_get_temperature(tz); - if (result) - return result; - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); } @@ -1017,18 +1012,6 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, return -EINVAL; } -static int thermal_get_crit_temp(struct thermal_zone_device *thermal, - unsigned long *temperature) { - struct acpi_thermal *tz = thermal->devdata; - - if (tz->trips.critical.flags.valid) { - *temperature = KELVIN_TO_MILLICELSIUS( - tz->trips.critical.temperature); - return 0; - } else - return -EINVAL; -} - typedef int (*cb)(struct thermal_zone_device *, int, struct thermal_cooling_device *); static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, @@ -1120,7 +1103,6 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .set_mode = thermal_set_mode, .get_trip_type = thermal_get_trip_type, .get_trip_temp = thermal_get_trip_temp, - .get_crit_temp = thermal_get_crit_temp, }; static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) @@ -1141,7 +1123,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].flags.valid; i++, trips++); - tz->thermal_zone = thermal_zone_device_register("acpitz", + tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", trips, tz, &acpi_thermal_zone_ops); if (IS_ERR(tz->thermal_zone)) return -ENODEV; diff --git a/trunk/drivers/acpi/utilities/utalloc.c b/trunk/drivers/acpi/utilities/utalloc.c index ede084829a70..6e56d5f7c43a 100644 --- a/trunk/drivers/acpi/utilities/utalloc.c +++ b/trunk/drivers/acpi/utilities/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -147,7 +147,7 @@ acpi_status acpi_ut_delete_caches(void) if (acpi_gbl_display_final_mem_stats) { ACPI_STRCPY(buffer, "MEMORY"); - (void)acpi_db_display_statistics(buffer); + acpi_db_display_statistics(buffer); } #endif diff --git a/trunk/drivers/acpi/utilities/utcache.c b/trunk/drivers/acpi/utilities/utcache.c index 245fa80cf600..285a0f531760 100644 --- a/trunk/drivers/acpi/utilities/utcache.c +++ b/trunk/drivers/acpi/utilities/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utcopy.c b/trunk/drivers/acpi/utilities/utcopy.c index 655c290aca7b..879eaa10d3ae 100644 --- a/trunk/drivers/acpi/utilities/utcopy.c +++ b/trunk/drivers/acpi/utilities/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,8 +43,6 @@ #include #include -#include - #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utcopy") @@ -174,21 +172,22 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, case ACPI_TYPE_LOCAL_REFERENCE: - /* This is an object reference. */ - + /* + * This is an object reference. Attempt to dereference it. + */ switch (internal_object->reference.opcode) { case AML_INT_NAMEPATH_OP: /* For namepath, return the object handle ("reference") */ default: - - /* We are referring to the namespace node */ - + /* + * Use the object type of "Any" to indicate a reference + * to object containing a handle to an ACPI named object. + */ + external_object->type = ACPI_TYPE_ANY; external_object->reference.handle = internal_object->reference.node; - external_object->reference.actual_type = - acpi_ns_get_type(internal_object->reference.node); break; } break; @@ -216,11 +215,6 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, /* * There is no corresponding external object type */ - ACPI_ERROR((AE_INFO, - "Unsupported object type, cannot convert to external object: %s", - acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE - (internal_object)))); - return_ACPI_STATUS(AE_SUPPORT); } @@ -461,7 +455,6 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_INTEGER: - case ACPI_TYPE_LOCAL_REFERENCE: internal_object = acpi_ut_create_internal_object((u8) external_object-> @@ -471,18 +464,9 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, } break; - case ACPI_TYPE_ANY: /* This is the case for a NULL object */ - - *ret_internal_object = NULL; - return_ACPI_STATUS(AE_OK); - default: /* All other types are not supported */ - ACPI_ERROR((AE_INFO, - "Unsupported object type, cannot convert to internal object: %s", - acpi_ut_get_type_name(external_object->type))); - return_ACPI_STATUS(AE_SUPPORT); } @@ -518,10 +502,6 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, external_object->buffer.length); internal_object->buffer.length = external_object->buffer.length; - - /* Mark buffer data valid */ - - internal_object->buffer.flags |= AOPOBJ_DATA_VALID; break; case ACPI_TYPE_INTEGER: @@ -529,15 +509,6 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, internal_object->integer.value = external_object->integer.value; break; - case ACPI_TYPE_LOCAL_REFERENCE: - - /* TBD: should validate incoming handle */ - - internal_object->reference.opcode = AML_INT_NAMEPATH_OP; - internal_object->reference.node = - external_object->reference.handle; - break; - default: /* Other types can't get here */ break; @@ -599,17 +570,13 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, /* Truncate package and delete it */ - package_object->package.count = (u32) i; + package_object->package.count = i; package_elements[i] = NULL; acpi_ut_remove_reference(package_object); return_ACPI_STATUS(status); } } - /* Mark package data valid */ - - package_object->package.flags |= AOPOBJ_DATA_VALID; - *internal_object = package_object; return_ACPI_STATUS(status); } @@ -742,15 +709,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, /* * We copied the reference object, so we now must add a reference * to the object pointed to by the reference - * - * DDBHandle reference (from Load/load_table is a special reference, - * it's Reference.Object is the table index, so does not need to - * increase the reference count */ - if (source_desc->reference.opcode == AML_LOAD_OP) { - break; - } - acpi_ut_add_reference(source_desc->reference.object); break; diff --git a/trunk/drivers/acpi/utilities/utdebug.c b/trunk/drivers/acpi/utilities/utdebug.c index f938f465efa4..7361204b1eef 100644 --- a/trunk/drivers/acpi/utilities/utdebug.c +++ b/trunk/drivers/acpi/utilities/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,9 +68,9 @@ static const char *acpi_ut_trim_function_name(const char *function_name); void acpi_ut_init_stack_ptr_trace(void) { - acpi_size current_sp; + u32 current_sp; - acpi_gbl_entry_stack_pointer = ¤t_sp; + acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF(¤t_sp, NULL); } /******************************************************************************* @@ -89,8 +89,10 @@ void acpi_ut_track_stack_ptr(void) { acpi_size current_sp; - if (¤t_sp < acpi_gbl_lowest_stack_pointer) { - acpi_gbl_lowest_stack_pointer = ¤t_sp; + current_sp = ACPI_PTR_DIFF(¤t_sp, NULL); + + if (current_sp < acpi_gbl_lowest_stack_pointer) { + acpi_gbl_lowest_stack_pointer = current_sp; } if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { @@ -201,7 +203,6 @@ acpi_ut_debug_print(u32 requested_debug_level, va_start(args, format); acpi_os_vprintf(format, args); - va_end(args); } ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) @@ -239,7 +240,6 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, va_start(args, format); acpi_os_vprintf(format, args); - va_end(args); } ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) @@ -524,11 +524,6 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) u32 temp32; u8 buf_char; - if (!buffer) { - acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n"); - return; - } - if ((count < 4) || (count & 0x01)) { display = DB_BYTE_DISPLAY; } diff --git a/trunk/drivers/acpi/utilities/utdelete.c b/trunk/drivers/acpi/utilities/utdelete.c index 1fbc35139e84..f777cebdc46d 100644 --- a/trunk/drivers/acpi/utilities/utdelete.c +++ b/trunk/drivers/acpi/utilities/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -158,7 +158,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) "***** Mutex %p, OS Mutex %p\n", object, object->mutex.os_mutex)); - if (object == acpi_gbl_global_lock_mutex) { + if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) { /* Global Lock has extra semaphore */ @@ -252,17 +252,6 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) } break; - case ACPI_TYPE_LOCAL_BANK_FIELD: - - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Bank Field %p\n", object)); - - second_desc = acpi_ns_get_secondary_object(object); - if (second_desc) { - acpi_ut_delete_object_desc(second_desc); - } - break; - default: break; } @@ -535,12 +524,10 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) case ACPI_TYPE_LOCAL_REFERENCE: /* - * The target of an Index (a package, string, or buffer) or a named - * reference must track changes to the ref count of the index or - * target object. + * The target of an Index (a package, string, or buffer) must track + * changes to the ref count of the index. */ - if ((object->reference.opcode == AML_INDEX_OP) || - (object->reference.opcode == AML_INT_NAMEPATH_OP)) { + if (object->reference.opcode == AML_INDEX_OP) { next_object = object->reference.object; } break; diff --git a/trunk/drivers/acpi/utilities/uteval.c b/trunk/drivers/acpi/utilities/uteval.c index 05e61be267d5..0042b7e78b26 100644 --- a/trunk/drivers/acpi/utilities/uteval.c +++ b/trunk/drivers/acpi/utilities/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utglobal.c b/trunk/drivers/acpi/utilities/utglobal.c index a6e71b801d2d..630c9a2c5b7b 100644 --- a/trunk/drivers/acpi/utilities/utglobal.c +++ b/trunk/drivers/acpi/utilities/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -602,48 +602,6 @@ char *acpi_ut_get_mutex_name(u32 mutex_id) return (acpi_gbl_mutex_names[mutex_id]); } - -/******************************************************************************* - * - * FUNCTION: acpi_ut_get_notify_name - * - * PARAMETERS: notify_value - Value from the Notify() request - * - * RETURN: String corresponding to the Notify Value. - * - * DESCRIPTION: Translate a Notify Value to a notify namestring. - * - ******************************************************************************/ - -/* Names for Notify() values, used for debug output */ - -static const char *acpi_gbl_notify_value_names[] = { - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault", - "Capabilities Check", - "Device PLD Check", - "Reserved", - "System Locality Update" -}; - -const char *acpi_ut_get_notify_name(u32 notify_value) -{ - - if (notify_value <= ACPI_NOTIFY_MAX) { - return (acpi_gbl_notify_value_names[notify_value]); - } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { - return ("Reserved"); - } else { /* Greater or equal to 0x80 */ - - return ("**Device Specific**"); - } -} #endif /******************************************************************************* @@ -717,13 +675,12 @@ void acpi_ut_init_globals(void) acpi_gbl_gpe_fadt_blocks[0] = NULL; acpi_gbl_gpe_fadt_blocks[1] = NULL; - /* Global handlers */ + /* Global notify handlers */ acpi_gbl_system_notify.handler = NULL; acpi_gbl_device_notify.handler = NULL; acpi_gbl_exception_handler = NULL; acpi_gbl_init_handler = NULL; - acpi_gbl_table_handler = NULL; /* Global Lock support */ @@ -765,7 +722,7 @@ void acpi_ut_init_globals(void) acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; #ifdef ACPI_DEBUG_OUTPUT - acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); + acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; #endif #ifdef ACPI_DBG_TRACK_ALLOCATIONS diff --git a/trunk/drivers/acpi/utilities/utinit.c b/trunk/drivers/acpi/utilities/utinit.c index cae515fc02d3..ad3c0d0a5cf8 100644 --- a/trunk/drivers/acpi/utilities/utinit.c +++ b/trunk/drivers/acpi/utilities/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,12 +125,9 @@ void acpi_ut_subsystem_shutdown(void) acpi_gbl_startup_flags = 0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); -#ifndef ACPI_ASL_COMPILER - /* Close the acpi_event Handling */ acpi_ev_terminate(); -#endif /* Close the Namespace */ diff --git a/trunk/drivers/acpi/utilities/utmath.c b/trunk/drivers/acpi/utilities/utmath.c index c927324fdd26..0c56a0d20b29 100644 --- a/trunk/drivers/acpi/utilities/utmath.c +++ b/trunk/drivers/acpi/utilities/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -276,7 +276,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, *out_quotient = in_dividend / divisor; } if (out_remainder) { - *out_remainder = (u32) (in_dividend % divisor); + *out_remainder = (u32) in_dividend % divisor; } return_ACPI_STATUS(AE_OK); diff --git a/trunk/drivers/acpi/utilities/utmisc.c b/trunk/drivers/acpi/utilities/utmisc.c index e4ba7192cd15..2d19f71e9cfa 100644 --- a/trunk/drivers/acpi/utilities/utmisc.c +++ b/trunk/drivers/acpi/utilities/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1033,7 +1033,6 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) va_start(args, format); acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); - va_end(args); } void ACPI_INTERNAL_VAR_XFACE @@ -1062,8 +1061,6 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) va_start(args, format); acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); - va_end(args); - va_end(args); } void ACPI_INTERNAL_VAR_XFACE @@ -1080,5 +1077,4 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) va_start(args, format); acpi_os_vprintf(format, args); acpi_os_printf("\n"); - va_end(args); } diff --git a/trunk/drivers/acpi/utilities/utmutex.c b/trunk/drivers/acpi/utilities/utmutex.c index f7d602b1a894..4820bc86d1f5 100644 --- a/trunk/drivers/acpi/utilities/utmutex.c +++ b/trunk/drivers/acpi/utilities/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utobject.c b/trunk/drivers/acpi/utilities/utobject.c index e68466de8044..e08b3fa6639f 100644 --- a/trunk/drivers/acpi/utilities/utobject.c +++ b/trunk/drivers/acpi/utilities/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,7 +107,6 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, switch (type) { case ACPI_TYPE_REGION: case ACPI_TYPE_BUFFER_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: /* These types require a secondary object */ @@ -470,8 +469,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: - /* No extra data for these types */ - + /* + * No extra data for these types + */ break; case ACPI_TYPE_LOCAL_REFERENCE: diff --git a/trunk/drivers/acpi/utilities/utresrc.c b/trunk/drivers/acpi/utilities/utresrc.c index c3e3e1308edc..b630ee137ee1 100644 --- a/trunk/drivers/acpi/utilities/utresrc.c +++ b/trunk/drivers/acpi/utilities/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utstate.c b/trunk/drivers/acpi/utilities/utstate.c index 63a6d3d77d88..edcaafad0a31 100644 --- a/trunk/drivers/acpi/utilities/utstate.c +++ b/trunk/drivers/acpi/utilities/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/drivers/acpi/utilities/utxface.c b/trunk/drivers/acpi/utilities/utxface.c index f8bdadf3c32f..2d496918b3cd 100644 --- a/trunk/drivers/acpi/utilities/utxface.c +++ b/trunk/drivers/acpi/utilities/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utxface") -#ifndef ACPI_ASL_COMPILER /******************************************************************************* * * FUNCTION: acpi_initialize_subsystem @@ -193,6 +192,24 @@ acpi_status acpi_enable_subsystem(u32 flags) } } + /* + * Complete the GPE initialization for the GPE blocks defined in the FADT + * (GPE block 0 and 1). + * + * Note1: This is where the _PRW methods are executed for the GPEs. These + * methods can only be executed after the SCI and Global Lock handlers are + * installed and initialized. + * + * Note2: Currently, there seems to be no need to run the _REG methods + * before execution of the _PRW methods and enabling of the GPEs. + */ + if (!(flags & ACPI_NO_EVENT_INIT)) { + status = acpi_ev_install_fadt_gpes(); + if (ACPI_FAILURE(status)) { + return (status); + } + } + return_ACPI_STATUS(status); } @@ -262,23 +279,6 @@ acpi_status acpi_initialize_objects(u32 flags) } } - /* - * Complete the GPE initialization for the GPE blocks defined in the FADT - * (GPE block 0 and 1). - * - * Note1: This is where the _PRW methods are executed for the GPEs. These - * methods can only be executed after the SCI and Global Lock handlers are - * installed and initialized. - * - * Note2: Currently, there seems to be no need to run the _REG methods - * before execution of the _PRW methods and enabling of the GPEs. - */ - if (!(flags & ACPI_NO_EVENT_INIT)) { - status = acpi_ev_install_fadt_gpes(); - if (ACPI_FAILURE(status)) - return (status); - } - /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- @@ -292,7 +292,6 @@ acpi_status acpi_initialize_objects(u32 flags) ACPI_EXPORT_SYMBOL(acpi_initialize_objects) -#endif /******************************************************************************* * * FUNCTION: acpi_terminate @@ -336,7 +335,6 @@ acpi_status acpi_terminate(void) } ACPI_EXPORT_SYMBOL(acpi_terminate) -#ifndef ACPI_ASL_COMPILER #ifdef ACPI_FUTURE_USAGE /******************************************************************************* * @@ -492,4 +490,3 @@ acpi_status acpi_purge_cached_objects(void) } ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) -#endif diff --git a/trunk/drivers/acpi/utils.c b/trunk/drivers/acpi/utils.c index 100926143818..44ea60cf21c0 100644 --- a/trunk/drivers/acpi/utils.c +++ b/trunk/drivers/acpi/utils.c @@ -398,7 +398,7 @@ acpi_evaluate_reference(acpi_handle handle, element = &(package->package.elements[i]); - if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { + if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; printk(KERN_ERR PREFIX "Expecting a [Reference] package element, found type %X\n", diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 33c502e56026..980a74188781 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -57,6 +57,8 @@ #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 +#define ACPI_VIDEO_HEAD_INVALID (~0u - 1) +#define ACPI_VIDEO_HEAD_END (~0u) #define MAX_NAME_LEN 20 #define ACPI_VIDEO_DISPLAY_CRT 1 @@ -732,19 +734,21 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) if (IS_ERR(device->cdev)) return; - printk(KERN_INFO PREFIX - "%s is registered as cooling_device%d\n", - device->dev->dev.bus_id, device->cdev->id); - result = sysfs_create_link(&device->dev->dev.kobj, - &device->cdev->device.kobj, - "thermal_cooling"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); - result = sysfs_create_link(&device->cdev->device.kobj, - &device->dev->dev.kobj, "device"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); - + if (device->cdev) { + printk(KERN_INFO PREFIX + "%s is registered as cooling_device%d\n", + device->dev->dev.bus_id, device->cdev->id); + result = sysfs_create_link(&device->dev->dev.kobj, + &device->cdev->device.kobj, + "thermal_cooling"); + if (result) + printk(KERN_ERR PREFIX "Create sysfs link\n"); + result = sysfs_create_link(&device->cdev->device.kobj, + &device->dev->dev.kobj, + "device"); + if (result) + printk(KERN_ERR PREFIX "Create sysfs link\n"); + } } if (device->cap._DCS && device->cap._DSS){ static int count = 0; @@ -1046,90 +1050,87 @@ acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) static int acpi_video_device_add_fs(struct acpi_device *device) { - struct proc_dir_entry *entry, *device_dir; + struct proc_dir_entry *entry = NULL; struct acpi_video_device *vid_dev; + + if (!device) + return -ENODEV; + vid_dev = acpi_driver_data(device); if (!vid_dev) return -ENODEV; - device_dir = proc_mkdir(acpi_device_bid(device), - vid_dev->video->dir); - if (!device_dir) - return -ENOMEM; - - device_dir->owner = THIS_MODULE; + if (!acpi_device_dir(device)) { + acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + vid_dev->video->dir); + if (!acpi_device_dir(device)) + return -ENODEV; + acpi_device_dir(device)->owner = THIS_MODULE; + } /* 'info' [R] */ - entry = create_proc_entry("info", S_IRUGO, device_dir); + entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - goto err_remove_dir; - - entry->proc_fops = &acpi_video_device_info_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + entry->proc_fops = &acpi_video_device_info_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'state' [R/W] */ - entry = create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, - device_dir); + entry = + create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) - goto err_remove_info; - - acpi_video_device_state_fops.write = acpi_video_device_write_state; - entry->proc_fops = &acpi_video_device_state_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + acpi_video_device_state_fops.write = acpi_video_device_write_state; + entry->proc_fops = &acpi_video_device_state_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'brightness' [R/W] */ - entry = create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, - device_dir); + entry = + create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, + acpi_device_dir(device)); if (!entry) - goto err_remove_state; - - acpi_video_device_brightness_fops.write = - acpi_video_device_write_brightness; - entry->proc_fops = &acpi_video_device_brightness_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; + entry->proc_fops = &acpi_video_device_brightness_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'EDID' [R] */ - entry = create_proc_entry("EDID", S_IRUGO, device_dir); + entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) - goto err_remove_brightness; - - entry->proc_fops = &acpi_video_device_EDID_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + entry->proc_fops = &acpi_video_device_EDID_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } - acpi_device_dir(device) = device_dir; return 0; - - err_remove_brightness: - remove_proc_entry("brightness", device_dir); - err_remove_state: - remove_proc_entry("state", device_dir); - err_remove_info: - remove_proc_entry("info", device_dir); - err_remove_dir: - remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); - return -ENOMEM; } static int acpi_video_device_remove_fs(struct acpi_device *device) { struct acpi_video_device *vid_dev; - struct proc_dir_entry *device_dir; vid_dev = acpi_driver_data(device); if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) return -ENODEV; - device_dir = acpi_device_dir(device); - if (device_dir) { - remove_proc_entry("info", device_dir); - remove_proc_entry("state", device_dir); - remove_proc_entry("brightness", device_dir); - remove_proc_entry("EDID", device_dir); + if (acpi_device_dir(device)) { + remove_proc_entry("info", acpi_device_dir(device)); + remove_proc_entry("state", acpi_device_dir(device)); + remove_proc_entry("brightness", acpi_device_dir(device)); + remove_proc_entry("EDID", acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); acpi_device_dir(device) = NULL; } @@ -1336,91 +1337,94 @@ acpi_video_bus_write_DOS(struct file *file, static int acpi_video_bus_add_fs(struct acpi_device *device) { - struct acpi_video_bus *video = acpi_driver_data(device); - struct proc_dir_entry *device_dir; - struct proc_dir_entry *entry; + struct proc_dir_entry *entry = NULL; + struct acpi_video_bus *video; - device_dir = proc_mkdir(acpi_device_bid(device), acpi_video_dir); - if (!device_dir) - return -ENOMEM; - device_dir->owner = THIS_MODULE; + video = acpi_driver_data(device); + + if (!acpi_device_dir(device)) { + acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), + acpi_video_dir); + if (!acpi_device_dir(device)) + return -ENODEV; + video->dir = acpi_device_dir(device); + acpi_device_dir(device)->owner = THIS_MODULE; + } /* 'info' [R] */ - entry = create_proc_entry("info", S_IRUGO, device_dir); + entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - goto err_remove_dir; - - entry->proc_fops = &acpi_video_bus_info_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + entry->proc_fops = &acpi_video_bus_info_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'ROM' [R] */ - entry = create_proc_entry("ROM", S_IRUGO, device_dir); + entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - goto err_remove_info; - - entry->proc_fops = &acpi_video_bus_ROM_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + entry->proc_fops = &acpi_video_bus_ROM_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'POST_info' [R] */ - entry = create_proc_entry("POST_info", S_IRUGO, device_dir); + entry = + create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - goto err_remove_rom; - - entry->proc_fops = &acpi_video_bus_POST_info_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + entry->proc_fops = &acpi_video_bus_POST_info_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'POST' [R/W] */ - entry = create_proc_entry("POST", S_IFREG | S_IRUGO | S_IWUSR, - device_dir); + entry = + create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, + acpi_device_dir(device)); if (!entry) - goto err_remove_post_info; - - acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; - entry->proc_fops = &acpi_video_bus_POST_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; + entry->proc_fops = &acpi_video_bus_POST_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } /* 'DOS' [R/W] */ - entry = create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IWUSR, - device_dir); + entry = + create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, + acpi_device_dir(device)); if (!entry) - goto err_remove_post; - - acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; - entry->proc_fops = &acpi_video_bus_DOS_fops; - entry->data = acpi_driver_data(device); - entry->owner = THIS_MODULE; + return -ENODEV; + else { + acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; + entry->proc_fops = &acpi_video_bus_DOS_fops; + entry->data = acpi_driver_data(device); + entry->owner = THIS_MODULE; + } - video->dir = acpi_device_dir(device) = device_dir; return 0; - - err_remove_post: - remove_proc_entry("POST", device_dir); - err_remove_post_info: - remove_proc_entry("POST_info", device_dir); - err_remove_rom: - remove_proc_entry("ROM", device_dir); - err_remove_info: - remove_proc_entry("info", device_dir); - err_remove_dir: - remove_proc_entry(acpi_device_bid(device), acpi_video_dir); - return -ENOMEM; } static int acpi_video_bus_remove_fs(struct acpi_device *device) { - struct proc_dir_entry *device_dir = acpi_device_dir(device); + struct acpi_video_bus *video; + + + video = acpi_driver_data(device); - if (device_dir) { - remove_proc_entry("info", device_dir); - remove_proc_entry("ROM", device_dir); - remove_proc_entry("POST_info", device_dir); - remove_proc_entry("POST", device_dir); - remove_proc_entry("DOS", device_dir); + if (acpi_device_dir(device)) { + remove_proc_entry("info", acpi_device_dir(device)); + remove_proc_entry("ROM", acpi_device_dir(device)); + remove_proc_entry("POST_info", acpi_device_dir(device)); + remove_proc_entry("POST", acpi_device_dir(device)); + remove_proc_entry("DOS", acpi_device_dir(device)); remove_proc_entry(acpi_device_bid(device), acpi_video_dir); acpi_device_dir(device) = NULL; } @@ -1436,15 +1440,11 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) static struct acpi_video_device_attrib* acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) { - struct acpi_video_enumerated_device *ids; - int i; - - for (i = 0; i < video->attached_count; i++) { - ids = &video->attached_array[i]; - if ((ids->value.int_val & 0xffff) == device_id) - return &ids->value.attrib; - } + int count; + for(count = 0; count < video->attached_count; count++) + if((video->attached_array[count].value.int_val & 0xffff) == device_id) + return &(video->attached_array[count].value.attrib); return NULL; } @@ -1571,16 +1571,20 @@ static void acpi_video_device_bind(struct acpi_video_bus *video, struct acpi_video_device *device) { - struct acpi_video_enumerated_device *ids; int i; - for (i = 0; i < video->attached_count; i++) { - ids = &video->attached_array[i]; - if (device->device_id == (ids->value.int_val & 0xffff)) { - ids->bind_info = device; +#define IDS_VAL(i) video->attached_array[i].value.int_val +#define IDS_BIND(i) video->attached_array[i].bind_info + + for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && + i < video->attached_count; i++) { + if (device->device_id == (IDS_VAL(i) & 0xffff)) { + IDS_BIND(i) = device; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); } } +#undef IDS_VAL +#undef IDS_BIND } /* @@ -1599,7 +1603,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) int status; int count; int i; - struct acpi_video_enumerated_device *active_list; + struct acpi_video_enumerated_device *active_device_list; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *dod = NULL; union acpi_object *obj; @@ -1620,10 +1624,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", dod->package.count)); - active_list = kcalloc(1 + dod->package.count, - sizeof(struct acpi_video_enumerated_device), - GFP_KERNEL); - if (!active_list) { + active_device_list = kmalloc((1 + + dod->package.count) * + sizeof(struct + acpi_video_enumerated_device), + GFP_KERNEL); + + if (!active_device_list) { status = -ENOMEM; goto out; } @@ -1633,24 +1640,23 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) obj = &dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - printk(KERN_ERR PREFIX - "Invalid _DOD data in element %d\n", i); - continue; + printk(KERN_ERR PREFIX "Invalid _DOD data\n"); + active_device_list[i].value.int_val = + ACPI_VIDEO_HEAD_INVALID; } - - active_list[count].value.int_val = obj->integer.value; - active_list[count].bind_info = NULL; + active_device_list[i].value.int_val = obj->integer.value; + active_device_list[i].bind_info = NULL; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, (int)obj->integer.value)); count++; } + active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; kfree(video->attached_array); - video->attached_array = active_list; + video->attached_array = active_device_list; video->attached_count = count; - - out: + out: kfree(buffer.pointer); return status; } diff --git a/trunk/drivers/misc/Kconfig b/trunk/drivers/misc/Kconfig index 636af2862308..297a48f85446 100644 --- a/trunk/drivers/misc/Kconfig +++ b/trunk/drivers/misc/Kconfig @@ -140,7 +140,6 @@ config ACER_WMI depends on EXPERIMENTAL depends on ACPI depends on LEDS_CLASS - depends on NEW_LEDS depends on BACKLIGHT_CLASS_DEVICE depends on SERIO_I8042 select ACPI_WMI @@ -161,7 +160,6 @@ config ASUS_LAPTOP depends on ACPI depends on EXPERIMENTAL && !ACPI_ASUS depends on LEDS_CLASS - depends on NEW_LEDS depends on BACKLIGHT_CLASS_DEVICE ---help--- This is the new Linux driver for Asus laptops. It may also support some @@ -243,13 +241,10 @@ config SONYPI_COMPAT config THINKPAD_ACPI tristate "ThinkPad ACPI Laptop Extras" depends on X86 && ACPI - select BACKLIGHT_LCD_SUPPORT select BACKLIGHT_CLASS_DEVICE select HWMON select NVRAM - select INPUT - select NEW_LEDS - select LEDS_CLASS + depends on INPUT ---help--- This is a driver for the IBM and Lenovo ThinkPad laptops. It adds support for Fn-Fx key combinations, Bluetooth control, video @@ -349,7 +344,6 @@ config ATMEL_SSC config INTEL_MENLOW tristate "Thermal Management driver for Intel menlow platform" depends on ACPI_THERMAL - select THERMAL depends on X86 ---help--- ACPI thermal management enhancement driver on @@ -357,19 +351,6 @@ config INTEL_MENLOW If unsure, say N. -config EEEPC_LAPTOP - tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" - depends on X86 - depends on ACPI - depends on BACKLIGHT_CLASS_DEVICE - depends on HWMON - depends on EXPERIMENTAL - ---help--- - This driver supports the Fn-Fx keys on Eee PC laptops. - It also adds the ability to switch camera/wlan on/off. - - If you have an Eee PC laptop, say Y or M here. - config ENCLOSURE_SERVICES tristate "Enclosure Services" default n diff --git a/trunk/drivers/misc/Makefile b/trunk/drivers/misc/Makefile index 1952875a272e..5914da434854 100644 --- a/trunk/drivers/misc/Makefile +++ b/trunk/drivers/misc/Makefile @@ -7,8 +7,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o obj-$(CONFIG_ACER_WMI) += acer-wmi.o -obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o -obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o +obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o diff --git a/trunk/drivers/misc/eeepc-laptop.c b/trunk/drivers/misc/eeepc-laptop.c deleted file mode 100644 index 6d727609097f..000000000000 --- a/trunk/drivers/misc/eeepc-laptop.c +++ /dev/null @@ -1,666 +0,0 @@ -/* - * eepc-laptop.c - Asus Eee PC extras - * - * Based on asus_acpi.c as patched for the Eee PC by Asus: - * ftp://ftp.asus.com/pub/ASUS/EeePC/701/ASUS_ACPI_071126.rar - * Based on eee.c from eeepc-linux - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define EEEPC_LAPTOP_VERSION "0.1" - -#define EEEPC_HOTK_NAME "Eee PC Hotkey Driver" -#define EEEPC_HOTK_FILE "eeepc" -#define EEEPC_HOTK_CLASS "hotkey" -#define EEEPC_HOTK_DEVICE_NAME "Hotkey" -#define EEEPC_HOTK_HID "ASUS010" - -#define EEEPC_LOG EEEPC_HOTK_FILE ": " -#define EEEPC_ERR KERN_ERR EEEPC_LOG -#define EEEPC_WARNING KERN_WARNING EEEPC_LOG -#define EEEPC_NOTICE KERN_NOTICE EEEPC_LOG -#define EEEPC_INFO KERN_INFO EEEPC_LOG - -/* - * Definitions for Asus EeePC - */ -#define NOTIFY_WLAN_ON 0x10 -#define NOTIFY_BRN_MIN 0x20 -#define NOTIFY_BRN_MAX 0x2f - -enum { - DISABLE_ASL_WLAN = 0x0001, - DISABLE_ASL_BLUETOOTH = 0x0002, - DISABLE_ASL_IRDA = 0x0004, - DISABLE_ASL_CAMERA = 0x0008, - DISABLE_ASL_TV = 0x0010, - DISABLE_ASL_GPS = 0x0020, - DISABLE_ASL_DISPLAYSWITCH = 0x0040, - DISABLE_ASL_MODEM = 0x0080, - DISABLE_ASL_CARDREADER = 0x0100 -}; - -enum { - CM_ASL_WLAN = 0, - CM_ASL_BLUETOOTH, - CM_ASL_IRDA, - CM_ASL_1394, - CM_ASL_CAMERA, - CM_ASL_TV, - CM_ASL_GPS, - CM_ASL_DVDROM, - CM_ASL_DISPLAYSWITCH, - CM_ASL_PANELBRIGHT, - CM_ASL_BIOSFLASH, - CM_ASL_ACPIFLASH, - CM_ASL_CPUFV, - CM_ASL_CPUTEMPERATURE, - CM_ASL_FANCPU, - CM_ASL_FANCHASSIS, - CM_ASL_USBPORT1, - CM_ASL_USBPORT2, - CM_ASL_USBPORT3, - CM_ASL_MODEM, - CM_ASL_CARDREADER, - CM_ASL_LID -}; - -const char *cm_getv[] = { - "WLDG", NULL, NULL, NULL, - "CAMG", NULL, NULL, NULL, - NULL, "PBLG", NULL, NULL, - "CFVG", NULL, NULL, NULL, - "USBG", NULL, NULL, "MODG", - "CRDG", "LIDG" -}; - -const char *cm_setv[] = { - "WLDS", NULL, NULL, NULL, - "CAMS", NULL, NULL, NULL, - "SDSP", "PBLS", "HDPS", NULL, - "CFVS", NULL, NULL, NULL, - "USBG", NULL, NULL, "MODS", - "CRDS", NULL -}; - -#define EEEPC_EC "\\_SB.PCI0.SBRG.EC0." - -#define EEEPC_EC_FAN_PWM EEEPC_EC "SC02" /* Fan PWM duty cycle (%) */ -#define EEEPC_EC_SC02 0x63 -#define EEEPC_EC_FAN_HRPM EEEPC_EC "SC05" /* High byte, fan speed (RPM) */ -#define EEEPC_EC_FAN_LRPM EEEPC_EC "SC06" /* Low byte, fan speed (RPM) */ -#define EEEPC_EC_FAN_CTRL EEEPC_EC "SFB3" /* Byte containing SF25 */ -#define EEEPC_EC_SFB3 0xD3 - -/* - * This is the main structure, we can use it to store useful information - * about the hotk device - */ -struct eeepc_hotk { - struct acpi_device *device; /* the device we are in */ - acpi_handle handle; /* the handle of the hotk device */ - u32 cm_supported; /* the control methods supported - by this BIOS */ - uint init_flag; /* Init flags */ - u16 event_count[128]; /* count for each event */ -}; - -/* The actual device the driver binds to */ -static struct eeepc_hotk *ehotk; - -/* Platform device/driver */ -static struct platform_driver platform_driver = { - .driver = { - .name = EEEPC_HOTK_FILE, - .owner = THIS_MODULE, - } -}; - -static struct platform_device *platform_device; - -/* - * The hotkey driver declaration - */ -static int eeepc_hotk_add(struct acpi_device *device); -static int eeepc_hotk_remove(struct acpi_device *device, int type); - -static const struct acpi_device_id eeepc_device_ids[] = { - {EEEPC_HOTK_HID, 0}, - {"", 0}, -}; -MODULE_DEVICE_TABLE(acpi, eeepc_device_ids); - -static struct acpi_driver eeepc_hotk_driver = { - .name = EEEPC_HOTK_NAME, - .class = EEEPC_HOTK_CLASS, - .ids = eeepc_device_ids, - .ops = { - .add = eeepc_hotk_add, - .remove = eeepc_hotk_remove, - }, -}; - -/* The backlight device /sys/class/backlight */ -static struct backlight_device *eeepc_backlight_device; - -/* The hwmon device */ -static struct device *eeepc_hwmon_device; - -/* - * The backlight class declaration - */ -static int read_brightness(struct backlight_device *bd); -static int update_bl_status(struct backlight_device *bd); -static struct backlight_ops eeepcbl_ops = { - .get_brightness = read_brightness, - .update_status = update_bl_status, -}; - -MODULE_AUTHOR("Corentin Chary, Eric Cooper"); -MODULE_DESCRIPTION(EEEPC_HOTK_NAME); -MODULE_LICENSE("GPL"); - -/* - * ACPI Helpers - */ -static int write_acpi_int(acpi_handle handle, const char *method, int val, - struct acpi_buffer *output) -{ - struct acpi_object_list params; - union acpi_object in_obj; - acpi_status status; - - params.count = 1; - params.pointer = &in_obj; - in_obj.type = ACPI_TYPE_INTEGER; - in_obj.integer.value = val; - - status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); - return (status == AE_OK ? 0 : -1); -} - -static int read_acpi_int(acpi_handle handle, const char *method, int *val) -{ - acpi_status status; - ulong result; - - status = acpi_evaluate_integer(handle, (char *)method, NULL, &result); - if (ACPI_FAILURE(status)) { - *val = -1; - return -1; - } else { - *val = result; - return 0; - } -} - -static int set_acpi(int cm, int value) -{ - if (ehotk->cm_supported & (0x1 << cm)) { - const char *method = cm_setv[cm]; - if (method == NULL) - return -ENODEV; - if (write_acpi_int(ehotk->handle, method, value, NULL)) - printk(EEEPC_WARNING "Error writing %s\n", method); - } - return 0; -} - -static int get_acpi(int cm) -{ - int value = -1; - if ((ehotk->cm_supported & (0x1 << cm))) { - const char *method = cm_getv[cm]; - if (method == NULL) - return -ENODEV; - if (read_acpi_int(ehotk->handle, method, &value)) - printk(EEEPC_WARNING "Error reading %s\n", method); - } - return value; -} - -/* - * Backlight - */ -static int read_brightness(struct backlight_device *bd) -{ - return get_acpi(CM_ASL_PANELBRIGHT); -} - -static int set_brightness(struct backlight_device *bd, int value) -{ - value = max(0, min(15, value)); - return set_acpi(CM_ASL_PANELBRIGHT, value); -} - -static int update_bl_status(struct backlight_device *bd) -{ - return set_brightness(bd, bd->props.brightness); -} - -/* - * Sys helpers - */ -static int parse_arg(const char *buf, unsigned long count, int *val) -{ - if (!count) - return 0; - if (sscanf(buf, "%i", val) != 1) - return -EINVAL; - return count; -} - -static ssize_t store_sys_acpi(int cm, const char *buf, size_t count) -{ - int rv, value; - - rv = parse_arg(buf, count, &value); - if (rv > 0) - set_acpi(cm, value); - return rv; -} - -static ssize_t show_sys_acpi(int cm, char *buf) -{ - return sprintf(buf, "%d\n", get_acpi(cm)); -} - -#define EEEPC_CREATE_DEVICE_ATTR(_name, _cm) \ - static ssize_t show_##_name(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ - { \ - return show_sys_acpi(_cm, buf); \ - } \ - static ssize_t store_##_name(struct device *dev, \ - struct device_attribute *attr, \ - const char *buf, size_t count) \ - { \ - return store_sys_acpi(_cm, buf, count); \ - } \ - static struct device_attribute dev_attr_##_name = { \ - .attr = { \ - .name = __stringify(_name), \ - .mode = 0644 }, \ - .show = show_##_name, \ - .store = store_##_name, \ - } - -EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); -EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); -EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); -EEEPC_CREATE_DEVICE_ATTR(wlan, CM_ASL_WLAN); - -static struct attribute *platform_attributes[] = { - &dev_attr_camera.attr, - &dev_attr_cardr.attr, - &dev_attr_disp.attr, - &dev_attr_wlan.attr, - NULL -}; - -static struct attribute_group platform_attribute_group = { - .attrs = platform_attributes -}; - -/* - * Hotkey functions - */ -static int eeepc_hotk_check(void) -{ - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - int result; - - result = acpi_bus_get_status(ehotk->device); - if (result) - return result; - if (ehotk->device->status.present) { - if (write_acpi_int(ehotk->handle, "INIT", ehotk->init_flag, - &buffer)) { - printk(EEEPC_ERR "Hotkey initialization failed\n"); - return -ENODEV; - } else { - printk(EEEPC_NOTICE "Hotkey init flags 0x%x\n", - ehotk->init_flag); - } - /* get control methods supported */ - if (read_acpi_int(ehotk->handle, "CMSG" - , &ehotk->cm_supported)) { - printk(EEEPC_ERR - "Get control methods supported failed\n"); - return -ENODEV; - } else { - printk(EEEPC_INFO - "Get control methods supported: 0x%x\n", - ehotk->cm_supported); - } - } else { - printk(EEEPC_ERR "Hotkey device not present, aborting\n"); - return -EINVAL; - } - return 0; -} - -static void notify_wlan(u32 *event) -{ - /* if DISABLE_ASL_WLAN is set, the notify code for fn+f2 - will always be 0x10 */ - if (ehotk->cm_supported & (0x1 << CM_ASL_WLAN)) { - const char *method = cm_getv[CM_ASL_WLAN]; - int value; - if (read_acpi_int(ehotk->handle, method, &value)) - printk(EEEPC_WARNING "Error reading %s\n", - method); - else if (value == 1) - *event = 0x11; - } -} - -static void notify_brn(void) -{ - struct backlight_device *bd = eeepc_backlight_device; - bd->props.brightness = read_brightness(bd); -} - -static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) -{ - if (!ehotk) - return; - if (event == NOTIFY_WLAN_ON && (DISABLE_ASL_WLAN & ehotk->init_flag)) - notify_wlan(&event); - if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) - notify_brn(); - acpi_bus_generate_proc_event(ehotk->device, event, - ehotk->event_count[event % 128]++); -} - -static int eeepc_hotk_add(struct acpi_device *device) -{ - acpi_status status = AE_OK; - int result; - - if (!device) - return -EINVAL; - printk(EEEPC_NOTICE EEEPC_HOTK_NAME "\n"); - ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); - if (!ehotk) - return -ENOMEM; - ehotk->init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH; - ehotk->handle = device->handle; - strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME); - strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS); - acpi_driver_data(device) = ehotk; - ehotk->device = device; - result = eeepc_hotk_check(); - if (result) - goto end; - status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, - eeepc_hotk_notify, ehotk); - if (ACPI_FAILURE(status)) - printk(EEEPC_ERR "Error installing notify handler\n"); - end: - if (result) { - kfree(ehotk); - ehotk = NULL; - } - return result; -} - -static int eeepc_hotk_remove(struct acpi_device *device, int type) -{ - acpi_status status = 0; - - if (!device || !acpi_driver_data(device)) - return -EINVAL; - status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, - eeepc_hotk_notify); - if (ACPI_FAILURE(status)) - printk(EEEPC_ERR "Error removing notify handler\n"); - kfree(ehotk); - return 0; -} - -/* - * Hwmon - */ -static int eeepc_get_fan_pwm(void) -{ - int value = 0; - - read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value); - return (value); -} - -static void eeepc_set_fan_pwm(int value) -{ - value = SENSORS_LIMIT(value, 0, 100); - ec_write(EEEPC_EC_SC02, value); -} - -static int eeepc_get_fan_rpm(void) -{ - int high = 0; - int low = 0; - - read_acpi_int(NULL, EEEPC_EC_FAN_HRPM, &high); - read_acpi_int(NULL, EEEPC_EC_FAN_LRPM, &low); - return (high << 8 | low); -} - -static int eeepc_get_fan_ctrl(void) -{ - int value = 0; - - read_acpi_int(NULL, EEEPC_EC_FAN_CTRL, &value); - return ((value & 0x02 ? 1 : 0)); -} - -static void eeepc_set_fan_ctrl(int manual) -{ - int value = 0; - - read_acpi_int(NULL, EEEPC_EC_FAN_CTRL, &value); - if (manual) - value |= 0x02; - else - value &= ~0x02; - ec_write(EEEPC_EC_SFB3, value); -} - -static ssize_t store_sys_hwmon(void (*set)(int), const char *buf, size_t count) -{ - int rv, value; - - rv = parse_arg(buf, count, &value); - if (rv > 0) - set(value); - return rv; -} - -static ssize_t show_sys_hwmon(int (*get)(void), char *buf) -{ - return sprintf(buf, "%d\n", get()); -} - -#define EEEPC_CREATE_SENSOR_ATTR(_name, _mode, _set, _get) \ - static ssize_t show_##_name(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ - { \ - return show_sys_hwmon(_set, buf); \ - } \ - static ssize_t store_##_name(struct device *dev, \ - struct device_attribute *attr, \ - const char *buf, size_t count) \ - { \ - return store_sys_hwmon(_get, buf, count); \ - } \ - static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); - -EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); -EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, - eeepc_get_fan_pwm, eeepc_set_fan_pwm); -EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, - eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); - -static struct attribute *hwmon_attributes[] = { - &sensor_dev_attr_fan1_pwm.dev_attr.attr, - &sensor_dev_attr_fan1_input.dev_attr.attr, - &sensor_dev_attr_pwm1_enable.dev_attr.attr, - NULL -}; - -static struct attribute_group hwmon_attribute_group = { - .attrs = hwmon_attributes -}; - -/* - * exit/init - */ -static void eeepc_backlight_exit(void) -{ - if (eeepc_backlight_device) - backlight_device_unregister(eeepc_backlight_device); - eeepc_backlight_device = NULL; -} - -static void eeepc_hwmon_exit(void) -{ - struct device *hwmon; - - hwmon = eeepc_hwmon_device; - if (!hwmon) - return ; - hwmon_device_unregister(hwmon); - sysfs_remove_group(&hwmon->kobj, - &hwmon_attribute_group); - eeepc_hwmon_device = NULL; -} - -static void __exit eeepc_laptop_exit(void) -{ - eeepc_backlight_exit(); - eeepc_hwmon_exit(); - acpi_bus_unregister_driver(&eeepc_hotk_driver); - sysfs_remove_group(&platform_device->dev.kobj, - &platform_attribute_group); - platform_device_unregister(platform_device); - platform_driver_unregister(&platform_driver); -} - -static int eeepc_backlight_init(struct device *dev) -{ - struct backlight_device *bd; - - bd = backlight_device_register(EEEPC_HOTK_FILE, dev, - NULL, &eeepcbl_ops); - if (IS_ERR(bd)) { - printk(EEEPC_ERR - "Could not register eeepc backlight device\n"); - eeepc_backlight_device = NULL; - return PTR_ERR(bd); - } - eeepc_backlight_device = bd; - bd->props.max_brightness = 15; - bd->props.brightness = read_brightness(NULL); - bd->props.power = FB_BLANK_UNBLANK; - backlight_update_status(bd); - return 0; -} - -static int eeepc_hwmon_init(struct device *dev) -{ - struct device *hwmon; - int result; - - hwmon = hwmon_device_register(dev); - if (IS_ERR(hwmon)) { - printk(EEEPC_ERR - "Could not register eeepc hwmon device\n"); - eeepc_hwmon_device = NULL; - return PTR_ERR(hwmon); - } - eeepc_hwmon_device = hwmon; - result = sysfs_create_group(&hwmon->kobj, - &hwmon_attribute_group); - if (result) - eeepc_hwmon_exit(); - return result; -} - -static int __init eeepc_laptop_init(void) -{ - struct device *dev; - int result; - - if (acpi_disabled) - return -ENODEV; - result = acpi_bus_register_driver(&eeepc_hotk_driver); - if (result < 0) - return result; - if (!ehotk) { - acpi_bus_unregister_driver(&eeepc_hotk_driver); - return -ENODEV; - } - dev = acpi_get_physical_device(ehotk->device->handle); - result = eeepc_backlight_init(dev); - if (result) - goto fail_backlight; - result = eeepc_hwmon_init(dev); - if (result) - goto fail_hwmon; - /* Register platform stuff */ - result = platform_driver_register(&platform_driver); - if (result) - goto fail_platform_driver; - platform_device = platform_device_alloc(EEEPC_HOTK_FILE, -1); - if (!platform_device) { - result = -ENOMEM; - goto fail_platform_device1; - } - result = platform_device_add(platform_device); - if (result) - goto fail_platform_device2; - result = sysfs_create_group(&platform_device->dev.kobj, - &platform_attribute_group); - if (result) - goto fail_sysfs; - return 0; -fail_sysfs: - platform_device_del(platform_device); -fail_platform_device2: - platform_device_put(platform_device); -fail_platform_device1: - platform_driver_unregister(&platform_driver); -fail_platform_driver: - eeepc_hwmon_exit(); -fail_hwmon: - eeepc_backlight_exit(); -fail_backlight: - return result; -} - -module_init(eeepc_laptop_init); -module_exit(eeepc_laptop_exit); diff --git a/trunk/drivers/misc/intel_menlow.c b/trunk/drivers/misc/intel_menlow.c index 5bb8816c9126..0c0bb3093e07 100644 --- a/trunk/drivers/misc/intel_menlow.c +++ b/trunk/drivers/misc/intel_menlow.c @@ -175,18 +175,28 @@ static int intel_menlow_memory_add(struct acpi_device *device) goto end; } - acpi_driver_data(device) = cdev; - result = sysfs_create_link(&device->dev.kobj, - &cdev->device.kobj, "thermal_cooling"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); - result = sysfs_create_link(&cdev->device.kobj, - &device->dev.kobj, "device"); - if (result) - printk(KERN_ERR PREFIX "Create sysfs link\n"); + if (cdev) { + acpi_driver_data(device) = cdev; + result = sysfs_create_link(&device->dev.kobj, + &cdev->device.kobj, "thermal_cooling"); + if (result) + goto unregister; + + result = sysfs_create_link(&cdev->device.kobj, + &device->dev.kobj, "device"); + if (result) { + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); + goto unregister; + } + } end: return result; + + unregister: + thermal_cooling_device_unregister(cdev); + return result; + } static int intel_menlow_memory_remove(struct acpi_device *device, int type) diff --git a/trunk/drivers/misc/thinkpad_acpi.c b/trunk/drivers/misc/thinkpad_acpi.c index 3f28f6eabdbf..6cb781262f94 100644 --- a/trunk/drivers/misc/thinkpad_acpi.c +++ b/trunk/drivers/misc/thinkpad_acpi.c @@ -21,7 +21,7 @@ * 02110-1301, USA. */ -#define TPACPI_VERSION "0.20" +#define TPACPI_VERSION "0.19" #define TPACPI_SYSFS_VERSION 0x020200 /* @@ -67,7 +67,6 @@ #include #include #include -#include #include #include @@ -86,8 +85,6 @@ #define TP_CMOS_VOLUME_MUTE 2 #define TP_CMOS_BRIGHTNESS_UP 4 #define TP_CMOS_BRIGHTNESS_DOWN 5 -#define TP_CMOS_THINKLIGHT_ON 12 -#define TP_CMOS_THINKLIGHT_OFF 13 /* NVRAM Addresses */ enum tp_nvram_addr { @@ -136,12 +133,8 @@ enum { #define TPACPI_PROC_DIR "ibm" #define TPACPI_ACPI_EVENT_PREFIX "ibm" #define TPACPI_DRVR_NAME TPACPI_FILE -#define TPACPI_DRVR_SHORTNAME "tpacpi" #define TPACPI_HWMON_DRVR_NAME TPACPI_NAME "_hwmon" -#define TPACPI_NVRAM_KTHREAD_NAME "ktpacpi_nvramd" -#define TPACPI_WORKQUEUE_NAME "ktpacpid" - #define TPACPI_MAX_ACPI_ARGS 3 /* Debugging */ @@ -232,7 +225,6 @@ static struct { u32 light:1; u32 light_status:1; u32 bright_16levels:1; - u32 bright_acpimode:1; u32 wan:1; u32 fan_ctrl_status_undef:1; u32 input_device_registered:1; @@ -244,11 +236,6 @@ static struct { u32 hotkey_poll_active:1; } tp_features; -static struct { - u16 hotkey_mask_ff:1; - u16 bright_cmos_ec_unsync:1; -} tp_warned; - struct thinkpad_id_data { unsigned int vendor; /* ThinkPad vendor: * PCI_VENDOR_ID_IBM/PCI_VENDOR_ID_LENOVO */ @@ -259,8 +246,7 @@ struct thinkpad_id_data { u16 bios_model; /* Big Endian, TP-1Y = 0x5931, 0 = unknown */ u16 ec_model; - char *model_str; /* ThinkPad T43 */ - char *nummodel_str; /* 9384A9C for a 9384-A9C model */ + char *model_str; }; static struct thinkpad_id_data thinkpad_id; @@ -273,16 +259,6 @@ static enum { static int experimental; static u32 dbg_level; -static struct workqueue_struct *tpacpi_wq; - -/* Special LED class that can defer work */ -struct tpacpi_led_classdev { - struct led_classdev led_classdev; - struct work_struct work; - enum led_brightness new_brightness; - unsigned int led; -}; - /**************************************************************************** **************************************************************************** * @@ -831,80 +807,6 @@ static int parse_strtoul(const char *buf, return 0; } -static int __init tpacpi_query_bcl_levels(acpi_handle handle) -{ - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object *obj; - int rc; - - if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { - obj = (union acpi_object *)buffer.pointer; - if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { - printk(TPACPI_ERR "Unknown _BCL data, " - "please report this to %s\n", TPACPI_MAIL); - rc = 0; - } else { - rc = obj->package.count; - } - } else { - return 0; - } - - kfree(buffer.pointer); - return rc; -} - -static acpi_status __init tpacpi_acpi_walk_find_bcl(acpi_handle handle, - u32 lvl, void *context, void **rv) -{ - char name[ACPI_PATH_SEGMENT_LENGTH]; - struct acpi_buffer buffer = { sizeof(name), &name }; - - if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && - !strncmp("_BCL", name, sizeof(name) - 1)) { - BUG_ON(!rv || !*rv); - **(int **)rv = tpacpi_query_bcl_levels(handle); - return AE_CTRL_TERMINATE; - } else { - return AE_OK; - } -} - -/* - * Returns 0 (no ACPI _BCL or _BCL invalid), or size of brightness map - */ -static int __init tpacpi_check_std_acpi_brightness_support(void) -{ - int status; - int bcl_levels = 0; - void *bcl_ptr = &bcl_levels; - - if (!vid_handle) { - TPACPI_ACPIHANDLE_INIT(vid); - } - if (!vid_handle) - return 0; - - /* - * Search for a _BCL method, and execute it. This is safe on all - * ThinkPads, and as a side-effect, _BCL will place a Lenovo Vista - * BIOS in ACPI backlight control mode. We do NOT have to care - * about calling the _BCL method in an enabled video device, any - * will do for our purposes. - */ - - status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, - tpacpi_acpi_walk_find_bcl, NULL, - &bcl_ptr); - - if (ACPI_SUCCESS(status) && bcl_levels > 2) { - tp_features.bright_acpimode = 1; - return (bcl_levels - 2); - } - - return 0; -} - /************************************************************************* * thinkpad-acpi driver attributes */ @@ -1007,14 +909,12 @@ static int __init thinkpad_acpi_driver_init(struct ibm_init_struct *iibm) thinkpad_id.ec_version_str : "unknown"); if (thinkpad_id.vendor && thinkpad_id.model_str) - printk(TPACPI_INFO "%s %s, model %s\n", + printk(TPACPI_INFO "%s %s\n", (thinkpad_id.vendor == PCI_VENDOR_ID_IBM) ? "IBM" : ((thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) ? "Lenovo" : "Unknown vendor"), - thinkpad_id.model_str, - (thinkpad_id.nummodel_str) ? - thinkpad_id.nummodel_str : "unknown"); + thinkpad_id.model_str); return 0; } @@ -1207,19 +1107,6 @@ static int hotkey_mask_set(u32 mask) int rc = 0; if (tp_features.hotkey_mask) { - if (!tp_warned.hotkey_mask_ff && - (mask == 0xffff || mask == 0xffffff || - mask == 0xffffffff)) { - tp_warned.hotkey_mask_ff = 1; - printk(TPACPI_NOTICE - "setting the hotkey mask to 0x%08x is likely " - "not the best way to go about it\n", mask); - printk(TPACPI_NOTICE - "please consider using the driver defaults, " - "and refer to up-to-date thinkpad-acpi " - "documentation\n"); - } - HOTKEY_CONFIG_CRITICAL_START for (i = 0; i < 32; i++) { u32 m = 1 << i; @@ -1540,7 +1427,8 @@ static void hotkey_poll_setup(int may_warn) (tpacpi_inputdev->users > 0 || hotkey_report_mode < 2)) { if (!tpacpi_hotkey_task) { tpacpi_hotkey_task = kthread_run(hotkey_kthread, - NULL, TPACPI_NVRAM_KTHREAD_NAME); + NULL, + TPACPI_FILE "d"); if (IS_ERR(tpacpi_hotkey_task)) { tpacpi_hotkey_task = NULL; printk(TPACPI_ERR @@ -1999,9 +1887,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) KEY_UNKNOWN, /* 0x0D: FN+INSERT */ KEY_UNKNOWN, /* 0x0E: FN+DELETE */ - /* These either have to go through ACPI video, or - * act like in the IBM ThinkPads, so don't ever - * enable them by default */ KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ KEY_RESERVED, /* 0x10: FN+END (brightness down) */ @@ -2206,32 +2091,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit); } - /* Do not issue duplicate brightness change events to - * userspace */ - if (!tp_features.bright_acpimode) - /* update bright_acpimode... */ - tpacpi_check_std_acpi_brightness_support(); - - if (tp_features.bright_acpimode) { - printk(TPACPI_INFO - "This ThinkPad has standard ACPI backlight " - "brightness control, supported by the ACPI " - "video driver\n"); - printk(TPACPI_NOTICE - "Disabling thinkpad-acpi brightness events " - "by default...\n"); - - /* The hotkey_reserved_mask change below is not - * necessary while the keys are at KEY_RESERVED in the - * default map, but better safe than sorry, leave it - * here as a marker of what we have to do, especially - * when we finally become able to set this at runtime - * on response to X.org requests */ - hotkey_reserved_mask |= - (1 << TP_ACPI_HOTKEYSCAN_FNHOME) - | (1 << TP_ACPI_HOTKEYSCAN_FNEND); - } - dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); res = hotkey_status_set(1); @@ -3251,82 +3110,13 @@ static struct ibm_struct video_driver_data = { TPACPI_HANDLE(lght, root, "\\LGHT"); /* A21e, A2xm/p, T20-22, X20-21 */ TPACPI_HANDLE(ledb, ec, "LEDB"); /* G4x */ -static int light_get_status(void) -{ - int status = 0; - - if (tp_features.light_status) { - if (!acpi_evalf(ec_handle, &status, "KBLT", "d")) - return -EIO; - return (!!status); - } - - return -ENXIO; -} - -static int light_set_status(int status) -{ - int rc; - - if (tp_features.light) { - if (cmos_handle) { - rc = acpi_evalf(cmos_handle, NULL, NULL, "vd", - (status)? - TP_CMOS_THINKLIGHT_ON : - TP_CMOS_THINKLIGHT_OFF); - } else { - rc = acpi_evalf(lght_handle, NULL, NULL, "vd", - (status)? 1 : 0); - } - return (rc)? 0 : -EIO; - } - - return -ENXIO; -} - -static void light_set_status_worker(struct work_struct *work) -{ - struct tpacpi_led_classdev *data = - container_of(work, struct tpacpi_led_classdev, work); - - if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) - light_set_status((data->new_brightness != LED_OFF)); -} - -static void light_sysfs_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct tpacpi_led_classdev *data = - container_of(led_cdev, - struct tpacpi_led_classdev, - led_classdev); - data->new_brightness = brightness; - queue_work(tpacpi_wq, &data->work); -} - -static enum led_brightness light_sysfs_get(struct led_classdev *led_cdev) -{ - return (light_get_status() == 1)? LED_FULL : LED_OFF; -} - -static struct tpacpi_led_classdev tpacpi_led_thinklight = { - .led_classdev = { - .name = "tpacpi::thinklight", - .brightness_set = &light_sysfs_set, - .brightness_get = &light_sysfs_get, - } -}; - static int __init light_init(struct ibm_init_struct *iibm) { - int rc = 0; - vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n"); TPACPI_ACPIHANDLE_INIT(ledb); TPACPI_ACPIHANDLE_INIT(lght); TPACPI_ACPIHANDLE_INIT(cmos); - INIT_WORK(&tpacpi_led_thinklight.work, light_set_status_worker); /* light not supported on 570, 600e/x, 770e, 770x, G4x, R30, R31 */ tp_features.light = (cmos_handle || lght_handle) && !ledb_handle; @@ -3340,31 +3130,13 @@ static int __init light_init(struct ibm_init_struct *iibm) vdbg_printk(TPACPI_DBG_INIT, "light is %s\n", str_supported(tp_features.light)); - if (tp_features.light) { - rc = led_classdev_register(&tpacpi_pdev->dev, - &tpacpi_led_thinklight.led_classdev); - } - - if (rc < 0) { - tp_features.light = 0; - tp_features.light_status = 0; - } else { - rc = (tp_features.light)? 0 : 1; - } - return rc; -} - -static void light_exit(void) -{ - led_classdev_unregister(&tpacpi_led_thinklight.led_classdev); - if (work_pending(&tpacpi_led_thinklight.work)) - flush_workqueue(tpacpi_wq); + return (tp_features.light)? 0 : 1; } static int light_read(char *p) { int len = 0; - int status; + int status = 0; if (!tp_features.light) { len += sprintf(p + len, "status:\t\tnot supported\n"); @@ -3372,9 +3144,8 @@ static int light_read(char *p) len += sprintf(p + len, "status:\t\tunknown\n"); len += sprintf(p + len, "commands:\ton, off\n"); } else { - status = light_get_status(); - if (status < 0) - return status; + if (!acpi_evalf(ec_handle, &status, "KBLT", "d")) + return -EIO; len += sprintf(p + len, "status:\t\t%s\n", onoff(status, 0)); len += sprintf(p + len, "commands:\ton, off\n"); } @@ -3384,29 +3155,37 @@ static int light_read(char *p) static int light_write(char *buf) { + int cmos_cmd, lght_cmd; char *cmd; - int newstatus = 0; + int success; if (!tp_features.light) return -ENODEV; while ((cmd = next_cmd(&buf))) { if (strlencmp(cmd, "on") == 0) { - newstatus = 1; + cmos_cmd = 0x0c; + lght_cmd = 1; } else if (strlencmp(cmd, "off") == 0) { - newstatus = 0; + cmos_cmd = 0x0d; + lght_cmd = 0; } else return -EINVAL; + + success = cmos_handle ? + acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) : + acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd); + if (!success) + return -EIO; } - return light_set_status(newstatus); + return 0; } static struct ibm_struct light_driver_data = { .name = "light", .read = light_read, .write = light_write, - .exit = light_exit, }; /************************************************************************* @@ -3804,12 +3583,6 @@ enum { /* For TPACPI_LED_OLD */ TPACPI_LED_EC_HLMS = 0x0e, /* EC reg to select led to command */ }; -enum led_status_t { - TPACPI_LED_OFF = 0, - TPACPI_LED_ON, - TPACPI_LED_BLINK, -}; - static enum led_access_mode led_supported; TPACPI_HANDLE(led, ec, "SLED", /* 570 */ @@ -3818,174 +3591,8 @@ TPACPI_HANDLE(led, ec, "SLED", /* 570 */ "LED", /* all others */ ); /* R30, R31 */ -#define TPACPI_LED_NUMLEDS 8 -static struct tpacpi_led_classdev *tpacpi_leds; -static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; -static const char const *tpacpi_led_names[TPACPI_LED_NUMLEDS] = { - /* there's a limit of 19 chars + NULL before 2.6.26 */ - "tpacpi::power", - "tpacpi:orange:batt", - "tpacpi:green:batt", - "tpacpi::dock_active", - "tpacpi::bay_active", - "tpacpi::dock_batt", - "tpacpi::unknown_led", - "tpacpi::standby", -}; - -static int led_get_status(unsigned int led) -{ - int status; - enum led_status_t led_s; - - switch (led_supported) { - case TPACPI_LED_570: - if (!acpi_evalf(ec_handle, - &status, "GLED", "dd", 1 << led)) - return -EIO; - led_s = (status == 0)? - TPACPI_LED_OFF : - ((status == 1)? - TPACPI_LED_ON : - TPACPI_LED_BLINK); - tpacpi_led_state_cache[led] = led_s; - return led_s; - default: - return -ENXIO; - } - - /* not reached */ -} - -static int led_set_status(unsigned int led, enum led_status_t ledstatus) -{ - /* off, on, blink. Index is led_status_t */ - static const int const led_sled_arg1[] = { 0, 1, 3 }; - static const int const led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ - static const int const led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ - static const int const led_led_arg1[] = { 0, 0x80, 0xc0 }; - - int rc = 0; - - switch (led_supported) { - case TPACPI_LED_570: - /* 570 */ - led = 1 << led; - if (!acpi_evalf(led_handle, NULL, NULL, "vdd", - led, led_sled_arg1[ledstatus])) - rc = -EIO; - break; - case TPACPI_LED_OLD: - /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ - led = 1 << led; - rc = ec_write(TPACPI_LED_EC_HLMS, led); - if (rc >= 0) - rc = ec_write(TPACPI_LED_EC_HLBL, - led * led_exp_hlbl[ledstatus]); - if (rc >= 0) - rc = ec_write(TPACPI_LED_EC_HLCL, - led * led_exp_hlcl[ledstatus]); - break; - case TPACPI_LED_NEW: - /* all others */ - if (!acpi_evalf(led_handle, NULL, NULL, "vdd", - led, led_led_arg1[ledstatus])) - rc = -EIO; - break; - default: - rc = -ENXIO; - } - - if (!rc) - tpacpi_led_state_cache[led] = ledstatus; - - return rc; -} - -static void led_sysfs_set_status(unsigned int led, - enum led_brightness brightness) -{ - led_set_status(led, - (brightness == LED_OFF) ? - TPACPI_LED_OFF : - (tpacpi_led_state_cache[led] == TPACPI_LED_BLINK) ? - TPACPI_LED_BLINK : TPACPI_LED_ON); -} - -static void led_set_status_worker(struct work_struct *work) -{ - struct tpacpi_led_classdev *data = - container_of(work, struct tpacpi_led_classdev, work); - - if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING)) - led_sysfs_set_status(data->led, data->new_brightness); -} - -static void led_sysfs_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct tpacpi_led_classdev *data = container_of(led_cdev, - struct tpacpi_led_classdev, led_classdev); - - data->new_brightness = brightness; - queue_work(tpacpi_wq, &data->work); -} - -static int led_sysfs_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, unsigned long *delay_off) -{ - struct tpacpi_led_classdev *data = container_of(led_cdev, - struct tpacpi_led_classdev, led_classdev); - - /* Can we choose the flash rate? */ - if (*delay_on == 0 && *delay_off == 0) { - /* yes. set them to the hardware blink rate (1 Hz) */ - *delay_on = 500; /* ms */ - *delay_off = 500; /* ms */ - } else if ((*delay_on != 500) || (*delay_off != 500)) - return -EINVAL; - - data->new_brightness = TPACPI_LED_BLINK; - queue_work(tpacpi_wq, &data->work); - - return 0; -} - -static enum led_brightness led_sysfs_get(struct led_classdev *led_cdev) -{ - int rc; - - struct tpacpi_led_classdev *data = container_of(led_cdev, - struct tpacpi_led_classdev, led_classdev); - - rc = led_get_status(data->led); - - if (rc == TPACPI_LED_OFF || rc < 0) - rc = LED_OFF; /* no error handling in led class :( */ - else - rc = LED_FULL; - - return rc; -} - -static void led_exit(void) -{ - unsigned int i; - - for (i = 0; i < TPACPI_LED_NUMLEDS; i++) { - if (tpacpi_leds[i].led_classdev.name) - led_classdev_unregister(&tpacpi_leds[i].led_classdev); - } - - kfree(tpacpi_leds); - tpacpi_leds = NULL; -} - static int __init led_init(struct ibm_init_struct *iibm) { - unsigned int i; - int rc; - vdbg_printk(TPACPI_DBG_INIT, "initializing LED subdriver\n"); TPACPI_ACPIHANDLE_INIT(led); @@ -4006,41 +3613,10 @@ static int __init led_init(struct ibm_init_struct *iibm) vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n", str_supported(led_supported), led_supported); - tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, - GFP_KERNEL); - if (!tpacpi_leds) { - printk(TPACPI_ERR "Out of memory for LED data\n"); - return -ENOMEM; - } - - for (i = 0; i < TPACPI_LED_NUMLEDS; i++) { - tpacpi_leds[i].led = i; - - tpacpi_leds[i].led_classdev.brightness_set = &led_sysfs_set; - tpacpi_leds[i].led_classdev.blink_set = &led_sysfs_blink_set; - if (led_supported == TPACPI_LED_570) - tpacpi_leds[i].led_classdev.brightness_get = - &led_sysfs_get; - - tpacpi_leds[i].led_classdev.name = tpacpi_led_names[i]; - - INIT_WORK(&tpacpi_leds[i].work, led_set_status_worker); - - rc = led_classdev_register(&tpacpi_pdev->dev, - &tpacpi_leds[i].led_classdev); - if (rc < 0) { - tpacpi_leds[i].led_classdev.name = NULL; - led_exit(); - return rc; - } - } - return (led_supported != TPACPI_LED_NONE)? 0 : 1; } -#define str_led_status(s) \ - ((s) == TPACPI_LED_OFF ? "off" : \ - ((s) == TPACPI_LED_ON ? "on" : "blinking")) +#define led_status(s) ((s) == 0 ? "off" : ((s) == 1 ? "on" : "blinking")) static int led_read(char *p) { @@ -4056,11 +3632,11 @@ static int led_read(char *p) /* 570 */ int i, status; for (i = 0; i < 8; i++) { - status = led_get_status(i); - if (status < 0) + if (!acpi_evalf(ec_handle, + &status, "GLED", "dd", 1 << i)) return -EIO; len += sprintf(p + len, "%d:\t\t%s\n", - i, str_led_status(status)); + i, led_status(status)); } } @@ -4070,11 +3646,16 @@ static int led_read(char *p) return len; } +/* off, on, blink */ +static const int led_sled_arg1[] = { 0, 1, 3 }; +static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ +static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ +static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; + static int led_write(char *buf) { char *cmd; - int led, rc; - enum led_status_t s; + int led, ind, ret; if (!led_supported) return -ENODEV; @@ -4084,18 +3665,38 @@ static int led_write(char *buf) return -EINVAL; if (strstr(cmd, "off")) { - s = TPACPI_LED_OFF; + ind = 0; } else if (strstr(cmd, "on")) { - s = TPACPI_LED_ON; + ind = 1; } else if (strstr(cmd, "blink")) { - s = TPACPI_LED_BLINK; - } else { + ind = 2; + } else return -EINVAL; - } - rc = led_set_status(led, s); - if (rc < 0) - return rc; + if (led_supported == TPACPI_LED_570) { + /* 570 */ + led = 1 << led; + if (!acpi_evalf(led_handle, NULL, NULL, "vdd", + led, led_sled_arg1[ind])) + return -EIO; + } else if (led_supported == TPACPI_LED_OLD) { + /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ + led = 1 << led; + ret = ec_write(TPACPI_LED_EC_HLMS, led); + if (ret >= 0) + ret = ec_write(TPACPI_LED_EC_HLBL, + led * led_exp_hlbl[ind]); + if (ret >= 0) + ret = ec_write(TPACPI_LED_EC_HLCL, + led * led_exp_hlcl[ind]); + if (ret < 0) + return ret; + } else { + /* all others */ + if (!acpi_evalf(led_handle, NULL, NULL, "vdd", + led, led_led_arg1[ind])) + return -EIO; + } } return 0; @@ -4105,7 +3706,6 @@ static struct ibm_struct led_driver_data = { .name = "led", .read = led_read, .write = led_write, - .exit = led_exit, }; /************************************************************************* @@ -4570,16 +4170,8 @@ static struct ibm_struct ecdump_driver_data = { #define TPACPI_BACKLIGHT_DEV_NAME "thinkpad_screen" -enum { - TP_EC_BACKLIGHT = 0x31, - - /* TP_EC_BACKLIGHT bitmasks */ - TP_EC_BACKLIGHT_LVLMSK = 0x1F, - TP_EC_BACKLIGHT_CMDMSK = 0xE0, - TP_EC_BACKLIGHT_MAPSW = 0x20, -}; - static struct backlight_device *ibm_backlight_device; +static int brightness_offset = 0x31; static int brightness_mode; static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */ @@ -4588,24 +4180,16 @@ static struct mutex brightness_mutex; /* * ThinkPads can read brightness from two places: EC 0x31, or * CMOS NVRAM byte 0x5E, bits 0-3. - * - * EC 0x31 has the following layout - * Bit 7: unknown function - * Bit 6: unknown function - * Bit 5: Z: honour scale changes, NZ: ignore scale changes - * Bit 4: must be set to zero to avoid problems - * Bit 3-0: backlight brightness level - * - * brightness_get_raw returns status data in the EC 0x31 layout */ -static int brightness_get_raw(int *status) +static int brightness_get(struct backlight_device *bd) { u8 lec = 0, lcmos = 0, level = 0; if (brightness_mode & 1) { - if (!acpi_ec_read(TP_EC_BACKLIGHT, &lec)) + if (!acpi_ec_read(brightness_offset, &lec)) return -EIO; - level = lec & TP_EC_BACKLIGHT_LVLMSK; + lec &= (tp_features.bright_16levels)? 0x0f : 0x07; + level = lec; }; if (brightness_mode & 2) { lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) @@ -4615,27 +4199,16 @@ static int brightness_get_raw(int *status) level = lcmos; } - if (brightness_mode == 3) { - *status = lec; /* Prefer EC, CMOS is just a backing store */ - lec &= TP_EC_BACKLIGHT_LVLMSK; - if (lec == lcmos) - tp_warned.bright_cmos_ec_unsync = 0; - else { - if (!tp_warned.bright_cmos_ec_unsync) { - printk(TPACPI_ERR - "CMOS NVRAM (%u) and EC (%u) do not " - "agree on display brightness level\n", - (unsigned int) lcmos, - (unsigned int) lec); - tp_warned.bright_cmos_ec_unsync = 1; - } - return -EIO; - } - } else { - *status = level; + if (brightness_mode == 3 && lec != lcmos) { + printk(TPACPI_ERR + "CMOS NVRAM (%u) and EC (%u) do not agree " + "on display brightness level\n", + (unsigned int) lcmos, + (unsigned int) lec); + return -EIO; } - return 0; + return level; } /* May return EINTR which can always be mapped to ERESTARTSYS */ @@ -4643,22 +4216,19 @@ static int brightness_set(int value) { int cmos_cmd, inc, i, res; int current_value; - int command_bits; - if (value > ((tp_features.bright_16levels)? 15 : 7) || - value < 0) + if (value > ((tp_features.bright_16levels)? 15 : 7)) return -EINVAL; res = mutex_lock_interruptible(&brightness_mutex); if (res < 0) return res; - res = brightness_get_raw(¤t_value); - if (res < 0) + current_value = brightness_get(NULL); + if (current_value < 0) { + res = current_value; goto errout; - - command_bits = current_value & TP_EC_BACKLIGHT_CMDMSK; - current_value &= TP_EC_BACKLIGHT_LVLMSK; + } cmos_cmd = value > current_value ? TP_CMOS_BRIGHTNESS_UP : @@ -4673,8 +4243,7 @@ static int brightness_set(int value) goto errout; } if ((brightness_mode & 1) && - !acpi_ec_write(TP_EC_BACKLIGHT, - (i + inc) | command_bits)) { + !acpi_ec_write(brightness_offset, i + inc)) { res = -EIO; goto errout;; } @@ -4697,17 +4266,6 @@ static int brightness_update_status(struct backlight_device *bd) bd->props.brightness : 0); } -static int brightness_get(struct backlight_device *bd) -{ - int status, res; - - res = brightness_get_raw(&status); - if (res < 0) - return 0; /* FIXME: teach backlight about error handling */ - - return status & TP_EC_BACKLIGHT_LVLMSK; -} - static struct backlight_ops ibm_backlight_data = { .get_brightness = brightness_get, .update_status = brightness_update_status, @@ -4715,6 +4273,100 @@ static struct backlight_ops ibm_backlight_data = { /* --------------------------------------------------------------------- */ +static int __init tpacpi_query_bcll_levels(acpi_handle handle) +{ + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; + int rc; + + if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { + obj = (union acpi_object *)buffer.pointer; + if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { + printk(TPACPI_ERR "Unknown BCLL data, " + "please report this to %s\n", TPACPI_MAIL); + rc = 0; + } else { + rc = obj->package.count; + } + } else { + return 0; + } + + kfree(buffer.pointer); + return rc; +} + +static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl, + void *context, void **rv) +{ + char name[ACPI_PATH_SEGMENT_LENGTH]; + struct acpi_buffer buffer = { sizeof(name), &name }; + + if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && + !strncmp("BCLL", name, sizeof(name) - 1)) { + if (tpacpi_query_bcll_levels(handle) == 16) { + *rv = handle; + return AE_CTRL_TERMINATE; + } else { + return AE_OK; + } + } else { + return AE_OK; + } +} + +static int __init brightness_check_levels(void) +{ + int status; + void *found_node = NULL; + + if (!vid_handle) { + TPACPI_ACPIHANDLE_INIT(vid); + } + if (!vid_handle) + return 0; + + /* Search for a BCLL package with 16 levels */ + status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3, + brightness_find_bcll, NULL, + &found_node); + + return (ACPI_SUCCESS(status) && found_node != NULL); +} + +static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl, + void *context, void **rv) +{ + char name[ACPI_PATH_SEGMENT_LENGTH]; + struct acpi_buffer buffer = { sizeof(name), &name }; + + if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && + !strncmp("_BCL", name, sizeof(name) - 1)) { + *rv = handle; + return AE_CTRL_TERMINATE; + } else { + return AE_OK; + } +} + +static int __init brightness_check_std_acpi_support(void) +{ + int status; + void *found_node = NULL; + + if (!vid_handle) { + TPACPI_ACPIHANDLE_INIT(vid); + } + if (!vid_handle) + return 0; + + /* Search for a _BCL method, but don't execute it */ + status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, + brightness_find_bcl, NULL, &found_node); + + return (ACPI_SUCCESS(status) && found_node != NULL); +} + static int __init brightness_init(struct ibm_init_struct *iibm) { int b; @@ -4723,42 +4375,20 @@ static int __init brightness_init(struct ibm_init_struct *iibm) mutex_init(&brightness_mutex); - /* - * We always attempt to detect acpi support, so as to switch - * Lenovo Vista BIOS to ACPI brightness mode even if we are not - * going to publish a backlight interface - */ - b = tpacpi_check_std_acpi_brightness_support(); - if (b > 0) { - if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { - printk(TPACPI_NOTICE - "Lenovo BIOS switched to ACPI backlight " - "control mode\n"); - } - if (brightness_enable > 1) { - printk(TPACPI_NOTICE - "standard ACPI backlight interface " - "available, not loading native one...\n"); - return 1; - } - } - if (!brightness_enable) { dbg_printk(TPACPI_DBG_INIT, "brightness support disabled by " "module parameter\n"); return 1; + } else if (brightness_enable > 1) { + if (brightness_check_std_acpi_support()) { + printk(TPACPI_NOTICE + "standard ACPI backlight interface " + "available, not loading native one...\n"); + return 1; + } } - if (b > 16) { - printk(TPACPI_ERR - "Unsupported brightness interface, " - "please contact %s\n", TPACPI_MAIL); - return 1; - } - if (b == 16) - tp_features.bright_16levels = 1; - if (!brightness_mode) { if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) brightness_mode = 2; @@ -4772,7 +4402,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) if (brightness_mode > 3) return -EINVAL; - if (brightness_get_raw(&b) < 0) + tp_features.bright_16levels = + thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO && + brightness_check_levels(); + + b = brightness_get(NULL); + if (b < 0) return 1; if (tp_features.bright_16levels) @@ -4790,7 +4425,7 @@ static int __init brightness_init(struct ibm_init_struct *iibm) ibm_backlight_device->props.max_brightness = (tp_features.bright_16levels)? 15 : 7; - ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; + ibm_backlight_device->props.brightness = b; backlight_update_status(ibm_backlight_device); return 0; @@ -5411,11 +5046,11 @@ static void fan_watchdog_reset(void) if (fan_watchdog_maxinterval > 0 && tpacpi_lifecycle != TPACPI_LIFE_EXITING) { fan_watchdog_active = 1; - if (!queue_delayed_work(tpacpi_wq, &fan_watchdog_task, + if (!schedule_delayed_work(&fan_watchdog_task, msecs_to_jiffies(fan_watchdog_maxinterval * 1000))) { printk(TPACPI_ERR - "failed to queue the fan watchdog, " + "failed to schedule the fan watchdog, " "watchdog will not trigger\n"); } } else @@ -5785,7 +5420,7 @@ static void fan_exit(void) &driver_attr_fan_watchdog); cancel_delayed_work(&fan_watchdog_task); - flush_workqueue(tpacpi_wq); + flush_scheduled_work(); } static int fan_read(char *p) @@ -6191,13 +5826,10 @@ static void __init get_thinkpad_model_data(struct thinkpad_id_data *tp) tp->model_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_VERSION), GFP_KERNEL); - if (tp->model_str && strnicmp(tp->model_str, "ThinkPad", 8) != 0) { + if (strnicmp(tp->model_str, "ThinkPad", 8) != 0) { kfree(tp->model_str); tp->model_str = NULL; } - - tp->nummodel_str = kstrdup(dmi_get_system_info(DMI_PRODUCT_NAME), - GFP_KERNEL); } static int __init probe_for_thinkpad(void) @@ -6439,9 +6071,6 @@ static void thinkpad_acpi_module_exit(void) if (proc_dir) remove_proc_entry(TPACPI_PROC_DIR, acpi_root_dir); - if (tpacpi_wq) - destroy_workqueue(tpacpi_wq); - kfree(thinkpad_id.bios_version_str); kfree(thinkpad_id.ec_version_str); kfree(thinkpad_id.model_str); @@ -6472,12 +6101,6 @@ static int __init thinkpad_acpi_module_init(void) TPACPI_ACPIHANDLE_INIT(ecrd); TPACPI_ACPIHANDLE_INIT(ecwr); - tpacpi_wq = create_singlethread_workqueue(TPACPI_WORKQUEUE_NAME); - if (!tpacpi_wq) { - thinkpad_acpi_module_exit(); - return -ENOMEM; - } - proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir); if (!proc_dir) { printk(TPACPI_ERR @@ -6600,8 +6223,6 @@ static int __init thinkpad_acpi_module_init(void) /* Please remove this in year 2009 */ MODULE_ALIAS("ibm_acpi"); -MODULE_ALIAS(TPACPI_DRVR_SHORTNAME); - /* * DMI matching for module autoloading * diff --git a/trunk/drivers/pnp/isapnp/Makefile b/trunk/drivers/pnp/isapnp/Makefile index cac18bbfb817..3e38f06f8d78 100644 --- a/trunk/drivers/pnp/isapnp/Makefile +++ b/trunk/drivers/pnp/isapnp/Makefile @@ -5,3 +5,7 @@ isapnp-proc-$(CONFIG_PROC_FS) = proc.o obj-y := core.o compat.o $(isapnp-proc-y) + +ifeq ($(CONFIG_PNP_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/trunk/drivers/pnp/pnpacpi/Makefile b/trunk/drivers/pnp/pnpacpi/Makefile index 905326fcca85..2d7a1e6908be 100644 --- a/trunk/drivers/pnp/pnpacpi/Makefile +++ b/trunk/drivers/pnp/pnpacpi/Makefile @@ -3,3 +3,7 @@ # obj-y := core.o rsparser.o + +ifeq ($(CONFIG_PNP_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/trunk/drivers/pnp/pnpacpi/core.c b/trunk/drivers/pnp/pnpacpi/core.c index 63e64ef39fb7..c283a9a70d83 100644 --- a/trunk/drivers/pnp/pnpacpi/core.c +++ b/trunk/drivers/pnp/pnpacpi/core.c @@ -44,7 +44,7 @@ static struct acpi_device_id excluded_id_list[] __initdata = { {"", 0}, }; -static inline int __init is_exclusive_device(struct acpi_device *dev) +static inline int is_exclusive_device(struct acpi_device *dev) { return (!acpi_match_device_ids(dev, excluded_id_list)); } diff --git a/trunk/drivers/pnp/pnpbios/Makefile b/trunk/drivers/pnp/pnpbios/Makefile index 3cd3ed760605..310e2b3a7710 100644 --- a/trunk/drivers/pnp/pnpbios/Makefile +++ b/trunk/drivers/pnp/pnpbios/Makefile @@ -5,3 +5,7 @@ pnpbios-proc-$(CONFIG_PNPBIOS_PROC_FS) = proc.o obj-y := core.o bioscalls.o rsparser.o $(pnpbios-proc-y) + +ifeq ($(CONFIG_PNP_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/trunk/drivers/thermal/Kconfig b/trunk/drivers/thermal/Kconfig index 4b628526df09..17e71d56f31e 100644 --- a/trunk/drivers/thermal/Kconfig +++ b/trunk/drivers/thermal/Kconfig @@ -3,7 +3,7 @@ # menuconfig THERMAL - tristate "Generic Thermal sysfs driver" + bool "Generic Thermal sysfs driver" help Generic Thermal Sysfs driver offers a generic mechanism for thermal management. Usually it's made up of one or more thermal @@ -11,4 +11,4 @@ menuconfig THERMAL Each thermal zone contains its own temperature, trip points, cooling devices. All platforms with ACPI thermal support can use this driver. - If you want this support, you should say Y or M here. + If you want this support, you should say Y here. diff --git a/trunk/drivers/thermal/Makefile b/trunk/drivers/thermal/Makefile index 31108a01c22e..8ef1232de376 100644 --- a/trunk/drivers/thermal/Makefile +++ b/trunk/drivers/thermal/Makefile @@ -2,4 +2,4 @@ # Makefile for sensor chip drivers. # -obj-$(CONFIG_THERMAL) += thermal_sys.o +obj-$(CONFIG_THERMAL) += thermal.o diff --git a/trunk/drivers/thermal/thermal_sys.c b/trunk/drivers/thermal/thermal.c similarity index 81% rename from trunk/drivers/thermal/thermal_sys.c rename to trunk/drivers/thermal/thermal.c index 6098787341f3..7f79bbf652d7 100644 --- a/trunk/drivers/thermal/thermal_sys.c +++ b/trunk/drivers/thermal/thermal.c @@ -31,7 +31,7 @@ #include #include -MODULE_AUTHOR("Zhang Rui"); +MODULE_AUTHOR("Zhang Rui") MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL"); @@ -295,164 +295,6 @@ thermal_cooling_device_trip_point_show(struct device *dev, /* Device management */ -#if defined(CONFIG_HWMON) || \ - (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) -/* hwmon sys I/F */ -#include -static LIST_HEAD(thermal_hwmon_list); - -static ssize_t -name_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct thermal_hwmon_device *hwmon = dev->driver_data; - return sprintf(buf, "%s\n", hwmon->type); -} -static DEVICE_ATTR(name, 0444, name_show, NULL); - -static ssize_t -temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct thermal_hwmon_attr *hwmon_attr - = container_of(attr, struct thermal_hwmon_attr, attr); - struct thermal_zone_device *tz - = container_of(hwmon_attr, struct thermal_zone_device, - temp_input); - - return tz->ops->get_temp(tz, buf); -} - -static ssize_t -temp_crit_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct thermal_hwmon_attr *hwmon_attr - = container_of(attr, struct thermal_hwmon_attr, attr); - struct thermal_zone_device *tz - = container_of(hwmon_attr, struct thermal_zone_device, - temp_crit); - - return tz->ops->get_trip_temp(tz, 0, buf); -} - - -static int -thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) -{ - struct thermal_hwmon_device *hwmon; - int new_hwmon_device = 1; - int result; - - mutex_lock(&thermal_list_lock); - list_for_each_entry(hwmon, &thermal_hwmon_list, node) - if (!strcmp(hwmon->type, tz->type)) { - new_hwmon_device = 0; - mutex_unlock(&thermal_list_lock); - goto register_sys_interface; - } - mutex_unlock(&thermal_list_lock); - - hwmon = kzalloc(sizeof(struct thermal_hwmon_device), GFP_KERNEL); - if (!hwmon) - return -ENOMEM; - - INIT_LIST_HEAD(&hwmon->tz_list); - strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH); - hwmon->device = hwmon_device_register(NULL); - if (IS_ERR(hwmon->device)) { - result = PTR_ERR(hwmon->device); - goto free_mem; - } - hwmon->device->driver_data = hwmon; - result = device_create_file(hwmon->device, &dev_attr_name); - if (result) - goto unregister_hwmon_device; - - register_sys_interface: - tz->hwmon = hwmon; - hwmon->count++; - - snprintf(tz->temp_input.name, THERMAL_NAME_LENGTH, - "temp%d_input", hwmon->count); - tz->temp_input.attr.attr.name = tz->temp_input.name; - tz->temp_input.attr.attr.mode = 0444; - tz->temp_input.attr.show = temp_input_show; - result = device_create_file(hwmon->device, &tz->temp_input.attr); - if (result) - goto unregister_hwmon_device; - - if (tz->ops->get_crit_temp) { - unsigned long temperature; - if (!tz->ops->get_crit_temp(tz, &temperature)) { - snprintf(tz->temp_crit.name, THERMAL_NAME_LENGTH, - "temp%d_crit", hwmon->count); - tz->temp_crit.attr.attr.name = tz->temp_crit.name; - tz->temp_crit.attr.attr.mode = 0444; - tz->temp_crit.attr.show = temp_crit_show; - result = device_create_file(hwmon->device, - &tz->temp_crit.attr); - if (result) - goto unregister_hwmon_device; - } - } - - mutex_lock(&thermal_list_lock); - if (new_hwmon_device) - list_add_tail(&hwmon->node, &thermal_hwmon_list); - list_add_tail(&tz->hwmon_node, &hwmon->tz_list); - mutex_unlock(&thermal_list_lock); - - return 0; - - unregister_hwmon_device: - device_remove_file(hwmon->device, &tz->temp_crit.attr); - device_remove_file(hwmon->device, &tz->temp_input.attr); - if (new_hwmon_device) { - device_remove_file(hwmon->device, &dev_attr_name); - hwmon_device_unregister(hwmon->device); - } - free_mem: - if (new_hwmon_device) - kfree(hwmon); - - return result; -} - -static void -thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) -{ - struct thermal_hwmon_device *hwmon = tz->hwmon; - - tz->hwmon = NULL; - device_remove_file(hwmon->device, &tz->temp_input.attr); - device_remove_file(hwmon->device, &tz->temp_crit.attr); - - mutex_lock(&thermal_list_lock); - list_del(&tz->hwmon_node); - if (!list_empty(&hwmon->tz_list)) { - mutex_unlock(&thermal_list_lock); - return; - } - list_del(&hwmon->node); - mutex_unlock(&thermal_list_lock); - - device_remove_file(hwmon->device, &dev_attr_name); - hwmon_device_unregister(hwmon->device); - kfree(hwmon); -} -#else -static int -thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) -{ - return 0; -} - -static void -thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) -{ -} -#endif - - /** * thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone * @tz: thermal zone device @@ -800,10 +642,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, goto unregister; } - result = thermal_add_hwmon_sysfs(tz); - if (result) - goto unregister; - mutex_lock(&thermal_list_lock); list_add_tail(&tz->node, &thermal_tz_list); if (ops->bind) @@ -862,7 +700,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) for (count = 0; count < tz->trips; count++) TRIP_POINT_ATTR_REMOVE(&tz->device, count); - thermal_remove_hwmon_sysfs(tz); release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); idr_destroy(&tz->idr); mutex_destroy(&tz->lock); diff --git a/trunk/include/acpi/acconfig.h b/trunk/include/acpi/acconfig.h index 28fe8bae1037..422f29c06c77 100644 --- a/trunk/include/acpi/acconfig.h +++ b/trunk/include/acpi/acconfig.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,7 +63,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20080321 +#define ACPI_CA_VERSION 0x20070126 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -150,17 +150,6 @@ #define ACPI_OBJ_NUM_OPERANDS 8 #define ACPI_OBJ_MAX_OPERAND 7 -/* Number of elements in the Result Stack frame, can be an arbitrary value */ - -#define ACPI_RESULTS_FRAME_OBJ_NUM 8 - -/* - * Maximal number of elements the Result Stack can contain, - * it may be an arbitray value not exceeding the types of - * result_size and result_count (now u8). - */ -#define ACPI_RESULTS_OBJ_NUM_MAX 255 - /* Names within the namespace are 4 bytes long */ #define ACPI_NAME_SIZE 4 diff --git a/trunk/include/acpi/acdebug.h b/trunk/include/acpi/acdebug.h index c5a1b50d8d94..d626bb1d2973 100644 --- a/trunk/include/acpi/acdebug.h +++ b/trunk/include/acpi/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acdisasm.h b/trunk/include/acpi/acdisasm.h index 788f88782012..389d772c7d5b 100644 --- a/trunk/include/acpi/acdisasm.h +++ b/trunk/include/acpi/acdisasm.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,23 +97,19 @@ typedef const struct acpi_dmtable_info { #define ACPI_DMT_CHKSUM 20 #define ACPI_DMT_SPACEID 21 #define ACPI_DMT_GAS 22 -#define ACPI_DMT_ASF 23 -#define ACPI_DMT_DMAR 24 -#define ACPI_DMT_HEST 25 -#define ACPI_DMT_HESTNTFY 26 -#define ACPI_DMT_HESTNTYP 27 -#define ACPI_DMT_MADT 28 -#define ACPI_DMT_SRAT 29 -#define ACPI_DMT_EXIT 30 -#define ACPI_DMT_SIG 31 +#define ACPI_DMT_DMAR 23 +#define ACPI_DMT_MADT 24 +#define ACPI_DMT_SRAT 25 +#define ACPI_DMT_EXIT 26 +#define ACPI_DMT_SIG 27 typedef -void (*acpi_dmtable_handler) (struct acpi_table_header * table); +void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); struct acpi_dmtable_data { char *signature; struct acpi_dmtable_info *table_info; - acpi_dmtable_handler table_handler; + ACPI_TABLE_HANDLER table_handler; char *name; }; @@ -153,7 +149,6 @@ extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; -extern struct acpi_dmtable_info acpi_dm_table_info_bert[]; extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; @@ -163,17 +158,11 @@ extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[]; extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[]; extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[]; extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; -extern struct acpi_dmtable_info acpi_dm_table_info_einj[]; -extern struct acpi_dmtable_info acpi_dm_table_info_einj0[]; -extern struct acpi_dmtable_info acpi_dm_table_info_erst[]; extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; extern struct acpi_dmtable_info acpi_dm_table_info_header[]; -extern struct acpi_dmtable_info acpi_dm_table_info_hest[]; -extern struct acpi_dmtable_info acpi_dm_table_info_hest9[]; -extern struct acpi_dmtable_info acpi_dm_table_info_hest_notify[]; extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; @@ -191,7 +180,6 @@ extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; -extern struct acpi_dmtable_info acpi_dm_table_info_slic[]; extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; @@ -206,7 +194,7 @@ extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; */ void acpi_dm_dump_data_table(struct acpi_table_header *table); -acpi_status +void acpi_dm_dump_table(u32 table_length, u32 table_offset, void *table, @@ -225,13 +213,9 @@ void acpi_dm_dump_cpep(struct acpi_table_header *table); void acpi_dm_dump_dmar(struct acpi_table_header *table); -void acpi_dm_dump_einj(struct acpi_table_header *table); - -void acpi_dm_dump_erst(struct acpi_table_header *table); - void acpi_dm_dump_fadt(struct acpi_table_header *table); -void acpi_dm_dump_hest(struct acpi_table_header *table); +void acpi_dm_dump_srat(struct acpi_table_header *table); void acpi_dm_dump_mcfg(struct acpi_table_header *table); @@ -243,8 +227,6 @@ void acpi_dm_dump_rsdt(struct acpi_table_header *table); void acpi_dm_dump_slit(struct acpi_table_header *table); -void acpi_dm_dump_srat(struct acpi_table_header *table); - void acpi_dm_dump_xsdt(struct acpi_table_header *table); /* diff --git a/trunk/include/acpi/acdispat.h b/trunk/include/acpi/acdispat.h index 910f018d92c7..7f690bb0f02f 100644 --- a/trunk/include/acpi/acdispat.h +++ b/trunk/include/acpi/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,9 +53,6 @@ acpi_status acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc); - acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc); acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc); @@ -70,19 +67,11 @@ acpi_status acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, union acpi_parse_object *op); -acpi_status -acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - acpi_status acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, union acpi_parse_object *op, union acpi_operand_object *obj_desc); -acpi_status -acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, - union acpi_parse_object *op); - acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); /* @@ -280,8 +269,6 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state); void acpi_ds_clear_operands(struct acpi_walk_state *walk_state); -acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state); - /* * dswscope - Scope Stack manipulation */ @@ -316,7 +303,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, u32 aml_length, struct acpi_evaluate_info *info, u8 pass_number); -void +acpi_status acpi_ds_obj_stack_pop_and_delete(u32 pop_count, struct acpi_walk_state *walk_state); @@ -329,11 +316,21 @@ void acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, struct acpi_thread_state *thread); +acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state); + +acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state); + acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state); struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state *thread); +#ifdef ACPI_FUTURE_USAGE +acpi_status +acpi_ds_result_remove(union acpi_operand_object **object, + u32 index, struct acpi_walk_state *walk_state); +#endif + acpi_status acpi_ds_result_pop(union acpi_operand_object **object, struct acpi_walk_state *walk_state); @@ -342,4 +339,8 @@ acpi_status acpi_ds_result_push(union acpi_operand_object *object, struct acpi_walk_state *walk_state); +acpi_status +acpi_ds_result_pop_from_bottom(union acpi_operand_object **object, + struct acpi_walk_state *walk_state); + #endif /* _ACDISPAT_H_ */ diff --git a/trunk/include/acpi/acevents.h b/trunk/include/acpi/acevents.h index d5d099bf349c..d23cdf326808 100644 --- a/trunk/include/acpi/acevents.h +++ b/trunk/include/acpi/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acexcep.h b/trunk/include/acpi/acexcep.h index 1f591171bf31..b73f18a48785 100644 --- a/trunk/include/acpi/acexcep.h +++ b/trunk/include/acpi/acexcep.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acglobal.h b/trunk/include/acpi/acglobal.h index 74ad971241db..47a1fd8f2d8a 100644 --- a/trunk/include/acpi/acglobal.h +++ b/trunk/include/acpi/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -170,14 +170,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; /* - * Global lock mutex is an actual AML mutex object - * Global lock semaphore works in conjunction with the HW global lock + * Global lock semaphore works in conjunction with the actual HW global lock */ -ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex; +ACPI_EXTERN acpi_mutex acpi_gbl_global_lock_mutex; ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore; -ACPI_EXTERN u16 acpi_gbl_global_lock_handle; -ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; -ACPI_EXTERN u8 acpi_gbl_global_lock_present; /* * Spinlocks are used for interfaces that can be possibly called at @@ -217,33 +213,27 @@ ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify; ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify; ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler; ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; -ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; -ACPI_EXTERN void *acpi_gbl_table_handler_context; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; -/* Owner ID support */ - -ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; -ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; -ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; - /* Misc */ ACPI_EXTERN u32 acpi_gbl_original_mode; ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; ACPI_EXTERN u32 acpi_gbl_ps_find_count; +ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save; +ACPI_EXTERN u16 acpi_gbl_global_lock_handle; +ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; +ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; ACPI_EXTERN u8 acpi_gbl_debugger_configuration; +ACPI_EXTERN u8 acpi_gbl_global_lock_acquired; ACPI_EXTERN u8 acpi_gbl_step_to_next_call; ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; +ACPI_EXTERN u8 acpi_gbl_global_lock_present; ACPI_EXTERN u8 acpi_gbl_events_initialized; ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; -#ifndef DEFINE_ACPI_GLOBALS - -/* Other miscellaneous */ - extern u8 acpi_gbl_shutdown; extern u32 acpi_gbl_startup_flags; extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; @@ -251,8 +241,6 @@ extern const char *acpi_gbl_highest_dstate_names[4]; extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; -#endif - /* Exception codes */ extern char const *acpi_gbl_exception_names_env[]; @@ -267,6 +255,8 @@ extern char const *acpi_gbl_exception_names_ctrl[]; * ****************************************************************************/ +#define NUM_NS_TYPES ACPI_TYPE_INVALID+1 + #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) #define NUM_PREDEFINED_NAMES 10 #else @@ -277,7 +267,7 @@ ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; -extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; +extern const u8 acpi_gbl_ns_properties[NUM_NS_TYPES]; extern const struct acpi_predefined_names acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES]; @@ -285,8 +275,8 @@ extern const struct acpi_predefined_names ACPI_EXTERN u32 acpi_gbl_current_node_count; ACPI_EXTERN u32 acpi_gbl_current_node_size; ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count; -ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer; -ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer; +ACPI_EXTERN acpi_size acpi_gbl_entry_stack_pointer; +ACPI_EXTERN acpi_size acpi_gbl_lowest_stack_pointer; ACPI_EXTERN u32 acpi_gbl_deepest_nesting; #endif diff --git a/trunk/include/acpi/achware.h b/trunk/include/acpi/achware.h index d4fb9bbc903c..4053df943453 100644 --- a/trunk/include/acpi/achware.h +++ b/trunk/include/acpi/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acinterp.h b/trunk/include/acpi/acinterp.h index e249ce5d3300..ce7c9d653910 100644 --- a/trunk/include/acpi/acinterp.h +++ b/trunk/include/acpi/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -215,6 +215,8 @@ acpi_ex_create_region(u8 * aml_start, u32 aml_length, u8 region_space, struct acpi_walk_state *walk_state); +acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state); + acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state); acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state); @@ -245,17 +247,10 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state); -acpi_status -acpi_ex_acquire_mutex_object(u16 timeout, - union acpi_operand_object *obj_desc, - acpi_thread_id thread_id); - acpi_status acpi_ex_release_mutex(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state); -acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc); - void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread); void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc); @@ -460,9 +455,9 @@ void acpi_ex_relinquish_interpreter(void); void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); -void acpi_ex_acquire_global_lock(u32 rule); +u8 acpi_ex_acquire_global_lock(u32 rule); -void acpi_ex_release_global_lock(u32 rule); +void acpi_ex_release_global_lock(u8 locked); void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); diff --git a/trunk/include/acpi/aclocal.h b/trunk/include/acpi/aclocal.h index c5cdc32ac2f8..202cd4242ba1 100644 --- a/trunk/include/acpi/aclocal.h +++ b/trunk/include/acpi/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -522,8 +522,9 @@ struct acpi_thread_state { * AML arguments */ struct acpi_result_values { - ACPI_STATE_COMMON - union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM]; + ACPI_STATE_COMMON u8 num_results; + u8 last_insert; + union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; }; typedef @@ -603,7 +604,6 @@ union acpi_parse_value { union acpi_parse_object *next; /* Next op */\ struct acpi_namespace_node *node; /* For use by interpreter */\ union acpi_parse_value value; /* Value or args associated with the opcode */\ - u8 arg_list_length; /* Number of elements in the arg list */\ ACPI_DISASM_ONLY_MEMBERS (\ u8 disasm_flags; /* Used during AML disassembly */\ u8 disasm_opcode; /* Subtype used for disassembly */\ @@ -696,8 +696,6 @@ struct acpi_parse_state { #define ACPI_PARSEOP_NAMED 0x02 #define ACPI_PARSEOP_DEFERRED 0x04 #define ACPI_PARSEOP_BYTELIST 0x08 -#define ACPI_PARSEOP_IN_STACK 0x10 -#define ACPI_PARSEOP_TARGET 0x20 #define ACPI_PARSEOP_IN_CACHE 0x80 /* Parse object disasm_flags */ diff --git a/trunk/include/acpi/acmacros.h b/trunk/include/acpi/acmacros.h index fb41a3b802fc..99d171c87c84 100644 --- a/trunk/include/acpi/acmacros.h +++ b/trunk/include/acpi/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,30 @@ #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) +#ifdef ACPI_NO_INTEGER64_SUPPORT +/* + * acpi_integer is 32-bits, no 64-bit support on this platform + */ +#define ACPI_LODWORD(l) ((u32)(l)) +#define ACPI_HIDWORD(l) ((u32)(0)) + +#else + +/* + * Full 64-bit address/integer on both 32-bit and 64-bit platforms + */ +#define ACPI_LODWORD(l) ((u32)(u64)(l)) +#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi)) +#endif + +/* + * printf() format helpers + */ + +/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ + +#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) + /* * Extract data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below. @@ -97,31 +121,6 @@ #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) #endif -/* - * Full 64-bit integer must be available on both 32-bit and 64-bit platforms - */ -struct acpi_integer_overlay { - u32 lo_dword; - u32 hi_dword; -}; - -#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword) -#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword) - -/* - * printf() format helpers - */ - -/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ - -#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) - -#if ACPI_MACHINE_WIDTH == 64 -#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) -#else -#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) -#endif - /* * Macros for moving data around to/from buffers that are possibly unaligned. * If the hardware supports the transfer of unaligned data, just do the store. @@ -138,29 +137,29 @@ struct acpi_integer_overlay { /* These macros reverse the bytes during the move, converting little-endian to big endian */ - /* Big Endian <== Little Endian */ - /* Hi...Lo Lo...Hi */ + /* Big Endian <== Little Endian */ + /* Hi...Lo Lo...Hi */ /* 16-bit source, 16/32/64 destination */ #define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ - (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} #define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ - ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ - ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} + ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ + ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} #define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ - ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ - ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} + ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ + ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} /* 32-bit source, 16/32/64 destination */ #define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ #define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ - (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ - (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ - (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} + (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ + (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ + (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} #define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ diff --git a/trunk/include/acpi/acnames.h b/trunk/include/acpi/acnames.h index c1343a9265fa..34bfae8a05f3 100644 --- a/trunk/include/acpi/acnames.h +++ b/trunk/include/acpi/acnames.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acnamesp.h b/trunk/include/acpi/acnamesp.h index 713b30903fe5..5ef38a6c8a61 100644 --- a/trunk/include/acpi/acnamesp.h +++ b/trunk/include/acpi/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,8 +113,7 @@ acpi_ns_parse_table(acpi_native_uint table_index, acpi_status acpi_ns_one_complete_parse(acpi_native_uint pass_number, - acpi_native_uint table_index, - struct acpi_namespace_node *start_node); + acpi_native_uint table_index); /* * nsaccess - Top-level namespace access diff --git a/trunk/include/acpi/acobject.h b/trunk/include/acpi/acobject.h index e9657dac69b7..7e1211a8b8fa 100644 --- a/trunk/include/acpi/acobject.h +++ b/trunk/include/acpi/acobject.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -155,9 +155,8 @@ struct acpi_object_event { struct acpi_object_mutex { ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ u16 acquisition_depth; /* Allow multiple Acquires, same thread */ - acpi_mutex os_mutex; /* Actual OS synchronization object */ - acpi_thread_id thread_id; /* Current owner of the mutex */ struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ + acpi_mutex os_mutex; /* Actual OS synchronization object */ union acpi_operand_object *prev; /* Link for list of acquired mutexes */ union acpi_operand_object *next; /* Link for list of acquired mutexes */ struct acpi_namespace_node *node; /* Containing namespace node */ diff --git a/trunk/include/acpi/acopcode.h b/trunk/include/acpi/acopcode.h index dfdf63327885..e6f76a280a94 100644 --- a/trunk/include/acpi/acopcode.h +++ b/trunk/include/acpi/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -233,7 +233,7 @@ #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) #define ARGI_DEBUG_OP ARG_NONE -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) +#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) @@ -246,7 +246,7 @@ #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) +#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) diff --git a/trunk/include/acpi/acoutput.h b/trunk/include/acpi/acoutput.h index e17873defcec..c090a8b0bc99 100644 --- a/trunk/include/acpi/acoutput.h +++ b/trunk/include/acpi/acoutput.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acparser.h b/trunk/include/acpi/acparser.h index 23ee0fbf5619..85c358e21014 100644 --- a/trunk/include/acpi/acparser.h +++ b/trunk/include/acpi/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,8 +109,6 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode); char *acpi_ps_get_opcode_name(u16 opcode); -u8 acpi_ps_get_argument_count(u32 op_type); - /* * psparse - top level parsing routines */ diff --git a/trunk/include/acpi/acpi.h b/trunk/include/acpi/acpi.h index c515ef6cc89e..2e5f00d3ea0d 100644 --- a/trunk/include/acpi/acpi.h +++ b/trunk/include/acpi/acpi.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acpiosxf.h b/trunk/include/acpi/acpiosxf.h index d4a560d2deb6..4839f2af94c3 100644 --- a/trunk/include/acpi/acpiosxf.h +++ b/trunk/include/acpi/acpiosxf.h @@ -8,7 +8,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/acpixf.h b/trunk/include/acpi/acpixf.h index 2c3806e6546f..d970f7f99549 100644 --- a/trunk/include/acpi/acpixf.h +++ b/trunk/include/acpi/acpixf.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,11 +119,6 @@ acpi_status acpi_get_table_by_index(acpi_native_uint table_index, struct acpi_table_header **out_table); -acpi_status -acpi_install_table_handler(acpi_tbl_handler handler, void *context); - -acpi_status acpi_remove_table_handler(acpi_tbl_handler handler); - /* * Namespace and name interfaces */ diff --git a/trunk/include/acpi/acresrc.h b/trunk/include/acpi/acresrc.h index eef5bd7a59fa..9486ab266a5e 100644 --- a/trunk/include/acpi/acresrc.h +++ b/trunk/include/acpi/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,7 +94,6 @@ typedef const struct acpi_rsconvert_info { #define ACPI_RSC_BITMASK16 18 #define ACPI_RSC_EXIT_NE 19 #define ACPI_RSC_EXIT_LE 20 -#define ACPI_RSC_EXIT_EQ 21 /* Resource Conversion sub-opcodes */ diff --git a/trunk/include/acpi/acstruct.h b/trunk/include/acpi/acstruct.h index a907c67d651e..88482655407f 100644 --- a/trunk/include/acpi/acstruct.h +++ b/trunk/include/acpi/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,15 +80,12 @@ struct acpi_walk_state { u16 opcode; /* Current AML opcode */ u8 next_op_info; /* Info about next_op */ u8 num_operands; /* Stack pointer for Operands[] array */ - u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */ acpi_owner_id owner_id; /* Owner of objects created during the walk */ u8 last_predicate; /* Result of last predicate */ u8 current_result; u8 return_used; u8 scope_depth; u8 pass_number; /* Parse pass during table load */ - u8 result_size; /* Total elements for the result stack */ - u8 result_count; /* Current number of occupied elements of result stack */ u32 aml_offset; u32 arg_types; u32 method_breakpoint; /* For single stepping */ diff --git a/trunk/include/acpi/actables.h b/trunk/include/acpi/actables.h index 4b36a55b0b3b..2b9f46f9da4d 100644 --- a/trunk/include/acpi/actables.h +++ b/trunk/include/acpi/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actbl.h b/trunk/include/acpi/actbl.h index 1ebbe883f786..955adfb8d64c 100644 --- a/trunk/include/acpi/actbl.h +++ b/trunk/include/acpi/actbl.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/actbl1.h b/trunk/include/acpi/actbl1.h index 9af239bd1153..a1b1b2ee3e51 100644 --- a/trunk/include/acpi/actbl1.h +++ b/trunk/include/acpi/actbl1.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,28 +58,20 @@ * it more difficult to inadvertently type in the wrong signature. */ #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ -#define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ -#define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ -#define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ -#define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ -#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ -#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ -#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ -#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ /* @@ -94,25 +86,13 @@ * portable, so do not use any other bitfield types. */ -/* Common Subtable header (used in MADT, SRAT, etc.) */ +/* Common Sub-table header (used in MADT, SRAT, etc.) */ struct acpi_subtable_header { u8 type; u8 length; }; -/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ - -struct acpi_whea_header { - u8 action; - u8 instruction; - u8 flags; - u8 reserved; - struct acpi_generic_address register_region; - u64 value; /* Value used with Read/Write register */ - u64 mask; /* Bitmask required for this register instruction */ -}; - /******************************************************************************* * * ASF - Alert Standard Format table (Signature "ASF!") @@ -222,35 +202,6 @@ struct acpi_asf_address { u8 devices; }; -/******************************************************************************* - * - * BERT - Boot Error Record Table - * - ******************************************************************************/ - -struct acpi_table_bert { - struct acpi_table_header header; /* Common ACPI table header */ - u32 region_length; /* Length of the boot error region */ - u64 address; /* Physical addresss of the error region */ -}; - -/* Boot Error Region */ - -struct acpi_bert_region { - u32 block_status; - u32 raw_data_offset; - u32 raw_data_length; - u32 data_length; - u32 error_severity; -}; - -/* block_status Flags */ - -#define ACPI_BERT_UNCORRECTABLE (1) -#define ACPI_BERT_CORRECTABLE (2) -#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) -#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) - /******************************************************************************* * * BOOT - Simple Boot Flag Table @@ -397,352 +348,6 @@ struct acpi_table_ecdt { u8 id[1]; /* Full namepath of the EC in the ACPI namespace */ }; -/******************************************************************************* - * - * EINJ - Error Injection Table - * - ******************************************************************************/ - -struct acpi_table_einj { - struct acpi_table_header header; /* Common ACPI table header */ - u32 header_length; - u32 reserved; - u32 entries; -}; - -/* EINJ Injection Instruction Entries (actions) */ - -struct acpi_einj_entry { - struct acpi_whea_header whea_header; /* Common header for WHEA tables */ -}; - -/* Values for Action field above */ - -enum acpi_einj_actions { - ACPI_EINJ_BEGIN_OPERATION = 0, - ACPI_EINJ_GET_TRIGGER_TABLE = 1, - ACPI_EINJ_SET_ERROR_TYPE = 2, - ACPI_EINJ_GET_ERROR_TYPE = 3, - ACPI_EINJ_END_OPERATION = 4, - ACPI_EINJ_EXECUTE_OPERATION = 5, - ACPI_EINJ_CHECK_BUSY_STATUS = 6, - ACPI_EINJ_GET_COMMAND_STATUS = 7, - ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */ - ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ -}; - -/* Values for Instruction field above */ - -enum acpi_einj_instructions { - ACPI_EINJ_READ_REGISTER = 0, - ACPI_EINJ_READ_REGISTER_VALUE = 1, - ACPI_EINJ_WRITE_REGISTER = 2, - ACPI_EINJ_WRITE_REGISTER_VALUE = 3, - ACPI_EINJ_NOOP = 4, - ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ -}; - -/* EINJ Trigger Error Action Table */ - -struct acpi_einj_trigger { - u32 header_size; - u32 revision; - u32 table_size; - u32 entry_count; -}; - -/******************************************************************************* - * - * ERST - Error Record Serialization Table - * - ******************************************************************************/ - -struct acpi_table_erst { - struct acpi_table_header header; /* Common ACPI table header */ - u32 header_length; - u32 reserved; - u32 entries; -}; - -/* ERST Serialization Entries (actions) */ - -struct acpi_erst_entry { - struct acpi_whea_header whea_header; /* Common header for WHEA tables */ -}; - -/* Values for Action field above */ - -enum acpi_erst_actions { - ACPI_ERST_BEGIN_WRITE_OPERATION = 0, - ACPI_ERST_BEGIN_READ_OPERATION = 1, - ACPI_ERST_BETGIN_CLEAR_OPERATION = 2, - ACPI_ERST_END_OPERATION = 3, - ACPI_ERST_SET_RECORD_OFFSET = 4, - ACPI_ERST_EXECUTE_OPERATION = 5, - ACPI_ERST_CHECK_BUSY_STATUS = 6, - ACPI_ERST_GET_COMMAND_STATUS = 7, - ACPI_ERST_GET_RECORD_IDENTIFIER = 8, - ACPI_ERST_SET_RECORD_IDENTIFIER = 9, - ACPI_ERST_GET_RECORD_COUNT = 10, - ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, - ACPI_ERST_NOT_USED = 12, - ACPI_ERST_GET_ERROR_RANGE = 13, - ACPI_ERST_GET_ERROR_LENGTH = 14, - ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, - ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ -}; - -/* Values for Instruction field above */ - -enum acpi_erst_instructions { - ACPI_ERST_READ_REGISTER = 0, - ACPI_ERST_READ_REGISTER_VALUE = 1, - ACPI_ERST_WRITE_REGISTER = 2, - ACPI_ERST_WRITE_REGISTER_VALUE = 3, - ACPI_ERST_NOOP = 4, - ACPI_ERST_LOAD_VAR1 = 5, - ACPI_ERST_LOAD_VAR2 = 6, - ACPI_ERST_STORE_VAR1 = 7, - ACPI_ERST_ADD = 8, - ACPI_ERST_SUBTRACT = 9, - ACPI_ERST_ADD_VALUE = 10, - ACPI_ERST_SUBTRACT_VALUE = 11, - ACPI_ERST_STALL = 12, - ACPI_ERST_STALL_WHILE_TRUE = 13, - ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, - ACPI_ERST_GOTO = 15, - ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, - ACPI_ERST_SET_DST_ADDRESS_BASE = 17, - ACPI_ERST_MOVE_DATA = 18, - ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ -}; - -/******************************************************************************* - * - * HEST - Hardware Error Source Table - * - ******************************************************************************/ - -struct acpi_table_hest { - struct acpi_table_header header; /* Common ACPI table header */ - u32 error_source_count; -}; - -/* HEST subtable header */ - -struct acpi_hest_header { - u16 type; -}; - -/* Values for Type field above for subtables */ - -enum acpi_hest_types { - ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, - ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, - ACPI_HEST_TYPE_XPF_UNUSED = 2, - ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, - ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, - ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, - ACPI_HEST_TYPE_AER_ROOT_PORT = 6, - ACPI_HEST_TYPE_AER_ENDPOINT = 7, - ACPI_HEST_TYPE_AER_BRIDGE = 8, - ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, - ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ -}; - -/* - * HEST Sub-subtables - */ - -/* XPF Machine Check Error Bank */ - -struct acpi_hest_xpf_error_bank { - u8 bank_number; - u8 clear_status_on_init; - u8 status_format; - u8 config_write_enable; - u32 control_register; - u64 control_init_data; - u32 status_register; - u32 address_register; - u32 misc_register; -}; - -/* Generic Error Status */ - -struct acpi_hest_generic_status { - u32 block_status; - u32 raw_data_offset; - u32 raw_data_length; - u32 data_length; - u32 error_severity; -}; - -/* Generic Error Data */ - -struct acpi_hest_generic_data { - u8 section_type[16]; - u32 error_severity; - u16 revision; - u8 validation_bits; - u8 flags; - u32 error_data_length; - u8 fru_id[16]; - u8 fru_text[20]; -}; - -/* Common HEST structure for PCI/AER types below (6,7,8) */ - -struct acpi_hest_aer_common { - u16 source_id; - u16 config_write_enable; - u8 flags; - u8 enabled; - u32 records_to_pre_allocate; - u32 max_sections_per_record; - u32 bus; - u16 device; - u16 function; - u16 device_control; - u16 reserved; - u32 uncorrectable_error_mask; - u32 uncorrectable_error_severity; - u32 correctable_error_mask; - u32 advanced_error_cababilities; -}; - -/* Hardware Error Notification */ - -struct acpi_hest_notify { - u8 type; - u8 length; - u16 config_write_enable; - u32 poll_interval; - u32 vector; - u32 polling_threshold_value; - u32 polling_threshold_window; - u32 error_threshold_value; - u32 error_threshold_window; -}; - -/* Values for Notify Type field above */ - -enum acpi_hest_notify_types { - ACPI_HEST_NOTIFY_POLLED = 0, - ACPI_HEST_NOTIFY_EXTERNAL = 1, - ACPI_HEST_NOTIFY_LOCAL = 2, - ACPI_HEST_NOTIFY_SCI = 3, - ACPI_HEST_NOTIFY_NMI = 4, - ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ -}; - -/* - * HEST subtables - * - * From WHEA Design Document, 16 May 2007. - * Note: There is no subtable type 2 in this version of the document, - * and there are two different subtable type 3s. - */ - - /* 0: XPF Machine Check Exception */ - -struct acpi_hest_xpf_machine_check { - struct acpi_hest_header header; - u16 source_id; - u16 config_write_enable; - u8 flags; - u8 reserved1; - u32 records_to_pre_allocate; - u32 max_sections_per_record; - u64 global_capability_data; - u64 global_control_data; - u8 num_hardware_banks; - u8 reserved2[7]; -}; - -/* 1: XPF Corrected Machine Check */ - -struct acpi_table_hest_xpf_corrected { - struct acpi_hest_header header; - u16 source_id; - u16 config_write_enable; - u8 flags; - u8 enabled; - u32 records_to_pre_allocate; - u32 max_sections_per_record; - struct acpi_hest_notify notify; - u8 num_hardware_banks; - u8 reserved[3]; -}; - -/* 3: XPF Non-Maskable Interrupt */ - -struct acpi_hest_xpf_nmi { - struct acpi_hest_header header; - u16 source_id; - u32 reserved; - u32 records_to_pre_allocate; - u32 max_sections_per_record; - u32 max_raw_data_length; -}; - -/* 4: IPF Corrected Machine Check */ - -struct acpi_hest_ipf_corrected { - struct acpi_hest_header header; - u8 enabled; - u8 reserved; -}; - -/* 5: IPF Corrected Platform Error */ - -struct acpi_hest_ipf_corrected_platform { - struct acpi_hest_header header; - u8 enabled; - u8 reserved; -}; - -/* 6: PCI Express Root Port AER */ - -struct acpi_hest_aer_root { - struct acpi_hest_header header; - struct acpi_hest_aer_common aer; - u32 root_error_command; -}; - -/* 7: PCI Express AER (AER Endpoint) */ - -struct acpi_hest_aer { - struct acpi_hest_header header; - struct acpi_hest_aer_common aer; -}; - -/* 8: PCI Express/PCI-X Bridge AER */ - -struct acpi_hest_aer_bridge { - struct acpi_hest_header header; - struct acpi_hest_aer_common aer; - u32 secondary_uncorrectable_error_mask; - u32 secondary_uncorrectable_error_severity; - u32 secondary_advanced_capabilities; -}; - -/* 9: Generic Hardware Error Source */ - -struct acpi_hest_generic { - struct acpi_hest_header header; - u16 source_id; - u16 related_source_id; - u8 config_write_enable; - u8 enabled; - u32 records_to_pre_allocate; - u32 max_sections_per_record; - u32 max_raw_data_length; - struct acpi_generic_address error_status_address; - struct acpi_hest_notify notify; - u32 error_status_block_length; -}; - /******************************************************************************* * * HPET - High Precision Event Timer table @@ -766,96 +371,6 @@ struct acpi_table_hpet { /*! [End] no source code translation !*/ -/******************************************************************************* - * - * IBFT - Boot Firmware Table - * - ******************************************************************************/ - -struct acpi_table_ibft { - struct acpi_table_header header; /* Common ACPI table header */ - u8 reserved[12]; -}; - -/* IBFT common subtable header */ - -struct acpi_ibft_header { - u8 type; - u8 version; - u16 length; - u8 index; - u8 flags; -}; - -/* Values for Type field above */ - -enum acpi_ibft_type { - ACPI_IBFT_TYPE_NOT_USED = 0, - ACPI_IBFT_TYPE_CONTROL = 1, - ACPI_IBFT_TYPE_INITIATOR = 2, - ACPI_IBFT_TYPE_NIC = 3, - ACPI_IBFT_TYPE_TARGET = 4, - ACPI_IBFT_TYPE_EXTENSIONS = 5, - ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; - -/* IBFT subtables */ - -struct acpi_ibft_control { - struct acpi_ibft_header header; - u16 extensions; - u16 initiator_offset; - u16 nic0_offset; - u16 target0_offset; - u16 nic1_offset; - u16 target1_offset; -}; - -struct acpi_ibft_initiator { - struct acpi_ibft_header header; - u8 sns_server[16]; - u8 slp_server[16]; - u8 primary_server[16]; - u8 secondary_server[16]; - u16 name_length; - u16 name_offset; -}; - -struct acpi_ibft_nic { - struct acpi_ibft_header header; - u8 ip_address[16]; - u8 subnet_mask_prefix; - u8 origin; - u8 gateway[16]; - u8 primary_dns[16]; - u8 secondary_dns[16]; - u8 dhcp[16]; - u16 vlan; - u8 mac_address[6]; - u16 pci_address; - u16 name_length; - u16 name_offset; -}; - -struct acpi_ibft_target { - struct acpi_ibft_header header; - u8 target_ip_address[16]; - u16 target_ip_socket; - u8 target_boot_lun[8]; - u8 chap_type; - u8 nic_association; - u16 target_name_length; - u16 target_name_offset; - u16 chap_name_length; - u16 chap_name_offset; - u16 chap_secret_length; - u16 chap_secret_offset; - u16 reverse_chap_name_length; - u16 reverse_chap_name_offset; - u16 reverse_chap_secret_length; - u16 reverse_chap_secret_offset; -}; - /******************************************************************************* * * MADT - Multiple APIC Description Table @@ -1180,78 +695,6 @@ struct acpi_table_tcpa { u64 log_address; /* Address of the event log area */ }; -/******************************************************************************* - * - * UEFI - UEFI Boot optimization Table - * - ******************************************************************************/ - -struct acpi_table_uefi { - struct acpi_table_header header; /* Common ACPI table header */ - u8 identifier[16]; /* UUID identifier */ - u16 data_offset; /* Offset of remaining data in table */ - u8 data; -}; - -/******************************************************************************* - * - * WDAT - Watchdog Action Table - * - ******************************************************************************/ - -struct acpi_table_wdat { - struct acpi_table_header header; /* Common ACPI table header */ - u32 header_length; /* Watchdog Header Length */ - u16 pci_segment; /* PCI Segment number */ - u8 pci_bus; /* PCI Bus number */ - u8 pci_device; /* PCI Device number */ - u8 pci_function; /* PCI Function number */ - u8 reserved[3]; - u32 timer_period; /* Period of one timer count (msec) */ - u32 max_count; /* Maximum counter value supported */ - u32 min_count; /* Minimum counter value */ - u8 flags; - u8 reserved2[3]; - u32 entries; /* Number of watchdog entries that follow */ -}; - -/* WDAT Instruction Entries (actions) */ - -struct acpi_wdat_entry { - struct acpi_whea_header whea_header; /* Common header for WHEA tables */ -}; - -/* Values for Action field above */ - -enum acpi_wdat_actions { - ACPI_WDAT_RESET = 1, - ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, - ACPI_WDAT_GET_COUNTDOWN = 5, - ACPI_WDAT_SET_COUNTDOWN = 6, - ACPI_WDAT_GET_RUNNING_STATE = 8, - ACPI_WDAT_SET_RUNNING_STATE = 9, - ACPI_WDAT_GET_STOPPED_STATE = 10, - ACPI_WDAT_SET_STOPPED_STATE = 11, - ACPI_WDAT_GET_REBOOT = 16, - ACPI_WDAT_SET_REBOOT = 17, - ACPI_WDAT_GET_SHUTDOWN = 18, - ACPI_WDAT_SET_SHUTDOWN = 19, - ACPI_WDAT_GET_STATUS = 32, - ACPI_WDAT_SET_STATUS = 33, - ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ -}; - -/* Values for Instruction field above */ - -enum acpi_wdat_instructions { - ACPI_WDAT_READ_VALUE = 0, - ACPI_WDAT_READ_COUNTDOWN = 1, - ACPI_WDAT_WRITE_VALUE = 2, - ACPI_WDAT_WRITE_COUNTDOWN = 3, - ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ - ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ -}; - /******************************************************************************* * * WDRT - Watchdog Resource Table diff --git a/trunk/include/acpi/actypes.h b/trunk/include/acpi/actypes.h index dfea2d440488..e73a38939120 100644 --- a/trunk/include/acpi/actypes.h +++ b/trunk/include/acpi/actypes.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -323,11 +323,27 @@ struct uint32_struct { #define acpi_semaphore void * /* - * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI - * version 2, integers are 64 bits. Note that this pertains to the ACPI integer - * type only, not other integers used in the implementation of the ACPI CA + * Acpi integer width. In ACPI version 1, integers are + * 32 bits. In ACPI version 2, integers are 64 bits. + * Note that this pertains to the ACPI integer type only, not + * other integers used in the implementation of the ACPI CA * subsystem. */ +#ifdef ACPI_NO_INTEGER64_SUPPORT + +/* 32-bit integers only, no 64-bit support */ + +typedef u32 acpi_integer; +#define ACPI_INTEGER_MAX ACPI_UINT32_MAX +#define ACPI_INTEGER_BIT_SIZE 32 +#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ + +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ + +#else + +/* 64-bit integers */ + typedef unsigned long long acpi_integer; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 @@ -336,6 +352,7 @@ typedef unsigned long long acpi_integer; #if ACPI_MACHINE_WIDTH == 64 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif +#endif #define ACPI_MAX64_DECIMAL_DIGITS 20 #define ACPI_MAX32_DECIMAL_DIGITS 10 @@ -402,20 +419,14 @@ typedef unsigned long long acpi_integer; /* * Standard notify values */ -#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 -#define ACPI_NOTIFY_DEVICE_CHECK (u8) 0x01 -#define ACPI_NOTIFY_DEVICE_WAKE (u8) 0x02 -#define ACPI_NOTIFY_EJECT_REQUEST (u8) 0x03 -#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 0x04 -#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 0x05 -#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 0x06 -#define ACPI_NOTIFY_POWER_FAULT (u8) 0x07 -#define ACPI_NOTIFY_CAPABILITIES_CHECK (u8) 0x08 -#define ACPI_NOTIFY_DEVICE_PLD_CHECK (u8) 0x09 -#define ACPI_NOTIFY_RESERVED (u8) 0x0A -#define ACPI_NOTIFY_LOCALITY_UPDATE (u8) 0x0B - -#define ACPI_NOTIFY_MAX 0x0B +#define ACPI_NOTIFY_BUS_CHECK (u8) 0 +#define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 +#define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 +#define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 +#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 +#define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 +#define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 +#define ACPI_NOTIFY_POWER_FAULT (u8) 7 /* * Types associated with ACPI names and objects. The first group of @@ -483,8 +494,6 @@ typedef u32 acpi_object_type; #define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF -#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) - /* * All I/O */ @@ -590,7 +599,7 @@ typedef u32 acpi_event_status; #define ACPI_SYSTEM_NOTIFY 0x1 #define ACPI_DEVICE_NOTIFY 0x2 -#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) +#define ACPI_ALL_NOTIFY 0x3 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 #define ACPI_MAX_SYS_NOTIFY 0x7f @@ -645,51 +654,46 @@ typedef u8 acpi_adr_space_type; /* * External ACPI object definition */ - -/* - * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element - * or an unresolved named reference. - */ union acpi_object { acpi_object_type type; /* See definition of acpi_ns_type for values */ struct { - acpi_object_type type; /* ACPI_TYPE_INTEGER */ + acpi_object_type type; acpi_integer value; /* The actual number */ } integer; struct { - acpi_object_type type; /* ACPI_TYPE_STRING */ + acpi_object_type type; u32 length; /* # of bytes in string, excluding trailing null */ char *pointer; /* points to the string value */ } string; struct { - acpi_object_type type; /* ACPI_TYPE_BUFFER */ + acpi_object_type type; u32 length; /* # of bytes in buffer */ u8 *pointer; /* points to the buffer */ } buffer; struct { - acpi_object_type type; /* ACPI_TYPE_PACKAGE */ + acpi_object_type type; + u32 fill1; + acpi_handle handle; /* object reference */ + } reference; + + struct { + acpi_object_type type; u32 count; /* # of elements in package */ union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ } package; struct { - acpi_object_type type; /* ACPI_TYPE_LOCAL_REFERENCE */ - acpi_object_type actual_type; /* Type associated with the Handle */ - acpi_handle handle; /* object reference */ - } reference; - - struct { - acpi_object_type type; /* ACPI_TYPE_PROCESSOR */ + acpi_object_type type; u32 proc_id; acpi_io_address pblk_address; u32 pblk_length; } processor; struct { - acpi_object_type type; /* ACPI_TYPE_POWER */ + acpi_object_type type; u32 system_level; u32 resource_order; } power_resource; @@ -743,12 +747,6 @@ struct acpi_system_info { u32 debug_layer; }; -/* Table Event Types */ - -#define ACPI_TABLE_EVENT_LOAD 0x0 -#define ACPI_TABLE_EVENT_UNLOAD 0x1 -#define ACPI_NUM_TABLE_EVENTS 2 - /* * Types specific to the OS service interfaces */ @@ -778,11 +776,6 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status, u16 opcode, u32 aml_offset, void *context); -/* Table Event handler (Load, load_table etc) and types */ - -typedef -acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context); - /* Address Spaces (For Operation Regions) */ typedef @@ -997,7 +990,6 @@ struct acpi_vendor_uuid { * Structures used to describe device resources */ struct acpi_resource_irq { - u8 descriptor_length; u8 triggering; u8 polarity; u8 sharable; @@ -1014,7 +1006,6 @@ struct acpi_resource_dma { }; struct acpi_resource_start_dependent { - u8 descriptor_length; u8 compatibility_priority; u8 performance_robustness; }; diff --git a/trunk/include/acpi/acutils.h b/trunk/include/acpi/acutils.h index b42cadf07302..a2918547c73f 100644 --- a/trunk/include/acpi/acutils.h +++ b/trunk/include/acpi/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,8 +116,6 @@ void acpi_ut_init_globals(void); char *acpi_ut_get_mutex_name(u32 mutex_id); -const char *acpi_ut_get_notify_name(u32 notify_value); - #endif char *acpi_ut_get_type_name(acpi_object_type type); diff --git a/trunk/include/acpi/amlcode.h b/trunk/include/acpi/amlcode.h index ff851c5df698..da53a4ef287a 100644 --- a/trunk/include/acpi/amlcode.h +++ b/trunk/include/acpi/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/amlresrc.h b/trunk/include/acpi/amlresrc.h index 7b070e42b7c5..f7d541239da4 100644 --- a/trunk/include/acpi/amlresrc.h +++ b/trunk/include/acpi/amlresrc.h @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/platform/acenv.h b/trunk/include/acpi/platform/acenv.h index fcd2572e428c..c785485e62a6 100644 --- a/trunk/include/acpi/platform/acenv.h +++ b/trunk/include/acpi/platform/acenv.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/platform/acgcc.h b/trunk/include/acpi/platform/acgcc.h index 8996dba90cd9..3bb50494a38a 100644 --- a/trunk/include/acpi/platform/acgcc.h +++ b/trunk/include/acpi/platform/acgcc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/acpi/platform/aclinux.h b/trunk/include/acpi/platform/aclinux.h index 9af464598682..6ed15a0978eb 100644 --- a/trunk/include/acpi/platform/aclinux.h +++ b/trunk/include/acpi/platform/aclinux.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2008, Intel Corp. + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/trunk/include/linux/thermal.h b/trunk/include/linux/thermal.h index 06d3e6eb9ca8..90c1c191ea69 100644 --- a/trunk/include/linux/thermal.h +++ b/trunk/include/linux/thermal.h @@ -41,7 +41,6 @@ struct thermal_zone_device_ops { int (*set_mode) (struct thermal_zone_device *, const char *); int (*get_trip_type) (struct thermal_zone_device *, int, char *); int (*get_trip_temp) (struct thermal_zone_device *, int, char *); - int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); }; struct thermal_cooling_device_ops { @@ -66,23 +65,6 @@ struct thermal_cooling_device { ((long)t-2732+5)/10 : ((long)t-2732-5)/10) #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) -#if defined(CONFIG_HWMON) || \ - (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) -/* thermal zone devices with the same type share one hwmon device */ -struct thermal_hwmon_device { - char type[THERMAL_NAME_LENGTH]; - struct device *device; - int count; - struct list_head tz_list; - struct list_head node; -}; - -struct thermal_hwmon_attr { - struct device_attribute attr; - char name[16]; -}; -#endif - struct thermal_zone_device { int id; char type[THERMAL_NAME_LENGTH]; @@ -94,13 +76,6 @@ struct thermal_zone_device { struct idr idr; struct mutex lock; /* protect cooling devices list */ struct list_head node; -#if defined(CONFIG_HWMON) || \ - (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) - struct list_head hwmon_node; - struct thermal_hwmon_device *hwmon; - struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ - struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ -#endif }; struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, @@ -113,10 +88,24 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *); int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *); + +#ifdef CONFIG_THERMAL struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, struct thermal_cooling_device_ops *); void thermal_cooling_device_unregister(struct thermal_cooling_device *); +#else +static inline struct thermal_cooling_device +*thermal_cooling_device_register(char *c, void *v, + struct thermal_cooling_device_ops *t) +{ + return NULL; +} +static inline + void thermal_cooling_device_unregister(struct thermal_cooling_device *t) +{ +}; +#endif #endif /* __THERMAL_H__ */ diff --git a/trunk/kernel/power/Kconfig b/trunk/kernel/power/Kconfig index b45da40e8d25..6233f3b4ae66 100644 --- a/trunk/kernel/power/Kconfig +++ b/trunk/kernel/power/Kconfig @@ -19,6 +19,16 @@ config PM will issue the hlt instruction if nothing is to be done, thereby sending the processor to sleep and saving power. +config PM_LEGACY + bool "Legacy Power Management API (DEPRECATED)" + depends on PM + default n + ---help--- + Support for pm_register() and friends. This old API is obsoleted + by the driver model. + + If unsure, say N. + config PM_DEBUG bool "Power Management Debug Support" depends on PM diff --git a/trunk/kernel/power/Makefile b/trunk/kernel/power/Makefile index 597823b5b700..f7dfff28ecdb 100644 --- a/trunk/kernel/power/Makefile +++ b/trunk/kernel/power/Makefile @@ -4,6 +4,7 @@ EXTRA_CFLAGS += -DDEBUG endif obj-y := main.o +obj-$(CONFIG_PM_LEGACY) += pm.o obj-$(CONFIG_PM_SLEEP) += process.o console.o obj-$(CONFIG_HIBERNATION) += swsusp.o disk.o snapshot.o swap.o user.o diff --git a/trunk/kernel/power/pm.c b/trunk/kernel/power/pm.c new file mode 100644 index 000000000000..60c73fa670d5 --- /dev/null +++ b/trunk/kernel/power/pm.c @@ -0,0 +1,205 @@ +/* + * pm.c - Power management interface + * + * Copyright (C) 2000 Andrew Henroid + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Locking notes: + * pm_devs_lock can be a semaphore providing pm ops are not called + * from an interrupt handler (already a bad idea so no change here). Each + * change must be protected so that an unlink of an entry doesn't clash + * with a pm send - which is permitted to sleep in the current architecture + * + * Module unloads clashing with pm events now work out safely, the module + * unload path will block until the event has been sent. It may well block + * until a resume but that will be fine. + */ + +static DEFINE_MUTEX(pm_devs_lock); +static LIST_HEAD(pm_devs); + +/** + * pm_register - register a device with power management + * @type: device type + * @id: device ID + * @callback: callback function + * + * Add a device to the list of devices that wish to be notified about + * power management events. A &pm_dev structure is returned on success, + * on failure the return is %NULL. + * + * The callback function will be called in process context and + * it may sleep. + */ + +struct pm_dev *pm_register(pm_dev_t type, + unsigned long id, + pm_callback callback) +{ + struct pm_dev *dev = kzalloc(sizeof(struct pm_dev), GFP_KERNEL); + if (dev) { + dev->type = type; + dev->id = id; + dev->callback = callback; + + mutex_lock(&pm_devs_lock); + list_add(&dev->entry, &pm_devs); + mutex_unlock(&pm_devs_lock); + } + return dev; +} + +/** + * pm_send - send request to a single device + * @dev: device to send to + * @rqst: power management request + * @data: data for the callback + * + * Issue a power management request to a given device. The + * %PM_SUSPEND and %PM_RESUME events are handled specially. The + * data field must hold the intended next state. No call is made + * if the state matches. + * + * BUGS: what stops two power management requests occurring in parallel + * and conflicting. + * + * WARNING: Calling pm_send directly is not generally recommended, in + * particular there is no locking against the pm_dev going away. The + * caller must maintain all needed locking or have 'inside knowledge' + * on the safety. Also remember that this function is not locked against + * pm_unregister. This means that you must handle SMP races on callback + * execution and unload yourself. + */ + +static int pm_send(struct pm_dev *dev, pm_request_t rqst, void *data) +{ + int status = 0; + unsigned long prev_state, next_state; + + if (in_interrupt()) + BUG(); + + switch (rqst) { + case PM_SUSPEND: + case PM_RESUME: + prev_state = dev->state; + next_state = (unsigned long) data; + if (prev_state != next_state) { + if (dev->callback) + status = (*dev->callback)(dev, rqst, data); + if (!status) { + dev->state = next_state; + dev->prev_state = prev_state; + } + } + else { + dev->prev_state = prev_state; + } + break; + default: + if (dev->callback) + status = (*dev->callback)(dev, rqst, data); + break; + } + return status; +} + +/* + * Undo incomplete request + */ +static void pm_undo_all(struct pm_dev *last) +{ + struct list_head *entry = last->entry.prev; + while (entry != &pm_devs) { + struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); + if (dev->state != dev->prev_state) { + /* previous state was zero (running) resume or + * previous state was non-zero (suspended) suspend + */ + pm_request_t undo = (dev->prev_state + ? PM_SUSPEND:PM_RESUME); + pm_send(dev, undo, (void*) dev->prev_state); + } + entry = entry->prev; + } +} + +/** + * pm_send_all - send request to all managed devices + * @rqst: power management request + * @data: data for the callback + * + * Issue a power management request to a all devices. The + * %PM_SUSPEND events are handled specially. Any device is + * permitted to fail a suspend by returning a non zero (error) + * value from its callback function. If any device vetoes a + * suspend request then all other devices that have suspended + * during the processing of this request are restored to their + * previous state. + * + * WARNING: This function takes the pm_devs_lock. The lock is not dropped until + * the callbacks have completed. This prevents races against pm locking + * functions, races against module unload pm_unregister code. It does + * mean however that you must not issue pm_ functions within the callback + * or you will deadlock and users will hate you. + * + * Zero is returned on success. If a suspend fails then the status + * from the device that vetoes the suspend is returned. + * + * BUGS: what stops two power management requests occurring in parallel + * and conflicting. + */ + +int pm_send_all(pm_request_t rqst, void *data) +{ + struct list_head *entry; + + mutex_lock(&pm_devs_lock); + entry = pm_devs.next; + while (entry != &pm_devs) { + struct pm_dev *dev = list_entry(entry, struct pm_dev, entry); + if (dev->callback) { + int status = pm_send(dev, rqst, data); + if (status) { + /* return devices to previous state on + * failed suspend request + */ + if (rqst == PM_SUSPEND) + pm_undo_all(dev); + mutex_unlock(&pm_devs_lock); + return status; + } + } + entry = entry->next; + } + mutex_unlock(&pm_devs_lock); + return 0; +} + +EXPORT_SYMBOL(pm_register); +EXPORT_SYMBOL(pm_send_all); +