Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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

+7309 -3097
+36
Documentation/ABI/stable/sysfs-class-backlight
··· 1 + What: /sys/class/backlight/<backlight>/bl_power 2 + Date: April 2005 3 + KernelVersion: 2.6.12 4 + Contact: Richard Purdie <rpurdie@rpsys.net> 5 + Description: 6 + Control BACKLIGHT power, values are FB_BLANK_* from fb.h 7 + - FB_BLANK_UNBLANK (0) : power on. 8 + - FB_BLANK_POWERDOWN (4) : power off 9 + Users: HAL 10 + 11 + What: /sys/class/backlight/<backlight>/brightness 12 + Date: April 2005 13 + KernelVersion: 2.6.12 14 + Contact: Richard Purdie <rpurdie@rpsys.net> 15 + Description: 16 + Control the brightness for this <backlight>. Values 17 + are between 0 and max_brightness. This file will also 18 + show the brightness level stored in the driver, which 19 + may not be the actual brightness (see actual_brightness). 20 + Users: HAL 21 + 22 + What: /sys/class/backlight/<backlight>/actual_brightness 23 + Date: March 2006 24 + KernelVersion: 2.6.17 25 + Contact: Richard Purdie <rpurdie@rpsys.net> 26 + Description: 27 + Show the actual brightness by querying the hardware. 28 + Users: HAL 29 + 30 + What: /sys/class/backlight/<backlight>/max_brightness 31 + Date: April 2005 32 + KernelVersion: 2.6.12 33 + Contact: Richard Purdie <rpurdie@rpsys.net> 34 + Description: 35 + Maximum brightness for <backlight>. 36 + Users: HAL
+23
Documentation/ABI/testing/sysfs-class-lcd
··· 1 + What: /sys/class/lcd/<lcd>/lcd_power 2 + Date: April 2005 3 + KernelVersion: 2.6.12 4 + Contact: Richard Purdie <rpurdie@rpsys.net> 5 + Description: 6 + Control LCD power, values are FB_BLANK_* from fb.h 7 + - FB_BLANK_UNBLANK (0) : power on. 8 + - FB_BLANK_POWERDOWN (4) : power off 9 + 10 + What: /sys/class/lcd/<lcd>/contrast 11 + Date: April 2005 12 + KernelVersion: 2.6.12 13 + Contact: Richard Purdie <rpurdie@rpsys.net> 14 + Description: 15 + Current contrast of this LCD device. Value is between 0 and 16 + /sys/class/lcd/<lcd>/max_contrast. 17 + 18 + What: /sys/class/lcd/<lcd>/max_contrast 19 + Date: April 2005 20 + KernelVersion: 2.6.12 21 + Contact: Richard Purdie <rpurdie@rpsys.net> 22 + Description: 23 + Maximum contrast for this LCD device.
+28
Documentation/ABI/testing/sysfs-class-led
··· 1 + What: /sys/class/leds/<led>/brightness 2 + Date: March 2006 3 + KernelVersion: 2.6.17 4 + Contact: Richard Purdie <rpurdie@rpsys.net> 5 + Description: 6 + Set the brightness of the LED. Most LEDs don't 7 + have hardware brightness support so will just be turned on for 8 + non-zero brightness settings. The value is between 0 and 9 + /sys/class/leds/<led>/max_brightness. 10 + 11 + What: /sys/class/leds/<led>/max_brightness 12 + Date: March 2006 13 + KernelVersion: 2.6.17 14 + Contact: Richard Purdie <rpurdie@rpsys.net> 15 + Description: 16 + Maximum brightness level for this led, default is 255 (LED_FULL). 17 + 18 + What: /sys/class/leds/<led>/trigger 19 + Date: March 2006 20 + KernelVersion: 2.6.17 21 + Contact: Richard Purdie <rpurdie@rpsys.net> 22 + Description: 23 + Set the trigger for this LED. A trigger is a kernel based source 24 + of led events. 25 + You can change triggers in a similar manner to the way an IO 26 + scheduler is chosen. Trigger specific parameters can appear in 27 + /sys/class/leds/<led> once a given trigger is selected. 28 +
+52
Documentation/ABI/testing/sysfs-platform-asus-laptop
··· 1 + What: /sys/devices/platform/asus-laptop/display 2 + Date: January 2007 3 + KernelVersion: 2.6.20 4 + Contact: "Corentin Chary" <corentincj@iksaif.net> 5 + Description: 6 + This file allows display switching. The value 7 + is composed by 4 bits and defined as follow: 8 + 4321 9 + |||`- LCD 10 + ||`-- CRT 11 + |`--- TV 12 + `---- DVI 13 + Ex: - 0 (0000b) means no display 14 + - 3 (0011b) CRT+LCD. 15 + 16 + What: /sys/devices/platform/asus-laptop/gps 17 + Date: January 2007 18 + KernelVersion: 2.6.20 19 + Contact: "Corentin Chary" <corentincj@iksaif.net> 20 + Description: 21 + Control the gps device. 1 means on, 0 means off. 22 + Users: Lapsus 23 + 24 + What: /sys/devices/platform/asus-laptop/ledd 25 + Date: January 2007 26 + KernelVersion: 2.6.20 27 + Contact: "Corentin Chary" <corentincj@iksaif.net> 28 + Description: 29 + Some models like the W1N have a LED display that can be 30 + used to display several informations. 31 + To control the LED display, use the following : 32 + echo 0x0T000DDD > /sys/devices/platform/asus-laptop/ 33 + where T control the 3 letters display, and DDD the 3 digits display. 34 + The DDD table can be found in Documentation/laptops/asus-laptop.txt 35 + 36 + What: /sys/devices/platform/asus-laptop/bluetooth 37 + Date: January 2007 38 + KernelVersion: 2.6.20 39 + Contact: "Corentin Chary" <corentincj@iksaif.net> 40 + Description: 41 + Control the bluetooth device. 1 means on, 0 means off. 42 + This may control the led, the device or both. 43 + Users: Lapsus 44 + 45 + What: /sys/devices/platform/asus-laptop/wlan 46 + Date: January 2007 47 + KernelVersion: 2.6.20 48 + Contact: "Corentin Chary" <corentincj@iksaif.net> 49 + Description: 50 + Control the bluetooth device. 1 means on, 0 means off. 51 + This may control the led, the device or both. 52 + Users: Lapsus
+50
Documentation/ABI/testing/sysfs-platform-eeepc-laptop
··· 1 + What: /sys/devices/platform/eeepc-laptop/disp 2 + Date: May 2008 3 + KernelVersion: 2.6.26 4 + Contact: "Corentin Chary" <corentincj@iksaif.net> 5 + Description: 6 + This file allows display switching. 7 + - 1 = LCD 8 + - 2 = CRT 9 + - 3 = LCD+CRT 10 + If you run X11, you should use xrandr instead. 11 + 12 + What: /sys/devices/platform/eeepc-laptop/camera 13 + Date: May 2008 14 + KernelVersion: 2.6.26 15 + Contact: "Corentin Chary" <corentincj@iksaif.net> 16 + Description: 17 + Control the camera. 1 means on, 0 means off. 18 + 19 + What: /sys/devices/platform/eeepc-laptop/cardr 20 + Date: May 2008 21 + KernelVersion: 2.6.26 22 + Contact: "Corentin Chary" <corentincj@iksaif.net> 23 + Description: 24 + Control the card reader. 1 means on, 0 means off. 25 + 26 + What: /sys/devices/platform/eeepc-laptop/cpufv 27 + Date: Jun 2009 28 + KernelVersion: 2.6.31 29 + Contact: "Corentin Chary" <corentincj@iksaif.net> 30 + Description: 31 + Change CPU clock configuration. 32 + On the Eee PC 1000H there are three available clock configuration: 33 + * 0 -> Super Performance Mode 34 + * 1 -> High Performance Mode 35 + * 2 -> Power Saving Mode 36 + On Eee PC 701 there is only 2 available clock configurations. 37 + Available configuration are listed in available_cpufv file. 38 + Reading this file will show the raw hexadecimal value which 39 + is defined as follow: 40 + | 8 bit | 8 bit | 41 + | `---- Current mode 42 + `------------ Availables modes 43 + For example, 0x301 means: mode 1 selected, 3 available modes. 44 + 45 + What: /sys/devices/platform/eeepc-laptop/available_cpufv 46 + Date: Jun 2009 47 + KernelVersion: 2.6.31 48 + Contact: "Corentin Chary" <corentincj@iksaif.net> 49 + Description: 50 + List available cpufv modes.
+51
Documentation/hwmon/acpi_power_meter
··· 1 + Kernel driver power_meter 2 + ========================= 3 + 4 + This driver talks to ACPI 4.0 power meters. 5 + 6 + Supported systems: 7 + * Any recent system with ACPI 4.0. 8 + Prefix: 'power_meter' 9 + Datasheet: http://acpi.info/, section 10.4. 10 + 11 + Author: Darrick J. Wong 12 + 13 + Description 14 + ----------- 15 + 16 + This driver implements sensor reading support for the power meters exposed in 17 + the ACPI 4.0 spec (Chapter 10.4). These devices have a simple set of 18 + features--a power meter that returns average power use over a configurable 19 + interval, an optional capping mechanism, and a couple of trip points. The 20 + sysfs interface conforms with the specification outlined in the "Power" section 21 + of Documentation/hwmon/sysfs-interface. 22 + 23 + Special Features 24 + ---------------- 25 + 26 + The power[1-*]_is_battery knob indicates if the power supply is a battery. 27 + Both power[1-*]_average_{min,max} must be set before the trip points will work. 28 + When both of them are set, an ACPI event will be broadcast on the ACPI netlink 29 + socket and a poll notification will be sent to the appropriate 30 + power[1-*]_average sysfs file. 31 + 32 + The power[1-*]_{model_number, serial_number, oem_info} fields display arbitrary 33 + strings that ACPI provides with the meter. The measures/ directory contains 34 + symlinks to the devices that this meter measures. 35 + 36 + Some computers have the ability to enforce a power cap in hardware. If this is 37 + the case, the power[1-*]_cap and related sysfs files will appear. When the 38 + average power consumption exceeds the cap, an ACPI event will be broadcast on 39 + the netlink event socket and a poll notification will be sent to the 40 + appropriate power[1-*]_alarm file to indicate that capping has begun, and the 41 + hardware has taken action to reduce power consumption. Most likely this will 42 + result in reduced performance. 43 + 44 + There are a few other ACPI notifications that can be sent by the firmware. In 45 + all cases the ACPI event will be broadcast on the ACPI netlink event socket as 46 + well as sent as a poll notification to a sysfs file. The events are as 47 + follows: 48 + 49 + power[1-*]_cap will be notified if the firmware changes the power cap. 50 + power[1-*]_interval will be notified if the firmware changes the averaging 51 + interval.
+258
Documentation/laptops/asus-laptop.txt
··· 1 + Asus Laptop Extras 2 + 3 + Version 0.1 4 + August 6, 2009 5 + 6 + Corentin Chary <corentincj@iksaif.net> 7 + http://acpi4asus.sf.net/ 8 + 9 + This driver provides support for extra features of ACPI-compatible ASUS laptops. 10 + It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or 11 + VICTOR XP7210 for example). It makes all the extra buttons generate standard 12 + ACPI events that go through /proc/acpi/events and input events (like keyboards). 13 + On some models adds support for changing the display brightness and output, 14 + switching the LCD backlight on and off, and most importantly, allows you to 15 + blink those fancy LEDs intended for reporting mail and wireless status. 16 + 17 + This driver supercedes the old asus_acpi driver. 18 + 19 + Requirements 20 + ------------ 21 + 22 + Kernel 2.6.X sources, configured for your computer, with ACPI support. 23 + You also need CONFIG_INPUT and CONFIG_ACPI. 24 + 25 + Status 26 + ------ 27 + 28 + The features currently supported are the following (see below for 29 + detailed description): 30 + 31 + - Fn key combinations 32 + - Bluetooth enable and disable 33 + - Wlan enable and disable 34 + - GPS enable and disable 35 + - Video output switching 36 + - Ambient Light Sensor on and off 37 + - LED control 38 + - LED Display control 39 + - LCD brightness control 40 + - LCD on and off 41 + 42 + A compatibility table by model and feature is maintained on the web 43 + site, http://acpi4asus.sf.net/. 44 + 45 + Usage 46 + ----- 47 + 48 + Try "modprobe asus_acpi". Check your dmesg (simply type dmesg). You should 49 + see some lines like this : 50 + 51 + Asus Laptop Extras version 0.42 52 + L2D model detected. 53 + 54 + If it is not the output you have on your laptop, send it (and the laptop's 55 + DSDT) to me. 56 + 57 + That's all, now, all the events generated by the hotkeys of your laptop 58 + should be reported in your /proc/acpi/event entry. You can check with 59 + "acpi_listen". 60 + 61 + Hotkeys are also reported as input keys (like keyboards) you can check 62 + which key are supported using "xev" under X11. 63 + 64 + You can get informations on the version of your DSDT table by reading the 65 + /sys/devices/platform/asus-laptop/infos entry. If you have a question or a 66 + bug report to do, please include the output of this entry. 67 + 68 + LEDs 69 + ---- 70 + 71 + You can modify LEDs be echoing values to /sys/class/leds/asus::*/brightness : 72 + echo 1 > /sys/class/leds/asus::mail/brightness 73 + will switch the mail LED on. 74 + You can also know if they are on/off by reading their content and use 75 + kernel triggers like ide-disk or heartbeat. 76 + 77 + Backlight 78 + --------- 79 + 80 + You can control lcd backlight power and brightness with 81 + /sys/class/backlight/asus-laptop/. Brightness Values are between 0 and 15. 82 + 83 + Wireless devices 84 + --------------- 85 + 86 + You can turn the internal Bluetooth adapter on/off with the bluetooth entry 87 + (only on models with Bluetooth). This usually controls the associated LED. 88 + Same for Wlan adapter. 89 + 90 + Display switching 91 + ----------------- 92 + 93 + Note: the display switching code is currently considered EXPERIMENTAL. 94 + 95 + Switching works for the following models: 96 + L3800C 97 + A2500H 98 + L5800C 99 + M5200N 100 + W1000N (albeit with some glitches) 101 + M6700R 102 + A6JC 103 + F3J 104 + 105 + Switching doesn't work for the following: 106 + M3700N 107 + L2X00D (locks the laptop under certain conditions) 108 + 109 + To switch the displays, echo values from 0 to 15 to 110 + /sys/devices/platform/asus-laptop/display. The significance of those values 111 + is as follows: 112 + 113 + +-------+-----+-----+-----+-----+-----+ 114 + | Bin | Val | DVI | TV | CRT | LCD | 115 + +-------+-----+-----+-----+-----+-----+ 116 + + 0000 + 0 + + + + + 117 + +-------+-----+-----+-----+-----+-----+ 118 + + 0001 + 1 + + + + X + 119 + +-------+-----+-----+-----+-----+-----+ 120 + + 0010 + 2 + + + X + + 121 + +-------+-----+-----+-----+-----+-----+ 122 + + 0011 + 3 + + + X + X + 123 + +-------+-----+-----+-----+-----+-----+ 124 + + 0100 + 4 + + X + + + 125 + +-------+-----+-----+-----+-----+-----+ 126 + + 0101 + 5 + + X + + X + 127 + +-------+-----+-----+-----+-----+-----+ 128 + + 0110 + 6 + + X + X + + 129 + +-------+-----+-----+-----+-----+-----+ 130 + + 0111 + 7 + + X + X + X + 131 + +-------+-----+-----+-----+-----+-----+ 132 + + 1000 + 8 + X + + + + 133 + +-------+-----+-----+-----+-----+-----+ 134 + + 1001 + 9 + X + + + X + 135 + +-------+-----+-----+-----+-----+-----+ 136 + + 1010 + 10 + X + + X + + 137 + +-------+-----+-----+-----+-----+-----+ 138 + + 1011 + 11 + X + + X + X + 139 + +-------+-----+-----+-----+-----+-----+ 140 + + 1100 + 12 + X + X + + + 141 + +-------+-----+-----+-----+-----+-----+ 142 + + 1101 + 13 + X + X + + X + 143 + +-------+-----+-----+-----+-----+-----+ 144 + + 1110 + 14 + X + X + X + + 145 + +-------+-----+-----+-----+-----+-----+ 146 + + 1111 + 15 + X + X + X + X + 147 + +-------+-----+-----+-----+-----+-----+ 148 + 149 + In most cases, the appropriate displays must be plugged in for the above 150 + combinations to work. TV-Out may need to be initialized at boot time. 151 + 152 + Debugging: 153 + 1) Check whether the Fn+F8 key: 154 + a) does not lock the laptop (try disabling CONFIG_X86_UP_APIC or boot with 155 + noapic / nolapic if it does) 156 + b) generates events (0x6n, where n is the value corresponding to the 157 + configuration above) 158 + c) actually works 159 + Record the disp value at every configuration. 160 + 2) Echo values from 0 to 15 to /sys/devices/platform/asus-laptop/display. 161 + Record its value, note any change. If nothing changes, try a broader range, 162 + up to 65535. 163 + 3) Send ANY output (both positive and negative reports are needed, unless your 164 + machine is already listed above) to the acpi4asus-user mailing list. 165 + 166 + Note: on some machines (e.g. L3C), after the module has been loaded, only 0x6n 167 + events are generated and no actual switching occurs. In such a case, a line 168 + like: 169 + 170 + echo $((10#$arg-60)) > /sys/devices/platform/asus-laptop/display 171 + 172 + will usually do the trick ($arg is the 0000006n-like event passed to acpid). 173 + 174 + Note: there is currently no reliable way to read display status on xxN 175 + (Centrino) models. 176 + 177 + LED display 178 + ----------- 179 + 180 + Some models like the W1N have a LED display that can be used to display 181 + several informations. 182 + 183 + LED display works for the following models: 184 + W1000N 185 + W1J 186 + 187 + To control the LED display, use the following : 188 + 189 + echo 0x0T000DDD > /sys/devices/platform/asus-laptop/ 190 + 191 + where T control the 3 letters display, and DDD the 3 digits display, 192 + according to the tables below. 193 + 194 + DDD (digits) 195 + 000 to 999 = display digits 196 + AAA = --- 197 + BBB to FFF = turn-off 198 + 199 + T (type) 200 + 0 = off 201 + 1 = dvd 202 + 2 = vcd 203 + 3 = mp3 204 + 4 = cd 205 + 5 = tv 206 + 6 = cpu 207 + 7 = vol 208 + 209 + For example "echo 0x01000001 >/sys/devices/platform/asus-laptop/ledd" 210 + would display "DVD001". 211 + 212 + Driver options: 213 + --------------- 214 + 215 + Options can be passed to the asus-laptop driver using the standard 216 + module argument syntax (<param>=<value> when passing the option to the 217 + module or asus-laptop.<param>=<value> on the kernel boot line when 218 + asus-laptop is statically linked into the kernel). 219 + 220 + wapf: WAPF defines the behavior of the Fn+Fx wlan key 221 + The significance of values is yet to be found, but 222 + most of the time: 223 + - 0x0 should do nothing 224 + - 0x1 should allow to control the device with Fn+Fx key. 225 + - 0x4 should send an ACPI event (0x88) while pressing the Fn+Fx key 226 + - 0x5 like 0x1 or 0x4 227 + 228 + The default value is 0x1. 229 + 230 + Unsupported models 231 + ------------------ 232 + 233 + These models will never be supported by this module, as they use a completely 234 + different mechanism to handle LEDs and extra stuff (meaning we have no clue 235 + how it works): 236 + 237 + - ASUS A1300 (A1B), A1370D 238 + - ASUS L7300G 239 + - ASUS L8400 240 + 241 + Patches, Errors, Questions: 242 + -------------------------- 243 + 244 + I appreciate any success or failure 245 + reports, especially if they add to or correct the compatibility table. 246 + Please include the following information in your report: 247 + 248 + - Asus model name 249 + - a copy of your ACPI tables, using the "acpidump" utility 250 + - a copy of /sys/devices/platform/asus-laptop/infos 251 + - which driver features work and which don't 252 + - the observed behavior of non-working features 253 + 254 + Any other comments or patches are also more than welcome. 255 + 256 + acpi4asus-user@lists.sourceforge.net 257 + http://sourceforge.net/projects/acpi4asus 258 +
+6 -2
Documentation/laptops/thinkpad-acpi.txt
··· 219 219 echo 0xffffffff > /proc/acpi/ibm/hotkey -- enable all hot keys 220 220 echo 0 > /proc/acpi/ibm/hotkey -- disable all possible hot keys 221 221 ... any other 8-hex-digit mask ... 222 - echo reset > /proc/acpi/ibm/hotkey -- restore the original mask 222 + echo reset > /proc/acpi/ibm/hotkey -- restore the recommended mask 223 223 224 224 The following commands have been deprecated and will cause the kernel 225 225 to log a warning: ··· 240 240 Returns 0. 241 241 242 242 hotkey_bios_mask: 243 + DEPRECATED, DON'T USE, WILL BE REMOVED IN THE FUTURE. 244 + 243 245 Returns the hot keys mask when thinkpad-acpi was loaded. 244 246 Upon module unload, the hot keys mask will be restored 245 - to this value. 247 + to this value. This is always 0x80c, because those are 248 + the hotkeys that were supported by ancient firmware 249 + without mask support. 246 250 247 251 hotkey_enable: 248 252 DEPRECATED, WILL BE REMOVED SOON.
+5 -4
Documentation/leds-class.txt
··· 1 + 1 2 LED handling under Linux 2 3 ======================== 3 4 ··· 6 5 handled by the input subsystem and the led class is *not* needed. 7 6 8 7 In its simplest form, the LED class just allows control of LEDs from 9 - userspace. LEDs appear in /sys/class/leds/. The brightness file will 10 - set the brightness of the LED (taking a value 0-255). Most LEDs don't 11 - have hardware brightness support so will just be turned on for non-zero 12 - brightness settings. 8 + userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the 9 + LED is defined in max_brightness file. The brightness file will set the brightness 10 + of the LED (taking a value 0-max_brightness). Most LEDs don't have hardware 11 + brightness support so will just be turned on for non-zero brightness settings. 13 12 14 13 The class also introduces the optional concept of an LED trigger. A trigger 15 14 is a kernel based source of led events. Triggers can either be simple or
+5
MAINTAINERS
··· 5069 5069 S: Maintained 5070 5070 F: security/tomoyo/ 5071 5071 5072 + TOPSTAR LAPTOP EXTRAS DRIVER 5073 + M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> 5074 + S: Maintained 5075 + F: drivers/platform/x86/topstar-laptop.c 5076 + 5072 5077 TOSHIBA ACPI EXTRAS DRIVER 5073 5078 S: Orphan 5074 5079 F: drivers/platform/x86/toshiba_acpi.c
+2 -5
arch/ia64/hp/common/sba_iommu.c
··· 2026 2026 struct ioc *ioc; 2027 2027 acpi_status status; 2028 2028 u64 hpa, length; 2029 - struct acpi_buffer buffer; 2030 2029 struct acpi_device_info *dev_info; 2031 2030 2032 2031 status = hp_acpi_csr_space(device->handle, &hpa, &length); 2033 2032 if (ACPI_FAILURE(status)) 2034 2033 return 1; 2035 2034 2036 - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 2037 - status = acpi_get_object_info(device->handle, &buffer); 2035 + status = acpi_get_object_info(device->handle, &dev_info); 2038 2036 if (ACPI_FAILURE(status)) 2039 2037 return 1; 2040 - dev_info = buffer.pointer; 2041 2038 2042 2039 /* 2043 2040 * For HWP0001, only SBA appears in ACPI namespace. It encloses the PCI 2044 2041 * root bridges, and its CSR space includes the IOC function. 2045 2042 */ 2046 - if (strncmp("HWP0001", dev_info->hardware_id.value, 7) == 0) { 2043 + if (strncmp("HWP0001", dev_info->hardware_id.string, 7) == 0) { 2047 2044 hpa += ZX1_IOC_OFFSET; 2048 2045 /* zx1 based systems default to kernel page size iommu pages */ 2049 2046 if (!iovp_shift)
-1
arch/x86/include/asm/acpi.h
··· 144 144 145 145 #else /* !CONFIG_ACPI */ 146 146 147 - #define acpi_disabled 1 148 147 #define acpi_lapic 0 149 148 #define acpi_ioapic 0 150 149 static inline void acpi_noirq_set(void) { }
+2
arch/x86/pci/mmconfig-shared.c
··· 18 18 #include <asm/e820.h> 19 19 #include <asm/pci_x86.h> 20 20 21 + #define PREFIX "PCI: " 22 + 21 23 /* aperture is up to 256MB but BIOS may reserve less */ 22 24 #define MMCONFIG_APER_MIN (2 * 1024*1024) 23 25 #define MMCONFIG_APER_MAX (256 * 1024*1024)
+16 -1
drivers/acpi/Kconfig
··· 60 60 /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) 61 61 /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) 62 62 /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) 63 - 63 + /proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*) 64 + /proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/ 65 + cpufreq/*) 66 + /proc/acpi/processor/*/throttling (/sys/class/thermal/ 67 + cooling_device*/*) 64 68 This option has no effect on /proc/acpi/ files 65 69 and functions which do not yet exist in /sys. 66 70 ··· 85 81 and functions, which do not yet exist in /sys 86 82 87 83 Say N to delete power /proc/acpi/ directories that have moved to /sys/ 84 + 85 + config ACPI_POWER_METER 86 + tristate "ACPI 4.0 power meter" 87 + depends on HWMON 88 + help 89 + This driver exposes ACPI 4.0 power meters as hardware monitoring 90 + devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware 91 + and a power meter. 92 + 93 + To compile this driver as a module, choose M here: 94 + the module will be called power-meter. 88 95 89 96 config ACPI_SYSFS_POWER 90 97 bool "Future power /sys interface"
+1
drivers/acpi/Makefile
··· 56 56 obj-$(CONFIG_ACPI_BATTERY) += battery.o 57 57 obj-$(CONFIG_ACPI_SBS) += sbshc.o 58 58 obj-$(CONFIG_ACPI_SBS) += sbs.o 59 + obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o 59 60 60 61 # processor has its own "processor." module_param namespace 61 62 processor-y := processor_core.o processor_throttling.o
+2
drivers/acpi/ac.c
··· 37 37 #include <acpi/acpi_bus.h> 38 38 #include <acpi/acpi_drivers.h> 39 39 40 + #define PREFIX "ACPI: " 41 + 40 42 #define ACPI_AC_CLASS "ac_adapter" 41 43 #define ACPI_AC_DEVICE_NAME "AC Adapter" 42 44 #define ACPI_AC_FILE_STATE "state"
+20 -35
drivers/acpi/acpi_memhotplug.c
··· 53 53 54 54 static int acpi_memory_device_add(struct acpi_device *device); 55 55 static int acpi_memory_device_remove(struct acpi_device *device, int type); 56 - static int acpi_memory_device_start(struct acpi_device *device); 57 56 58 57 static const struct acpi_device_id memory_device_ids[] = { 59 58 {ACPI_MEMORY_DEVICE_HID, 0}, ··· 67 68 .ops = { 68 69 .add = acpi_memory_device_add, 69 70 .remove = acpi_memory_device_remove, 70 - .start = acpi_memory_device_start, 71 71 }, 72 72 }; 73 73 ··· 429 431 430 432 printk(KERN_DEBUG "%s \n", acpi_device_name(device)); 431 433 434 + /* 435 + * Early boot code has recognized memory area by EFI/E820. 436 + * If DSDT shows these memory devices on boot, hotplug is not necessary 437 + * for them. So, it just returns until completion of this driver's 438 + * start up. 439 + */ 440 + if (!acpi_hotmem_initialized) 441 + return 0; 442 + 443 + if (!acpi_memory_check_device(mem_device)) { 444 + /* call add_memory func */ 445 + result = acpi_memory_enable_device(mem_device); 446 + if (result) 447 + printk(KERN_ERR PREFIX 448 + "Error in acpi_memory_enable_device\n"); 449 + } 432 450 return result; 433 451 } 434 452 ··· 462 448 return 0; 463 449 } 464 450 465 - static int acpi_memory_device_start (struct acpi_device *device) 466 - { 467 - struct acpi_memory_device *mem_device; 468 - int result = 0; 469 - 470 - /* 471 - * Early boot code has recognized memory area by EFI/E820. 472 - * If DSDT shows these memory devices on boot, hotplug is not necessary 473 - * for them. So, it just returns until completion of this driver's 474 - * start up. 475 - */ 476 - if (!acpi_hotmem_initialized) 477 - return 0; 478 - 479 - mem_device = acpi_driver_data(device); 480 - 481 - if (!acpi_memory_check_device(mem_device)) { 482 - /* call add_memory func */ 483 - result = acpi_memory_enable_device(mem_device); 484 - if (result) 485 - printk(KERN_ERR PREFIX 486 - "Error in acpi_memory_enable_device\n"); 487 - } 488 - return result; 489 - } 490 - 491 451 /* 492 452 * Helper function to check for memory device 493 453 */ ··· 469 481 { 470 482 char *hardware_id; 471 483 acpi_status status; 472 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 473 484 struct acpi_device_info *info; 474 485 475 - 476 - status = acpi_get_object_info(handle, &buffer); 486 + status = acpi_get_object_info(handle, &info); 477 487 if (ACPI_FAILURE(status)) 478 488 return status; 479 489 480 - info = buffer.pointer; 481 490 if (!(info->valid & ACPI_VALID_HID)) { 482 - kfree(buffer.pointer); 491 + kfree(info); 483 492 return AE_ERROR; 484 493 } 485 494 486 - hardware_id = info->hardware_id.value; 495 + hardware_id = info->hardware_id.string; 487 496 if ((hardware_id == NULL) || 488 497 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) 489 498 status = AE_ERROR; 490 499 491 - kfree(buffer.pointer); 500 + kfree(info); 492 501 return status; 493 502 } 494 503
+2 -2
drivers/acpi/acpica/Makefile
··· 28 28 acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 29 29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 30 30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 31 - nsparse.o nspredef.o 31 + nsparse.o nspredef.o nsrepair.o 32 32 33 33 acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 34 34 ··· 44 44 45 45 acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ 46 46 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ 47 - utstate.o utmutex.o utobject.o utresrc.o utlock.o 47 + utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o
+8 -2
drivers/acpi/acpica/acconfig.h
··· 183 183 184 184 /* Operation regions */ 185 185 186 - #define ACPI_NUM_PREDEFINED_REGIONS 8 186 + #define ACPI_NUM_PREDEFINED_REGIONS 9 187 187 #define ACPI_USER_REGION_BEGIN 0x80 188 188 189 189 /* Maximum space_ids for Operation Regions */ ··· 199 199 #define ACPI_RSDP_CHECKSUM_LENGTH 20 200 200 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 201 201 202 - /* SMBus bidirectional buffer size */ 202 + /* SMBus and IPMI bidirectional buffer size */ 203 203 204 204 #define ACPI_SMBUS_BUFFER_SIZE 34 205 + #define ACPI_IPMI_BUFFER_SIZE 66 206 + 207 + /* _sx_d and _sx_w control methods */ 208 + 209 + #define ACPI_NUM_sx_d_METHODS 4 210 + #define ACPI_NUM_sx_w_METHODS 5 205 211 206 212 /****************************************************************************** 207 213 *
-4
drivers/acpi/acpica/acdebug.h
··· 154 154 acpi_db_display_argument_object(union acpi_operand_object *obj_desc, 155 155 struct acpi_walk_state *walk_state); 156 156 157 - void acpi_db_check_predefined_names(void); 158 - 159 - void acpi_db_batch_execute(void); 160 - 161 157 /* 162 158 * dbexec - debugger control method execution 163 159 */
+21 -16
drivers/acpi/acpica/acglobal.h
··· 58 58 #define ACPI_INIT_GLOBAL(a,b) a 59 59 #endif 60 60 61 + #ifdef DEFINE_ACPI_GLOBALS 62 + 63 + /* Public globals, available from outside ACPICA subsystem */ 64 + 61 65 /***************************************************************************** 62 66 * 63 67 * Runtime configuration (static defaults that can be overriden at runtime) ··· 82 78 * 5) Allow unresolved references (invalid target name) in package objects 83 79 * 6) Enable warning messages for behavior that is not ACPI spec compliant 84 80 */ 85 - ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); 81 + u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); 86 82 87 83 /* 88 84 * Automatically serialize ALL control methods? Default is FALSE, meaning ··· 90 86 * Only change this if the ASL code is poorly written and cannot handle 91 87 * reentrancy even though methods are marked "NotSerialized". 92 88 */ 93 - ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); 89 + u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); 94 90 95 91 /* 96 92 * Create the predefined _OSI method in the namespace? Default is TRUE 97 93 * because ACPI CA is fully compatible with other ACPI implementations. 98 94 * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. 99 95 */ 100 - ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); 96 + u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE); 101 97 102 98 /* 103 99 * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and 104 100 * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only 105 101 * be enabled just before going to sleep. 106 102 */ 107 - ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); 103 + u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); 108 104 109 105 /* 110 106 * Optionally use default values for the ACPI register widths. Set this to 111 107 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. 112 108 */ 113 - ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); 109 + u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE); 110 + 111 + /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ 112 + 113 + struct acpi_table_fadt acpi_gbl_FADT; 114 + u32 acpi_current_gpe_count; 115 + u32 acpi_gbl_trace_flags; 116 + acpi_name acpi_gbl_trace_method_name; 117 + 118 + #endif 114 119 115 120 /***************************************************************************** 116 121 * 117 122 * Debug support 118 123 * 119 124 ****************************************************************************/ 120 - 121 - /* Runtime configuration of debug print levels */ 122 - 123 - extern u32 acpi_dbg_level; 124 - extern u32 acpi_dbg_layer; 125 125 126 126 /* Procedure nesting level for debug output */ 127 127 ··· 135 127 136 128 ACPI_EXTERN u32 acpi_gbl_original_dbg_level; 137 129 ACPI_EXTERN u32 acpi_gbl_original_dbg_layer; 138 - ACPI_EXTERN acpi_name acpi_gbl_trace_method_name; 139 130 ACPI_EXTERN u32 acpi_gbl_trace_dbg_level; 140 131 ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer; 141 - ACPI_EXTERN u32 acpi_gbl_trace_flags; 142 132 143 133 /***************************************************************************** 144 134 * ··· 148 142 * acpi_gbl_root_table_list is the master list of ACPI tables found in the 149 143 * RSDT/XSDT. 150 144 * 151 - * acpi_gbl_FADT is a local copy of the FADT, converted to a common format. 152 145 */ 153 146 ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list; 154 - ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; 155 147 ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS; 156 148 157 149 /* These addresses are calculated from the FADT Event Block addresses */ ··· 265 261 extern u8 acpi_gbl_shutdown; 266 262 extern u32 acpi_gbl_startup_flags; 267 263 extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; 268 - extern const char *acpi_gbl_highest_dstate_names[4]; 264 + extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS]; 265 + extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS]; 269 266 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 270 267 extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 271 268 ··· 295 290 ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct; 296 291 ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node; 297 292 ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device; 293 + ACPI_EXTERN union acpi_operand_object *acpi_gbl_module_code_list; 298 294 299 295 extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; 300 296 extern const struct acpi_predefined_names ··· 346 340 ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; 347 341 ACPI_EXTERN struct acpi_gpe_block_info 348 342 *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; 349 - ACPI_EXTERN u32 acpi_current_gpe_count; 350 343 351 344 /***************************************************************************** 352 345 *
+8
drivers/acpi/acpica/achware.h
··· 62 62 /* 63 63 * hwregs - ACPI Register I/O 64 64 */ 65 + acpi_status 66 + acpi_hw_validate_register(struct acpi_generic_address *reg, 67 + u8 max_bit_width, u64 *address); 68 + 69 + acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg); 70 + 71 + acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg); 72 + 65 73 struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); 66 74 67 75 acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
+2 -2
drivers/acpi/acpica/acinterp.h
··· 461 461 462 462 void acpi_ex_release_global_lock(u32 rule); 463 463 464 - void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string); 464 + void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id); 465 465 466 - void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string); 466 + void acpi_ex_integer_to_string(char *dest, acpi_integer value); 467 467 468 468 /* 469 469 * exregion - default op_region handlers
+16
drivers/acpi/acpica/aclocal.h
··· 369 369 struct acpi_package_info3 ret_info3; 370 370 }; 371 371 372 + /* Data block used during object validation */ 373 + 374 + struct acpi_predefined_data { 375 + char *pathname; 376 + const union acpi_predefined_info *predefined; 377 + u32 flags; 378 + u8 node_flags; 379 + }; 380 + 381 + /* Defines for Flags field above */ 382 + 383 + #define ACPI_OBJECT_REPAIRED 1 384 + 372 385 /* 373 386 * Bitmapped return value types 374 387 * Note: the actual data types must be contiguous, a loop in nspredef.c ··· 898 885 #define ACPI_OSI_WIN_XP_SP2 0x05 899 886 #define ACPI_OSI_WINSRV_2003_SP1 0x06 900 887 #define ACPI_OSI_WIN_VISTA 0x07 888 + #define ACPI_OSI_WINSRV_2008 0x08 889 + #define ACPI_OSI_WIN_VISTA_SP1 0x09 890 + #define ACPI_OSI_WIN_7 0x0A 901 891 902 892 #define ACPI_ALWAYS_ILLEGAL 0x00 903 893
+2
drivers/acpi/acpica/acmacros.h
··· 340 340 */ 341 341 #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); 342 342 #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); 343 + #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist 343 344 344 345 #else 345 346 ··· 348 347 349 348 #define ACPI_ERROR_NAMESPACE(s, e) 350 349 #define ACPI_ERROR_METHOD(s, n, p, e) 350 + #define ACPI_WARN_PREDEFINED(plist) 351 351 #endif /* ACPI_NO_ERROR_MESSAGES */ 352 352 353 353 /*
+25
drivers/acpi/acpica/acnamesp.h
··· 73 73 #define ACPI_NS_WALK_UNLOCK 0x01 74 74 #define ACPI_NS_WALK_TEMP_NODES 0x02 75 75 76 + /* Object is not a package element */ 77 + 78 + #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX 79 + 80 + /* Always emit warning message, not dependent on node flags */ 81 + 82 + #define ACPI_WARN_ALWAYS 0 83 + 76 84 /* 77 85 * nsinit - Namespace initialization 78 86 */ ··· 152 144 153 145 void acpi_ns_delete_node(struct acpi_namespace_node *node); 154 146 147 + void acpi_ns_remove_node(struct acpi_namespace_node *node); 148 + 155 149 void 156 150 acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle); 157 151 ··· 195 185 * nseval - Namespace evaluation functions 196 186 */ 197 187 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); 188 + 189 + void acpi_ns_exec_module_code_list(void); 198 190 199 191 /* 200 192 * nspredef - Support for predefined/reserved names ··· 270 258 acpi_status 271 259 acpi_ns_get_attached_data(struct acpi_namespace_node *node, 272 260 acpi_object_handler handler, void **data); 261 + 262 + /* 263 + * nsrepair - return object repair for predefined methods/objects 264 + */ 265 + acpi_status 266 + acpi_ns_repair_object(struct acpi_predefined_data *data, 267 + u32 expected_btypes, 268 + u32 package_index, 269 + union acpi_operand_object **return_object_ptr); 270 + 271 + acpi_status 272 + acpi_ns_repair_package_list(struct acpi_predefined_data *data, 273 + union acpi_operand_object **obj_desc_ptr); 273 274 274 275 /* 275 276 * nssearch - Namespace searching and entry
+1
drivers/acpi/acpica/acobject.h
··· 98 98 #define AOPOBJ_SETUP_COMPLETE 0x10 99 99 #define AOPOBJ_SINGLE_DATUM 0x20 100 100 #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ 101 + #define AOPOBJ_MODULE_LEVEL 0x80 101 102 102 103 /****************************************************************************** 103 104 *
+2
drivers/acpi/acpica/acparser.h
··· 62 62 #define ACPI_PARSE_DEFERRED_OP 0x0100 63 63 #define ACPI_PARSE_DISASSEMBLE 0x0200 64 64 65 + #define ACPI_PARSE_MODULE_LEVEL 0x0400 66 + 65 67 /****************************************************************************** 66 68 * 67 69 * Parser interfaces
+364 -214
drivers/acpi/acpica/acpredef.h
··· 64 64 * (Used for _PRW) 65 65 * 66 66 * 67 - * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the 68 - * different types describe the contents of each of the sub-packages. 67 + * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each 68 + * of the different types describe the contents of each of the sub-packages. 69 69 * 70 70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: 71 71 * object type ··· 91 91 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length 92 92 * (Used for _HPX) 93 93 * 94 + * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length 95 + * (Used for _ART, _FPS) 96 + * 94 97 *****************************************************************************/ 95 98 96 99 enum acpi_return_package_types { ··· 104 101 ACPI_PTYPE2_COUNT = 5, 105 102 ACPI_PTYPE2_PKG_COUNT = 6, 106 103 ACPI_PTYPE2_FIXED = 7, 107 - ACPI_PTYPE2_MIN = 8 104 + ACPI_PTYPE2_MIN = 8, 105 + ACPI_PTYPE2_REV_FIXED = 9 108 106 }; 109 107 108 + #ifdef ACPI_CREATE_PREDEFINED_TABLE 110 109 /* 111 110 * Predefined method/object information table. 112 111 * ··· 141 136 * is saved here (rather than in a separate table) in order to minimize the 142 137 * overall size of the stored data. 143 138 */ 144 - static const union acpi_predefined_info predefined_names[] = { 145 - {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}}, 146 - {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}}, 147 - {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}}, 148 - {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}}, 149 - {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}}, 150 - {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}}, 151 - {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}}, 152 - {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}}, 153 - {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}}, 154 - {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}}, 155 - {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}}, 156 - {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 157 - {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 158 - {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 159 - {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 160 - {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 161 - {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 162 - {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 163 - {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 164 - {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 165 - {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 166 - {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}}, 167 - {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}}, 168 - {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}}, 169 - {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */ 170 - {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}}, 171 - {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}}, 172 - {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 173 - {.info = {"_BCM", 1, 0}}, 174 - {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}}, 175 - {.info = {"_BFS", 1, 0}}, 176 - {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 177 - 9, 178 - ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */ 179 - {.info = {"_BLT", 3, 0}}, 180 - {.info = {"_BMC", 1, 0}}, 181 - {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */ 182 - {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}}, 183 - {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 184 - {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}}, 185 - {.info = {"_BTP", 1, 0}}, 186 - {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */ 187 - {.info = {"_CID", 0, 188 - ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, 189 - {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */ 190 - {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}}, 191 - {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}}, 192 - {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */ 193 - {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT, 194 - ACPI_RTYPE_BUFFER, 1, 195 - ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */ 196 - {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}}, 197 - {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}}, 198 - {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, 199 - {.info = {"_DDN", 0, ACPI_RTYPE_STRING}}, 200 - {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}}, 201 - {.info = {"_DIS", 0, 0}}, 202 - {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}}, 203 - {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 204 - {.info = {"_DOS", 1, 0}}, 205 - {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ 206 - {.info = {"_DSS", 1, 0}}, 207 - {.info = {"_DSW", 3, 0}}, 208 - {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}}, 209 - {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 210 - {.info = {"_EJ0", 1, 0}}, 211 - {.info = {"_EJ1", 1, 0}}, 212 - {.info = {"_EJ2", 1, 0}}, 213 - {.info = {"_EJ3", 1, 0}}, 214 - {.info = {"_EJ4", 1, 0}}, 215 - {.info = {"_EJD", 0, ACPI_RTYPE_STRING}}, 216 - {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}}, 217 - {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */ 218 - {.info = {"_FDM", 1, 0}}, 219 - {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */ 220 - {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}}, 221 - {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}}, 222 - {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ 223 - {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}}, 224 - {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}}, 225 - {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}}, 226 - {.info = {"_GTS", 1, 0}}, 227 - {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 228 - {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}}, 229 - {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 139 + static const union acpi_predefined_info predefined_names[] = 140 + { 141 + {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, 142 + {{"_AC1", 0, ACPI_RTYPE_INTEGER}}, 143 + {{"_AC2", 0, ACPI_RTYPE_INTEGER}}, 144 + {{"_AC3", 0, ACPI_RTYPE_INTEGER}}, 145 + {{"_AC4", 0, ACPI_RTYPE_INTEGER}}, 146 + {{"_AC5", 0, ACPI_RTYPE_INTEGER}}, 147 + {{"_AC6", 0, ACPI_RTYPE_INTEGER}}, 148 + {{"_AC7", 0, ACPI_RTYPE_INTEGER}}, 149 + {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, 150 + {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, 151 + {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, 152 + {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 153 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 154 + 155 + {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 156 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 157 + 158 + {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 159 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 160 + 161 + {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 162 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 163 + 164 + {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 165 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 166 + 167 + {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 168 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 169 + 170 + {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 171 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 172 + 173 + {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 174 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 175 + 176 + {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 177 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 178 + 179 + {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 180 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 181 + 182 + {{"_ALC", 0, ACPI_RTYPE_INTEGER}}, 183 + {{"_ALI", 0, ACPI_RTYPE_INTEGER}}, 184 + {{"_ALP", 0, ACPI_RTYPE_INTEGER}}, 185 + {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */ 186 + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, 187 + 188 + {{"_ALT", 0, ACPI_RTYPE_INTEGER}}, 189 + {{"_ART", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ 190 + {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 191 + 11, 0}}, 192 + 193 + {{"_BBN", 0, ACPI_RTYPE_INTEGER}}, 194 + {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ 195 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 196 + 197 + {{"_BCM", 1, 0}}, 198 + {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, 199 + {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, 200 + {{"_BFS", 1, 0}}, 201 + {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ 202 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}}, 203 + 204 + {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ 205 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4, 206 + 0}}, 207 + 208 + {{"_BLT", 3, 0}}, 209 + {{"_BMA", 1, ACPI_RTYPE_INTEGER}}, 210 + {{"_BMC", 1, 0}}, 211 + {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */ 212 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 213 + 214 + {{"_BMS", 1, ACPI_RTYPE_INTEGER}}, 215 + {{"_BQC", 0, ACPI_RTYPE_INTEGER}}, 216 + {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ 217 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, 218 + 219 + {{"_BTM", 1, ACPI_RTYPE_INTEGER}}, 220 + {{"_BTP", 1, 0}}, 221 + {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ 222 + {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, 223 + {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ 224 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, 225 + 226 + {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, 227 + {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, 228 + {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ 229 + {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 230 + 231 + {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ 232 + {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, 233 + 234 + {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, 235 + {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, 236 + {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, 237 + {{"_DDN", 0, ACPI_RTYPE_STRING}}, 238 + {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, 239 + {{"_DIS", 0, 0}}, 240 + {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, 241 + {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ 242 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 243 + 244 + {{"_DOS", 1, 0}}, 245 + {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ 246 + {{"_DSS", 1, 0}}, 247 + {{"_DSW", 3, 0}}, 248 + {{"_DTI", 1, 0}}, 249 + {{"_EC_", 0, ACPI_RTYPE_INTEGER}}, 250 + {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/ 251 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 252 + 253 + {{"_EJ0", 1, 0}}, 254 + {{"_EJ1", 1, 0}}, 255 + {{"_EJ2", 1, 0}}, 256 + {{"_EJ3", 1, 0}}, 257 + {{"_EJ4", 1, 0}}, 258 + {{"_EJD", 0, ACPI_RTYPE_STRING}}, 259 + {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, 260 + {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ 261 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, 262 + 263 + {{"_FDM", 1, 0}}, 264 + {{"_FIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ 265 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0}, 0, 0}}, 266 + 267 + {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ 268 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, 269 + 270 + {{"_FPS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ 271 + {{{ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0}, 0, 0}}, 272 + 273 + {{"_FSL", 1, 0}}, 274 + {{"_FST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ 275 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0}, 0, 0}}, 276 + 277 + {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, 278 + {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, 279 + {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, 280 + {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, 281 + {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ 282 + {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, 283 + {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, 284 + {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, 285 + {{"_GTS", 1, 0}}, 286 + {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 287 + {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, 288 + {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ 289 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, 230 290 231 291 /* 232 - * For _HPX, a single package is returned, containing a variable number of sub-packages. 233 - * Each sub-package contains a PCI record setting. There are several different type of 234 - * record settings, of different lengths, but all elements of all settings are Integers. 292 + * For _HPX, a single package is returned, containing a Variable-length number 293 + * of sub-packages. Each sub-package contains a PCI record setting. 294 + * There are several different type of record settings, of different 295 + * lengths, but all elements of all settings are Integers. 235 296 */ 236 - {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */ 237 - {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ 238 - {.info = {"_INI", 0, 0}}, 239 - {.info = {"_IRC", 0, 0}}, 240 - {.info = {"_LCK", 1, 0}}, 241 - {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}}, 242 - {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}}, 243 - {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */ 244 - {.info = {"_MSG", 1, 0}}, 245 - {.info = {"_OFF", 0, 0}}, 246 - {.info = {"_ON_", 0, 0}}, 247 - {.info = {"_OS_", 0, ACPI_RTYPE_STRING}}, 248 - {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}}, 249 - {.info = {"_OST", 3, 0}}, 250 - {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 251 - {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ 252 - {.info = {"_PDC", 1, 0}}, 253 - {.info = {"_PIC", 1, 0}}, 254 - {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */ 255 - {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}}, 256 - {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */ 257 - {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 258 - {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 259 - {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 260 - {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}}, 297 + {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ 298 + {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 299 + 300 + {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ 301 + {{"_INI", 0, 0}}, 302 + {{"_IRC", 0, 0}}, 303 + {{"_LCK", 1, 0}}, 304 + {{"_LID", 0, ACPI_RTYPE_INTEGER}}, 305 + {{"_MAT", 0, ACPI_RTYPE_BUFFER}}, 306 + {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ 307 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0}, 0, 0}}, 308 + 309 + {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */ 310 + {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}}, 311 + 312 + {{"_MSG", 1, 0}}, 313 + {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, 314 + {{"_NTT", 0, ACPI_RTYPE_INTEGER}}, 315 + {{"_OFF", 0, 0}}, 316 + {{"_ON_", 0, 0}}, 317 + {{"_OS_", 0, ACPI_RTYPE_STRING}}, 318 + {{"_OSC", 4, ACPI_RTYPE_BUFFER}}, 319 + {{"_OST", 3, 0}}, 320 + {{"_PAI", 1, ACPI_RTYPE_INTEGER}}, 321 + {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 322 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 323 + 324 + {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ 325 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, 326 + 327 + {{"_PDC", 1, 0}}, 328 + {{"_PDL", 0, ACPI_RTYPE_INTEGER}}, 329 + {{"_PIC", 1, 0}}, 330 + {{"_PIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int),(3 Str) */ 331 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3, 0}}, 332 + 333 + {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */ 334 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, 335 + 336 + {{"_PMC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (11 Int),(3 Str) */ 337 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3, 338 + 0}}, 339 + 340 + {{"_PMD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 341 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, 342 + 343 + {{"_PMM", 0, ACPI_RTYPE_INTEGER}}, 344 + {{"_PPC", 0, ACPI_RTYPE_INTEGER}}, 345 + {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */ 346 + {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 347 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 348 + 349 + {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 350 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 351 + 352 + {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 353 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 354 + 355 + {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 356 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, 357 + 358 + {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 359 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0}, 0, 0}}, 360 + 361 + {{"_PRS", 0, ACPI_RTYPE_BUFFER}}, 261 362 262 363 /* 263 - * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there 264 - * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow 265 - * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE 266 - * type to the 2nd element (index 1) in the statement below. 364 + * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source 365 + * and source_index). This bug is so prevalent that there is code in the 366 + * ACPICA Resource Manager to detect this and switch them back. For now, 367 + * do not allow and issue a warning. To allow this and eliminate the 368 + * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) 369 + * in the statement below. 267 370 */ 268 - {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4, 269 - ACPI_RTYPE_INTEGER, 270 - ACPI_RTYPE_INTEGER, 271 - ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */ 371 + {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ 372 + {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER}, 373 + ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, 374 + ACPI_RTYPE_INTEGER}}, 272 375 273 - {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2, 274 - ACPI_RTYPE_INTEGER | 275 - ACPI_RTYPE_PACKAGE, 276 - ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */ 376 + {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ 377 + {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, 378 + ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}}, 277 379 278 - {.info = {"_PS0", 0, 0}}, 279 - {.info = {"_PS1", 0, 0}}, 280 - {.info = {"_PS2", 0, 0}}, 281 - {.info = {"_PS3", 0, 0}}, 282 - {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}}, 283 - {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */ 284 - {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 285 - {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}}, 286 - {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */ 287 - {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}}, 288 - {.info = {"_PSW", 1, 0}}, 289 - {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */ 290 - {.info = {"_PTS", 1, 0}}, 291 - {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}}, 292 - {.info = {"_REG", 2, 0}}, 293 - {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}}, 294 - {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}}, 295 - {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}}, 296 - {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}}, 380 + {{"_PS0", 0, 0}}, 381 + {{"_PS1", 0, 0}}, 382 + {{"_PS2", 0, 0}}, 383 + {{"_PS3", 0, 0}}, 384 + {{"_PSC", 0, ACPI_RTYPE_INTEGER}}, 385 + {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ 386 + {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, 387 + 388 + {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 389 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 390 + 391 + {{"_PSR", 0, ACPI_RTYPE_INTEGER}}, 392 + {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */ 393 + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}}, 394 + 395 + {{"_PSV", 0, ACPI_RTYPE_INTEGER}}, 396 + {{"_PSW", 1, 0}}, 397 + {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ 398 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, 399 + 400 + {{"_PTP", 2, ACPI_RTYPE_INTEGER}}, 401 + {{"_PTS", 1, 0}}, 402 + {{"_PUR", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Int) */ 403 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0}, 0, 0}}, 404 + 405 + {{"_PXM", 0, ACPI_RTYPE_INTEGER}}, 406 + {{"_REG", 2, 0}}, 407 + {{"_REV", 0, ACPI_RTYPE_INTEGER}}, 408 + {{"_RMV", 0, ACPI_RTYPE_INTEGER}}, 409 + {{"_ROM", 2, ACPI_RTYPE_BUFFER}}, 410 + {{"_RTV", 0, ACPI_RTYPE_INTEGER}}, 297 411 298 412 /* 299 - * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer, 300 - * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length", 301 - * but all elements must be Integers. 413 + * For _S0_ through _S5_, the ACPI spec defines a return Package 414 + * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers. 415 + * Allow this by making the objects "Variable-length length", but all elements 416 + * must be Integers. 302 417 */ 303 - {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 304 - {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 305 - {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 306 - {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 307 - {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 308 - {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */ 418 + {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 419 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 309 420 310 - {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}}, 311 - {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}}, 312 - {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}}, 313 - {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}}, 314 - {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}}, 315 - {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}}, 316 - {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}}, 317 - {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}}, 318 - {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}}, 319 - {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}}, 320 - {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ 321 - /* Note: the 3-arg definition may be removed for ACPI 4.0 */ 322 - {.info = {"_SDD", 1, 0}}, 323 - {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}}, 324 - {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}}, 325 - {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}}, 326 - {.info = {"_SRS", 1, 0}}, 327 - {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */ 328 - {.info = {"_SST", 1, 0}}, 329 - {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}}, 330 - {.info = {"_STM", 3, 0}}, 331 - {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}}, 332 - {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}}, 333 - {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}}, 334 - {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}}, 335 - {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}}, 336 - {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}}, 337 - {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}}, 338 - {.info = {"_TPT", 1, 0}}, 339 - {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, 340 - ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */ 341 - {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */ 342 - {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}}, 343 - {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */ 344 - {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}}, 345 - {.info = {"_TTS", 1, 0}}, 346 - {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */ 347 - {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}}, 348 - {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}}, 349 - {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 350 - {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */ 351 - {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}}, 352 - {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}}, 353 - {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}}, 421 + {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 422 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 423 + 424 + {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 425 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 426 + 427 + {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 428 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 429 + 430 + {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 431 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 432 + 433 + {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ 434 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, 435 + 436 + {{"_S1D", 0, ACPI_RTYPE_INTEGER}}, 437 + {{"_S2D", 0, ACPI_RTYPE_INTEGER}}, 438 + {{"_S3D", 0, ACPI_RTYPE_INTEGER}}, 439 + {{"_S4D", 0, ACPI_RTYPE_INTEGER}}, 440 + {{"_S0W", 0, ACPI_RTYPE_INTEGER}}, 441 + {{"_S1W", 0, ACPI_RTYPE_INTEGER}}, 442 + {{"_S2W", 0, ACPI_RTYPE_INTEGER}}, 443 + {{"_S3W", 0, ACPI_RTYPE_INTEGER}}, 444 + {{"_S4W", 0, ACPI_RTYPE_INTEGER}}, 445 + {{"_SBS", 0, ACPI_RTYPE_INTEGER}}, 446 + {{"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ 447 + /* Note: the 3-arg definition may be removed for ACPI 4.0 */ 448 + {{"_SDD", 1, 0}}, 449 + {{"_SEG", 0, ACPI_RTYPE_INTEGER}}, 450 + {{"_SHL", 1, ACPI_RTYPE_INTEGER}}, 451 + {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, 452 + {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, 453 + {{"_SRS", 1, 0}}, 454 + {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ 455 + {{"_SST", 1, 0}}, 456 + {{"_STA", 0, ACPI_RTYPE_INTEGER}}, 457 + {{"_STM", 3, 0}}, 458 + {{"_STP", 2, ACPI_RTYPE_INTEGER}}, 459 + {{"_STR", 0, ACPI_RTYPE_BUFFER}}, 460 + {{"_STV", 2, ACPI_RTYPE_INTEGER}}, 461 + {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, 462 + {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, 463 + {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, 464 + {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, 465 + {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, 466 + {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, 467 + {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, 468 + {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, 469 + {{"_TPT", 1, 0}}, 470 + {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2_ref/6_int */ 471 + {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, 472 + 473 + {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int with count */ 474 + {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 475 + 476 + {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, 477 + {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5_int */ 478 + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, 479 + 480 + {{"_TST", 0, ACPI_RTYPE_INTEGER}}, 481 + {{"_TTS", 1, 0}}, 482 + {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ 483 + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, 484 + 485 + {{"_TZM", 0, ACPI_RTYPE_REFERENCE}}, 486 + {{"_TZP", 0, ACPI_RTYPE_INTEGER}}, 487 + {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, 488 + {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ 489 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, 490 + 491 + {{"_UPD", 0, ACPI_RTYPE_INTEGER}}, 492 + {{"_UPP", 0, ACPI_RTYPE_INTEGER}}, 493 + {{"_VPO", 0, ACPI_RTYPE_INTEGER}}, 354 494 355 495 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ 356 496 357 - {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, 358 - {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */ 359 - {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */ 497 + {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, 498 + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ 499 + 500 + {{{0,0,0,0}, 0,0}} /* Table terminator */ 360 501 }; 361 502 362 503 #if 0 363 504 /* Not implemented */ 364 505 365 - { 366 - "_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */ 506 + {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */ 507 + {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */ 367 508 368 - { 369 - "_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */ 509 + /* This is an internally implemented control method, no need to check */ 510 + {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, 370 511 371 - /* This is an internally implemented control method, no need to check */ 372 - { 373 - "_OSI", 1, ACPI_RTYPE_INTEGER}, 512 + /* TBD: */ 374 513 375 - /* TBD: */ 376 - _PRT - currently ignore reversed entries.attempt to fix here ? 377 - think about code that attempts to fix package elements like _BIF, etc. 514 + _PRT - currently ignore reversed entries. attempt to fix here? 515 + think about possibly fixing package elements like _BIF, etc. 516 + #endif 517 + 378 518 #endif 379 519 #endif
+24 -12
drivers/acpi/acpica/acutils.h
··· 324 324 acpi_status 325 325 acpi_ut_evaluate_numeric_object(char *object_name, 326 326 struct acpi_namespace_node *device_node, 327 - acpi_integer * address); 327 + acpi_integer *value); 328 328 329 + acpi_status 330 + acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); 331 + 332 + acpi_status 333 + acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, 334 + const char **method_names, 335 + u8 method_count, u8 *out_values); 336 + 337 + /* 338 + * utids - device ID support 339 + */ 329 340 acpi_status 330 341 acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 331 - struct acpica_device_id *hid); 332 - 333 - acpi_status 334 - acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 335 - struct acpi_compatible_id_list **return_cid_list); 336 - 337 - acpi_status 338 - acpi_ut_execute_STA(struct acpi_namespace_node *device_node, 339 - u32 * status_flags); 342 + struct acpica_device_id **return_id); 340 343 341 344 acpi_status 342 345 acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 343 - struct acpica_device_id *uid); 346 + struct acpica_device_id **return_id); 344 347 345 348 acpi_status 346 - acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest); 349 + acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 350 + struct acpica_device_id_list **return_cid_list); 347 351 348 352 /* 349 353 * utlock - reader/writer locks ··· 449 445 */ 450 446 const char *acpi_ut_validate_exception(acpi_status status); 451 447 448 + u8 acpi_ut_is_pci_root_bridge(char *id); 449 + 452 450 u8 acpi_ut_is_aml_table(struct acpi_table_header *table); 453 451 454 452 acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); ··· 474 468 475 469 acpi_status 476 470 acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); 471 + 472 + void ACPI_INTERNAL_VAR_XFACE 473 + acpi_ut_predefined_warning(const char *module_name, 474 + u32 line_number, 475 + char *pathname, 476 + u8 node_flags, const char *format, ...); 477 477 478 478 /* Values for Base above (16=Hex, 10=Decimal) */ 479 479
+1
drivers/acpi/acpica/amlcode.h
··· 404 404 REGION_SMBUS, 405 405 REGION_CMOS, 406 406 REGION_PCI_BAR, 407 + REGION_IPMI, 407 408 REGION_DATA_TABLE, /* Internal use only */ 408 409 REGION_FIXED_HW = 0x7F 409 410 } AML_REGION_TYPES;
+12 -6
drivers/acpi/acpica/dsfield.c
··· 123 123 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 124 124 ACPI_NS_ERROR_IF_FOUND; 125 125 126 - /* Mark node temporary if we are executing a method */ 127 - 128 - if (walk_state->method_node) { 126 + /* 127 + * Mark node temporary if we are executing a normal control 128 + * method. (Don't mark if this is a module-level code method) 129 + */ 130 + if (walk_state->method_node && 131 + !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) { 129 132 flags |= ACPI_NS_TEMPORARY; 130 133 } 131 134 ··· 459 456 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 460 457 ACPI_NS_ERROR_IF_FOUND; 461 458 462 - /* Mark node(s) temporary if we are executing a method */ 463 - 464 - if (walk_state->method_node) { 459 + /* 460 + * Mark node(s) temporary if we are executing a normal control 461 + * method. (Don't mark if this is a module-level code method) 462 + */ 463 + if (walk_state->method_node && 464 + !(walk_state->parse_flags & ACPI_PARSE_MODULE_LEVEL)) { 465 465 flags |= ACPI_NS_TEMPORARY; 466 466 } 467 467
+11 -4
drivers/acpi/acpica/dsmethod.c
··· 578 578 } 579 579 580 580 /* 581 - * Delete any namespace objects created anywhere within 582 - * the namespace by the execution of this method 581 + * Delete any namespace objects created anywhere within the 582 + * namespace by the execution of this method. Unless this method 583 + * is a module-level executable code method, in which case we 584 + * want make the objects permanent. 583 585 */ 584 - acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); 586 + if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { 587 + acpi_ns_delete_namespace_by_owner(method_desc->method. 588 + owner_id); 589 + } 585 590 } 586 591 587 592 /* Decrement the thread count on the method */ ··· 627 622 628 623 /* No more threads, we can free the owner_id */ 629 624 630 - acpi_ut_release_owner_id(&method_desc->method.owner_id); 625 + if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { 626 + acpi_ut_release_owner_id(&method_desc->method.owner_id); 627 + } 631 628 } 632 629 633 630 return_VOID;
+4 -4
drivers/acpi/acpica/dsmthdat.c
··· 433 433 434 434 case ACPI_REFCLASS_LOCAL: 435 435 436 - ACPI_ERROR((AE_INFO, 437 - "Uninitialized Local[%d] at node %p", 438 - index, node)); 439 - 436 + /* 437 + * No error message for this case, will be trapped again later to 438 + * detect and ignore cases of Store(local_x,local_x) 439 + */ 440 440 return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); 441 441 442 442 default:
+18 -5
drivers/acpi/acpica/dsobject.c
··· 482 482 if (arg) { 483 483 /* 484 484 * num_elements was exhausted, but there are remaining elements in the 485 - * package_list. 485 + * package_list. Truncate the package to num_elements. 486 486 * 487 487 * Note: technically, this is an error, from ACPI spec: "It is an error 488 488 * for NumElements to be less than the number of elements in the 489 - * PackageList". However, for now, we just print an error message and 490 - * no exception is returned. 489 + * PackageList". However, we just print an error message and 490 + * no exception is returned. This provides Windows compatibility. Some 491 + * BIOSs will alter the num_elements on the fly, creating this type 492 + * of ill-formed package object. 491 493 */ 492 494 while (arg) { 495 + /* 496 + * We must delete any package elements that were created earlier 497 + * and are not going to be used because of the package truncation. 498 + */ 499 + if (arg->common.node) { 500 + acpi_ut_remove_reference(ACPI_CAST_PTR 501 + (union 502 + acpi_operand_object, 503 + arg->common.node)); 504 + arg->common.node = NULL; 505 + } 493 506 494 507 /* Find out how many elements there really are */ 495 508 ··· 511 498 } 512 499 513 500 ACPI_WARNING((AE_INFO, 514 - "Package List length (%X) larger than NumElements count (%X), truncated\n", 501 + "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", 515 502 i, element_count)); 516 503 } else if (i < element_count) { 517 504 /* ··· 519 506 * Note: this is not an error, the package is padded out with NULLs. 520 507 */ 521 508 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 522 - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", 509 + "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", 523 510 i, element_count)); 524 511 } 525 512
+7 -34
drivers/acpi/acpica/dswload.c
··· 581 581 if ((!(walk_state->op_info->flags & AML_NSOPCODE) && 582 582 (walk_state->opcode != AML_INT_NAMEPATH_OP)) || 583 583 (!(walk_state->op_info->flags & AML_NAMED))) { 584 - #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 585 - if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || 586 - (walk_state->op_info->class == AML_CLASS_CONTROL)) { 587 - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 588 - "Begin/EXEC: %s (fl %8.8X)\n", 589 - walk_state->op_info->name, 590 - walk_state->op_info->flags)); 591 - 592 - /* Executing a type1 or type2 opcode outside of a method */ 593 - 594 - status = 595 - acpi_ds_exec_begin_op(walk_state, out_op); 596 - return_ACPI_STATUS(status); 597 - } 598 - #endif 599 584 return_ACPI_STATUS(AE_OK); 600 585 } 601 586 ··· 753 768 754 769 /* Execution mode, node cannot already exist, node is temporary */ 755 770 756 - flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY); 771 + flags |= ACPI_NS_ERROR_IF_FOUND; 772 + 773 + if (! 774 + (walk_state-> 775 + parse_flags & ACPI_PARSE_MODULE_LEVEL)) { 776 + flags |= ACPI_NS_TEMPORARY; 777 + } 757 778 } 758 779 759 780 /* Add new entry or lookup existing entry */ ··· 842 851 /* Check if opcode had an associated namespace object */ 843 852 844 853 if (!(walk_state->op_info->flags & AML_NSOBJECT)) { 845 - #ifndef ACPI_NO_METHOD_EXECUTION 846 - #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 847 - /* No namespace object. Executable opcode? */ 848 - 849 - if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || 850 - (walk_state->op_info->class == AML_CLASS_CONTROL)) { 851 - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 852 - "End/EXEC: %s (fl %8.8X)\n", 853 - walk_state->op_info->name, 854 - walk_state->op_info->flags)); 855 - 856 - /* Executing a type1 or type2 opcode outside of a method */ 857 - 858 - status = acpi_ds_exec_end_op(walk_state); 859 - return_ACPI_STATUS(status); 860 - } 861 - #endif 862 - #endif 863 854 return_ACPI_STATUS(AE_OK); 864 855 } 865 856
+4 -4
drivers/acpi/acpica/evgpe.c
··· 424 424 /* Read the Status Register */ 425 425 426 426 status = 427 - acpi_read(&status_reg, 428 - &gpe_register_info->status_address); 427 + acpi_hw_read(&status_reg, 428 + &gpe_register_info->status_address); 429 429 if (ACPI_FAILURE(status)) { 430 430 goto unlock_and_exit; 431 431 } ··· 433 433 /* Read the Enable Register */ 434 434 435 435 status = 436 - acpi_read(&enable_reg, 437 - &gpe_register_info->enable_address); 436 + acpi_hw_read(&enable_reg, 437 + &gpe_register_info->enable_address); 438 438 if (ACPI_FAILURE(status)) { 439 439 goto unlock_and_exit; 440 440 }
+2 -2
drivers/acpi/acpica/evgpeblk.c
··· 843 843 844 844 /* Disable all GPEs within this register */ 845 845 846 - status = acpi_write(0x00, &this_register->enable_address); 846 + status = acpi_hw_write(0x00, &this_register->enable_address); 847 847 if (ACPI_FAILURE(status)) { 848 848 goto error_exit; 849 849 } 850 850 851 851 /* Clear any pending GPE events within this register */ 852 852 853 - status = acpi_write(0xFF, &this_register->status_address); 853 + status = acpi_hw_write(0xFF, &this_register->status_address); 854 854 if (ACPI_FAILURE(status)) { 855 855 goto error_exit; 856 856 }
+8 -37
drivers/acpi/acpica/evrgnini.c
··· 50 50 ACPI_MODULE_NAME("evrgnini") 51 51 52 52 /* Local prototypes */ 53 - static u8 acpi_ev_match_pci_root_bridge(char *id); 54 - 55 53 static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node); 56 54 57 55 /******************************************************************************* ··· 330 332 331 333 /******************************************************************************* 332 334 * 333 - * FUNCTION: acpi_ev_match_pci_root_bridge 334 - * 335 - * PARAMETERS: Id - The HID/CID in string format 336 - * 337 - * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge 338 - * 339 - * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. 340 - * 341 - ******************************************************************************/ 342 - 343 - static u8 acpi_ev_match_pci_root_bridge(char *id) 344 - { 345 - 346 - /* 347 - * Check if this is a PCI root. 348 - * ACPI 3.0+: check for a PCI Express root also. 349 - */ 350 - if (!(ACPI_STRNCMP(id, 351 - PCI_ROOT_HID_STRING, 352 - sizeof(PCI_ROOT_HID_STRING))) || 353 - !(ACPI_STRNCMP(id, 354 - PCI_EXPRESS_ROOT_HID_STRING, 355 - sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) { 356 - return (TRUE); 357 - } 358 - 359 - return (FALSE); 360 - } 361 - 362 - /******************************************************************************* 363 - * 364 335 * FUNCTION: acpi_ev_is_pci_root_bridge 365 336 * 366 337 * PARAMETERS: Node - Device node being examined ··· 344 377 static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) 345 378 { 346 379 acpi_status status; 347 - struct acpica_device_id hid; 348 - struct acpi_compatible_id_list *cid; 380 + struct acpica_device_id *hid; 381 + struct acpica_device_id_list *cid; 349 382 u32 i; 383 + u8 match; 350 384 351 385 /* Get the _HID and check for a PCI Root Bridge */ 352 386 ··· 356 388 return (FALSE); 357 389 } 358 390 359 - if (acpi_ev_match_pci_root_bridge(hid.value)) { 391 + match = acpi_ut_is_pci_root_bridge(hid->string); 392 + ACPI_FREE(hid); 393 + 394 + if (match) { 360 395 return (TRUE); 361 396 } 362 397 ··· 373 402 /* Check all _CIDs in the returned list */ 374 403 375 404 for (i = 0; i < cid->count; i++) { 376 - if (acpi_ev_match_pci_root_bridge(cid->id[i].value)) { 405 + if (acpi_ut_is_pci_root_bridge(cid->ids[i].string)) { 377 406 ACPI_FREE(cid); 378 407 return (TRUE); 379 408 }
+7
drivers/acpi/acpica/exconfig.c
··· 110 110 if (ACPI_FAILURE(status)) { 111 111 acpi_ut_remove_reference(obj_desc); 112 112 *ddb_handle = NULL; 113 + return_ACPI_STATUS(status); 113 114 } 115 + 116 + /* Execute any module-level code that was found in the table */ 117 + 118 + acpi_ex_exit_interpreter(); 119 + acpi_ns_exec_module_code_list(); 120 + acpi_ex_enter_interpreter(); 114 121 115 122 return_ACPI_STATUS(status); 116 123 }
+3 -3
drivers/acpi/acpica/exdump.c
··· 418 418 case ACPI_EXD_REFERENCE: 419 419 420 420 acpi_ex_out_string("Class Name", 421 - (char *) 422 - acpi_ut_get_reference_name 423 - (obj_desc)); 421 + ACPI_CAST_PTR(char, 422 + acpi_ut_get_reference_name 423 + (obj_desc))); 424 424 acpi_ex_dump_reference_obj(obj_desc); 425 425 break; 426 426
+55 -27
drivers/acpi/acpica/exfield.c
··· 72 72 union acpi_operand_object *buffer_desc; 73 73 acpi_size length; 74 74 void *buffer; 75 + u32 function; 75 76 76 77 ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); 77 78 ··· 98 97 } 99 98 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && 100 99 (obj_desc->field.region_obj->region.space_id == 101 - ACPI_ADR_SPACE_SMBUS)) { 100 + ACPI_ADR_SPACE_SMBUS 101 + || obj_desc->field.region_obj->region.space_id == 102 + ACPI_ADR_SPACE_IPMI)) { 102 103 /* 103 - * This is an SMBus read. We must create a buffer to hold the data 104 - * and directly access the region handler. 104 + * This is an SMBus or IPMI read. We must create a buffer to hold 105 + * the data and then directly access the region handler. 106 + * 107 + * Note: Smbus protocol value is passed in upper 16-bits of Function 105 108 */ 106 - buffer_desc = 107 - acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); 109 + if (obj_desc->field.region_obj->region.space_id == 110 + ACPI_ADR_SPACE_SMBUS) { 111 + length = ACPI_SMBUS_BUFFER_SIZE; 112 + function = 113 + ACPI_READ | (obj_desc->field.attribute << 16); 114 + } else { /* IPMI */ 115 + 116 + length = ACPI_IPMI_BUFFER_SIZE; 117 + function = ACPI_READ; 118 + } 119 + 120 + buffer_desc = acpi_ut_create_buffer_object(length); 108 121 if (!buffer_desc) { 109 122 return_ACPI_STATUS(AE_NO_MEMORY); 110 123 } ··· 127 112 128 113 acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); 129 114 130 - /* 131 - * Perform the read. 132 - * Note: Smbus protocol value is passed in upper 16-bits of Function 133 - */ 115 + /* Call the region handler for the read */ 116 + 134 117 status = acpi_ex_access_region(obj_desc, 0, 135 118 ACPI_CAST_PTR(acpi_integer, 136 119 buffer_desc-> 137 120 buffer.pointer), 138 - ACPI_READ | (obj_desc->field. 139 - attribute << 16)); 121 + function); 140 122 acpi_ex_release_global_lock(obj_desc->common_field.field_flags); 141 123 goto exit; 142 124 } ··· 224 212 u32 length; 225 213 void *buffer; 226 214 union acpi_operand_object *buffer_desc; 215 + u32 function; 227 216 228 217 ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); 229 218 ··· 247 234 } 248 235 } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && 249 236 (obj_desc->field.region_obj->region.space_id == 250 - ACPI_ADR_SPACE_SMBUS)) { 237 + ACPI_ADR_SPACE_SMBUS 238 + || obj_desc->field.region_obj->region.space_id == 239 + ACPI_ADR_SPACE_IPMI)) { 251 240 /* 252 - * This is an SMBus write. We will bypass the entire field mechanism 253 - * and handoff the buffer directly to the handler. 241 + * This is an SMBus or IPMI write. We will bypass the entire field 242 + * mechanism and handoff the buffer directly to the handler. For 243 + * these address spaces, the buffer is bi-directional; on a write, 244 + * return data is returned in the same buffer. 254 245 * 255 - * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). 246 + * Source must be a buffer of sufficient size: 247 + * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE. 248 + * 249 + * Note: SMBus protocol type is passed in upper 16-bits of Function 256 250 */ 257 251 if (source_desc->common.type != ACPI_TYPE_BUFFER) { 258 252 ACPI_ERROR((AE_INFO, 259 - "SMBus write requires Buffer, found type %s", 253 + "SMBus or IPMI write requires Buffer, found type %s", 260 254 acpi_ut_get_object_type_name(source_desc))); 261 255 262 256 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 263 257 } 264 258 265 - if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 259 + if (obj_desc->field.region_obj->region.space_id == 260 + ACPI_ADR_SPACE_SMBUS) { 261 + length = ACPI_SMBUS_BUFFER_SIZE; 262 + function = 263 + ACPI_WRITE | (obj_desc->field.attribute << 16); 264 + } else { /* IPMI */ 265 + 266 + length = ACPI_IPMI_BUFFER_SIZE; 267 + function = ACPI_WRITE; 268 + } 269 + 270 + if (source_desc->buffer.length < length) { 266 271 ACPI_ERROR((AE_INFO, 267 - "SMBus write requires Buffer of length %X, found length %X", 268 - ACPI_SMBUS_BUFFER_SIZE, 269 - source_desc->buffer.length)); 272 + "SMBus or IPMI write requires Buffer of length %X, found length %X", 273 + length, source_desc->buffer.length)); 270 274 271 275 return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); 272 276 } 273 277 274 - buffer_desc = 275 - acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE); 278 + /* Create the bi-directional buffer */ 279 + 280 + buffer_desc = acpi_ut_create_buffer_object(length); 276 281 if (!buffer_desc) { 277 282 return_ACPI_STATUS(AE_NO_MEMORY); 278 283 } 279 284 280 285 buffer = buffer_desc->buffer.pointer; 281 - ACPI_MEMCPY(buffer, source_desc->buffer.pointer, 282 - ACPI_SMBUS_BUFFER_SIZE); 286 + ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length); 283 287 284 288 /* Lock entire transaction if requested */ 285 289 ··· 305 275 /* 306 276 * Perform the write (returns status and perhaps data in the 307 277 * same buffer) 308 - * Note: SMBus protocol type is passed in upper 16-bits of Function. 309 278 */ 310 279 status = acpi_ex_access_region(obj_desc, 0, 311 280 (acpi_integer *) buffer, 312 - ACPI_WRITE | (obj_desc->field. 313 - attribute << 16)); 281 + function); 314 282 acpi_ex_release_global_lock(obj_desc->common_field.field_flags); 315 283 316 284 *result_desc = buffer_desc;
+4 -3
drivers/acpi/acpica/exfldio.c
··· 120 120 } 121 121 122 122 /* 123 - * Exit now for SMBus address space, it has a non-linear address space 123 + * Exit now for SMBus or IPMI address space, it has a non-linear address space 124 124 * and the request cannot be directly validated 125 125 */ 126 - if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { 126 + if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || 127 + rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { 127 128 128 - /* SMBus has a non-linear address space */ 129 + /* SMBus or IPMI has a non-linear address space */ 129 130 130 131 return_ACPI_STATUS(AE_OK); 131 132 }
+35 -18
drivers/acpi/acpica/exutils.c
··· 358 358 * 359 359 * FUNCTION: acpi_ex_eisa_id_to_string 360 360 * 361 - * PARAMETERS: numeric_id - EISA ID to be converted 361 + * PARAMETERS: compressed_id - EISAID to be converted 362 362 * out_string - Where to put the converted string (8 bytes) 363 363 * 364 364 * RETURN: None 365 365 * 366 - * DESCRIPTION: Convert a numeric EISA ID to string representation 366 + * DESCRIPTION: Convert a numeric EISAID to string representation. Return 367 + * buffer must be large enough to hold the string. The string 368 + * returned is always exactly of length ACPI_EISAID_STRING_SIZE 369 + * (includes null terminator). The EISAID is always 32 bits. 367 370 * 368 371 ******************************************************************************/ 369 372 370 - void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) 373 + void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) 371 374 { 372 - u32 eisa_id; 375 + u32 swapped_id; 373 376 374 377 ACPI_FUNCTION_ENTRY(); 375 378 379 + /* The EISAID should be a 32-bit integer */ 380 + 381 + if (compressed_id > ACPI_UINT32_MAX) { 382 + ACPI_WARNING((AE_INFO, 383 + "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", 384 + ACPI_FORMAT_UINT64(compressed_id))); 385 + } 386 + 376 387 /* Swap ID to big-endian to get contiguous bits */ 377 388 378 - eisa_id = acpi_ut_dword_byte_swap(numeric_id); 389 + swapped_id = acpi_ut_dword_byte_swap((u32)compressed_id); 379 390 380 - out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); 381 - out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); 382 - out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); 383 - out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); 384 - out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); 385 - out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); 386 - out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); 391 + /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ 392 + 393 + out_string[0] = 394 + (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); 395 + out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); 396 + out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); 397 + out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); 398 + out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); 399 + out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); 400 + out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); 387 401 out_string[7] = 0; 388 402 } 389 403 390 404 /******************************************************************************* 391 405 * 392 - * FUNCTION: acpi_ex_unsigned_integer_to_string 406 + * FUNCTION: acpi_ex_integer_to_string 393 407 * 394 - * PARAMETERS: Value - Value to be converted 395 - * out_string - Where to put the converted string (8 bytes) 408 + * PARAMETERS: out_string - Where to put the converted string. At least 409 + * 21 bytes are needed to hold the largest 410 + * possible 64-bit integer. 411 + * Value - Value to be converted 396 412 * 397 413 * RETURN: None, string 398 414 * 399 - * DESCRIPTION: Convert a number to string representation. Assumes string 400 - * buffer is large enough to hold the string. 415 + * DESCRIPTION: Convert a 64-bit integer to decimal string representation. 416 + * Assumes string buffer is large enough to hold the string. The 417 + * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). 401 418 * 402 419 ******************************************************************************/ 403 420 404 - void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) 421 + void acpi_ex_integer_to_string(char *out_string, acpi_integer value) 405 422 { 406 423 u32 count; 407 424 u32 digits_needed;
+17 -17
drivers/acpi/acpica/hwgpe.c
··· 82 82 83 83 /* Get current value of the enable register that contains this GPE */ 84 84 85 - status = acpi_read(&enable_mask, &gpe_register_info->enable_address); 85 + status = acpi_hw_read(&enable_mask, &gpe_register_info->enable_address); 86 86 if (ACPI_FAILURE(status)) { 87 87 return (status); 88 88 } ··· 95 95 96 96 /* Write the updated enable mask */ 97 97 98 - status = acpi_write(enable_mask, &gpe_register_info->enable_address); 98 + status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); 99 99 return (status); 100 100 } 101 101 ··· 130 130 131 131 /* Write the entire GPE (runtime) enable register */ 132 132 133 - status = acpi_write(gpe_register_info->enable_for_run, 134 - &gpe_register_info->enable_address); 133 + status = acpi_hw_write(gpe_register_info->enable_for_run, 134 + &gpe_register_info->enable_address); 135 135 136 136 return (status); 137 137 } ··· 163 163 * Write a one to the appropriate bit in the status register to 164 164 * clear this GPE. 165 165 */ 166 - status = acpi_write(register_bit, 167 - &gpe_event_info->register_info->status_address); 166 + status = acpi_hw_write(register_bit, 167 + &gpe_event_info->register_info->status_address); 168 168 169 169 return (status); 170 170 } ··· 222 222 223 223 /* GPE currently active (status bit == 1)? */ 224 224 225 - status = acpi_read(&in_byte, &gpe_register_info->status_address); 225 + status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); 226 226 if (ACPI_FAILURE(status)) { 227 227 goto unlock_and_exit; 228 228 } ··· 266 266 /* Disable all GPEs in this register */ 267 267 268 268 status = 269 - acpi_write(0x00, 270 - &gpe_block->register_info[i].enable_address); 269 + acpi_hw_write(0x00, 270 + &gpe_block->register_info[i].enable_address); 271 271 if (ACPI_FAILURE(status)) { 272 272 return (status); 273 273 } ··· 303 303 /* Clear status on all GPEs in this register */ 304 304 305 305 status = 306 - acpi_write(0xFF, 307 - &gpe_block->register_info[i].status_address); 306 + acpi_hw_write(0xFF, 307 + &gpe_block->register_info[i].status_address); 308 308 if (ACPI_FAILURE(status)) { 309 309 return (status); 310 310 } ··· 345 345 346 346 /* Enable all "runtime" GPEs in this register */ 347 347 348 - status = acpi_write(gpe_block->register_info[i].enable_for_run, 349 - &gpe_block->register_info[i]. 350 - enable_address); 348 + status = 349 + acpi_hw_write(gpe_block->register_info[i].enable_for_run, 350 + &gpe_block->register_info[i].enable_address); 351 351 if (ACPI_FAILURE(status)) { 352 352 return (status); 353 353 } ··· 387 387 388 388 /* Enable all "wake" GPEs in this register */ 389 389 390 - status = acpi_write(gpe_block->register_info[i].enable_for_wake, 391 - &gpe_block->register_info[i]. 392 - enable_address); 390 + status = 391 + acpi_hw_write(gpe_block->register_info[i].enable_for_wake, 392 + &gpe_block->register_info[i].enable_address); 393 393 if (ACPI_FAILURE(status)) { 394 394 return (status); 395 395 }
+194 -12
drivers/acpi/acpica/hwregs.c
··· 62 62 struct acpi_generic_address *register_a, 63 63 struct acpi_generic_address *register_b); 64 64 65 + /****************************************************************************** 66 + * 67 + * FUNCTION: acpi_hw_validate_register 68 + * 69 + * PARAMETERS: Reg - GAS register structure 70 + * max_bit_width - Max bit_width supported (32 or 64) 71 + * Address - Pointer to where the gas->address 72 + * is returned 73 + * 74 + * RETURN: Status 75 + * 76 + * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS 77 + * pointer, Address, space_id, bit_width, and bit_offset. 78 + * 79 + ******************************************************************************/ 80 + 81 + acpi_status 82 + acpi_hw_validate_register(struct acpi_generic_address *reg, 83 + u8 max_bit_width, u64 *address) 84 + { 85 + 86 + /* Must have a valid pointer to a GAS structure */ 87 + 88 + if (!reg) { 89 + return (AE_BAD_PARAMETER); 90 + } 91 + 92 + /* 93 + * Copy the target address. This handles possible alignment issues. 94 + * Address must not be null. A null address also indicates an optional 95 + * ACPI register that is not supported, so no error message. 96 + */ 97 + ACPI_MOVE_64_TO_64(address, &reg->address); 98 + if (!(*address)) { 99 + return (AE_BAD_ADDRESS); 100 + } 101 + 102 + /* Validate the space_iD */ 103 + 104 + if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) && 105 + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { 106 + ACPI_ERROR((AE_INFO, 107 + "Unsupported address space: 0x%X", reg->space_id)); 108 + return (AE_SUPPORT); 109 + } 110 + 111 + /* Validate the bit_width */ 112 + 113 + if ((reg->bit_width != 8) && 114 + (reg->bit_width != 16) && 115 + (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) { 116 + ACPI_ERROR((AE_INFO, 117 + "Unsupported register bit width: 0x%X", 118 + reg->bit_width)); 119 + return (AE_SUPPORT); 120 + } 121 + 122 + /* Validate the bit_offset. Just a warning for now. */ 123 + 124 + if (reg->bit_offset != 0) { 125 + ACPI_WARNING((AE_INFO, 126 + "Unsupported register bit offset: 0x%X", 127 + reg->bit_offset)); 128 + } 129 + 130 + return (AE_OK); 131 + } 132 + 133 + /****************************************************************************** 134 + * 135 + * FUNCTION: acpi_hw_read 136 + * 137 + * PARAMETERS: Value - Where the value is returned 138 + * Reg - GAS register structure 139 + * 140 + * RETURN: Status 141 + * 142 + * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max 143 + * version of acpi_read, used internally since the overhead of 144 + * 64-bit values is not needed. 145 + * 146 + * LIMITATIONS: <These limitations also apply to acpi_hw_write> 147 + * bit_width must be exactly 8, 16, or 32. 148 + * space_iD must be system_memory or system_iO. 149 + * bit_offset and access_width are currently ignored, as there has 150 + * not been a need to implement these. 151 + * 152 + ******************************************************************************/ 153 + 154 + acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) 155 + { 156 + u64 address; 157 + acpi_status status; 158 + 159 + ACPI_FUNCTION_NAME(hw_read); 160 + 161 + /* Validate contents of the GAS register */ 162 + 163 + status = acpi_hw_validate_register(reg, 32, &address); 164 + if (ACPI_FAILURE(status)) { 165 + return (status); 166 + } 167 + 168 + /* Initialize entire 32-bit return value to zero */ 169 + 170 + *value = 0; 171 + 172 + /* 173 + * Two address spaces supported: Memory or IO. PCI_Config is 174 + * not supported here because the GAS structure is insufficient 175 + */ 176 + if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 177 + status = acpi_os_read_memory((acpi_physical_address) 178 + address, value, reg->bit_width); 179 + } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 180 + 181 + status = acpi_hw_read_port((acpi_io_address) 182 + address, value, reg->bit_width); 183 + } 184 + 185 + ACPI_DEBUG_PRINT((ACPI_DB_IO, 186 + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 187 + *value, reg->bit_width, ACPI_FORMAT_UINT64(address), 188 + acpi_ut_get_region_name(reg->space_id))); 189 + 190 + return (status); 191 + } 192 + 193 + /****************************************************************************** 194 + * 195 + * FUNCTION: acpi_hw_write 196 + * 197 + * PARAMETERS: Value - Value to be written 198 + * Reg - GAS register structure 199 + * 200 + * RETURN: Status 201 + * 202 + * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max 203 + * version of acpi_write, used internally since the overhead of 204 + * 64-bit values is not needed. 205 + * 206 + ******************************************************************************/ 207 + 208 + acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) 209 + { 210 + u64 address; 211 + acpi_status status; 212 + 213 + ACPI_FUNCTION_NAME(hw_write); 214 + 215 + /* Validate contents of the GAS register */ 216 + 217 + status = acpi_hw_validate_register(reg, 32, &address); 218 + if (ACPI_FAILURE(status)) { 219 + return (status); 220 + } 221 + 222 + /* 223 + * Two address spaces supported: Memory or IO. PCI_Config is 224 + * not supported here because the GAS structure is insufficient 225 + */ 226 + if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 227 + status = acpi_os_write_memory((acpi_physical_address) 228 + address, value, reg->bit_width); 229 + } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 230 + 231 + status = acpi_hw_write_port((acpi_io_address) 232 + address, value, reg->bit_width); 233 + } 234 + 235 + ACPI_DEBUG_PRINT((ACPI_DB_IO, 236 + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 237 + value, reg->bit_width, ACPI_FORMAT_UINT64(address), 238 + acpi_ut_get_region_name(reg->space_id))); 239 + 240 + return (status); 241 + } 242 + 65 243 /******************************************************************************* 66 244 * 67 245 * FUNCTION: acpi_hw_clear_acpi_status ··· 330 152 331 153 ACPI_FUNCTION_TRACE(hw_write_pm1_control); 332 154 333 - status = acpi_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block); 155 + status = 156 + acpi_hw_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block); 334 157 if (ACPI_FAILURE(status)) { 335 158 return_ACPI_STATUS(status); 336 159 } 337 160 338 161 if (acpi_gbl_FADT.xpm1b_control_block.address) { 339 162 status = 340 - acpi_write(pm1b_control, 341 - &acpi_gbl_FADT.xpm1b_control_block); 163 + acpi_hw_write(pm1b_control, 164 + &acpi_gbl_FADT.xpm1b_control_block); 342 165 } 343 166 return_ACPI_STATUS(status); 344 167 } ··· 397 218 398 219 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ 399 220 400 - status = acpi_read(&value, &acpi_gbl_FADT.xpm2_control_block); 221 + status = 222 + acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block); 401 223 break; 402 224 403 225 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 404 226 405 - status = acpi_read(&value, &acpi_gbl_FADT.xpm_timer_block); 227 + status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block); 406 228 break; 407 229 408 230 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ ··· 520 340 * as per the ACPI spec. 521 341 */ 522 342 status = 523 - acpi_read(&read_value, &acpi_gbl_FADT.xpm2_control_block); 343 + acpi_hw_read(&read_value, 344 + &acpi_gbl_FADT.xpm2_control_block); 524 345 if (ACPI_FAILURE(status)) { 525 346 goto exit; 526 347 } ··· 531 350 ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS, 532 351 read_value); 533 352 534 - status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); 353 + status = 354 + acpi_hw_write(value, &acpi_gbl_FADT.xpm2_control_block); 535 355 break; 536 356 537 357 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 538 358 539 - status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block); 359 + status = acpi_hw_write(value, &acpi_gbl_FADT.xpm_timer_block); 540 360 break; 541 361 542 362 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ ··· 583 401 584 402 /* The first register is always required */ 585 403 586 - status = acpi_read(&value_a, register_a); 404 + status = acpi_hw_read(&value_a, register_a); 587 405 if (ACPI_FAILURE(status)) { 588 406 return (status); 589 407 } ··· 591 409 /* Second register is optional */ 592 410 593 411 if (register_b->address) { 594 - status = acpi_read(&value_b, register_b); 412 + status = acpi_hw_read(&value_b, register_b); 595 413 if (ACPI_FAILURE(status)) { 596 414 return (status); 597 415 } ··· 634 452 635 453 /* The first register is always required */ 636 454 637 - status = acpi_write(value, register_a); 455 + status = acpi_hw_write(value, register_a); 638 456 if (ACPI_FAILURE(status)) { 639 457 return (status); 640 458 } ··· 652 470 * and writes have no side effects" 653 471 */ 654 472 if (register_b->address) { 655 - status = acpi_write(value, register_b); 473 + status = acpi_hw_write(value, register_b); 656 474 } 657 475 658 476 return (status);
+1 -1
drivers/acpi/acpica/hwtimer.c
··· 100 100 } 101 101 102 102 status = 103 - acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block); 103 + acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block); 104 104 105 105 return_ACPI_STATUS(status); 106 106 }
+114 -69
drivers/acpi/acpica/hwxface.c
··· 78 78 return_ACPI_STATUS(AE_NOT_EXIST); 79 79 } 80 80 81 - /* Write the reset value to the reset register */ 81 + if (reset_reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { 82 + /* 83 + * For I/O space, write directly to the OSL. This bypasses the port 84 + * validation mechanism, which may block a valid write to the reset 85 + * register. 86 + */ 87 + status = 88 + acpi_os_write_port((acpi_io_address) reset_reg->address, 89 + acpi_gbl_FADT.reset_value, 90 + reset_reg->bit_width); 91 + } else { 92 + /* Write the reset value to the reset register */ 82 93 83 - status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg); 94 + status = acpi_hw_write(acpi_gbl_FADT.reset_value, reset_reg); 95 + } 96 + 84 97 return_ACPI_STATUS(status); 85 98 } 86 99 ··· 110 97 * 111 98 * DESCRIPTION: Read from either memory or IO space. 112 99 * 100 + * LIMITATIONS: <These limitations also apply to acpi_write> 101 + * bit_width must be exactly 8, 16, 32, or 64. 102 + * space_iD must be system_memory or system_iO. 103 + * bit_offset and access_width are currently ignored, as there has 104 + * not been a need to implement these. 105 + * 113 106 ******************************************************************************/ 114 - acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) 107 + acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) 115 108 { 109 + u32 value; 116 110 u32 width; 117 111 u64 address; 118 112 acpi_status status; 119 113 120 114 ACPI_FUNCTION_NAME(acpi_read); 121 115 122 - /* 123 - * Must have a valid pointer to a GAS structure, and a non-zero address 124 - * within. 125 - */ 126 - if (!reg) { 116 + if (!return_value) { 127 117 return (AE_BAD_PARAMETER); 128 118 } 129 119 130 - /* Get a local copy of the address. Handles possible alignment issues */ 120 + /* Validate contents of the GAS register. Allow 64-bit transfers */ 131 121 132 - ACPI_MOVE_64_TO_64(&address, &reg->address); 133 - if (!address) { 134 - return (AE_BAD_ADDRESS); 122 + status = acpi_hw_validate_register(reg, 64, &address); 123 + if (ACPI_FAILURE(status)) { 124 + return (status); 135 125 } 136 - 137 - /* Supported widths are 8/16/32 */ 138 126 139 127 width = reg->bit_width; 140 - if ((width != 8) && (width != 16) && (width != 32)) { 141 - return (AE_SUPPORT); 128 + if (width == 64) { 129 + width = 32; /* Break into two 32-bit transfers */ 142 130 } 143 131 144 - /* Initialize entire 32-bit return value to zero */ 132 + /* Initialize entire 64-bit return value to zero */ 145 133 146 - *value = 0; 134 + *return_value = 0; 135 + value = 0; 147 136 148 137 /* 149 138 * Two address spaces supported: Memory or IO. PCI_Config is 150 139 * not supported here because the GAS structure is insufficient 151 140 */ 152 - switch (reg->space_id) { 153 - case ACPI_ADR_SPACE_SYSTEM_MEMORY: 141 + if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 142 + status = acpi_os_read_memory((acpi_physical_address) 143 + address, &value, width); 144 + if (ACPI_FAILURE(status)) { 145 + return (status); 146 + } 147 + *return_value = value; 154 148 155 - status = acpi_os_read_memory((acpi_physical_address) address, 156 - value, width); 157 - break; 149 + if (reg->bit_width == 64) { 158 150 159 - case ACPI_ADR_SPACE_SYSTEM_IO: 151 + /* Read the top 32 bits */ 160 152 161 - status = 162 - acpi_hw_read_port((acpi_io_address) address, value, width); 163 - break; 153 + status = acpi_os_read_memory((acpi_physical_address) 154 + (address + 4), &value, 32); 155 + if (ACPI_FAILURE(status)) { 156 + return (status); 157 + } 158 + *return_value |= ((u64)value << 32); 159 + } 160 + } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 164 161 165 - default: 166 - ACPI_ERROR((AE_INFO, 167 - "Unsupported address space: %X", reg->space_id)); 168 - return (AE_BAD_PARAMETER); 162 + status = acpi_hw_read_port((acpi_io_address) 163 + address, &value, width); 164 + if (ACPI_FAILURE(status)) { 165 + return (status); 166 + } 167 + *return_value = value; 168 + 169 + if (reg->bit_width == 64) { 170 + 171 + /* Read the top 32 bits */ 172 + 173 + status = acpi_hw_read_port((acpi_io_address) 174 + (address + 4), &value, 32); 175 + if (ACPI_FAILURE(status)) { 176 + return (status); 177 + } 178 + *return_value |= ((u64)value << 32); 179 + } 169 180 } 170 181 171 182 ACPI_DEBUG_PRINT((ACPI_DB_IO, 172 - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 173 - *value, width, ACPI_FORMAT_UINT64(address), 183 + "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", 184 + ACPI_FORMAT_UINT64(*return_value), reg->bit_width, 185 + ACPI_FORMAT_UINT64(address), 174 186 acpi_ut_get_region_name(reg->space_id))); 175 187 176 188 return (status); ··· 207 169 * 208 170 * FUNCTION: acpi_write 209 171 * 210 - * PARAMETERS: Value - To be written 172 + * PARAMETERS: Value - Value to be written 211 173 * Reg - GAS register structure 212 174 * 213 175 * RETURN: Status ··· 215 177 * DESCRIPTION: Write to either memory or IO space. 216 178 * 217 179 ******************************************************************************/ 218 - acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) 180 + acpi_status acpi_write(u64 value, struct acpi_generic_address *reg) 219 181 { 220 182 u32 width; 221 183 u64 address; ··· 223 185 224 186 ACPI_FUNCTION_NAME(acpi_write); 225 187 226 - /* 227 - * Must have a valid pointer to a GAS structure, and a non-zero address 228 - * within. 229 - */ 230 - if (!reg) { 231 - return (AE_BAD_PARAMETER); 188 + /* Validate contents of the GAS register. Allow 64-bit transfers */ 189 + 190 + status = acpi_hw_validate_register(reg, 64, &address); 191 + if (ACPI_FAILURE(status)) { 192 + return (status); 232 193 } 233 - 234 - /* Get a local copy of the address. Handles possible alignment issues */ 235 - 236 - ACPI_MOVE_64_TO_64(&address, &reg->address); 237 - if (!address) { 238 - return (AE_BAD_ADDRESS); 239 - } 240 - 241 - /* Supported widths are 8/16/32 */ 242 194 243 195 width = reg->bit_width; 244 - if ((width != 8) && (width != 16) && (width != 32)) { 245 - return (AE_SUPPORT); 196 + if (width == 64) { 197 + width = 32; /* Break into two 32-bit transfers */ 246 198 } 247 199 248 200 /* 249 - * Two address spaces supported: Memory or IO. 250 - * PCI_Config is not supported here because the GAS struct is insufficient 201 + * Two address spaces supported: Memory or IO. PCI_Config is 202 + * not supported here because the GAS structure is insufficient 251 203 */ 252 - switch (reg->space_id) { 253 - case ACPI_ADR_SPACE_SYSTEM_MEMORY: 204 + if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 205 + status = acpi_os_write_memory((acpi_physical_address) 206 + address, ACPI_LODWORD(value), 207 + width); 208 + if (ACPI_FAILURE(status)) { 209 + return (status); 210 + } 254 211 255 - status = acpi_os_write_memory((acpi_physical_address) address, 256 - value, width); 257 - break; 212 + if (reg->bit_width == 64) { 213 + status = acpi_os_write_memory((acpi_physical_address) 214 + (address + 4), 215 + ACPI_HIDWORD(value), 32); 216 + if (ACPI_FAILURE(status)) { 217 + return (status); 218 + } 219 + } 220 + } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 258 221 259 - case ACPI_ADR_SPACE_SYSTEM_IO: 260 - 261 - status = acpi_hw_write_port((acpi_io_address) address, value, 222 + status = acpi_hw_write_port((acpi_io_address) 223 + address, ACPI_LODWORD(value), 262 224 width); 263 - break; 225 + if (ACPI_FAILURE(status)) { 226 + return (status); 227 + } 264 228 265 - default: 266 - ACPI_ERROR((AE_INFO, 267 - "Unsupported address space: %X", reg->space_id)); 268 - return (AE_BAD_PARAMETER); 229 + if (reg->bit_width == 64) { 230 + status = acpi_hw_write_port((acpi_io_address) 231 + (address + 4), 232 + ACPI_HIDWORD(value), 32); 233 + if (ACPI_FAILURE(status)) { 234 + return (status); 235 + } 236 + } 269 237 } 270 238 271 239 ACPI_DEBUG_PRINT((ACPI_DB_IO, 272 - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 273 - value, width, ACPI_FORMAT_UINT64(address), 240 + "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", 241 + ACPI_FORMAT_UINT64(value), reg->bit_width, 242 + ACPI_FORMAT_UINT64(address), 274 243 acpi_ut_get_region_name(reg->space_id))); 275 244 276 245 return (status);
+61 -27
drivers/acpi/acpica/nsalloc.c
··· 96 96 * 97 97 * RETURN: None 98 98 * 99 - * DESCRIPTION: Delete a namespace node 99 + * DESCRIPTION: Delete a namespace node. All node deletions must come through 100 + * here. Detaches any attached objects, including any attached 101 + * data. If a handler is associated with attached data, it is 102 + * invoked before the node is deleted. 100 103 * 101 104 ******************************************************************************/ 102 105 103 106 void acpi_ns_delete_node(struct acpi_namespace_node *node) 104 107 { 108 + union acpi_operand_object *obj_desc; 109 + 110 + ACPI_FUNCTION_NAME(ns_delete_node); 111 + 112 + /* Detach an object if there is one */ 113 + 114 + acpi_ns_detach_object(node); 115 + 116 + /* 117 + * Delete an attached data object if present (an object that was created 118 + * and attached via acpi_attach_data). Note: After any normal object is 119 + * detached above, the only possible remaining object is a data object. 120 + */ 121 + obj_desc = node->object; 122 + if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) { 123 + 124 + /* Invoke the attached data deletion handler if present */ 125 + 126 + if (obj_desc->data.handler) { 127 + obj_desc->data.handler(node, obj_desc->data.pointer); 128 + } 129 + 130 + acpi_ut_remove_reference(obj_desc); 131 + } 132 + 133 + /* Now we can delete the node */ 134 + 135 + (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); 136 + 137 + ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); 138 + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", 139 + node, acpi_gbl_current_node_count)); 140 + } 141 + 142 + /******************************************************************************* 143 + * 144 + * FUNCTION: acpi_ns_remove_node 145 + * 146 + * PARAMETERS: Node - Node to be removed/deleted 147 + * 148 + * RETURN: None 149 + * 150 + * DESCRIPTION: Remove (unlink) and delete a namespace node 151 + * 152 + ******************************************************************************/ 153 + 154 + void acpi_ns_remove_node(struct acpi_namespace_node *node) 155 + { 105 156 struct acpi_namespace_node *parent_node; 106 157 struct acpi_namespace_node *prev_node; 107 158 struct acpi_namespace_node *next_node; 108 159 109 - ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); 160 + ACPI_FUNCTION_TRACE_PTR(ns_remove_node, node); 110 161 111 162 parent_node = acpi_ns_get_parent_node(node); 112 163 ··· 193 142 } 194 143 } 195 144 196 - ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); 145 + /* Delete the node and any attached objects */ 197 146 198 - /* Detach an object if there is one, then delete the node */ 199 - 200 - acpi_ns_detach_object(node); 201 - (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); 147 + acpi_ns_delete_node(node); 202 148 return_VOID; 203 149 } 204 150 ··· 321 273 parent_node, child_node)); 322 274 } 323 275 324 - /* Now we can free this child object */ 325 - 326 - ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); 327 - 328 - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 329 - "Object %p, Remaining %X\n", child_node, 330 - acpi_gbl_current_node_count)); 331 - 332 - /* Detach an object if there is one, then free the child node */ 333 - 334 - acpi_ns_detach_object(child_node); 335 - 336 - /* Now we can delete the node */ 337 - 338 - (void)acpi_os_release_object(acpi_gbl_namespace_cache, 339 - child_node); 340 - 341 - /* And move on to the next child in the list */ 342 - 276 + /* 277 + * Delete this child node and move on to the next child in the list. 278 + * No need to unlink the node since we are deleting the entire branch. 279 + */ 280 + acpi_ns_delete_node(child_node); 343 281 child_node = next_node; 344 282 345 283 } while (!(flags & ANOBJ_END_OF_PEER_LIST)); ··· 467 433 468 434 if (deletion_node) { 469 435 acpi_ns_delete_children(deletion_node); 470 - acpi_ns_delete_node(deletion_node); 436 + acpi_ns_remove_node(deletion_node); 471 437 deletion_node = NULL; 472 438 } 473 439
+2 -5
drivers/acpi/acpica/nsdumpdv.c
··· 70 70 acpi_ns_dump_one_device(acpi_handle obj_handle, 71 71 u32 level, void *context, void **return_value) 72 72 { 73 - struct acpi_buffer buffer; 74 73 struct acpi_device_info *info; 75 74 acpi_status status; 76 75 u32 i; ··· 79 80 status = 80 81 acpi_ns_dump_one_object(obj_handle, level, context, return_value); 81 82 82 - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 83 - status = acpi_get_object_info(obj_handle, &buffer); 83 + status = acpi_get_object_info(obj_handle, &info); 84 84 if (ACPI_SUCCESS(status)) { 85 - info = buffer.pointer; 86 85 for (i = 0; i < level; i++) { 87 86 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); 88 87 } 89 88 90 89 ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, 91 90 " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", 92 - info->hardware_id.value, 91 + info->hardware_id.string, 93 92 ACPI_FORMAT_UINT64(info->address), 94 93 info->current_status)); 95 94 ACPI_FREE(info);
+137
drivers/acpi/acpica/nseval.c
··· 50 50 #define _COMPONENT ACPI_NAMESPACE 51 51 ACPI_MODULE_NAME("nseval") 52 52 53 + /* Local prototypes */ 54 + static void 55 + acpi_ns_exec_module_code(union acpi_operand_object *method_obj, 56 + struct acpi_evaluate_info *info); 57 + 53 58 /******************************************************************************* 54 59 * 55 60 * FUNCTION: acpi_ns_evaluate ··· 81 76 * MUTEX: Locks interpreter 82 77 * 83 78 ******************************************************************************/ 79 + 84 80 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) 85 81 { 86 82 acpi_status status; ··· 281 275 * just return 282 276 */ 283 277 return_ACPI_STATUS(status); 278 + } 279 + 280 + /******************************************************************************* 281 + * 282 + * FUNCTION: acpi_ns_exec_module_code_list 283 + * 284 + * PARAMETERS: None 285 + * 286 + * RETURN: None. Exceptions during method execution are ignored, since 287 + * we cannot abort a table load. 288 + * 289 + * DESCRIPTION: Execute all elements of the global module-level code list. 290 + * Each element is executed as a single control method. 291 + * 292 + ******************************************************************************/ 293 + 294 + void acpi_ns_exec_module_code_list(void) 295 + { 296 + union acpi_operand_object *prev; 297 + union acpi_operand_object *next; 298 + struct acpi_evaluate_info *info; 299 + u32 method_count = 0; 300 + 301 + ACPI_FUNCTION_TRACE(ns_exec_module_code_list); 302 + 303 + /* Exit now if the list is empty */ 304 + 305 + next = acpi_gbl_module_code_list; 306 + if (!next) { 307 + return_VOID; 308 + } 309 + 310 + /* Allocate the evaluation information block */ 311 + 312 + info = ACPI_ALLOCATE(sizeof(struct acpi_evaluate_info)); 313 + if (!info) { 314 + return_VOID; 315 + } 316 + 317 + /* Walk the list, executing each "method" */ 318 + 319 + while (next) { 320 + prev = next; 321 + next = next->method.mutex; 322 + 323 + /* Clear the link field and execute the method */ 324 + 325 + prev->method.mutex = NULL; 326 + acpi_ns_exec_module_code(prev, info); 327 + method_count++; 328 + 329 + /* Delete the (temporary) method object */ 330 + 331 + acpi_ut_remove_reference(prev); 332 + } 333 + 334 + ACPI_INFO((AE_INFO, 335 + "Executed %u blocks of module-level executable AML code", 336 + method_count)); 337 + 338 + ACPI_FREE(info); 339 + acpi_gbl_module_code_list = NULL; 340 + return_VOID; 341 + } 342 + 343 + /******************************************************************************* 344 + * 345 + * FUNCTION: acpi_ns_exec_module_code 346 + * 347 + * PARAMETERS: method_obj - Object container for the module-level code 348 + * Info - Info block for method evaluation 349 + * 350 + * RETURN: None. Exceptions during method execution are ignored, since 351 + * we cannot abort a table load. 352 + * 353 + * DESCRIPTION: Execute a control method containing a block of module-level 354 + * executable AML code. The control method is temporarily 355 + * installed to the root node, then evaluated. 356 + * 357 + ******************************************************************************/ 358 + 359 + static void 360 + acpi_ns_exec_module_code(union acpi_operand_object *method_obj, 361 + struct acpi_evaluate_info *info) 362 + { 363 + union acpi_operand_object *root_obj; 364 + acpi_status status; 365 + 366 + ACPI_FUNCTION_TRACE(ns_exec_module_code); 367 + 368 + /* Initialize the evaluation information block */ 369 + 370 + ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info)); 371 + info->prefix_node = acpi_gbl_root_node; 372 + 373 + /* 374 + * Get the currently attached root object. Add a reference, because the 375 + * ref count will be decreased when the method object is installed to 376 + * the root node. 377 + */ 378 + root_obj = acpi_ns_get_attached_object(acpi_gbl_root_node); 379 + acpi_ut_add_reference(root_obj); 380 + 381 + /* Install the method (module-level code) in the root node */ 382 + 383 + status = acpi_ns_attach_object(acpi_gbl_root_node, method_obj, 384 + ACPI_TYPE_METHOD); 385 + if (ACPI_FAILURE(status)) { 386 + goto exit; 387 + } 388 + 389 + /* Execute the root node as a control method */ 390 + 391 + status = acpi_ns_evaluate(info); 392 + 393 + ACPI_DEBUG_PRINT((ACPI_DB_INIT, "Executed module-level code at %p\n", 394 + method_obj->method.aml_start)); 395 + 396 + /* Detach the temporary method object */ 397 + 398 + acpi_ns_detach_object(acpi_gbl_root_node); 399 + 400 + /* Restore the original root object */ 401 + 402 + status = 403 + acpi_ns_attach_object(acpi_gbl_root_node, root_obj, 404 + ACPI_TYPE_DEVICE); 405 + 406 + exit: 407 + acpi_ut_remove_reference(root_obj); 408 + return_VOID; 284 409 }
+15
drivers/acpi/acpica/nsinit.c
··· 170 170 goto error_exit; 171 171 } 172 172 173 + /* 174 + * Execute the "global" _INI method that may appear at the root. This 175 + * support is provided for Windows compatibility (Vista+) and is not 176 + * part of the ACPI specification. 177 + */ 178 + info.evaluate_info->prefix_node = acpi_gbl_root_node; 179 + info.evaluate_info->pathname = METHOD_NAME__INI; 180 + info.evaluate_info->parameters = NULL; 181 + info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE; 182 + 183 + status = acpi_ns_evaluate(info.evaluate_info); 184 + if (ACPI_SUCCESS(status)) { 185 + info.num_INI++; 186 + } 187 + 173 188 /* Walk namespace to execute all _INIs on present devices */ 174 189 175 190 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+1 -2
drivers/acpi/acpica/nsload.c
··· 270 270 271 271 /* Now delete the starting object, and we are done */ 272 272 273 - acpi_ns_delete_node(child_handle); 274 - 273 + acpi_ns_remove_node(child_handle); 275 274 return_ACPI_STATUS(AE_OK); 276 275 } 277 276
+392 -374
drivers/acpi/acpica/nspredef.c
··· 42 42 * POSSIBILITY OF SUCH DAMAGES. 43 43 */ 44 44 45 + #define ACPI_CREATE_PREDEFINED_TABLE 46 + 45 47 #include <acpi/acpi.h> 46 48 #include "accommon.h" 47 49 #include "acnamesp.h" ··· 74 72 ******************************************************************************/ 75 73 /* Local prototypes */ 76 74 static acpi_status 77 - acpi_ns_check_package(char *pathname, 78 - union acpi_operand_object **return_object_ptr, 79 - const union acpi_predefined_info *predefined); 75 + acpi_ns_check_package(struct acpi_predefined_data *data, 76 + union acpi_operand_object **return_object_ptr); 80 77 81 78 static acpi_status 82 - acpi_ns_check_package_elements(char *pathname, 79 + acpi_ns_check_package_list(struct acpi_predefined_data *data, 80 + const union acpi_predefined_info *package, 81 + union acpi_operand_object **elements, u32 count); 82 + 83 + static acpi_status 84 + acpi_ns_check_package_elements(struct acpi_predefined_data *data, 83 85 union acpi_operand_object **elements, 84 86 u8 type1, 85 87 u32 count1, 86 88 u8 type2, u32 count2, u32 start_index); 87 89 88 90 static acpi_status 89 - acpi_ns_check_object_type(char *pathname, 91 + acpi_ns_check_object_type(struct acpi_predefined_data *data, 90 92 union acpi_operand_object **return_object_ptr, 91 93 u32 expected_btypes, u32 package_index); 92 94 93 95 static acpi_status 94 - acpi_ns_check_reference(char *pathname, 96 + acpi_ns_check_reference(struct acpi_predefined_data *data, 95 97 union acpi_operand_object *return_object); 96 98 97 - static acpi_status 98 - acpi_ns_repair_object(u32 expected_btypes, 99 - u32 package_index, 100 - union acpi_operand_object **return_object_ptr); 99 + static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes); 101 100 102 101 /* 103 102 * Names for the types that can be returned by the predefined objects. ··· 112 109 "/Reference", 113 110 }; 114 111 115 - #define ACPI_NOT_PACKAGE ACPI_UINT32_MAX 116 - 117 112 /******************************************************************************* 118 113 * 119 114 * FUNCTION: acpi_ns_check_predefined_names 120 115 * 121 116 * PARAMETERS: Node - Namespace node for the method/object 117 + * user_param_count - Number of parameters actually passed 118 + * return_status - Status from the object evaluation 122 119 * return_object_ptr - Pointer to the object returned from the 123 120 * evaluation of a method or object 124 121 * ··· 138 135 acpi_status status = AE_OK; 139 136 const union acpi_predefined_info *predefined; 140 137 char *pathname; 138 + struct acpi_predefined_data *data; 141 139 142 140 /* Match the name for this method/object against the predefined list */ 143 141 144 142 predefined = acpi_ns_check_for_predefined_name(node); 145 143 146 - /* Get the full pathname to the object, for use in error messages */ 144 + /* Get the full pathname to the object, for use in warning messages */ 147 145 148 146 pathname = acpi_ns_get_external_pathname(node); 149 147 if (!pathname) { ··· 162 158 /* If not a predefined name, we cannot validate the return object */ 163 159 164 160 if (!predefined) { 165 - goto exit; 166 - } 167 - 168 - /* If the method failed, we cannot validate the return object */ 169 - 170 - if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { 171 - goto exit; 161 + goto cleanup; 172 162 } 173 163 174 164 /* 175 - * Only validate the return value on the first successful evaluation of 176 - * the method. This ensures that any warnings will only be emitted during 177 - * the very first evaluation of the method/object. 165 + * If the method failed or did not actually return an object, we cannot 166 + * validate the return object 178 167 */ 179 - if (node->flags & ANOBJ_EVALUATED) { 180 - goto exit; 168 + if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { 169 + goto cleanup; 181 170 } 182 - 183 - /* Mark the node as having been successfully evaluated */ 184 - 185 - node->flags |= ANOBJ_EVALUATED; 186 171 187 172 /* 188 173 * If there is no return value, check if we require a return value for ··· 183 190 if (!return_object) { 184 191 if ((predefined->info.expected_btypes) && 185 192 (!(predefined->info.expected_btypes & ACPI_RTYPE_NONE))) { 186 - ACPI_ERROR((AE_INFO, 187 - "%s: Missing expected return value", 188 - pathname)); 193 + ACPI_WARN_PREDEFINED((AE_INFO, pathname, 194 + ACPI_WARN_ALWAYS, 195 + "Missing expected return value")); 189 196 190 197 status = AE_AML_NO_RETURN_VALUE; 191 198 } 192 - goto exit; 199 + goto cleanup; 193 200 } 194 201 195 202 /* 196 - * We have a return value, but if one wasn't expected, just exit, this is 197 - * not a problem 203 + * 1) We have a return value, but if one wasn't expected, just exit, this is 204 + * not a problem. For example, if the "Implicit Return" feature is 205 + * enabled, methods will always return a value. 198 206 * 199 - * For example, if the "Implicit Return" feature is enabled, methods will 200 - * always return a value 207 + * 2) If the return value can be of any type, then we cannot perform any 208 + * validation, exit. 201 209 */ 202 - if (!predefined->info.expected_btypes) { 203 - goto exit; 210 + if ((!predefined->info.expected_btypes) || 211 + (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { 212 + goto cleanup; 204 213 } 214 + 215 + /* Create the parameter data block for object validation */ 216 + 217 + data = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_predefined_data)); 218 + if (!data) { 219 + goto cleanup; 220 + } 221 + data->predefined = predefined; 222 + data->node_flags = node->flags; 223 + data->pathname = pathname; 205 224 206 225 /* 207 226 * Check that the type of the return object is what is expected for 208 227 * this predefined name 209 228 */ 210 - status = acpi_ns_check_object_type(pathname, return_object_ptr, 229 + status = acpi_ns_check_object_type(data, return_object_ptr, 211 230 predefined->info.expected_btypes, 212 - ACPI_NOT_PACKAGE); 231 + ACPI_NOT_PACKAGE_ELEMENT); 213 232 if (ACPI_FAILURE(status)) { 214 - goto exit; 233 + goto check_validation_status; 215 234 } 216 235 217 236 /* For returned Package objects, check the type of all sub-objects */ 218 237 219 238 if (return_object->common.type == ACPI_TYPE_PACKAGE) { 220 - status = 221 - acpi_ns_check_package(pathname, return_object_ptr, 222 - predefined); 239 + status = acpi_ns_check_package(data, return_object_ptr); 223 240 } 224 241 225 - exit: 242 + check_validation_status: 243 + /* 244 + * If the object validation failed or if we successfully repaired one 245 + * or more objects, mark the parent node to suppress further warning 246 + * messages during the next evaluation of the same method/object. 247 + */ 248 + if (ACPI_FAILURE(status) || (data->flags & ACPI_OBJECT_REPAIRED)) { 249 + node->flags |= ANOBJ_EVALUATED; 250 + } 251 + ACPI_FREE(data); 252 + 253 + cleanup: 226 254 ACPI_FREE(pathname); 227 255 return (status); 228 256 } ··· 282 268 param_count = node->object->method.param_count; 283 269 } 284 270 285 - /* Argument count check for non-predefined methods/objects */ 286 - 287 271 if (!predefined) { 288 272 /* 273 + * Check the parameter count for non-predefined methods/objects. 274 + * 289 275 * Warning if too few or too many arguments have been passed by the 290 276 * caller. An incorrect number of arguments may not cause the method 291 277 * to fail. However, the method will fail if there are too few 292 278 * arguments and the method attempts to use one of the missing ones. 293 279 */ 294 280 if (user_param_count < param_count) { 295 - ACPI_WARNING((AE_INFO, 296 - "%s: Insufficient arguments - needs %d, found %d", 297 - pathname, param_count, user_param_count)); 281 + ACPI_WARN_PREDEFINED((AE_INFO, pathname, 282 + ACPI_WARN_ALWAYS, 283 + "Insufficient arguments - needs %u, found %u", 284 + param_count, user_param_count)); 298 285 } else if (user_param_count > param_count) { 299 - ACPI_WARNING((AE_INFO, 300 - "%s: Excess arguments - needs %d, found %d", 301 - pathname, param_count, user_param_count)); 286 + ACPI_WARN_PREDEFINED((AE_INFO, pathname, 287 + ACPI_WARN_ALWAYS, 288 + "Excess arguments - needs %u, found %u", 289 + param_count, user_param_count)); 302 290 } 303 291 return; 304 292 } 305 293 306 - /* Allow two different legal argument counts (_SCP, etc.) */ 307 - 294 + /* 295 + * Validate the user-supplied parameter count. 296 + * Allow two different legal argument counts (_SCP, etc.) 297 + */ 308 298 required_params_current = predefined->info.param_count & 0x0F; 309 299 required_params_old = predefined->info.param_count >> 4; 310 300 311 301 if (user_param_count != ACPI_UINT32_MAX) { 312 - 313 - /* Validate the user-supplied parameter count */ 314 - 315 302 if ((user_param_count != required_params_current) && 316 303 (user_param_count != required_params_old)) { 317 - ACPI_WARNING((AE_INFO, 318 - "%s: Parameter count mismatch - " 319 - "caller passed %d, ACPI requires %d", 320 - pathname, user_param_count, 321 - required_params_current)); 304 + ACPI_WARN_PREDEFINED((AE_INFO, pathname, 305 + ACPI_WARN_ALWAYS, 306 + "Parameter count mismatch - " 307 + "caller passed %u, ACPI requires %u", 308 + user_param_count, 309 + required_params_current)); 322 310 } 323 311 } 324 312 325 313 /* 326 - * Only validate the argument count on the first successful evaluation of 327 - * the method. This ensures that any warnings will only be emitted during 328 - * the very first evaluation of the method/object. 329 - */ 330 - if (node->flags & ANOBJ_EVALUATED) { 331 - return; 332 - } 333 - 334 - /* 335 314 * Check that the ASL-defined parameter count is what is expected for 336 - * this predefined name. 315 + * this predefined name (parameter count as defined by the ACPI 316 + * specification) 337 317 */ 338 318 if ((param_count != required_params_current) && 339 319 (param_count != required_params_old)) { 340 - ACPI_WARNING((AE_INFO, 341 - "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", 342 - pathname, param_count, required_params_current)); 320 + ACPI_WARN_PREDEFINED((AE_INFO, pathname, node->flags, 321 + "Parameter count mismatch - ASL declared %u, ACPI requires %u", 322 + param_count, required_params_current)); 343 323 } 344 324 } 345 325 ··· 366 358 this_name = predefined_names; 367 359 while (this_name->info.name[0]) { 368 360 if (ACPI_COMPARE_NAME(node->name.ascii, this_name->info.name)) { 369 - 370 - /* Return pointer to this table entry */ 371 - 372 361 return (this_name); 373 362 } 374 363 ··· 380 375 this_name++; 381 376 } 382 377 383 - return (NULL); 378 + return (NULL); /* Not found */ 384 379 } 385 380 386 381 /******************************************************************************* 387 382 * 388 383 * FUNCTION: acpi_ns_check_package 389 384 * 390 - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 385 + * PARAMETERS: Data - Pointer to validation data structure 391 386 * return_object_ptr - Pointer to the object returned from the 392 387 * evaluation of a method or object 393 - * Predefined - Pointer to entry in predefined name table 394 388 * 395 389 * RETURN: Status 396 390 * ··· 399 395 ******************************************************************************/ 400 396 401 397 static acpi_status 402 - acpi_ns_check_package(char *pathname, 403 - union acpi_operand_object **return_object_ptr, 404 - const union acpi_predefined_info *predefined) 398 + acpi_ns_check_package(struct acpi_predefined_data *data, 399 + union acpi_operand_object **return_object_ptr) 405 400 { 406 401 union acpi_operand_object *return_object = *return_object_ptr; 407 402 const union acpi_predefined_info *package; 408 - union acpi_operand_object *sub_package; 409 403 union acpi_operand_object **elements; 410 - union acpi_operand_object **sub_elements; 411 - acpi_status status; 404 + acpi_status status = AE_OK; 412 405 u32 expected_count; 413 406 u32 count; 414 407 u32 i; 415 - u32 j; 416 408 417 409 ACPI_FUNCTION_NAME(ns_check_package); 418 410 419 411 /* The package info for this name is in the next table entry */ 420 412 421 - package = predefined + 1; 413 + package = data->predefined + 1; 422 414 423 415 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 424 416 "%s Validating return Package of Type %X, Count %X\n", 425 - pathname, package->ret_info.type, 417 + data->pathname, package->ret_info.type, 426 418 return_object->package.count)); 427 419 428 420 /* Extract package count and elements array */ ··· 429 429 /* The package must have at least one element, else invalid */ 430 430 431 431 if (!count) { 432 - ACPI_WARNING((AE_INFO, 433 - "%s: Return Package has no elements (empty)", 434 - pathname)); 432 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 433 + "Return Package has no elements (empty)")); 435 434 436 435 return (AE_AML_OPERAND_VALUE); 437 436 } ··· 455 456 if (count < expected_count) { 456 457 goto package_too_small; 457 458 } else if (count > expected_count) { 458 - ACPI_WARNING((AE_INFO, 459 - "%s: Return Package is larger than needed - " 460 - "found %u, expected %u", pathname, count, 461 - expected_count)); 459 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 460 + data->node_flags, 461 + "Return Package is larger than needed - " 462 + "found %u, expected %u", count, 463 + expected_count)); 462 464 } 463 465 464 466 /* Validate all elements of the returned package */ 465 467 466 - status = acpi_ns_check_package_elements(pathname, elements, 468 + status = acpi_ns_check_package_elements(data, elements, 467 469 package->ret_info. 468 470 object_type1, 469 471 package->ret_info. ··· 473 473 object_type2, 474 474 package->ret_info. 475 475 count2, 0); 476 - if (ACPI_FAILURE(status)) { 477 - return (status); 478 - } 479 476 break; 480 477 481 478 case ACPI_PTYPE1_VAR: ··· 482 485 * elements must be of the same type 483 486 */ 484 487 for (i = 0; i < count; i++) { 485 - status = acpi_ns_check_object_type(pathname, elements, 488 + status = acpi_ns_check_object_type(data, elements, 486 489 package->ret_info. 487 490 object_type1, i); 488 491 if (ACPI_FAILURE(status)) { ··· 514 517 /* These are the required package elements (0, 1, or 2) */ 515 518 516 519 status = 517 - acpi_ns_check_object_type(pathname, 518 - elements, 520 + acpi_ns_check_object_type(data, elements, 519 521 package-> 520 522 ret_info3. 521 523 object_type[i], ··· 526 530 /* These are the optional package elements */ 527 531 528 532 status = 529 - acpi_ns_check_object_type(pathname, 530 - elements, 533 + acpi_ns_check_object_type(data, elements, 531 534 package-> 532 535 ret_info3. 533 536 tail_object_type, ··· 539 544 } 540 545 break; 541 546 547 + case ACPI_PTYPE2_REV_FIXED: 548 + 549 + /* First element is the (Integer) revision */ 550 + 551 + status = acpi_ns_check_object_type(data, elements, 552 + ACPI_RTYPE_INTEGER, 0); 553 + if (ACPI_FAILURE(status)) { 554 + return (status); 555 + } 556 + 557 + elements++; 558 + count--; 559 + 560 + /* Examine the sub-packages */ 561 + 562 + status = 563 + acpi_ns_check_package_list(data, package, elements, count); 564 + break; 565 + 542 566 case ACPI_PTYPE2_PKG_COUNT: 543 567 544 568 /* First element is the (Integer) count of sub-packages to follow */ 545 569 546 - status = acpi_ns_check_object_type(pathname, elements, 570 + status = acpi_ns_check_object_type(data, elements, 547 571 ACPI_RTYPE_INTEGER, 0); 548 572 if (ACPI_FAILURE(status)) { 549 573 return (status); ··· 580 566 count = expected_count; 581 567 elements++; 582 568 583 - /* Now we can walk the sub-packages */ 569 + /* Examine the sub-packages */ 584 570 585 - /*lint -fallthrough */ 571 + status = 572 + acpi_ns_check_package_list(data, package, elements, count); 573 + break; 586 574 587 575 case ACPI_PTYPE2: 588 576 case ACPI_PTYPE2_FIXED: ··· 592 576 case ACPI_PTYPE2_COUNT: 593 577 594 578 /* 595 - * These types all return a single package that consists of a variable 596 - * number of sub-packages 579 + * These types all return a single Package that consists of a 580 + * variable number of sub-Packages. 581 + * 582 + * First, ensure that the first element is a sub-Package. If not, 583 + * the BIOS may have incorrectly returned the object as a single 584 + * package instead of a Package of Packages (a common error if 585 + * there is only one entry). We may be able to repair this by 586 + * wrapping the returned Package with a new outer Package. 597 587 */ 598 - for (i = 0; i < count; i++) { 599 - sub_package = *elements; 600 - sub_elements = sub_package->package.elements; 588 + if ((*elements)->common.type != ACPI_TYPE_PACKAGE) { 601 589 602 - /* Each sub-object must be of type Package */ 590 + /* Create the new outer package and populate it */ 603 591 604 592 status = 605 - acpi_ns_check_object_type(pathname, &sub_package, 606 - ACPI_RTYPE_PACKAGE, i); 593 + acpi_ns_repair_package_list(data, 594 + return_object_ptr); 607 595 if (ACPI_FAILURE(status)) { 608 596 return (status); 609 597 } 610 598 611 - /* Examine the different types of sub-packages */ 599 + /* Update locals to point to the new package (of 1 element) */ 612 600 613 - switch (package->ret_info.type) { 614 - case ACPI_PTYPE2: 615 - case ACPI_PTYPE2_PKG_COUNT: 616 - 617 - /* Each subpackage has a fixed number of elements */ 618 - 619 - expected_count = 620 - package->ret_info.count1 + 621 - package->ret_info.count2; 622 - if (sub_package->package.count != 623 - expected_count) { 624 - count = sub_package->package.count; 625 - goto package_too_small; 626 - } 627 - 628 - status = 629 - acpi_ns_check_package_elements(pathname, 630 - sub_elements, 631 - package-> 632 - ret_info. 633 - object_type1, 634 - package-> 635 - ret_info. 636 - count1, 637 - package-> 638 - ret_info. 639 - object_type2, 640 - package-> 641 - ret_info. 642 - count2, 0); 643 - if (ACPI_FAILURE(status)) { 644 - return (status); 645 - } 646 - break; 647 - 648 - case ACPI_PTYPE2_FIXED: 649 - 650 - /* Each sub-package has a fixed length */ 651 - 652 - expected_count = package->ret_info2.count; 653 - if (sub_package->package.count < expected_count) { 654 - count = sub_package->package.count; 655 - goto package_too_small; 656 - } 657 - 658 - /* Check the type of each sub-package element */ 659 - 660 - for (j = 0; j < expected_count; j++) { 661 - status = 662 - acpi_ns_check_object_type(pathname, 663 - &sub_elements[j], 664 - package->ret_info2.object_type[j], j); 665 - if (ACPI_FAILURE(status)) { 666 - return (status); 667 - } 668 - } 669 - break; 670 - 671 - case ACPI_PTYPE2_MIN: 672 - 673 - /* Each sub-package has a variable but minimum length */ 674 - 675 - expected_count = package->ret_info.count1; 676 - if (sub_package->package.count < expected_count) { 677 - count = sub_package->package.count; 678 - goto package_too_small; 679 - } 680 - 681 - /* Check the type of each sub-package element */ 682 - 683 - status = 684 - acpi_ns_check_package_elements(pathname, 685 - sub_elements, 686 - package-> 687 - ret_info. 688 - object_type1, 689 - sub_package-> 690 - package. 691 - count, 0, 0, 692 - 0); 693 - if (ACPI_FAILURE(status)) { 694 - return (status); 695 - } 696 - break; 697 - 698 - case ACPI_PTYPE2_COUNT: 699 - 700 - /* First element is the (Integer) count of elements to follow */ 701 - 702 - status = 703 - acpi_ns_check_object_type(pathname, 704 - sub_elements, 705 - ACPI_RTYPE_INTEGER, 706 - 0); 707 - if (ACPI_FAILURE(status)) { 708 - return (status); 709 - } 710 - 711 - /* Make sure package is large enough for the Count */ 712 - 713 - expected_count = 714 - (u32) (*sub_elements)->integer.value; 715 - if (sub_package->package.count < expected_count) { 716 - count = sub_package->package.count; 717 - goto package_too_small; 718 - } 719 - 720 - /* Check the type of each sub-package element */ 721 - 722 - status = 723 - acpi_ns_check_package_elements(pathname, 724 - (sub_elements 725 - + 1), 726 - package-> 727 - ret_info. 728 - object_type1, 729 - (expected_count 730 - - 1), 0, 0, 731 - 1); 732 - if (ACPI_FAILURE(status)) { 733 - return (status); 734 - } 735 - break; 736 - 737 - default: 738 - break; 739 - } 740 - 741 - elements++; 601 + return_object = *return_object_ptr; 602 + elements = return_object->package.elements; 603 + count = 1; 742 604 } 605 + 606 + /* Examine the sub-packages */ 607 + 608 + status = 609 + acpi_ns_check_package_list(data, package, elements, count); 743 610 break; 744 611 745 612 default: 746 613 747 614 /* Should not get here if predefined info table is correct */ 748 615 749 - ACPI_WARNING((AE_INFO, 750 - "%s: Invalid internal return type in table entry: %X", 751 - pathname, package->ret_info.type)); 616 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 617 + "Invalid internal return type in table entry: %X", 618 + package->ret_info.type)); 752 619 753 620 return (AE_AML_INTERNAL); 754 621 } 755 622 756 - return (AE_OK); 623 + return (status); 757 624 758 - package_too_small: 625 + package_too_small: 759 626 760 627 /* Error exit for the case with an incorrect package count */ 761 628 762 - ACPI_WARNING((AE_INFO, "%s: Return Package is too small - " 763 - "found %u, expected %u", pathname, count, 764 - expected_count)); 629 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 630 + "Return Package is too small - found %u elements, expected %u", 631 + count, expected_count)); 632 + 633 + return (AE_AML_OPERAND_VALUE); 634 + } 635 + 636 + /******************************************************************************* 637 + * 638 + * FUNCTION: acpi_ns_check_package_list 639 + * 640 + * PARAMETERS: Data - Pointer to validation data structure 641 + * Package - Pointer to package-specific info for method 642 + * Elements - Element list of parent package. All elements 643 + * of this list should be of type Package. 644 + * Count - Count of subpackages 645 + * 646 + * RETURN: Status 647 + * 648 + * DESCRIPTION: Examine a list of subpackages 649 + * 650 + ******************************************************************************/ 651 + 652 + static acpi_status 653 + acpi_ns_check_package_list(struct acpi_predefined_data *data, 654 + const union acpi_predefined_info *package, 655 + union acpi_operand_object **elements, u32 count) 656 + { 657 + union acpi_operand_object *sub_package; 658 + union acpi_operand_object **sub_elements; 659 + acpi_status status; 660 + u32 expected_count; 661 + u32 i; 662 + u32 j; 663 + 664 + /* Validate each sub-Package in the parent Package */ 665 + 666 + for (i = 0; i < count; i++) { 667 + sub_package = *elements; 668 + sub_elements = sub_package->package.elements; 669 + 670 + /* Each sub-object must be of type Package */ 671 + 672 + status = acpi_ns_check_object_type(data, &sub_package, 673 + ACPI_RTYPE_PACKAGE, i); 674 + if (ACPI_FAILURE(status)) { 675 + return (status); 676 + } 677 + 678 + /* Examine the different types of expected sub-packages */ 679 + 680 + switch (package->ret_info.type) { 681 + case ACPI_PTYPE2: 682 + case ACPI_PTYPE2_PKG_COUNT: 683 + case ACPI_PTYPE2_REV_FIXED: 684 + 685 + /* Each subpackage has a fixed number of elements */ 686 + 687 + expected_count = 688 + package->ret_info.count1 + package->ret_info.count2; 689 + if (sub_package->package.count < expected_count) { 690 + goto package_too_small; 691 + } 692 + 693 + status = 694 + acpi_ns_check_package_elements(data, sub_elements, 695 + package->ret_info. 696 + object_type1, 697 + package->ret_info. 698 + count1, 699 + package->ret_info. 700 + object_type2, 701 + package->ret_info. 702 + count2, 0); 703 + if (ACPI_FAILURE(status)) { 704 + return (status); 705 + } 706 + break; 707 + 708 + case ACPI_PTYPE2_FIXED: 709 + 710 + /* Each sub-package has a fixed length */ 711 + 712 + expected_count = package->ret_info2.count; 713 + if (sub_package->package.count < expected_count) { 714 + goto package_too_small; 715 + } 716 + 717 + /* Check the type of each sub-package element */ 718 + 719 + for (j = 0; j < expected_count; j++) { 720 + status = 721 + acpi_ns_check_object_type(data, 722 + &sub_elements[j], 723 + package-> 724 + ret_info2. 725 + object_type[j], 726 + j); 727 + if (ACPI_FAILURE(status)) { 728 + return (status); 729 + } 730 + } 731 + break; 732 + 733 + case ACPI_PTYPE2_MIN: 734 + 735 + /* Each sub-package has a variable but minimum length */ 736 + 737 + expected_count = package->ret_info.count1; 738 + if (sub_package->package.count < expected_count) { 739 + goto package_too_small; 740 + } 741 + 742 + /* Check the type of each sub-package element */ 743 + 744 + status = 745 + acpi_ns_check_package_elements(data, sub_elements, 746 + package->ret_info. 747 + object_type1, 748 + sub_package->package. 749 + count, 0, 0, 0); 750 + if (ACPI_FAILURE(status)) { 751 + return (status); 752 + } 753 + break; 754 + 755 + case ACPI_PTYPE2_COUNT: 756 + 757 + /* 758 + * First element is the (Integer) count of elements, including 759 + * the count field. 760 + */ 761 + status = acpi_ns_check_object_type(data, sub_elements, 762 + ACPI_RTYPE_INTEGER, 763 + 0); 764 + if (ACPI_FAILURE(status)) { 765 + return (status); 766 + } 767 + 768 + /* 769 + * Make sure package is large enough for the Count and is 770 + * is as large as the minimum size 771 + */ 772 + expected_count = (u32)(*sub_elements)->integer.value; 773 + if (sub_package->package.count < expected_count) { 774 + goto package_too_small; 775 + } 776 + if (sub_package->package.count < 777 + package->ret_info.count1) { 778 + expected_count = package->ret_info.count1; 779 + goto package_too_small; 780 + } 781 + 782 + /* Check the type of each sub-package element */ 783 + 784 + status = 785 + acpi_ns_check_package_elements(data, 786 + (sub_elements + 1), 787 + package->ret_info. 788 + object_type1, 789 + (expected_count - 1), 790 + 0, 0, 1); 791 + if (ACPI_FAILURE(status)) { 792 + return (status); 793 + } 794 + break; 795 + 796 + default: /* Should not get here, type was validated by caller */ 797 + 798 + return (AE_AML_INTERNAL); 799 + } 800 + 801 + elements++; 802 + } 803 + 804 + return (AE_OK); 805 + 806 + package_too_small: 807 + 808 + /* The sub-package count was smaller than required */ 809 + 810 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 811 + "Return Sub-Package[%u] is too small - found %u elements, expected %u", 812 + i, sub_package->package.count, expected_count)); 765 813 766 814 return (AE_AML_OPERAND_VALUE); 767 815 } ··· 834 754 * 835 755 * FUNCTION: acpi_ns_check_package_elements 836 756 * 837 - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 757 + * PARAMETERS: Data - Pointer to validation data structure 838 758 * Elements - Pointer to the package elements array 839 759 * Type1 - Object type for first group 840 760 * Count1 - Count for first group ··· 850 770 ******************************************************************************/ 851 771 852 772 static acpi_status 853 - acpi_ns_check_package_elements(char *pathname, 773 + acpi_ns_check_package_elements(struct acpi_predefined_data *data, 854 774 union acpi_operand_object **elements, 855 775 u8 type1, 856 776 u32 count1, ··· 866 786 * The second group can have a count of zero. 867 787 */ 868 788 for (i = 0; i < count1; i++) { 869 - status = acpi_ns_check_object_type(pathname, this_element, 789 + status = acpi_ns_check_object_type(data, this_element, 870 790 type1, i + start_index); 871 791 if (ACPI_FAILURE(status)) { 872 792 return (status); ··· 875 795 } 876 796 877 797 for (i = 0; i < count2; i++) { 878 - status = acpi_ns_check_object_type(pathname, this_element, 798 + status = acpi_ns_check_object_type(data, this_element, 879 799 type2, 880 800 (i + count1 + start_index)); 881 801 if (ACPI_FAILURE(status)) { ··· 891 811 * 892 812 * FUNCTION: acpi_ns_check_object_type 893 813 * 894 - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 814 + * PARAMETERS: Data - Pointer to validation data structure 895 815 * return_object_ptr - Pointer to the object returned from the 896 816 * evaluation of a method or object 897 817 * expected_btypes - Bitmap of expected return type(s) 898 818 * package_index - Index of object within parent package (if 899 - * applicable - ACPI_NOT_PACKAGE otherwise) 819 + * applicable - ACPI_NOT_PACKAGE_ELEMENT 820 + * otherwise) 900 821 * 901 822 * RETURN: Status 902 823 * ··· 907 826 ******************************************************************************/ 908 827 909 828 static acpi_status 910 - acpi_ns_check_object_type(char *pathname, 829 + acpi_ns_check_object_type(struct acpi_predefined_data *data, 911 830 union acpi_operand_object **return_object_ptr, 912 831 u32 expected_btypes, u32 package_index) 913 832 { ··· 915 834 acpi_status status = AE_OK; 916 835 u32 return_btype; 917 836 char type_buffer[48]; /* Room for 5 types */ 918 - u32 this_rtype; 919 - u32 i; 920 - u32 j; 921 837 922 838 /* 923 839 * If we get a NULL return_object here, it is a NULL package element, ··· 927 849 /* A Namespace node should not get here, but make sure */ 928 850 929 851 if (ACPI_GET_DESCRIPTOR_TYPE(return_object) == ACPI_DESC_TYPE_NAMED) { 930 - ACPI_WARNING((AE_INFO, 931 - "%s: Invalid return type - Found a Namespace node [%4.4s] type %s", 932 - pathname, return_object->node.name.ascii, 933 - acpi_ut_get_type_name(return_object->node.type))); 852 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 853 + "Invalid return type - Found a Namespace node [%4.4s] type %s", 854 + return_object->node.name.ascii, 855 + acpi_ut_get_type_name(return_object->node. 856 + type))); 934 857 return (AE_AML_OPERAND_TYPE); 935 858 } 936 859 ··· 976 897 977 898 /* Type mismatch -- attempt repair of the returned object */ 978 899 979 - status = acpi_ns_repair_object(expected_btypes, package_index, 900 + status = acpi_ns_repair_object(data, expected_btypes, 901 + package_index, 980 902 return_object_ptr); 981 903 if (ACPI_SUCCESS(status)) { 982 - return (status); 904 + return (AE_OK); /* Repair was successful */ 983 905 } 984 906 goto type_error_exit; 985 907 } ··· 988 908 /* For reference objects, check that the reference type is correct */ 989 909 990 910 if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { 991 - status = acpi_ns_check_reference(pathname, return_object); 911 + status = acpi_ns_check_reference(data, return_object); 992 912 } 993 913 994 914 return (status); ··· 997 917 998 918 /* Create a string with all expected types for this predefined object */ 999 919 1000 - j = 1; 1001 - type_buffer[0] = 0; 1002 - this_rtype = ACPI_RTYPE_INTEGER; 920 + acpi_ns_get_expected_types(type_buffer, expected_btypes); 1003 921 1004 - for (i = 0; i < ACPI_NUM_RTYPES; i++) { 1005 - 1006 - /* If one of the expected types, concatenate the name of this type */ 1007 - 1008 - if (expected_btypes & this_rtype) { 1009 - ACPI_STRCAT(type_buffer, &acpi_rtype_names[i][j]); 1010 - j = 0; /* Use name separator from now on */ 1011 - } 1012 - this_rtype <<= 1; /* Next Rtype */ 1013 - } 1014 - 1015 - if (package_index == ACPI_NOT_PACKAGE) { 1016 - ACPI_WARNING((AE_INFO, 1017 - "%s: Return type mismatch - found %s, expected %s", 1018 - pathname, 1019 - acpi_ut_get_object_type_name(return_object), 1020 - type_buffer)); 922 + if (package_index == ACPI_NOT_PACKAGE_ELEMENT) { 923 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 924 + "Return type mismatch - found %s, expected %s", 925 + acpi_ut_get_object_type_name 926 + (return_object), type_buffer)); 1021 927 } else { 1022 - ACPI_WARNING((AE_INFO, 1023 - "%s: Return Package type mismatch at index %u - " 1024 - "found %s, expected %s", pathname, package_index, 1025 - acpi_ut_get_object_type_name(return_object), 1026 - type_buffer)); 928 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 929 + "Return Package type mismatch at index %u - " 930 + "found %s, expected %s", package_index, 931 + acpi_ut_get_object_type_name 932 + (return_object), type_buffer)); 1027 933 } 1028 934 1029 935 return (AE_AML_OPERAND_TYPE); ··· 1019 953 * 1020 954 * FUNCTION: acpi_ns_check_reference 1021 955 * 1022 - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 956 + * PARAMETERS: Data - Pointer to validation data structure 1023 957 * return_object - Object returned from the evaluation of a 1024 958 * method or object 1025 959 * ··· 1032 966 ******************************************************************************/ 1033 967 1034 968 static acpi_status 1035 - acpi_ns_check_reference(char *pathname, 969 + acpi_ns_check_reference(struct acpi_predefined_data *data, 1036 970 union acpi_operand_object *return_object) 1037 971 { 1038 972 ··· 1045 979 return (AE_OK); 1046 980 } 1047 981 1048 - ACPI_WARNING((AE_INFO, 1049 - "%s: Return type mismatch - " 1050 - "unexpected reference object type [%s] %2.2X", 1051 - pathname, acpi_ut_get_reference_name(return_object), 1052 - return_object->reference.class)); 982 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 983 + "Return type mismatch - unexpected reference object type [%s] %2.2X", 984 + acpi_ut_get_reference_name(return_object), 985 + return_object->reference.class)); 1053 986 1054 987 return (AE_AML_OPERAND_TYPE); 1055 988 } 1056 989 1057 990 /******************************************************************************* 1058 991 * 1059 - * FUNCTION: acpi_ns_repair_object 992 + * FUNCTION: acpi_ns_get_expected_types 1060 993 * 1061 - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) 1062 - * package_index - Used to determine if target is in a package 1063 - * return_object_ptr - Pointer to the object returned from the 1064 - * evaluation of a method or object 994 + * PARAMETERS: Buffer - Pointer to where the string is returned 995 + * expected_btypes - Bitmap of expected return type(s) 1065 996 * 1066 - * RETURN: Status. AE_OK if repair was successful. 997 + * RETURN: Buffer is populated with type names. 1067 998 * 1068 - * DESCRIPTION: Attempt to repair/convert a return object of a type that was 1069 - * not expected. 999 + * DESCRIPTION: Translate the expected types bitmap into a string of ascii 1000 + * names of expected types, for use in warning messages. 1070 1001 * 1071 1002 ******************************************************************************/ 1072 1003 1073 - static acpi_status 1074 - acpi_ns_repair_object(u32 expected_btypes, 1075 - u32 package_index, 1076 - union acpi_operand_object **return_object_ptr) 1004 + static void acpi_ns_get_expected_types(char *buffer, u32 expected_btypes) 1077 1005 { 1078 - union acpi_operand_object *return_object = *return_object_ptr; 1079 - union acpi_operand_object *new_object; 1080 - acpi_size length; 1006 + u32 this_rtype; 1007 + u32 i; 1008 + u32 j; 1081 1009 1082 - switch (return_object->common.type) { 1083 - case ACPI_TYPE_BUFFER: 1010 + j = 1; 1011 + buffer[0] = 0; 1012 + this_rtype = ACPI_RTYPE_INTEGER; 1084 1013 1085 - if (!(expected_btypes & ACPI_RTYPE_STRING)) { 1086 - return (AE_AML_OPERAND_TYPE); 1014 + for (i = 0; i < ACPI_NUM_RTYPES; i++) { 1015 + 1016 + /* If one of the expected types, concatenate the name of this type */ 1017 + 1018 + if (expected_btypes & this_rtype) { 1019 + ACPI_STRCAT(buffer, &acpi_rtype_names[i][j]); 1020 + j = 0; /* Use name separator from now on */ 1087 1021 } 1088 - 1089 - /* 1090 - * Have a Buffer, expected a String, convert. Use a to_string 1091 - * conversion, no transform performed on the buffer data. The best 1092 - * example of this is the _BIF method, where the string data from 1093 - * the battery is often (incorrectly) returned as buffer object(s). 1094 - */ 1095 - length = 0; 1096 - while ((length < return_object->buffer.length) && 1097 - (return_object->buffer.pointer[length])) { 1098 - length++; 1099 - } 1100 - 1101 - /* Allocate a new string object */ 1102 - 1103 - new_object = acpi_ut_create_string_object(length); 1104 - if (!new_object) { 1105 - return (AE_NO_MEMORY); 1106 - } 1107 - 1108 - /* 1109 - * Copy the raw buffer data with no transform. String is already NULL 1110 - * terminated at Length+1. 1111 - */ 1112 - ACPI_MEMCPY(new_object->string.pointer, 1113 - return_object->buffer.pointer, length); 1114 - 1115 - /* Install the new return object */ 1116 - 1117 - acpi_ut_remove_reference(return_object); 1118 - *return_object_ptr = new_object; 1119 - 1120 - /* 1121 - * If the object is a package element, we need to: 1122 - * 1. Decrement the reference count of the orignal object, it was 1123 - * incremented when building the package 1124 - * 2. Increment the reference count of the new object, it will be 1125 - * decremented when releasing the package 1126 - */ 1127 - if (package_index != ACPI_NOT_PACKAGE) { 1128 - acpi_ut_remove_reference(return_object); 1129 - acpi_ut_add_reference(new_object); 1130 - } 1131 - return (AE_OK); 1132 - 1133 - default: 1134 - break; 1022 + this_rtype <<= 1; /* Next Rtype */ 1135 1023 } 1136 - 1137 - return (AE_AML_OPERAND_TYPE); 1138 1024 }
+203
drivers/acpi/acpica/nsrepair.c
··· 1 + /****************************************************************************** 2 + * 3 + * Module Name: nsrepair - Repair for objects returned by predefined methods 4 + * 5 + *****************************************************************************/ 6 + 7 + /* 8 + * Copyright (C) 2000 - 2009, Intel Corp. 9 + * All rights reserved. 10 + * 11 + * Redistribution and use in source and binary forms, with or without 12 + * modification, are permitted provided that the following conditions 13 + * are met: 14 + * 1. Redistributions of source code must retain the above copyright 15 + * notice, this list of conditions, and the following disclaimer, 16 + * without modification. 17 + * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 + * substantially similar to the "NO WARRANTY" disclaimer below 19 + * ("Disclaimer") and any redistribution must be conditioned upon 20 + * including a substantially similar Disclaimer requirement for further 21 + * binary redistribution. 22 + * 3. Neither the names of the above-listed copyright holders nor the names 23 + * of any contributors may be used to endorse or promote products derived 24 + * from this software without specific prior written permission. 25 + * 26 + * Alternatively, this software may be distributed under the terms of the 27 + * GNU General Public License ("GPL") version 2 as published by the Free 28 + * Software Foundation. 29 + * 30 + * NO WARRANTY 31 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 + * POSSIBILITY OF SUCH DAMAGES. 42 + */ 43 + 44 + #include <acpi/acpi.h> 45 + #include "accommon.h" 46 + #include "acnamesp.h" 47 + #include "acpredef.h" 48 + 49 + #define _COMPONENT ACPI_NAMESPACE 50 + ACPI_MODULE_NAME("nsrepair") 51 + 52 + /******************************************************************************* 53 + * 54 + * FUNCTION: acpi_ns_repair_object 55 + * 56 + * PARAMETERS: Data - Pointer to validation data structure 57 + * expected_btypes - Object types expected 58 + * package_index - Index of object within parent package (if 59 + * applicable - ACPI_NOT_PACKAGE_ELEMENT 60 + * otherwise) 61 + * return_object_ptr - Pointer to the object returned from the 62 + * evaluation of a method or object 63 + * 64 + * RETURN: Status. AE_OK if repair was successful. 65 + * 66 + * DESCRIPTION: Attempt to repair/convert a return object of a type that was 67 + * not expected. 68 + * 69 + ******************************************************************************/ 70 + acpi_status 71 + acpi_ns_repair_object(struct acpi_predefined_data *data, 72 + u32 expected_btypes, 73 + u32 package_index, 74 + union acpi_operand_object **return_object_ptr) 75 + { 76 + union acpi_operand_object *return_object = *return_object_ptr; 77 + union acpi_operand_object *new_object; 78 + acpi_size length; 79 + 80 + switch (return_object->common.type) { 81 + case ACPI_TYPE_BUFFER: 82 + 83 + /* Does the method/object legally return a string? */ 84 + 85 + if (!(expected_btypes & ACPI_RTYPE_STRING)) { 86 + return (AE_AML_OPERAND_TYPE); 87 + } 88 + 89 + /* 90 + * Have a Buffer, expected a String, convert. Use a to_string 91 + * conversion, no transform performed on the buffer data. The best 92 + * example of this is the _BIF method, where the string data from 93 + * the battery is often (incorrectly) returned as buffer object(s). 94 + */ 95 + length = 0; 96 + while ((length < return_object->buffer.length) && 97 + (return_object->buffer.pointer[length])) { 98 + length++; 99 + } 100 + 101 + /* Allocate a new string object */ 102 + 103 + new_object = acpi_ut_create_string_object(length); 104 + if (!new_object) { 105 + return (AE_NO_MEMORY); 106 + } 107 + 108 + /* 109 + * Copy the raw buffer data with no transform. String is already NULL 110 + * terminated at Length+1. 111 + */ 112 + ACPI_MEMCPY(new_object->string.pointer, 113 + return_object->buffer.pointer, length); 114 + 115 + /* 116 + * If the original object is a package element, we need to: 117 + * 1. Set the reference count of the new object to match the 118 + * reference count of the old object. 119 + * 2. Decrement the reference count of the original object. 120 + */ 121 + if (package_index != ACPI_NOT_PACKAGE_ELEMENT) { 122 + new_object->common.reference_count = 123 + return_object->common.reference_count; 124 + 125 + if (return_object->common.reference_count > 1) { 126 + return_object->common.reference_count--; 127 + } 128 + 129 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 130 + data->node_flags, 131 + "Converted Buffer to expected String at index %u", 132 + package_index)); 133 + } else { 134 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, 135 + data->node_flags, 136 + "Converted Buffer to expected String")); 137 + } 138 + 139 + /* Delete old object, install the new return object */ 140 + 141 + acpi_ut_remove_reference(return_object); 142 + *return_object_ptr = new_object; 143 + data->flags |= ACPI_OBJECT_REPAIRED; 144 + return (AE_OK); 145 + 146 + default: 147 + break; 148 + } 149 + 150 + return (AE_AML_OPERAND_TYPE); 151 + } 152 + 153 + /******************************************************************************* 154 + * 155 + * FUNCTION: acpi_ns_repair_package_list 156 + * 157 + * PARAMETERS: Data - Pointer to validation data structure 158 + * obj_desc_ptr - Pointer to the object to repair. The new 159 + * package object is returned here, 160 + * overwriting the old object. 161 + * 162 + * RETURN: Status, new object in *obj_desc_ptr 163 + * 164 + * DESCRIPTION: Repair a common problem with objects that are defined to return 165 + * a variable-length Package of Packages. If the variable-length 166 + * is one, some BIOS code mistakenly simply declares a single 167 + * Package instead of a Package with one sub-Package. This 168 + * function attempts to repair this error by wrapping a Package 169 + * object around the original Package, creating the correct 170 + * Package with one sub-Package. 171 + * 172 + * Names that can be repaired in this manner include: 173 + * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS 174 + * 175 + ******************************************************************************/ 176 + 177 + acpi_status 178 + acpi_ns_repair_package_list(struct acpi_predefined_data *data, 179 + union acpi_operand_object **obj_desc_ptr) 180 + { 181 + union acpi_operand_object *pkg_obj_desc; 182 + 183 + /* 184 + * Create the new outer package and populate it. The new package will 185 + * have a single element, the lone subpackage. 186 + */ 187 + pkg_obj_desc = acpi_ut_create_package_object(1); 188 + if (!pkg_obj_desc) { 189 + return (AE_NO_MEMORY); 190 + } 191 + 192 + pkg_obj_desc->package.elements[0] = *obj_desc_ptr; 193 + 194 + /* Return the new object in the object pointer */ 195 + 196 + *obj_desc_ptr = pkg_obj_desc; 197 + data->flags |= ACPI_OBJECT_REPAIRED; 198 + 199 + ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, 200 + "Incorrectly formed Package, attempting repair")); 201 + 202 + return (AE_OK); 203 + }
+3 -2
drivers/acpi/acpica/nsutils.c
··· 88 88 89 89 /* There is a non-ascii character in the name */ 90 90 91 - ACPI_MOVE_32_TO_32(&bad_name, internal_name); 91 + ACPI_MOVE_32_TO_32(&bad_name, 92 + ACPI_CAST_PTR(u32, internal_name)); 92 93 acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); 93 94 } else { 94 95 /* Convert path to external format */ ··· 837 836 acpi_status status; 838 837 char *internal_path; 839 838 840 - ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); 839 + ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname)); 841 840 842 841 if (!pathname) { 843 842 *return_node = prefix_node;
+13 -10
drivers/acpi/acpica/nsxfeval.c
··· 535 535 acpi_status status; 536 536 struct acpi_namespace_node *node; 537 537 u32 flags; 538 - struct acpica_device_id hid; 539 - struct acpi_compatible_id_list *cid; 538 + struct acpica_device_id *hid; 539 + struct acpica_device_id_list *cid; 540 540 u32 i; 541 - int found; 541 + u8 found; 542 + int no_match; 542 543 543 544 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 544 545 if (ACPI_FAILURE(status)) { ··· 583 582 return (AE_CTRL_DEPTH); 584 583 } 585 584 586 - if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { 585 + no_match = ACPI_STRCMP(hid->string, info->hid); 586 + ACPI_FREE(hid); 587 587 588 - /* Get the list of Compatible IDs */ 589 - 588 + if (no_match) { 589 + /* 590 + * HID does not match, attempt match within the 591 + * list of Compatible IDs (CIDs) 592 + */ 590 593 status = acpi_ut_execute_CID(node, &cid); 591 594 if (status == AE_NOT_FOUND) { 592 595 return (AE_OK); ··· 602 597 603 598 found = 0; 604 599 for (i = 0; i < cid->count; i++) { 605 - if (ACPI_STRNCMP(cid->id[i].value, info->hid, 606 - sizeof(struct 607 - acpi_compatible_id)) == 608 - 0) { 600 + if (ACPI_STRCMP(cid->ids[i].string, info->hid) 601 + == 0) { 609 602 found = 1; 610 603 break; 611 604 }
+182 -55
drivers/acpi/acpica/nsxfname.c
··· 51 51 #define _COMPONENT ACPI_NAMESPACE 52 52 ACPI_MODULE_NAME("nsxfname") 53 53 54 + /* Local prototypes */ 55 + static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, 56 + struct acpica_device_id *source, 57 + char *string_area); 58 + 54 59 /****************************************************************************** 55 60 * 56 61 * FUNCTION: acpi_get_handle ··· 73 68 * namespace handle. 74 69 * 75 70 ******************************************************************************/ 71 + 76 72 acpi_status 77 73 acpi_get_handle(acpi_handle parent, 78 74 acpi_string pathname, acpi_handle * ret_handle) ··· 216 210 217 211 /****************************************************************************** 218 212 * 213 + * FUNCTION: acpi_ns_copy_device_id 214 + * 215 + * PARAMETERS: Dest - Pointer to the destination DEVICE_ID 216 + * Source - Pointer to the source DEVICE_ID 217 + * string_area - Pointer to where to copy the dest string 218 + * 219 + * RETURN: Pointer to the next string area 220 + * 221 + * DESCRIPTION: Copy a single DEVICE_ID, including the string data. 222 + * 223 + ******************************************************************************/ 224 + static char *acpi_ns_copy_device_id(struct acpica_device_id *dest, 225 + struct acpica_device_id *source, 226 + char *string_area) 227 + { 228 + /* Create the destination DEVICE_ID */ 229 + 230 + dest->string = string_area; 231 + dest->length = source->length; 232 + 233 + /* Copy actual string and return a pointer to the next string area */ 234 + 235 + ACPI_MEMCPY(string_area, source->string, source->length); 236 + return (string_area + source->length); 237 + } 238 + 239 + /****************************************************************************** 240 + * 219 241 * FUNCTION: acpi_get_object_info 220 242 * 221 - * PARAMETERS: Handle - Object Handle 222 - * Buffer - Where the info is returned 243 + * PARAMETERS: Handle - Object Handle 244 + * return_buffer - Where the info is returned 223 245 * 224 246 * RETURN: Status 225 247 * ··· 255 221 * namespace node and possibly by running several standard 256 222 * control methods (Such as in the case of a device.) 257 223 * 224 + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, 225 + * _ADR, _sx_w, and _sx_d methods. 226 + * 227 + * Note: Allocates the return buffer, must be freed by the caller. 228 + * 258 229 ******************************************************************************/ 230 + 259 231 acpi_status 260 - acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) 232 + acpi_get_object_info(acpi_handle handle, 233 + struct acpi_device_info **return_buffer) 261 234 { 262 - acpi_status status; 263 235 struct acpi_namespace_node *node; 264 236 struct acpi_device_info *info; 265 - struct acpi_device_info *return_info; 266 - struct acpi_compatible_id_list *cid_list = NULL; 267 - acpi_size size; 237 + struct acpica_device_id_list *cid_list = NULL; 238 + struct acpica_device_id *hid = NULL; 239 + struct acpica_device_id *uid = NULL; 240 + char *next_id_string; 241 + acpi_object_type type; 242 + acpi_name name; 243 + u8 param_count = 0; 244 + u8 valid = 0; 245 + u32 info_size; 246 + u32 i; 247 + acpi_status status; 268 248 269 249 /* Parameter validation */ 270 250 271 - if (!handle || !buffer) { 251 + if (!handle || !return_buffer) { 272 252 return (AE_BAD_PARAMETER); 273 - } 274 - 275 - status = acpi_ut_validate_buffer(buffer); 276 - if (ACPI_FAILURE(status)) { 277 - return (status); 278 - } 279 - 280 - info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); 281 - if (!info) { 282 - return (AE_NO_MEMORY); 283 253 } 284 254 285 255 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); ··· 294 256 node = acpi_ns_map_handle_to_node(handle); 295 257 if (!node) { 296 258 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 297 - status = AE_BAD_PARAMETER; 298 - goto cleanup; 259 + return (AE_BAD_PARAMETER); 299 260 } 300 261 301 - /* Init return structure */ 262 + /* Get the namespace node data while the namespace is locked */ 302 263 303 - size = sizeof(struct acpi_device_info); 304 - 305 - info->type = node->type; 306 - info->name = node->name.integer; 307 - info->valid = 0; 264 + info_size = sizeof(struct acpi_device_info); 265 + type = node->type; 266 + name = node->name.integer; 308 267 309 268 if (node->type == ACPI_TYPE_METHOD) { 310 - info->param_count = node->object->method.param_count; 269 + param_count = node->object->method.param_count; 311 270 } 312 271 313 272 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 314 273 if (ACPI_FAILURE(status)) { 315 - goto cleanup; 274 + return (status); 316 275 } 317 276 318 - /* If not a device, we are all done */ 319 - 320 - if (info->type == ACPI_TYPE_DEVICE) { 277 + if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 321 278 /* 322 - * Get extra info for ACPI Devices objects only: 323 - * Run the Device _HID, _UID, _CID, _STA, _ADR and _sx_d methods. 279 + * Get extra info for ACPI Device/Processor objects only: 280 + * Run the Device _HID, _UID, and _CID methods. 324 281 * 325 282 * Note: none of these methods are required, so they may or may 326 - * not be present for this device. The Info->Valid bitfield is used 327 - * to indicate which methods were found and ran successfully. 283 + * not be present for this device. The Info->Valid bitfield is used 284 + * to indicate which methods were found and run successfully. 328 285 */ 329 286 330 287 /* Execute the Device._HID method */ 331 288 332 - status = acpi_ut_execute_HID(node, &info->hardware_id); 289 + status = acpi_ut_execute_HID(node, &hid); 333 290 if (ACPI_SUCCESS(status)) { 334 - info->valid |= ACPI_VALID_HID; 291 + info_size += hid->length; 292 + valid |= ACPI_VALID_HID; 335 293 } 336 294 337 295 /* Execute the Device._UID method */ 338 296 339 - status = acpi_ut_execute_UID(node, &info->unique_id); 297 + status = acpi_ut_execute_UID(node, &uid); 340 298 if (ACPI_SUCCESS(status)) { 341 - info->valid |= ACPI_VALID_UID; 299 + info_size += uid->length; 300 + valid |= ACPI_VALID_UID; 342 301 } 343 302 344 303 /* Execute the Device._CID method */ 345 304 346 305 status = acpi_ut_execute_CID(node, &cid_list); 347 306 if (ACPI_SUCCESS(status)) { 348 - size += cid_list->size; 349 - info->valid |= ACPI_VALID_CID; 307 + 308 + /* Add size of CID strings and CID pointer array */ 309 + 310 + info_size += 311 + (cid_list->list_size - 312 + sizeof(struct acpica_device_id_list)); 313 + valid |= ACPI_VALID_CID; 350 314 } 315 + } 316 + 317 + /* 318 + * Now that we have the variable-length data, we can allocate the 319 + * return buffer 320 + */ 321 + info = ACPI_ALLOCATE_ZEROED(info_size); 322 + if (!info) { 323 + status = AE_NO_MEMORY; 324 + goto cleanup; 325 + } 326 + 327 + /* Get the fixed-length data */ 328 + 329 + if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 330 + /* 331 + * Get extra info for ACPI Device/Processor objects only: 332 + * Run the _STA, _ADR and, sx_w, and _sx_d methods. 333 + * 334 + * Note: none of these methods are required, so they may or may 335 + * not be present for this device. The Info->Valid bitfield is used 336 + * to indicate which methods were found and run successfully. 337 + */ 351 338 352 339 /* Execute the Device._STA method */ 353 340 354 341 status = acpi_ut_execute_STA(node, &info->current_status); 355 342 if (ACPI_SUCCESS(status)) { 356 - info->valid |= ACPI_VALID_STA; 343 + valid |= ACPI_VALID_STA; 357 344 } 358 345 359 346 /* Execute the Device._ADR method */ ··· 386 323 status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, 387 324 &info->address); 388 325 if (ACPI_SUCCESS(status)) { 389 - info->valid |= ACPI_VALID_ADR; 326 + valid |= ACPI_VALID_ADR; 327 + } 328 + 329 + /* Execute the Device._sx_w methods */ 330 + 331 + status = acpi_ut_execute_power_methods(node, 332 + acpi_gbl_lowest_dstate_names, 333 + ACPI_NUM_sx_w_METHODS, 334 + info->lowest_dstates); 335 + if (ACPI_SUCCESS(status)) { 336 + valid |= ACPI_VALID_SXWS; 390 337 } 391 338 392 339 /* Execute the Device._sx_d methods */ 393 340 394 - status = acpi_ut_execute_sxds(node, info->highest_dstates); 341 + status = acpi_ut_execute_power_methods(node, 342 + acpi_gbl_highest_dstate_names, 343 + ACPI_NUM_sx_d_METHODS, 344 + info->highest_dstates); 395 345 if (ACPI_SUCCESS(status)) { 396 - info->valid |= ACPI_VALID_SXDS; 346 + valid |= ACPI_VALID_SXDS; 397 347 } 398 348 } 399 349 400 - /* Validate/Allocate/Clear caller buffer */ 350 + /* 351 + * Create a pointer to the string area of the return buffer. 352 + * Point to the end of the base struct acpi_device_info structure. 353 + */ 354 + next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); 355 + if (cid_list) { 401 356 402 - status = acpi_ut_initialize_buffer(buffer, size); 403 - if (ACPI_FAILURE(status)) { 404 - goto cleanup; 357 + /* Point past the CID DEVICE_ID array */ 358 + 359 + next_id_string += 360 + ((acpi_size) cid_list->count * 361 + sizeof(struct acpica_device_id)); 405 362 } 406 363 407 - /* Populate the return buffer */ 364 + /* 365 + * Copy the HID, UID, and CIDs to the return buffer. The variable-length 366 + * strings are copied to the reserved area at the end of the buffer. 367 + * 368 + * For HID and CID, check if the ID is a PCI Root Bridge. 369 + */ 370 + if (hid) { 371 + next_id_string = acpi_ns_copy_device_id(&info->hardware_id, 372 + hid, next_id_string); 408 373 409 - return_info = buffer->pointer; 410 - ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); 374 + if (acpi_ut_is_pci_root_bridge(hid->string)) { 375 + info->flags |= ACPI_PCI_ROOT_BRIDGE; 376 + } 377 + } 378 + 379 + if (uid) { 380 + next_id_string = acpi_ns_copy_device_id(&info->unique_id, 381 + uid, next_id_string); 382 + } 411 383 412 384 if (cid_list) { 413 - ACPI_MEMCPY(&return_info->compatibility_id, cid_list, 414 - cid_list->size); 385 + info->compatible_id_list.count = cid_list->count; 386 + info->compatible_id_list.list_size = cid_list->list_size; 387 + 388 + /* Copy each CID */ 389 + 390 + for (i = 0; i < cid_list->count; i++) { 391 + next_id_string = 392 + acpi_ns_copy_device_id(&info->compatible_id_list. 393 + ids[i], &cid_list->ids[i], 394 + next_id_string); 395 + 396 + if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) { 397 + info->flags |= ACPI_PCI_ROOT_BRIDGE; 398 + } 399 + } 415 400 } 416 401 402 + /* Copy the fixed-length data */ 403 + 404 + info->info_size = info_size; 405 + info->type = type; 406 + info->name = name; 407 + info->param_count = param_count; 408 + info->valid = valid; 409 + 410 + *return_buffer = info; 411 + status = AE_OK; 412 + 417 413 cleanup: 418 - ACPI_FREE(info); 414 + if (hid) { 415 + ACPI_FREE(hid); 416 + } 417 + if (uid) { 418 + ACPI_FREE(uid); 419 + } 419 420 if (cid_list) { 420 421 ACPI_FREE(cid_list); 421 422 }
+111 -8
drivers/acpi/acpica/psloop.c
··· 86 86 acpi_ps_complete_final_op(struct acpi_walk_state *walk_state, 87 87 union acpi_parse_object *op, acpi_status status); 88 88 89 + static void 90 + acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id); 91 + 89 92 /******************************************************************************* 90 93 * 91 94 * FUNCTION: acpi_ps_get_aml_opcode ··· 393 390 { 394 391 acpi_status status = AE_OK; 395 392 union acpi_parse_object *arg = NULL; 393 + const struct acpi_opcode_info *op_info; 396 394 397 395 ACPI_FUNCTION_TRACE_PTR(ps_get_arguments, walk_state); 398 396 ··· 453 449 INCREMENT_ARG_LIST(walk_state->arg_types); 454 450 } 455 451 456 - /* Special processing for certain opcodes */ 457 - 458 - /* TBD (remove): Temporary mechanism to disable this code if needed */ 459 - 460 - #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 461 - 462 - if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) && 452 + /* 453 + * Handle executable code at "module-level". This refers to 454 + * executable opcodes that appear outside of any control method. 455 + */ 456 + if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) && 463 457 ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) { 464 458 /* 465 459 * We want to skip If/Else/While constructs during Pass1 because we ··· 471 469 case AML_ELSE_OP: 472 470 case AML_WHILE_OP: 473 471 472 + /* 473 + * Currently supported module-level opcodes are: 474 + * IF/ELSE/WHILE. These appear to be the most common, 475 + * and easiest to support since they open an AML 476 + * package. 477 + */ 478 + if (walk_state->pass_number == 479 + ACPI_IMODE_LOAD_PASS1) { 480 + acpi_ps_link_module_code(aml_op_start, 481 + walk_state-> 482 + parser_state. 483 + pkg_end - 484 + aml_op_start, 485 + walk_state-> 486 + owner_id); 487 + } 488 + 474 489 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 475 490 "Pass1: Skipping an If/Else/While body\n")); 476 491 ··· 499 480 break; 500 481 501 482 default: 483 + /* 484 + * Check for an unsupported executable opcode at module 485 + * level. We must be in PASS1, the parent must be a SCOPE, 486 + * The opcode class must be EXECUTE, and the opcode must 487 + * not be an argument to another opcode. 488 + */ 489 + if ((walk_state->pass_number == 490 + ACPI_IMODE_LOAD_PASS1) 491 + && (op->common.parent->common.aml_opcode == 492 + AML_SCOPE_OP)) { 493 + op_info = 494 + acpi_ps_get_opcode_info(op->common. 495 + aml_opcode); 496 + if ((op_info->class == 497 + AML_CLASS_EXECUTE) && (!arg)) { 498 + ACPI_WARNING((AE_INFO, 499 + "Detected an unsupported executable opcode " 500 + "at module-level: [0x%.4X] at table offset 0x%.4X", 501 + op->common.aml_opcode, 502 + (u32)((aml_op_start - walk_state->parser_state.aml_start) 503 + + sizeof(struct acpi_table_header)))); 504 + } 505 + } 502 506 break; 503 507 } 504 508 } 505 - #endif 509 + 510 + /* Special processing for certain opcodes */ 506 511 507 512 switch (op->common.aml_opcode) { 508 513 case AML_METHOD_OP: ··· 592 549 } 593 550 594 551 return_ACPI_STATUS(AE_OK); 552 + } 553 + 554 + /******************************************************************************* 555 + * 556 + * FUNCTION: acpi_ps_link_module_code 557 + * 558 + * PARAMETERS: aml_start - Pointer to the AML 559 + * aml_length - Length of executable AML 560 + * owner_id - owner_id of module level code 561 + * 562 + * RETURN: None. 563 + * 564 + * DESCRIPTION: Wrap the module-level code with a method object and link the 565 + * object to the global list. Note, the mutex field of the method 566 + * object is used to link multiple module-level code objects. 567 + * 568 + ******************************************************************************/ 569 + 570 + static void 571 + acpi_ps_link_module_code(u8 *aml_start, u32 aml_length, acpi_owner_id owner_id) 572 + { 573 + union acpi_operand_object *prev; 574 + union acpi_operand_object *next; 575 + union acpi_operand_object *method_obj; 576 + 577 + /* Get the tail of the list */ 578 + 579 + prev = next = acpi_gbl_module_code_list; 580 + while (next) { 581 + prev = next; 582 + next = next->method.mutex; 583 + } 584 + 585 + /* 586 + * Insert the module level code into the list. Merge it if it is 587 + * adjacent to the previous element. 588 + */ 589 + if (!prev || 590 + ((prev->method.aml_start + prev->method.aml_length) != aml_start)) { 591 + 592 + /* Create, initialize, and link a new temporary method object */ 593 + 594 + method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); 595 + if (!method_obj) { 596 + return; 597 + } 598 + 599 + method_obj->method.aml_start = aml_start; 600 + method_obj->method.aml_length = aml_length; 601 + method_obj->method.owner_id = owner_id; 602 + method_obj->method.flags |= AOPOBJ_MODULE_LEVEL; 603 + 604 + if (!prev) { 605 + acpi_gbl_module_code_list = method_obj; 606 + } else { 607 + prev->method.mutex = method_obj; 608 + } 609 + } else { 610 + prev->method.aml_length += aml_length; 611 + } 595 612 } 596 613 597 614 /*******************************************************************************
+4
drivers/acpi/acpica/psxface.c
··· 280 280 goto cleanup; 281 281 } 282 282 283 + if (info->obj_desc->method.flags & AOPOBJ_MODULE_LEVEL) { 284 + walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL; 285 + } 286 + 283 287 /* Invoke an internal method if necessary */ 284 288 285 289 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
+75 -7
drivers/acpi/acpica/tbutils.c
··· 49 49 ACPI_MODULE_NAME("tbutils") 50 50 51 51 /* Local prototypes */ 52 + static void acpi_tb_fix_string(char *string, acpi_size length); 53 + 54 + static void 55 + acpi_tb_cleanup_table_header(struct acpi_table_header *out_header, 56 + struct acpi_table_header *header); 57 + 52 58 static acpi_physical_address 53 59 acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size); 54 60 ··· 167 161 168 162 /******************************************************************************* 169 163 * 164 + * FUNCTION: acpi_tb_fix_string 165 + * 166 + * PARAMETERS: String - String to be repaired 167 + * Length - Maximum length 168 + * 169 + * RETURN: None 170 + * 171 + * DESCRIPTION: Replace every non-printable or non-ascii byte in the string 172 + * with a question mark '?'. 173 + * 174 + ******************************************************************************/ 175 + 176 + static void acpi_tb_fix_string(char *string, acpi_size length) 177 + { 178 + 179 + while (length && *string) { 180 + if (!ACPI_IS_PRINT(*string)) { 181 + *string = '?'; 182 + } 183 + string++; 184 + length--; 185 + } 186 + } 187 + 188 + /******************************************************************************* 189 + * 190 + * FUNCTION: acpi_tb_cleanup_table_header 191 + * 192 + * PARAMETERS: out_header - Where the cleaned header is returned 193 + * Header - Input ACPI table header 194 + * 195 + * RETURN: Returns the cleaned header in out_header 196 + * 197 + * DESCRIPTION: Copy the table header and ensure that all "string" fields in 198 + * the header consist of printable characters. 199 + * 200 + ******************************************************************************/ 201 + 202 + static void 203 + acpi_tb_cleanup_table_header(struct acpi_table_header *out_header, 204 + struct acpi_table_header *header) 205 + { 206 + 207 + ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header)); 208 + 209 + acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE); 210 + acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE); 211 + acpi_tb_fix_string(out_header->oem_table_id, ACPI_OEM_TABLE_ID_SIZE); 212 + acpi_tb_fix_string(out_header->asl_compiler_id, ACPI_NAME_SIZE); 213 + } 214 + 215 + /******************************************************************************* 216 + * 170 217 * FUNCTION: acpi_tb_print_table_header 171 218 * 172 219 * PARAMETERS: Address - Table physical address ··· 235 176 acpi_tb_print_table_header(acpi_physical_address address, 236 177 struct acpi_table_header *header) 237 178 { 179 + struct acpi_table_header local_header; 238 180 239 181 /* 240 182 * The reason that the Address is cast to a void pointer is so that we ··· 252 192 253 193 /* RSDP has no common fields */ 254 194 195 + ACPI_MEMCPY(local_header.oem_id, 196 + ACPI_CAST_PTR(struct acpi_table_rsdp, 197 + header)->oem_id, ACPI_OEM_ID_SIZE); 198 + acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); 199 + 255 200 ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", 256 201 ACPI_CAST_PTR (void, address), 257 202 (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> ··· 265 200 header)->length : 20, 266 201 ACPI_CAST_PTR(struct acpi_table_rsdp, 267 202 header)->revision, 268 - ACPI_CAST_PTR(struct acpi_table_rsdp, 269 - header)->oem_id)); 203 + local_header.oem_id)); 270 204 } else { 271 205 /* Standard ACPI table with full common header */ 272 206 207 + acpi_tb_cleanup_table_header(&local_header, header); 208 + 273 209 ACPI_INFO((AE_INFO, 274 210 "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", 275 - header->signature, ACPI_CAST_PTR (void, address), 276 - header->length, header->revision, header->oem_id, 277 - header->oem_table_id, header->oem_revision, 278 - header->asl_compiler_id, 279 - header->asl_compiler_revision)); 211 + local_header.signature, ACPI_CAST_PTR(void, address), 212 + local_header.length, local_header.revision, 213 + local_header.oem_id, local_header.oem_table_id, 214 + local_header.oem_revision, 215 + local_header.asl_compiler_id, 216 + local_header.asl_compiler_revision)); 217 + 280 218 } 281 219 } 282 220
+6
drivers/acpi/acpica/utdelete.c
··· 215 215 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 216 216 "***** Region %p\n", object)); 217 217 218 + /* Invalidate the region address/length via the host OS */ 219 + 220 + acpi_os_invalidate_address(object->region.space_id, 221 + object->region.address, 222 + (acpi_size) object->region.length); 223 + 218 224 second_desc = acpi_ns_get_secondary_object(object); 219 225 if (second_desc) { 220 226 /*
+44 -334
drivers/acpi/acpica/uteval.c
··· 44 44 #include <acpi/acpi.h> 45 45 #include "accommon.h" 46 46 #include "acnamesp.h" 47 - #include "acinterp.h" 48 47 49 48 #define _COMPONENT ACPI_UTILITIES 50 49 ACPI_MODULE_NAME("uteval") 51 - 52 - /* Local prototypes */ 53 - static void 54 - acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length); 55 - 56 - static acpi_status 57 - acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, 58 - struct acpi_compatible_id *one_cid); 59 50 60 51 /* 61 52 * Strings supported by the _OSI predefined (internal) method. ··· 69 78 {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ 70 79 {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ 71 80 {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ 81 + {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ 82 + {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ 83 + {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ 72 84 73 85 /* Feature Group Strings */ 74 86 ··· 207 213 * RETURN: Status 208 214 * 209 215 * DESCRIPTION: Evaluates a namespace object and verifies the type of the 210 - * return object. Common code that simplifies accessing objects 216 + * return object. Common code that simplifies accessing objects 211 217 * that have required return objects of fixed types. 212 218 * 213 219 * NOTE: Internal function, no parameter validation ··· 292 298 293 299 if ((acpi_gbl_enable_interpreter_slack) && (!expected_return_btypes)) { 294 300 /* 295 - * We received a return object, but one was not expected. This can 301 + * We received a return object, but one was not expected. This can 296 302 * happen frequently if the "implicit return" feature is enabled. 297 303 * Just delete the return object and return AE_OK. 298 304 */ ··· 334 340 * 335 341 * PARAMETERS: object_name - Object name to be evaluated 336 342 * device_node - Node for the device 337 - * Address - Where the value is returned 343 + * Value - Where the value is returned 338 344 * 339 345 * RETURN: Status 340 346 * 341 347 * DESCRIPTION: Evaluates a numeric namespace object for a selected device 342 - * and stores result in *Address. 348 + * and stores result in *Value. 343 349 * 344 350 * NOTE: Internal function, no parameter validation 345 351 * ··· 348 354 acpi_status 349 355 acpi_ut_evaluate_numeric_object(char *object_name, 350 356 struct acpi_namespace_node *device_node, 351 - acpi_integer * address) 357 + acpi_integer *value) 352 358 { 353 359 union acpi_operand_object *obj_desc; 354 360 acpi_status status; ··· 363 369 364 370 /* Get the returned Integer */ 365 371 366 - *address = obj_desc->integer.value; 367 - 368 - /* On exit, we must delete the return object */ 369 - 370 - acpi_ut_remove_reference(obj_desc); 371 - return_ACPI_STATUS(status); 372 - } 373 - 374 - /******************************************************************************* 375 - * 376 - * FUNCTION: acpi_ut_copy_id_string 377 - * 378 - * PARAMETERS: Destination - Where to copy the string 379 - * Source - Source string 380 - * max_length - Length of the destination buffer 381 - * 382 - * RETURN: None 383 - * 384 - * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. 385 - * Performs removal of a leading asterisk if present -- workaround 386 - * for a known issue on a bunch of machines. 387 - * 388 - ******************************************************************************/ 389 - 390 - static void 391 - acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length) 392 - { 393 - 394 - /* 395 - * Workaround for ID strings that have a leading asterisk. This construct 396 - * is not allowed by the ACPI specification (ID strings must be 397 - * alphanumeric), but enough existing machines have this embedded in their 398 - * ID strings that the following code is useful. 399 - */ 400 - if (*source == '*') { 401 - source++; 402 - } 403 - 404 - /* Do the actual copy */ 405 - 406 - ACPI_STRNCPY(destination, source, max_length); 407 - } 408 - 409 - /******************************************************************************* 410 - * 411 - * FUNCTION: acpi_ut_execute_HID 412 - * 413 - * PARAMETERS: device_node - Node for the device 414 - * Hid - Where the HID is returned 415 - * 416 - * RETURN: Status 417 - * 418 - * DESCRIPTION: Executes the _HID control method that returns the hardware 419 - * ID of the device. 420 - * 421 - * NOTE: Internal function, no parameter validation 422 - * 423 - ******************************************************************************/ 424 - 425 - acpi_status 426 - acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 427 - struct acpica_device_id *hid) 428 - { 429 - union acpi_operand_object *obj_desc; 430 - acpi_status status; 431 - 432 - ACPI_FUNCTION_TRACE(ut_execute_HID); 433 - 434 - status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, 435 - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 436 - &obj_desc); 437 - if (ACPI_FAILURE(status)) { 438 - return_ACPI_STATUS(status); 439 - } 440 - 441 - if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 442 - 443 - /* Convert the Numeric HID to string */ 444 - 445 - acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, 446 - hid->value); 447 - } else { 448 - /* Copy the String HID from the returned object */ 449 - 450 - acpi_ut_copy_id_string(hid->value, obj_desc->string.pointer, 451 - sizeof(hid->value)); 452 - } 453 - 454 - /* On exit, we must delete the return object */ 455 - 456 - acpi_ut_remove_reference(obj_desc); 457 - return_ACPI_STATUS(status); 458 - } 459 - 460 - /******************************************************************************* 461 - * 462 - * FUNCTION: acpi_ut_translate_one_cid 463 - * 464 - * PARAMETERS: obj_desc - _CID object, must be integer or string 465 - * one_cid - Where the CID string is returned 466 - * 467 - * RETURN: Status 468 - * 469 - * DESCRIPTION: Return a numeric or string _CID value as a string. 470 - * (Compatible ID) 471 - * 472 - * NOTE: Assumes a maximum _CID string length of 473 - * ACPI_MAX_CID_LENGTH. 474 - * 475 - ******************************************************************************/ 476 - 477 - static acpi_status 478 - acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, 479 - struct acpi_compatible_id *one_cid) 480 - { 481 - 482 - switch (obj_desc->common.type) { 483 - case ACPI_TYPE_INTEGER: 484 - 485 - /* Convert the Numeric CID to string */ 486 - 487 - acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, 488 - one_cid->value); 489 - return (AE_OK); 490 - 491 - case ACPI_TYPE_STRING: 492 - 493 - if (obj_desc->string.length > ACPI_MAX_CID_LENGTH) { 494 - return (AE_AML_STRING_LIMIT); 495 - } 496 - 497 - /* Copy the String CID from the returned object */ 498 - 499 - acpi_ut_copy_id_string(one_cid->value, obj_desc->string.pointer, 500 - ACPI_MAX_CID_LENGTH); 501 - return (AE_OK); 502 - 503 - default: 504 - 505 - return (AE_TYPE); 506 - } 507 - } 508 - 509 - /******************************************************************************* 510 - * 511 - * FUNCTION: acpi_ut_execute_CID 512 - * 513 - * PARAMETERS: device_node - Node for the device 514 - * return_cid_list - Where the CID list is returned 515 - * 516 - * RETURN: Status 517 - * 518 - * DESCRIPTION: Executes the _CID control method that returns one or more 519 - * compatible hardware IDs for the device. 520 - * 521 - * NOTE: Internal function, no parameter validation 522 - * 523 - ******************************************************************************/ 524 - 525 - acpi_status 526 - acpi_ut_execute_CID(struct acpi_namespace_node * device_node, 527 - struct acpi_compatible_id_list ** return_cid_list) 528 - { 529 - union acpi_operand_object *obj_desc; 530 - acpi_status status; 531 - u32 count; 532 - u32 size; 533 - struct acpi_compatible_id_list *cid_list; 534 - u32 i; 535 - 536 - ACPI_FUNCTION_TRACE(ut_execute_CID); 537 - 538 - /* Evaluate the _CID method for this device */ 539 - 540 - status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID, 541 - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING 542 - | ACPI_BTYPE_PACKAGE, &obj_desc); 543 - if (ACPI_FAILURE(status)) { 544 - return_ACPI_STATUS(status); 545 - } 546 - 547 - /* Get the number of _CIDs returned */ 548 - 549 - count = 1; 550 - if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { 551 - count = obj_desc->package.count; 552 - } 553 - 554 - /* Allocate a worst-case buffer for the _CIDs */ 555 - 556 - size = (((count - 1) * sizeof(struct acpi_compatible_id)) + 557 - sizeof(struct acpi_compatible_id_list)); 558 - 559 - cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); 560 - if (!cid_list) { 561 - return_ACPI_STATUS(AE_NO_MEMORY); 562 - } 563 - 564 - /* Init CID list */ 565 - 566 - cid_list->count = count; 567 - cid_list->size = size; 568 - 569 - /* 570 - * A _CID can return either a single compatible ID or a package of 571 - * compatible IDs. Each compatible ID can be one of the following: 572 - * 1) Integer (32 bit compressed EISA ID) or 573 - * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") 574 - */ 575 - 576 - /* The _CID object can be either a single CID or a package (list) of CIDs */ 577 - 578 - if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { 579 - 580 - /* Translate each package element */ 581 - 582 - for (i = 0; i < count; i++) { 583 - status = 584 - acpi_ut_translate_one_cid(obj_desc->package. 585 - elements[i], 586 - &cid_list->id[i]); 587 - if (ACPI_FAILURE(status)) { 588 - break; 589 - } 590 - } 591 - } else { 592 - /* Only one CID, translate to a string */ 593 - 594 - status = acpi_ut_translate_one_cid(obj_desc, cid_list->id); 595 - } 596 - 597 - /* Cleanup on error */ 598 - 599 - if (ACPI_FAILURE(status)) { 600 - ACPI_FREE(cid_list); 601 - } else { 602 - *return_cid_list = cid_list; 603 - } 604 - 605 - /* On exit, we must delete the _CID return object */ 606 - 607 - acpi_ut_remove_reference(obj_desc); 608 - return_ACPI_STATUS(status); 609 - } 610 - 611 - /******************************************************************************* 612 - * 613 - * FUNCTION: acpi_ut_execute_UID 614 - * 615 - * PARAMETERS: device_node - Node for the device 616 - * Uid - Where the UID is returned 617 - * 618 - * RETURN: Status 619 - * 620 - * DESCRIPTION: Executes the _UID control method that returns the hardware 621 - * ID of the device. 622 - * 623 - * NOTE: Internal function, no parameter validation 624 - * 625 - ******************************************************************************/ 626 - 627 - acpi_status 628 - acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 629 - struct acpica_device_id *uid) 630 - { 631 - union acpi_operand_object *obj_desc; 632 - acpi_status status; 633 - 634 - ACPI_FUNCTION_TRACE(ut_execute_UID); 635 - 636 - status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, 637 - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 638 - &obj_desc); 639 - if (ACPI_FAILURE(status)) { 640 - return_ACPI_STATUS(status); 641 - } 642 - 643 - if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 644 - 645 - /* Convert the Numeric UID to string */ 646 - 647 - acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, 648 - uid->value); 649 - } else { 650 - /* Copy the String UID from the returned object */ 651 - 652 - acpi_ut_copy_id_string(uid->value, obj_desc->string.pointer, 653 - sizeof(uid->value)); 654 - } 372 + *value = obj_desc->integer.value; 655 373 656 374 /* On exit, we must delete the return object */ 657 375 ··· 422 716 423 717 /******************************************************************************* 424 718 * 425 - * FUNCTION: acpi_ut_execute_Sxds 719 + * FUNCTION: acpi_ut_execute_power_methods 426 720 * 427 721 * PARAMETERS: device_node - Node for the device 428 - * Flags - Where the status flags are returned 722 + * method_names - Array of power method names 723 + * method_count - Number of methods to execute 724 + * out_values - Where the power method values are returned 429 725 * 430 - * RETURN: Status 726 + * RETURN: Status, out_values 431 727 * 432 - * DESCRIPTION: Executes _STA for selected device and stores results in 433 - * *Flags. 728 + * DESCRIPTION: Executes the specified power methods for the device and returns 729 + * the result(s). 434 730 * 435 731 * NOTE: Internal function, no parameter validation 436 732 * 437 - ******************************************************************************/ 733 + ******************************************************************************/ 438 734 439 735 acpi_status 440 - acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) 736 + acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, 737 + const char **method_names, 738 + u8 method_count, u8 *out_values) 441 739 { 442 740 union acpi_operand_object *obj_desc; 443 741 acpi_status status; 742 + acpi_status final_status = AE_NOT_FOUND; 444 743 u32 i; 445 744 446 - ACPI_FUNCTION_TRACE(ut_execute_sxds); 745 + ACPI_FUNCTION_TRACE(ut_execute_power_methods); 447 746 448 - for (i = 0; i < 4; i++) { 449 - highest[i] = 0xFF; 747 + for (i = 0; i < method_count; i++) { 748 + /* 749 + * Execute the power method (_sx_d or _sx_w). The only allowable 750 + * return type is an Integer. 751 + */ 450 752 status = acpi_ut_evaluate_object(device_node, 451 753 ACPI_CAST_PTR(char, 452 - acpi_gbl_highest_dstate_names 453 - [i]), 754 + method_names[i]), 454 755 ACPI_BTYPE_INTEGER, &obj_desc); 455 - if (ACPI_FAILURE(status)) { 456 - if (status != AE_NOT_FOUND) { 457 - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 458 - "%s on Device %4.4s, %s\n", 459 - ACPI_CAST_PTR(char, 460 - acpi_gbl_highest_dstate_names 461 - [i]), 462 - acpi_ut_get_node_name 463 - (device_node), 464 - acpi_format_exception 465 - (status))); 466 - 467 - return_ACPI_STATUS(status); 468 - } 469 - } else { 470 - /* Extract the Dstate value */ 471 - 472 - highest[i] = (u8) obj_desc->integer.value; 756 + if (ACPI_SUCCESS(status)) { 757 + out_values[i] = (u8)obj_desc->integer.value; 473 758 474 759 /* Delete the return object */ 475 760 476 761 acpi_ut_remove_reference(obj_desc); 762 + final_status = AE_OK; /* At least one value is valid */ 763 + continue; 477 764 } 765 + 766 + out_values[i] = ACPI_UINT8_MAX; 767 + if (status == AE_NOT_FOUND) { 768 + continue; /* Ignore if not found */ 769 + } 770 + 771 + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 772 + "Failed %s on Device %4.4s, %s\n", 773 + ACPI_CAST_PTR(char, method_names[i]), 774 + acpi_ut_get_node_name(device_node), 775 + acpi_format_exception(status))); 478 776 } 479 777 480 - return_ACPI_STATUS(AE_OK); 778 + return_ACPI_STATUS(final_status); 481 779 }
+11 -1
drivers/acpi/acpica/utglobal.c
··· 90 90 "\\_S5_" 91 91 }; 92 92 93 - const char *acpi_gbl_highest_dstate_names[4] = { 93 + const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS] = { 94 + "_S0W", 95 + "_S1W", 96 + "_S2W", 97 + "_S3W", 98 + "_S4W" 99 + }; 100 + 101 + const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { 94 102 "_S1D", 95 103 "_S2D", 96 104 "_S3D", ··· 359 351 "SMBus", 360 352 "SystemCMOS", 361 353 "PCIBARTarget", 354 + "IPMI", 362 355 "DataTable" 363 356 }; 364 357 ··· 807 798 808 799 /* Namespace */ 809 800 801 + acpi_gbl_module_code_list = NULL; 810 802 acpi_gbl_root_node = NULL; 811 803 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 812 804 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
+382
drivers/acpi/acpica/utids.c
··· 1 + /****************************************************************************** 2 + * 3 + * Module Name: utids - support for device IDs - HID, UID, CID 4 + * 5 + *****************************************************************************/ 6 + 7 + /* 8 + * Copyright (C) 2000 - 2009, Intel Corp. 9 + * All rights reserved. 10 + * 11 + * Redistribution and use in source and binary forms, with or without 12 + * modification, are permitted provided that the following conditions 13 + * are met: 14 + * 1. Redistributions of source code must retain the above copyright 15 + * notice, this list of conditions, and the following disclaimer, 16 + * without modification. 17 + * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 + * substantially similar to the "NO WARRANTY" disclaimer below 19 + * ("Disclaimer") and any redistribution must be conditioned upon 20 + * including a substantially similar Disclaimer requirement for further 21 + * binary redistribution. 22 + * 3. Neither the names of the above-listed copyright holders nor the names 23 + * of any contributors may be used to endorse or promote products derived 24 + * from this software without specific prior written permission. 25 + * 26 + * Alternatively, this software may be distributed under the terms of the 27 + * GNU General Public License ("GPL") version 2 as published by the Free 28 + * Software Foundation. 29 + * 30 + * NO WARRANTY 31 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 + * POSSIBILITY OF SUCH DAMAGES. 42 + */ 43 + 44 + #include <acpi/acpi.h> 45 + #include "accommon.h" 46 + #include "acinterp.h" 47 + 48 + #define _COMPONENT ACPI_UTILITIES 49 + ACPI_MODULE_NAME("utids") 50 + 51 + /* Local prototypes */ 52 + static void acpi_ut_copy_id_string(char *destination, char *source); 53 + 54 + /******************************************************************************* 55 + * 56 + * FUNCTION: acpi_ut_copy_id_string 57 + * 58 + * PARAMETERS: Destination - Where to copy the string 59 + * Source - Source string 60 + * 61 + * RETURN: None 62 + * 63 + * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. 64 + * Performs removal of a leading asterisk if present -- workaround 65 + * for a known issue on a bunch of machines. 66 + * 67 + ******************************************************************************/ 68 + 69 + static void acpi_ut_copy_id_string(char *destination, char *source) 70 + { 71 + 72 + /* 73 + * Workaround for ID strings that have a leading asterisk. This construct 74 + * is not allowed by the ACPI specification (ID strings must be 75 + * alphanumeric), but enough existing machines have this embedded in their 76 + * ID strings that the following code is useful. 77 + */ 78 + if (*source == '*') { 79 + source++; 80 + } 81 + 82 + /* Do the actual copy */ 83 + 84 + ACPI_STRCPY(destination, source); 85 + } 86 + 87 + /******************************************************************************* 88 + * 89 + * FUNCTION: acpi_ut_execute_HID 90 + * 91 + * PARAMETERS: device_node - Node for the device 92 + * return_id - Where the string HID is returned 93 + * 94 + * RETURN: Status 95 + * 96 + * DESCRIPTION: Executes the _HID control method that returns the hardware 97 + * ID of the device. The HID is either an 32-bit encoded EISAID 98 + * Integer or a String. A string is always returned. An EISAID 99 + * is converted to a string. 100 + * 101 + * NOTE: Internal function, no parameter validation 102 + * 103 + ******************************************************************************/ 104 + 105 + acpi_status 106 + acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 107 + struct acpica_device_id **return_id) 108 + { 109 + union acpi_operand_object *obj_desc; 110 + struct acpica_device_id *hid; 111 + u32 length; 112 + acpi_status status; 113 + 114 + ACPI_FUNCTION_TRACE(ut_execute_HID); 115 + 116 + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, 117 + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 118 + &obj_desc); 119 + if (ACPI_FAILURE(status)) { 120 + return_ACPI_STATUS(status); 121 + } 122 + 123 + /* Get the size of the String to be returned, includes null terminator */ 124 + 125 + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 126 + length = ACPI_EISAID_STRING_SIZE; 127 + } else { 128 + length = obj_desc->string.length + 1; 129 + } 130 + 131 + /* Allocate a buffer for the HID */ 132 + 133 + hid = 134 + ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 135 + (acpi_size) length); 136 + if (!hid) { 137 + status = AE_NO_MEMORY; 138 + goto cleanup; 139 + } 140 + 141 + /* Area for the string starts after DEVICE_ID struct */ 142 + 143 + hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id)); 144 + 145 + /* Convert EISAID to a string or simply copy existing string */ 146 + 147 + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 148 + acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); 149 + } else { 150 + acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer); 151 + } 152 + 153 + hid->length = length; 154 + *return_id = hid; 155 + 156 + cleanup: 157 + 158 + /* On exit, we must delete the return object */ 159 + 160 + acpi_ut_remove_reference(obj_desc); 161 + return_ACPI_STATUS(status); 162 + } 163 + 164 + /******************************************************************************* 165 + * 166 + * FUNCTION: acpi_ut_execute_UID 167 + * 168 + * PARAMETERS: device_node - Node for the device 169 + * return_id - Where the string UID is returned 170 + * 171 + * RETURN: Status 172 + * 173 + * DESCRIPTION: Executes the _UID control method that returns the unique 174 + * ID of the device. The UID is either a 64-bit Integer (NOT an 175 + * EISAID) or a string. Always returns a string. A 64-bit integer 176 + * is converted to a decimal string. 177 + * 178 + * NOTE: Internal function, no parameter validation 179 + * 180 + ******************************************************************************/ 181 + 182 + acpi_status 183 + acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 184 + struct acpica_device_id **return_id) 185 + { 186 + union acpi_operand_object *obj_desc; 187 + struct acpica_device_id *uid; 188 + u32 length; 189 + acpi_status status; 190 + 191 + ACPI_FUNCTION_TRACE(ut_execute_UID); 192 + 193 + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, 194 + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 195 + &obj_desc); 196 + if (ACPI_FAILURE(status)) { 197 + return_ACPI_STATUS(status); 198 + } 199 + 200 + /* Get the size of the String to be returned, includes null terminator */ 201 + 202 + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 203 + length = ACPI_MAX64_DECIMAL_DIGITS + 1; 204 + } else { 205 + length = obj_desc->string.length + 1; 206 + } 207 + 208 + /* Allocate a buffer for the UID */ 209 + 210 + uid = 211 + ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 212 + (acpi_size) length); 213 + if (!uid) { 214 + status = AE_NO_MEMORY; 215 + goto cleanup; 216 + } 217 + 218 + /* Area for the string starts after DEVICE_ID struct */ 219 + 220 + uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id)); 221 + 222 + /* Convert an Integer to string, or just copy an existing string */ 223 + 224 + if (obj_desc->common.type == ACPI_TYPE_INTEGER) { 225 + acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); 226 + } else { 227 + acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer); 228 + } 229 + 230 + uid->length = length; 231 + *return_id = uid; 232 + 233 + cleanup: 234 + 235 + /* On exit, we must delete the return object */ 236 + 237 + acpi_ut_remove_reference(obj_desc); 238 + return_ACPI_STATUS(status); 239 + } 240 + 241 + /******************************************************************************* 242 + * 243 + * FUNCTION: acpi_ut_execute_CID 244 + * 245 + * PARAMETERS: device_node - Node for the device 246 + * return_cid_list - Where the CID list is returned 247 + * 248 + * RETURN: Status, list of CID strings 249 + * 250 + * DESCRIPTION: Executes the _CID control method that returns one or more 251 + * compatible hardware IDs for the device. 252 + * 253 + * NOTE: Internal function, no parameter validation 254 + * 255 + * A _CID method can return either a single compatible ID or a package of 256 + * compatible IDs. Each compatible ID can be one of the following: 257 + * 1) Integer (32 bit compressed EISA ID) or 258 + * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") 259 + * 260 + * The Integer CIDs are converted to string format by this function. 261 + * 262 + ******************************************************************************/ 263 + 264 + acpi_status 265 + acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 266 + struct acpica_device_id_list **return_cid_list) 267 + { 268 + union acpi_operand_object **cid_objects; 269 + union acpi_operand_object *obj_desc; 270 + struct acpica_device_id_list *cid_list; 271 + char *next_id_string; 272 + u32 string_area_size; 273 + u32 length; 274 + u32 cid_list_size; 275 + acpi_status status; 276 + u32 count; 277 + u32 i; 278 + 279 + ACPI_FUNCTION_TRACE(ut_execute_CID); 280 + 281 + /* Evaluate the _CID method for this device */ 282 + 283 + status = acpi_ut_evaluate_object(device_node, METHOD_NAME__CID, 284 + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING 285 + | ACPI_BTYPE_PACKAGE, &obj_desc); 286 + if (ACPI_FAILURE(status)) { 287 + return_ACPI_STATUS(status); 288 + } 289 + 290 + /* 291 + * Get the count and size of the returned _CIDs. _CID can return either 292 + * a Package of Integers/Strings or a single Integer or String. 293 + * Note: This section also validates that all CID elements are of the 294 + * correct type (Integer or String). 295 + */ 296 + if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { 297 + count = obj_desc->package.count; 298 + cid_objects = obj_desc->package.elements; 299 + } else { /* Single Integer or String CID */ 300 + 301 + count = 1; 302 + cid_objects = &obj_desc; 303 + } 304 + 305 + string_area_size = 0; 306 + for (i = 0; i < count; i++) { 307 + 308 + /* String lengths include null terminator */ 309 + 310 + switch (cid_objects[i]->common.type) { 311 + case ACPI_TYPE_INTEGER: 312 + string_area_size += ACPI_EISAID_STRING_SIZE; 313 + break; 314 + 315 + case ACPI_TYPE_STRING: 316 + string_area_size += cid_objects[i]->string.length + 1; 317 + break; 318 + 319 + default: 320 + status = AE_TYPE; 321 + goto cleanup; 322 + } 323 + } 324 + 325 + /* 326 + * Now that we know the length of the CIDs, allocate return buffer: 327 + * 1) Size of the base structure + 328 + * 2) Size of the CID DEVICE_ID array + 329 + * 3) Size of the actual CID strings 330 + */ 331 + cid_list_size = sizeof(struct acpica_device_id_list) + 332 + ((count - 1) * sizeof(struct acpica_device_id)) + string_area_size; 333 + 334 + cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size); 335 + if (!cid_list) { 336 + status = AE_NO_MEMORY; 337 + goto cleanup; 338 + } 339 + 340 + /* Area for CID strings starts after the CID DEVICE_ID array */ 341 + 342 + next_id_string = ACPI_CAST_PTR(char, cid_list->ids) + 343 + ((acpi_size) count * sizeof(struct acpica_device_id)); 344 + 345 + /* Copy/convert the CIDs to the return buffer */ 346 + 347 + for (i = 0; i < count; i++) { 348 + if (cid_objects[i]->common.type == ACPI_TYPE_INTEGER) { 349 + 350 + /* Convert the Integer (EISAID) CID to a string */ 351 + 352 + acpi_ex_eisa_id_to_string(next_id_string, 353 + cid_objects[i]->integer. 354 + value); 355 + length = ACPI_EISAID_STRING_SIZE; 356 + } else { /* ACPI_TYPE_STRING */ 357 + 358 + /* Copy the String CID from the returned object */ 359 + 360 + acpi_ut_copy_id_string(next_id_string, 361 + cid_objects[i]->string.pointer); 362 + length = cid_objects[i]->string.length + 1; 363 + } 364 + 365 + cid_list->ids[i].string = next_id_string; 366 + cid_list->ids[i].length = length; 367 + next_id_string += length; 368 + } 369 + 370 + /* Finish the CID list */ 371 + 372 + cid_list->count = count; 373 + cid_list->list_size = cid_list_size; 374 + *return_cid_list = cid_list; 375 + 376 + cleanup: 377 + 378 + /* On exit, we must delete the _CID return object */ 379 + 380 + acpi_ut_remove_reference(obj_desc); 381 + return_ACPI_STATUS(status); 382 + }
+4 -18
drivers/acpi/acpica/utinit.c
··· 99 99 * 100 100 * FUNCTION: acpi_ut_subsystem_shutdown 101 101 * 102 - * PARAMETERS: none 102 + * PARAMETERS: None 103 103 * 104 - * RETURN: none 104 + * RETURN: None 105 105 * 106 - * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex 107 - * objects here -- because the AML debugger may be still running. 106 + * DESCRIPTION: Shutdown the various components. Do not delete the mutex 107 + * objects here, because the AML debugger may be still running. 108 108 * 109 109 ******************************************************************************/ 110 110 111 111 void acpi_ut_subsystem_shutdown(void) 112 112 { 113 - 114 113 ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); 115 - 116 - /* Just exit if subsystem is already shutdown */ 117 - 118 - if (acpi_gbl_shutdown) { 119 - ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated")); 120 - return_VOID; 121 - } 122 - 123 - /* Subsystem appears active, go ahead and shut it down */ 124 - 125 - acpi_gbl_shutdown = TRUE; 126 - acpi_gbl_startup_flags = 0; 127 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); 128 114 129 115 #ifndef ACPI_ASL_COMPILER 130 116
+79 -6
drivers/acpi/acpica/utmisc.c
··· 50 50 #define _COMPONENT ACPI_UTILITIES 51 51 ACPI_MODULE_NAME("utmisc") 52 52 53 + /* 54 + * Common suffix for messages 55 + */ 56 + #define ACPI_COMMON_MSG_SUFFIX \ 57 + acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) 53 58 /******************************************************************************* 54 59 * 55 60 * FUNCTION: acpi_ut_validate_exception ··· 121 116 } 122 117 123 118 return (ACPI_CAST_PTR(const char, exception)); 119 + } 120 + 121 + /******************************************************************************* 122 + * 123 + * FUNCTION: acpi_ut_is_pci_root_bridge 124 + * 125 + * PARAMETERS: Id - The HID/CID in string format 126 + * 127 + * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge 128 + * 129 + * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. 130 + * 131 + ******************************************************************************/ 132 + 133 + u8 acpi_ut_is_pci_root_bridge(char *id) 134 + { 135 + 136 + /* 137 + * Check if this is a PCI root bridge. 138 + * ACPI 3.0+: check for a PCI Express root also. 139 + */ 140 + if (!(ACPI_STRCMP(id, 141 + PCI_ROOT_HID_STRING)) || 142 + !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) { 143 + return (TRUE); 144 + } 145 + 146 + return (FALSE); 124 147 } 125 148 126 149 /******************************************************************************* ··· 1070 1037 1071 1038 va_start(args, format); 1072 1039 acpi_os_vprintf(format, args); 1073 - acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1074 - line_number); 1040 + ACPI_COMMON_MSG_SUFFIX; 1075 1041 va_end(args); 1076 1042 } 1077 1043 ··· 1084 1052 1085 1053 va_start(args, format); 1086 1054 acpi_os_vprintf(format, args); 1087 - acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1088 - line_number); 1055 + ACPI_COMMON_MSG_SUFFIX; 1089 1056 va_end(args); 1090 1057 } 1091 1058 ··· 1097 1066 1098 1067 va_start(args, format); 1099 1068 acpi_os_vprintf(format, args); 1100 - acpi_os_printf(" %8.8X %s-%u\n", ACPI_CA_VERSION, module_name, 1101 - line_number); 1069 + ACPI_COMMON_MSG_SUFFIX; 1102 1070 va_end(args); 1103 1071 } 1104 1072 ··· 1118 1088 ACPI_EXPORT_SYMBOL(acpi_exception) 1119 1089 ACPI_EXPORT_SYMBOL(acpi_warning) 1120 1090 ACPI_EXPORT_SYMBOL(acpi_info) 1091 + 1092 + /******************************************************************************* 1093 + * 1094 + * FUNCTION: acpi_ut_predefined_warning 1095 + * 1096 + * PARAMETERS: module_name - Caller's module name (for error output) 1097 + * line_number - Caller's line number (for error output) 1098 + * Pathname - Full pathname to the node 1099 + * node_flags - From Namespace node for the method/object 1100 + * Format - Printf format string + additional args 1101 + * 1102 + * RETURN: None 1103 + * 1104 + * DESCRIPTION: Warnings for the predefined validation module. Messages are 1105 + * only emitted the first time a problem with a particular 1106 + * method/object is detected. This prevents a flood of error 1107 + * messages for methods that are repeatedly evaluated. 1108 + * 1109 + ******************************************************************************/ 1110 + 1111 + void ACPI_INTERNAL_VAR_XFACE 1112 + acpi_ut_predefined_warning(const char *module_name, 1113 + u32 line_number, 1114 + char *pathname, 1115 + u8 node_flags, const char *format, ...) 1116 + { 1117 + va_list args; 1118 + 1119 + /* 1120 + * Warning messages for this method/object will be disabled after the 1121 + * first time a validation fails or an object is successfully repaired. 1122 + */ 1123 + if (node_flags & ANOBJ_EVALUATED) { 1124 + return; 1125 + } 1126 + 1127 + acpi_os_printf("ACPI Warning for %s: ", pathname); 1128 + 1129 + va_start(args, format); 1130 + acpi_os_vprintf(format, args); 1131 + ACPI_COMMON_MSG_SUFFIX; 1132 + va_end(args); 1133 + }
+25 -1
drivers/acpi/acpica/utxface.c
··· 251 251 } 252 252 253 253 /* 254 + * Execute any module-level code that was detected during the table load 255 + * phase. Although illegal since ACPI 2.0, there are many machines that 256 + * contain this type of code. Each block of detected executable AML code 257 + * outside of any control method is wrapped with a temporary control 258 + * method object and placed on a global list. The methods on this list 259 + * are executed below. 260 + */ 261 + acpi_ns_exec_module_code_list(); 262 + 263 + /* 254 264 * Initialize the objects that remain uninitialized. This runs the 255 265 * executable AML that may be part of the declaration of these objects: 256 266 * operation_regions, buffer_fields, Buffers, and Packages. ··· 328 318 * 329 319 * RETURN: Status 330 320 * 331 - * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. 321 + * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. 332 322 * 333 323 ******************************************************************************/ 334 324 acpi_status acpi_terminate(void) ··· 336 326 acpi_status status; 337 327 338 328 ACPI_FUNCTION_TRACE(acpi_terminate); 329 + 330 + /* Just exit if subsystem is already shutdown */ 331 + 332 + if (acpi_gbl_shutdown) { 333 + ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated")); 334 + return_ACPI_STATUS(AE_OK); 335 + } 336 + 337 + /* Subsystem appears active, go ahead and shut it down */ 338 + 339 + acpi_gbl_shutdown = TRUE; 340 + acpi_gbl_startup_flags = 0; 341 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); 339 342 340 343 /* Terminate the AML Debugger if present */ 341 344 ··· 376 353 } 377 354 378 355 ACPI_EXPORT_SYMBOL(acpi_terminate) 356 + 379 357 #ifndef ACPI_ASL_COMPILER 380 358 #ifdef ACPI_FUTURE_USAGE 381 359 /*******************************************************************************
+22
drivers/acpi/battery.c
··· 31 31 #include <linux/types.h> 32 32 #include <linux/jiffies.h> 33 33 #include <linux/async.h> 34 + #include <linux/dmi.h> 34 35 35 36 #ifdef CONFIG_ACPI_PROCFS_POWER 36 37 #include <linux/proc_fs.h> ··· 45 44 #ifdef CONFIG_ACPI_SYSFS_POWER 46 45 #include <linux/power_supply.h> 47 46 #endif 47 + 48 + #define PREFIX "ACPI: " 48 49 49 50 #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 50 51 ··· 88 85 89 86 MODULE_DEVICE_TABLE(acpi, battery_device_ids); 90 87 88 + /* For buggy DSDTs that report negative 16-bit values for either charging 89 + * or discharging current and/or report 0 as 65536 due to bad math. 90 + */ 91 + #define QUIRK_SIGNED16_CURRENT 0x0001 91 92 92 93 struct acpi_battery { 93 94 struct mutex lock; ··· 119 112 int state; 120 113 int power_unit; 121 114 u8 alarm_present; 115 + long quirks; 122 116 }; 123 117 124 118 #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); ··· 398 390 state_offsets, ARRAY_SIZE(state_offsets)); 399 391 battery->update_time = jiffies; 400 392 kfree(buffer.pointer); 393 + 394 + if ((battery->quirks & QUIRK_SIGNED16_CURRENT) && 395 + battery->rate_now != -1) 396 + battery->rate_now = abs((s16)battery->rate_now); 397 + 401 398 return result; 402 399 } 403 400 ··· 508 495 } 509 496 #endif 510 497 498 + static void acpi_battery_quirks(struct acpi_battery *battery) 499 + { 500 + battery->quirks = 0; 501 + if (dmi_name_in_vendors("Acer") && battery->power_unit) { 502 + battery->quirks |= QUIRK_SIGNED16_CURRENT; 503 + } 504 + } 505 + 511 506 static int acpi_battery_update(struct acpi_battery *battery) 512 507 { 513 508 int result, old_present = acpi_battery_present(battery); ··· 534 513 result = acpi_battery_get_info(battery); 535 514 if (result) 536 515 return result; 516 + acpi_battery_quirks(battery); 537 517 acpi_battery_init_alarm(battery); 538 518 } 539 519 #ifdef CONFIG_ACPI_SYSFS_POWER
+2
drivers/acpi/blacklist.c
··· 34 34 #include <acpi/acpi_bus.h> 35 35 #include <linux/dmi.h> 36 36 37 + #include "internal.h" 38 + 37 39 enum acpi_blacklist_predicates { 38 40 all_versions, 39 41 less_than_or_equal,
+2 -1
drivers/acpi/bus.c
··· 38 38 #include <linux/pci.h> 39 39 #include <acpi/acpi_bus.h> 40 40 #include <acpi/acpi_drivers.h> 41 + #include <linux/dmi.h> 41 42 42 43 #include "internal.h" 43 44 ··· 142 141 EXPORT_SYMBOL(acpi_bus_get_status); 143 142 144 143 void acpi_bus_private_data_handler(acpi_handle handle, 145 - u32 function, void *context) 144 + void *context) 146 145 { 147 146 return; 148 147 }
+2
drivers/acpi/button.c
··· 33 33 #include <acpi/acpi_bus.h> 34 34 #include <acpi/acpi_drivers.h> 35 35 36 + #define PREFIX "ACPI: " 37 + 36 38 #define ACPI_BUTTON_CLASS "button" 37 39 #define ACPI_BUTTON_FILE_INFO "info" 38 40 #define ACPI_BUTTON_FILE_STATE "state"
+2
drivers/acpi/cm_sbs.c
··· 28 28 #include <acpi/acpi_bus.h> 29 29 #include <acpi/acpi_drivers.h> 30 30 31 + #define PREFIX "ACPI: " 32 + 31 33 ACPI_MODULE_NAME("cm_sbs"); 32 34 #define ACPI_AC_CLASS "ac_adapter" 33 35 #define ACPI_BATTERY_CLASS "battery"
+6 -7
drivers/acpi/container.c
··· 35 35 #include <acpi/acpi_drivers.h> 36 36 #include <acpi/container.h> 37 37 38 + #define PREFIX "ACPI: " 39 + 38 40 #define ACPI_CONTAINER_DEVICE_NAME "ACPI container device" 39 41 #define ACPI_CONTAINER_CLASS "container" 40 42 ··· 202 200 u32 lvl, void *context, void **rv) 203 201 { 204 202 char *hid = NULL; 205 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 206 203 struct acpi_device_info *info; 207 204 acpi_status status; 208 205 int *action = context; 209 206 210 - 211 - status = acpi_get_object_info(handle, &buffer); 212 - if (ACPI_FAILURE(status) || !buffer.pointer) { 207 + status = acpi_get_object_info(handle, &info); 208 + if (ACPI_FAILURE(status)) { 213 209 return AE_OK; 214 210 } 215 211 216 - info = buffer.pointer; 217 212 if (info->valid & ACPI_VALID_HID) 218 - hid = info->hardware_id.value; 213 + hid = info->hardware_id.string; 219 214 220 215 if (hid == NULL) { 221 216 goto end; ··· 239 240 } 240 241 241 242 end: 242 - kfree(buffer.pointer); 243 + kfree(info); 243 244 244 245 return AE_OK; 245 246 }
+35 -49
drivers/acpi/debug.c
··· 3 3 */ 4 4 5 5 #include <linux/proc_fs.h> 6 + #include <linux/seq_file.h> 6 7 #include <linux/init.h> 7 8 #include <linux/module.h> 8 9 #include <linux/kernel.h> ··· 202 201 #define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer" 203 202 #define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level" 204 203 205 - static int 206 - acpi_system_read_debug(char *page, 207 - char **start, off_t off, int count, int *eof, void *data) 204 + static int acpi_system_debug_proc_show(struct seq_file *m, void *v) 208 205 { 209 - char *p = page; 210 - int size = 0; 211 206 unsigned int i; 212 207 213 - if (off != 0) 214 - goto end; 208 + seq_printf(m, "%-25s\tHex SET\n", "Description"); 215 209 216 - p += sprintf(p, "%-25s\tHex SET\n", "Description"); 217 - 218 - switch ((unsigned long)data) { 210 + switch ((unsigned long)m->private) { 219 211 case 0: 220 212 for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) { 221 - p += sprintf(p, "%-25s\t0x%08lX [%c]\n", 213 + seq_printf(m, "%-25s\t0x%08lX [%c]\n", 222 214 acpi_debug_layers[i].name, 223 215 acpi_debug_layers[i].value, 224 216 (acpi_dbg_layer & acpi_debug_layers[i]. 225 217 value) ? '*' : ' '); 226 218 } 227 - p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS", 219 + seq_printf(m, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS", 228 220 ACPI_ALL_DRIVERS, 229 221 (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 230 222 ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer & 231 223 ACPI_ALL_DRIVERS) == 232 224 0 ? ' ' : '-'); 233 - p += sprintf(p, 225 + seq_printf(m, 234 226 "--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n", 235 227 acpi_dbg_layer); 236 228 break; 237 229 case 1: 238 230 for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) { 239 - p += sprintf(p, "%-25s\t0x%08lX [%c]\n", 231 + seq_printf(m, "%-25s\t0x%08lX [%c]\n", 240 232 acpi_debug_levels[i].name, 241 233 acpi_debug_levels[i].value, 242 234 (acpi_dbg_level & acpi_debug_levels[i]. 243 235 value) ? '*' : ' '); 244 236 } 245 - p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n", 237 + seq_printf(m, "--\ndebug_level = 0x%08X (* = enabled)\n", 246 238 acpi_dbg_level); 247 239 break; 248 - default: 249 - p += sprintf(p, "Invalid debug option\n"); 250 - break; 251 240 } 252 - 253 - end: 254 - size = (p - page); 255 - if (size <= off + count) 256 - *eof = 1; 257 - *start = page + off; 258 - size -= off; 259 - if (size > count) 260 - size = count; 261 - if (size < 0) 262 - size = 0; 263 - 264 - return size; 241 + return 0; 265 242 } 266 243 267 - static int 268 - acpi_system_write_debug(struct file *file, 244 + static int acpi_system_debug_proc_open(struct inode *inode, struct file *file) 245 + { 246 + return single_open(file, acpi_system_debug_proc_show, PDE(inode)->data); 247 + } 248 + 249 + static ssize_t acpi_system_debug_proc_write(struct file *file, 269 250 const char __user * buffer, 270 - unsigned long count, void *data) 251 + size_t count, loff_t *pos) 271 252 { 272 253 char debug_string[12] = { '\0' }; 273 254 ··· 262 279 263 280 debug_string[count] = '\0'; 264 281 265 - switch ((unsigned long)data) { 282 + switch ((unsigned long)PDE(file->f_path.dentry->d_inode)->data) { 266 283 case 0: 267 284 acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0); 268 285 break; ··· 275 292 276 293 return count; 277 294 } 295 + 296 + static const struct file_operations acpi_system_debug_proc_fops = { 297 + .owner = THIS_MODULE, 298 + .open = acpi_system_debug_proc_open, 299 + .read = seq_read, 300 + .llseek = seq_lseek, 301 + .release = single_release, 302 + .write = acpi_system_debug_proc_write, 303 + }; 278 304 #endif 279 305 280 306 int __init acpi_debug_init(void) ··· 295 303 296 304 /* 'debug_layer' [R/W] */ 297 305 name = ACPI_SYSTEM_FILE_DEBUG_LAYER; 298 - entry = 299 - create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, 300 - acpi_root_dir, acpi_system_read_debug, 301 - (void *)0); 302 - if (entry) 303 - entry->write_proc = acpi_system_write_debug; 304 - else 306 + entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, 307 + acpi_root_dir, &acpi_system_debug_proc_fops, 308 + (void *)0); 309 + if (!entry) 305 310 goto Error; 306 311 307 312 /* 'debug_level' [R/W] */ 308 313 name = ACPI_SYSTEM_FILE_DEBUG_LEVEL; 309 - entry = 310 - create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, 311 - acpi_root_dir, acpi_system_read_debug, 312 - (void *)1); 313 - if (entry) 314 - entry->write_proc = acpi_system_write_debug; 315 - else 314 + entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR, 315 + acpi_root_dir, &acpi_system_debug_proc_fops, 316 + (void *)1); 317 + if (!entry) 316 318 goto Error; 317 319 318 320 Done:
+5 -5
drivers/acpi/dock.c
··· 33 33 #include <acpi/acpi_bus.h> 34 34 #include <acpi/acpi_drivers.h> 35 35 36 + #define PREFIX "ACPI: " 37 + 36 38 #define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver" 37 39 38 40 ACPI_MODULE_NAME("dock"); ··· 233 231 static int is_battery(acpi_handle handle) 234 232 { 235 233 struct acpi_device_info *info; 236 - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 237 234 int ret = 1; 238 235 239 - if (!ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) 236 + if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) 240 237 return 0; 241 - info = buffer.pointer; 242 238 if (!(info->valid & ACPI_VALID_HID)) 243 239 ret = 0; 244 240 else 245 - ret = !strcmp("PNP0C0A", info->hardware_id.value); 241 + ret = !strcmp("PNP0C0A", info->hardware_id.string); 246 242 247 - kfree(buffer.pointer); 243 + kfree(info); 248 244 return ret; 249 245 } 250 246
+134 -214
drivers/acpi/ec.c
··· 42 42 #include <asm/io.h> 43 43 #include <acpi/acpi_bus.h> 44 44 #include <acpi/acpi_drivers.h> 45 + #include <linux/dmi.h> 45 46 46 47 #define ACPI_EC_CLASS "embedded_controller" 47 48 #define ACPI_EC_DEVICE_NAME "Embedded Controller" 48 49 #define ACPI_EC_FILE_INFO "info" 49 50 50 - #undef PREFIX 51 51 #define PREFIX "ACPI: EC: " 52 52 53 53 /* EC status register */ ··· 68 68 #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ 69 69 #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ 70 70 #define ACPI_EC_CDELAY 10 /* Wait 10us before polling EC */ 71 + #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */ 71 72 72 73 #define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts 73 74 per one transaction */ 74 75 75 76 enum { 76 77 EC_FLAGS_QUERY_PENDING, /* Query is pending */ 77 - EC_FLAGS_GPE_MODE, /* Expect GPE to be sent 78 - * for status change */ 79 - EC_FLAGS_NO_GPE, /* Don't use GPE mode */ 80 78 EC_FLAGS_GPE_STORM, /* GPE storm detected */ 81 79 EC_FLAGS_HANDLERS_INSTALLED /* Handlers for GPE and 82 80 * OpReg are installed */ ··· 168 170 acpi_ec_write_cmd(ec, ec->curr->command); 169 171 } 170 172 171 - static void gpe_transaction(struct acpi_ec *ec, u8 status) 173 + static void advance_transaction(struct acpi_ec *ec, u8 status) 172 174 { 173 175 unsigned long flags; 174 176 spin_lock_irqsave(&ec->curr_lock, flags); ··· 199 201 spin_unlock_irqrestore(&ec->curr_lock, flags); 200 202 } 201 203 202 - static int acpi_ec_wait(struct acpi_ec *ec) 203 - { 204 - if (wait_event_timeout(ec->wait, ec_transaction_done(ec), 205 - msecs_to_jiffies(ACPI_EC_DELAY))) 206 - return 0; 207 - /* try restart command if we get any false interrupts */ 208 - if (ec->curr->irq_count && 209 - (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { 210 - pr_debug(PREFIX "controller reset, restart transaction\n"); 211 - start_transaction(ec); 212 - if (wait_event_timeout(ec->wait, ec_transaction_done(ec), 213 - msecs_to_jiffies(ACPI_EC_DELAY))) 214 - return 0; 215 - } 216 - /* missing GPEs, switch back to poll mode */ 217 - if (printk_ratelimit()) 218 - pr_info(PREFIX "missing confirmations, " 219 - "switch off interrupt mode.\n"); 220 - set_bit(EC_FLAGS_NO_GPE, &ec->flags); 221 - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); 222 - return 1; 223 - } 224 - 225 204 static void acpi_ec_gpe_query(void *ec_cxt); 226 205 227 206 static int ec_check_sci(struct acpi_ec *ec, u8 state) ··· 211 236 return 0; 212 237 } 213 238 214 - static void ec_delay(void) 215 - { 216 - /* EC in MSI notebooks don't tolerate delays other than 550 usec */ 217 - if (EC_FLAGS_MSI) 218 - udelay(ACPI_EC_DELAY); 219 - else 220 - /* Use shortest sleep available */ 221 - msleep(1); 222 - } 223 - 224 239 static int ec_poll(struct acpi_ec *ec) 225 240 { 226 - unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 227 - udelay(ACPI_EC_CDELAY); 228 - while (time_before(jiffies, delay)) { 229 - gpe_transaction(ec, acpi_ec_read_status(ec)); 230 - ec_delay(); 231 - if (ec_transaction_done(ec)) 232 - return 0; 241 + unsigned long flags; 242 + int repeat = 2; /* number of command restarts */ 243 + while (repeat--) { 244 + unsigned long delay = jiffies + 245 + msecs_to_jiffies(ACPI_EC_DELAY); 246 + do { 247 + /* don't sleep with disabled interrupts */ 248 + if (EC_FLAGS_MSI || irqs_disabled()) { 249 + udelay(ACPI_EC_MSI_UDELAY); 250 + if (ec_transaction_done(ec)) 251 + return 0; 252 + } else { 253 + if (wait_event_timeout(ec->wait, 254 + ec_transaction_done(ec), 255 + msecs_to_jiffies(1))) 256 + return 0; 257 + } 258 + advance_transaction(ec, acpi_ec_read_status(ec)); 259 + } while (time_before(jiffies, delay)); 260 + if (!ec->curr->irq_count || 261 + (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)) 262 + break; 263 + /* try restart command if we get any false interrupts */ 264 + pr_debug(PREFIX "controller reset, restart transaction\n"); 265 + spin_lock_irqsave(&ec->curr_lock, flags); 266 + start_transaction(ec); 267 + spin_unlock_irqrestore(&ec->curr_lock, flags); 233 268 } 234 269 return -ETIME; 235 270 } 236 271 237 272 static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, 238 - struct transaction *t, 239 - int force_poll) 273 + struct transaction *t) 240 274 { 241 275 unsigned long tmp; 242 276 int ret = 0; 243 277 pr_debug(PREFIX "transaction start\n"); 244 278 /* disable GPE during transaction if storm is detected */ 245 279 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 246 - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); 247 280 acpi_disable_gpe(NULL, ec->gpe); 248 281 } 249 282 if (EC_FLAGS_MSI) 250 - udelay(ACPI_EC_DELAY); 283 + udelay(ACPI_EC_MSI_UDELAY); 251 284 /* start transaction */ 252 285 spin_lock_irqsave(&ec->curr_lock, tmp); 253 286 /* following two actions should be kept atomic */ ··· 264 281 if (ec->curr->command == ACPI_EC_COMMAND_QUERY) 265 282 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); 266 283 spin_unlock_irqrestore(&ec->curr_lock, tmp); 267 - /* if we selected poll mode or failed in GPE-mode do a poll loop */ 268 - if (force_poll || 269 - !test_bit(EC_FLAGS_GPE_MODE, &ec->flags) || 270 - acpi_ec_wait(ec)) 271 - ret = ec_poll(ec); 284 + ret = ec_poll(ec); 272 285 pr_debug(PREFIX "transaction end\n"); 273 286 spin_lock_irqsave(&ec->curr_lock, tmp); 274 287 ec->curr = NULL; ··· 274 295 ec_check_sci(ec, acpi_ec_read_status(ec)); 275 296 /* it is safe to enable GPE outside of transaction */ 276 297 acpi_enable_gpe(NULL, ec->gpe); 277 - } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && 278 - t->irq_count > ACPI_EC_STORM_THRESHOLD) { 298 + } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { 279 299 pr_info(PREFIX "GPE storm detected, " 280 300 "transactions will use polling mode\n"); 281 301 set_bit(EC_FLAGS_GPE_STORM, &ec->flags); ··· 292 314 { 293 315 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); 294 316 /* interrupt wait manually if GPE mode is not active */ 295 - unsigned long timeout = test_bit(EC_FLAGS_GPE_MODE, &ec->flags) ? 296 - msecs_to_jiffies(ACPI_EC_DELAY) : msecs_to_jiffies(1); 297 317 while (time_before(jiffies, delay)) 298 - if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), timeout)) 318 + if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), 319 + msecs_to_jiffies(1))) 299 320 return 0; 300 321 return -ETIME; 301 322 } 302 323 303 - static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t, 304 - int force_poll) 324 + static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) 305 325 { 306 326 int status; 307 327 u32 glk; ··· 321 345 status = -ETIME; 322 346 goto end; 323 347 } 324 - status = acpi_ec_transaction_unlocked(ec, t, force_poll); 348 + status = acpi_ec_transaction_unlocked(ec, t); 325 349 end: 326 350 if (ec->global_lock) 327 351 acpi_release_global_lock(glk); ··· 330 354 return status; 331 355 } 332 356 333 - /* 334 - * Note: samsung nv5000 doesn't work with ec burst mode. 335 - * http://bugzilla.kernel.org/show_bug.cgi?id=4980 336 - */ 337 357 static int acpi_ec_burst_enable(struct acpi_ec *ec) 338 358 { 339 359 u8 d; ··· 337 365 .wdata = NULL, .rdata = &d, 338 366 .wlen = 0, .rlen = 1}; 339 367 340 - return acpi_ec_transaction(ec, &t, 0); 368 + return acpi_ec_transaction(ec, &t); 341 369 } 342 370 343 371 static int acpi_ec_burst_disable(struct acpi_ec *ec) ··· 347 375 .wlen = 0, .rlen = 0}; 348 376 349 377 return (acpi_ec_read_status(ec) & ACPI_EC_FLAG_BURST) ? 350 - acpi_ec_transaction(ec, &t, 0) : 0; 378 + acpi_ec_transaction(ec, &t) : 0; 351 379 } 352 380 353 381 static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) ··· 358 386 .wdata = &address, .rdata = &d, 359 387 .wlen = 1, .rlen = 1}; 360 388 361 - result = acpi_ec_transaction(ec, &t, 0); 389 + result = acpi_ec_transaction(ec, &t); 362 390 *data = d; 363 391 return result; 364 392 } ··· 370 398 .wdata = wdata, .rdata = NULL, 371 399 .wlen = 2, .rlen = 0}; 372 400 373 - return acpi_ec_transaction(ec, &t, 0); 401 + return acpi_ec_transaction(ec, &t); 374 402 } 375 403 376 404 /* ··· 438 466 if (!first_ec) 439 467 return -ENODEV; 440 468 441 - return acpi_ec_transaction(first_ec, &t, force_poll); 469 + return acpi_ec_transaction(first_ec, &t); 442 470 } 443 471 444 472 EXPORT_SYMBOL(ec_transaction); ··· 459 487 * bit to be cleared (and thus clearing the interrupt source). 460 488 */ 461 489 462 - result = acpi_ec_transaction(ec, &t, 0); 490 + result = acpi_ec_transaction(ec, &t); 463 491 if (result) 464 492 return result; 465 493 ··· 542 570 pr_debug(PREFIX "~~~> interrupt\n"); 543 571 status = acpi_ec_read_status(ec); 544 572 545 - if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) { 546 - gpe_transaction(ec, status); 547 - if (ec_transaction_done(ec) && 548 - (status & ACPI_EC_FLAG_IBF) == 0) 549 - wake_up(&ec->wait); 550 - } 551 - 573 + advance_transaction(ec, status); 574 + if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) 575 + wake_up(&ec->wait); 552 576 ec_check_sci(ec, status); 553 - if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && 554 - !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) { 555 - /* this is non-query, must be confirmation */ 556 - if (!test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 557 - if (printk_ratelimit()) 558 - pr_info(PREFIX "non-query interrupt received," 559 - " switching to interrupt mode\n"); 560 - } else { 561 - /* hush, STORM switches the mode every transaction */ 562 - pr_debug(PREFIX "non-query interrupt received," 563 - " switching to interrupt mode\n"); 564 - } 565 - set_bit(EC_FLAGS_GPE_MODE, &ec->flags); 566 - } 567 577 return ACPI_INTERRUPT_HANDLED; 568 578 } 569 579 ··· 571 617 if (bits != 8 && acpi_strict) 572 618 return AE_BAD_PARAMETER; 573 619 574 - acpi_ec_burst_enable(ec); 620 + if (EC_FLAGS_MSI) 621 + acpi_ec_burst_enable(ec); 575 622 576 623 if (function == ACPI_READ) { 577 624 result = acpi_ec_read(ec, address, &temp); ··· 593 638 } 594 639 } 595 640 596 - acpi_ec_burst_disable(ec); 641 + if (EC_FLAGS_MSI) 642 + acpi_ec_burst_disable(ec); 597 643 598 644 switch (result) { 599 645 case -EINVAL: ··· 744 788 return AE_CTRL_TERMINATE; 745 789 } 746 790 747 - static void ec_remove_handlers(struct acpi_ec *ec) 748 - { 749 - if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 750 - ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 751 - pr_err(PREFIX "failed to remove space handler\n"); 752 - if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, 753 - &acpi_ec_gpe_handler))) 754 - pr_err(PREFIX "failed to remove gpe handler\n"); 755 - clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags); 756 - } 757 - 758 - static int acpi_ec_add(struct acpi_device *device) 759 - { 760 - struct acpi_ec *ec = NULL; 761 - 762 - if (!device) 763 - return -EINVAL; 764 - strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 765 - strcpy(acpi_device_class(device), ACPI_EC_CLASS); 766 - 767 - /* Check for boot EC */ 768 - if (boot_ec && 769 - (boot_ec->handle == device->handle || 770 - boot_ec->handle == ACPI_ROOT_OBJECT)) { 771 - ec = boot_ec; 772 - boot_ec = NULL; 773 - } else { 774 - ec = make_acpi_ec(); 775 - if (!ec) 776 - return -ENOMEM; 777 - } 778 - if (ec_parse_device(device->handle, 0, ec, NULL) != 779 - AE_CTRL_TERMINATE) { 780 - kfree(ec); 781 - return -EINVAL; 782 - } 783 - 784 - ec->handle = device->handle; 785 - 786 - /* Find and register all query methods */ 787 - acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, 788 - acpi_ec_register_query_methods, ec, NULL); 789 - 790 - if (!first_ec) 791 - first_ec = ec; 792 - device->driver_data = ec; 793 - acpi_ec_add_fs(device); 794 - pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 795 - ec->gpe, ec->command_addr, ec->data_addr); 796 - pr_info(PREFIX "driver started in %s mode\n", 797 - (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); 798 - return 0; 799 - } 800 - 801 - static int acpi_ec_remove(struct acpi_device *device, int type) 802 - { 803 - struct acpi_ec *ec; 804 - struct acpi_ec_query_handler *handler, *tmp; 805 - 806 - if (!device) 807 - return -EINVAL; 808 - 809 - ec = acpi_driver_data(device); 810 - mutex_lock(&ec->lock); 811 - list_for_each_entry_safe(handler, tmp, &ec->list, node) { 812 - list_del(&handler->node); 813 - kfree(handler); 814 - } 815 - mutex_unlock(&ec->lock); 816 - acpi_ec_remove_fs(device); 817 - device->driver_data = NULL; 818 - if (ec == first_ec) 819 - first_ec = NULL; 820 - kfree(ec); 821 - return 0; 822 - } 823 - 824 - static acpi_status 825 - ec_parse_io_ports(struct acpi_resource *resource, void *context) 826 - { 827 - struct acpi_ec *ec = context; 828 - 829 - if (resource->type != ACPI_RESOURCE_TYPE_IO) 830 - return AE_OK; 831 - 832 - /* 833 - * The first address region returned is the data port, and 834 - * the second address region returned is the status/command 835 - * port. 836 - */ 837 - if (ec->data_addr == 0) 838 - ec->data_addr = resource->data.io.minimum; 839 - else if (ec->command_addr == 0) 840 - ec->command_addr = resource->data.io.minimum; 841 - else 842 - return AE_CTRL_TERMINATE; 843 - 844 - return AE_OK; 845 - } 846 - 847 791 static int ec_install_handlers(struct acpi_ec *ec) 848 792 { 849 793 acpi_status status; ··· 780 924 return 0; 781 925 } 782 926 783 - static int acpi_ec_start(struct acpi_device *device) 927 + static void ec_remove_handlers(struct acpi_ec *ec) 784 928 { 785 - struct acpi_ec *ec; 786 - int ret = 0; 929 + if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 930 + ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 931 + pr_err(PREFIX "failed to remove space handler\n"); 932 + if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, 933 + &acpi_ec_gpe_handler))) 934 + pr_err(PREFIX "failed to remove gpe handler\n"); 935 + clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags); 936 + } 787 937 788 - if (!device) 789 - return -EINVAL; 938 + static int acpi_ec_add(struct acpi_device *device) 939 + { 940 + struct acpi_ec *ec = NULL; 941 + int ret; 790 942 791 - ec = acpi_driver_data(device); 943 + strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 944 + strcpy(acpi_device_class(device), ACPI_EC_CLASS); 792 945 793 - if (!ec) 794 - return -EINVAL; 946 + /* Check for boot EC */ 947 + if (boot_ec && 948 + (boot_ec->handle == device->handle || 949 + boot_ec->handle == ACPI_ROOT_OBJECT)) { 950 + ec = boot_ec; 951 + boot_ec = NULL; 952 + } else { 953 + ec = make_acpi_ec(); 954 + if (!ec) 955 + return -ENOMEM; 956 + } 957 + if (ec_parse_device(device->handle, 0, ec, NULL) != 958 + AE_CTRL_TERMINATE) { 959 + kfree(ec); 960 + return -EINVAL; 961 + } 962 + 963 + ec->handle = device->handle; 964 + 965 + /* Find and register all query methods */ 966 + acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, 967 + acpi_ec_register_query_methods, ec, NULL); 968 + 969 + if (!first_ec) 970 + first_ec = ec; 971 + device->driver_data = ec; 972 + acpi_ec_add_fs(device); 973 + pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 974 + ec->gpe, ec->command_addr, ec->data_addr); 795 975 796 976 ret = ec_install_handlers(ec); 797 977 ··· 836 944 return ret; 837 945 } 838 946 839 - static int acpi_ec_stop(struct acpi_device *device, int type) 947 + static int acpi_ec_remove(struct acpi_device *device, int type) 840 948 { 841 949 struct acpi_ec *ec; 950 + struct acpi_ec_query_handler *handler, *tmp; 951 + 842 952 if (!device) 843 953 return -EINVAL; 844 - ec = acpi_driver_data(device); 845 - if (!ec) 846 - return -EINVAL; 847 - ec_remove_handlers(ec); 848 954 955 + ec = acpi_driver_data(device); 956 + ec_remove_handlers(ec); 957 + mutex_lock(&ec->lock); 958 + list_for_each_entry_safe(handler, tmp, &ec->list, node) { 959 + list_del(&handler->node); 960 + kfree(handler); 961 + } 962 + mutex_unlock(&ec->lock); 963 + acpi_ec_remove_fs(device); 964 + device->driver_data = NULL; 965 + if (ec == first_ec) 966 + first_ec = NULL; 967 + kfree(ec); 849 968 return 0; 969 + } 970 + 971 + static acpi_status 972 + ec_parse_io_ports(struct acpi_resource *resource, void *context) 973 + { 974 + struct acpi_ec *ec = context; 975 + 976 + if (resource->type != ACPI_RESOURCE_TYPE_IO) 977 + return AE_OK; 978 + 979 + /* 980 + * The first address region returned is the data port, and 981 + * the second address region returned is the status/command 982 + * port. 983 + */ 984 + if (ec->data_addr == 0) 985 + ec->data_addr = resource->data.io.minimum; 986 + else if (ec->command_addr == 0) 987 + ec->command_addr = resource->data.io.minimum; 988 + else 989 + return AE_CTRL_TERMINATE; 990 + 991 + return AE_OK; 850 992 } 851 993 852 994 int __init acpi_boot_ec_enable(void) ··· 980 1054 { 981 1055 struct acpi_ec *ec = acpi_driver_data(device); 982 1056 /* Stop using GPE */ 983 - set_bit(EC_FLAGS_NO_GPE, &ec->flags); 984 - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); 985 1057 acpi_disable_gpe(NULL, ec->gpe); 986 1058 return 0; 987 1059 } ··· 988 1064 { 989 1065 struct acpi_ec *ec = acpi_driver_data(device); 990 1066 /* Enable use of GPE back */ 991 - clear_bit(EC_FLAGS_NO_GPE, &ec->flags); 992 - set_bit(EC_FLAGS_GPE_MODE, &ec->flags); 993 1067 acpi_enable_gpe(NULL, ec->gpe); 994 1068 return 0; 995 1069 } ··· 999 1077 .ops = { 1000 1078 .add = acpi_ec_add, 1001 1079 .remove = acpi_ec_remove, 1002 - .start = acpi_ec_start, 1003 - .stop = acpi_ec_stop, 1004 1080 .suspend = acpi_ec_suspend, 1005 1081 .resume = acpi_ec_resume, 1006 1082 },
+2
drivers/acpi/event.c
··· 14 14 #include <net/netlink.h> 15 15 #include <net/genetlink.h> 16 16 17 + #include "internal.h" 18 + 17 19 #define _COMPONENT ACPI_SYSTEM_COMPONENT 18 20 ACPI_MODULE_NAME("event"); 19 21
+2
drivers/acpi/fan.c
··· 34 34 #include <acpi/acpi_bus.h> 35 35 #include <acpi/acpi_drivers.h> 36 36 37 + #define PREFIX "ACPI: " 38 + 37 39 #define ACPI_FAN_CLASS "fan" 38 40 #define ACPI_FAN_FILE_STATE "state" 39 41
+5 -5
drivers/acpi/glue.c
··· 12 12 #include <linux/rwsem.h> 13 13 #include <linux/acpi.h> 14 14 15 + #include "internal.h" 16 + 15 17 #define ACPI_GLUE_DEBUG 0 16 18 #if ACPI_GLUE_DEBUG 17 19 #define DBG(x...) printk(PREFIX x) ··· 95 93 { 96 94 acpi_status status; 97 95 struct acpi_device_info *info; 98 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 99 96 struct acpi_find_child *find = context; 100 97 101 - status = acpi_get_object_info(handle, &buffer); 98 + status = acpi_get_object_info(handle, &info); 102 99 if (ACPI_SUCCESS(status)) { 103 - info = buffer.pointer; 104 100 if (info->address == find->address) 105 101 find->handle = handle; 106 - kfree(buffer.pointer); 102 + kfree(info); 107 103 } 108 104 return AE_OK; 109 105 } ··· 121 121 122 122 /* Link ACPI devices with physical devices */ 123 123 static void acpi_glue_data_handler(acpi_handle handle, 124 - u32 function, void *context) 124 + void *context) 125 125 { 126 126 /* we provide an empty handler */ 127 127 }
+21 -1
drivers/acpi/internal.h
··· 1 - /* For use by Linux/ACPI infrastructure, not drivers */ 1 + /* 2 + * acpi/internal.h 3 + * For use by Linux/ACPI infrastructure, not drivers 4 + * 5 + * Copyright (c) 2009, Intel Corporation. 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms and conditions of the GNU General Public License, 9 + * version 2, as published by the Free Software Foundation. 10 + * 11 + * This program is distributed in the hope it will be useful, but WITHOUT 12 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 + * more details. 15 + * 16 + * You should have received a copy of the GNU General Public License along with 17 + * this program; if not, write to the Free Software Foundation, Inc., 18 + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 19 + */ 20 + 21 + #define PREFIX "ACPI: " 2 22 3 23 int init_acpi_device_notify(void); 4 24 int acpi_scan_init(void);
+2
drivers/acpi/numa.c
··· 30 30 #include <linux/acpi.h> 31 31 #include <acpi/acpi_bus.h> 32 32 33 + #define PREFIX "ACPI: " 34 + 33 35 #define ACPI_NUMA 0x80000000 34 36 #define _COMPONENT ACPI_NUMA 35 37 ACPI_MODULE_NAME("numa");
+97 -31
drivers/acpi/osl.c
··· 58 58 acpi_osd_exec_callback function; 59 59 void *context; 60 60 struct work_struct work; 61 + int wait; 61 62 }; 62 63 63 64 #ifdef CONFIG_ACPI_CUSTOM_DSDT ··· 89 88 char name[5]; /* only can have a length of 4 chars, make use of this 90 89 one instead of res->name, no need to kalloc then */ 91 90 struct list_head resource_list; 91 + int count; 92 92 }; 93 93 94 94 static LIST_HEAD(resource_list_head); ··· 699 697 static void acpi_os_execute_deferred(struct work_struct *work) 700 698 { 701 699 struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); 702 - if (!dpc) { 703 - printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); 704 - return; 705 - } 700 + 701 + if (dpc->wait) 702 + acpi_os_wait_events_complete(NULL); 706 703 707 704 dpc->function(dpc->context); 708 705 kfree(dpc); 709 - 710 - return; 711 - } 712 - 713 - static void acpi_os_execute_hp_deferred(struct work_struct *work) 714 - { 715 - struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); 716 - if (!dpc) { 717 - printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); 718 - return; 719 - } 720 - 721 - acpi_os_wait_events_complete(NULL); 722 - 723 - dpc->function(dpc->context); 724 - kfree(dpc); 725 - 726 - return; 727 706 } 728 707 729 708 /******************************************************************************* ··· 728 745 acpi_status status = AE_OK; 729 746 struct acpi_os_dpc *dpc; 730 747 struct workqueue_struct *queue; 731 - work_func_t func; 732 748 int ret; 733 749 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 734 750 "Scheduling function [%p(%p)] for deferred execution.\n", 735 751 function, context)); 736 - 737 - if (!function) 738 - return AE_BAD_PARAMETER; 739 752 740 753 /* 741 754 * Allocate/initialize DPC structure. Note that this memory will be ··· 757 778 */ 758 779 queue = hp ? kacpi_hotplug_wq : 759 780 (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); 760 - func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred; 761 - INIT_WORK(&dpc->work, func); 781 + dpc->wait = hp ? 1 : 0; 782 + INIT_WORK(&dpc->work, acpi_os_execute_deferred); 762 783 ret = queue_work(queue, &dpc->work); 763 784 764 785 if (!ret) { ··· 1337 1358 return AE_SUPPORT; 1338 1359 } 1339 1360 1361 + static inline int acpi_res_list_add(struct acpi_res_list *res) 1362 + { 1363 + struct acpi_res_list *res_list_elem; 1364 + 1365 + list_for_each_entry(res_list_elem, &resource_list_head, 1366 + resource_list) { 1367 + 1368 + if (res->resource_type == res_list_elem->resource_type && 1369 + res->start == res_list_elem->start && 1370 + res->end == res_list_elem->end) { 1371 + 1372 + /* 1373 + * The Region(addr,len) already exist in the list, 1374 + * just increase the count 1375 + */ 1376 + 1377 + res_list_elem->count++; 1378 + return 0; 1379 + } 1380 + } 1381 + 1382 + res->count = 1; 1383 + list_add(&res->resource_list, &resource_list_head); 1384 + return 1; 1385 + } 1386 + 1387 + static inline void acpi_res_list_del(struct acpi_res_list *res) 1388 + { 1389 + struct acpi_res_list *res_list_elem; 1390 + 1391 + list_for_each_entry(res_list_elem, &resource_list_head, 1392 + resource_list) { 1393 + 1394 + if (res->resource_type == res_list_elem->resource_type && 1395 + res->start == res_list_elem->start && 1396 + res->end == res_list_elem->end) { 1397 + 1398 + /* 1399 + * If the res count is decreased to 0, 1400 + * remove and free it 1401 + */ 1402 + 1403 + if (--res_list_elem->count == 0) { 1404 + list_del(&res_list_elem->resource_list); 1405 + kfree(res_list_elem); 1406 + } 1407 + return; 1408 + } 1409 + } 1410 + } 1411 + 1412 + acpi_status 1413 + acpi_os_invalidate_address( 1414 + u8 space_id, 1415 + acpi_physical_address address, 1416 + acpi_size length) 1417 + { 1418 + struct acpi_res_list res; 1419 + 1420 + switch (space_id) { 1421 + case ACPI_ADR_SPACE_SYSTEM_IO: 1422 + case ACPI_ADR_SPACE_SYSTEM_MEMORY: 1423 + /* Only interference checks against SystemIO and SytemMemory 1424 + are needed */ 1425 + res.start = address; 1426 + res.end = address + length - 1; 1427 + res.resource_type = space_id; 1428 + spin_lock(&acpi_res_lock); 1429 + acpi_res_list_del(&res); 1430 + spin_unlock(&acpi_res_lock); 1431 + break; 1432 + case ACPI_ADR_SPACE_PCI_CONFIG: 1433 + case ACPI_ADR_SPACE_EC: 1434 + case ACPI_ADR_SPACE_SMBUS: 1435 + case ACPI_ADR_SPACE_CMOS: 1436 + case ACPI_ADR_SPACE_PCI_BAR_TARGET: 1437 + case ACPI_ADR_SPACE_DATA_TABLE: 1438 + case ACPI_ADR_SPACE_FIXED_HARDWARE: 1439 + break; 1440 + } 1441 + return AE_OK; 1442 + } 1443 + 1340 1444 /****************************************************************************** 1341 1445 * 1342 1446 * FUNCTION: acpi_os_validate_address ··· 1444 1382 char *name) 1445 1383 { 1446 1384 struct acpi_res_list *res; 1385 + int added; 1447 1386 if (acpi_enforce_resources == ENFORCE_RESOURCES_NO) 1448 1387 return AE_OK; 1449 1388 ··· 1462 1399 res->end = address + length - 1; 1463 1400 res->resource_type = space_id; 1464 1401 spin_lock(&acpi_res_lock); 1465 - list_add(&res->resource_list, &resource_list_head); 1402 + added = acpi_res_list_add(res); 1466 1403 spin_unlock(&acpi_res_lock); 1467 - pr_debug("Added %s resource: start: 0x%llx, end: 0x%llx, " 1468 - "name: %s\n", (space_id == ACPI_ADR_SPACE_SYSTEM_IO) 1404 + pr_debug("%s %s resource: start: 0x%llx, end: 0x%llx, " 1405 + "name: %s\n", added ? "Added" : "Already exist", 1406 + (space_id == ACPI_ADR_SPACE_SYSTEM_IO) 1469 1407 ? "SystemIO" : "System Memory", 1470 1408 (unsigned long long)res->start, 1471 1409 (unsigned long long)res->end, 1472 1410 res->name); 1411 + if (!added) 1412 + kfree(res); 1473 1413 break; 1474 1414 case ACPI_ADR_SPACE_PCI_CONFIG: 1475 1415 case ACPI_ADR_SPACE_EC:
+2
drivers/acpi/pci_irq.c
··· 40 40 #include <acpi/acpi_bus.h> 41 41 #include <acpi/acpi_drivers.h> 42 42 43 + #define PREFIX "ACPI: " 44 + 43 45 #define _COMPONENT ACPI_PCI_COMPONENT 44 46 ACPI_MODULE_NAME("pci_irq"); 45 47
+2
drivers/acpi/pci_link.c
··· 43 43 #include <acpi/acpi_bus.h> 44 44 #include <acpi/acpi_drivers.h> 45 45 46 + #define PREFIX "ACPI: " 47 + 46 48 #define _COMPONENT ACPI_PCI_COMPONENT 47 49 ACPI_MODULE_NAME("pci_link"); 48 50 #define ACPI_PCI_LINK_CLASS "pci_irq_routing"
+2
drivers/acpi/pci_root.c
··· 36 36 #include <acpi/acpi_bus.h> 37 37 #include <acpi/acpi_drivers.h> 38 38 39 + #define PREFIX "ACPI: " 40 + 39 41 #define _COMPONENT ACPI_PCI_COMPONENT 40 42 ACPI_MODULE_NAME("pci_root"); 41 43 #define ACPI_PCI_ROOT_CLASS "pci_bridge"
+3 -2
drivers/acpi/pci_slot.c
··· 31 31 #include <linux/acpi.h> 32 32 #include <acpi/acpi_bus.h> 33 33 #include <acpi/acpi_drivers.h> 34 + #include <linux/dmi.h> 34 35 35 36 static int debug; 36 37 static int check_sta_before_sun; ··· 58 57 MY_NAME , ## arg); \ 59 58 } while (0) 60 59 61 - #define SLOT_NAME_SIZE 20 /* Inspired by #define in acpiphp.h */ 60 + #define SLOT_NAME_SIZE 21 /* Inspired by #define in acpiphp.h */ 62 61 63 62 struct acpi_pci_slot { 64 63 acpi_handle root_handle; /* handle of the root bridge */ ··· 150 149 return AE_OK; 151 150 } 152 151 153 - snprintf(name, sizeof(name), "%u", (u32)sun); 152 + snprintf(name, sizeof(name), "%llu", sun); 154 153 pci_slot = pci_create_slot(pci_bus, device, name, NULL); 155 154 if (IS_ERR(pci_slot)) { 156 155 err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot));
+2 -1
drivers/acpi/power.c
··· 43 43 #include <linux/seq_file.h> 44 44 #include <acpi/acpi_bus.h> 45 45 #include <acpi/acpi_drivers.h> 46 - 47 46 #include "sleep.h" 47 + 48 + #define PREFIX "ACPI: " 48 49 49 50 #define _COMPONENT ACPI_POWER_COMPONENT 50 51 ACPI_MODULE_NAME("power");
+1018
drivers/acpi/power_meter.c
··· 1 + /* 2 + * A hwmon driver for ACPI 4.0 power meters 3 + * Copyright (C) 2009 IBM 4 + * 5 + * Author: Darrick J. Wong <djwong@us.ibm.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 + */ 21 + 22 + #include <linux/module.h> 23 + #include <linux/hwmon.h> 24 + #include <linux/hwmon-sysfs.h> 25 + #include <linux/jiffies.h> 26 + #include <linux/mutex.h> 27 + #include <linux/dmi.h> 28 + #include <linux/kdev_t.h> 29 + #include <linux/sched.h> 30 + #include <linux/time.h> 31 + #include <acpi/acpi_drivers.h> 32 + #include <acpi/acpi_bus.h> 33 + 34 + #define ACPI_POWER_METER_NAME "power_meter" 35 + ACPI_MODULE_NAME(ACPI_POWER_METER_NAME); 36 + #define ACPI_POWER_METER_DEVICE_NAME "Power Meter" 37 + #define ACPI_POWER_METER_CLASS "power_meter_resource" 38 + 39 + #define NUM_SENSORS 17 40 + 41 + #define POWER_METER_CAN_MEASURE (1 << 0) 42 + #define POWER_METER_CAN_TRIP (1 << 1) 43 + #define POWER_METER_CAN_CAP (1 << 2) 44 + #define POWER_METER_CAN_NOTIFY (1 << 3) 45 + #define POWER_METER_IS_BATTERY (1 << 8) 46 + #define UNKNOWN_HYSTERESIS 0xFFFFFFFF 47 + 48 + #define METER_NOTIFY_CONFIG 0x80 49 + #define METER_NOTIFY_TRIP 0x81 50 + #define METER_NOTIFY_CAP 0x82 51 + #define METER_NOTIFY_CAPPING 0x83 52 + #define METER_NOTIFY_INTERVAL 0x84 53 + 54 + #define POWER_AVERAGE_NAME "power1_average" 55 + #define POWER_CAP_NAME "power1_cap" 56 + #define POWER_AVG_INTERVAL_NAME "power1_average_interval" 57 + #define POWER_ALARM_NAME "power1_alarm" 58 + 59 + static int cap_in_hardware; 60 + static int force_cap_on; 61 + 62 + static int can_cap_in_hardware(void) 63 + { 64 + return force_cap_on || cap_in_hardware; 65 + } 66 + 67 + static struct acpi_device_id power_meter_ids[] = { 68 + {"ACPI000D", 0}, 69 + {"", 0}, 70 + }; 71 + MODULE_DEVICE_TABLE(acpi, power_meter_ids); 72 + 73 + struct acpi_power_meter_capabilities { 74 + acpi_integer flags; 75 + acpi_integer units; 76 + acpi_integer type; 77 + acpi_integer accuracy; 78 + acpi_integer sampling_time; 79 + acpi_integer min_avg_interval; 80 + acpi_integer max_avg_interval; 81 + acpi_integer hysteresis; 82 + acpi_integer configurable_cap; 83 + acpi_integer min_cap; 84 + acpi_integer max_cap; 85 + }; 86 + 87 + struct acpi_power_meter_resource { 88 + struct acpi_device *acpi_dev; 89 + acpi_bus_id name; 90 + struct mutex lock; 91 + struct device *hwmon_dev; 92 + struct acpi_power_meter_capabilities caps; 93 + acpi_string model_number; 94 + acpi_string serial_number; 95 + acpi_string oem_info; 96 + acpi_integer power; 97 + acpi_integer cap; 98 + acpi_integer avg_interval; 99 + int sensors_valid; 100 + unsigned long sensors_last_updated; 101 + struct sensor_device_attribute sensors[NUM_SENSORS]; 102 + int num_sensors; 103 + int trip[2]; 104 + int num_domain_devices; 105 + struct acpi_device **domain_devices; 106 + struct kobject *holders_dir; 107 + }; 108 + 109 + struct ro_sensor_template { 110 + char *label; 111 + ssize_t (*show)(struct device *dev, 112 + struct device_attribute *devattr, 113 + char *buf); 114 + int index; 115 + }; 116 + 117 + struct rw_sensor_template { 118 + char *label; 119 + ssize_t (*show)(struct device *dev, 120 + struct device_attribute *devattr, 121 + char *buf); 122 + ssize_t (*set)(struct device *dev, 123 + struct device_attribute *devattr, 124 + const char *buf, size_t count); 125 + int index; 126 + }; 127 + 128 + /* Averaging interval */ 129 + static int update_avg_interval(struct acpi_power_meter_resource *resource) 130 + { 131 + unsigned long long data; 132 + acpi_status status; 133 + 134 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GAI", 135 + NULL, &data); 136 + if (ACPI_FAILURE(status)) { 137 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GAI")); 138 + return -ENODEV; 139 + } 140 + 141 + resource->avg_interval = data; 142 + return 0; 143 + } 144 + 145 + static ssize_t show_avg_interval(struct device *dev, 146 + struct device_attribute *devattr, 147 + char *buf) 148 + { 149 + struct acpi_device *acpi_dev = to_acpi_device(dev); 150 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 151 + 152 + mutex_lock(&resource->lock); 153 + update_avg_interval(resource); 154 + mutex_unlock(&resource->lock); 155 + 156 + return sprintf(buf, "%llu\n", resource->avg_interval); 157 + } 158 + 159 + static ssize_t set_avg_interval(struct device *dev, 160 + struct device_attribute *devattr, 161 + const char *buf, size_t count) 162 + { 163 + struct acpi_device *acpi_dev = to_acpi_device(dev); 164 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 165 + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 166 + struct acpi_object_list args = { 1, &arg0 }; 167 + int res; 168 + unsigned long temp; 169 + unsigned long long data; 170 + acpi_status status; 171 + 172 + res = strict_strtoul(buf, 10, &temp); 173 + if (res) 174 + return res; 175 + 176 + if (temp > resource->caps.max_avg_interval || 177 + temp < resource->caps.min_avg_interval) 178 + return -EINVAL; 179 + arg0.integer.value = temp; 180 + 181 + mutex_lock(&resource->lock); 182 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PAI", 183 + &args, &data); 184 + if (!ACPI_FAILURE(status)) 185 + resource->avg_interval = temp; 186 + mutex_unlock(&resource->lock); 187 + 188 + if (ACPI_FAILURE(status)) { 189 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PAI")); 190 + return -EINVAL; 191 + } 192 + 193 + /* _PAI returns 0 on success, nonzero otherwise */ 194 + if (data) 195 + return -EINVAL; 196 + 197 + return count; 198 + } 199 + 200 + /* Cap functions */ 201 + static int update_cap(struct acpi_power_meter_resource *resource) 202 + { 203 + unsigned long long data; 204 + acpi_status status; 205 + 206 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_GHL", 207 + NULL, &data); 208 + if (ACPI_FAILURE(status)) { 209 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _GHL")); 210 + return -ENODEV; 211 + } 212 + 213 + resource->cap = data; 214 + return 0; 215 + } 216 + 217 + static ssize_t show_cap(struct device *dev, 218 + struct device_attribute *devattr, 219 + char *buf) 220 + { 221 + struct acpi_device *acpi_dev = to_acpi_device(dev); 222 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 223 + 224 + mutex_lock(&resource->lock); 225 + update_cap(resource); 226 + mutex_unlock(&resource->lock); 227 + 228 + return sprintf(buf, "%llu\n", resource->cap * 1000); 229 + } 230 + 231 + static ssize_t set_cap(struct device *dev, struct device_attribute *devattr, 232 + const char *buf, size_t count) 233 + { 234 + struct acpi_device *acpi_dev = to_acpi_device(dev); 235 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 236 + union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 237 + struct acpi_object_list args = { 1, &arg0 }; 238 + int res; 239 + unsigned long temp; 240 + unsigned long long data; 241 + acpi_status status; 242 + 243 + res = strict_strtoul(buf, 10, &temp); 244 + if (res) 245 + return res; 246 + 247 + temp /= 1000; 248 + if (temp > resource->caps.max_cap || temp < resource->caps.min_cap) 249 + return -EINVAL; 250 + arg0.integer.value = temp; 251 + 252 + mutex_lock(&resource->lock); 253 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_SHL", 254 + &args, &data); 255 + if (!ACPI_FAILURE(status)) 256 + resource->cap = temp; 257 + mutex_unlock(&resource->lock); 258 + 259 + if (ACPI_FAILURE(status)) { 260 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SHL")); 261 + return -EINVAL; 262 + } 263 + 264 + /* _SHL returns 0 on success, nonzero otherwise */ 265 + if (data) 266 + return -EINVAL; 267 + 268 + return count; 269 + } 270 + 271 + /* Power meter trip points */ 272 + static int set_acpi_trip(struct acpi_power_meter_resource *resource) 273 + { 274 + union acpi_object arg_objs[] = { 275 + {ACPI_TYPE_INTEGER}, 276 + {ACPI_TYPE_INTEGER} 277 + }; 278 + struct acpi_object_list args = { 2, arg_objs }; 279 + unsigned long long data; 280 + acpi_status status; 281 + 282 + /* Both trip levels must be set */ 283 + if (resource->trip[0] < 0 || resource->trip[1] < 0) 284 + return 0; 285 + 286 + /* This driver stores min, max; ACPI wants max, min. */ 287 + arg_objs[0].integer.value = resource->trip[1]; 288 + arg_objs[1].integer.value = resource->trip[0]; 289 + 290 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PTP", 291 + &args, &data); 292 + if (ACPI_FAILURE(status)) { 293 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTP")); 294 + return -EINVAL; 295 + } 296 + 297 + return data; 298 + } 299 + 300 + static ssize_t set_trip(struct device *dev, struct device_attribute *devattr, 301 + const char *buf, size_t count) 302 + { 303 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 304 + struct acpi_device *acpi_dev = to_acpi_device(dev); 305 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 306 + int res; 307 + unsigned long temp; 308 + 309 + res = strict_strtoul(buf, 10, &temp); 310 + if (res) 311 + return res; 312 + 313 + temp /= 1000; 314 + if (temp < 0) 315 + return -EINVAL; 316 + 317 + mutex_lock(&resource->lock); 318 + resource->trip[attr->index - 7] = temp; 319 + res = set_acpi_trip(resource); 320 + mutex_unlock(&resource->lock); 321 + 322 + if (res) 323 + return res; 324 + 325 + return count; 326 + } 327 + 328 + /* Power meter */ 329 + static int update_meter(struct acpi_power_meter_resource *resource) 330 + { 331 + unsigned long long data; 332 + acpi_status status; 333 + unsigned long local_jiffies = jiffies; 334 + 335 + if (time_before(local_jiffies, resource->sensors_last_updated + 336 + msecs_to_jiffies(resource->caps.sampling_time)) && 337 + resource->sensors_valid) 338 + return 0; 339 + 340 + status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PMM", 341 + NULL, &data); 342 + if (ACPI_FAILURE(status)) { 343 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMM")); 344 + return -ENODEV; 345 + } 346 + 347 + resource->power = data; 348 + resource->sensors_valid = 1; 349 + resource->sensors_last_updated = jiffies; 350 + return 0; 351 + } 352 + 353 + static ssize_t show_power(struct device *dev, 354 + struct device_attribute *devattr, 355 + char *buf) 356 + { 357 + struct acpi_device *acpi_dev = to_acpi_device(dev); 358 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 359 + 360 + mutex_lock(&resource->lock); 361 + update_meter(resource); 362 + mutex_unlock(&resource->lock); 363 + 364 + return sprintf(buf, "%llu\n", resource->power * 1000); 365 + } 366 + 367 + /* Miscellaneous */ 368 + static ssize_t show_str(struct device *dev, 369 + struct device_attribute *devattr, 370 + char *buf) 371 + { 372 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 373 + struct acpi_device *acpi_dev = to_acpi_device(dev); 374 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 375 + acpi_string val; 376 + 377 + switch (attr->index) { 378 + case 0: 379 + val = resource->model_number; 380 + break; 381 + case 1: 382 + val = resource->serial_number; 383 + break; 384 + case 2: 385 + val = resource->oem_info; 386 + break; 387 + default: 388 + BUG(); 389 + } 390 + 391 + return sprintf(buf, "%s\n", val); 392 + } 393 + 394 + static ssize_t show_val(struct device *dev, 395 + struct device_attribute *devattr, 396 + char *buf) 397 + { 398 + struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 399 + struct acpi_device *acpi_dev = to_acpi_device(dev); 400 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 401 + acpi_integer val = 0; 402 + 403 + switch (attr->index) { 404 + case 0: 405 + val = resource->caps.min_avg_interval; 406 + break; 407 + case 1: 408 + val = resource->caps.max_avg_interval; 409 + break; 410 + case 2: 411 + val = resource->caps.min_cap * 1000; 412 + break; 413 + case 3: 414 + val = resource->caps.max_cap * 1000; 415 + break; 416 + case 4: 417 + if (resource->caps.hysteresis == UNKNOWN_HYSTERESIS) 418 + return sprintf(buf, "unknown\n"); 419 + 420 + val = resource->caps.hysteresis * 1000; 421 + break; 422 + case 5: 423 + if (resource->caps.flags & POWER_METER_IS_BATTERY) 424 + val = 1; 425 + else 426 + val = 0; 427 + break; 428 + case 6: 429 + if (resource->power > resource->cap) 430 + val = 1; 431 + else 432 + val = 0; 433 + break; 434 + case 7: 435 + case 8: 436 + if (resource->trip[attr->index - 7] < 0) 437 + return sprintf(buf, "unknown\n"); 438 + 439 + val = resource->trip[attr->index - 7] * 1000; 440 + break; 441 + default: 442 + BUG(); 443 + } 444 + 445 + return sprintf(buf, "%llu\n", val); 446 + } 447 + 448 + static ssize_t show_accuracy(struct device *dev, 449 + struct device_attribute *devattr, 450 + char *buf) 451 + { 452 + struct acpi_device *acpi_dev = to_acpi_device(dev); 453 + struct acpi_power_meter_resource *resource = acpi_dev->driver_data; 454 + unsigned int acc = resource->caps.accuracy; 455 + 456 + return sprintf(buf, "%u.%u%%\n", acc / 1000, acc % 1000); 457 + } 458 + 459 + static ssize_t show_name(struct device *dev, 460 + struct device_attribute *devattr, 461 + char *buf) 462 + { 463 + return sprintf(buf, "%s\n", ACPI_POWER_METER_NAME); 464 + } 465 + 466 + /* Sensor descriptions. If you add a sensor, update NUM_SENSORS above! */ 467 + static struct ro_sensor_template meter_ro_attrs[] = { 468 + {POWER_AVERAGE_NAME, show_power, 0}, 469 + {"power1_accuracy", show_accuracy, 0}, 470 + {"power1_average_interval_min", show_val, 0}, 471 + {"power1_average_interval_max", show_val, 1}, 472 + {"power1_is_battery", show_val, 5}, 473 + {NULL, NULL, 0}, 474 + }; 475 + 476 + static struct rw_sensor_template meter_rw_attrs[] = { 477 + {POWER_AVG_INTERVAL_NAME, show_avg_interval, set_avg_interval, 0}, 478 + {NULL, NULL, NULL, 0}, 479 + }; 480 + 481 + static struct ro_sensor_template misc_cap_attrs[] = { 482 + {"power1_cap_min", show_val, 2}, 483 + {"power1_cap_max", show_val, 3}, 484 + {"power1_cap_hyst", show_val, 4}, 485 + {POWER_ALARM_NAME, show_val, 6}, 486 + {NULL, NULL, 0}, 487 + }; 488 + 489 + static struct ro_sensor_template ro_cap_attrs[] = { 490 + {POWER_CAP_NAME, show_cap, 0}, 491 + {NULL, NULL, 0}, 492 + }; 493 + 494 + static struct rw_sensor_template rw_cap_attrs[] = { 495 + {POWER_CAP_NAME, show_cap, set_cap, 0}, 496 + {NULL, NULL, NULL, 0}, 497 + }; 498 + 499 + static struct rw_sensor_template trip_attrs[] = { 500 + {"power1_average_min", show_val, set_trip, 7}, 501 + {"power1_average_max", show_val, set_trip, 8}, 502 + {NULL, NULL, NULL, 0}, 503 + }; 504 + 505 + static struct ro_sensor_template misc_attrs[] = { 506 + {"name", show_name, 0}, 507 + {"power1_model_number", show_str, 0}, 508 + {"power1_oem_info", show_str, 2}, 509 + {"power1_serial_number", show_str, 1}, 510 + {NULL, NULL, 0}, 511 + }; 512 + 513 + /* Read power domain data */ 514 + static void remove_domain_devices(struct acpi_power_meter_resource *resource) 515 + { 516 + int i; 517 + 518 + if (!resource->num_domain_devices) 519 + return; 520 + 521 + for (i = 0; i < resource->num_domain_devices; i++) { 522 + struct acpi_device *obj = resource->domain_devices[i]; 523 + if (!obj) 524 + continue; 525 + 526 + sysfs_remove_link(resource->holders_dir, 527 + kobject_name(&obj->dev.kobj)); 528 + put_device(&obj->dev); 529 + } 530 + 531 + kfree(resource->domain_devices); 532 + kobject_put(resource->holders_dir); 533 + } 534 + 535 + static int read_domain_devices(struct acpi_power_meter_resource *resource) 536 + { 537 + int res = 0; 538 + int i; 539 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 540 + union acpi_object *pss; 541 + acpi_status status; 542 + 543 + status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMD", NULL, 544 + &buffer); 545 + if (ACPI_FAILURE(status)) { 546 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMD")); 547 + return -ENODEV; 548 + } 549 + 550 + pss = buffer.pointer; 551 + if (!pss || 552 + pss->type != ACPI_TYPE_PACKAGE) { 553 + dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME 554 + "Invalid _PMD data\n"); 555 + res = -EFAULT; 556 + goto end; 557 + } 558 + 559 + if (!pss->package.count) 560 + goto end; 561 + 562 + resource->domain_devices = kzalloc(sizeof(struct acpi_device *) * 563 + pss->package.count, GFP_KERNEL); 564 + if (!resource->domain_devices) { 565 + res = -ENOMEM; 566 + goto end; 567 + } 568 + 569 + resource->holders_dir = kobject_create_and_add("measures", 570 + &resource->acpi_dev->dev.kobj); 571 + if (!resource->holders_dir) { 572 + res = -ENOMEM; 573 + goto exit_free; 574 + } 575 + 576 + resource->num_domain_devices = pss->package.count; 577 + 578 + for (i = 0; i < pss->package.count; i++) { 579 + struct acpi_device *obj; 580 + union acpi_object *element = &(pss->package.elements[i]); 581 + 582 + /* Refuse non-references */ 583 + if (element->type != ACPI_TYPE_LOCAL_REFERENCE) 584 + continue; 585 + 586 + /* Create a symlink to domain objects */ 587 + resource->domain_devices[i] = NULL; 588 + status = acpi_bus_get_device(element->reference.handle, 589 + &resource->domain_devices[i]); 590 + if (ACPI_FAILURE(status)) 591 + continue; 592 + 593 + obj = resource->domain_devices[i]; 594 + get_device(&obj->dev); 595 + 596 + res = sysfs_create_link(resource->holders_dir, &obj->dev.kobj, 597 + kobject_name(&obj->dev.kobj)); 598 + if (res) { 599 + put_device(&obj->dev); 600 + resource->domain_devices[i] = NULL; 601 + } 602 + } 603 + 604 + res = 0; 605 + goto end; 606 + 607 + exit_free: 608 + kfree(resource->domain_devices); 609 + end: 610 + kfree(buffer.pointer); 611 + return res; 612 + } 613 + 614 + /* Registration and deregistration */ 615 + static int register_ro_attrs(struct acpi_power_meter_resource *resource, 616 + struct ro_sensor_template *ro) 617 + { 618 + struct device *dev = &resource->acpi_dev->dev; 619 + struct sensor_device_attribute *sensors = 620 + &resource->sensors[resource->num_sensors]; 621 + int res = 0; 622 + 623 + while (ro->label) { 624 + sensors->dev_attr.attr.name = ro->label; 625 + sensors->dev_attr.attr.mode = S_IRUGO; 626 + sensors->dev_attr.show = ro->show; 627 + sensors->index = ro->index; 628 + 629 + res = device_create_file(dev, &sensors->dev_attr); 630 + if (res) { 631 + sensors->dev_attr.attr.name = NULL; 632 + goto error; 633 + } 634 + sensors++; 635 + resource->num_sensors++; 636 + ro++; 637 + } 638 + 639 + error: 640 + return res; 641 + } 642 + 643 + static int register_rw_attrs(struct acpi_power_meter_resource *resource, 644 + struct rw_sensor_template *rw) 645 + { 646 + struct device *dev = &resource->acpi_dev->dev; 647 + struct sensor_device_attribute *sensors = 648 + &resource->sensors[resource->num_sensors]; 649 + int res = 0; 650 + 651 + while (rw->label) { 652 + sensors->dev_attr.attr.name = rw->label; 653 + sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; 654 + sensors->dev_attr.show = rw->show; 655 + sensors->dev_attr.store = rw->set; 656 + sensors->index = rw->index; 657 + 658 + res = device_create_file(dev, &sensors->dev_attr); 659 + if (res) { 660 + sensors->dev_attr.attr.name = NULL; 661 + goto error; 662 + } 663 + sensors++; 664 + resource->num_sensors++; 665 + rw++; 666 + } 667 + 668 + error: 669 + return res; 670 + } 671 + 672 + static void remove_attrs(struct acpi_power_meter_resource *resource) 673 + { 674 + int i; 675 + 676 + for (i = 0; i < resource->num_sensors; i++) { 677 + if (!resource->sensors[i].dev_attr.attr.name) 678 + continue; 679 + device_remove_file(&resource->acpi_dev->dev, 680 + &resource->sensors[i].dev_attr); 681 + } 682 + 683 + remove_domain_devices(resource); 684 + 685 + resource->num_sensors = 0; 686 + } 687 + 688 + static int setup_attrs(struct acpi_power_meter_resource *resource) 689 + { 690 + int res = 0; 691 + 692 + res = read_domain_devices(resource); 693 + if (res) 694 + return res; 695 + 696 + if (resource->caps.flags & POWER_METER_CAN_MEASURE) { 697 + res = register_ro_attrs(resource, meter_ro_attrs); 698 + if (res) 699 + goto error; 700 + res = register_rw_attrs(resource, meter_rw_attrs); 701 + if (res) 702 + goto error; 703 + } 704 + 705 + if (resource->caps.flags & POWER_METER_CAN_CAP) { 706 + if (!can_cap_in_hardware()) { 707 + dev_err(&resource->acpi_dev->dev, 708 + "Ignoring unsafe software power cap!\n"); 709 + goto skip_unsafe_cap; 710 + } 711 + 712 + if (resource->caps.configurable_cap) { 713 + res = register_rw_attrs(resource, rw_cap_attrs); 714 + if (res) 715 + goto error; 716 + } else { 717 + res = register_ro_attrs(resource, ro_cap_attrs); 718 + if (res) 719 + goto error; 720 + } 721 + res = register_ro_attrs(resource, misc_cap_attrs); 722 + if (res) 723 + goto error; 724 + } 725 + skip_unsafe_cap: 726 + 727 + if (resource->caps.flags & POWER_METER_CAN_TRIP) { 728 + res = register_rw_attrs(resource, trip_attrs); 729 + if (res) 730 + goto error; 731 + } 732 + 733 + res = register_ro_attrs(resource, misc_attrs); 734 + if (res) 735 + goto error; 736 + 737 + return res; 738 + error: 739 + remove_domain_devices(resource); 740 + remove_attrs(resource); 741 + return res; 742 + } 743 + 744 + static void free_capabilities(struct acpi_power_meter_resource *resource) 745 + { 746 + acpi_string *str; 747 + int i; 748 + 749 + str = &resource->model_number; 750 + for (i = 0; i < 3; i++, str++) 751 + kfree(*str); 752 + } 753 + 754 + static int read_capabilities(struct acpi_power_meter_resource *resource) 755 + { 756 + int res = 0; 757 + int i; 758 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 759 + struct acpi_buffer state = { 0, NULL }; 760 + struct acpi_buffer format = { sizeof("NNNNNNNNNNN"), "NNNNNNNNNNN" }; 761 + union acpi_object *pss; 762 + acpi_string *str; 763 + acpi_status status; 764 + 765 + status = acpi_evaluate_object(resource->acpi_dev->handle, "_PMC", NULL, 766 + &buffer); 767 + if (ACPI_FAILURE(status)) { 768 + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PMC")); 769 + return -ENODEV; 770 + } 771 + 772 + pss = buffer.pointer; 773 + if (!pss || 774 + pss->type != ACPI_TYPE_PACKAGE || 775 + pss->package.count != 14) { 776 + dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME 777 + "Invalid _PMC data\n"); 778 + res = -EFAULT; 779 + goto end; 780 + } 781 + 782 + /* Grab all the integer data at once */ 783 + state.length = sizeof(struct acpi_power_meter_capabilities); 784 + state.pointer = &resource->caps; 785 + 786 + status = acpi_extract_package(pss, &format, &state); 787 + if (ACPI_FAILURE(status)) { 788 + ACPI_EXCEPTION((AE_INFO, status, "Invalid data")); 789 + res = -EFAULT; 790 + goto end; 791 + } 792 + 793 + if (resource->caps.units) { 794 + dev_err(&resource->acpi_dev->dev, ACPI_POWER_METER_NAME 795 + "Unknown units %llu.\n", 796 + resource->caps.units); 797 + res = -EINVAL; 798 + goto end; 799 + } 800 + 801 + /* Grab the string data */ 802 + str = &resource->model_number; 803 + 804 + for (i = 11; i < 14; i++) { 805 + union acpi_object *element = &(pss->package.elements[i]); 806 + 807 + if (element->type != ACPI_TYPE_STRING) { 808 + res = -EINVAL; 809 + goto error; 810 + } 811 + 812 + *str = kzalloc(sizeof(u8) * (element->string.length + 1), 813 + GFP_KERNEL); 814 + if (!*str) { 815 + res = -ENOMEM; 816 + goto error; 817 + } 818 + 819 + strncpy(*str, element->string.pointer, element->string.length); 820 + str++; 821 + } 822 + 823 + dev_info(&resource->acpi_dev->dev, "Found ACPI power meter.\n"); 824 + goto end; 825 + error: 826 + str = &resource->model_number; 827 + for (i = 0; i < 3; i++, str++) 828 + kfree(*str); 829 + end: 830 + kfree(buffer.pointer); 831 + return res; 832 + } 833 + 834 + /* Handle ACPI event notifications */ 835 + static void acpi_power_meter_notify(struct acpi_device *device, u32 event) 836 + { 837 + struct acpi_power_meter_resource *resource; 838 + int res; 839 + 840 + if (!device || !acpi_driver_data(device)) 841 + return; 842 + 843 + resource = acpi_driver_data(device); 844 + 845 + mutex_lock(&resource->lock); 846 + switch (event) { 847 + case METER_NOTIFY_CONFIG: 848 + free_capabilities(resource); 849 + res = read_capabilities(resource); 850 + if (res) 851 + break; 852 + 853 + remove_attrs(resource); 854 + setup_attrs(resource); 855 + break; 856 + case METER_NOTIFY_TRIP: 857 + sysfs_notify(&device->dev.kobj, NULL, POWER_AVERAGE_NAME); 858 + update_meter(resource); 859 + break; 860 + case METER_NOTIFY_CAP: 861 + sysfs_notify(&device->dev.kobj, NULL, POWER_CAP_NAME); 862 + update_cap(resource); 863 + break; 864 + case METER_NOTIFY_INTERVAL: 865 + sysfs_notify(&device->dev.kobj, NULL, POWER_AVG_INTERVAL_NAME); 866 + update_avg_interval(resource); 867 + break; 868 + case METER_NOTIFY_CAPPING: 869 + sysfs_notify(&device->dev.kobj, NULL, POWER_ALARM_NAME); 870 + dev_info(&device->dev, "Capping in progress.\n"); 871 + break; 872 + default: 873 + BUG(); 874 + } 875 + mutex_unlock(&resource->lock); 876 + 877 + acpi_bus_generate_netlink_event(ACPI_POWER_METER_CLASS, 878 + dev_name(&device->dev), event, 0); 879 + } 880 + 881 + static int acpi_power_meter_add(struct acpi_device *device) 882 + { 883 + int res; 884 + struct acpi_power_meter_resource *resource; 885 + 886 + if (!device) 887 + return -EINVAL; 888 + 889 + resource = kzalloc(sizeof(struct acpi_power_meter_resource), 890 + GFP_KERNEL); 891 + if (!resource) 892 + return -ENOMEM; 893 + 894 + resource->sensors_valid = 0; 895 + resource->acpi_dev = device; 896 + mutex_init(&resource->lock); 897 + strcpy(acpi_device_name(device), ACPI_POWER_METER_DEVICE_NAME); 898 + strcpy(acpi_device_class(device), ACPI_POWER_METER_CLASS); 899 + device->driver_data = resource; 900 + 901 + free_capabilities(resource); 902 + res = read_capabilities(resource); 903 + if (res) 904 + goto exit_free; 905 + 906 + resource->trip[0] = resource->trip[1] = -1; 907 + 908 + res = setup_attrs(resource); 909 + if (res) 910 + goto exit_free; 911 + 912 + resource->hwmon_dev = hwmon_device_register(&device->dev); 913 + if (IS_ERR(resource->hwmon_dev)) { 914 + res = PTR_ERR(resource->hwmon_dev); 915 + goto exit_remove; 916 + } 917 + 918 + res = 0; 919 + goto exit; 920 + 921 + exit_remove: 922 + remove_attrs(resource); 923 + exit_free: 924 + kfree(resource); 925 + exit: 926 + return res; 927 + } 928 + 929 + static int acpi_power_meter_remove(struct acpi_device *device, int type) 930 + { 931 + struct acpi_power_meter_resource *resource; 932 + 933 + if (!device || !acpi_driver_data(device)) 934 + return -EINVAL; 935 + 936 + resource = acpi_driver_data(device); 937 + hwmon_device_unregister(resource->hwmon_dev); 938 + 939 + free_capabilities(resource); 940 + remove_attrs(resource); 941 + 942 + kfree(resource); 943 + return 0; 944 + } 945 + 946 + static int acpi_power_meter_resume(struct acpi_device *device) 947 + { 948 + struct acpi_power_meter_resource *resource; 949 + 950 + if (!device || !acpi_driver_data(device)) 951 + return -EINVAL; 952 + 953 + resource = acpi_driver_data(device); 954 + free_capabilities(resource); 955 + read_capabilities(resource); 956 + 957 + return 0; 958 + } 959 + 960 + static struct acpi_driver acpi_power_meter_driver = { 961 + .name = "power_meter", 962 + .class = ACPI_POWER_METER_CLASS, 963 + .ids = power_meter_ids, 964 + .ops = { 965 + .add = acpi_power_meter_add, 966 + .remove = acpi_power_meter_remove, 967 + .resume = acpi_power_meter_resume, 968 + .notify = acpi_power_meter_notify, 969 + }, 970 + }; 971 + 972 + /* Module init/exit routines */ 973 + static int __init enable_cap_knobs(const struct dmi_system_id *d) 974 + { 975 + cap_in_hardware = 1; 976 + return 0; 977 + } 978 + 979 + static struct dmi_system_id __initdata pm_dmi_table[] = { 980 + { 981 + enable_cap_knobs, "IBM Active Energy Manager", 982 + { 983 + DMI_MATCH(DMI_SYS_VENDOR, "IBM") 984 + }, 985 + }, 986 + {} 987 + }; 988 + 989 + static int __init acpi_power_meter_init(void) 990 + { 991 + int result; 992 + 993 + if (acpi_disabled) 994 + return -ENODEV; 995 + 996 + dmi_check_system(pm_dmi_table); 997 + 998 + result = acpi_bus_register_driver(&acpi_power_meter_driver); 999 + if (result < 0) 1000 + return -ENODEV; 1001 + 1002 + return 0; 1003 + } 1004 + 1005 + static void __exit acpi_power_meter_exit(void) 1006 + { 1007 + acpi_bus_unregister_driver(&acpi_power_meter_driver); 1008 + } 1009 + 1010 + MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); 1011 + MODULE_DESCRIPTION("ACPI 4.0 power meter driver"); 1012 + MODULE_LICENSE("GPL"); 1013 + 1014 + module_param(force_cap_on, bool, 0644); 1015 + MODULE_PARM_DESC(force_cap_on, "Enable power cap even it is unsafe to do so."); 1016 + 1017 + module_init(acpi_power_meter_init); 1018 + module_exit(acpi_power_meter_exit);
+118 -128
drivers/acpi/processor_core.c
··· 59 59 #include <acpi/acpi_drivers.h> 60 60 #include <acpi/processor.h> 61 61 62 + #define PREFIX "ACPI: " 63 + 62 64 #define ACPI_PROCESSOR_CLASS "processor" 63 65 #define ACPI_PROCESSOR_DEVICE_NAME "Processor" 64 66 #define ACPI_PROCESSOR_FILE_INFO "info" ··· 81 79 MODULE_LICENSE("GPL"); 82 80 83 81 static int acpi_processor_add(struct acpi_device *device); 84 - static int acpi_processor_start(struct acpi_device *device); 85 82 static int acpi_processor_remove(struct acpi_device *device, int type); 83 + #ifdef CONFIG_ACPI_PROCFS 86 84 static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); 85 + #endif 87 86 static void acpi_processor_notify(struct acpi_device *device, u32 event); 88 87 static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 89 88 static int acpi_processor_handle_eject(struct acpi_processor *pr); ··· 104 101 .ops = { 105 102 .add = acpi_processor_add, 106 103 .remove = acpi_processor_remove, 107 - .start = acpi_processor_start, 108 104 .suspend = acpi_processor_suspend, 109 105 .resume = acpi_processor_resume, 110 106 .notify = acpi_processor_notify, ··· 112 110 113 111 #define INSTALL_NOTIFY_HANDLER 1 114 112 #define UNINSTALL_NOTIFY_HANDLER 2 115 - 113 + #ifdef CONFIG_ACPI_PROCFS 116 114 static const struct file_operations acpi_processor_info_fops = { 117 115 .owner = THIS_MODULE, 118 116 .open = acpi_processor_info_open_fs, ··· 120 118 .llseek = seq_lseek, 121 119 .release = single_release, 122 120 }; 121 + #endif 123 122 124 123 DEFINE_PER_CPU(struct acpi_processor *, processors); 125 124 struct acpi_processor_errata errata __read_mostly; ··· 319 316 FS Interface (/proc) 320 317 -------------------------------------------------------------------------- */ 321 318 319 + #ifdef CONFIG_ACPI_PROCFS 322 320 static struct proc_dir_entry *acpi_processor_dir = NULL; 323 321 324 322 static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) ··· 392 388 return -EIO; 393 389 return 0; 394 390 } 395 - 396 391 static int acpi_processor_remove_fs(struct acpi_device *device) 397 392 { 398 393 ··· 408 405 409 406 return 0; 410 407 } 408 + #else 409 + static inline int acpi_processor_add_fs(struct acpi_device *device) 410 + { 411 + return 0; 412 + } 413 + static inline int acpi_processor_remove_fs(struct acpi_device *device) 414 + { 415 + return 0; 416 + } 417 + #endif 411 418 412 419 /* Use the acpiid in MADT to map cpus in case of SMP */ 413 420 ··· 711 698 712 699 static DEFINE_PER_CPU(void *, processor_device_array); 713 700 714 - static int __cpuinit acpi_processor_start(struct acpi_device *device) 715 - { 716 - int result = 0; 717 - struct acpi_processor *pr; 718 - struct sys_device *sysdev; 719 - 720 - pr = acpi_driver_data(device); 721 - 722 - result = acpi_processor_get_info(device); 723 - if (result) { 724 - /* Processor is physically not present */ 725 - return 0; 726 - } 727 - 728 - BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); 729 - 730 - /* 731 - * Buggy BIOS check 732 - * ACPI id of processors can be reported wrongly by the BIOS. 733 - * Don't trust it blindly 734 - */ 735 - if (per_cpu(processor_device_array, pr->id) != NULL && 736 - per_cpu(processor_device_array, pr->id) != device) { 737 - printk(KERN_WARNING "BIOS reported wrong ACPI id " 738 - "for the processor\n"); 739 - return -ENODEV; 740 - } 741 - per_cpu(processor_device_array, pr->id) = device; 742 - 743 - per_cpu(processors, pr->id) = pr; 744 - 745 - result = acpi_processor_add_fs(device); 746 - if (result) 747 - goto end; 748 - 749 - sysdev = get_cpu_sysdev(pr->id); 750 - if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) 751 - return -EFAULT; 752 - 753 - /* _PDC call should be done before doing anything else (if reqd.). */ 754 - arch_acpi_processor_init_pdc(pr); 755 - acpi_processor_set_pdc(pr); 756 - arch_acpi_processor_cleanup_pdc(pr); 757 - 758 - #ifdef CONFIG_CPU_FREQ 759 - acpi_processor_ppc_has_changed(pr); 760 - #endif 761 - acpi_processor_get_throttling_info(pr); 762 - acpi_processor_get_limit_info(pr); 763 - 764 - 765 - acpi_processor_power_init(pr, device); 766 - 767 - pr->cdev = thermal_cooling_device_register("Processor", device, 768 - &processor_cooling_ops); 769 - if (IS_ERR(pr->cdev)) { 770 - result = PTR_ERR(pr->cdev); 771 - goto end; 772 - } 773 - 774 - dev_info(&device->dev, "registered as cooling_device%d\n", 775 - pr->cdev->id); 776 - 777 - result = sysfs_create_link(&device->dev.kobj, 778 - &pr->cdev->device.kobj, 779 - "thermal_cooling"); 780 - if (result) 781 - printk(KERN_ERR PREFIX "Create sysfs link\n"); 782 - result = sysfs_create_link(&pr->cdev->device.kobj, 783 - &device->dev.kobj, 784 - "device"); 785 - if (result) 786 - printk(KERN_ERR PREFIX "Create sysfs link\n"); 787 - 788 - if (pr->flags.throttling) { 789 - printk(KERN_INFO PREFIX "%s [%s] (supports", 790 - acpi_device_name(device), acpi_device_bid(device)); 791 - printk(" %d throttling states", pr->throttling.state_count); 792 - printk(")\n"); 793 - } 794 - 795 - end: 796 - 797 - return result; 798 - } 799 - 800 701 static void acpi_processor_notify(struct acpi_device *device, u32 event) 801 702 { 802 703 struct acpi_processor *pr = acpi_driver_data(device); ··· 773 846 static int acpi_processor_add(struct acpi_device *device) 774 847 { 775 848 struct acpi_processor *pr = NULL; 776 - 777 - 778 - if (!device) 779 - return -EINVAL; 849 + int result = 0; 850 + struct sys_device *sysdev; 780 851 781 852 pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); 782 853 if (!pr) ··· 790 865 strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); 791 866 device->driver_data = pr; 792 867 868 + result = acpi_processor_get_info(device); 869 + if (result) { 870 + /* Processor is physically not present */ 871 + return 0; 872 + } 873 + 874 + BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); 875 + 876 + /* 877 + * Buggy BIOS check 878 + * ACPI id of processors can be reported wrongly by the BIOS. 879 + * Don't trust it blindly 880 + */ 881 + if (per_cpu(processor_device_array, pr->id) != NULL && 882 + per_cpu(processor_device_array, pr->id) != device) { 883 + printk(KERN_WARNING "BIOS reported wrong ACPI id " 884 + "for the processor\n"); 885 + result = -ENODEV; 886 + goto err_free_cpumask; 887 + } 888 + per_cpu(processor_device_array, pr->id) = device; 889 + 890 + per_cpu(processors, pr->id) = pr; 891 + 892 + result = acpi_processor_add_fs(device); 893 + if (result) 894 + goto err_free_cpumask; 895 + 896 + sysdev = get_cpu_sysdev(pr->id); 897 + if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { 898 + result = -EFAULT; 899 + goto err_remove_fs; 900 + } 901 + 902 + /* _PDC call should be done before doing anything else (if reqd.). */ 903 + arch_acpi_processor_init_pdc(pr); 904 + acpi_processor_set_pdc(pr); 905 + arch_acpi_processor_cleanup_pdc(pr); 906 + 907 + #ifdef CONFIG_CPU_FREQ 908 + acpi_processor_ppc_has_changed(pr); 909 + #endif 910 + acpi_processor_get_throttling_info(pr); 911 + acpi_processor_get_limit_info(pr); 912 + 913 + 914 + acpi_processor_power_init(pr, device); 915 + 916 + pr->cdev = thermal_cooling_device_register("Processor", device, 917 + &processor_cooling_ops); 918 + if (IS_ERR(pr->cdev)) { 919 + result = PTR_ERR(pr->cdev); 920 + goto err_power_exit; 921 + } 922 + 923 + dev_info(&device->dev, "registered as cooling_device%d\n", 924 + pr->cdev->id); 925 + 926 + result = sysfs_create_link(&device->dev.kobj, 927 + &pr->cdev->device.kobj, 928 + "thermal_cooling"); 929 + if (result) { 930 + printk(KERN_ERR PREFIX "Create sysfs link\n"); 931 + goto err_thermal_unregister; 932 + } 933 + result = sysfs_create_link(&pr->cdev->device.kobj, 934 + &device->dev.kobj, 935 + "device"); 936 + if (result) { 937 + printk(KERN_ERR PREFIX "Create sysfs link\n"); 938 + goto err_remove_sysfs; 939 + } 940 + 941 + if (pr->flags.throttling) { 942 + printk(KERN_INFO PREFIX "%s [%s] (supports", 943 + acpi_device_name(device), acpi_device_bid(device)); 944 + printk(" %d throttling states", pr->throttling.state_count); 945 + printk(")\n"); 946 + } 947 + 793 948 return 0; 949 + 950 + err_remove_sysfs: 951 + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 952 + err_thermal_unregister: 953 + thermal_cooling_device_unregister(pr->cdev); 954 + err_power_exit: 955 + acpi_processor_power_exit(pr, device); 956 + err_remove_fs: 957 + acpi_processor_remove_fs(device); 958 + err_free_cpumask: 959 + free_cpumask_var(pr->throttling.shared_cpu_map); 960 + 961 + return result; 794 962 } 795 963 796 964 static int acpi_processor_remove(struct acpi_device *device, int type) ··· 960 942 { 961 943 acpi_handle phandle; 962 944 struct acpi_device *pdev; 963 - struct acpi_processor *pr; 964 945 965 946 966 947 if (acpi_get_parent(handle, &phandle)) { ··· 974 957 return -ENODEV; 975 958 } 976 959 977 - acpi_bus_start(*device); 978 - 979 - pr = acpi_driver_data(*device); 980 - if (!pr) 981 - return -ENODEV; 982 - 983 - if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) { 984 - kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); 985 - } 986 960 return 0; 987 961 } 988 962 ··· 1003 995 "Unable to add the device\n"); 1004 996 break; 1005 997 } 1006 - 1007 - pr = acpi_driver_data(device); 1008 - if (!pr) { 1009 - printk(KERN_ERR PREFIX "Driver data is NULL\n"); 1010 - break; 1011 - } 1012 - 1013 - if (pr->id >= 0 && (pr->id < nr_cpu_ids)) { 1014 - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 1015 - break; 1016 - } 1017 - 1018 - result = acpi_processor_start(device); 1019 - if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) { 1020 - kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); 1021 - } else { 1022 - printk(KERN_ERR PREFIX "Device [%s] failed to start\n", 1023 - acpi_device_bid(device)); 1024 - } 1025 998 break; 1026 999 case ACPI_NOTIFY_EJECT_REQUEST: 1027 1000 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ··· 1019 1030 "Driver data is NULL, dropping EJECT\n"); 1020 1031 return; 1021 1032 } 1022 - 1023 - if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id))) 1024 - kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 1025 1033 break; 1026 1034 default: 1027 1035 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ··· 1147 1161 (struct acpi_table_header **)&madt))) 1148 1162 madt = NULL; 1149 1163 #endif 1150 - 1164 + #ifdef CONFIG_ACPI_PROCFS 1151 1165 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1152 1166 if (!acpi_processor_dir) 1153 1167 return -ENOMEM; 1154 - 1168 + #endif 1155 1169 /* 1156 1170 * Check whether the system is DMI table. If yes, OSPM 1157 1171 * should not use mwait for CPU-states. ··· 1179 1193 cpuidle_unregister_driver(&acpi_idle_driver); 1180 1194 1181 1195 out_proc: 1196 + #ifdef CONFIG_ACPI_PROCFS 1182 1197 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1198 + #endif 1183 1199 1184 1200 return result; 1185 1201 } ··· 1201 1213 1202 1214 cpuidle_unregister_driver(&acpi_idle_driver); 1203 1215 1216 + #ifdef CONFIG_ACPI_PROCFS 1204 1217 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1218 + #endif 1205 1219 1206 1220 return; 1207 1221 }
+10 -2
drivers/acpi/processor_idle.c
··· 60 60 #include <acpi/processor.h> 61 61 #include <asm/processor.h> 62 62 63 + #define PREFIX "ACPI: " 64 + 63 65 #define ACPI_PROCESSOR_CLASS "processor" 64 66 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 65 67 ACPI_MODULE_NAME("processor_idle"); ··· 682 680 return 0; 683 681 } 684 682 683 + #ifdef CONFIG_ACPI_PROCFS 685 684 static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) 686 685 { 687 686 struct acpi_processor *pr = seq->private; ··· 762 759 .llseek = seq_lseek, 763 760 .release = single_release, 764 761 }; 765 - 762 + #endif 766 763 767 764 /** 768 765 * acpi_idle_bm_check - checks if bus master activity was detected ··· 1163 1160 { 1164 1161 acpi_status status = 0; 1165 1162 static int first_run; 1163 + #ifdef CONFIG_ACPI_PROCFS 1166 1164 struct proc_dir_entry *entry = NULL; 1165 + #endif 1167 1166 unsigned int i; 1168 1167 1169 1168 if (boot_option_idle_override) ··· 1222 1217 pr->power.states[i].type); 1223 1218 printk(")\n"); 1224 1219 } 1225 - 1220 + #ifdef CONFIG_ACPI_PROCFS 1226 1221 /* 'power' [R] */ 1227 1222 entry = proc_create_data(ACPI_PROCESSOR_FILE_POWER, 1228 1223 S_IRUGO, acpi_device_dir(device), ··· 1230 1225 acpi_driver_data(device)); 1231 1226 if (!entry) 1232 1227 return -EIO; 1228 + #endif 1233 1229 return 0; 1234 1230 } 1235 1231 ··· 1243 1237 cpuidle_unregister_device(&pr->power.dev); 1244 1238 pr->flags.power_setup_done = 0; 1245 1239 1240 + #ifdef CONFIG_ACPI_PROCFS 1246 1241 if (acpi_device_dir(device)) 1247 1242 remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1248 1243 acpi_device_dir(device)); 1244 + #endif 1249 1245 1250 1246 return 0; 1251 1247 }
+2
drivers/acpi/processor_perflib.c
··· 39 39 #include <acpi/acpi_drivers.h> 40 40 #include <acpi/processor.h> 41 41 42 + #define PREFIX "ACPI: " 43 + 42 44 #define ACPI_PROCESSOR_CLASS "processor" 43 45 #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" 44 46 #define _COMPONENT ACPI_PROCESSOR_COMPONENT
+4 -1
drivers/acpi/processor_thermal.c
··· 40 40 #include <acpi/processor.h> 41 41 #include <acpi/acpi_drivers.h> 42 42 43 + #define PREFIX "ACPI: " 44 + 43 45 #define ACPI_PROCESSOR_CLASS "processor" 44 46 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 45 47 ACPI_MODULE_NAME("processor_thermal"); ··· 440 438 }; 441 439 442 440 /* /proc interface */ 443 - 441 + #ifdef CONFIG_ACPI_PROCFS 444 442 static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) 445 443 { 446 444 struct acpi_processor *pr = (struct acpi_processor *)seq->private; ··· 519 517 .llseek = seq_lseek, 520 518 .release = single_release, 521 519 }; 520 + #endif
+4 -1
drivers/acpi/processor_throttling.c
··· 41 41 #include <acpi/acpi_drivers.h> 42 42 #include <acpi/processor.h> 43 43 44 + #define PREFIX "ACPI: " 45 + 44 46 #define ACPI_PROCESSOR_CLASS "processor" 45 47 #define _COMPONENT ACPI_PROCESSOR_COMPONENT 46 48 ACPI_MODULE_NAME("processor_throttling"); ··· 1218 1216 } 1219 1217 1220 1218 /* proc interface */ 1221 - 1219 + #ifdef CONFIG_ACPI_PROCFS 1222 1220 static int acpi_processor_throttling_seq_show(struct seq_file *seq, 1223 1221 void *offset) 1224 1222 { ··· 1326 1324 .llseek = seq_lseek, 1327 1325 .release = single_release, 1328 1326 }; 1327 + #endif
+2
drivers/acpi/sbs.c
··· 46 46 47 47 #include "sbshc.h" 48 48 49 + #define PREFIX "ACPI: " 50 + 49 51 #define ACPI_SBS_CLASS "sbs" 50 52 #define ACPI_AC_CLASS "ac_adapter" 51 53 #define ACPI_BATTERY_CLASS "battery"
+2
drivers/acpi/sbshc.c
··· 15 15 #include <linux/interrupt.h> 16 16 #include "sbshc.h" 17 17 18 + #define PREFIX "ACPI: " 19 + 18 20 #define ACPI_SMB_HC_CLASS "smbus_host_controller" 19 21 #define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC" 20 22
+114 -77
drivers/acpi/scan.c
··· 60 60 } 61 61 62 62 if (acpi_dev->flags.compatible_ids) { 63 - struct acpi_compatible_id_list *cid_list; 63 + struct acpica_device_id_list *cid_list; 64 64 int i; 65 65 66 66 cid_list = acpi_dev->pnp.cid_list; 67 67 for (i = 0; i < cid_list->count; i++) { 68 68 count = snprintf(&modalias[len], size, "%s:", 69 - cid_list->id[i].value); 69 + cid_list->ids[i].string); 70 70 if (count < 0 || count >= size) { 71 71 printk(KERN_ERR PREFIX "%s cid[%i] exceeds event buffer size", 72 72 acpi_dev->pnp.device_name, i); ··· 287 287 } 288 288 289 289 if (device->flags.compatible_ids) { 290 - struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 290 + struct acpica_device_id_list *cid_list = device->pnp.cid_list; 291 291 int i; 292 292 293 293 for (id = ids; id->id[0]; id++) { 294 294 /* compare multiple _CID entries against driver ids */ 295 295 for (i = 0; i < cid_list->count; i++) { 296 296 if (!strcmp((char*)id->id, 297 - cid_list->id[i].value)) 297 + cid_list->ids[i].string)) 298 298 return 0; 299 299 } 300 300 } ··· 309 309 struct acpi_device *acpi_dev = to_acpi_device(dev); 310 310 311 311 kfree(acpi_dev->pnp.cid_list); 312 + if (acpi_dev->flags.hardware_id) 313 + kfree(acpi_dev->pnp.hardware_id); 314 + if (acpi_dev->flags.unique_id) 315 + kfree(acpi_dev->pnp.unique_id); 312 316 kfree(acpi_dev); 313 317 } 314 318 ··· 370 366 { 371 367 struct acpi_device *device = data; 372 368 373 - acpi_device_notify(device->handle, ACPI_FIXED_HARDWARE_EVENT, device); 369 + /* Fixed hardware devices have no handles */ 370 + acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); 374 371 return AE_OK; 375 372 } 376 373 ··· 431 426 if (acpi_drv->ops.notify) { 432 427 ret = acpi_device_install_notify_handler(acpi_dev); 433 428 if (ret) { 434 - if (acpi_drv->ops.stop) 435 - acpi_drv->ops.stop(acpi_dev, 436 - acpi_dev->removal_type); 437 429 if (acpi_drv->ops.remove) 438 430 acpi_drv->ops.remove(acpi_dev, 439 431 acpi_dev->removal_type); ··· 454 452 if (acpi_drv) { 455 453 if (acpi_drv->ops.notify) 456 454 acpi_device_remove_notify_handler(acpi_dev); 457 - if (acpi_drv->ops.stop) 458 - acpi_drv->ops.stop(acpi_dev, acpi_dev->removal_type); 459 455 if (acpi_drv->ops.remove) 460 456 acpi_drv->ops.remove(acpi_dev, acpi_dev->removal_type); 461 457 } ··· 687 687 } 688 688 EXPORT_SYMBOL_GPL(acpi_bus_get_ejd); 689 689 690 - void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) 690 + void acpi_bus_data_handler(acpi_handle handle, void *context) 691 691 { 692 692 693 693 /* TBD */ ··· 1000 1000 return acpi_get_handle(device->handle, "_DCK", &tmp); 1001 1001 } 1002 1002 1003 + static struct acpica_device_id_list* 1004 + acpi_add_cid( 1005 + struct acpi_device_info *info, 1006 + struct acpica_device_id *new_cid) 1007 + { 1008 + struct acpica_device_id_list *cid; 1009 + char *next_id_string; 1010 + acpi_size cid_length; 1011 + acpi_size new_cid_length; 1012 + u32 i; 1013 + 1014 + 1015 + /* Allocate new CID list with room for the new CID */ 1016 + 1017 + if (!new_cid) 1018 + new_cid_length = info->compatible_id_list.list_size; 1019 + else if (info->compatible_id_list.list_size) 1020 + new_cid_length = info->compatible_id_list.list_size + 1021 + new_cid->length + sizeof(struct acpica_device_id); 1022 + else 1023 + new_cid_length = sizeof(struct acpica_device_id_list) + new_cid->length; 1024 + 1025 + cid = ACPI_ALLOCATE_ZEROED(new_cid_length); 1026 + if (!cid) { 1027 + return NULL; 1028 + } 1029 + 1030 + cid->list_size = new_cid_length; 1031 + cid->count = info->compatible_id_list.count; 1032 + if (new_cid) 1033 + cid->count++; 1034 + next_id_string = (char *) cid->ids + (cid->count * sizeof(struct acpica_device_id)); 1035 + 1036 + /* Copy all existing CIDs */ 1037 + 1038 + for (i = 0; i < info->compatible_id_list.count; i++) { 1039 + cid_length = info->compatible_id_list.ids[i].length; 1040 + cid->ids[i].string = next_id_string; 1041 + cid->ids[i].length = cid_length; 1042 + 1043 + ACPI_MEMCPY(next_id_string, info->compatible_id_list.ids[i].string, 1044 + cid_length); 1045 + 1046 + next_id_string += cid_length; 1047 + } 1048 + 1049 + /* Append the new CID */ 1050 + 1051 + if (new_cid) { 1052 + cid->ids[i].string = next_id_string; 1053 + cid->ids[i].length = new_cid->length; 1054 + 1055 + ACPI_MEMCPY(next_id_string, new_cid->string, new_cid->length); 1056 + } 1057 + 1058 + return cid; 1059 + } 1060 + 1003 1061 static void acpi_device_set_id(struct acpi_device *device, 1004 1062 struct acpi_device *parent, acpi_handle handle, 1005 1063 int type) 1006 1064 { 1007 - struct acpi_device_info *info; 1008 - struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 1065 + struct acpi_device_info *info = NULL; 1009 1066 char *hid = NULL; 1010 1067 char *uid = NULL; 1011 - struct acpi_compatible_id_list *cid_list = NULL; 1012 - const char *cid_add = NULL; 1068 + struct acpica_device_id_list *cid_list = NULL; 1069 + char *cid_add = NULL; 1013 1070 acpi_status status; 1014 1071 1015 1072 switch (type) { 1016 1073 case ACPI_BUS_TYPE_DEVICE: 1017 - status = acpi_get_object_info(handle, &buffer); 1074 + status = acpi_get_object_info(handle, &info); 1018 1075 if (ACPI_FAILURE(status)) { 1019 1076 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); 1020 1077 return; 1021 1078 } 1022 1079 1023 - info = buffer.pointer; 1024 1080 if (info->valid & ACPI_VALID_HID) 1025 - hid = info->hardware_id.value; 1081 + hid = info->hardware_id.string; 1026 1082 if (info->valid & ACPI_VALID_UID) 1027 - uid = info->unique_id.value; 1083 + uid = info->unique_id.string; 1028 1084 if (info->valid & ACPI_VALID_CID) 1029 - cid_list = &info->compatibility_id; 1085 + cid_list = &info->compatible_id_list; 1030 1086 if (info->valid & ACPI_VALID_ADR) { 1031 1087 device->pnp.bus_address = info->address; 1032 1088 device->flags.bus_address = 1; ··· 1133 1077 } 1134 1078 1135 1079 if (hid) { 1136 - strcpy(device->pnp.hardware_id, hid); 1137 - device->flags.hardware_id = 1; 1138 - } 1139 - if (uid) { 1140 - strcpy(device->pnp.unique_id, uid); 1141 - device->flags.unique_id = 1; 1142 - } 1143 - if (cid_list || cid_add) { 1144 - struct acpi_compatible_id_list *list; 1145 - int size = 0; 1146 - int count = 0; 1147 - 1148 - if (cid_list) { 1149 - size = cid_list->size; 1150 - } else if (cid_add) { 1151 - size = sizeof(struct acpi_compatible_id_list); 1152 - cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); 1153 - if (!cid_list) { 1154 - printk(KERN_ERR "Memory allocation error\n"); 1155 - kfree(buffer.pointer); 1156 - return; 1157 - } else { 1158 - cid_list->count = 0; 1159 - cid_list->size = size; 1160 - } 1080 + device->pnp.hardware_id = ACPI_ALLOCATE_ZEROED(strlen (hid) + 1); 1081 + if (device->pnp.hardware_id) { 1082 + strcpy(device->pnp.hardware_id, hid); 1083 + device->flags.hardware_id = 1; 1161 1084 } 1162 - if (cid_add) 1163 - size += sizeof(struct acpi_compatible_id); 1164 - list = kmalloc(size, GFP_KERNEL); 1085 + } 1086 + if (!device->flags.hardware_id) 1087 + device->pnp.hardware_id = ""; 1088 + 1089 + if (uid) { 1090 + device->pnp.unique_id = ACPI_ALLOCATE_ZEROED(strlen (uid) + 1); 1091 + if (device->pnp.unique_id) { 1092 + strcpy(device->pnp.unique_id, uid); 1093 + device->flags.unique_id = 1; 1094 + } 1095 + } 1096 + if (!device->flags.unique_id) 1097 + device->pnp.unique_id = ""; 1098 + 1099 + if (cid_list || cid_add) { 1100 + struct acpica_device_id_list *list; 1101 + 1102 + if (cid_add) { 1103 + struct acpica_device_id cid; 1104 + cid.length = strlen (cid_add) + 1; 1105 + cid.string = cid_add; 1106 + 1107 + list = acpi_add_cid(info, &cid); 1108 + } else { 1109 + list = acpi_add_cid(info, NULL); 1110 + } 1165 1111 1166 1112 if (list) { 1167 - if (cid_list) { 1168 - memcpy(list, cid_list, cid_list->size); 1169 - count = cid_list->count; 1170 - } 1171 - if (cid_add) { 1172 - strncpy(list->id[count].value, cid_add, 1173 - ACPI_MAX_CID_LENGTH); 1174 - count++; 1175 - device->flags.compatible_ids = 1; 1176 - } 1177 - list->size = size; 1178 - list->count = count; 1179 1113 device->pnp.cid_list = list; 1180 - } else 1181 - printk(KERN_ERR PREFIX "Memory allocation error\n"); 1114 + if (cid_add) 1115 + device->flags.compatible_ids = 1; 1116 + } 1182 1117 } 1183 1118 1184 - kfree(buffer.pointer); 1119 + kfree(info); 1185 1120 } 1186 1121 1187 1122 static int acpi_device_set_context(struct acpi_device *device, int type) ··· 1312 1265 acpi_device_set_id(device, parent, handle, type); 1313 1266 1314 1267 /* 1315 - * The ACPI device is attached to acpi handle before getting 1316 - * the power/wakeup/peformance flags. Otherwise OS can't get 1317 - * the corresponding ACPI device by the acpi handle in the course 1318 - * of getting the power/wakeup/performance flags. 1319 - */ 1320 - result = acpi_device_set_context(device, type); 1321 - if (result) 1322 - goto end; 1323 - 1324 - /* 1325 1268 * Power Management 1326 1269 * ---------------- 1327 1270 */ ··· 1341 1304 goto end; 1342 1305 } 1343 1306 1307 + if ((result = acpi_device_set_context(device, type))) 1308 + goto end; 1344 1309 1345 1310 result = acpi_device_register(device, parent); 1346 1311 ··· 1357 1318 end: 1358 1319 if (!result) 1359 1320 *child = device; 1360 - else { 1361 - kfree(device->pnp.cid_list); 1362 - kfree(device); 1363 - } 1321 + else 1322 + acpi_device_release(&device->dev); 1364 1323 1365 1324 return result; 1366 1325 }
+8
drivers/acpi/sleep.c
··· 405 405 }, 406 406 }, 407 407 { 408 + .callback = init_set_sci_en_on_resume, 409 + .ident = "Hewlett-Packard HP Pavilion dv3 Notebook PC", 410 + .matches = { 411 + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 412 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv3 Notebook PC"), 413 + }, 414 + }, 415 + { 408 416 .callback = init_old_suspend_ordering, 409 417 .ident = "Panasonic CF51-2L", 410 418 .matches = {
+2
drivers/acpi/system.c
··· 31 31 32 32 #include <acpi/acpi_drivers.h> 33 33 34 + #define PREFIX "ACPI: " 35 + 34 36 #define _COMPONENT ACPI_SYSTEM_COMPONENT 35 37 ACPI_MODULE_NAME("system"); 36 38
+6
drivers/acpi/tables.c
··· 213 213 unsigned long table_end; 214 214 acpi_size tbl_size; 215 215 216 + if (acpi_disabled) 217 + return -ENODEV; 218 + 216 219 if (!handler) 217 220 return -EINVAL; 218 221 ··· 279 276 { 280 277 struct acpi_table_header *table = NULL; 281 278 acpi_size tbl_size; 279 + 280 + if (acpi_disabled) 281 + return -ENODEV; 282 282 283 283 if (!handler) 284 284 return -EINVAL;
+2
drivers/acpi/thermal.c
··· 47 47 #include <acpi/acpi_bus.h> 48 48 #include <acpi/acpi_drivers.h> 49 49 50 + #define PREFIX "ACPI: " 51 + 50 52 #define ACPI_THERMAL_CLASS "thermal_zone" 51 53 #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" 52 54 #define ACPI_THERMAL_FILE_STATE "state"
+2
drivers/acpi/utils.c
··· 30 30 #include <acpi/acpi_bus.h> 31 31 #include <acpi/acpi_drivers.h> 32 32 33 + #include "internal.h" 34 + 33 35 #define _COMPONENT ACPI_BUS_COMPONENT 34 36 ACPI_MODULE_NAME("utils"); 35 37
+53 -27
drivers/acpi/video.c
··· 40 40 #include <linux/pci.h> 41 41 #include <linux/pci_ids.h> 42 42 #include <asm/uaccess.h> 43 - 43 + #include <linux/dmi.h> 44 44 #include <acpi/acpi_bus.h> 45 45 #include <acpi/acpi_drivers.h> 46 + 47 + #define PREFIX "ACPI: " 46 48 47 49 #define ACPI_VIDEO_CLASS "video" 48 50 #define ACPI_VIDEO_BUS_NAME "Video Bus" ··· 200 198 struct acpi_device *dev; 201 199 struct acpi_video_device_brightness *brightness; 202 200 struct backlight_device *backlight; 203 - struct thermal_cooling_device *cdev; 201 + struct thermal_cooling_device *cooling_dev; 204 202 struct output_device *output_dev; 205 203 }; 206 204 ··· 389 387 390 388 391 389 /* thermal cooling device callbacks */ 392 - static int video_get_max_state(struct thermal_cooling_device *cdev, unsigned 390 + static int video_get_max_state(struct thermal_cooling_device *cooling_dev, unsigned 393 391 long *state) 394 392 { 395 - struct acpi_device *device = cdev->devdata; 393 + struct acpi_device *device = cooling_dev->devdata; 396 394 struct acpi_video_device *video = acpi_driver_data(device); 397 395 398 396 *state = video->brightness->count - 3; 399 397 return 0; 400 398 } 401 399 402 - static int video_get_cur_state(struct thermal_cooling_device *cdev, unsigned 400 + static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsigned 403 401 long *state) 404 402 { 405 - struct acpi_device *device = cdev->devdata; 403 + struct acpi_device *device = cooling_dev->devdata; 406 404 struct acpi_video_device *video = acpi_driver_data(device); 407 405 unsigned long long level; 408 406 int offset; ··· 419 417 } 420 418 421 419 static int 422 - video_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) 420 + video_set_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long state) 423 421 { 424 - struct acpi_device *device = cdev->devdata; 422 + struct acpi_device *device = cooling_dev->devdata; 425 423 struct acpi_video_device *video = acpi_driver_data(device); 426 424 int level; 427 425 ··· 605 603 unsigned long long *level) 606 604 { 607 605 acpi_status status = AE_OK; 606 + int i; 608 607 609 608 if (device->cap._BQC || device->cap._BCQ) { 610 609 char *buf = device->cap._BQC ? "_BQC" : "_BCQ"; ··· 621 618 622 619 } 623 620 *level += bqc_offset_aml_bug_workaround; 624 - device->brightness->curr = *level; 625 - return 0; 621 + for (i = 2; i < device->brightness->count; i++) 622 + if (device->brightness->levels[i] == *level) { 623 + device->brightness->curr = *level; 624 + return 0; 625 + } 626 + /* BQC returned an invalid level. Stop using it. */ 627 + ACPI_WARNING((AE_INFO, "%s returned an invalid level", 628 + buf)); 629 + device->cap._BQC = device->cap._BCQ = 0; 626 630 } else { 627 631 /* Fixme: 628 632 * should we return an error or ignore this failure? ··· 880 870 br->flags._BCM_use_index = br->flags._BCL_use_index; 881 871 882 872 /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ 883 - br->curr = level_old = max_level; 873 + br->curr = level = max_level; 884 874 885 875 if (!device->cap._BQC) 886 876 goto set_level; ··· 902 892 903 893 br->flags._BQC_use_index = (level == max_level ? 0 : 1); 904 894 905 - if (!br->flags._BQC_use_index) 895 + if (!br->flags._BQC_use_index) { 896 + /* 897 + * Set the backlight to the initial state. 898 + * On some buggy laptops, _BQC returns an uninitialized value 899 + * when invoked for the first time, i.e. level_old is invalid. 900 + * set the backlight to max_level in this case 901 + */ 902 + for (i = 2; i < br->count; i++) 903 + if (level_old == br->levels[i]) 904 + level = level_old; 906 905 goto set_level; 906 + } 907 907 908 908 if (br->flags._BCL_reversed) 909 909 level_old = (br->count - 1) - level_old; 910 - level_old = br->levels[level_old]; 910 + level = br->levels[level_old]; 911 911 912 912 set_level: 913 - result = acpi_video_device_lcd_set_level(device, level_old); 913 + result = acpi_video_device_lcd_set_level(device, level); 914 914 if (result) 915 915 goto out_free_levels; 916 916 ··· 953 933 static void acpi_video_device_find_cap(struct acpi_video_device *device) 954 934 { 955 935 acpi_handle h_dummy1; 956 - 957 - 958 - memset(&device->cap, 0, sizeof(device->cap)); 959 936 960 937 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { 961 938 device->cap._ADR = 1; ··· 1007 990 if (result) 1008 991 printk(KERN_ERR PREFIX "Create sysfs link\n"); 1009 992 1010 - device->cdev = thermal_cooling_device_register("LCD", 993 + device->cooling_dev = thermal_cooling_device_register("LCD", 1011 994 device->dev, &video_cooling_ops); 1012 - if (IS_ERR(device->cdev)) 995 + if (IS_ERR(device->cooling_dev)) { 996 + /* 997 + * Set cooling_dev to NULL so we don't crash trying to 998 + * free it. 999 + * Also, why the hell we are returning early and 1000 + * not attempt to register video output if cooling 1001 + * device registration failed? 1002 + * -- dtor 1003 + */ 1004 + device->cooling_dev = NULL; 1013 1005 return; 1006 + } 1014 1007 1015 1008 dev_info(&device->dev->dev, "registered as cooling_device%d\n", 1016 - device->cdev->id); 1009 + device->cooling_dev->id); 1017 1010 result = sysfs_create_link(&device->dev->dev.kobj, 1018 - &device->cdev->device.kobj, 1011 + &device->cooling_dev->device.kobj, 1019 1012 "thermal_cooling"); 1020 1013 if (result) 1021 1014 printk(KERN_ERR PREFIX "Create sysfs link\n"); 1022 - result = sysfs_create_link(&device->cdev->device.kobj, 1015 + result = sysfs_create_link(&device->cooling_dev->device.kobj, 1023 1016 &device->dev->dev.kobj, "device"); 1024 1017 if (result) 1025 1018 printk(KERN_ERR PREFIX "Create sysfs link\n"); ··· 1066 1039 { 1067 1040 acpi_handle h_dummy1; 1068 1041 1069 - memset(&video->cap, 0, sizeof(video->cap)); 1070 1042 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { 1071 1043 video->cap._DOS = 1; 1072 1044 } ··· 2035 2009 backlight_device_unregister(device->backlight); 2036 2010 device->backlight = NULL; 2037 2011 } 2038 - if (device->cdev) { 2012 + if (device->cooling_dev) { 2039 2013 sysfs_remove_link(&device->dev->dev.kobj, 2040 2014 "thermal_cooling"); 2041 - sysfs_remove_link(&device->cdev->device.kobj, 2015 + sysfs_remove_link(&device->cooling_dev->device.kobj, 2042 2016 "device"); 2043 - thermal_cooling_device_unregister(device->cdev); 2044 - device->cdev = NULL; 2017 + thermal_cooling_device_unregister(device->cooling_dev); 2018 + device->cooling_dev = NULL; 2045 2019 } 2046 2020 video_output_unregister(device->output_dev); 2047 2021
+2
drivers/acpi/video_detect.c
··· 38 38 #include <linux/dmi.h> 39 39 #include <linux/pci.h> 40 40 41 + #define PREFIX "ACPI: " 42 + 41 43 ACPI_MODULE_NAME("video"); 42 44 #define _COMPONENT ACPI_VIDEO_COMPONENT 43 45
+3 -6
drivers/char/agp/hp-agp.c
··· 476 476 { 477 477 acpi_handle handle, parent; 478 478 acpi_status status; 479 - struct acpi_buffer buffer; 480 479 struct acpi_device_info *info; 481 480 u64 lba_hpa, sba_hpa, length; 482 481 int match; ··· 487 488 /* Look for an enclosing IOC scope and find its CSR space */ 488 489 handle = obj; 489 490 do { 490 - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 491 - status = acpi_get_object_info(handle, &buffer); 491 + status = acpi_get_object_info(handle, &info); 492 492 if (ACPI_SUCCESS(status)) { 493 493 /* TBD check _CID also */ 494 - info = buffer.pointer; 495 - info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; 496 - match = (strcmp(info->hardware_id.value, "HWP0001") == 0); 494 + info->hardware_id.string[sizeof(info->hardware_id.length)-1] = '\0'; 495 + match = (strcmp(info->hardware_id.string, "HWP0001") == 0); 497 496 kfree(info); 498 497 if (match) { 499 498 status = hp_acpi_csr_space(handle, &sba_hpa, &length);
+1 -4
drivers/ide/ide-acpi.c
··· 114 114 unsigned int bus, devnum, func; 115 115 acpi_integer addr; 116 116 acpi_handle dev_handle; 117 - struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER, 118 - .pointer = NULL}; 119 117 acpi_status status; 120 118 struct acpi_device_info *dinfo = NULL; 121 119 int ret = -ENODEV; ··· 132 134 goto err; 133 135 } 134 136 135 - status = acpi_get_object_info(dev_handle, &buffer); 137 + status = acpi_get_object_info(dev_handle, &dinfo); 136 138 if (ACPI_FAILURE(status)) { 137 139 DEBPRINT("get_object_info for device failed\n"); 138 140 goto err; 139 141 } 140 - dinfo = buffer.pointer; 141 142 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && 142 143 dinfo->address == addr) { 143 144 *pcidevfn = addr;
+2 -2
drivers/pci/dmar.c
··· 34 34 #include <linux/irq.h> 35 35 #include <linux/interrupt.h> 36 36 #include <linux/tboot.h> 37 + #include <linux/dmi.h> 37 38 38 - #undef PREFIX 39 - #define PREFIX "DMAR:" 39 + #define PREFIX "DMAR: " 40 40 41 41 /* No locks are needed as DMA remapping hardware unit 42 42 * list is constructed at boot time and hotplug of
+5 -7
drivers/pci/hotplug/acpiphp_ibm.c
··· 398 398 acpi_handle *phandle = (acpi_handle *)context; 399 399 acpi_status status; 400 400 struct acpi_device_info *info; 401 - struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 402 401 int retval = 0; 403 402 404 - status = acpi_get_object_info(handle, &info_buffer); 403 + status = acpi_get_object_info(handle, &info); 405 404 if (ACPI_FAILURE(status)) { 406 405 err("%s: Failed to get device information status=0x%x\n", 407 406 __func__, status); 408 407 return retval; 409 408 } 410 - info = info_buffer.pointer; 411 - info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0'; 409 + info->hardware_id.string[sizeof(info->hardware_id.length) - 1] = '\0'; 412 410 413 411 if (info->current_status && (info->valid & ACPI_VALID_HID) && 414 - (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) || 415 - !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) { 412 + (!strcmp(info->hardware_id.string, IBM_HARDWARE_ID1) || 413 + !strcmp(info->hardware_id.string, IBM_HARDWARE_ID2))) { 416 414 dbg("found hardware: %s, handle: %p\n", 417 - info->hardware_id.value, handle); 415 + info->hardware_id.string, handle); 418 416 *phandle = handle; 419 417 /* returning non-zero causes the search to stop 420 418 * and returns this value to the caller of
+10
drivers/platform/x86/Kconfig
··· 99 99 depends on ACPI 100 100 depends on INPUT 101 101 depends on BACKLIGHT_CLASS_DEVICE 102 + depends on LEDS_CLASS || LEDS_CLASS=n 102 103 ---help--- 103 104 This is a driver for laptops built by Fujitsu: 104 105 ··· 396 395 397 396 NOTE: This driver is deprecated and will probably be removed soon, 398 397 use asus-laptop instead. 398 + 399 + config TOPSTAR_LAPTOP 400 + tristate "Topstar Laptop Extras" 401 + depends on ACPI 402 + depends on INPUT 403 + ---help--- 404 + This driver adds support for hotkeys found on Topstar laptops. 405 + 406 + If you have a Topstar laptop, say Y or M here. 399 407 400 408 config ACPI_TOSHIBA 401 409 tristate "Toshiba Laptop Extras"
+1
drivers/platform/x86/Makefile
··· 19 19 obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o 20 20 obj-$(CONFIG_ACPI_WMI) += wmi.o 21 21 obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o 22 + obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o 22 23 obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
+78 -43
drivers/platform/x86/acerhdf.c
··· 52 52 */ 53 53 #undef START_IN_KERNEL_MODE 54 54 55 - #define DRV_VER "0.5.13" 55 + #define DRV_VER "0.5.17" 56 56 57 57 /* 58 58 * According to the Atom N270 datasheet, ··· 90 90 static unsigned int verbose; 91 91 static unsigned int fanstate = ACERHDF_FAN_AUTO; 92 92 static char force_bios[16]; 93 + static char force_product[16]; 93 94 static unsigned int prev_interval; 94 95 struct thermal_zone_device *thz_dev; 95 96 struct thermal_cooling_device *cl_dev; ··· 108 107 MODULE_PARM_DESC(verbose, "Enable verbose dmesg output"); 109 108 module_param_string(force_bios, force_bios, 16, 0); 110 109 MODULE_PARM_DESC(force_bios, "Force BIOS version and omit BIOS check"); 110 + module_param_string(force_product, force_product, 16, 0); 111 + MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check"); 112 + 113 + /* 114 + * cmd_off: to switch the fan completely off / to check if the fan is off 115 + * cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then 116 + * the fan speed depending on the temperature 117 + */ 118 + struct fancmd { 119 + u8 cmd_off; 120 + u8 cmd_auto; 121 + }; 111 122 112 123 /* BIOS settings */ 113 124 struct bios_settings_t { 114 125 const char *vendor; 126 + const char *product; 115 127 const char *version; 116 128 unsigned char fanreg; 117 129 unsigned char tempreg; 118 - unsigned char fancmd[2]; /* fan off and auto commands */ 130 + struct fancmd cmd; 119 131 }; 120 132 121 133 /* Register addresses and values for different BIOS versions */ 122 134 static const struct bios_settings_t bios_tbl[] = { 123 - {"Acer", "v0.3109", 0x55, 0x58, {0x1f, 0x00} }, 124 - {"Acer", "v0.3114", 0x55, 0x58, {0x1f, 0x00} }, 125 - {"Acer", "v0.3301", 0x55, 0x58, {0xaf, 0x00} }, 126 - {"Acer", "v0.3304", 0x55, 0x58, {0xaf, 0x00} }, 127 - {"Acer", "v0.3305", 0x55, 0x58, {0xaf, 0x00} }, 128 - {"Acer", "v0.3308", 0x55, 0x58, {0x21, 0x00} }, 129 - {"Acer", "v0.3309", 0x55, 0x58, {0x21, 0x00} }, 130 - {"Acer", "v0.3310", 0x55, 0x58, {0x21, 0x00} }, 131 - {"Gateway", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, 132 - {"Packard Bell", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, 133 - {"", "", 0, 0, {0, 0} } 135 + /* AOA110 */ 136 + {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} }, 137 + {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} }, 138 + {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} }, 139 + {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} }, 140 + {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} }, 141 + {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} }, 142 + {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} }, 143 + {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} }, 144 + {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} }, 145 + /* AOA150 */ 146 + {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x00} }, 147 + {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} }, 148 + {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} }, 149 + {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} }, 150 + {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} }, 151 + {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, 152 + {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, 153 + {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, 154 + /* special BIOS / other */ 155 + {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, 156 + {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, 157 + {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, 158 + {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, 159 + {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, 160 + /* pewpew-terminator */ 161 + {"", "", "", 0, 0, {0, 0} } 134 162 }; 135 163 136 164 static const struct bios_settings_t *bios_cfg __read_mostly; 137 - 138 165 139 166 static int acerhdf_get_temp(int *temp) 140 167 { ··· 179 150 static int acerhdf_get_fanstate(int *state) 180 151 { 181 152 u8 fan; 182 - bool tmp; 183 153 184 154 if (ec_read(bios_cfg->fanreg, &fan)) 185 155 return -EINVAL; 186 156 187 - tmp = (fan == bios_cfg->fancmd[ACERHDF_FAN_OFF]); 188 - *state = tmp ? ACERHDF_FAN_OFF : ACERHDF_FAN_AUTO; 157 + if (fan != bios_cfg->cmd.cmd_off) 158 + *state = ACERHDF_FAN_AUTO; 159 + else 160 + *state = ACERHDF_FAN_OFF; 189 161 190 162 return 0; 191 163 } ··· 205 175 state = ACERHDF_FAN_AUTO; 206 176 } 207 177 208 - cmd = bios_cfg->fancmd[state]; 178 + cmd = (state == ACERHDF_FAN_OFF) ? bios_cfg->cmd.cmd_off 179 + : bios_cfg->cmd.cmd_auto; 209 180 fanstate = state; 210 181 211 182 ec_write(bios_cfg->fanreg, cmd); ··· 439 408 }; 440 409 441 410 /* suspend / resume functionality */ 442 - static int acerhdf_suspend(struct platform_device *dev, pm_message_t state) 411 + static int acerhdf_suspend(struct device *dev) 443 412 { 444 413 if (kernelmode) 445 414 acerhdf_change_fanstate(ACERHDF_FAN_AUTO); 446 415 447 416 if (verbose) 448 417 pr_notice("going suspend\n"); 449 - 450 - return 0; 451 - } 452 - 453 - static int acerhdf_resume(struct platform_device *device) 454 - { 455 - if (verbose) 456 - pr_notice("resuming\n"); 457 418 458 419 return 0; 459 420 } ··· 460 437 return 0; 461 438 } 462 439 463 - struct platform_driver acerhdf_drv = { 440 + static struct dev_pm_ops acerhdf_pm_ops = { 441 + .suspend = acerhdf_suspend, 442 + .freeze = acerhdf_suspend, 443 + }; 444 + 445 + static struct platform_driver acerhdf_driver = { 464 446 .driver = { 465 - .name = "acerhdf", 447 + .name = "acerhdf", 466 448 .owner = THIS_MODULE, 449 + .pm = &acerhdf_pm_ops, 467 450 }, 468 451 .probe = acerhdf_probe, 469 452 .remove = acerhdf_remove, 470 - .suspend = acerhdf_suspend, 471 - .resume = acerhdf_resume, 472 453 }; 473 454 474 455 ··· 481 454 { 482 455 char const *vendor, *version, *product; 483 456 int i; 457 + unsigned long prod_len = 0; 484 458 485 459 /* get BIOS data */ 486 460 vendor = dmi_get_system_info(DMI_SYS_VENDOR); 487 461 version = dmi_get_system_info(DMI_BIOS_VERSION); 488 462 product = dmi_get_system_info(DMI_PRODUCT_NAME); 489 463 464 + 490 465 pr_info("Acer Aspire One Fan driver, v.%s\n", DRV_VER); 491 466 492 - if (!force_bios[0]) { 493 - if (strncmp(product, "AO", 2)) { 494 - pr_err("no Aspire One hardware found\n"); 495 - return -EINVAL; 496 - } 497 - } else { 498 - pr_info("forcing BIOS version: %s\n", version); 467 + if (force_bios[0]) { 499 468 version = force_bios; 469 + pr_info("forcing BIOS version: %s\n", version); 500 470 kernelmode = 0; 501 471 } 472 + 473 + if (force_product[0]) { 474 + product = force_product; 475 + pr_info("forcing BIOS product: %s\n", product); 476 + kernelmode = 0; 477 + } 478 + 479 + prod_len = strlen(product); 502 480 503 481 if (verbose) 504 482 pr_info("BIOS info: %s %s, product: %s\n", ··· 511 479 512 480 /* search BIOS version and vendor in BIOS settings table */ 513 481 for (i = 0; bios_tbl[i].version[0]; i++) { 514 - if (!strcmp(bios_tbl[i].vendor, vendor) && 482 + if (strlen(bios_tbl[i].product) >= prod_len && 483 + !strncmp(bios_tbl[i].product, product, 484 + strlen(bios_tbl[i].product)) && 485 + !strcmp(bios_tbl[i].vendor, vendor) && 515 486 !strcmp(bios_tbl[i].version, version)) { 516 487 bios_cfg = &bios_tbl[i]; 517 488 break; ··· 522 487 } 523 488 524 489 if (!bios_cfg) { 525 - pr_err("unknown (unsupported) BIOS version %s/%s, " 526 - "please report, aborting!\n", vendor, version); 490 + pr_err("unknown (unsupported) BIOS version %s/%s/%s, " 491 + "please report, aborting!\n", vendor, product, version); 527 492 return -EINVAL; 528 493 } 529 494 ··· 544 509 { 545 510 int err = 0; 546 511 547 - err = platform_driver_register(&acerhdf_drv); 512 + err = platform_driver_register(&acerhdf_driver); 548 513 if (err) 549 514 return err; 550 515 ··· 560 525 return; 561 526 562 527 platform_device_del(acerhdf_dev); 563 - platform_driver_unregister(&acerhdf_drv); 528 + platform_driver_unregister(&acerhdf_driver); 564 529 } 565 530 566 531 static int acerhdf_register_thermal(void)
+173 -54
drivers/platform/x86/asus-laptop.c
··· 77 77 * Flags for hotk status 78 78 * WL_ON and BT_ON are also used for wireless_status() 79 79 */ 80 - #define WL_ON 0x01 //internal Wifi 81 - #define BT_ON 0x02 //internal Bluetooth 82 - #define MLED_ON 0x04 //mail LED 83 - #define TLED_ON 0x08 //touchpad LED 84 - #define RLED_ON 0x10 //Record LED 85 - #define PLED_ON 0x20 //Phone LED 86 - #define GLED_ON 0x40 //Gaming LED 87 - #define LCD_ON 0x80 //LCD backlight 88 - #define GPS_ON 0x100 //GPS 80 + #define WL_ON 0x01 /* internal Wifi */ 81 + #define BT_ON 0x02 /* internal Bluetooth */ 82 + #define MLED_ON 0x04 /* mail LED */ 83 + #define TLED_ON 0x08 /* touchpad LED */ 84 + #define RLED_ON 0x10 /* Record LED */ 85 + #define PLED_ON 0x20 /* Phone LED */ 86 + #define GLED_ON 0x40 /* Gaming LED */ 87 + #define LCD_ON 0x80 /* LCD backlight */ 88 + #define GPS_ON 0x100 /* GPS */ 89 + #define KEY_ON 0x200 /* Keyboard backlight */ 89 90 90 91 #define ASUS_LOG ASUS_HOTK_FILE ": " 91 92 #define ASUS_ERR KERN_ERR ASUS_LOG ··· 99 98 MODULE_DESCRIPTION(ASUS_HOTK_NAME); 100 99 MODULE_LICENSE("GPL"); 101 100 102 - /* WAPF defines the behavior of the Fn+Fx wlan key 101 + /* 102 + * WAPF defines the behavior of the Fn+Fx wlan key 103 103 * The significance of values is yet to be found, but 104 104 * most of the time: 105 105 * 0x0 will do nothing ··· 127 125 /* LEDD */ 128 126 ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM"); 129 127 130 - /* Bluetooth and WLAN 128 + /* 129 + * Bluetooth and WLAN 131 130 * WLED and BLED are not handled like other XLED, because in some dsdt 132 131 * they also control the WLAN/Bluetooth device. 133 132 */ ··· 152 149 153 150 /* Display */ 154 151 ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP"); 155 - ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G 156 - M6A M6V VX-1 V6J V6V W3Z */ 157 - "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V 158 - S5A M5A z33A W1Jc W2V G1 */ 159 - "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */ 160 - "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */ 161 - "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */ 162 - "\\_SB.PCI0.VGA.GETD", /* Z96F */ 163 - "\\ACTD", /* A2D */ 164 - "\\ADVG", /* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ 165 - "\\DNXT", /* P30 */ 166 - "\\INFB", /* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ 167 - "\\SSTE"); /* A3F A6F A3N A3L M6N W3N W6A */ 152 + ASUS_HANDLE(display_get, 153 + /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ 154 + "\\_SB.PCI0.P0P1.VGA.GETD", 155 + /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V S5A M5A z33A W1Jc W2V G1 */ 156 + "\\_SB.PCI0.P0P2.VGA.GETD", 157 + /* A6V A6Q */ 158 + "\\_SB.PCI0.P0P3.VGA.GETD", 159 + /* A6T, A6M */ 160 + "\\_SB.PCI0.P0PA.VGA.GETD", 161 + /* L3C */ 162 + "\\_SB.PCI0.PCI1.VGAC.NMAP", 163 + /* Z96F */ 164 + "\\_SB.PCI0.VGA.GETD", 165 + /* A2D */ 166 + "\\ACTD", 167 + /* A4G Z71A W1N W5A W5F M2N M3N M5N M6N S1N S5N */ 168 + "\\ADVG", 169 + /* P30 */ 170 + "\\DNXT", 171 + /* A2H D1 L2D L3D L3H L2E L5D L5C M1A M2E L4L W3V */ 172 + "\\INFB", 173 + /* A3F A6F A3N A3L M6N W3N W6A */ 174 + "\\SSTE"); 168 175 169 - ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ 170 - ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ 176 + ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ 177 + ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ 171 178 172 179 /* GPS */ 173 180 /* R2H use different handle for GPS on/off */ ··· 185 172 ASUS_HANDLE(gps_off, ASUS_HOTK_PREFIX "SDOF"); /* R2H */ 186 173 ASUS_HANDLE(gps_status, ASUS_HOTK_PREFIX "GPST"); 187 174 175 + /* Keyboard light */ 176 + ASUS_HANDLE(kled_set, ASUS_HOTK_PREFIX "SLKB"); 177 + ASUS_HANDLE(kled_get, ASUS_HOTK_PREFIX "GLKB"); 178 + 188 179 /* 189 180 * This is the main structure, we can use it to store anything interesting 190 181 * about the hotk device 191 182 */ 192 183 struct asus_hotk { 193 - char *name; //laptop name 194 - struct acpi_device *device; //the device we are in 195 - acpi_handle handle; //the handle of the hotk device 196 - char status; //status of the hotk, for LEDs, ... 197 - u32 ledd_status; //status of the LED display 198 - u8 light_level; //light sensor level 199 - u8 light_switch; //light sensor switch value 200 - u16 event_count[128]; //count for each event TODO make this better 184 + char *name; /* laptop name */ 185 + struct acpi_device *device; /* the device we are in */ 186 + acpi_handle handle; /* the handle of the hotk device */ 187 + char status; /* status of the hotk, for LEDs, ... */ 188 + u32 ledd_status; /* status of the LED display */ 189 + u8 light_level; /* light sensor level */ 190 + u8 light_switch; /* light sensor switch value */ 191 + u16 event_count[128]; /* count for each event TODO make this better */ 201 192 struct input_dev *inputdev; 202 193 u16 *keycode_map; 203 194 }; ··· 254 237 .update_status = update_bl_status, 255 238 }; 256 239 257 - /* These functions actually update the LED's, and are called from a 240 + /* 241 + * These functions actually update the LED's, and are called from a 258 242 * workqueue. By doing this as separate work rather than when the LED 259 243 * subsystem asks, we avoid messing with the Asus ACPI stuff during a 260 - * potentially bad time, such as a timer interrupt. */ 244 + * potentially bad time, such as a timer interrupt. 245 + */ 261 246 static struct workqueue_struct *led_workqueue; 262 247 263 - #define ASUS_LED(object, ledname) \ 248 + #define ASUS_LED(object, ledname, max) \ 264 249 static void object##_led_set(struct led_classdev *led_cdev, \ 265 250 enum led_brightness value); \ 251 + static enum led_brightness object##_led_get( \ 252 + struct led_classdev *led_cdev); \ 266 253 static void object##_led_update(struct work_struct *ignored); \ 267 254 static int object##_led_wk; \ 268 255 static DECLARE_WORK(object##_led_work, object##_led_update); \ 269 256 static struct led_classdev object##_led = { \ 270 257 .name = "asus::" ledname, \ 271 258 .brightness_set = object##_led_set, \ 259 + .brightness_get = object##_led_get, \ 260 + .max_brightness = max \ 272 261 } 273 262 274 - ASUS_LED(mled, "mail"); 275 - ASUS_LED(tled, "touchpad"); 276 - ASUS_LED(rled, "record"); 277 - ASUS_LED(pled, "phone"); 278 - ASUS_LED(gled, "gaming"); 263 + ASUS_LED(mled, "mail", 1); 264 + ASUS_LED(tled, "touchpad", 1); 265 + ASUS_LED(rled, "record", 1); 266 + ASUS_LED(pled, "phone", 1); 267 + ASUS_LED(gled, "gaming", 1); 268 + ASUS_LED(kled, "kbd_backlight", 3); 279 269 280 270 struct key_entry { 281 271 char type; ··· 302 278 {KE_KEY, 0x41, KEY_NEXTSONG}, 303 279 {KE_KEY, 0x43, KEY_STOPCD}, 304 280 {KE_KEY, 0x45, KEY_PLAYPAUSE}, 281 + {KE_KEY, 0x4c, KEY_MEDIA}, 305 282 {KE_KEY, 0x50, KEY_EMAIL}, 306 283 {KE_KEY, 0x51, KEY_WWW}, 284 + {KE_KEY, 0x55, KEY_CALC}, 307 285 {KE_KEY, 0x5C, KEY_SCREENLOCK}, /* Screenlock */ 308 286 {KE_KEY, 0x5D, KEY_WLAN}, 287 + {KE_KEY, 0x5E, KEY_WLAN}, 288 + {KE_KEY, 0x5F, KEY_WLAN}, 289 + {KE_KEY, 0x60, KEY_SWITCHVIDEOMODE}, 309 290 {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, 310 291 {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ 311 292 {KE_KEY, 0x82, KEY_CAMERA}, 312 293 {KE_KEY, 0x8A, KEY_PROG1}, 313 294 {KE_KEY, 0x95, KEY_MEDIA}, 314 295 {KE_KEY, 0x99, KEY_PHONE}, 296 + {KE_KEY, 0xc4, KEY_KBDILLUMUP}, 297 + {KE_KEY, 0xc5, KEY_KBDILLUMDOWN}, 315 298 {KE_END, 0}, 316 299 }; 317 300 ··· 332 301 static int write_acpi_int(acpi_handle handle, const char *method, int val, 333 302 struct acpi_buffer *output) 334 303 { 335 - struct acpi_object_list params; //list of input parameters (an int here) 336 - union acpi_object in_obj; //the only param we use 304 + struct acpi_object_list params; /* list of input parameters (an int) */ 305 + union acpi_object in_obj; /* the only param we use */ 337 306 acpi_status status; 338 307 339 308 if (!handle) ··· 430 399 { \ 431 400 int value = object##_led_wk; \ 432 401 write_status(object##_set_handle, value, (mask)); \ 402 + } \ 403 + static enum led_brightness object##_led_get( \ 404 + struct led_classdev *led_cdev) \ 405 + { \ 406 + return led_cdev->brightness; \ 433 407 } 434 408 435 409 ASUS_LED_HANDLER(mled, MLED_ON); ··· 442 406 ASUS_LED_HANDLER(rled, RLED_ON); 443 407 ASUS_LED_HANDLER(tled, TLED_ON); 444 408 ASUS_LED_HANDLER(gled, GLED_ON); 409 + 410 + /* 411 + * Keyboard backlight 412 + */ 413 + static int get_kled_lvl(void) 414 + { 415 + unsigned long long kblv; 416 + struct acpi_object_list params; 417 + union acpi_object in_obj; 418 + acpi_status rv; 419 + 420 + params.count = 1; 421 + params.pointer = &in_obj; 422 + in_obj.type = ACPI_TYPE_INTEGER; 423 + in_obj.integer.value = 2; 424 + 425 + rv = acpi_evaluate_integer(kled_get_handle, NULL, &params, &kblv); 426 + if (ACPI_FAILURE(rv)) { 427 + pr_warning("Error reading kled level\n"); 428 + return 0; 429 + } 430 + return kblv; 431 + } 432 + 433 + static int set_kled_lvl(int kblv) 434 + { 435 + if (kblv > 0) 436 + kblv = (1 << 7) | (kblv & 0x7F); 437 + else 438 + kblv = 0; 439 + 440 + if (write_acpi_int(kled_set_handle, NULL, kblv, NULL)) { 441 + pr_warning("Keyboard LED display write failed\n"); 442 + return -EINVAL; 443 + } 444 + return 0; 445 + } 446 + 447 + static void kled_led_set(struct led_classdev *led_cdev, 448 + enum led_brightness value) 449 + { 450 + kled_led_wk = value; 451 + queue_work(led_workqueue, &kled_led_work); 452 + } 453 + 454 + static void kled_led_update(struct work_struct *ignored) 455 + { 456 + set_kled_lvl(kled_led_wk); 457 + } 458 + 459 + static enum led_brightness kled_led_get(struct led_classdev *led_cdev) 460 + { 461 + return get_kled_lvl(); 462 + } 445 463 446 464 static int get_lcd_state(void) 447 465 { ··· 588 498 { 589 499 int len = 0; 590 500 unsigned long long temp; 591 - char buf[16]; //enough for all info 501 + char buf[16]; /* enough for all info */ 592 502 acpi_status rv = AE_OK; 593 503 594 504 /* ··· 606 516 */ 607 517 rv = acpi_evaluate_integer(hotk->handle, "SFUN", NULL, &temp); 608 518 if (!ACPI_FAILURE(rv)) 609 - len += sprintf(page + len, "SFUN value : 0x%04x\n", 519 + len += sprintf(page + len, "SFUN value : %#x\n", 520 + (uint) temp); 521 + /* 522 + * The HWRS method return informations about the hardware. 523 + * 0x80 bit is for WLAN, 0x100 for Bluetooth. 524 + * The significance of others is yet to be found. 525 + * If we don't find the method, we assume the device are present. 526 + */ 527 + rv = acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &temp); 528 + if (!ACPI_FAILURE(rv)) 529 + len += sprintf(page + len, "HRWS value : %#x\n", 610 530 (uint) temp); 611 531 /* 612 532 * Another value for userspace: the ASYM method returns 0x02 for ··· 627 527 */ 628 528 rv = acpi_evaluate_integer(hotk->handle, "ASYM", NULL, &temp); 629 529 if (!ACPI_FAILURE(rv)) 630 - len += sprintf(page + len, "ASYM value : 0x%04x\n", 530 + len += sprintf(page + len, "ASYM value : %#x\n", 631 531 (uint) temp); 632 532 if (asus_info) { 633 533 snprintf(buf, 16, "%d", asus_info->length); ··· 748 648 unsigned long long value = 0; 749 649 acpi_status rv = AE_OK; 750 650 751 - /* In most of the case, we know how to set the display, but sometime 752 - we can't read it */ 651 + /* 652 + * In most of the case, we know how to set the display, but sometime 653 + * we can't read it 654 + */ 753 655 if (display_get_handle) { 754 656 rv = acpi_evaluate_integer(display_get_handle, NULL, 755 657 NULL, &value); ··· 1139 1037 1140 1038 ASUS_HANDLE_INIT(ledd_set); 1141 1039 1040 + ASUS_HANDLE_INIT(kled_set); 1041 + ASUS_HANDLE_INIT(kled_get); 1042 + 1142 1043 /* 1143 1044 * The HWRS method return informations about the hardware. 1144 1045 * 0x80 bit is for WLAN, 0x100 for Bluetooth. ··· 1168 1063 ASUS_HANDLE_INIT(display_set); 1169 1064 ASUS_HANDLE_INIT(display_get); 1170 1065 1171 - /* There is a lot of models with "ALSL", but a few get 1172 - a real light sens, so we need to check it. */ 1066 + /* 1067 + * There is a lot of models with "ALSL", but a few get 1068 + * a real light sens, so we need to check it. 1069 + */ 1173 1070 if (!ASUS_HANDLE_INIT(ls_switch)) 1174 1071 ASUS_HANDLE_INIT(ls_level); 1175 1072 ··· 1275 1168 /* LCD Backlight is on by default */ 1276 1169 write_status(NULL, 1, LCD_ON); 1277 1170 1171 + /* Keyboard Backlight is on by default */ 1172 + if (kled_set_handle) 1173 + set_kled_lvl(1); 1174 + 1278 1175 /* LED display is off by default */ 1279 1176 hotk->ledd_status = 0xFFF; 1280 1177 ··· 1333 1222 ASUS_LED_UNREGISTER(pled); 1334 1223 ASUS_LED_UNREGISTER(rled); 1335 1224 ASUS_LED_UNREGISTER(gled); 1225 + ASUS_LED_UNREGISTER(kled); 1336 1226 } 1337 1227 1338 1228 static void asus_input_exit(void) ··· 1413 1301 if (rv) 1414 1302 goto out4; 1415 1303 1416 - led_workqueue = create_singlethread_workqueue("led_workqueue"); 1417 - if (!led_workqueue) 1304 + if (kled_set_handle && kled_get_handle) 1305 + rv = ASUS_LED_REGISTER(kled, dev); 1306 + if (rv) 1418 1307 goto out5; 1419 1308 1309 + led_workqueue = create_singlethread_workqueue("led_workqueue"); 1310 + if (!led_workqueue) 1311 + goto out6; 1312 + 1420 1313 return 0; 1421 - out5: 1314 + out6: 1422 1315 rv = -ENOMEM; 1316 + ASUS_LED_UNREGISTER(kled); 1317 + out5: 1423 1318 ASUS_LED_UNREGISTER(gled); 1424 1319 out4: 1425 1320 ASUS_LED_UNREGISTER(pled);
+210 -140
drivers/platform/x86/eeepc-laptop.c
··· 142 142 struct rfkill *wlan_rfkill; 143 143 struct rfkill *bluetooth_rfkill; 144 144 struct rfkill *wwan3g_rfkill; 145 + struct rfkill *wimax_rfkill; 145 146 struct hotplug_slot *hotplug_slot; 146 - struct work_struct hotplug_work; 147 + struct mutex hotplug_lock; 147 148 }; 148 149 149 150 /* The actual device the driver binds to */ 150 151 static struct eeepc_hotk *ehotk; 151 152 152 153 /* Platform device/driver */ 154 + static int eeepc_hotk_thaw(struct device *device); 155 + static int eeepc_hotk_restore(struct device *device); 156 + 157 + static struct dev_pm_ops eeepc_pm_ops = { 158 + .thaw = eeepc_hotk_thaw, 159 + .restore = eeepc_hotk_restore, 160 + }; 161 + 153 162 static struct platform_driver platform_driver = { 154 163 .driver = { 155 164 .name = EEEPC_HOTK_FILE, 156 165 .owner = THIS_MODULE, 166 + .pm = &eeepc_pm_ops, 157 167 } 158 168 }; 159 169 ··· 202 192 */ 203 193 static int eeepc_hotk_add(struct acpi_device *device); 204 194 static int eeepc_hotk_remove(struct acpi_device *device, int type); 205 - static int eeepc_hotk_resume(struct acpi_device *device); 206 195 static void eeepc_hotk_notify(struct acpi_device *device, u32 event); 207 196 208 197 static const struct acpi_device_id eeepc_device_ids[] = { ··· 218 209 .ops = { 219 210 .add = eeepc_hotk_add, 220 211 .remove = eeepc_hotk_remove, 221 - .resume = eeepc_hotk_resume, 222 212 .notify = eeepc_hotk_notify, 223 213 }, 224 214 }; ··· 587 579 588 580 static int eeepc_hotk_check(void) 589 581 { 590 - const struct key_entry *key; 591 582 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 592 583 int result; 593 584 ··· 610 603 cmsg_quirks(); 611 604 pr_info("Get control methods supported: 0x%x\n", 612 605 ehotk->cm_supported); 613 - } 614 - ehotk->inputdev = input_allocate_device(); 615 - if (!ehotk->inputdev) { 616 - pr_info("Unable to allocate input device\n"); 617 - return 0; 618 - } 619 - ehotk->inputdev->name = "Asus EeePC extra buttons"; 620 - ehotk->inputdev->phys = EEEPC_HOTK_FILE "/input0"; 621 - ehotk->inputdev->id.bustype = BUS_HOST; 622 - ehotk->inputdev->getkeycode = eeepc_getkeycode; 623 - ehotk->inputdev->setkeycode = eeepc_setkeycode; 624 - 625 - for (key = eeepc_keymap; key->type != KE_END; key++) { 626 - switch (key->type) { 627 - case KE_KEY: 628 - set_bit(EV_KEY, ehotk->inputdev->evbit); 629 - set_bit(key->keycode, ehotk->inputdev->keybit); 630 - break; 631 - } 632 - } 633 - result = input_register_device(ehotk->inputdev); 634 - if (result) { 635 - pr_info("Unable to register input device\n"); 636 - input_free_device(ehotk->inputdev); 637 - return 0; 638 606 } 639 607 } else { 640 608 pr_err("Hotkey device not present, aborting\n"); ··· 643 661 return 0; 644 662 } 645 663 646 - static void eeepc_hotplug_work(struct work_struct *work) 664 + static void eeepc_rfkill_hotplug(void) 647 665 { 648 666 struct pci_dev *dev; 649 - struct pci_bus *bus = pci_find_bus(0, 1); 650 - bool blocked; 667 + struct pci_bus *bus; 668 + bool blocked = eeepc_wlan_rfkill_blocked(); 651 669 652 - if (!bus) { 653 - pr_warning("Unable to find PCI bus 1?\n"); 654 - return; 670 + if (ehotk->wlan_rfkill) 671 + rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); 672 + 673 + mutex_lock(&ehotk->hotplug_lock); 674 + 675 + if (ehotk->hotplug_slot) { 676 + bus = pci_find_bus(0, 1); 677 + if (!bus) { 678 + pr_warning("Unable to find PCI bus 1?\n"); 679 + goto out_unlock; 680 + } 681 + 682 + if (!blocked) { 683 + dev = pci_get_slot(bus, 0); 684 + if (dev) { 685 + /* Device already present */ 686 + pci_dev_put(dev); 687 + goto out_unlock; 688 + } 689 + dev = pci_scan_single_device(bus, 0); 690 + if (dev) { 691 + pci_bus_assign_resources(bus); 692 + if (pci_bus_add_device(dev)) 693 + pr_err("Unable to hotplug wifi\n"); 694 + } 695 + } else { 696 + dev = pci_get_slot(bus, 0); 697 + if (dev) { 698 + pci_remove_bus_device(dev); 699 + pci_dev_put(dev); 700 + } 701 + } 655 702 } 656 703 657 - blocked = eeepc_wlan_rfkill_blocked(); 658 - if (!blocked) { 659 - dev = pci_get_slot(bus, 0); 660 - if (dev) { 661 - /* Device already present */ 662 - pci_dev_put(dev); 663 - return; 664 - } 665 - dev = pci_scan_single_device(bus, 0); 666 - if (dev) { 667 - pci_bus_assign_resources(bus); 668 - if (pci_bus_add_device(dev)) 669 - pr_err("Unable to hotplug wifi\n"); 670 - } 671 - } else { 672 - dev = pci_get_slot(bus, 0); 673 - if (dev) { 674 - pci_remove_bus_device(dev); 675 - pci_dev_put(dev); 676 - } 677 - } 678 - 679 - rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); 704 + out_unlock: 705 + mutex_unlock(&ehotk->hotplug_lock); 680 706 } 681 707 682 708 static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) ··· 692 702 if (event != ACPI_NOTIFY_BUS_CHECK) 693 703 return; 694 704 695 - schedule_work(&ehotk->hotplug_work); 705 + eeepc_rfkill_hotplug(); 696 706 } 697 707 698 708 static void eeepc_hotk_notify(struct acpi_device *device, u32 event) ··· 829 839 return ret; 830 840 } 831 841 832 - static int eeepc_hotk_add(struct acpi_device *device) 833 - { 834 - int result; 835 - 836 - if (!device) 837 - return -EINVAL; 838 - pr_notice(EEEPC_HOTK_NAME "\n"); 839 - ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); 840 - if (!ehotk) 841 - return -ENOMEM; 842 - ehotk->init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH; 843 - ehotk->handle = device->handle; 844 - strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME); 845 - strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS); 846 - device->driver_data = ehotk; 847 - ehotk->device = device; 848 - result = eeepc_hotk_check(); 849 - if (result) 850 - goto ehotk_fail; 851 - 852 - return 0; 853 - 854 - ehotk_fail: 855 - kfree(ehotk); 856 - ehotk = NULL; 857 - 858 - return result; 859 - } 860 - 861 - static int eeepc_hotk_remove(struct acpi_device *device, int type) 862 - { 863 - if (!device || !acpi_driver_data(device)) 864 - return -EINVAL; 865 - 866 - kfree(ehotk); 867 - return 0; 868 - } 869 - 870 - static int eeepc_hotk_resume(struct acpi_device *device) 842 + static int eeepc_hotk_thaw(struct device *device) 871 843 { 872 844 if (ehotk->wlan_rfkill) { 873 845 bool wlan; 874 846 875 - /* Workaround - it seems that _PTS disables the wireless 876 - without notification or changing the value read by WLAN. 877 - Normally this is fine because the correct value is restored 878 - from the non-volatile storage on resume, but we need to do 879 - it ourself if case suspend is aborted, or we lose wireless. 847 + /* 848 + * Work around bios bug - acpi _PTS turns off the wireless led 849 + * during suspend. Normally it restores it on resume, but 850 + * we should kick it ourselves in case hibernation is aborted. 880 851 */ 881 852 wlan = get_acpi(CM_ASL_WLAN); 882 853 set_acpi(CM_ASL_WLAN, wlan); 883 - 884 - rfkill_set_sw_state(ehotk->wlan_rfkill, wlan != 1); 885 - 886 - schedule_work(&ehotk->hotplug_work); 887 854 } 855 + 856 + return 0; 857 + } 858 + 859 + static int eeepc_hotk_restore(struct device *device) 860 + { 861 + /* Refresh both wlan rfkill state and pci hotplug */ 862 + if (ehotk->wlan_rfkill) 863 + eeepc_rfkill_hotplug(); 888 864 889 865 if (ehotk->bluetooth_rfkill) 890 866 rfkill_set_sw_state(ehotk->bluetooth_rfkill, 891 867 get_acpi(CM_ASL_BLUETOOTH) != 1); 868 + if (ehotk->wwan3g_rfkill) 869 + rfkill_set_sw_state(ehotk->wwan3g_rfkill, 870 + get_acpi(CM_ASL_3G) != 1); 871 + if (ehotk->wimax_rfkill) 872 + rfkill_set_sw_state(ehotk->wimax_rfkill, 873 + get_acpi(CM_ASL_WIMAX) != 1); 892 874 893 875 return 0; 894 876 } ··· 981 1019 982 1020 static void eeepc_rfkill_exit(void) 983 1021 { 1022 + eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P5"); 984 1023 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); 985 1024 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); 986 - if (ehotk->wlan_rfkill) 1025 + if (ehotk->wlan_rfkill) { 987 1026 rfkill_unregister(ehotk->wlan_rfkill); 988 - if (ehotk->bluetooth_rfkill) 989 - rfkill_unregister(ehotk->bluetooth_rfkill); 990 - if (ehotk->wwan3g_rfkill) 991 - rfkill_unregister(ehotk->wwan3g_rfkill); 1027 + rfkill_destroy(ehotk->wlan_rfkill); 1028 + ehotk->wlan_rfkill = NULL; 1029 + } 1030 + /* 1031 + * Refresh pci hotplug in case the rfkill state was changed after 1032 + * eeepc_unregister_rfkill_notifier() 1033 + */ 1034 + eeepc_rfkill_hotplug(); 992 1035 if (ehotk->hotplug_slot) 993 1036 pci_hp_deregister(ehotk->hotplug_slot); 1037 + 1038 + if (ehotk->bluetooth_rfkill) { 1039 + rfkill_unregister(ehotk->bluetooth_rfkill); 1040 + rfkill_destroy(ehotk->bluetooth_rfkill); 1041 + ehotk->bluetooth_rfkill = NULL; 1042 + } 1043 + if (ehotk->wwan3g_rfkill) { 1044 + rfkill_unregister(ehotk->wwan3g_rfkill); 1045 + rfkill_destroy(ehotk->wwan3g_rfkill); 1046 + ehotk->wwan3g_rfkill = NULL; 1047 + } 1048 + if (ehotk->wimax_rfkill) { 1049 + rfkill_unregister(ehotk->wimax_rfkill); 1050 + rfkill_destroy(ehotk->wimax_rfkill); 1051 + ehotk->wimax_rfkill = NULL; 1052 + } 994 1053 } 995 1054 996 1055 static void eeepc_input_exit(void) ··· 1031 1048 &hwmon_attribute_group); 1032 1049 hwmon_device_unregister(hwmon); 1033 1050 eeepc_hwmon_device = NULL; 1034 - } 1035 - 1036 - static void __exit eeepc_laptop_exit(void) 1037 - { 1038 - eeepc_backlight_exit(); 1039 - eeepc_rfkill_exit(); 1040 - eeepc_input_exit(); 1041 - eeepc_hwmon_exit(); 1042 - acpi_bus_unregister_driver(&eeepc_hotk_driver); 1043 - sysfs_remove_group(&platform_device->dev.kobj, 1044 - &platform_attribute_group); 1045 - platform_device_unregister(platform_device); 1046 - platform_driver_unregister(&platform_driver); 1047 1051 } 1048 1052 1049 1053 static int eeepc_new_rfkill(struct rfkill **rfkill, ··· 1064 1094 { 1065 1095 int result = 0; 1066 1096 1067 - INIT_WORK(&ehotk->hotplug_work, eeepc_hotplug_work); 1068 - 1069 - eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); 1070 - eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); 1097 + mutex_init(&ehotk->hotplug_lock); 1071 1098 1072 1099 result = eeepc_new_rfkill(&ehotk->wlan_rfkill, 1073 1100 "eeepc-wlan", dev, ··· 1087 1120 if (result && result != -ENODEV) 1088 1121 goto exit; 1089 1122 1123 + result = eeepc_new_rfkill(&ehotk->wimax_rfkill, 1124 + "eeepc-wimax", dev, 1125 + RFKILL_TYPE_WIMAX, CM_ASL_WIMAX); 1126 + 1127 + if (result && result != -ENODEV) 1128 + goto exit; 1129 + 1090 1130 result = eeepc_setup_pci_hotplug(); 1091 1131 /* 1092 1132 * If we get -EBUSY then something else is handling the PCI hotplug - ··· 1101 1127 */ 1102 1128 if (result == -EBUSY) 1103 1129 result = 0; 1130 + 1131 + eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P5"); 1132 + eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); 1133 + eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); 1134 + /* 1135 + * Refresh pci hotplug in case the rfkill state was changed during 1136 + * setup. 1137 + */ 1138 + eeepc_rfkill_hotplug(); 1104 1139 1105 1140 exit: 1106 1141 if (result && result != -ENODEV) ··· 1155 1172 return result; 1156 1173 } 1157 1174 1158 - static int __init eeepc_laptop_init(void) 1175 + static int eeepc_input_init(struct device *dev) 1176 + { 1177 + const struct key_entry *key; 1178 + int result; 1179 + 1180 + ehotk->inputdev = input_allocate_device(); 1181 + if (!ehotk->inputdev) { 1182 + pr_info("Unable to allocate input device\n"); 1183 + return -ENOMEM; 1184 + } 1185 + ehotk->inputdev->name = "Asus EeePC extra buttons"; 1186 + ehotk->inputdev->dev.parent = dev; 1187 + ehotk->inputdev->phys = EEEPC_HOTK_FILE "/input0"; 1188 + ehotk->inputdev->id.bustype = BUS_HOST; 1189 + ehotk->inputdev->getkeycode = eeepc_getkeycode; 1190 + ehotk->inputdev->setkeycode = eeepc_setkeycode; 1191 + 1192 + for (key = eeepc_keymap; key->type != KE_END; key++) { 1193 + switch (key->type) { 1194 + case KE_KEY: 1195 + set_bit(EV_KEY, ehotk->inputdev->evbit); 1196 + set_bit(key->keycode, ehotk->inputdev->keybit); 1197 + break; 1198 + } 1199 + } 1200 + result = input_register_device(ehotk->inputdev); 1201 + if (result) { 1202 + pr_info("Unable to register input device\n"); 1203 + input_free_device(ehotk->inputdev); 1204 + return result; 1205 + } 1206 + return 0; 1207 + } 1208 + 1209 + static int eeepc_hotk_add(struct acpi_device *device) 1159 1210 { 1160 1211 struct device *dev; 1161 1212 int result; 1162 1213 1163 - if (acpi_disabled) 1164 - return -ENODEV; 1165 - result = acpi_bus_register_driver(&eeepc_hotk_driver); 1166 - if (result < 0) 1167 - return result; 1168 - if (!ehotk) { 1169 - acpi_bus_unregister_driver(&eeepc_hotk_driver); 1170 - return -ENODEV; 1171 - } 1214 + if (!device) 1215 + return -EINVAL; 1216 + pr_notice(EEEPC_HOTK_NAME "\n"); 1217 + ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); 1218 + if (!ehotk) 1219 + return -ENOMEM; 1220 + ehotk->init_flag = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH; 1221 + ehotk->handle = device->handle; 1222 + strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME); 1223 + strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS); 1224 + device->driver_data = ehotk; 1225 + ehotk->device = device; 1172 1226 1227 + result = eeepc_hotk_check(); 1228 + if (result) 1229 + goto fail_platform_driver; 1173 1230 eeepc_enable_camera(); 1174 1231 1175 1232 /* Register platform stuff */ ··· 1239 1216 pr_info("Backlight controlled by ACPI video " 1240 1217 "driver\n"); 1241 1218 1219 + result = eeepc_input_init(dev); 1220 + if (result) 1221 + goto fail_input; 1222 + 1242 1223 result = eeepc_hwmon_init(dev); 1243 1224 if (result) 1244 1225 goto fail_hwmon; ··· 1252 1225 goto fail_rfkill; 1253 1226 1254 1227 return 0; 1228 + 1255 1229 fail_rfkill: 1256 1230 eeepc_hwmon_exit(); 1257 1231 fail_hwmon: 1232 + eeepc_input_exit(); 1233 + fail_input: 1258 1234 eeepc_backlight_exit(); 1259 1235 fail_backlight: 1260 1236 sysfs_remove_group(&platform_device->dev.kobj, ··· 1269 1239 fail_platform_device1: 1270 1240 platform_driver_unregister(&platform_driver); 1271 1241 fail_platform_driver: 1272 - eeepc_input_exit(); 1242 + kfree(ehotk); 1243 + 1273 1244 return result; 1245 + } 1246 + 1247 + static int eeepc_hotk_remove(struct acpi_device *device, int type) 1248 + { 1249 + if (!device || !acpi_driver_data(device)) 1250 + return -EINVAL; 1251 + 1252 + eeepc_backlight_exit(); 1253 + eeepc_rfkill_exit(); 1254 + eeepc_input_exit(); 1255 + eeepc_hwmon_exit(); 1256 + sysfs_remove_group(&platform_device->dev.kobj, 1257 + &platform_attribute_group); 1258 + platform_device_unregister(platform_device); 1259 + platform_driver_unregister(&platform_driver); 1260 + 1261 + kfree(ehotk); 1262 + return 0; 1263 + } 1264 + 1265 + static int __init eeepc_laptop_init(void) 1266 + { 1267 + int result; 1268 + 1269 + if (acpi_disabled) 1270 + return -ENODEV; 1271 + result = acpi_bus_register_driver(&eeepc_hotk_driver); 1272 + if (result < 0) 1273 + return result; 1274 + if (!ehotk) { 1275 + acpi_bus_unregister_driver(&eeepc_hotk_driver); 1276 + return -ENODEV; 1277 + } 1278 + return 0; 1279 + } 1280 + 1281 + static void __exit eeepc_laptop_exit(void) 1282 + { 1283 + acpi_bus_unregister_driver(&eeepc_hotk_driver); 1274 1284 } 1275 1285 1276 1286 module_init(eeepc_laptop_init);
+48 -61
drivers/platform/x86/fujitsu-laptop.c
··· 66 66 #include <linux/kfifo.h> 67 67 #include <linux/video_output.h> 68 68 #include <linux/platform_device.h> 69 - #ifdef CONFIG_LEDS_CLASS 69 + #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 70 70 #include <linux/leds.h> 71 71 #endif 72 72 73 - #define FUJITSU_DRIVER_VERSION "0.5.0" 73 + #define FUJITSU_DRIVER_VERSION "0.6.0" 74 74 75 75 #define FUJITSU_LCD_N_LEVELS 8 76 76 ··· 96 96 /* FUNC interface - responses */ 97 97 #define UNSUPPORTED_CMD 0x80000000 98 98 99 - #ifdef CONFIG_LEDS_CLASS 99 + #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 100 100 /* FUNC interface - LED control */ 101 101 #define FUNC_LED_OFF 0x1 102 102 #define FUNC_LED_ON 0x30001 ··· 176 176 177 177 static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event); 178 178 179 - #ifdef CONFIG_LEDS_CLASS 179 + #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 180 180 static enum led_brightness logolamp_get(struct led_classdev *cdev); 181 181 static void logolamp_set(struct led_classdev *cdev, 182 182 enum led_brightness brightness); ··· 257 257 return out_obj.integer.value; 258 258 } 259 259 260 - #ifdef CONFIG_LEDS_CLASS 260 + #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 261 261 /* LED class callbacks */ 262 262 263 263 static void logolamp_set(struct led_classdev *cdev, ··· 324 324 if (level < 0 || level >= fujitsu->max_brightness) 325 325 return -EINVAL; 326 326 327 - if (!fujitsu) 328 - return -EINVAL; 329 - 330 327 status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle); 331 328 if (ACPI_FAILURE(status)) { 332 329 vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n"); ··· 350 353 level); 351 354 352 355 if (level < 0 || level >= fujitsu->max_brightness) 353 - return -EINVAL; 354 - 355 - if (!fujitsu) 356 356 return -EINVAL; 357 357 358 358 status = acpi_get_handle(fujitsu->acpi_handle, "SBL2", &handle); ··· 691 697 result = acpi_bus_get_power(fujitsu->acpi_handle, &state); 692 698 if (result) { 693 699 printk(KERN_ERR "Error reading power state\n"); 694 - goto end; 700 + goto err_unregister_input_dev; 695 701 } 696 702 697 - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 703 + printk(KERN_INFO "ACPI: %s [%s] (%s)\n", 698 704 acpi_device_name(device), acpi_device_bid(device), 699 705 !device->power.state ? "on" : "off"); 700 706 ··· 722 728 723 729 return result; 724 730 725 - end: 731 + err_unregister_input_dev: 732 + input_unregister_device(input); 726 733 err_free_input_dev: 727 734 input_free_device(input); 728 735 err_stop: 729 - 730 736 return result; 731 737 } 732 738 733 739 static int acpi_fujitsu_remove(struct acpi_device *device, int type) 734 740 { 735 - struct fujitsu_t *fujitsu = NULL; 741 + struct fujitsu_t *fujitsu = acpi_driver_data(device); 742 + struct input_dev *input = fujitsu->input; 736 743 737 - if (!device || !acpi_driver_data(device)) 738 - return -EINVAL; 744 + input_unregister_device(input); 739 745 740 - fujitsu = acpi_driver_data(device); 741 - 742 - if (!device || !acpi_driver_data(device)) 743 - return -EINVAL; 746 + input_free_device(input); 744 747 745 748 fujitsu->acpi_handle = NULL; 746 749 ··· 862 871 result = acpi_bus_get_power(fujitsu_hotkey->acpi_handle, &state); 863 872 if (result) { 864 873 printk(KERN_ERR "Error reading power state\n"); 865 - goto end; 874 + goto err_unregister_input_dev; 866 875 } 867 876 868 - printk(KERN_INFO PREFIX "%s [%s] (%s)\n", 877 + printk(KERN_INFO "ACPI: %s [%s] (%s)\n", 869 878 acpi_device_name(device), acpi_device_bid(device), 870 879 !device->power.state ? "on" : "off"); 871 880 ··· 902 911 printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n", 903 912 call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0)); 904 913 905 - #ifdef CONFIG_LEDS_CLASS 914 + #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) 906 915 if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { 907 916 result = led_classdev_register(&fujitsu->pf_device->dev, 908 917 &logolamp_led); ··· 925 934 "LED handler for keyboard lamps, error %i\n", result); 926 935 } 927 936 } 928 - #endif 937 + #endif 929 938 930 939 return result; 931 940 932 - end: 941 + err_unregister_input_dev: 942 + input_unregister_device(input); 933 943 err_free_input_dev: 934 944 input_free_device(input); 935 945 err_free_fifo: 936 946 kfifo_free(fujitsu_hotkey->fifo); 937 947 err_stop: 938 - 939 948 return result; 940 949 } 941 950 942 951 static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) 943 952 { 944 - struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; 953 + struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device); 954 + struct input_dev *input = fujitsu_hotkey->input; 945 955 946 - if (!device || !acpi_driver_data(device)) 947 - return -EINVAL; 956 + #ifdef CONFIG_LEDS_CLASS 957 + if (fujitsu_hotkey->logolamp_registered) 958 + led_classdev_unregister(&logolamp_led); 948 959 949 - fujitsu_hotkey = acpi_driver_data(device); 960 + if (fujitsu_hotkey->kblamps_registered) 961 + led_classdev_unregister(&kblamps_led); 962 + #endif 950 963 951 - fujitsu_hotkey->acpi_handle = NULL; 964 + input_unregister_device(input); 965 + 966 + input_free_device(input); 952 967 953 968 kfifo_free(fujitsu_hotkey->fifo); 969 + 970 + fujitsu_hotkey->acpi_handle = NULL; 954 971 955 972 return 0; 956 973 } ··· 1129 1130 fujitsu->bl_device = 1130 1131 backlight_device_register("fujitsu-laptop", NULL, NULL, 1131 1132 &fujitsubl_ops); 1132 - if (IS_ERR(fujitsu->bl_device)) 1133 - return PTR_ERR(fujitsu->bl_device); 1133 + if (IS_ERR(fujitsu->bl_device)) { 1134 + ret = PTR_ERR(fujitsu->bl_device); 1135 + fujitsu->bl_device = NULL; 1136 + goto fail_sysfs_group; 1137 + } 1134 1138 max_brightness = fujitsu->max_brightness; 1135 1139 fujitsu->bl_device->props.max_brightness = max_brightness - 1; 1136 1140 fujitsu->bl_device->props.brightness = fujitsu->brightness_level; ··· 1173 1171 return 0; 1174 1172 1175 1173 fail_hotkey1: 1176 - 1177 1174 kfree(fujitsu_hotkey); 1178 - 1179 1175 fail_hotkey: 1180 - 1181 1176 platform_driver_unregister(&fujitsupf_driver); 1182 - 1183 1177 fail_backlight: 1184 - 1185 1178 if (fujitsu->bl_device) 1186 1179 backlight_device_unregister(fujitsu->bl_device); 1187 - 1180 + fail_sysfs_group: 1181 + sysfs_remove_group(&fujitsu->pf_device->dev.kobj, 1182 + &fujitsupf_attribute_group); 1188 1183 fail_platform_device2: 1189 - 1190 1184 platform_device_del(fujitsu->pf_device); 1191 - 1192 1185 fail_platform_device1: 1193 - 1194 1186 platform_device_put(fujitsu->pf_device); 1195 - 1196 1187 fail_platform_driver: 1197 - 1198 1188 acpi_bus_unregister_driver(&acpi_fujitsu_driver); 1199 - 1200 1189 fail_acpi: 1201 - 1202 1190 kfree(fujitsu); 1203 1191 1204 1192 return ret; ··· 1196 1204 1197 1205 static void __exit fujitsu_cleanup(void) 1198 1206 { 1199 - #ifdef CONFIG_LEDS_CLASS 1200 - if (fujitsu_hotkey->logolamp_registered != 0) 1201 - led_classdev_unregister(&logolamp_led); 1207 + acpi_bus_unregister_driver(&acpi_fujitsu_hotkey_driver); 1202 1208 1203 - if (fujitsu_hotkey->kblamps_registered != 0) 1204 - led_classdev_unregister(&kblamps_led); 1205 - #endif 1209 + kfree(fujitsu_hotkey); 1210 + 1211 + platform_driver_unregister(&fujitsupf_driver); 1212 + 1213 + if (fujitsu->bl_device) 1214 + backlight_device_unregister(fujitsu->bl_device); 1206 1215 1207 1216 sysfs_remove_group(&fujitsu->pf_device->dev.kobj, 1208 1217 &fujitsupf_attribute_group); 1218 + 1209 1219 platform_device_unregister(fujitsu->pf_device); 1210 - platform_driver_unregister(&fujitsupf_driver); 1211 - if (fujitsu->bl_device) 1212 - backlight_device_unregister(fujitsu->bl_device); 1213 1220 1214 1221 acpi_bus_unregister_driver(&acpi_fujitsu_driver); 1215 1222 1216 1223 kfree(fujitsu); 1217 - 1218 - acpi_bus_unregister_driver(&acpi_fujitsu_hotkey_driver); 1219 - 1220 - kfree(fujitsu_hotkey); 1221 1224 1222 1225 printk(KERN_INFO "fujitsu-laptop: driver unloaded.\n"); 1223 1226 }
+1 -1
drivers/platform/x86/hp-wmi.c
··· 507 507 } 508 508 if (bluetooth_rfkill) { 509 509 rfkill_unregister(bluetooth_rfkill); 510 - rfkill_destroy(wifi_rfkill); 510 + rfkill_destroy(bluetooth_rfkill); 511 511 } 512 512 if (wwan_rfkill) { 513 513 rfkill_unregister(wwan_rfkill);
+2 -5
drivers/platform/x86/sony-laptop.c
··· 976 976 void *context, void **return_value) 977 977 { 978 978 struct acpi_device_info *info; 979 - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 980 979 981 - if (ACPI_SUCCESS(acpi_get_object_info(handle, &buffer))) { 982 - info = buffer.pointer; 983 - 980 + if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { 984 981 printk(KERN_WARNING DRV_PFX "method: name: %4.4s, args %X\n", 985 982 (char *)&info->name, info->param_count); 986 983 987 - kfree(buffer.pointer); 984 + kfree(info); 988 985 } 989 986 990 987 return AE_OK;
+310 -72
drivers/platform/x86/thinkpad_acpi.c
··· 1278 1278 tp_rfk = tpacpi_rfkill_switches[id]; 1279 1279 if (tp_rfk) { 1280 1280 rfkill_unregister(tp_rfk->rfkill); 1281 + rfkill_destroy(tp_rfk->rfkill); 1281 1282 tpacpi_rfkill_switches[id] = NULL; 1282 1283 kfree(tp_rfk); 1283 1284 } ··· 1602 1601 #endif 1603 1602 } 1604 1603 1604 + /************************************************************************* 1605 + * Firmware Data 1606 + */ 1607 + 1608 + /* 1609 + * Table of recommended minimum BIOS versions 1610 + * 1611 + * Reasons for listing: 1612 + * 1. Stable BIOS, listed because the unknown ammount of 1613 + * bugs and bad ACPI behaviour on older versions 1614 + * 1615 + * 2. BIOS or EC fw with known bugs that trigger on Linux 1616 + * 1617 + * 3. BIOS with known reduced functionality in older versions 1618 + * 1619 + * We recommend the latest BIOS and EC version. 1620 + * We only support the latest BIOS and EC fw version as a rule. 1621 + * 1622 + * Sources: IBM ThinkPad Public Web Documents (update changelogs), 1623 + * Information from users in ThinkWiki 1624 + * 1625 + * WARNING: we use this table also to detect that the machine is 1626 + * a ThinkPad in some cases, so don't remove entries lightly. 1627 + */ 1628 + 1629 + #define TPV_Q(__v, __id1, __id2, __bv1, __bv2) \ 1630 + { .vendor = (__v), \ 1631 + .bios = TPID(__id1, __id2), \ 1632 + .ec = TPACPI_MATCH_ANY, \ 1633 + .quirks = TPACPI_MATCH_ANY << 16 \ 1634 + | (__bv1) << 8 | (__bv2) } 1635 + 1636 + #define TPV_Q_X(__v, __bid1, __bid2, __bv1, __bv2, \ 1637 + __eid1, __eid2, __ev1, __ev2) \ 1638 + { .vendor = (__v), \ 1639 + .bios = TPID(__bid1, __bid2), \ 1640 + .ec = TPID(__eid1, __eid2), \ 1641 + .quirks = (__ev1) << 24 | (__ev2) << 16 \ 1642 + | (__bv1) << 8 | (__bv2) } 1643 + 1644 + #define TPV_QI0(__id1, __id2, __bv1, __bv2) \ 1645 + TPV_Q(PCI_VENDOR_ID_IBM, __id1, __id2, __bv1, __bv2) 1646 + 1647 + #define TPV_QI1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ 1648 + TPV_Q_X(PCI_VENDOR_ID_IBM, __id1, __id2, \ 1649 + __bv1, __bv2, __id1, __id2, __ev1, __ev2) 1650 + 1651 + #define TPV_QI2(__bid1, __bid2, __bv1, __bv2, \ 1652 + __eid1, __eid2, __ev1, __ev2) \ 1653 + TPV_Q_X(PCI_VENDOR_ID_IBM, __bid1, __bid2, \ 1654 + __bv1, __bv2, __eid1, __eid2, __ev1, __ev2) 1655 + 1656 + #define TPV_QL0(__id1, __id2, __bv1, __bv2) \ 1657 + TPV_Q(PCI_VENDOR_ID_LENOVO, __id1, __id2, __bv1, __bv2) 1658 + 1659 + #define TPV_QL1(__id1, __id2, __bv1, __bv2, __ev1, __ev2) \ 1660 + TPV_Q_X(PCI_VENDOR_ID_LENOVO, __id1, __id2, \ 1661 + __bv1, __bv2, __id1, __id2, __ev1, __ev2) 1662 + 1663 + #define TPV_QL2(__bid1, __bid2, __bv1, __bv2, \ 1664 + __eid1, __eid2, __ev1, __ev2) \ 1665 + TPV_Q_X(PCI_VENDOR_ID_LENOVO, __bid1, __bid2, \ 1666 + __bv1, __bv2, __eid1, __eid2, __ev1, __ev2) 1667 + 1668 + static const struct tpacpi_quirk tpacpi_bios_version_qtable[] __initconst = { 1669 + /* Numeric models ------------------ */ 1670 + /* FW MODEL BIOS VERS */ 1671 + TPV_QI0('I', 'M', '6', '5'), /* 570 */ 1672 + TPV_QI0('I', 'U', '2', '6'), /* 570E */ 1673 + TPV_QI0('I', 'B', '5', '4'), /* 600 */ 1674 + TPV_QI0('I', 'H', '4', '7'), /* 600E */ 1675 + TPV_QI0('I', 'N', '3', '6'), /* 600E */ 1676 + TPV_QI0('I', 'T', '5', '5'), /* 600X */ 1677 + TPV_QI0('I', 'D', '4', '8'), /* 770, 770E, 770ED */ 1678 + TPV_QI0('I', 'I', '4', '2'), /* 770X */ 1679 + TPV_QI0('I', 'O', '2', '3'), /* 770Z */ 1680 + 1681 + /* A-series ------------------------- */ 1682 + /* FW MODEL BIOS VERS EC VERS */ 1683 + TPV_QI0('I', 'W', '5', '9'), /* A20m */ 1684 + TPV_QI0('I', 'V', '6', '9'), /* A20p */ 1685 + TPV_QI0('1', '0', '2', '6'), /* A21e, A22e */ 1686 + TPV_QI0('K', 'U', '3', '6'), /* A21e */ 1687 + TPV_QI0('K', 'X', '3', '6'), /* A21m, A22m */ 1688 + TPV_QI0('K', 'Y', '3', '8'), /* A21p, A22p */ 1689 + TPV_QI0('1', 'B', '1', '7'), /* A22e */ 1690 + TPV_QI0('1', '3', '2', '0'), /* A22m */ 1691 + TPV_QI0('1', 'E', '7', '3'), /* A30/p (0) */ 1692 + TPV_QI1('1', 'G', '4', '1', '1', '7'), /* A31/p (0) */ 1693 + TPV_QI1('1', 'N', '1', '6', '0', '7'), /* A31/p (0) */ 1694 + 1695 + /* G-series ------------------------- */ 1696 + /* FW MODEL BIOS VERS */ 1697 + TPV_QI0('1', 'T', 'A', '6'), /* G40 */ 1698 + TPV_QI0('1', 'X', '5', '7'), /* G41 */ 1699 + 1700 + /* R-series, T-series --------------- */ 1701 + /* FW MODEL BIOS VERS EC VERS */ 1702 + TPV_QI0('1', 'C', 'F', '0'), /* R30 */ 1703 + TPV_QI0('1', 'F', 'F', '1'), /* R31 */ 1704 + TPV_QI0('1', 'M', '9', '7'), /* R32 */ 1705 + TPV_QI0('1', 'O', '6', '1'), /* R40 */ 1706 + TPV_QI0('1', 'P', '6', '5'), /* R40 */ 1707 + TPV_QI0('1', 'S', '7', '0'), /* R40e */ 1708 + TPV_QI1('1', 'R', 'D', 'R', '7', '1'), /* R50/p, R51, 1709 + T40/p, T41/p, T42/p (1) */ 1710 + TPV_QI1('1', 'V', '7', '1', '2', '8'), /* R50e, R51 (1) */ 1711 + TPV_QI1('7', '8', '7', '1', '0', '6'), /* R51e (1) */ 1712 + TPV_QI1('7', '6', '6', '9', '1', '6'), /* R52 (1) */ 1713 + TPV_QI1('7', '0', '6', '9', '2', '8'), /* R52, T43 (1) */ 1714 + 1715 + TPV_QI0('I', 'Y', '6', '1'), /* T20 */ 1716 + TPV_QI0('K', 'Z', '3', '4'), /* T21 */ 1717 + TPV_QI0('1', '6', '3', '2'), /* T22 */ 1718 + TPV_QI1('1', 'A', '6', '4', '2', '3'), /* T23 (0) */ 1719 + TPV_QI1('1', 'I', '7', '1', '2', '0'), /* T30 (0) */ 1720 + TPV_QI1('1', 'Y', '6', '5', '2', '9'), /* T43/p (1) */ 1721 + 1722 + TPV_QL1('7', '9', 'E', '3', '5', '0'), /* T60/p */ 1723 + TPV_QL1('7', 'C', 'D', '2', '2', '2'), /* R60, R60i */ 1724 + TPV_QL0('7', 'E', 'D', '0'), /* R60e, R60i */ 1725 + 1726 + /* BIOS FW BIOS VERS EC FW EC VERS */ 1727 + TPV_QI2('1', 'W', '9', '0', '1', 'V', '2', '8'), /* R50e (1) */ 1728 + TPV_QL2('7', 'I', '3', '4', '7', '9', '5', '0'), /* T60/p wide */ 1729 + 1730 + /* X-series ------------------------- */ 1731 + /* FW MODEL BIOS VERS EC VERS */ 1732 + TPV_QI0('I', 'Z', '9', 'D'), /* X20, X21 */ 1733 + TPV_QI0('1', 'D', '7', '0'), /* X22, X23, X24 */ 1734 + TPV_QI1('1', 'K', '4', '8', '1', '8'), /* X30 (0) */ 1735 + TPV_QI1('1', 'Q', '9', '7', '2', '3'), /* X31, X32 (0) */ 1736 + TPV_QI1('1', 'U', 'D', '3', 'B', '2'), /* X40 (0) */ 1737 + TPV_QI1('7', '4', '6', '4', '2', '7'), /* X41 (0) */ 1738 + TPV_QI1('7', '5', '6', '0', '2', '0'), /* X41t (0) */ 1739 + 1740 + TPV_QL0('7', 'B', 'D', '7'), /* X60/s */ 1741 + TPV_QL0('7', 'J', '3', '0'), /* X60t */ 1742 + 1743 + /* (0) - older versions lack DMI EC fw string and functionality */ 1744 + /* (1) - older versions known to lack functionality */ 1745 + }; 1746 + 1747 + #undef TPV_QL1 1748 + #undef TPV_QL0 1749 + #undef TPV_QI2 1750 + #undef TPV_QI1 1751 + #undef TPV_QI0 1752 + #undef TPV_Q_X 1753 + #undef TPV_Q 1754 + 1755 + static void __init tpacpi_check_outdated_fw(void) 1756 + { 1757 + unsigned long fwvers; 1758 + u16 ec_version, bios_version; 1759 + 1760 + fwvers = tpacpi_check_quirks(tpacpi_bios_version_qtable, 1761 + ARRAY_SIZE(tpacpi_bios_version_qtable)); 1762 + 1763 + if (!fwvers) 1764 + return; 1765 + 1766 + bios_version = fwvers & 0xffffU; 1767 + ec_version = (fwvers >> 16) & 0xffffU; 1768 + 1769 + /* note that unknown versions are set to 0x0000 and we use that */ 1770 + if ((bios_version > thinkpad_id.bios_release) || 1771 + (ec_version > thinkpad_id.ec_release && 1772 + ec_version != TPACPI_MATCH_ANY)) { 1773 + /* 1774 + * The changelogs would let us track down the exact 1775 + * reason, but it is just too much of a pain to track 1776 + * it. We only list BIOSes that are either really 1777 + * broken, or really stable to begin with, so it is 1778 + * best if the user upgrades the firmware anyway. 1779 + */ 1780 + printk(TPACPI_WARN 1781 + "WARNING: Outdated ThinkPad BIOS/EC firmware\n"); 1782 + printk(TPACPI_WARN 1783 + "WARNING: This firmware may be missing critical bug " 1784 + "fixes and/or important features\n"); 1785 + } 1786 + } 1787 + 1788 + static bool __init tpacpi_is_fw_known(void) 1789 + { 1790 + return tpacpi_check_quirks(tpacpi_bios_version_qtable, 1791 + ARRAY_SIZE(tpacpi_bios_version_qtable)) != 0; 1792 + } 1793 + 1605 1794 /**************************************************************************** 1606 1795 **************************************************************************** 1607 1796 * ··· 1825 1634 (thinkpad_id.nummodel_str) ? 1826 1635 thinkpad_id.nummodel_str : "unknown"); 1827 1636 1637 + tpacpi_check_outdated_fw(); 1828 1638 return 0; 1829 1639 } 1830 1640 ··· 1923 1731 u8 volume_level; 1924 1732 }; 1925 1733 1734 + /* kthread for the hotkey poller */ 1926 1735 static struct task_struct *tpacpi_hotkey_task; 1927 - static u32 hotkey_source_mask; /* bit mask 0=ACPI,1=NVRAM */ 1928 - static int hotkey_poll_freq = 10; /* Hz */ 1736 + 1737 + /* Acquired while the poller kthread is running, use to sync start/stop */ 1929 1738 static struct mutex hotkey_thread_mutex; 1739 + 1740 + /* 1741 + * Acquire mutex to write poller control variables. 1742 + * Increment hotkey_config_change when changing them. 1743 + * 1744 + * See HOTKEY_CONFIG_CRITICAL_START/HOTKEY_CONFIG_CRITICAL_END 1745 + */ 1930 1746 static struct mutex hotkey_thread_data_mutex; 1931 1747 static unsigned int hotkey_config_change; 1748 + 1749 + /* 1750 + * hotkey poller control variables 1751 + * 1752 + * Must be atomic or readers will also need to acquire mutex 1753 + */ 1754 + static u32 hotkey_source_mask; /* bit mask 0=ACPI,1=NVRAM */ 1755 + static unsigned int hotkey_poll_freq = 10; /* Hz */ 1756 + 1757 + #define HOTKEY_CONFIG_CRITICAL_START \ 1758 + do { \ 1759 + mutex_lock(&hotkey_thread_data_mutex); \ 1760 + hotkey_config_change++; \ 1761 + } while (0); 1762 + #define HOTKEY_CONFIG_CRITICAL_END \ 1763 + mutex_unlock(&hotkey_thread_data_mutex); 1932 1764 1933 1765 #else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1934 1766 1935 1767 #define hotkey_source_mask 0U 1768 + #define HOTKEY_CONFIG_CRITICAL_START 1769 + #define HOTKEY_CONFIG_CRITICAL_END 1936 1770 1937 1771 #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1938 1772 ··· 1982 1764 static u16 *hotkey_keycode_map; 1983 1765 1984 1766 static struct attribute_set *hotkey_dev_attributes; 1985 - 1986 - #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 1987 - #define HOTKEY_CONFIG_CRITICAL_START \ 1988 - do { \ 1989 - mutex_lock(&hotkey_thread_data_mutex); \ 1990 - hotkey_config_change++; \ 1991 - } while (0); 1992 - #define HOTKEY_CONFIG_CRITICAL_END \ 1993 - mutex_unlock(&hotkey_thread_data_mutex); 1994 - #else 1995 - #define HOTKEY_CONFIG_CRITICAL_START 1996 - #define HOTKEY_CONFIG_CRITICAL_END 1997 - #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1998 1767 1999 1768 /* HKEY.MHKG() return bits */ 2000 1769 #define TP_HOTKEY_TABLET_MASK (1 << 3) ··· 2027 1822 if (!acpi_evalf(hkey_handle, &m, "DHKN", "d")) 2028 1823 return -EIO; 2029 1824 } 1825 + HOTKEY_CONFIG_CRITICAL_START 2030 1826 hotkey_mask = m | (hotkey_source_mask & hotkey_mask); 1827 + HOTKEY_CONFIG_CRITICAL_END 2031 1828 2032 1829 return 0; 2033 1830 } ··· 2282 2075 unsigned int si, so; 2283 2076 unsigned long t; 2284 2077 unsigned int change_detector, must_reset; 2078 + unsigned int poll_freq; 2285 2079 2286 2080 mutex_lock(&hotkey_thread_mutex); 2287 2081 ··· 2299 2091 mutex_lock(&hotkey_thread_data_mutex); 2300 2092 change_detector = hotkey_config_change; 2301 2093 mask = hotkey_source_mask & hotkey_mask; 2094 + poll_freq = hotkey_poll_freq; 2302 2095 mutex_unlock(&hotkey_thread_data_mutex); 2303 2096 hotkey_read_nvram(&s[so], mask); 2304 2097 2305 - while (!kthread_should_stop() && hotkey_poll_freq) { 2306 - if (t == 0) 2307 - t = 1000/hotkey_poll_freq; 2098 + while (!kthread_should_stop()) { 2099 + if (t == 0) { 2100 + if (likely(poll_freq)) 2101 + t = 1000/poll_freq; 2102 + else 2103 + t = 100; /* should never happen... */ 2104 + } 2308 2105 t = msleep_interruptible(t); 2309 2106 if (unlikely(kthread_should_stop())) 2310 2107 break; ··· 2325 2112 change_detector = hotkey_config_change; 2326 2113 } 2327 2114 mask = hotkey_source_mask & hotkey_mask; 2115 + poll_freq = hotkey_poll_freq; 2328 2116 mutex_unlock(&hotkey_thread_data_mutex); 2329 2117 2330 2118 if (likely(mask)) { ··· 2345 2131 return 0; 2346 2132 } 2347 2133 2134 + /* call with hotkey_mutex held */ 2348 2135 static void hotkey_poll_stop_sync(void) 2349 2136 { 2350 2137 if (tpacpi_hotkey_task) { ··· 2362 2147 } 2363 2148 2364 2149 /* call with hotkey_mutex held */ 2365 - static void hotkey_poll_setup(int may_warn) 2150 + static void hotkey_poll_setup(bool may_warn) 2366 2151 { 2367 - if ((hotkey_source_mask & hotkey_mask) != 0 && 2368 - hotkey_poll_freq > 0 && 2152 + u32 hotkeys_to_poll = hotkey_source_mask & hotkey_mask; 2153 + 2154 + if (hotkeys_to_poll != 0 && hotkey_poll_freq > 0 && 2369 2155 (tpacpi_inputdev->users > 0 || hotkey_report_mode < 2)) { 2370 2156 if (!tpacpi_hotkey_task) { 2371 2157 tpacpi_hotkey_task = kthread_run(hotkey_kthread, ··· 2380 2164 } 2381 2165 } else { 2382 2166 hotkey_poll_stop_sync(); 2383 - if (may_warn && 2384 - hotkey_source_mask != 0 && hotkey_poll_freq == 0) { 2167 + if (may_warn && hotkeys_to_poll != 0 && 2168 + hotkey_poll_freq == 0) { 2385 2169 printk(TPACPI_NOTICE 2386 2170 "hot keys 0x%08x require polling, " 2387 2171 "which is currently disabled\n", 2388 - hotkey_source_mask); 2172 + hotkeys_to_poll); 2389 2173 } 2390 2174 } 2391 2175 } 2392 2176 2393 - static void hotkey_poll_setup_safe(int may_warn) 2177 + static void hotkey_poll_setup_safe(bool may_warn) 2394 2178 { 2395 2179 mutex_lock(&hotkey_mutex); 2396 2180 hotkey_poll_setup(may_warn); 2397 2181 mutex_unlock(&hotkey_mutex); 2398 2182 } 2399 2183 2184 + /* call with hotkey_mutex held */ 2185 + static void hotkey_poll_set_freq(unsigned int freq) 2186 + { 2187 + if (!freq) 2188 + hotkey_poll_stop_sync(); 2189 + 2190 + HOTKEY_CONFIG_CRITICAL_START 2191 + hotkey_poll_freq = freq; 2192 + HOTKEY_CONFIG_CRITICAL_END 2193 + } 2194 + 2400 2195 #else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 2401 2196 2402 - static void hotkey_poll_setup_safe(int __unused) 2197 + static void hotkey_poll_setup_safe(bool __unused) 2403 2198 { 2404 2199 } 2405 2200 ··· 2428 2201 case TPACPI_LIFE_EXITING: 2429 2202 return -EBUSY; 2430 2203 case TPACPI_LIFE_RUNNING: 2431 - hotkey_poll_setup_safe(0); 2204 + hotkey_poll_setup_safe(false); 2432 2205 return 0; 2433 2206 } 2434 2207 ··· 2441 2214 { 2442 2215 /* disable hotkey polling when possible */ 2443 2216 if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING) 2444 - hotkey_poll_setup_safe(0); 2217 + hotkey_poll_setup_safe(false); 2445 2218 } 2446 2219 2447 2220 /* sysfs hotkey enable ------------------------------------------------- */ ··· 2515 2288 res = hotkey_mask_set(t); 2516 2289 2517 2290 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2518 - hotkey_poll_setup(1); 2291 + hotkey_poll_setup(true); 2519 2292 #endif 2520 2293 2521 2294 mutex_unlock(&hotkey_mutex); ··· 2545 2318 struct device_attribute *attr, 2546 2319 char *buf) 2547 2320 { 2321 + printk_deprecated_attribute("hotkey_bios_mask", 2322 + "This attribute is useless."); 2548 2323 return snprintf(buf, PAGE_SIZE, "0x%08x\n", hotkey_orig_mask); 2549 2324 } 2550 2325 ··· 2606 2377 hotkey_source_mask = t; 2607 2378 HOTKEY_CONFIG_CRITICAL_END 2608 2379 2609 - hotkey_poll_setup(1); 2380 + hotkey_poll_setup(true); 2381 + hotkey_mask_set(hotkey_mask); 2610 2382 2611 2383 mutex_unlock(&hotkey_mutex); 2612 2384 ··· 2640 2410 if (mutex_lock_killable(&hotkey_mutex)) 2641 2411 return -ERESTARTSYS; 2642 2412 2643 - hotkey_poll_freq = t; 2413 + hotkey_poll_set_freq(t); 2414 + hotkey_poll_setup(true); 2644 2415 2645 - hotkey_poll_setup(1); 2646 2416 mutex_unlock(&hotkey_mutex); 2647 2417 2648 2418 tpacpi_disclose_usertask("hotkey_poll_freq", "set to %lu\n", t); ··· 2833 2603 static void hotkey_exit(void) 2834 2604 { 2835 2605 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2606 + mutex_lock(&hotkey_mutex); 2836 2607 hotkey_poll_stop_sync(); 2608 + mutex_unlock(&hotkey_mutex); 2837 2609 #endif 2838 2610 2839 2611 if (hotkey_dev_attributes) ··· 2852 2620 printk(TPACPI_ERR 2853 2621 "failed to restore hot key mask " 2854 2622 "to BIOS defaults\n"); 2623 + } 2624 + } 2625 + 2626 + static void __init hotkey_unmap(const unsigned int scancode) 2627 + { 2628 + if (hotkey_keycode_map[scancode] != KEY_RESERVED) { 2629 + clear_bit(hotkey_keycode_map[scancode], 2630 + tpacpi_inputdev->keybit); 2631 + hotkey_keycode_map[scancode] = KEY_RESERVED; 2855 2632 } 2856 2633 } 2857 2634 ··· 2942 2701 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 2943 2702 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 2944 2703 2945 - /* These either have to go through ACPI video, or 2946 - * act like in the IBM ThinkPads, so don't ever 2947 - * enable them by default */ 2948 - KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ 2949 - KEY_RESERVED, /* 0x10: FN+END (brightness down) */ 2704 + /* These should be enabled --only-- when ACPI video 2705 + * is disabled (i.e. in "vendor" mode), and are handled 2706 + * in a special way by the init code */ 2707 + KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ 2708 + KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ 2950 2709 2951 2710 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 2952 2711 ··· 3072 2831 goto err_exit; 3073 2832 } 3074 2833 3075 - #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 3076 - if (tp_features.hotkey_mask) { 3077 - hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 3078 - & ~hotkey_all_mask; 3079 - } else { 3080 - hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; 3081 - } 3082 - 3083 - vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3084 - "hotkey source mask 0x%08x, polling freq %d\n", 3085 - hotkey_source_mask, hotkey_poll_freq); 3086 - #endif 3087 - 3088 2834 #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES 3089 2835 if (dbg_wlswemul) { 3090 2836 tp_features.hotkey_wlsw = 1; ··· 3172 2944 "Disabling thinkpad-acpi brightness events " 3173 2945 "by default...\n"); 3174 2946 3175 - /* The hotkey_reserved_mask change below is not 3176 - * necessary while the keys are at KEY_RESERVED in the 3177 - * default map, but better safe than sorry, leave it 3178 - * here as a marker of what we have to do, especially 3179 - * when we finally become able to set this at runtime 3180 - * on response to X.org requests */ 2947 + /* Disable brightness up/down on Lenovo thinkpads when 2948 + * ACPI is handling them, otherwise it is plain impossible 2949 + * for userspace to do something even remotely sane */ 3181 2950 hotkey_reserved_mask |= 3182 2951 (1 << TP_ACPI_HOTKEYSCAN_FNHOME) 3183 2952 | (1 << TP_ACPI_HOTKEYSCAN_FNEND); 2953 + hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNHOME); 2954 + hotkey_unmap(TP_ACPI_HOTKEYSCAN_FNEND); 3184 2955 } 2956 + 2957 + #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2958 + if (tp_features.hotkey_mask) { 2959 + hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 2960 + & ~hotkey_all_mask 2961 + & ~hotkey_reserved_mask; 2962 + } else { 2963 + hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 2964 + & ~hotkey_reserved_mask; 2965 + } 2966 + 2967 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 2968 + "hotkey source mask 0x%08x, polling freq %u\n", 2969 + hotkey_source_mask, hotkey_poll_freq); 2970 + #endif 3185 2971 3186 2972 dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY, 3187 2973 "enabling firmware HKEY event interface...\n"); ··· 3220 2978 tpacpi_inputdev->open = &hotkey_inputdev_open; 3221 2979 tpacpi_inputdev->close = &hotkey_inputdev_close; 3222 2980 3223 - hotkey_poll_setup_safe(1); 2981 + hotkey_poll_setup_safe(true); 3224 2982 tpacpi_send_radiosw_update(); 3225 2983 tpacpi_input_send_tabletsw(); 3226 2984 ··· 3508 3266 hotkey_tablet_mode_notify_change(); 3509 3267 hotkey_wakeup_reason_notify_change(); 3510 3268 hotkey_wakeup_hotunplug_complete_notify_change(); 3511 - hotkey_poll_setup_safe(0); 3269 + hotkey_poll_setup_safe(false); 3512 3270 } 3513 3271 3514 3272 /* procfs -------------------------------------------------------------- */ ··· 3580 3338 hotkey_enabledisable_warn(0); 3581 3339 res = -EPERM; 3582 3340 } else if (strlencmp(cmd, "reset") == 0) { 3583 - mask = hotkey_orig_mask; 3341 + mask = (hotkey_all_mask | hotkey_source_mask) 3342 + & ~hotkey_reserved_mask; 3584 3343 } else if (sscanf(cmd, "0x%x", &mask) == 1) { 3585 3344 /* mask set */ 3586 3345 } else if (sscanf(cmd, "%x", &mask) == 1) { ··· 5898 5655 /* Models with ATI GPUs known to require ECNVRAM mode */ 5899 5656 TPACPI_Q_IBM('1', 'Y', TPACPI_BRGHT_Q_EC), /* T43/p ATI */ 5900 5657 5901 - /* Models with ATI GPUs (waiting confirmation) */ 5902 - TPACPI_Q_IBM('1', 'R', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), 5658 + /* Models with ATI GPUs that can use ECNVRAM */ 5659 + TPACPI_Q_IBM('1', 'R', TPACPI_BRGHT_Q_EC), 5903 5660 TPACPI_Q_IBM('1', 'Q', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), 5904 5661 TPACPI_Q_IBM('7', '6', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), 5905 5662 TPACPI_Q_IBM('7', '8', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC), 5906 5663 5907 - /* Models with Intel Extreme Graphics 2 (waiting confirmation) */ 5664 + /* Models with Intel Extreme Graphics 2 */ 5665 + TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC), 5908 5666 TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC), 5909 5667 TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC), 5910 - TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC), 5911 5668 5912 5669 /* Models with Intel GMA900 */ 5913 5670 TPACPI_Q_IBM('7', '0', TPACPI_BRGHT_Q_NOEC), /* T43, R52 */ ··· 7767 7524 7768 7525 /* 7769 7526 * Non-ancient models have better DMI tagging, but very old models 7770 - * don't. 7527 + * don't. tpacpi_is_fw_known() is a cheat to help in that case. 7771 7528 */ 7772 - is_thinkpad = (thinkpad_id.model_str != NULL); 7529 + is_thinkpad = (thinkpad_id.model_str != NULL) || 7530 + (thinkpad_id.ec_model != 0) || 7531 + tpacpi_is_fw_known(); 7773 7532 7774 7533 /* ec is required because many other handles are relative to it */ 7775 7534 TPACPI_ACPIHANDLE_INIT(ec); ··· 7781 7536 "Not yet supported ThinkPad detected!\n"); 7782 7537 return -ENODEV; 7783 7538 } 7784 - 7785 - /* 7786 - * Risks a regression on very old machines, but reduces potential 7787 - * false positives a damn great deal 7788 - */ 7789 - if (!is_thinkpad) 7790 - is_thinkpad = (thinkpad_id.vendor == PCI_VENDOR_ID_IBM); 7791 7539 7792 7540 if (!is_thinkpad && !force_load) 7793 7541 return -ENODEV;
+265
drivers/platform/x86/topstar-laptop.c
··· 1 + /* 2 + * ACPI driver for Topstar notebooks (hotkeys support only) 3 + * 4 + * Copyright (c) 2009 Herton Ronaldo Krzesinski <herton@mandriva.com.br> 5 + * 6 + * Implementation inspired by existing x86 platform drivers, in special 7 + * asus/eepc/fujitsu-laptop, thanks to their authors 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + */ 13 + 14 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15 + 16 + #include <linux/kernel.h> 17 + #include <linux/module.h> 18 + #include <linux/init.h> 19 + #include <linux/acpi.h> 20 + #include <linux/input.h> 21 + 22 + #define ACPI_TOPSTAR_CLASS "topstar" 23 + 24 + struct topstar_hkey { 25 + struct input_dev *inputdev; 26 + }; 27 + 28 + struct tps_key_entry { 29 + u8 code; 30 + u16 keycode; 31 + }; 32 + 33 + static struct tps_key_entry topstar_keymap[] = { 34 + { 0x80, KEY_BRIGHTNESSUP }, 35 + { 0x81, KEY_BRIGHTNESSDOWN }, 36 + { 0x83, KEY_VOLUMEUP }, 37 + { 0x84, KEY_VOLUMEDOWN }, 38 + { 0x85, KEY_MUTE }, 39 + { 0x86, KEY_SWITCHVIDEOMODE }, 40 + { 0x87, KEY_F13 }, /* touchpad enable/disable key */ 41 + { 0x88, KEY_WLAN }, 42 + { 0x8a, KEY_WWW }, 43 + { 0x8b, KEY_MAIL }, 44 + { 0x8c, KEY_MEDIA }, 45 + { 0x96, KEY_F14 }, /* G key? */ 46 + { } 47 + }; 48 + 49 + static struct tps_key_entry *tps_get_key_by_scancode(int code) 50 + { 51 + struct tps_key_entry *key; 52 + 53 + for (key = topstar_keymap; key->code; key++) 54 + if (code == key->code) 55 + return key; 56 + 57 + return NULL; 58 + } 59 + 60 + static struct tps_key_entry *tps_get_key_by_keycode(int code) 61 + { 62 + struct tps_key_entry *key; 63 + 64 + for (key = topstar_keymap; key->code; key++) 65 + if (code == key->keycode) 66 + return key; 67 + 68 + return NULL; 69 + } 70 + 71 + static void acpi_topstar_notify(struct acpi_device *device, u32 event) 72 + { 73 + struct tps_key_entry *key; 74 + static bool dup_evnt[2]; 75 + bool *dup; 76 + struct topstar_hkey *hkey = acpi_driver_data(device); 77 + 78 + /* 0x83 and 0x84 key events comes duplicated... */ 79 + if (event == 0x83 || event == 0x84) { 80 + dup = &dup_evnt[event - 0x83]; 81 + if (*dup) { 82 + *dup = false; 83 + return; 84 + } 85 + *dup = true; 86 + } 87 + 88 + /* 89 + * 'G key' generate two event codes, convert to only 90 + * one event/key code for now (3G switch?) 91 + */ 92 + if (event == 0x97) 93 + event = 0x96; 94 + 95 + key = tps_get_key_by_scancode(event); 96 + if (key) { 97 + input_report_key(hkey->inputdev, key->keycode, 1); 98 + input_sync(hkey->inputdev); 99 + input_report_key(hkey->inputdev, key->keycode, 0); 100 + input_sync(hkey->inputdev); 101 + return; 102 + } 103 + 104 + /* Known non hotkey events don't handled or that we don't care yet */ 105 + if (event == 0x8e || event == 0x8f || event == 0x90) 106 + return; 107 + 108 + pr_info("unknown event = 0x%02x\n", event); 109 + } 110 + 111 + static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) 112 + { 113 + acpi_status status; 114 + union acpi_object fncx_params[1] = { 115 + { .type = ACPI_TYPE_INTEGER } 116 + }; 117 + struct acpi_object_list fncx_arg_list = { 1, &fncx_params[0] }; 118 + 119 + fncx_params[0].integer.value = state ? 0x86 : 0x87; 120 + status = acpi_evaluate_object(device->handle, "FNCX", &fncx_arg_list, NULL); 121 + if (ACPI_FAILURE(status)) { 122 + pr_err("Unable to switch FNCX notifications\n"); 123 + return -ENODEV; 124 + } 125 + 126 + return 0; 127 + } 128 + 129 + static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) 130 + { 131 + struct tps_key_entry *key = tps_get_key_by_scancode(scancode); 132 + 133 + if (!key) 134 + return -EINVAL; 135 + 136 + *keycode = key->keycode; 137 + return 0; 138 + } 139 + 140 + static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) 141 + { 142 + struct tps_key_entry *key; 143 + int old_keycode; 144 + 145 + if (keycode < 0 || keycode > KEY_MAX) 146 + return -EINVAL; 147 + 148 + key = tps_get_key_by_scancode(scancode); 149 + 150 + if (!key) 151 + return -EINVAL; 152 + 153 + old_keycode = key->keycode; 154 + key->keycode = keycode; 155 + set_bit(keycode, dev->keybit); 156 + if (!tps_get_key_by_keycode(old_keycode)) 157 + clear_bit(old_keycode, dev->keybit); 158 + return 0; 159 + } 160 + 161 + static int acpi_topstar_init_hkey(struct topstar_hkey *hkey) 162 + { 163 + struct tps_key_entry *key; 164 + 165 + hkey->inputdev = input_allocate_device(); 166 + if (!hkey->inputdev) { 167 + pr_err("Unable to allocate input device\n"); 168 + return -ENODEV; 169 + } 170 + hkey->inputdev->name = "Topstar Laptop extra buttons"; 171 + hkey->inputdev->phys = "topstar/input0"; 172 + hkey->inputdev->id.bustype = BUS_HOST; 173 + hkey->inputdev->getkeycode = topstar_getkeycode; 174 + hkey->inputdev->setkeycode = topstar_setkeycode; 175 + for (key = topstar_keymap; key->code; key++) { 176 + set_bit(EV_KEY, hkey->inputdev->evbit); 177 + set_bit(key->keycode, hkey->inputdev->keybit); 178 + } 179 + if (input_register_device(hkey->inputdev)) { 180 + pr_err("Unable to register input device\n"); 181 + input_free_device(hkey->inputdev); 182 + return -ENODEV; 183 + } 184 + 185 + return 0; 186 + } 187 + 188 + static int acpi_topstar_add(struct acpi_device *device) 189 + { 190 + struct topstar_hkey *tps_hkey; 191 + 192 + tps_hkey = kzalloc(sizeof(struct topstar_hkey), GFP_KERNEL); 193 + if (!tps_hkey) 194 + return -ENOMEM; 195 + 196 + strcpy(acpi_device_name(device), "Topstar TPSACPI"); 197 + strcpy(acpi_device_class(device), ACPI_TOPSTAR_CLASS); 198 + 199 + if (acpi_topstar_fncx_switch(device, true)) 200 + goto add_err; 201 + 202 + if (acpi_topstar_init_hkey(tps_hkey)) 203 + goto add_err; 204 + 205 + device->driver_data = tps_hkey; 206 + return 0; 207 + 208 + add_err: 209 + kfree(tps_hkey); 210 + return -ENODEV; 211 + } 212 + 213 + static int acpi_topstar_remove(struct acpi_device *device, int type) 214 + { 215 + struct topstar_hkey *tps_hkey = acpi_driver_data(device); 216 + 217 + acpi_topstar_fncx_switch(device, false); 218 + 219 + input_unregister_device(tps_hkey->inputdev); 220 + kfree(tps_hkey); 221 + 222 + return 0; 223 + } 224 + 225 + static const struct acpi_device_id topstar_device_ids[] = { 226 + { "TPSACPI01", 0 }, 227 + { "", 0 }, 228 + }; 229 + MODULE_DEVICE_TABLE(acpi, topstar_device_ids); 230 + 231 + static struct acpi_driver acpi_topstar_driver = { 232 + .name = "Topstar laptop ACPI driver", 233 + .class = ACPI_TOPSTAR_CLASS, 234 + .ids = topstar_device_ids, 235 + .ops = { 236 + .add = acpi_topstar_add, 237 + .remove = acpi_topstar_remove, 238 + .notify = acpi_topstar_notify, 239 + }, 240 + }; 241 + 242 + static int __init topstar_laptop_init(void) 243 + { 244 + int ret; 245 + 246 + ret = acpi_bus_register_driver(&acpi_topstar_driver); 247 + if (ret < 0) 248 + return ret; 249 + 250 + printk(KERN_INFO "Topstar Laptop ACPI extras driver loaded\n"); 251 + 252 + return 0; 253 + } 254 + 255 + static void __exit topstar_laptop_exit(void) 256 + { 257 + acpi_bus_unregister_driver(&acpi_topstar_driver); 258 + } 259 + 260 + module_init(topstar_laptop_init); 261 + module_exit(topstar_laptop_exit); 262 + 263 + MODULE_AUTHOR("Herton Ronaldo Krzesinski"); 264 + MODULE_DESCRIPTION("Topstar Laptop ACPI Extras driver"); 265 + MODULE_LICENSE("GPL");
-1
drivers/platform/x86/wmi.c
··· 42 42 43 43 #define ACPI_WMI_CLASS "wmi" 44 44 45 - #undef PREFIX 46 45 #define PREFIX "ACPI: WMI: " 47 46 48 47 static DEFINE_MUTEX(wmi_data_lock);
+3 -3
drivers/pnp/pnpacpi/core.c
··· 194 194 pnpacpi_parse_resource_option_data(dev); 195 195 196 196 if (device->flags.compatible_ids) { 197 - struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 197 + struct acpica_device_id_list *cid_list = device->pnp.cid_list; 198 198 int i; 199 199 200 200 for (i = 0; i < cid_list->count; i++) { 201 - if (!ispnpidacpi(cid_list->id[i].value)) 201 + if (!ispnpidacpi(cid_list->ids[i].string)) 202 202 continue; 203 - pnp_add_id(dev, cid_list->id[i].value); 203 + pnp_add_id(dev, cid_list->ids[i].string); 204 204 } 205 205 } 206 206
+1
drivers/thermal/Kconfig
··· 15 15 16 16 config THERMAL_HWMON 17 17 bool "Hardware monitoring support" 18 + depends on THERMAL 18 19 depends on HWMON=y || HWMON=THERMAL 19 20 help 20 21 The generic thermal sysfs driver's hardware monitoring support
+5 -11
include/acpi/acpi_bus.h
··· 30 30 31 31 #include <acpi/acpi.h> 32 32 33 - #define PREFIX "ACPI: " 34 - 35 33 /* TBD: Make dynamic */ 36 34 #define ACPI_MAX_HANDLES 10 37 35 struct acpi_handle_list { ··· 87 89 typedef int (*acpi_op_add) (struct acpi_device * device); 88 90 typedef int (*acpi_op_remove) (struct acpi_device * device, int type); 89 91 typedef int (*acpi_op_start) (struct acpi_device * device); 90 - typedef int (*acpi_op_stop) (struct acpi_device * device, int type); 91 92 typedef int (*acpi_op_suspend) (struct acpi_device * device, 92 93 pm_message_t state); 93 94 typedef int (*acpi_op_resume) (struct acpi_device * device); ··· 103 106 acpi_op_add add; 104 107 acpi_op_remove remove; 105 108 acpi_op_start start; 106 - acpi_op_stop stop; 107 109 acpi_op_suspend suspend; 108 110 acpi_op_resume resume; 109 111 acpi_op_bind bind; ··· 169 173 170 174 typedef char acpi_bus_id[8]; 171 175 typedef unsigned long acpi_bus_address; 172 - typedef char acpi_hardware_id[15]; 173 - typedef char acpi_unique_id[9]; 174 176 typedef char acpi_device_name[40]; 175 177 typedef char acpi_device_class[20]; 176 178 177 179 struct acpi_device_pnp { 178 180 acpi_bus_id bus_id; /* Object name */ 179 181 acpi_bus_address bus_address; /* _ADR */ 180 - acpi_hardware_id hardware_id; /* _HID */ 181 - struct acpi_compatible_id_list *cid_list; /* _CIDs */ 182 - acpi_unique_id unique_id; /* _UID */ 182 + char *hardware_id; /* _HID */ 183 + struct acpica_device_id_list *cid_list; /* _CIDs */ 184 + char *unique_id; /* _UID */ 183 185 acpi_device_name device_name; /* Driver-determined */ 184 186 acpi_device_class device_class; /* " */ 185 187 }; ··· 308 314 309 315 extern struct kobject *acpi_kobj; 310 316 extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 311 - void acpi_bus_private_data_handler(acpi_handle, u32, void *); 317 + void acpi_bus_private_data_handler(acpi_handle, void *); 312 318 int acpi_bus_get_private_data(acpi_handle, void **); 313 319 extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 314 320 extern int register_acpi_notifier(struct notifier_block *); ··· 321 327 */ 322 328 323 329 int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); 324 - void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context); 330 + void acpi_bus_data_handler(acpi_handle handle, void *context); 325 331 int acpi_bus_get_status(struct acpi_device *device); 326 332 int acpi_bus_get_power(acpi_handle handle, int *state); 327 333 int acpi_bus_set_power(acpi_handle handle, int state);
+3
include/acpi/acpiosxf.h
··· 245 245 acpi_status 246 246 acpi_os_validate_address(u8 space_id, acpi_physical_address address, 247 247 acpi_size length, char *name); 248 + acpi_status 249 + acpi_os_invalidate_address(u8 space_id, acpi_physical_address address, 250 + acpi_size length); 248 251 249 252 u64 acpi_os_get_timer(void); 250 253
+6 -4
include/acpi/acpixf.h
··· 47 47 48 48 /* Current ACPICA subsystem version in YYYYMMDD format */ 49 49 50 - #define ACPI_CA_VERSION 0x20090521 50 + #define ACPI_CA_VERSION 0x20090903 51 51 52 52 #include "actypes.h" 53 53 #include "actbl.h" ··· 64 64 extern u8 acpi_gbl_all_methods_serialized; 65 65 extern u8 acpi_gbl_create_osi_method; 66 66 extern u8 acpi_gbl_leave_wake_gpes_disabled; 67 + extern u8 acpi_gbl_use_default_register_widths; 67 68 extern acpi_name acpi_gbl_trace_method_name; 68 69 extern u32 acpi_gbl_trace_flags; 69 70 ··· 200 199 acpi_object_type return_type); 201 200 202 201 acpi_status 203 - acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202 + acpi_get_object_info(acpi_handle handle, 203 + struct acpi_device_info **return_buffer); 204 204 205 205 acpi_status acpi_install_method(u8 *buffer); 206 206 ··· 361 359 acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); 362 360 #endif 363 361 364 - acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); 362 + acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); 365 363 366 - acpi_status acpi_write(u32 value, struct acpi_generic_address *reg); 364 + acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); 367 365 368 366 acpi_status 369 367 acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);
+51 -27
include/acpi/actbl.h
··· 44 44 #ifndef __ACTBL_H__ 45 45 #define __ACTBL_H__ 46 46 47 + /******************************************************************************* 48 + * 49 + * Fundamental ACPI tables 50 + * 51 + * This file contains definitions for the ACPI tables that are directly consumed 52 + * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related 53 + * device drivers and other OS support code. 54 + * 55 + * The RSDP and FACS do not use the common ACPI table header. All other ACPI 56 + * tables use the header. 57 + * 58 + ******************************************************************************/ 59 + 47 60 /* 48 - * Values for description table header signatures. Useful because they make 49 - * it more difficult to inadvertently type in the wrong signature. 61 + * Values for description table header signatures for tables defined in this 62 + * file. Useful because they make it more difficult to inadvertently type in 63 + * the wrong signature. 50 64 */ 51 65 #define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ 52 66 #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ ··· 79 65 #pragma pack(1) 80 66 81 67 /* 82 - * These are the ACPI tables that are directly consumed by the subsystem. 83 - * 84 - * The RSDP and FACS do not use the common ACPI table header. All other ACPI 85 - * tables use the header. 86 - * 87 68 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 88 69 * This is the only type that is even remotely portable. Anything else is not 89 70 * portable, so do not use any other bitfield types. ··· 86 77 87 78 /******************************************************************************* 88 79 * 89 - * ACPI Table Header. This common header is used by all tables except the 90 - * RSDP and FACS. The define is used for direct inclusion of header into 91 - * other ACPI tables 80 + * Master ACPI Table Header. This common header is used by all ACPI tables 81 + * except the RSDP and FACS. 92 82 * 93 83 ******************************************************************************/ 94 84 ··· 103 95 u32 asl_compiler_revision; /* ASL compiler version */ 104 96 }; 105 97 106 - /* 98 + /******************************************************************************* 99 + * 107 100 * GAS - Generic Address Structure (ACPI 2.0+) 108 101 * 109 102 * Note: Since this structure is used in the ACPI tables, it is byte aligned. 110 - * If misalignment is not supported, access to the Address field must be 111 - * performed with care. 112 - */ 103 + * If misaliged access is not supported by the hardware, accesses to the 104 + * 64-bit Address field must be performed with care. 105 + * 106 + ******************************************************************************/ 107 + 113 108 struct acpi_generic_address { 114 109 u8 space_id; /* Address space where struct or register exists */ 115 110 u8 bit_width; /* Size in bits of given register */ ··· 124 113 /******************************************************************************* 125 114 * 126 115 * RSDP - Root System Description Pointer (Signature is "RSD PTR ") 116 + * Version 2 127 117 * 128 118 ******************************************************************************/ 129 119 ··· 145 133 /******************************************************************************* 146 134 * 147 135 * RSDT/XSDT - Root System Description Tables 136 + * Version 1 (both) 148 137 * 149 138 ******************************************************************************/ 150 139 ··· 174 161 u32 flags; 175 162 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ 176 163 u8 version; /* Version of this table (ACPI 2.0+) */ 177 - u8 reserved[31]; /* Reserved, must be zero */ 164 + u8 reserved[3]; /* Reserved, must be zero */ 165 + u32 ospm_flags; /* Flags to be set by OSPM (ACPI 4.0) */ 166 + u8 reserved1[24]; /* Reserved, must be zero */ 178 167 }; 179 168 180 - /* Flag macros */ 169 + /* Masks for global_lock flag field above */ 181 170 182 - #define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ 171 + #define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */ 172 + #define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */ 183 173 184 - /* Global lock flags */ 174 + /* Masks for Flags field above */ 185 175 186 - #define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ 187 - #define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ 176 + #define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ 177 + #define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */ 178 + 179 + /* Masks for ospm_flags field above */ 180 + 181 + #define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */ 188 182 189 183 /******************************************************************************* 190 184 * 191 185 * FADT - Fixed ACPI Description Table (Signature "FACP") 186 + * Version 4 192 187 * 193 188 ******************************************************************************/ 194 189 ··· 257 236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 258 237 }; 259 238 260 - /* FADT Boot Architecture Flags (boot_flags) */ 239 + /* Masks for FADT Boot Architecture Flags (boot_flags) */ 261 240 262 241 #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 263 242 #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ ··· 267 246 268 247 #define FADT2_REVISION_ID 3 269 248 270 - /* FADT flags */ 249 + /* Masks for FADT flags */ 271 250 272 251 #define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ 273 252 #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ ··· 290 269 #define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 291 270 #define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 292 271 293 - /* FADT Prefered Power Management Profiles */ 272 + /* Values for preferred_profile (Prefered Power Management Profiles) */ 294 273 295 274 enum acpi_prefered_pm_profiles { 296 275 PM_UNSPECIFIED = 0, ··· 308 287 309 288 #define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 310 289 290 + /* 291 + * Internal table-related structures 292 + */ 311 293 union acpi_name_union { 312 294 u32 integer; 313 295 char ascii[4]; 314 296 }; 315 297 316 - /* 317 - * Internal ACPI Table Descriptor. One per ACPI table 318 - */ 298 + /* Internal ACPI Table Descriptor. One per ACPI table. */ 299 + 319 300 struct acpi_table_desc { 320 301 acpi_physical_address address; 321 302 struct acpi_table_header *pointer; ··· 327 304 u8 flags; 328 305 }; 329 306 330 - /* Flags for above */ 307 + /* Masks for Flags field above */ 331 308 332 309 #define ACPI_TABLE_ORIGIN_UNKNOWN (0) 333 310 #define ACPI_TABLE_ORIGIN_MAPPED (1) ··· 341 318 */ 342 319 343 320 #include <acpi/actbl1.h> 321 + #include <acpi/actbl2.h> 344 322 345 323 #endif /* __ACTBL_H__ */
+227 -655
include/acpi/actbl1.h
··· 46 46 47 47 /******************************************************************************* 48 48 * 49 - * Additional ACPI Tables 49 + * Additional ACPI Tables (1) 50 50 * 51 51 * These tables are not consumed directly by the ACPICA subsystem, but are 52 52 * included here to support device drivers and the AML disassembler. 53 53 * 54 + * The tables in this file are fully defined within the ACPI specification. 55 + * 54 56 ******************************************************************************/ 55 57 56 58 /* 57 - * Values for description table header signatures. Useful because they make 58 - * it more difficult to inadvertently type in the wrong signature. 59 + * Values for description table header signatures for tables defined in this 60 + * file. Useful because they make it more difficult to inadvertently type in 61 + * the wrong signature. 59 62 */ 60 - #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ 61 63 #define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ 62 - #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ 63 64 #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ 64 - #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 65 - #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ 66 65 #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ 67 66 #define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ 68 67 #define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ 69 68 #define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ 70 - #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 71 - #define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ 72 69 #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 73 - #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 70 + #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ 74 71 #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ 75 - #define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 76 72 #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ 77 - #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 78 - #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 79 73 #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ 80 - #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 81 - #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ 82 - #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ 83 - #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 84 74 85 75 /* 86 76 * All tables must be byte-packed to match the ACPI specification, since ··· 84 94 * portable, so do not use any other bitfield types. 85 95 */ 86 96 87 - /* Common Subtable header (used in MADT, SRAT, etc.) */ 97 + /******************************************************************************* 98 + * 99 + * Common subtable headers 100 + * 101 + ******************************************************************************/ 102 + 103 + /* Generic subtable header (used in MADT, SRAT, etc.) */ 88 104 89 105 struct acpi_subtable_header { 90 106 u8 type; 91 107 u8 length; 92 108 }; 93 109 94 - /* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ 110 + /* Subtable header for WHEA tables (EINJ, ERST, WDAT) */ 95 111 96 112 struct acpi_whea_header { 97 113 u8 action; ··· 111 115 112 116 /******************************************************************************* 113 117 * 114 - * ASF - Alert Standard Format table (Signature "ASF!") 115 - * 116 - * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 117 - * 118 - ******************************************************************************/ 119 - 120 - struct acpi_table_asf { 121 - struct acpi_table_header header; /* Common ACPI table header */ 122 - }; 123 - 124 - /* ASF subtable header */ 125 - 126 - struct acpi_asf_header { 127 - u8 type; 128 - u8 reserved; 129 - u16 length; 130 - }; 131 - 132 - /* Values for Type field above */ 133 - 134 - enum acpi_asf_type { 135 - ACPI_ASF_TYPE_INFO = 0, 136 - ACPI_ASF_TYPE_ALERT = 1, 137 - ACPI_ASF_TYPE_CONTROL = 2, 138 - ACPI_ASF_TYPE_BOOT = 3, 139 - ACPI_ASF_TYPE_ADDRESS = 4, 140 - ACPI_ASF_TYPE_RESERVED = 5 141 - }; 142 - 143 - /* 144 - * ASF subtables 145 - */ 146 - 147 - /* 0: ASF Information */ 148 - 149 - struct acpi_asf_info { 150 - struct acpi_asf_header header; 151 - u8 min_reset_value; 152 - u8 min_poll_interval; 153 - u16 system_id; 154 - u32 mfg_id; 155 - u8 flags; 156 - u8 reserved2[3]; 157 - }; 158 - 159 - /* 1: ASF Alerts */ 160 - 161 - struct acpi_asf_alert { 162 - struct acpi_asf_header header; 163 - u8 assert_mask; 164 - u8 deassert_mask; 165 - u8 alerts; 166 - u8 data_length; 167 - }; 168 - 169 - struct acpi_asf_alert_data { 170 - u8 address; 171 - u8 command; 172 - u8 mask; 173 - u8 value; 174 - u8 sensor_type; 175 - u8 type; 176 - u8 offset; 177 - u8 source_type; 178 - u8 severity; 179 - u8 sensor_number; 180 - u8 entity; 181 - u8 instance; 182 - }; 183 - 184 - /* 2: ASF Remote Control */ 185 - 186 - struct acpi_asf_remote { 187 - struct acpi_asf_header header; 188 - u8 controls; 189 - u8 data_length; 190 - u16 reserved2; 191 - }; 192 - 193 - struct acpi_asf_control_data { 194 - u8 function; 195 - u8 address; 196 - u8 command; 197 - u8 value; 198 - }; 199 - 200 - /* 3: ASF RMCP Boot Options */ 201 - 202 - struct acpi_asf_rmcp { 203 - struct acpi_asf_header header; 204 - u8 capabilities[7]; 205 - u8 completion_code; 206 - u32 enterprise_id; 207 - u8 command; 208 - u16 parameter; 209 - u16 boot_options; 210 - u16 oem_parameters; 211 - }; 212 - 213 - /* 4: ASF Address */ 214 - 215 - struct acpi_asf_address { 216 - struct acpi_asf_header header; 217 - u8 eprom_address; 218 - u8 devices; 219 - }; 220 - 221 - /******************************************************************************* 222 - * 223 - * BERT - Boot Error Record Table 118 + * BERT - Boot Error Record Table (ACPI 4.0) 119 + * Version 1 224 120 * 225 121 ******************************************************************************/ 226 122 ··· 122 234 u64 address; /* Physical addresss of the error region */ 123 235 }; 124 236 125 - /* Boot Error Region */ 237 + /* Boot Error Region (not a subtable, pointed to by Address field above) */ 126 238 127 239 struct acpi_bert_region { 128 - u32 block_status; 129 - u32 raw_data_offset; 130 - u32 raw_data_length; 131 - u32 data_length; 132 - u32 error_severity; 240 + u32 block_status; /* Type of error information */ 241 + u32 raw_data_offset; /* Offset to raw error data */ 242 + u32 raw_data_length; /* Length of raw error data */ 243 + u32 data_length; /* Length of generic error data */ 244 + u32 error_severity; /* Severity code */ 133 245 }; 134 246 135 - /* block_status Flags */ 247 + /* Values for block_status flags above */ 136 248 137 249 #define ACPI_BERT_UNCORRECTABLE (1) 138 - #define ACPI_BERT_CORRECTABLE (2) 139 - #define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) 140 - #define ACPI_BERT_MULTIPLE_CORRECTABLE (8) 250 + #define ACPI_BERT_CORRECTABLE (1<<1) 251 + #define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2) 252 + #define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3) 253 + #define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ 141 254 142 - /******************************************************************************* 143 - * 144 - * BOOT - Simple Boot Flag Table 145 - * 146 - ******************************************************************************/ 255 + /* Values for error_severity above */ 147 256 148 - struct acpi_table_boot { 149 - struct acpi_table_header header; /* Common ACPI table header */ 150 - u8 cmos_index; /* Index in CMOS RAM for the boot register */ 151 - u8 reserved[3]; 257 + enum acpi_bert_error_severity { 258 + ACPI_BERT_ERROR_CORRECTABLE = 0, 259 + ACPI_BERT_ERROR_FATAL = 1, 260 + ACPI_BERT_ERROR_CORRECTED = 2, 261 + ACPI_BERT_ERROR_NONE = 3, 262 + ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */ 152 263 }; 153 264 265 + /* 266 + * Note: The generic error data that follows the error_severity field above 267 + * uses the struct acpi_hest_generic_data defined under the HEST table below 268 + */ 269 + 154 270 /******************************************************************************* 155 271 * 156 - * CPEP - Corrected Platform Error Polling table 272 + * CPEP - Corrected Platform Error Polling table (ACPI 4.0) 273 + * Version 1 157 274 * 158 275 ******************************************************************************/ 159 276 ··· 170 277 /* Subtable */ 171 278 172 279 struct acpi_cpep_polling { 173 - u8 type; 174 - u8 length; 280 + struct acpi_subtable_header header; 175 281 u8 id; /* Processor ID */ 176 282 u8 eid; /* Processor EID */ 177 283 u32 interval; /* Polling interval (msec) */ ··· 178 286 179 287 /******************************************************************************* 180 288 * 181 - * DBGP - Debug Port table 182 - * 183 - ******************************************************************************/ 184 - 185 - struct acpi_table_dbgp { 186 - struct acpi_table_header header; /* Common ACPI table header */ 187 - u8 type; /* 0=full 16550, 1=subset of 16550 */ 188 - u8 reserved[3]; 189 - struct acpi_generic_address debug_port; 190 - }; 191 - 192 - /******************************************************************************* 193 - * 194 - * DMAR - DMA Remapping table 195 - * From "Intel Virtualization Technology for Directed I/O", Sept. 2007 196 - * 197 - ******************************************************************************/ 198 - 199 - struct acpi_table_dmar { 200 - struct acpi_table_header header; /* Common ACPI table header */ 201 - u8 width; /* Host Address Width */ 202 - u8 flags; 203 - u8 reserved[10]; 204 - }; 205 - 206 - /* Flags */ 207 - 208 - #define ACPI_DMAR_INTR_REMAP (1) 209 - 210 - /* DMAR subtable header */ 211 - 212 - struct acpi_dmar_header { 213 - u16 type; 214 - u16 length; 215 - }; 216 - 217 - /* Values for subtable type in struct acpi_dmar_header */ 218 - 219 - enum acpi_dmar_type { 220 - ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, 221 - ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, 222 - ACPI_DMAR_TYPE_ATSR = 2, 223 - ACPI_DMAR_TYPE_RESERVED = 3 /* 3 and greater are reserved */ 224 - }; 225 - 226 - struct acpi_dmar_device_scope { 227 - u8 entry_type; 228 - u8 length; 229 - u16 reserved; 230 - u8 enumeration_id; 231 - u8 bus; 232 - }; 233 - 234 - /* Values for entry_type in struct acpi_dmar_device_scope */ 235 - 236 - enum acpi_dmar_scope_type { 237 - ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, 238 - ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, 239 - ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, 240 - ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, 241 - ACPI_DMAR_SCOPE_TYPE_HPET = 4, 242 - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ 243 - }; 244 - 245 - struct acpi_dmar_pci_path { 246 - u8 dev; 247 - u8 fn; 248 - }; 249 - 250 - /* 251 - * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header 252 - */ 253 - 254 - /* 0: Hardware Unit Definition */ 255 - 256 - struct acpi_dmar_hardware_unit { 257 - struct acpi_dmar_header header; 258 - u8 flags; 259 - u8 reserved; 260 - u16 segment; 261 - u64 address; /* Register Base Address */ 262 - }; 263 - 264 - /* Flags */ 265 - 266 - #define ACPI_DMAR_INCLUDE_ALL (1) 267 - 268 - /* 1: Reserved Memory Defininition */ 269 - 270 - struct acpi_dmar_reserved_memory { 271 - struct acpi_dmar_header header; 272 - u16 reserved; 273 - u16 segment; 274 - u64 base_address; /* 4_k aligned base address */ 275 - u64 end_address; /* 4_k aligned limit address */ 276 - }; 277 - 278 - /* Flags */ 279 - 280 - #define ACPI_DMAR_ALLOW_ALL (1) 281 - 282 - 283 - /* 2: Root Port ATS Capability Reporting Structure */ 284 - 285 - struct acpi_dmar_atsr { 286 - struct acpi_dmar_header header; 287 - u8 flags; 288 - u8 reserved; 289 - u16 segment; 290 - }; 291 - 292 - /* Flags */ 293 - 294 - #define ACPI_DMAR_ALL_PORTS (1) 295 - 296 - /******************************************************************************* 297 - * 298 289 * ECDT - Embedded Controller Boot Resources Table 290 + * Version 1 299 291 * 300 292 ******************************************************************************/ 301 293 ··· 194 418 195 419 /******************************************************************************* 196 420 * 197 - * EINJ - Error Injection Table 421 + * EINJ - Error Injection Table (ACPI 4.0) 422 + * Version 1 198 423 * 199 424 ******************************************************************************/ 200 425 201 426 struct acpi_table_einj { 202 427 struct acpi_table_header header; /* Common ACPI table header */ 203 428 u32 header_length; 204 - u32 reserved; 429 + u8 flags; 430 + u8 reserved[3]; 205 431 u32 entries; 206 432 }; 207 433 ··· 212 434 struct acpi_einj_entry { 213 435 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 214 436 }; 437 + 438 + /* Masks for Flags field above */ 439 + 440 + #define ACPI_EINJ_PRESERVE (1) 215 441 216 442 /* Values for Action field above */ 217 443 ··· 252 470 u32 entry_count; 253 471 }; 254 472 473 + /* Command status return values */ 474 + 475 + enum acpi_einj_command_status { 476 + ACPI_EINJ_SUCCESS = 0, 477 + ACPI_EINJ_FAILURE = 1, 478 + ACPI_EINJ_INVALID_ACCESS = 2, 479 + ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */ 480 + }; 481 + 482 + /* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */ 483 + 484 + #define ACPI_EINJ_PROCESSOR_CORRECTABLE (1) 485 + #define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1) 486 + #define ACPI_EINJ_PROCESSOR_FATAL (1<<2) 487 + #define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3) 488 + #define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4) 489 + #define ACPI_EINJ_MEMORY_FATAL (1<<5) 490 + #define ACPI_EINJ_PCIX_CORRECTABLE (1<<6) 491 + #define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7) 492 + #define ACPI_EINJ_PCIX_FATAL (1<<8) 493 + #define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) 494 + #define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) 495 + #define ACPI_EINJ_PLATFORM_FATAL (1<<11) 496 + 255 497 /******************************************************************************* 256 498 * 257 - * ERST - Error Record Serialization Table 499 + * ERST - Error Record Serialization Table (ACPI 4.0) 500 + * Version 1 258 501 * 259 502 ******************************************************************************/ 260 503 ··· 296 489 struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 297 490 }; 298 491 492 + /* Masks for Flags field above */ 493 + 494 + #define ACPI_ERST_PRESERVE (1) 495 + 299 496 /* Values for Action field above */ 300 497 301 498 enum acpi_erst_actions { 302 - ACPI_ERST_BEGIN_WRITE_OPERATION = 0, 303 - ACPI_ERST_BEGIN_READ_OPERATION = 1, 304 - ACPI_ERST_BETGIN_CLEAR_OPERATION = 2, 305 - ACPI_ERST_END_OPERATION = 3, 499 + ACPI_ERST_BEGIN_WRITE = 0, 500 + ACPI_ERST_BEGIN_READ = 1, 501 + ACPI_ERST_BEGIN_CLEAR = 2, 502 + ACPI_ERST_END = 3, 306 503 ACPI_ERST_SET_RECORD_OFFSET = 4, 307 504 ACPI_ERST_EXECUTE_OPERATION = 5, 308 505 ACPI_ERST_CHECK_BUSY_STATUS = 6, 309 506 ACPI_ERST_GET_COMMAND_STATUS = 7, 310 - ACPI_ERST_GET_RECORD_IDENTIFIER = 8, 311 - ACPI_ERST_SET_RECORD_IDENTIFIER = 9, 507 + ACPI_ERST_GET_RECORD_ID = 8, 508 + ACPI_ERST_SET_RECORD_ID = 9, 312 509 ACPI_ERST_GET_RECORD_COUNT = 10, 313 510 ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, 314 511 ACPI_ERST_NOT_USED = 12, ··· 347 536 ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ 348 537 }; 349 538 539 + /* Command status return values */ 540 + 541 + enum acpi_erst_command_status { 542 + ACPI_ERST_SUCESS = 0, 543 + ACPI_ERST_NO_SPACE = 1, 544 + ACPI_ERST_NOT_AVAILABLE = 2, 545 + ACPI_ERST_FAILURE = 3, 546 + ACPI_ERST_RECORD_EMPTY = 4, 547 + ACPI_ERST_NOT_FOUND = 5, 548 + ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */ 549 + }; 550 + 551 + /* Error Record Serialization Information */ 552 + 553 + struct acpi_erst_info { 554 + u16 signature; /* Should be "ER" */ 555 + u8 data[48]; 556 + }; 557 + 350 558 /******************************************************************************* 351 559 * 352 - * HEST - Hardware Error Source Table 560 + * HEST - Hardware Error Source Table (ACPI 4.0) 561 + * Version 1 353 562 * 354 563 ******************************************************************************/ 355 564 ··· 382 551 383 552 struct acpi_hest_header { 384 553 u16 type; 554 + u16 source_id; 385 555 }; 386 556 387 557 /* Values for Type field above for subtables */ 388 558 389 559 enum acpi_hest_types { 390 - ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, 391 - ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, 392 - ACPI_HEST_TYPE_XPF_UNUSED = 2, 393 - ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, 394 - ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, 395 - ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, 560 + ACPI_HEST_TYPE_IA32_CHECK = 0, 561 + ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1, 562 + ACPI_HEST_TYPE_IA32_NMI = 2, 563 + ACPI_HEST_TYPE_NOT_USED3 = 3, 564 + ACPI_HEST_TYPE_NOT_USED4 = 4, 565 + ACPI_HEST_TYPE_NOT_USED5 = 5, 396 566 ACPI_HEST_TYPE_AER_ROOT_PORT = 6, 397 567 ACPI_HEST_TYPE_AER_ENDPOINT = 7, 398 568 ACPI_HEST_TYPE_AER_BRIDGE = 8, 399 - ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, 569 + ACPI_HEST_TYPE_GENERIC_ERROR = 9, 400 570 ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ 401 571 }; 402 572 403 573 /* 404 - * HEST Sub-subtables 574 + * HEST substructures contained in subtables 405 575 */ 406 576 407 - /* XPF Machine Check Error Bank */ 408 - 409 - struct acpi_hest_xpf_error_bank { 577 + /* 578 + * IA32 Error Bank(s) - Follows the struct acpi_hest_ia_machine_check and 579 + * struct acpi_hest_ia_corrected structures. 580 + */ 581 + struct acpi_hest_ia_error_bank { 410 582 u8 bank_number; 411 583 u8 clear_status_on_init; 412 584 u8 status_format; 413 - u8 config_write_enable; 585 + u8 reserved; 414 586 u32 control_register; 415 - u64 control_init_data; 587 + u64 control_data; 416 588 u32 status_register; 417 589 u32 address_register; 418 590 u32 misc_register; 419 591 }; 420 592 421 - /* Generic Error Status */ 422 - 423 - struct acpi_hest_generic_status { 424 - u32 block_status; 425 - u32 raw_data_offset; 426 - u32 raw_data_length; 427 - u32 data_length; 428 - u32 error_severity; 429 - }; 430 - 431 - /* Generic Error Data */ 432 - 433 - struct acpi_hest_generic_data { 434 - u8 section_type[16]; 435 - u32 error_severity; 436 - u16 revision; 437 - u8 validation_bits; 438 - u8 flags; 439 - u32 error_data_length; 440 - u8 fru_id[16]; 441 - u8 fru_text[20]; 442 - }; 443 - 444 - /* Common HEST structure for PCI/AER types below (6,7,8) */ 593 + /* Common HEST sub-structure for PCI/AER structures below (6,7,8) */ 445 594 446 595 struct acpi_hest_aer_common { 447 - u16 source_id; 448 - u16 config_write_enable; 596 + u16 reserved1; 449 597 u8 flags; 450 598 u8 enabled; 451 - u32 records_to_pre_allocate; 599 + u32 records_to_preallocate; 452 600 u32 max_sections_per_record; 453 601 u32 bus; 454 602 u16 device; 455 603 u16 function; 456 604 u16 device_control; 457 - u16 reserved; 458 - u32 uncorrectable_error_mask; 459 - u32 uncorrectable_error_severity; 460 - u32 correctable_error_mask; 461 - u32 advanced_error_capabilities; 605 + u16 reserved2; 606 + u32 uncorrectable_mask; 607 + u32 uncorrectable_severity; 608 + u32 correctable_mask; 609 + u32 advanced_capabilities; 462 610 }; 611 + 612 + /* Masks for HEST Flags fields */ 613 + 614 + #define ACPI_HEST_FIRMWARE_FIRST (1) 615 + #define ACPI_HEST_GLOBAL (1<<1) 463 616 464 617 /* Hardware Error Notification */ 465 618 ··· 470 655 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ 471 656 }; 472 657 658 + /* Values for config_write_enable bitfield above */ 659 + 660 + #define ACPI_HEST_TYPE (1) 661 + #define ACPI_HEST_POLL_INTERVAL (1<<1) 662 + #define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2) 663 + #define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3) 664 + #define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4) 665 + #define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5) 666 + 473 667 /* 474 668 * HEST subtables 475 - * 476 - * From WHEA Design Document, 16 May 2007. 477 - * Note: There is no subtable type 2 in this version of the document, 478 - * and there are two different subtable type 3s. 479 669 */ 480 670 481 - /* 0: XPF Machine Check Exception */ 671 + /* 0: IA32 Machine Check Exception */ 482 672 483 - struct acpi_hest_xpf_machine_check { 673 + struct acpi_hest_ia_machine_check { 484 674 struct acpi_hest_header header; 485 - u16 source_id; 486 - u16 config_write_enable; 675 + u16 reserved1; 487 676 u8 flags; 488 - u8 reserved1; 489 - u32 records_to_pre_allocate; 677 + u8 enabled; 678 + u32 records_to_preallocate; 490 679 u32 max_sections_per_record; 491 680 u64 global_capability_data; 492 681 u64 global_control_data; 493 682 u8 num_hardware_banks; 494 - u8 reserved2[7]; 683 + u8 reserved3[7]; 495 684 }; 496 685 497 - /* 1: XPF Corrected Machine Check */ 686 + /* 1: IA32 Corrected Machine Check */ 498 687 499 - struct acpi_table_hest_xpf_corrected { 688 + struct acpi_hest_ia_corrected { 500 689 struct acpi_hest_header header; 501 - u16 source_id; 502 - u16 config_write_enable; 690 + u16 reserved1; 503 691 u8 flags; 504 692 u8 enabled; 505 - u32 records_to_pre_allocate; 693 + u32 records_to_preallocate; 506 694 u32 max_sections_per_record; 507 695 struct acpi_hest_notify notify; 508 696 u8 num_hardware_banks; 509 - u8 reserved[3]; 697 + u8 reserved2[3]; 510 698 }; 511 699 512 - /* 3: XPF Non-Maskable Interrupt */ 700 + /* 2: IA32 Non-Maskable Interrupt */ 513 701 514 - struct acpi_hest_xpf_nmi { 702 + struct acpi_hest_ia_nmi { 515 703 struct acpi_hest_header header; 516 - u16 source_id; 517 704 u32 reserved; 518 - u32 records_to_pre_allocate; 705 + u32 records_to_preallocate; 519 706 u32 max_sections_per_record; 520 707 u32 max_raw_data_length; 521 708 }; 522 709 523 - /* 4: IPF Corrected Machine Check */ 524 - 525 - struct acpi_hest_ipf_corrected { 526 - struct acpi_hest_header header; 527 - u8 enabled; 528 - u8 reserved; 529 - }; 530 - 531 - /* 5: IPF Corrected Platform Error */ 532 - 533 - struct acpi_hest_ipf_corrected_platform { 534 - struct acpi_hest_header header; 535 - u8 enabled; 536 - u8 reserved; 537 - }; 710 + /* 3,4,5: Not used */ 538 711 539 712 /* 6: PCI Express Root Port AER */ 540 713 ··· 544 741 struct acpi_hest_aer_bridge { 545 742 struct acpi_hest_header header; 546 743 struct acpi_hest_aer_common aer; 547 - u32 secondary_uncorrectable_error_mask; 548 - u32 secondary_uncorrectable_error_severity; 549 - u32 secondary_advanced_capabilities; 744 + u32 uncorrectable_mask2; 745 + u32 uncorrectable_severity2; 746 + u32 advanced_capabilities2; 550 747 }; 551 748 552 749 /* 9: Generic Hardware Error Source */ 553 750 554 751 struct acpi_hest_generic { 555 752 struct acpi_hest_header header; 556 - u16 source_id; 557 753 u16 related_source_id; 558 - u8 config_write_enable; 754 + u8 reserved; 559 755 u8 enabled; 560 - u32 records_to_pre_allocate; 756 + u32 records_to_preallocate; 561 757 u32 max_sections_per_record; 562 758 u32 max_raw_data_length; 563 759 struct acpi_generic_address error_status_address; 564 760 struct acpi_hest_notify notify; 565 - u32 error_status_block_length; 761 + u32 error_block_length; 566 762 }; 567 763 568 - /******************************************************************************* 569 - * 570 - * HPET - High Precision Event Timer table 571 - * 572 - ******************************************************************************/ 764 + /* Generic Error Status block */ 573 765 574 - struct acpi_table_hpet { 575 - struct acpi_table_header header; /* Common ACPI table header */ 576 - u32 id; /* Hardware ID of event timer block */ 577 - struct acpi_generic_address address; /* Address of event timer block */ 578 - u8 sequence; /* HPET sequence number */ 579 - u16 minimum_tick; /* Main counter min tick, periodic mode */ 766 + struct acpi_hest_generic_status { 767 + u32 block_status; 768 + u32 raw_data_offset; 769 + u32 raw_data_length; 770 + u32 data_length; 771 + u32 error_severity; 772 + }; 773 + 774 + /* Values for block_status flags above */ 775 + 776 + #define ACPI_HEST_UNCORRECTABLE (1) 777 + #define ACPI_HEST_CORRECTABLE (1<<1) 778 + #define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) 779 + #define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) 780 + #define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ 781 + 782 + /* Generic Error Data entry */ 783 + 784 + struct acpi_hest_generic_data { 785 + u8 section_type[16]; 786 + u32 error_severity; 787 + u16 revision; 788 + u8 validation_bits; 580 789 u8 flags; 581 - }; 582 - 583 - /*! Flags */ 584 - 585 - #define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */ 586 - #define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */ 587 - #define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */ 588 - 589 - /*! [End] no source code translation !*/ 590 - 591 - /******************************************************************************* 592 - * 593 - * IBFT - Boot Firmware Table 594 - * 595 - ******************************************************************************/ 596 - 597 - struct acpi_table_ibft { 598 - struct acpi_table_header header; /* Common ACPI table header */ 599 - u8 reserved[12]; 600 - }; 601 - 602 - /* IBFT common subtable header */ 603 - 604 - struct acpi_ibft_header { 605 - u8 type; 606 - u8 version; 607 - u16 length; 608 - u8 index; 609 - u8 flags; 610 - }; 611 - 612 - /* Values for Type field above */ 613 - 614 - enum acpi_ibft_type { 615 - ACPI_IBFT_TYPE_NOT_USED = 0, 616 - ACPI_IBFT_TYPE_CONTROL = 1, 617 - ACPI_IBFT_TYPE_INITIATOR = 2, 618 - ACPI_IBFT_TYPE_NIC = 3, 619 - ACPI_IBFT_TYPE_TARGET = 4, 620 - ACPI_IBFT_TYPE_EXTENSIONS = 5, 621 - ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ 622 - }; 623 - 624 - /* IBFT subtables */ 625 - 626 - struct acpi_ibft_control { 627 - struct acpi_ibft_header header; 628 - u16 extensions; 629 - u16 initiator_offset; 630 - u16 nic0_offset; 631 - u16 target0_offset; 632 - u16 nic1_offset; 633 - u16 target1_offset; 634 - }; 635 - 636 - struct acpi_ibft_initiator { 637 - struct acpi_ibft_header header; 638 - u8 sns_server[16]; 639 - u8 slp_server[16]; 640 - u8 primary_server[16]; 641 - u8 secondary_server[16]; 642 - u16 name_length; 643 - u16 name_offset; 644 - }; 645 - 646 - struct acpi_ibft_nic { 647 - struct acpi_ibft_header header; 648 - u8 ip_address[16]; 649 - u8 subnet_mask_prefix; 650 - u8 origin; 651 - u8 gateway[16]; 652 - u8 primary_dns[16]; 653 - u8 secondary_dns[16]; 654 - u8 dhcp[16]; 655 - u16 vlan; 656 - u8 mac_address[6]; 657 - u16 pci_address; 658 - u16 name_length; 659 - u16 name_offset; 660 - }; 661 - 662 - struct acpi_ibft_target { 663 - struct acpi_ibft_header header; 664 - u8 target_ip_address[16]; 665 - u16 target_ip_socket; 666 - u8 target_boot_lun[8]; 667 - u8 chap_type; 668 - u8 nic_association; 669 - u16 target_name_length; 670 - u16 target_name_offset; 671 - u16 chap_name_length; 672 - u16 chap_name_offset; 673 - u16 chap_secret_length; 674 - u16 chap_secret_offset; 675 - u16 reverse_chap_name_length; 676 - u16 reverse_chap_name_offset; 677 - u16 reverse_chap_secret_length; 678 - u16 reverse_chap_secret_offset; 790 + u32 error_data_length; 791 + u8 fru_id[16]; 792 + u8 fru_text[20]; 679 793 }; 680 794 681 795 /******************************************************************************* 682 796 * 683 797 * MADT - Multiple APIC Description Table 798 + * Version 3 684 799 * 685 800 ******************************************************************************/ 686 801 ··· 608 887 u32 flags; 609 888 }; 610 889 611 - /* Flags */ 890 + /* Masks for Flags field above */ 612 891 613 - #define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ 892 + #define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ 614 893 615 894 /* Values for PCATCompat flag */ 616 895 617 896 #define ACPI_MADT_DUAL_PIC 0 618 897 #define ACPI_MADT_MULTIPLE_APIC 1 619 898 620 - /* Values for subtable type in struct acpi_subtable_header */ 899 + /* Values for MADT subtable type in struct acpi_subtable_header */ 621 900 622 901 enum acpi_madt_type { 623 902 ACPI_MADT_TYPE_LOCAL_APIC = 0, ··· 728 1007 u32 flags; /* Interrupt Source Flags */ 729 1008 }; 730 1009 731 - /* Flags field above */ 1010 + /* Masks for Flags field above */ 732 1011 733 1012 #define ACPI_MADT_CPEI_OVERRIDE (1) 734 1013 735 - /* 9: Processor Local X2_APIC (07/2008) */ 1014 + /* 9: Processor Local X2APIC (ACPI 4.0) */ 736 1015 737 1016 struct acpi_madt_local_x2apic { 738 1017 struct acpi_subtable_header header; ··· 742 1021 u32 uid; /* ACPI processor UID */ 743 1022 }; 744 1023 745 - /* 10: Local X2APIC NMI (07/2008) */ 1024 + /* 10: Local X2APIC NMI (ACPI 4.0) */ 746 1025 747 1026 struct acpi_madt_local_x2apic_nmi { 748 1027 struct acpi_subtable_header header; ··· 779 1058 780 1059 /******************************************************************************* 781 1060 * 782 - * MCFG - PCI Memory Mapped Configuration table and sub-table 1061 + * MSCT - Maximum System Characteristics Table (ACPI 4.0) 1062 + * Version 1 783 1063 * 784 1064 ******************************************************************************/ 785 1065 786 - struct acpi_table_mcfg { 1066 + struct acpi_table_msct { 787 1067 struct acpi_table_header header; /* Common ACPI table header */ 788 - u8 reserved[8]; 1068 + u32 proximity_offset; /* Location of proximity info struct(s) */ 1069 + u32 max_proximity_domains; /* Max number of proximity domains */ 1070 + u32 max_clock_domains; /* Max number of clock domains */ 1071 + u64 max_address; /* Max physical address in system */ 789 1072 }; 790 1073 791 - /* Subtable */ 1074 + /* Subtable - Maximum Proximity Domain Information. Version 1 */ 792 1075 793 - struct acpi_mcfg_allocation { 794 - u64 address; /* Base address, processor-relative */ 795 - u16 pci_segment; /* PCI segment group number */ 796 - u8 start_bus_number; /* Starting PCI Bus number */ 797 - u8 end_bus_number; /* Final PCI Bus number */ 798 - u32 reserved; 1076 + struct acpi_msct_proximity { 1077 + u8 revision; 1078 + u8 length; 1079 + u32 range_start; /* Start of domain range */ 1080 + u32 range_end; /* End of domain range */ 1081 + u32 processor_capacity; 1082 + u64 memory_capacity; /* In bytes */ 799 1083 }; 800 1084 801 1085 /******************************************************************************* 802 1086 * 803 1087 * SBST - Smart Battery Specification Table 1088 + * Version 1 804 1089 * 805 1090 ******************************************************************************/ 806 1091 ··· 820 1093 /******************************************************************************* 821 1094 * 822 1095 * SLIT - System Locality Distance Information Table 1096 + * Version 1 823 1097 * 824 1098 ******************************************************************************/ 825 1099 ··· 832 1104 833 1105 /******************************************************************************* 834 1106 * 835 - * SPCR - Serial Port Console Redirection table 836 - * 837 - ******************************************************************************/ 838 - 839 - struct acpi_table_spcr { 840 - struct acpi_table_header header; /* Common ACPI table header */ 841 - u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 842 - u8 reserved[3]; 843 - struct acpi_generic_address serial_port; 844 - u8 interrupt_type; 845 - u8 pc_interrupt; 846 - u32 interrupt; 847 - u8 baud_rate; 848 - u8 parity; 849 - u8 stop_bits; 850 - u8 flow_control; 851 - u8 terminal_type; 852 - u8 reserved1; 853 - u16 pci_device_id; 854 - u16 pci_vendor_id; 855 - u8 pci_bus; 856 - u8 pci_device; 857 - u8 pci_function; 858 - u32 pci_flags; 859 - u8 pci_segment; 860 - u32 reserved2; 861 - }; 862 - 863 - /******************************************************************************* 864 - * 865 - * SPMI - Server Platform Management Interface table 866 - * 867 - ******************************************************************************/ 868 - 869 - struct acpi_table_spmi { 870 - struct acpi_table_header header; /* Common ACPI table header */ 871 - u8 reserved; 872 - u8 interface_type; 873 - u16 spec_revision; /* Version of IPMI */ 874 - u8 interrupt_type; 875 - u8 gpe_number; /* GPE assigned */ 876 - u8 reserved1; 877 - u8 pci_device_flag; 878 - u32 interrupt; 879 - struct acpi_generic_address ipmi_register; 880 - u8 pci_segment; 881 - u8 pci_bus; 882 - u8 pci_device; 883 - u8 pci_function; 884 - }; 885 - 886 - /******************************************************************************* 887 - * 888 1107 * SRAT - System Resource Affinity Table 1108 + * Version 3 889 1109 * 890 1110 ******************************************************************************/ 891 1111 ··· 868 1192 u32 reserved; /* Reserved, must be zero */ 869 1193 }; 870 1194 1195 + /* Flags */ 1196 + 1197 + #define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */ 1198 + 871 1199 /* 1: Memory Affinity */ 872 1200 873 1201 struct acpi_srat_mem_affinity { ··· 891 1211 #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ 892 1212 #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ 893 1213 894 - /* 2: Processor Local X2_APIC Affinity (07/2008) */ 1214 + /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ 895 1215 896 1216 struct acpi_srat_x2apic_cpu_affinity { 897 1217 struct acpi_subtable_header header; ··· 899 1219 u32 proximity_domain; 900 1220 u32 apic_id; 901 1221 u32 flags; 1222 + u32 clock_domain; 1223 + u32 reserved2; 902 1224 }; 903 1225 904 1226 /* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */ 905 1227 906 1228 #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ 907 - 908 - /******************************************************************************* 909 - * 910 - * TCPA - Trusted Computing Platform Alliance table 911 - * 912 - ******************************************************************************/ 913 - 914 - struct acpi_table_tcpa { 915 - struct acpi_table_header header; /* Common ACPI table header */ 916 - u16 reserved; 917 - u32 max_log_length; /* Maximum length for the event log area */ 918 - u64 log_address; /* Address of the event log area */ 919 - }; 920 - 921 - /******************************************************************************* 922 - * 923 - * UEFI - UEFI Boot optimization Table 924 - * 925 - ******************************************************************************/ 926 - 927 - struct acpi_table_uefi { 928 - struct acpi_table_header header; /* Common ACPI table header */ 929 - u8 identifier[16]; /* UUID identifier */ 930 - u16 data_offset; /* Offset of remaining data in table */ 931 - u8 data; 932 - }; 933 - 934 - /******************************************************************************* 935 - * 936 - * WDAT - Watchdog Action Table 937 - * 938 - ******************************************************************************/ 939 - 940 - struct acpi_table_wdat { 941 - struct acpi_table_header header; /* Common ACPI table header */ 942 - u32 header_length; /* Watchdog Header Length */ 943 - u16 pci_segment; /* PCI Segment number */ 944 - u8 pci_bus; /* PCI Bus number */ 945 - u8 pci_device; /* PCI Device number */ 946 - u8 pci_function; /* PCI Function number */ 947 - u8 reserved[3]; 948 - u32 timer_period; /* Period of one timer count (msec) */ 949 - u32 max_count; /* Maximum counter value supported */ 950 - u32 min_count; /* Minimum counter value */ 951 - u8 flags; 952 - u8 reserved2[3]; 953 - u32 entries; /* Number of watchdog entries that follow */ 954 - }; 955 - 956 - /* WDAT Instruction Entries (actions) */ 957 - 958 - struct acpi_wdat_entry { 959 - struct acpi_whea_header whea_header; /* Common header for WHEA tables */ 960 - }; 961 - 962 - /* Values for Action field above */ 963 - 964 - enum acpi_wdat_actions { 965 - ACPI_WDAT_RESET = 1, 966 - ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, 967 - ACPI_WDAT_GET_COUNTDOWN = 5, 968 - ACPI_WDAT_SET_COUNTDOWN = 6, 969 - ACPI_WDAT_GET_RUNNING_STATE = 8, 970 - ACPI_WDAT_SET_RUNNING_STATE = 9, 971 - ACPI_WDAT_GET_STOPPED_STATE = 10, 972 - ACPI_WDAT_SET_STOPPED_STATE = 11, 973 - ACPI_WDAT_GET_REBOOT = 16, 974 - ACPI_WDAT_SET_REBOOT = 17, 975 - ACPI_WDAT_GET_SHUTDOWN = 18, 976 - ACPI_WDAT_SET_SHUTDOWN = 19, 977 - ACPI_WDAT_GET_STATUS = 32, 978 - ACPI_WDAT_SET_STATUS = 33, 979 - ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ 980 - }; 981 - 982 - /* Values for Instruction field above */ 983 - 984 - enum acpi_wdat_instructions { 985 - ACPI_WDAT_READ_VALUE = 0, 986 - ACPI_WDAT_READ_COUNTDOWN = 1, 987 - ACPI_WDAT_WRITE_VALUE = 2, 988 - ACPI_WDAT_WRITE_COUNTDOWN = 3, 989 - ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ 990 - ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ 991 - }; 992 - 993 - /******************************************************************************* 994 - * 995 - * WDRT - Watchdog Resource Table 996 - * 997 - ******************************************************************************/ 998 - 999 - struct acpi_table_wdrt { 1000 - struct acpi_table_header header; /* Common ACPI table header */ 1001 - u32 header_length; /* Watchdog Header Length */ 1002 - u8 pci_segment; /* PCI Segment number */ 1003 - u8 pci_bus; /* PCI Bus number */ 1004 - u8 pci_device; /* PCI Device number */ 1005 - u8 pci_function; /* PCI Function number */ 1006 - u32 timer_period; /* Period of one timer count (msec) */ 1007 - u32 max_count; /* Maximum counter value supported */ 1008 - u32 min_count; /* Minimum counter value */ 1009 - u8 flags; 1010 - u8 reserved[3]; 1011 - u32 entries; /* Number of watchdog entries that follow */ 1012 - }; 1013 - 1014 - /* Flags */ 1015 - 1016 - #define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */ 1017 1229 1018 1230 /* Reset to default packing */ 1019 1231
+868
include/acpi/actbl2.h
··· 1 + #ifndef __ACTBL2_H__ 2 + #define __ACTBL2_H__ 3 + 4 + /******************************************************************************* 5 + * 6 + * Additional ACPI Tables (2) 7 + * 8 + * These tables are not consumed directly by the ACPICA subsystem, but are 9 + * included here to support device drivers and the AML disassembler. 10 + * 11 + * The tables in this file are defined by third-party specifications, and are 12 + * not defined directly by the ACPI specification itself. 13 + * 14 + ******************************************************************************/ 15 + 16 + /* 17 + * Values for description table header signatures for tables defined in this 18 + * file. Useful because they make it more difficult to inadvertently type in 19 + * the wrong signature. 20 + */ 21 + #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ 22 + #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ 23 + #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 24 + #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ 25 + #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 26 + #define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ 27 + #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 28 + #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 29 + #define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ 30 + #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ 31 + #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ 32 + #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 33 + #define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ 34 + #define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */ 35 + #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ 36 + #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 37 + 38 + /* 39 + * All tables must be byte-packed to match the ACPI specification, since 40 + * the tables are provided by the system BIOS. 41 + */ 42 + #pragma pack(1) 43 + 44 + /* 45 + * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 46 + * This is the only type that is even remotely portable. Anything else is not 47 + * portable, so do not use any other bitfield types. 48 + */ 49 + 50 + /******************************************************************************* 51 + * 52 + * ASF - Alert Standard Format table (Signature "ASF!") 53 + * Revision 0x10 54 + * 55 + * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 56 + * 57 + ******************************************************************************/ 58 + 59 + struct acpi_table_asf { 60 + struct acpi_table_header header; /* Common ACPI table header */ 61 + }; 62 + 63 + /* ASF subtable header */ 64 + 65 + struct acpi_asf_header { 66 + u8 type; 67 + u8 reserved; 68 + u16 length; 69 + }; 70 + 71 + /* Values for Type field above */ 72 + 73 + enum acpi_asf_type { 74 + ACPI_ASF_TYPE_INFO = 0, 75 + ACPI_ASF_TYPE_ALERT = 1, 76 + ACPI_ASF_TYPE_CONTROL = 2, 77 + ACPI_ASF_TYPE_BOOT = 3, 78 + ACPI_ASF_TYPE_ADDRESS = 4, 79 + ACPI_ASF_TYPE_RESERVED = 5 80 + }; 81 + 82 + /* 83 + * ASF subtables 84 + */ 85 + 86 + /* 0: ASF Information */ 87 + 88 + struct acpi_asf_info { 89 + struct acpi_asf_header header; 90 + u8 min_reset_value; 91 + u8 min_poll_interval; 92 + u16 system_id; 93 + u32 mfg_id; 94 + u8 flags; 95 + u8 reserved2[3]; 96 + }; 97 + 98 + /* Masks for Flags field above */ 99 + 100 + #define ACPI_ASF_SMBUS_PROTOCOLS (1) 101 + 102 + /* 1: ASF Alerts */ 103 + 104 + struct acpi_asf_alert { 105 + struct acpi_asf_header header; 106 + u8 assert_mask; 107 + u8 deassert_mask; 108 + u8 alerts; 109 + u8 data_length; 110 + }; 111 + 112 + struct acpi_asf_alert_data { 113 + u8 address; 114 + u8 command; 115 + u8 mask; 116 + u8 value; 117 + u8 sensor_type; 118 + u8 type; 119 + u8 offset; 120 + u8 source_type; 121 + u8 severity; 122 + u8 sensor_number; 123 + u8 entity; 124 + u8 instance; 125 + }; 126 + 127 + /* 2: ASF Remote Control */ 128 + 129 + struct acpi_asf_remote { 130 + struct acpi_asf_header header; 131 + u8 controls; 132 + u8 data_length; 133 + u16 reserved2; 134 + }; 135 + 136 + struct acpi_asf_control_data { 137 + u8 function; 138 + u8 address; 139 + u8 command; 140 + u8 value; 141 + }; 142 + 143 + /* 3: ASF RMCP Boot Options */ 144 + 145 + struct acpi_asf_rmcp { 146 + struct acpi_asf_header header; 147 + u8 capabilities[7]; 148 + u8 completion_code; 149 + u32 enterprise_id; 150 + u8 command; 151 + u16 parameter; 152 + u16 boot_options; 153 + u16 oem_parameters; 154 + }; 155 + 156 + /* 4: ASF Address */ 157 + 158 + struct acpi_asf_address { 159 + struct acpi_asf_header header; 160 + u8 eprom_address; 161 + u8 devices; 162 + }; 163 + 164 + /******************************************************************************* 165 + * 166 + * BOOT - Simple Boot Flag Table 167 + * Version 1 168 + * 169 + * Conforms to the "Simple Boot Flag Specification", Version 2.1 170 + * 171 + ******************************************************************************/ 172 + 173 + struct acpi_table_boot { 174 + struct acpi_table_header header; /* Common ACPI table header */ 175 + u8 cmos_index; /* Index in CMOS RAM for the boot register */ 176 + u8 reserved[3]; 177 + }; 178 + 179 + /******************************************************************************* 180 + * 181 + * DBGP - Debug Port table 182 + * Version 1 183 + * 184 + * Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000 185 + * 186 + ******************************************************************************/ 187 + 188 + struct acpi_table_dbgp { 189 + struct acpi_table_header header; /* Common ACPI table header */ 190 + u8 type; /* 0=full 16550, 1=subset of 16550 */ 191 + u8 reserved[3]; 192 + struct acpi_generic_address debug_port; 193 + }; 194 + 195 + /******************************************************************************* 196 + * 197 + * DMAR - DMA Remapping table 198 + * Version 1 199 + * 200 + * Conforms to "Intel Virtualization Technology for Directed I/O", 201 + * Version 1.2, Sept. 2008 202 + * 203 + ******************************************************************************/ 204 + 205 + struct acpi_table_dmar { 206 + struct acpi_table_header header; /* Common ACPI table header */ 207 + u8 width; /* Host Address Width */ 208 + u8 flags; 209 + u8 reserved[10]; 210 + }; 211 + 212 + /* Masks for Flags field above */ 213 + 214 + #define ACPI_DMAR_INTR_REMAP (1) 215 + 216 + /* DMAR subtable header */ 217 + 218 + struct acpi_dmar_header { 219 + u16 type; 220 + u16 length; 221 + }; 222 + 223 + /* Values for subtable type in struct acpi_dmar_header */ 224 + 225 + enum acpi_dmar_type { 226 + ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, 227 + ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, 228 + ACPI_DMAR_TYPE_ATSR = 2, 229 + ACPI_DMAR_HARDWARE_AFFINITY = 3, 230 + ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */ 231 + }; 232 + 233 + /* DMAR Device Scope structure */ 234 + 235 + struct acpi_dmar_device_scope { 236 + u8 entry_type; 237 + u8 length; 238 + u16 reserved; 239 + u8 enumeration_id; 240 + u8 bus; 241 + }; 242 + 243 + /* Values for entry_type in struct acpi_dmar_device_scope */ 244 + 245 + enum acpi_dmar_scope_type { 246 + ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, 247 + ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, 248 + ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, 249 + ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, 250 + ACPI_DMAR_SCOPE_TYPE_HPET = 4, 251 + ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ 252 + }; 253 + 254 + struct acpi_dmar_pci_path { 255 + u8 dev; 256 + u8 fn; 257 + }; 258 + 259 + /* 260 + * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header 261 + */ 262 + 263 + /* 0: Hardware Unit Definition */ 264 + 265 + struct acpi_dmar_hardware_unit { 266 + struct acpi_dmar_header header; 267 + u8 flags; 268 + u8 reserved; 269 + u16 segment; 270 + u64 address; /* Register Base Address */ 271 + }; 272 + 273 + /* Masks for Flags field above */ 274 + 275 + #define ACPI_DMAR_INCLUDE_ALL (1) 276 + 277 + /* 1: Reserved Memory Defininition */ 278 + 279 + struct acpi_dmar_reserved_memory { 280 + struct acpi_dmar_header header; 281 + u16 reserved; 282 + u16 segment; 283 + u64 base_address; /* 4_k aligned base address */ 284 + u64 end_address; /* 4_k aligned limit address */ 285 + }; 286 + 287 + /* Masks for Flags field above */ 288 + 289 + #define ACPI_DMAR_ALLOW_ALL (1) 290 + 291 + /* 2: Root Port ATS Capability Reporting Structure */ 292 + 293 + struct acpi_dmar_atsr { 294 + struct acpi_dmar_header header; 295 + u8 flags; 296 + u8 reserved; 297 + u16 segment; 298 + }; 299 + 300 + /* Masks for Flags field above */ 301 + 302 + #define ACPI_DMAR_ALL_PORTS (1) 303 + 304 + /* 3: Remapping Hardware Static Affinity Structure */ 305 + 306 + struct acpi_dmar_rhsa { 307 + struct acpi_dmar_header header; 308 + u32 reserved; 309 + u64 base_address; 310 + u32 proximity_domain; 311 + }; 312 + 313 + /******************************************************************************* 314 + * 315 + * HPET - High Precision Event Timer table 316 + * Version 1 317 + * 318 + * Conforms to "IA-PC HPET (High Precision Event Timers) Specification", 319 + * Version 1.0a, October 2004 320 + * 321 + ******************************************************************************/ 322 + 323 + struct acpi_table_hpet { 324 + struct acpi_table_header header; /* Common ACPI table header */ 325 + u32 id; /* Hardware ID of event timer block */ 326 + struct acpi_generic_address address; /* Address of event timer block */ 327 + u8 sequence; /* HPET sequence number */ 328 + u16 minimum_tick; /* Main counter min tick, periodic mode */ 329 + u8 flags; 330 + }; 331 + 332 + /* Masks for Flags field above */ 333 + 334 + #define ACPI_HPET_PAGE_PROTECT_MASK (3) 335 + 336 + /* Values for Page Protect flags */ 337 + 338 + enum acpi_hpet_page_protect { 339 + ACPI_HPET_NO_PAGE_PROTECT = 0, 340 + ACPI_HPET_PAGE_PROTECT4 = 1, 341 + ACPI_HPET_PAGE_PROTECT64 = 2 342 + }; 343 + 344 + /******************************************************************************* 345 + * 346 + * IBFT - Boot Firmware Table 347 + * Version 1 348 + * 349 + * Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b 350 + * Specification", Version 1.01, March 1, 2007 351 + * 352 + * Note: It appears that this table is not intended to appear in the RSDT/XSDT. 353 + * Therefore, it is not currently supported by the disassembler. 354 + * 355 + ******************************************************************************/ 356 + 357 + struct acpi_table_ibft { 358 + struct acpi_table_header header; /* Common ACPI table header */ 359 + u8 reserved[12]; 360 + }; 361 + 362 + /* IBFT common subtable header */ 363 + 364 + struct acpi_ibft_header { 365 + u8 type; 366 + u8 version; 367 + u16 length; 368 + u8 index; 369 + u8 flags; 370 + }; 371 + 372 + /* Values for Type field above */ 373 + 374 + enum acpi_ibft_type { 375 + ACPI_IBFT_TYPE_NOT_USED = 0, 376 + ACPI_IBFT_TYPE_CONTROL = 1, 377 + ACPI_IBFT_TYPE_INITIATOR = 2, 378 + ACPI_IBFT_TYPE_NIC = 3, 379 + ACPI_IBFT_TYPE_TARGET = 4, 380 + ACPI_IBFT_TYPE_EXTENSIONS = 5, 381 + ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ 382 + }; 383 + 384 + /* IBFT subtables */ 385 + 386 + struct acpi_ibft_control { 387 + struct acpi_ibft_header header; 388 + u16 extensions; 389 + u16 initiator_offset; 390 + u16 nic0_offset; 391 + u16 target0_offset; 392 + u16 nic1_offset; 393 + u16 target1_offset; 394 + }; 395 + 396 + struct acpi_ibft_initiator { 397 + struct acpi_ibft_header header; 398 + u8 sns_server[16]; 399 + u8 slp_server[16]; 400 + u8 primary_server[16]; 401 + u8 secondary_server[16]; 402 + u16 name_length; 403 + u16 name_offset; 404 + }; 405 + 406 + struct acpi_ibft_nic { 407 + struct acpi_ibft_header header; 408 + u8 ip_address[16]; 409 + u8 subnet_mask_prefix; 410 + u8 origin; 411 + u8 gateway[16]; 412 + u8 primary_dns[16]; 413 + u8 secondary_dns[16]; 414 + u8 dhcp[16]; 415 + u16 vlan; 416 + u8 mac_address[6]; 417 + u16 pci_address; 418 + u16 name_length; 419 + u16 name_offset; 420 + }; 421 + 422 + struct acpi_ibft_target { 423 + struct acpi_ibft_header header; 424 + u8 target_ip_address[16]; 425 + u16 target_ip_socket; 426 + u8 target_boot_lun[8]; 427 + u8 chap_type; 428 + u8 nic_association; 429 + u16 target_name_length; 430 + u16 target_name_offset; 431 + u16 chap_name_length; 432 + u16 chap_name_offset; 433 + u16 chap_secret_length; 434 + u16 chap_secret_offset; 435 + u16 reverse_chap_name_length; 436 + u16 reverse_chap_name_offset; 437 + u16 reverse_chap_secret_length; 438 + u16 reverse_chap_secret_offset; 439 + }; 440 + 441 + /******************************************************************************* 442 + * 443 + * IVRS - I/O Virtualization Reporting Structure 444 + * Version 1 445 + * 446 + * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification", 447 + * Revision 1.26, February 2009. 448 + * 449 + ******************************************************************************/ 450 + 451 + struct acpi_table_ivrs { 452 + struct acpi_table_header header; /* Common ACPI table header */ 453 + u32 info; /* Common virtualization info */ 454 + u64 reserved; 455 + }; 456 + 457 + /* Values for Info field above */ 458 + 459 + #define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */ 460 + #define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */ 461 + #define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */ 462 + 463 + /* IVRS subtable header */ 464 + 465 + struct acpi_ivrs_header { 466 + u8 type; /* Subtable type */ 467 + u8 flags; 468 + u16 length; /* Subtable length */ 469 + u16 device_id; /* ID of IOMMU */ 470 + }; 471 + 472 + /* Values for subtable Type above */ 473 + 474 + enum acpi_ivrs_type { 475 + ACPI_IVRS_TYPE_HARDWARE = 0x10, 476 + ACPI_IVRS_TYPE_MEMORY1 = 0x20, 477 + ACPI_IVRS_TYPE_MEMORY2 = 0x21, 478 + ACPI_IVRS_TYPE_MEMORY3 = 0x22 479 + }; 480 + 481 + /* Masks for Flags field above for IVHD subtable */ 482 + 483 + #define ACPI_IVHD_TT_ENABLE (1) 484 + #define ACPI_IVHD_PASS_PW (1<<1) 485 + #define ACPI_IVHD_RES_PASS_PW (1<<2) 486 + #define ACPI_IVHD_ISOC (1<<3) 487 + #define ACPI_IVHD_IOTLB (1<<4) 488 + 489 + /* Masks for Flags field above for IVMD subtable */ 490 + 491 + #define ACPI_IVMD_UNITY (1) 492 + #define ACPI_IVMD_READ (1<<1) 493 + #define ACPI_IVMD_WRITE (1<<2) 494 + #define ACPI_IVMD_EXCLUSION_RANGE (1<<3) 495 + 496 + /* 497 + * IVRS subtables, correspond to Type in struct acpi_ivrs_header 498 + */ 499 + 500 + /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */ 501 + 502 + struct acpi_ivrs_hardware { 503 + struct acpi_ivrs_header header; 504 + u16 capability_offset; /* Offset for IOMMU control fields */ 505 + u64 base_address; /* IOMMU control registers */ 506 + u16 pci_segment_group; 507 + u16 info; /* MSI number and unit ID */ 508 + u32 reserved; 509 + }; 510 + 511 + /* Masks for Info field above */ 512 + 513 + #define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */ 514 + #define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_iD */ 515 + 516 + /* 517 + * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure. 518 + * Upper two bits of the Type field are the (encoded) length of the structure. 519 + * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries 520 + * are reserved for future use but not defined. 521 + */ 522 + struct acpi_ivrs_de_header { 523 + u8 type; 524 + u16 id; 525 + u8 data_setting; 526 + }; 527 + 528 + /* Length of device entry is in the top two bits of Type field above */ 529 + 530 + #define ACPI_IVHD_ENTRY_LENGTH 0xC0 531 + 532 + /* Values for device entry Type field above */ 533 + 534 + enum acpi_ivrs_device_entry_type { 535 + /* 4-byte device entries, all use struct acpi_ivrs_device4 */ 536 + 537 + ACPI_IVRS_TYPE_PAD4 = 0, 538 + ACPI_IVRS_TYPE_ALL = 1, 539 + ACPI_IVRS_TYPE_SELECT = 2, 540 + ACPI_IVRS_TYPE_START = 3, 541 + ACPI_IVRS_TYPE_END = 4, 542 + 543 + /* 8-byte device entries */ 544 + 545 + ACPI_IVRS_TYPE_PAD8 = 64, 546 + ACPI_IVRS_TYPE_NOT_USED = 65, 547 + ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */ 548 + ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */ 549 + ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */ 550 + ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */ 551 + ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses struct acpi_ivrs_device8c */ 552 + }; 553 + 554 + /* Values for Data field above */ 555 + 556 + #define ACPI_IVHD_INIT_PASS (1) 557 + #define ACPI_IVHD_EINT_PASS (1<<1) 558 + #define ACPI_IVHD_NMI_PASS (1<<2) 559 + #define ACPI_IVHD_SYSTEM_MGMT (3<<4) 560 + #define ACPI_IVHD_LINT0_PASS (1<<6) 561 + #define ACPI_IVHD_LINT1_PASS (1<<7) 562 + 563 + /* Types 0-4: 4-byte device entry */ 564 + 565 + struct acpi_ivrs_device4 { 566 + struct acpi_ivrs_de_header header; 567 + }; 568 + 569 + /* Types 66-67: 8-byte device entry */ 570 + 571 + struct acpi_ivrs_device8a { 572 + struct acpi_ivrs_de_header header; 573 + u8 reserved1; 574 + u16 used_id; 575 + u8 reserved2; 576 + }; 577 + 578 + /* Types 70-71: 8-byte device entry */ 579 + 580 + struct acpi_ivrs_device8b { 581 + struct acpi_ivrs_de_header header; 582 + u32 extended_data; 583 + }; 584 + 585 + /* Values for extended_data above */ 586 + 587 + #define ACPI_IVHD_ATS_DISABLED (1<<31) 588 + 589 + /* Type 72: 8-byte device entry */ 590 + 591 + struct acpi_ivrs_device8c { 592 + struct acpi_ivrs_de_header header; 593 + u8 handle; 594 + u16 used_id; 595 + u8 variety; 596 + }; 597 + 598 + /* Values for Variety field above */ 599 + 600 + #define ACPI_IVHD_IOAPIC 1 601 + #define ACPI_IVHD_HPET 2 602 + 603 + /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */ 604 + 605 + struct acpi_ivrs_memory { 606 + struct acpi_ivrs_header header; 607 + u16 aux_data; 608 + u64 reserved; 609 + u64 start_address; 610 + u64 memory_length; 611 + }; 612 + 613 + /******************************************************************************* 614 + * 615 + * MCFG - PCI Memory Mapped Configuration table and sub-table 616 + * Version 1 617 + * 618 + * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 619 + * 620 + ******************************************************************************/ 621 + 622 + struct acpi_table_mcfg { 623 + struct acpi_table_header header; /* Common ACPI table header */ 624 + u8 reserved[8]; 625 + }; 626 + 627 + /* Subtable */ 628 + 629 + struct acpi_mcfg_allocation { 630 + u64 address; /* Base address, processor-relative */ 631 + u16 pci_segment; /* PCI segment group number */ 632 + u8 start_bus_number; /* Starting PCI Bus number */ 633 + u8 end_bus_number; /* Final PCI Bus number */ 634 + u32 reserved; 635 + }; 636 + 637 + /******************************************************************************* 638 + * 639 + * SPCR - Serial Port Console Redirection table 640 + * Version 1 641 + * 642 + * Conforms to "Serial Port Console Redirection Table", 643 + * Version 1.00, January 11, 2002 644 + * 645 + ******************************************************************************/ 646 + 647 + struct acpi_table_spcr { 648 + struct acpi_table_header header; /* Common ACPI table header */ 649 + u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 650 + u8 reserved[3]; 651 + struct acpi_generic_address serial_port; 652 + u8 interrupt_type; 653 + u8 pc_interrupt; 654 + u32 interrupt; 655 + u8 baud_rate; 656 + u8 parity; 657 + u8 stop_bits; 658 + u8 flow_control; 659 + u8 terminal_type; 660 + u8 reserved1; 661 + u16 pci_device_id; 662 + u16 pci_vendor_id; 663 + u8 pci_bus; 664 + u8 pci_device; 665 + u8 pci_function; 666 + u32 pci_flags; 667 + u8 pci_segment; 668 + u32 reserved2; 669 + }; 670 + 671 + /* Masks for pci_flags field above */ 672 + 673 + #define ACPI_SPCR_DO_NOT_DISABLE (1) 674 + 675 + /******************************************************************************* 676 + * 677 + * SPMI - Server Platform Management Interface table 678 + * Version 5 679 + * 680 + * Conforms to "Intelligent Platform Management Interface Specification 681 + * Second Generation v2.0", Document Revision 1.0, February 12, 2004 with 682 + * June 12, 2009 markup. 683 + * 684 + ******************************************************************************/ 685 + 686 + struct acpi_table_spmi { 687 + struct acpi_table_header header; /* Common ACPI table header */ 688 + u8 interface_type; 689 + u8 reserved; /* Must be 1 */ 690 + u16 spec_revision; /* Version of IPMI */ 691 + u8 interrupt_type; 692 + u8 gpe_number; /* GPE assigned */ 693 + u8 reserved1; 694 + u8 pci_device_flag; 695 + u32 interrupt; 696 + struct acpi_generic_address ipmi_register; 697 + u8 pci_segment; 698 + u8 pci_bus; 699 + u8 pci_device; 700 + u8 pci_function; 701 + u8 reserved2; 702 + }; 703 + 704 + /* Values for interface_type above */ 705 + 706 + enum acpi_spmi_interface_types { 707 + ACPI_SPMI_NOT_USED = 0, 708 + ACPI_SPMI_KEYBOARD = 1, 709 + ACPI_SPMI_SMI = 2, 710 + ACPI_SPMI_BLOCK_TRANSFER = 3, 711 + ACPI_SPMI_SMBUS = 4, 712 + ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */ 713 + }; 714 + 715 + /******************************************************************************* 716 + * 717 + * TCPA - Trusted Computing Platform Alliance table 718 + * Version 1 719 + * 720 + * Conforms to "TCG PC Specific Implementation Specification", 721 + * Version 1.1, August 18, 2003 722 + * 723 + ******************************************************************************/ 724 + 725 + struct acpi_table_tcpa { 726 + struct acpi_table_header header; /* Common ACPI table header */ 727 + u16 reserved; 728 + u32 max_log_length; /* Maximum length for the event log area */ 729 + u64 log_address; /* Address of the event log area */ 730 + }; 731 + 732 + /******************************************************************************* 733 + * 734 + * UEFI - UEFI Boot optimization Table 735 + * Version 1 736 + * 737 + * Conforms to "Unified Extensible Firmware Interface Specification", 738 + * Version 2.3, May 8, 2009 739 + * 740 + ******************************************************************************/ 741 + 742 + struct acpi_table_uefi { 743 + struct acpi_table_header header; /* Common ACPI table header */ 744 + u8 identifier[16]; /* UUID identifier */ 745 + u16 data_offset; /* Offset of remaining data in table */ 746 + }; 747 + 748 + /******************************************************************************* 749 + * 750 + * WAET - Windows ACPI Emulated devices Table 751 + * Version 1 752 + * 753 + * Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009 754 + * 755 + ******************************************************************************/ 756 + 757 + struct acpi_table_waet { 758 + struct acpi_table_header header; /* Common ACPI table header */ 759 + u32 flags; 760 + }; 761 + 762 + /* Masks for Flags field above */ 763 + 764 + #define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */ 765 + #define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */ 766 + 767 + /******************************************************************************* 768 + * 769 + * WDAT - Watchdog Action Table 770 + * Version 1 771 + * 772 + * Conforms to "Hardware Watchdog Timers Design Specification", 773 + * Copyright 2006 Microsoft Corporation. 774 + * 775 + ******************************************************************************/ 776 + 777 + struct acpi_table_wdat { 778 + struct acpi_table_header header; /* Common ACPI table header */ 779 + u32 header_length; /* Watchdog Header Length */ 780 + u16 pci_segment; /* PCI Segment number */ 781 + u8 pci_bus; /* PCI Bus number */ 782 + u8 pci_device; /* PCI Device number */ 783 + u8 pci_function; /* PCI Function number */ 784 + u8 reserved[3]; 785 + u32 timer_period; /* Period of one timer count (msec) */ 786 + u32 max_count; /* Maximum counter value supported */ 787 + u32 min_count; /* Minimum counter value */ 788 + u8 flags; 789 + u8 reserved2[3]; 790 + u32 entries; /* Number of watchdog entries that follow */ 791 + }; 792 + 793 + /* Masks for Flags field above */ 794 + 795 + #define ACPI_WDAT_ENABLED (1) 796 + #define ACPI_WDAT_STOPPED 0x80 797 + 798 + /* WDAT Instruction Entries (actions) */ 799 + 800 + struct acpi_wdat_entry { 801 + u8 action; 802 + u8 instruction; 803 + u16 reserved; 804 + struct acpi_generic_address register_region; 805 + u32 value; /* Value used with Read/Write register */ 806 + u32 mask; /* Bitmask required for this register instruction */ 807 + }; 808 + 809 + /* Values for Action field above */ 810 + 811 + enum acpi_wdat_actions { 812 + ACPI_WDAT_RESET = 1, 813 + ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, 814 + ACPI_WDAT_GET_COUNTDOWN = 5, 815 + ACPI_WDAT_SET_COUNTDOWN = 6, 816 + ACPI_WDAT_GET_RUNNING_STATE = 8, 817 + ACPI_WDAT_SET_RUNNING_STATE = 9, 818 + ACPI_WDAT_GET_STOPPED_STATE = 10, 819 + ACPI_WDAT_SET_STOPPED_STATE = 11, 820 + ACPI_WDAT_GET_REBOOT = 16, 821 + ACPI_WDAT_SET_REBOOT = 17, 822 + ACPI_WDAT_GET_SHUTDOWN = 18, 823 + ACPI_WDAT_SET_SHUTDOWN = 19, 824 + ACPI_WDAT_GET_STATUS = 32, 825 + ACPI_WDAT_SET_STATUS = 33, 826 + ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ 827 + }; 828 + 829 + /* Values for Instruction field above */ 830 + 831 + enum acpi_wdat_instructions { 832 + ACPI_WDAT_READ_VALUE = 0, 833 + ACPI_WDAT_READ_COUNTDOWN = 1, 834 + ACPI_WDAT_WRITE_VALUE = 2, 835 + ACPI_WDAT_WRITE_COUNTDOWN = 3, 836 + ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ 837 + ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ 838 + }; 839 + 840 + /******************************************************************************* 841 + * 842 + * WDRT - Watchdog Resource Table 843 + * Version 1 844 + * 845 + * Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003", 846 + * Version 1.01, August 28, 2006 847 + * 848 + ******************************************************************************/ 849 + 850 + struct acpi_table_wdrt { 851 + struct acpi_table_header header; /* Common ACPI table header */ 852 + struct acpi_generic_address control_register; 853 + struct acpi_generic_address count_register; 854 + u16 pci_device_id; 855 + u16 pci_vendor_id; 856 + u8 pci_bus; /* PCI Bus number */ 857 + u8 pci_device; /* PCI Device number */ 858 + u8 pci_function; /* PCI Function number */ 859 + u8 pci_segment; /* PCI Segment number */ 860 + u16 max_count; /* Maximum counter value supported */ 861 + u8 units; 862 + }; 863 + 864 + /* Reset to default packing */ 865 + 866 + #pragma pack() 867 + 868 + #endif /* __ACTBL2_H__ */
+46 -46
include/acpi/actypes.h
··· 338 338 339 339 /* PM Timer ticks per second (HZ) */ 340 340 341 - #define PM_TIMER_FREQUENCY 3579545 341 + #define PM_TIMER_FREQUENCY 3579545 342 342 343 343 /******************************************************************************* 344 344 * ··· 732 732 #define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 733 733 #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 734 734 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 735 - #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 735 + #define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 736 + #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 8 736 737 #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 737 738 738 739 /* ··· 922 921 void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); 923 922 924 923 typedef 925 - void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); 924 + void (*acpi_object_handler) (acpi_handle object, void *data); 926 925 927 926 typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); 928 927 ··· 970 969 #define ACPI_INTERRUPT_NOT_HANDLED 0x00 971 970 #define ACPI_INTERRUPT_HANDLED 0x01 972 971 973 - /* Length of _HID, _UID, _CID, and UUID values */ 972 + /* Length of 32-bit EISAID values when converted back to a string */ 974 973 975 - #define ACPI_DEVICE_ID_LENGTH 0x09 976 - #define ACPI_MAX_CID_LENGTH 48 974 + #define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ 975 + 976 + /* Length of UUID (string) values */ 977 + 977 978 #define ACPI_UUID_LENGTH 16 978 979 979 - /* Common string version of device HIDs and UIDs */ 980 + /* Structures used for device/processor HID, UID, CID */ 980 981 981 982 struct acpica_device_id { 982 - char value[ACPI_DEVICE_ID_LENGTH]; 983 + u32 length; /* Length of string + null */ 984 + char *string; 983 985 }; 984 986 985 - /* Common string version of device CIDs */ 986 - 987 - struct acpi_compatible_id { 988 - char value[ACPI_MAX_CID_LENGTH]; 987 + struct acpica_device_id_list { 988 + u32 count; /* Number of IDs in Ids array */ 989 + u32 list_size; /* Size of list, including ID strings */ 990 + struct acpica_device_id ids[1]; /* ID array */ 989 991 }; 990 992 991 - struct acpi_compatible_id_list { 992 - u32 count; 993 - u32 size; 994 - struct acpi_compatible_id id[1]; 993 + /* 994 + * Structure returned from acpi_get_object_info. 995 + * Optimized for both 32- and 64-bit builds 996 + */ 997 + struct acpi_device_info { 998 + u32 info_size; /* Size of info, including ID strings */ 999 + u32 name; /* ACPI object Name */ 1000 + acpi_object_type type; /* ACPI object Type */ 1001 + u8 param_count; /* If a method, required parameter count */ 1002 + u8 valid; /* Indicates which optional fields are valid */ 1003 + u8 flags; /* Miscellaneous info */ 1004 + u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 1005 + u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ 1006 + u32 current_status; /* _STA value */ 1007 + acpi_integer address; /* _ADR value */ 1008 + struct acpica_device_id hardware_id; /* _HID value */ 1009 + struct acpica_device_id unique_id; /* _UID value */ 1010 + struct acpica_device_id_list compatible_id_list; /* _CID list <must be last> */ 995 1011 }; 996 1012 997 - /* Structure and flags for acpi_get_object_info */ 1013 + /* Values for Flags field above (acpi_get_object_info) */ 998 1014 999 - #define ACPI_VALID_STA 0x0001 1000 - #define ACPI_VALID_ADR 0x0002 1001 - #define ACPI_VALID_HID 0x0004 1002 - #define ACPI_VALID_UID 0x0008 1003 - #define ACPI_VALID_CID 0x0010 1004 - #define ACPI_VALID_SXDS 0x0020 1015 + #define ACPI_PCI_ROOT_BRIDGE 0x01 1016 + 1017 + /* Flags for Valid field above (acpi_get_object_info) */ 1018 + 1019 + #define ACPI_VALID_STA 0x01 1020 + #define ACPI_VALID_ADR 0x02 1021 + #define ACPI_VALID_HID 0x04 1022 + #define ACPI_VALID_UID 0x08 1023 + #define ACPI_VALID_CID 0x10 1024 + #define ACPI_VALID_SXDS 0x20 1025 + #define ACPI_VALID_SXWS 0x40 1005 1026 1006 1027 /* Flags for _STA method */ 1007 1028 ··· 1033 1010 #define ACPI_STA_DEVICE_FUNCTIONING 0x08 1034 1011 #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ 1035 1012 #define ACPI_STA_BATTERY_PRESENT 0x10 1036 - 1037 - #define ACPI_COMMON_OBJ_INFO \ 1038 - acpi_object_type type; /* ACPI object type */ \ 1039 - acpi_name name /* ACPI object Name */ 1040 - 1041 - struct acpi_obj_info_header { 1042 - ACPI_COMMON_OBJ_INFO; 1043 - }; 1044 - 1045 - /* Structure returned from Get Object Info */ 1046 - 1047 - struct acpi_device_info { 1048 - ACPI_COMMON_OBJ_INFO; 1049 - 1050 - u32 param_count; /* If a method, required parameter count */ 1051 - u32 valid; /* Indicates which fields below are valid */ 1052 - u32 current_status; /* _STA value */ 1053 - acpi_integer address; /* _ADR value if any */ 1054 - struct acpica_device_id hardware_id; /* _HID value if any */ 1055 - struct acpica_device_id unique_id; /* _UID value if any */ 1056 - u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ 1057 - struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ 1058 - }; 1059 1013 1060 1014 /* Context structs for address space handlers */ 1061 1015
+2 -2
include/acpi/platform/aclinux.h
··· 149 149 #define ACPI_FREE(a) kfree(a) 150 150 151 151 /* Used within ACPICA to show where it is safe to preempt execution */ 152 - 152 + #include <linux/hardirq.h> 153 153 #define ACPI_PREEMPTION_POINT() \ 154 154 do { \ 155 - if (!irqs_disabled()) \ 155 + if (!in_atomic_preempt_off()) \ 156 156 cond_resched(); \ 157 157 } while (0) 158 158
+10 -5
include/linux/acpi.h
··· 41 41 #include <acpi/acpi_drivers.h> 42 42 #include <acpi/acpi_numa.h> 43 43 #include <asm/acpi.h> 44 - #include <linux/dmi.h> 45 - 46 44 47 45 enum acpi_irq_model_id { 48 46 ACPI_IRQ_MODEL_PIC = 0, ··· 217 219 #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ 218 220 219 221 extern int acpi_blacklisted(void); 220 - #ifdef CONFIG_DMI 221 222 extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); 222 223 extern int acpi_osi_setup(char *str); 223 - #endif 224 224 225 225 #ifdef CONFIG_ACPI_NUMA 226 226 int acpi_get_pxm(acpi_handle handle); ··· 288 292 extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); 289 293 extern void acpi_early_init(void); 290 294 291 - #else /* CONFIG_ACPI */ 295 + #else /* !CONFIG_ACPI */ 296 + 297 + #define acpi_disabled 1 298 + 292 299 static inline void acpi_early_init(void) { } 293 300 294 301 static inline int early_acpi_boot_init(void) ··· 330 331 return 0; 331 332 } 332 333 334 + struct acpi_table_header; 335 + static inline int acpi_table_parse(char *id, 336 + int (*handler)(struct acpi_table_header *)) 337 + { 338 + return -1; 339 + } 333 340 #endif /* !CONFIG_ACPI */ 334 341 #endif /*_LINUX_ACPI_H*/