diff options
81 files changed, 1564 insertions, 595 deletions
diff --git a/Documentation/ABI/testing/sysfs-firmware-acpi b/Documentation/ABI/testing/sysfs-firmware-acpi index f27be7d1a49f..e8ffc70ffe12 100644 --- a/Documentation/ABI/testing/sysfs-firmware-acpi +++ b/Documentation/ABI/testing/sysfs-firmware-acpi | |||
@@ -89,7 +89,7 @@ Description: | |||
89 | 89 | ||
90 | error - an interrupt that can't be accounted for above. | 90 | error - an interrupt that can't be accounted for above. |
91 | 91 | ||
92 | invalid: it's either a wakeup GPE or a GPE/Fixed Event that | 92 | invalid: it's either a GPE or a Fixed Event that |
93 | doesn't have an event handler. | 93 | doesn't have an event handler. |
94 | 94 | ||
95 | disable: the GPE/Fixed Event is valid but disabled. | 95 | disable: the GPE/Fixed Event is valid but disabled. |
@@ -117,30 +117,30 @@ Description: | |||
117 | and other user space applications so that the machine won't shutdown | 117 | and other user space applications so that the machine won't shutdown |
118 | when pressing the power button. | 118 | when pressing the power button. |
119 | # cat ff_pwr_btn | 119 | # cat ff_pwr_btn |
120 | 0 | 120 | 0 enabled |
121 | # press the power button for 3 times; | 121 | # press the power button for 3 times; |
122 | # cat ff_pwr_btn | 122 | # cat ff_pwr_btn |
123 | 3 | 123 | 3 enabled |
124 | # echo disable > ff_pwr_btn | 124 | # echo disable > ff_pwr_btn |
125 | # cat ff_pwr_btn | 125 | # cat ff_pwr_btn |
126 | disable | 126 | 3 disabled |
127 | # press the power button for 3 times; | 127 | # press the power button for 3 times; |
128 | # cat ff_pwr_btn | 128 | # cat ff_pwr_btn |
129 | disable | 129 | 3 disabled |
130 | # echo enable > ff_pwr_btn | 130 | # echo enable > ff_pwr_btn |
131 | # cat ff_pwr_btn | 131 | # cat ff_pwr_btn |
132 | 4 | 132 | 4 enabled |
133 | /* | 133 | /* |
134 | * this is because the status bit is set even if the enable bit is cleared, | 134 | * this is because the status bit is set even if the enable bit is cleared, |
135 | * and it triggers an ACPI fixed event when the enable bit is set again | 135 | * and it triggers an ACPI fixed event when the enable bit is set again |
136 | */ | 136 | */ |
137 | # press the power button for 3 times; | 137 | # press the power button for 3 times; |
138 | # cat ff_pwr_btn | 138 | # cat ff_pwr_btn |
139 | 7 | 139 | 7 enabled |
140 | # echo disable > ff_pwr_btn | 140 | # echo disable > ff_pwr_btn |
141 | # press the power button for 3 times; | 141 | # press the power button for 3 times; |
142 | # echo clear > ff_pwr_btn /* clear the status bit */ | 142 | # echo clear > ff_pwr_btn /* clear the status bit */ |
143 | # echo disable > ff_pwr_btn | 143 | # echo disable > ff_pwr_btn |
144 | # cat ff_pwr_btn | 144 | # cat ff_pwr_btn |
145 | 7 | 145 | 7 enabled |
146 | 146 | ||
diff --git a/Documentation/acpi/debug.txt b/Documentation/acpi/debug.txt new file mode 100644 index 000000000000..65bf47c46b6d --- /dev/null +++ b/Documentation/acpi/debug.txt | |||
@@ -0,0 +1,148 @@ | |||
1 | ACPI Debug Output | ||
2 | |||
3 | |||
4 | The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug | ||
5 | output. This document describes how to use this facility. | ||
6 | |||
7 | Compile-time configuration | ||
8 | -------------------------- | ||
9 | |||
10 | ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config | ||
11 | option is turned off, the debug messages are not even built into the | ||
12 | kernel. | ||
13 | |||
14 | Boot- and run-time configuration | ||
15 | -------------------------------- | ||
16 | |||
17 | When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages | ||
18 | you're interested in. At boot-time, use the acpi.debug_layer and | ||
19 | acpi.debug_level kernel command line options. After boot, you can use the | ||
20 | debug_layer and debug_level files in /sys/module/acpi/parameters/ to control | ||
21 | the debug messages. | ||
22 | |||
23 | debug_layer (component) | ||
24 | ----------------------- | ||
25 | |||
26 | The "debug_layer" is a mask that selects components of interest, e.g., a | ||
27 | specific driver or part of the ACPI interpreter. To build the debug_layer | ||
28 | bitmask, look for the "#define _COMPONENT" in an ACPI source file. | ||
29 | |||
30 | You can set the debug_layer mask at boot-time using the acpi.debug_layer | ||
31 | command line argument, and you can change it after boot by writing values | ||
32 | to /sys/module/acpi/parameters/debug_layer. | ||
33 | |||
34 | The possible components are defined in include/acpi/acoutput.h and | ||
35 | include/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer | ||
36 | shows the supported mask values, currently these: | ||
37 | |||
38 | ACPI_UTILITIES 0x00000001 | ||
39 | ACPI_HARDWARE 0x00000002 | ||
40 | ACPI_EVENTS 0x00000004 | ||
41 | ACPI_TABLES 0x00000008 | ||
42 | ACPI_NAMESPACE 0x00000010 | ||
43 | ACPI_PARSER 0x00000020 | ||
44 | ACPI_DISPATCHER 0x00000040 | ||
45 | ACPI_EXECUTER 0x00000080 | ||
46 | ACPI_RESOURCES 0x00000100 | ||
47 | ACPI_CA_DEBUGGER 0x00000200 | ||
48 | ACPI_OS_SERVICES 0x00000400 | ||
49 | ACPI_CA_DISASSEMBLER 0x00000800 | ||
50 | ACPI_COMPILER 0x00001000 | ||
51 | ACPI_TOOLS 0x00002000 | ||
52 | ACPI_BUS_COMPONENT 0x00010000 | ||
53 | ACPI_AC_COMPONENT 0x00020000 | ||
54 | ACPI_BATTERY_COMPONENT 0x00040000 | ||
55 | ACPI_BUTTON_COMPONENT 0x00080000 | ||
56 | ACPI_SBS_COMPONENT 0x00100000 | ||
57 | ACPI_FAN_COMPONENT 0x00200000 | ||
58 | ACPI_PCI_COMPONENT 0x00400000 | ||
59 | ACPI_POWER_COMPONENT 0x00800000 | ||
60 | ACPI_CONTAINER_COMPONENT 0x01000000 | ||
61 | ACPI_SYSTEM_COMPONENT 0x02000000 | ||
62 | ACPI_THERMAL_COMPONENT 0x04000000 | ||
63 | ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 | ||
64 | ACPI_VIDEO_COMPONENT 0x10000000 | ||
65 | ACPI_PROCESSOR_COMPONENT 0x20000000 | ||
66 | |||
67 | debug_level | ||
68 | ----------- | ||
69 | |||
70 | The "debug_level" is a mask that selects different types of messages, e.g., | ||
71 | those related to initialization, method execution, informational messages, etc. | ||
72 | To build debug_level, look at the level specified in an ACPI_DEBUG_PRINT() | ||
73 | statement. | ||
74 | |||
75 | The ACPI interpreter uses several different levels, but the Linux | ||
76 | ACPI core and ACPI drivers generally only use ACPI_LV_INFO. | ||
77 | |||
78 | You can set the debug_level mask at boot-time using the acpi.debug_level | ||
79 | command line argument, and you can change it after boot by writing values | ||
80 | to /sys/module/acpi/parameters/debug_level. | ||
81 | |||
82 | The possible levels are defined in include/acpi/acoutput.h. Reading | ||
83 | /sys/module/acpi/parameters/debug_level shows the supported mask values, | ||
84 | currently these: | ||
85 | |||
86 | ACPI_LV_INIT 0x00000001 | ||
87 | ACPI_LV_DEBUG_OBJECT 0x00000002 | ||
88 | ACPI_LV_INFO 0x00000004 | ||
89 | ACPI_LV_INIT_NAMES 0x00000020 | ||
90 | ACPI_LV_PARSE 0x00000040 | ||
91 | ACPI_LV_LOAD 0x00000080 | ||
92 | ACPI_LV_DISPATCH 0x00000100 | ||
93 | ACPI_LV_EXEC 0x00000200 | ||
94 | ACPI_LV_NAMES 0x00000400 | ||
95 | ACPI_LV_OPREGION 0x00000800 | ||
96 | ACPI_LV_BFIELD 0x00001000 | ||
97 | ACPI_LV_TABLES 0x00002000 | ||
98 | ACPI_LV_VALUES 0x00004000 | ||
99 | ACPI_LV_OBJECTS 0x00008000 | ||
100 | ACPI_LV_RESOURCES 0x00010000 | ||
101 | ACPI_LV_USER_REQUESTS 0x00020000 | ||
102 | ACPI_LV_PACKAGE 0x00040000 | ||
103 | ACPI_LV_ALLOCATIONS 0x00100000 | ||
104 | ACPI_LV_FUNCTIONS 0x00200000 | ||
105 | ACPI_LV_OPTIMIZATIONS 0x00400000 | ||
106 | ACPI_LV_MUTEX 0x01000000 | ||
107 | ACPI_LV_THREADS 0x02000000 | ||
108 | ACPI_LV_IO 0x04000000 | ||
109 | ACPI_LV_INTERRUPTS 0x08000000 | ||
110 | ACPI_LV_AML_DISASSEMBLE 0x10000000 | ||
111 | ACPI_LV_VERBOSE_INFO 0x20000000 | ||
112 | ACPI_LV_FULL_TABLES 0x40000000 | ||
113 | ACPI_LV_EVENTS 0x80000000 | ||
114 | |||
115 | Examples | ||
116 | -------- | ||
117 | |||
118 | For example, drivers/acpi/bus.c contains this: | ||
119 | |||
120 | #define _COMPONENT ACPI_BUS_COMPONENT | ||
121 | ... | ||
122 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n")); | ||
123 | |||
124 | To turn on this message, set the ACPI_BUS_COMPONENT bit in acpi.debug_layer | ||
125 | and the ACPI_LV_INFO bit in acpi.debug_level. (The ACPI_DEBUG_PRINT | ||
126 | statement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO | ||
127 | definition.) | ||
128 | |||
129 | Enable all AML "Debug" output (stores to the Debug object while interpreting | ||
130 | AML) during boot: | ||
131 | |||
132 | acpi.debug_layer=0xffffffff acpi.debug_level=0x2 | ||
133 | |||
134 | Enable PCI and PCI interrupt routing debug messages: | ||
135 | |||
136 | acpi.debug_layer=0x400000 acpi.debug_level=0x4 | ||
137 | |||
138 | Enable all ACPI hardware-related messages: | ||
139 | |||
140 | acpi.debug_layer=0x2 acpi.debug_level=0xffffffff | ||
141 | |||
142 | Enable all ACPI_DB_INFO messages after boot: | ||
143 | |||
144 | # echo 0x4 > /sys/module/acpi/parameters/debug_level | ||
145 | |||
146 | Show all valid component values: | ||
147 | |||
148 | # cat /sys/module/acpi/parameters/debug_layer | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c86c07459712..c600c4ffc657 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -198,59 +198,42 @@ and is between 256 and 4096 characters. It is defined in the file | |||
198 | that require a timer override, but don't have | 198 | that require a timer override, but don't have |
199 | HPET | 199 | HPET |
200 | 200 | ||
201 | acpi.debug_layer= [HW,ACPI] | 201 | acpi_backlight= [HW,ACPI] |
202 | acpi_backlight=vendor | ||
203 | acpi_backlight=video | ||
204 | If set to vendor, prefer vendor specific driver | ||
205 | (e.g. thinkpad_acpi, sony_acpi, etc.) instead | ||
206 | of the ACPI video.ko driver. | ||
207 | |||
208 | acpi_display_output= [HW,ACPI] | ||
209 | acpi_display_output=vendor | ||
210 | acpi_display_output=video | ||
211 | See above. | ||
212 | |||
213 | acpi.debug_layer= [HW,ACPI,ACPI_DEBUG] | ||
214 | acpi.debug_level= [HW,ACPI,ACPI_DEBUG] | ||
202 | Format: <int> | 215 | Format: <int> |
203 | Each bit of the <int> indicates an ACPI debug layer, | 216 | CONFIG_ACPI_DEBUG must be enabled to produce any ACPI |
204 | 1: enable, 0: disable. It is useful for boot time | 217 | debug output. Bits in debug_layer correspond to a |
205 | debugging. After system has booted up, it can be set | 218 | _COMPONENT in an ACPI source file, e.g., |
206 | via /sys/module/acpi/parameters/debug_layer. | 219 | #define _COMPONENT ACPI_PCI_COMPONENT |
207 | CONFIG_ACPI_DEBUG must be enabled for this to produce any output. | 220 | Bits in debug_level correspond to a level in |
208 | Available bits (add the numbers together) to enable debug output | 221 | ACPI_DEBUG_PRINT statements, e.g., |
209 | for specific parts of the ACPI subsystem: | 222 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, ... |
210 | 0x01 utilities 0x02 hardware 0x04 events 0x08 tables | 223 | See Documentation/acpi/debug.txt for more information |
211 | 0x10 namespace 0x20 parser 0x40 dispatcher | 224 | about debug layers and levels. |
212 | 0x80 executer 0x100 resources 0x200 acpica debugger | 225 | |
213 | 0x400 os services 0x800 acpica disassembler. | 226 | Enable AML "Debug" output, i.e., stores to the Debug |
214 | The number can be in decimal or prefixed with 0x in hex. | 227 | object while interpreting AML: |
215 | Warning: Many of these options can produce a lot of | 228 | acpi.debug_layer=0xffffffff acpi.debug_level=0x2 |
216 | output and make your system unusable. Be very careful. | 229 | Enable PCI/PCI interrupt routing info messages: |
217 | 230 | acpi.debug_layer=0x400000 acpi.debug_level=0x4 | |
218 | acpi.debug_level= [HW,ACPI] | 231 | Enable all messages related to ACPI hardware: |
219 | Format: <int> | 232 | acpi.debug_layer=0x2 acpi.debug_level=0xffffffff |
220 | Each bit of the <int> indicates an ACPI debug level, | 233 | |
221 | which corresponds to the level in an ACPI_DEBUG_PRINT | 234 | Some values produce so much output that the system is |
222 | statement. After system has booted up, this mask | 235 | unusable. The "log_buf_len" parameter may be useful |
223 | can be set via /sys/module/acpi/parameters/debug_level. | 236 | if you need to capture more output. |
224 | |||
225 | CONFIG_ACPI_DEBUG must be enabled for this to produce | ||
226 | any output. The number can be in decimal or prefixed | ||
227 | with 0x in hex. Some of these options produce so much | ||
228 | output that the system is unusable. | ||
229 | |||
230 | The following global components are defined by the | ||
231 | ACPI CA: | ||
232 | 0x01 error | ||
233 | 0x02 warn | ||
234 | 0x04 init | ||
235 | 0x08 debug object | ||
236 | 0x10 info | ||
237 | 0x20 init names | ||
238 | 0x40 parse | ||
239 | 0x80 load | ||
240 | 0x100 dispatch | ||
241 | 0x200 execute | ||
242 | 0x400 names | ||
243 | 0x800 operation region | ||
244 | 0x1000 bfield | ||
245 | 0x2000 tables | ||
246 | 0x4000 values | ||
247 | 0x8000 objects | ||
248 | 0x10000 resources | ||
249 | 0x20000 user requests | ||
250 | 0x40000 package | ||
251 | The number can be in decimal or prefixed with 0x in hex. | ||
252 | Warning: Many of these options can produce a lot of | ||
253 | output and make your system unusable. Be very careful. | ||
254 | 237 | ||
255 | acpi.power_nocheck= [HW,ACPI] | 238 | acpi.power_nocheck= [HW,ACPI] |
256 | Format: 1/0 enable/disable the check of power state. | 239 | Format: 1/0 enable/disable the check of power state. |
diff --git a/MAINTAINERS b/MAINTAINERS index 53e78c83cc7a..272d04e95faa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2216,6 +2216,13 @@ M: adaplas@gmail.com | |||
2216 | L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers) | 2216 | L: linux-fbdev-devel@lists.sourceforge.net (moderated for non-subscribers) |
2217 | S: Maintained | 2217 | S: Maintained |
2218 | 2218 | ||
2219 | INTEL MENLOW THERMAL DRIVER | ||
2220 | P: Sujith Thomas | ||
2221 | M: sujith.thomas@intel.com | ||
2222 | L: linux-acpi@vger.kernel.org | ||
2223 | W: http://www.lesswatts.org/projects/acpi/ | ||
2224 | S: Supported | ||
2225 | |||
2219 | INTEL IA32 MICROCODE UPDATE SUPPORT | 2226 | INTEL IA32 MICROCODE UPDATE SUPPORT |
2220 | P: Tigran Aivazian | 2227 | P: Tigran Aivazian |
2221 | M: tigran@aivazian.fsnet.co.uk | 2228 | M: tigran@aivazian.fsnet.co.uk |
@@ -3377,7 +3384,9 @@ S: Maintained | |||
3377 | 3384 | ||
3378 | PNP SUPPORT | 3385 | PNP SUPPORT |
3379 | P: Adam Belay | 3386 | P: Adam Belay |
3380 | M: ambx1@neo.rr.com | 3387 | M: abelay@mit.edu |
3388 | P: Bjorn Helgaas | ||
3389 | M: bjorn.helgaas@hp.com | ||
3381 | S: Maintained | 3390 | S: Maintained |
3382 | 3391 | ||
3383 | PNXxxxx I2C DRIVER | 3392 | PNXxxxx I2C DRIVER |
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig index 8e99fed6b3fd..f833a0b4188d 100644 --- a/arch/ia64/kvm/Kconfig +++ b/arch/ia64/kvm/Kconfig | |||
@@ -20,6 +20,8 @@ if VIRTUALIZATION | |||
20 | config KVM | 20 | config KVM |
21 | tristate "Kernel-based Virtual Machine (KVM) support" | 21 | tristate "Kernel-based Virtual Machine (KVM) support" |
22 | depends on HAVE_KVM && EXPERIMENTAL | 22 | depends on HAVE_KVM && EXPERIMENTAL |
23 | # for device assignment: | ||
24 | depends on PCI | ||
23 | select PREEMPT_NOTIFIERS | 25 | select PREEMPT_NOTIFIERS |
24 | select ANON_INODES | 26 | select ANON_INODES |
25 | ---help--- | 27 | ---help--- |
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 3caac477de9e..af1464f7a6ad 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -673,16 +673,16 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
673 | 673 | ||
674 | vcpu_load(vcpu); | 674 | vcpu_load(vcpu); |
675 | 675 | ||
676 | if (vcpu->sigset_active) | ||
677 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | ||
678 | |||
676 | if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { | 679 | if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { |
677 | kvm_vcpu_block(vcpu); | 680 | kvm_vcpu_block(vcpu); |
678 | clear_bit(KVM_REQ_UNHALT, &vcpu->requests); | 681 | clear_bit(KVM_REQ_UNHALT, &vcpu->requests); |
679 | vcpu_put(vcpu); | 682 | r = -EAGAIN; |
680 | return -EAGAIN; | 683 | goto out; |
681 | } | 684 | } |
682 | 685 | ||
683 | if (vcpu->sigset_active) | ||
684 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | ||
685 | |||
686 | if (vcpu->mmio_needed) { | 686 | if (vcpu->mmio_needed) { |
687 | memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); | 687 | memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); |
688 | kvm_set_mmio_data(vcpu); | 688 | kvm_set_mmio_data(vcpu); |
@@ -690,7 +690,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
690 | vcpu->mmio_needed = 0; | 690 | vcpu->mmio_needed = 0; |
691 | } | 691 | } |
692 | r = __vcpu_run(vcpu, kvm_run); | 692 | r = __vcpu_run(vcpu, kvm_run); |
693 | 693 | out: | |
694 | if (vcpu->sigset_active) | 694 | if (vcpu->sigset_active) |
695 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | 695 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); |
696 | 696 | ||
diff --git a/arch/ia64/kvm/vcpu.h b/arch/ia64/kvm/vcpu.h index 341e3fee280c..e9b2a4e121c0 100644 --- a/arch/ia64/kvm/vcpu.h +++ b/arch/ia64/kvm/vcpu.h | |||
@@ -384,6 +384,10 @@ static inline u64 __gpfn_is_io(u64 gpfn) | |||
384 | #define MODE_IND(psr) \ | 384 | #define MODE_IND(psr) \ |
385 | (((psr).it << 2) + ((psr).dt << 1) + (psr).rt) | 385 | (((psr).it << 2) + ((psr).dt << 1) + (psr).rt) |
386 | 386 | ||
387 | #ifndef CONFIG_SMP | ||
388 | #define _vmm_raw_spin_lock(x) do {}while(0) | ||
389 | #define _vmm_raw_spin_unlock(x) do {}while(0) | ||
390 | #else | ||
387 | #define _vmm_raw_spin_lock(x) \ | 391 | #define _vmm_raw_spin_lock(x) \ |
388 | do { \ | 392 | do { \ |
389 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ | 393 | __u32 *ia64_spinlock_ptr = (__u32 *) (x); \ |
@@ -403,6 +407,7 @@ static inline u64 __gpfn_is_io(u64 gpfn) | |||
403 | do { barrier(); \ | 407 | do { barrier(); \ |
404 | ((spinlock_t *)x)->raw_lock.lock = 0; } \ | 408 | ((spinlock_t *)x)->raw_lock.lock = 0; } \ |
405 | while (0) | 409 | while (0) |
410 | #endif | ||
406 | 411 | ||
407 | void vmm_spin_lock(spinlock_t *lock); | 412 | void vmm_spin_lock(spinlock_t *lock); |
408 | void vmm_spin_unlock(spinlock_t *lock); | 413 | void vmm_spin_unlock(spinlock_t *lock); |
diff --git a/arch/mn10300/Kconfig.debug b/arch/mn10300/Kconfig.debug index 524e33819f32..ff80e86b9bd2 100644 --- a/arch/mn10300/Kconfig.debug +++ b/arch/mn10300/Kconfig.debug | |||
@@ -15,6 +15,15 @@ config DEBUG_DECOMPRESS_KERNEL | |||
15 | decompressing Linux seeing "Uncompressing Linux... " and | 15 | decompressing Linux seeing "Uncompressing Linux... " and |
16 | "Ok, booting the kernel.\n" on console. | 16 | "Ok, booting the kernel.\n" on console. |
17 | 17 | ||
18 | config TEST_MISALIGNMENT_HANDLER | ||
19 | bool "Run tests on the misalignment handler" | ||
20 | depends on DEBUG_KERNEL | ||
21 | default n | ||
22 | help | ||
23 | If you say Y here the kernel will execute a list of misaligned memory | ||
24 | accesses to make sure the misalignment handler deals them with | ||
25 | correctly. If it does not, the kernel will throw a BUG. | ||
26 | |||
18 | config KPROBES | 27 | config KPROBES |
19 | bool "Kprobes" | 28 | bool "Kprobes" |
20 | depends on DEBUG_KERNEL | 29 | depends on DEBUG_KERNEL |
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c index 32aa89dc3848..94c4a4358065 100644 --- a/arch/mn10300/mm/misalignment.c +++ b/arch/mn10300/mm/misalignment.c | |||
@@ -37,26 +37,22 @@ | |||
37 | #include <asm/asm-offsets.h> | 37 | #include <asm/asm-offsets.h> |
38 | 38 | ||
39 | #if 0 | 39 | #if 0 |
40 | #define kdebug(FMT, ...) printk(KERN_DEBUG FMT, ##__VA_ARGS__) | 40 | #define kdebug(FMT, ...) printk(KERN_DEBUG "MISALIGN: "FMT"\n", ##__VA_ARGS__) |
41 | #else | 41 | #else |
42 | #define kdebug(FMT, ...) do {} while (0) | 42 | #define kdebug(FMT, ...) do {} while (0) |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | static int misalignment_addr(unsigned long *registers, unsigned params, | 45 | static int misalignment_addr(unsigned long *registers, unsigned long sp, |
46 | unsigned opcode, unsigned disp, | 46 | unsigned params, unsigned opcode, |
47 | void **_address, unsigned long **_postinc); | 47 | unsigned long disp, |
48 | void **_address, unsigned long **_postinc, | ||
49 | unsigned long *_inc); | ||
48 | 50 | ||
49 | static int misalignment_reg(unsigned long *registers, unsigned params, | 51 | static int misalignment_reg(unsigned long *registers, unsigned params, |
50 | unsigned opcode, unsigned disp, | 52 | unsigned opcode, unsigned long disp, |
51 | unsigned long **_register); | 53 | unsigned long **_register); |
52 | 54 | ||
53 | static inline unsigned int_log2(unsigned x) | 55 | static void misalignment_MOV_Lcc(struct pt_regs *regs, uint32_t opcode); |
54 | { | ||
55 | unsigned y; | ||
56 | asm("bsch %1,%0" : "=r"(y) : "r"(x), "0"(0)); | ||
57 | return y; | ||
58 | } | ||
59 | #define log2(x) int_log2(x) | ||
60 | 56 | ||
61 | static const unsigned Dreg_index[] = { | 57 | static const unsigned Dreg_index[] = { |
62 | REG_D0 >> 2, REG_D1 >> 2, REG_D2 >> 2, REG_D3 >> 2 | 58 | REG_D0 >> 2, REG_D1 >> 2, REG_D2 >> 2, REG_D3 >> 2 |
@@ -86,9 +82,10 @@ enum format_id { | |||
86 | FMT_D7, | 82 | FMT_D7, |
87 | FMT_D8, | 83 | FMT_D8, |
88 | FMT_D9, | 84 | FMT_D9, |
85 | FMT_D10, | ||
89 | }; | 86 | }; |
90 | 87 | ||
91 | struct { | 88 | static const struct { |
92 | u_int8_t opsz, dispsz; | 89 | u_int8_t opsz, dispsz; |
93 | } format_tbl[16] = { | 90 | } format_tbl[16] = { |
94 | [FMT_S0] = { 8, 0 }, | 91 | [FMT_S0] = { 8, 0 }, |
@@ -103,6 +100,7 @@ struct { | |||
103 | [FMT_D7] = { 24, 8 }, | 100 | [FMT_D7] = { 24, 8 }, |
104 | [FMT_D8] = { 24, 24 }, | 101 | [FMT_D8] = { 24, 24 }, |
105 | [FMT_D9] = { 24, 32 }, | 102 | [FMT_D9] = { 24, 32 }, |
103 | [FMT_D10] = { 32, 0 }, | ||
106 | }; | 104 | }; |
107 | 105 | ||
108 | enum value_id { | 106 | enum value_id { |
@@ -128,9 +126,14 @@ enum value_id { | |||
128 | SD24, /* 24-bit signed displacement */ | 126 | SD24, /* 24-bit signed displacement */ |
129 | SIMM4_2, /* 4-bit signed displacement in opcode bits 4-7 */ | 127 | SIMM4_2, /* 4-bit signed displacement in opcode bits 4-7 */ |
130 | SIMM8, /* 8-bit signed immediate */ | 128 | SIMM8, /* 8-bit signed immediate */ |
129 | IMM8, /* 8-bit unsigned immediate */ | ||
130 | IMM16, /* 16-bit unsigned immediate */ | ||
131 | IMM24, /* 24-bit unsigned immediate */ | 131 | IMM24, /* 24-bit unsigned immediate */ |
132 | IMM32, /* 32-bit unsigned immediate */ | 132 | IMM32, /* 32-bit unsigned immediate */ |
133 | IMM32_HIGH8, /* 32-bit unsigned immediate, high 8-bits in opcode */ | 133 | IMM32_HIGH8, /* 32-bit unsigned immediate, LSB in opcode */ |
134 | |||
135 | IMM32_MEM, /* 32-bit unsigned displacement */ | ||
136 | IMM32_HIGH8_MEM, /* 32-bit unsigned displacement, LSB in opcode */ | ||
134 | 137 | ||
135 | DN0 = DM0, | 138 | DN0 = DM0, |
136 | DN1 = DM1, | 139 | DN1 = DM1, |
@@ -149,7 +152,7 @@ enum value_id { | |||
149 | }; | 152 | }; |
150 | 153 | ||
151 | struct mn10300_opcode { | 154 | struct mn10300_opcode { |
152 | const char *name; | 155 | const char name[8]; |
153 | u_int32_t opcode; | 156 | u_int32_t opcode; |
154 | u_int32_t opmask; | 157 | u_int32_t opmask; |
155 | unsigned exclusion; | 158 | unsigned exclusion; |
@@ -185,6 +188,10 @@ struct mn10300_opcode { | |||
185 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 188 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
186 | */ | 189 | */ |
187 | static const struct mn10300_opcode mn10300_opcodes[] = { | 190 | static const struct mn10300_opcode mn10300_opcodes[] = { |
191 | { "mov", 0x4200, 0xf300, 0, FMT_S1, 0, {DM1, MEM2(IMM8, SP)}}, | ||
192 | { "mov", 0x4300, 0xf300, 0, FMT_S1, 0, {AM1, MEM2(IMM8, SP)}}, | ||
193 | { "mov", 0x5800, 0xfc00, 0, FMT_S1, 0, {MEM2(IMM8, SP), DN0}}, | ||
194 | { "mov", 0x5c00, 0xfc00, 0, FMT_S1, 0, {MEM2(IMM8, SP), AN0}}, | ||
188 | { "mov", 0x60, 0xf0, 0, FMT_S0, 0, {DM1, MEM(AN0)}}, | 195 | { "mov", 0x60, 0xf0, 0, FMT_S0, 0, {DM1, MEM(AN0)}}, |
189 | { "mov", 0x70, 0xf0, 0, FMT_S0, 0, {MEM(AM0), DN1}}, | 196 | { "mov", 0x70, 0xf0, 0, FMT_S0, 0, {MEM(AM0), DN1}}, |
190 | { "mov", 0xf000, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), AN1}}, | 197 | { "mov", 0xf000, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), AN1}}, |
@@ -197,8 +204,6 @@ static const struct mn10300_opcode mn10300_opcodes[] = { | |||
197 | { "mov", 0xf81000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, | 204 | { "mov", 0xf81000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, |
198 | { "mov", 0xf82000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8,AM0), AN1}}, | 205 | { "mov", 0xf82000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8,AM0), AN1}}, |
199 | { "mov", 0xf83000, 0xfff000, 0, FMT_D1, 0, {AM1, MEM2(SD8, AN0)}}, | 206 | { "mov", 0xf83000, 0xfff000, 0, FMT_D1, 0, {AM1, MEM2(SD8, AN0)}}, |
200 | { "mov", 0xf8f000, 0xfffc00, 0, FMT_D1, AM33, {MEM2(SD8, AM0), SP}}, | ||
201 | { "mov", 0xf8f400, 0xfffc00, 0, FMT_D1, AM33, {SP, MEM2(SD8, AN0)}}, | ||
202 | { "mov", 0xf90a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, | 207 | { "mov", 0xf90a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, |
203 | { "mov", 0xf91a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, | 208 | { "mov", 0xf91a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, |
204 | { "mov", 0xf96a00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, | 209 | { "mov", 0xf96a00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, |
@@ -207,24 +212,46 @@ static const struct mn10300_opcode mn10300_opcodes[] = { | |||
207 | { "mov", 0xfa100000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, | 212 | { "mov", 0xfa100000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, |
208 | { "mov", 0xfa200000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), AN1}}, | 213 | { "mov", 0xfa200000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), AN1}}, |
209 | { "mov", 0xfa300000, 0xfff00000, 0, FMT_D2, 0, {AM1, MEM2(SD16, AN0)}}, | 214 | { "mov", 0xfa300000, 0xfff00000, 0, FMT_D2, 0, {AM1, MEM2(SD16, AN0)}}, |
215 | { "mov", 0xfa900000, 0xfff30000, 0, FMT_D2, 0, {AM1, MEM2(IMM16, SP)}}, | ||
216 | { "mov", 0xfa910000, 0xfff30000, 0, FMT_D2, 0, {DM1, MEM2(IMM16, SP)}}, | ||
217 | { "mov", 0xfab00000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), AN0}}, | ||
218 | { "mov", 0xfab40000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), DN0}}, | ||
210 | { "mov", 0xfb0a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, | 219 | { "mov", 0xfb0a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, |
211 | { "mov", 0xfb1a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, | 220 | { "mov", 0xfb1a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, |
212 | { "mov", 0xfb6a0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, | 221 | { "mov", 0xfb6a0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, |
213 | { "mov", 0xfb7a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, | 222 | { "mov", 0xfb7a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, |
223 | { "mov", 0xfb8a0000, 0xffff0f00, 0, FMT_D7, AM33, {MEM2(IMM8, SP), RN2}}, | ||
214 | { "mov", 0xfb8e0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, | 224 | { "mov", 0xfb8e0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, |
225 | { "mov", 0xfb9a0000, 0xffff0f00, 0, FMT_D7, AM33, {RM2, MEM2(IMM8, SP)}}, | ||
215 | { "mov", 0xfb9e0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, | 226 | { "mov", 0xfb9e0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, |
216 | { "mov", 0xfc000000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, | 227 | { "mov", 0xfc000000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, |
217 | { "mov", 0xfc100000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, | 228 | { "mov", 0xfc100000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, |
218 | { "mov", 0xfc200000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), AN1}}, | 229 | { "mov", 0xfc200000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), AN1}}, |
219 | { "mov", 0xfc300000, 0xfff00000, 0, FMT_D4, 0, {AM1, MEM2(IMM32,AN0)}}, | 230 | { "mov", 0xfc300000, 0xfff00000, 0, FMT_D4, 0, {AM1, MEM2(IMM32,AN0)}}, |
231 | { "mov", 0xfc800000, 0xfff30000, 0, FMT_D4, 0, {AM1, MEM(IMM32_MEM)}}, | ||
232 | { "mov", 0xfc810000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM(IMM32_MEM)}}, | ||
233 | { "mov", 0xfc900000, 0xfff30000, 0, FMT_D4, 0, {AM1, MEM2(IMM32, SP)}}, | ||
234 | { "mov", 0xfc910000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM2(IMM32, SP)}}, | ||
235 | { "mov", 0xfca00000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), AN0}}, | ||
236 | { "mov", 0xfca40000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), DN0}}, | ||
237 | { "mov", 0xfcb00000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), AN0}}, | ||
238 | { "mov", 0xfcb40000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), DN0}}, | ||
220 | { "mov", 0xfd0a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, | 239 | { "mov", 0xfd0a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, |
221 | { "mov", 0xfd1a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, | 240 | { "mov", 0xfd1a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, |
222 | { "mov", 0xfd6a0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, | 241 | { "mov", 0xfd6a0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, |
223 | { "mov", 0xfd7a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, | 242 | { "mov", 0xfd7a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, |
243 | { "mov", 0xfd8a0000, 0xffff0f00, 0, FMT_D8, AM33, {MEM2(IMM24, SP), RN2}}, | ||
244 | { "mov", 0xfd9a0000, 0xffff0f00, 0, FMT_D8, AM33, {RM2, MEM2(IMM24, SP)}}, | ||
224 | { "mov", 0xfe0a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, | 245 | { "mov", 0xfe0a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, |
246 | { "mov", 0xfe0a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, | ||
247 | { "mov", 0xfe0e0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM(IMM32_HIGH8_MEM), RN2}}, | ||
248 | { "mov", 0xfe1a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, | ||
225 | { "mov", 0xfe1a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, | 249 | { "mov", 0xfe1a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, |
250 | { "mov", 0xfe1e0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM(IMM32_HIGH8_MEM)}}, | ||
226 | { "mov", 0xfe6a0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, | 251 | { "mov", 0xfe6a0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, |
227 | { "mov", 0xfe7a0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, | 252 | { "mov", 0xfe7a0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, |
253 | { "mov", 0xfe8a0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8, SP), RN2}}, | ||
254 | { "mov", 0xfe9a0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, SP)}}, | ||
228 | 255 | ||
229 | { "movhu", 0xf060, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), DN1}}, | 256 | { "movhu", 0xf060, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), DN1}}, |
230 | { "movhu", 0xf070, 0xfff0, 0, FMT_D0, 0, {DM1, MEM(AN0)}}, | 257 | { "movhu", 0xf070, 0xfff0, 0, FMT_D0, 0, {DM1, MEM(AN0)}}, |
@@ -232,29 +259,58 @@ static const struct mn10300_opcode mn10300_opcodes[] = { | |||
232 | { "movhu", 0xf4c0, 0xffc0, 0, FMT_D0, 0, {DM2, MEM2(DI, AN0)}}, | 259 | { "movhu", 0xf4c0, 0xffc0, 0, FMT_D0, 0, {DM2, MEM2(DI, AN0)}}, |
233 | { "movhu", 0xf86000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8, AM0), DN1}}, | 260 | { "movhu", 0xf86000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8, AM0), DN1}}, |
234 | { "movhu", 0xf87000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, | 261 | { "movhu", 0xf87000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, |
262 | { "movhu", 0xf89300, 0xfff300, 0, FMT_D1, 0, {DM1, MEM2(IMM8, SP)}}, | ||
263 | { "movhu", 0xf8bc00, 0xfffc00, 0, FMT_D1, 0, {MEM2(IMM8, SP), DN0}}, | ||
235 | { "movhu", 0xf94a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, | 264 | { "movhu", 0xf94a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, |
236 | { "movhu", 0xf95a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, | 265 | { "movhu", 0xf95a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, |
237 | { "movhu", 0xf9ea00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, | 266 | { "movhu", 0xf9ea00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, |
238 | { "movhu", 0xf9fa00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEMINC(RN0)}}, | 267 | { "movhu", 0xf9fa00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEMINC(RN0)}}, |
239 | { "movhu", 0xfa600000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), DN1}}, | 268 | { "movhu", 0xfa600000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), DN1}}, |
240 | { "movhu", 0xfa700000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, | 269 | { "movhu", 0xfa700000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, |
270 | { "movhu", 0xfa930000, 0xfff30000, 0, FMT_D2, 0, {DM1, MEM2(IMM16, SP)}}, | ||
271 | { "movhu", 0xfabc0000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), DN0}}, | ||
241 | { "movhu", 0xfb4a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, | 272 | { "movhu", 0xfb4a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, |
242 | { "movhu", 0xfb5a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, | 273 | { "movhu", 0xfb5a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, |
274 | { "movhu", 0xfbca0000, 0xffff0f00, 0, FMT_D7, AM33, {MEM2(IMM8, SP), RN2}}, | ||
243 | { "movhu", 0xfbce0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, | 275 | { "movhu", 0xfbce0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, |
276 | { "movhu", 0xfbda0000, 0xffff0f00, 0, FMT_D7, AM33, {RM2, MEM2(IMM8, SP)}}, | ||
244 | { "movhu", 0xfbde0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, | 277 | { "movhu", 0xfbde0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, |
245 | { "movhu", 0xfbea0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, | 278 | { "movhu", 0xfbea0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, |
246 | { "movhu", 0xfbfa0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, | 279 | { "movhu", 0xfbfa0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, |
247 | { "movhu", 0xfc600000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, | 280 | { "movhu", 0xfc600000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, |
248 | { "movhu", 0xfc700000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, | 281 | { "movhu", 0xfc700000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, |
282 | { "movhu", 0xfc830000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM(IMM32_MEM)}}, | ||
283 | { "movhu", 0xfc930000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM2(IMM32, SP)}}, | ||
284 | { "movhu", 0xfcac0000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), DN0}}, | ||
285 | { "movhu", 0xfcbc0000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), DN0}}, | ||
249 | { "movhu", 0xfd4a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, | 286 | { "movhu", 0xfd4a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, |
250 | { "movhu", 0xfd5a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, | 287 | { "movhu", 0xfd5a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, |
288 | { "movhu", 0xfdca0000, 0xffff0f00, 0, FMT_D8, AM33, {MEM2(IMM24, SP), RN2}}, | ||
289 | { "movhu", 0xfdda0000, 0xffff0f00, 0, FMT_D8, AM33, {RM2, MEM2(IMM24, SP)}}, | ||
251 | { "movhu", 0xfdea0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, | 290 | { "movhu", 0xfdea0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, |
252 | { "movhu", 0xfdfa0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, | 291 | { "movhu", 0xfdfa0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, |
253 | { "movhu", 0xfe4a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, | 292 | { "movhu", 0xfe4a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, |
293 | { "movhu", 0xfe4e0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM(IMM32_HIGH8_MEM), RN2}}, | ||
254 | { "movhu", 0xfe5a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, | 294 | { "movhu", 0xfe5a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, |
295 | { "movhu", 0xfe5e0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM(IMM32_HIGH8_MEM)}}, | ||
296 | { "movhu", 0xfeca0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8, SP), RN2}}, | ||
297 | { "movhu", 0xfeda0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, SP)}}, | ||
255 | { "movhu", 0xfeea0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, | 298 | { "movhu", 0xfeea0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, |
256 | { "movhu", 0xfefa0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, | 299 | { "movhu", 0xfefa0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, |
257 | { 0, 0, 0, 0, 0, 0, {0}}, | 300 | |
301 | { "mov_llt", 0xf7e00000, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
302 | { "mov_lgt", 0xf7e00001, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
303 | { "mov_lge", 0xf7e00002, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
304 | { "mov_lle", 0xf7e00003, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
305 | { "mov_lcs", 0xf7e00004, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
306 | { "mov_lhi", 0xf7e00005, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
307 | { "mov_lcc", 0xf7e00006, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
308 | { "mov_lls", 0xf7e00007, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
309 | { "mov_leq", 0xf7e00008, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
310 | { "mov_lne", 0xf7e00009, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
311 | { "mov_lra", 0xf7e0000a, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, | ||
312 | |||
313 | { "", 0, 0, 0, 0, 0, {0}}, | ||
258 | }; | 314 | }; |
259 | 315 | ||
260 | /* | 316 | /* |
@@ -265,18 +321,21 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) | |||
265 | const struct exception_table_entry *fixup; | 321 | const struct exception_table_entry *fixup; |
266 | const struct mn10300_opcode *pop; | 322 | const struct mn10300_opcode *pop; |
267 | unsigned long *registers = (unsigned long *) regs; | 323 | unsigned long *registers = (unsigned long *) regs; |
268 | unsigned long data, *store, *postinc; | 324 | unsigned long data, *store, *postinc, disp, inc, sp; |
269 | mm_segment_t seg; | 325 | mm_segment_t seg; |
270 | siginfo_t info; | 326 | siginfo_t info; |
271 | uint32_t opcode, disp, noc, xo, xm; | 327 | uint32_t opcode, noc, xo, xm; |
272 | uint8_t *pc, byte; | 328 | uint8_t *pc, byte, datasz; |
273 | void *address; | 329 | void *address; |
274 | unsigned tmp, npop; | 330 | unsigned tmp, npop, dispsz, loop; |
331 | |||
332 | /* we don't fix up userspace misalignment faults */ | ||
333 | if (user_mode(regs)) | ||
334 | goto bus_error; | ||
275 | 335 | ||
276 | kdebug("MISALIGN at %lx\n", regs->pc); | 336 | sp = (unsigned long) regs + sizeof(*regs); |
277 | 337 | ||
278 | if (in_interrupt()) | 338 | kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp); |
279 | die("Misalignment trap in interrupt context", regs, code); | ||
280 | 339 | ||
281 | if (regs->epsw & EPSW_IE) | 340 | if (regs->epsw & EPSW_IE) |
282 | asm volatile("or %0,epsw" : : "i"(EPSW_IE)); | 341 | asm volatile("or %0,epsw" : : "i"(EPSW_IE)); |
@@ -294,8 +353,8 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) | |||
294 | opcode = byte; | 353 | opcode = byte; |
295 | noc = 8; | 354 | noc = 8; |
296 | 355 | ||
297 | for (pop = mn10300_opcodes; pop->name; pop++) { | 356 | for (pop = mn10300_opcodes; pop->name[0]; pop++) { |
298 | npop = log2(pop->opcode | pop->opmask); | 357 | npop = ilog2(pop->opcode | pop->opmask); |
299 | if (npop <= 0 || npop > 31) | 358 | if (npop <= 0 || npop > 31) |
300 | continue; | 359 | continue; |
301 | npop = (npop + 8) & ~7; | 360 | npop = (npop + 8) & ~7; |
@@ -328,15 +387,15 @@ asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) | |||
328 | } | 387 | } |
329 | 388 | ||
330 | /* didn't manage to find a fixup */ | 389 | /* didn't manage to find a fixup */ |
331 | if (!user_mode(regs)) | 390 | printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", |
332 | printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", | 391 | regs->pc, opcode); |
333 | regs->pc, opcode); | ||
334 | 392 | ||
335 | failed: | 393 | failed: |
336 | set_fs(seg); | 394 | set_fs(seg); |
337 | if (die_if_no_fixup("misalignment error", regs, code)) | 395 | if (die_if_no_fixup("misalignment error", regs, code)) |
338 | return; | 396 | return; |
339 | 397 | ||
398 | bus_error: | ||
340 | info.si_signo = SIGBUS; | 399 | info.si_signo = SIGBUS; |
341 | info.si_errno = 0; | 400 | info.si_errno = 0; |
342 | info.si_code = BUS_ADRALN; | 401 | info.si_code = BUS_ADRALN; |
@@ -346,31 +405,27 @@ failed: | |||
346 | 405 | ||
347 | /* error reading opcodes */ | 406 | /* error reading opcodes */ |
348 | fetch_error: | 407 | fetch_error: |
349 | if (!user_mode(regs)) | 408 | printk(KERN_CRIT |
350 | printk(KERN_CRIT | 409 | "MISALIGN: %p: fault whilst reading instruction data\n", |
351 | "MISALIGN: %p: fault whilst reading instruction data\n", | 410 | pc); |
352 | pc); | ||
353 | goto failed; | 411 | goto failed; |
354 | 412 | ||
355 | bad_addr_mode: | 413 | bad_addr_mode: |
356 | if (!user_mode(regs)) | 414 | printk(KERN_CRIT |
357 | printk(KERN_CRIT | 415 | "MISALIGN: %lx: unsupported addressing mode %x\n", |
358 | "MISALIGN: %lx: unsupported addressing mode %x\n", | 416 | regs->pc, opcode); |
359 | regs->pc, opcode); | ||
360 | goto failed; | 417 | goto failed; |
361 | 418 | ||
362 | bad_reg_mode: | 419 | bad_reg_mode: |
363 | if (!user_mode(regs)) | 420 | printk(KERN_CRIT |
364 | printk(KERN_CRIT | 421 | "MISALIGN: %lx: unsupported register mode %x\n", |
365 | "MISALIGN: %lx: unsupported register mode %x\n", | 422 | regs->pc, opcode); |
366 | regs->pc, opcode); | ||
367 | goto failed; | 423 | goto failed; |
368 | 424 | ||
369 | unsupported_instruction: | 425 | unsupported_instruction: |
370 | if (!user_mode(regs)) | 426 | printk(KERN_CRIT |
371 | printk(KERN_CRIT | 427 | "MISALIGN: %lx: unsupported instruction %x (%s)\n", |
372 | "MISALIGN: %lx: unsupported instruction %x (%s)\n", | 428 | regs->pc, opcode, pop->name); |
373 | regs->pc, opcode, pop->name); | ||
374 | goto failed; | 429 | goto failed; |
375 | 430 | ||
376 | transfer_failed: | 431 | transfer_failed: |
@@ -391,7 +446,7 @@ transfer_failed: | |||
391 | 446 | ||
392 | /* we matched the opcode */ | 447 | /* we matched the opcode */ |
393 | found_opcode: | 448 | found_opcode: |
394 | kdebug("MISALIGN: %lx: %x==%x { %x, %x }\n", | 449 | kdebug("%lx: %x==%x { %x, %x }", |
395 | regs->pc, opcode, pop->opcode, pop->params[0], pop->params[1]); | 450 | regs->pc, opcode, pop->opcode, pop->params[0], pop->params[1]); |
396 | 451 | ||
397 | tmp = format_tbl[pop->format].opsz; | 452 | tmp = format_tbl[pop->format].opsz; |
@@ -406,106 +461,108 @@ found_opcode: | |||
406 | 461 | ||
407 | /* grab the extra displacement (note it's LSB first) */ | 462 | /* grab the extra displacement (note it's LSB first) */ |
408 | disp = 0; | 463 | disp = 0; |
409 | tmp = format_tbl[pop->format].dispsz >> 3; | 464 | dispsz = format_tbl[pop->format].dispsz; |
410 | while (tmp > 0) { | 465 | for (loop = 0; loop < dispsz; loop += 8) { |
411 | tmp--; | ||
412 | disp <<= 8; | ||
413 | |||
414 | pc++; | 466 | pc++; |
415 | if (__get_user(byte, pc) != 0) | 467 | if (__get_user(byte, pc) != 0) |
416 | goto fetch_error; | 468 | goto fetch_error; |
417 | disp |= byte; | 469 | disp |= byte << loop; |
470 | kdebug("{%p} disp[%02x]=%02x", pc, loop, byte); | ||
418 | } | 471 | } |
419 | 472 | ||
473 | kdebug("disp=%lx", disp); | ||
474 | |||
420 | set_fs(KERNEL_XDS); | 475 | set_fs(KERNEL_XDS); |
421 | if (fixup || regs->epsw & EPSW_nSL) | 476 | if (fixup) |
422 | set_fs(seg); | 477 | set_fs(seg); |
423 | 478 | ||
424 | tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; | 479 | tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; |
425 | if (!tmp) { | 480 | if (!tmp) { |
426 | if (!user_mode(regs)) | 481 | printk(KERN_CRIT |
427 | printk(KERN_CRIT | 482 | "MISALIGN: %lx: insn not move to/from memory %x\n", |
428 | "MISALIGN: %lx:" | 483 | regs->pc, opcode); |
429 | " insn not move to/from memory %x\n", | ||
430 | regs->pc, opcode); | ||
431 | goto failed; | 484 | goto failed; |
432 | } | 485 | } |
433 | 486 | ||
487 | /* determine the data transfer size of the move */ | ||
488 | if (pop->name[3] == 0 || /* "mov" */ | ||
489 | pop->name[4] == 'l') /* mov_lcc */ | ||
490 | inc = datasz = 4; | ||
491 | else if (pop->name[3] == 'h') /* movhu */ | ||
492 | inc = datasz = 2; | ||
493 | else | ||
494 | goto unsupported_instruction; | ||
495 | |||
434 | if (pop->params[0] & 0x80000000) { | 496 | if (pop->params[0] & 0x80000000) { |
435 | /* move memory to register */ | 497 | /* move memory to register */ |
436 | if (!misalignment_addr(registers, pop->params[0], opcode, disp, | 498 | if (!misalignment_addr(registers, sp, |
437 | &address, &postinc)) | 499 | pop->params[0], opcode, disp, |
500 | &address, &postinc, &inc)) | ||
438 | goto bad_addr_mode; | 501 | goto bad_addr_mode; |
439 | 502 | ||
440 | if (!misalignment_reg(registers, pop->params[1], opcode, disp, | 503 | if (!misalignment_reg(registers, pop->params[1], opcode, disp, |
441 | &store)) | 504 | &store)) |
442 | goto bad_reg_mode; | 505 | goto bad_reg_mode; |
443 | 506 | ||
444 | if (strcmp(pop->name, "mov") == 0) { | 507 | kdebug("mov%u (%p),DARn", datasz, address); |
445 | kdebug("FIXUP: mov (%p),DARn\n", address); | 508 | if (copy_from_user(&data, (void *) address, datasz) != 0) |
446 | if (copy_from_user(&data, (void *) address, 4) != 0) | 509 | goto transfer_failed; |
447 | goto transfer_failed; | 510 | if (pop->params[0] & 0x1000000) { |
448 | if (pop->params[0] & 0x1000000) | 511 | kdebug("inc=%lx", inc); |
449 | *postinc += 4; | 512 | *postinc += inc; |
450 | } else if (strcmp(pop->name, "movhu") == 0) { | ||
451 | kdebug("FIXUP: movhu (%p),DARn\n", address); | ||
452 | data = 0; | ||
453 | if (copy_from_user(&data, (void *) address, 2) != 0) | ||
454 | goto transfer_failed; | ||
455 | if (pop->params[0] & 0x1000000) | ||
456 | *postinc += 2; | ||
457 | } else { | ||
458 | goto unsupported_instruction; | ||
459 | } | 513 | } |
460 | 514 | ||
461 | *store = data; | 515 | *store = data; |
516 | kdebug("loaded %lx", data); | ||
462 | } else { | 517 | } else { |
463 | /* move register to memory */ | 518 | /* move register to memory */ |
464 | if (!misalignment_reg(registers, pop->params[0], opcode, disp, | 519 | if (!misalignment_reg(registers, pop->params[0], opcode, disp, |
465 | &store)) | 520 | &store)) |
466 | goto bad_reg_mode; | 521 | goto bad_reg_mode; |
467 | 522 | ||
468 | if (!misalignment_addr(registers, pop->params[1], opcode, disp, | 523 | if (!misalignment_addr(registers, sp, |
469 | &address, &postinc)) | 524 | pop->params[1], opcode, disp, |
525 | &address, &postinc, &inc)) | ||
470 | goto bad_addr_mode; | 526 | goto bad_addr_mode; |
471 | 527 | ||
472 | data = *store; | 528 | data = *store; |
473 | 529 | ||
474 | if (strcmp(pop->name, "mov") == 0) { | 530 | kdebug("mov%u %lx,(%p)", datasz, data, address); |
475 | kdebug("FIXUP: mov %lx,(%p)\n", data, address); | 531 | if (copy_to_user((void *) address, &data, datasz) != 0) |
476 | if (copy_to_user((void *) address, &data, 4) != 0) | 532 | goto transfer_failed; |
477 | goto transfer_failed; | 533 | if (pop->params[1] & 0x1000000) |
478 | if (pop->params[1] & 0x1000000) | 534 | *postinc += inc; |
479 | *postinc += 4; | ||
480 | } else if (strcmp(pop->name, "movhu") == 0) { | ||
481 | kdebug("FIXUP: movhu %hx,(%p)\n", | ||
482 | (uint16_t) data, address); | ||
483 | if (copy_to_user((void *) address, &data, 2) != 0) | ||
484 | goto transfer_failed; | ||
485 | if (pop->params[1] & 0x1000000) | ||
486 | *postinc += 2; | ||
487 | } else { | ||
488 | goto unsupported_instruction; | ||
489 | } | ||
490 | } | 535 | } |
491 | 536 | ||
492 | tmp = format_tbl[pop->format].opsz + format_tbl[pop->format].dispsz; | 537 | tmp = format_tbl[pop->format].opsz + format_tbl[pop->format].dispsz; |
493 | regs->pc += tmp >> 3; | 538 | regs->pc += tmp >> 3; |
494 | 539 | ||
540 | /* handle MOV_Lcc, which are currently the only FMT_D10 insns that | ||
541 | * access memory */ | ||
542 | if (pop->format == FMT_D10) | ||
543 | misalignment_MOV_Lcc(regs, opcode); | ||
544 | |||
495 | set_fs(seg); | 545 | set_fs(seg); |
496 | return; | ||
497 | } | 546 | } |
498 | 547 | ||
499 | /* | 548 | /* |
500 | * determine the address that was being accessed | 549 | * determine the address that was being accessed |
501 | */ | 550 | */ |
502 | static int misalignment_addr(unsigned long *registers, unsigned params, | 551 | static int misalignment_addr(unsigned long *registers, unsigned long sp, |
503 | unsigned opcode, unsigned disp, | 552 | unsigned params, unsigned opcode, |
504 | void **_address, unsigned long **_postinc) | 553 | unsigned long disp, |
554 | void **_address, unsigned long **_postinc, | ||
555 | unsigned long *_inc) | ||
505 | { | 556 | { |
506 | unsigned long *postinc = NULL, address = 0, tmp; | 557 | unsigned long *postinc = NULL, address = 0, tmp; |
507 | 558 | ||
508 | params &= 0x7fffffff; | 559 | if (!(params & 0x1000000)) { |
560 | kdebug("noinc"); | ||
561 | *_inc = 0; | ||
562 | _inc = NULL; | ||
563 | } | ||
564 | |||
565 | params &= 0x00ffffff; | ||
509 | 566 | ||
510 | do { | 567 | do { |
511 | switch (params & 0xff) { | 568 | switch (params & 0xff) { |
@@ -514,11 +571,11 @@ static int misalignment_addr(unsigned long *registers, unsigned params, | |||
514 | address += *postinc; | 571 | address += *postinc; |
515 | break; | 572 | break; |
516 | case DM1: | 573 | case DM1: |
517 | postinc = ®isters[Dreg_index[opcode >> 2 & 0x0c]]; | 574 | postinc = ®isters[Dreg_index[opcode >> 2 & 0x03]]; |
518 | address += *postinc; | 575 | address += *postinc; |
519 | break; | 576 | break; |
520 | case DM2: | 577 | case DM2: |
521 | postinc = ®isters[Dreg_index[opcode >> 4 & 0x30]]; | 578 | postinc = ®isters[Dreg_index[opcode >> 4 & 0x03]]; |
522 | address += *postinc; | 579 | address += *postinc; |
523 | break; | 580 | break; |
524 | case AM0: | 581 | case AM0: |
@@ -526,11 +583,11 @@ static int misalignment_addr(unsigned long *registers, unsigned params, | |||
526 | address += *postinc; | 583 | address += *postinc; |
527 | break; | 584 | break; |
528 | case AM1: | 585 | case AM1: |
529 | postinc = ®isters[Areg_index[opcode >> 2 & 0x0c]]; | 586 | postinc = ®isters[Areg_index[opcode >> 2 & 0x03]]; |
530 | address += *postinc; | 587 | address += *postinc; |
531 | break; | 588 | break; |
532 | case AM2: | 589 | case AM2: |
533 | postinc = ®isters[Areg_index[opcode >> 4 & 0x30]]; | 590 | postinc = ®isters[Areg_index[opcode >> 4 & 0x03]]; |
534 | address += *postinc; | 591 | address += *postinc; |
535 | break; | 592 | break; |
536 | case RM0: | 593 | case RM0: |
@@ -561,33 +618,53 @@ static int misalignment_addr(unsigned long *registers, unsigned params, | |||
561 | postinc = ®isters[Rreg_index[disp >> 4 & 0x0f]]; | 618 | postinc = ®isters[Rreg_index[disp >> 4 & 0x0f]]; |
562 | address += *postinc; | 619 | address += *postinc; |
563 | break; | 620 | break; |
621 | case SP: | ||
622 | address += sp; | ||
623 | break; | ||
564 | 624 | ||
625 | /* displacements are either to be added to the address | ||
626 | * before use, or, in the case of post-inc addressing, | ||
627 | * to be added into the base register after use */ | ||
565 | case SD8: | 628 | case SD8: |
566 | case SIMM8: | 629 | case SIMM8: |
567 | address += (int32_t) (int8_t) (disp & 0xff); | 630 | disp = (long) (int8_t) (disp & 0xff); |
568 | break; | 631 | goto displace_or_inc; |
569 | case SD16: | 632 | case SD16: |
570 | address += (int32_t) (int16_t) (disp & 0xffff); | 633 | disp = (long) (int16_t) (disp & 0xffff); |
571 | break; | 634 | goto displace_or_inc; |
572 | case SD24: | 635 | case SD24: |
573 | tmp = disp << 8; | 636 | tmp = disp << 8; |
574 | asm("asr 8,%0" : "=r"(tmp) : "0"(tmp)); | 637 | asm("asr 8,%0" : "=r"(tmp) : "0"(tmp)); |
575 | address += tmp; | 638 | disp = (long) tmp; |
576 | break; | 639 | goto displace_or_inc; |
577 | case SIMM4_2: | 640 | case SIMM4_2: |
578 | tmp = opcode >> 4 & 0x0f; | 641 | tmp = opcode >> 4 & 0x0f; |
579 | tmp <<= 28; | 642 | tmp <<= 28; |
580 | asm("asr 28,%0" : "=r"(tmp) : "0"(tmp)); | 643 | asm("asr 28,%0" : "=r"(tmp) : "0"(tmp)); |
581 | address += tmp; | 644 | disp = (long) tmp; |
582 | break; | 645 | goto displace_or_inc; |
646 | case IMM8: | ||
647 | disp &= 0x000000ff; | ||
648 | goto displace_or_inc; | ||
649 | case IMM16: | ||
650 | disp &= 0x0000ffff; | ||
651 | goto displace_or_inc; | ||
583 | case IMM24: | 652 | case IMM24: |
584 | address += disp & 0x00ffffff; | 653 | disp &= 0x00ffffff; |
585 | break; | 654 | goto displace_or_inc; |
586 | case IMM32: | 655 | case IMM32: |
656 | case IMM32_MEM: | ||
587 | case IMM32_HIGH8: | 657 | case IMM32_HIGH8: |
588 | address += disp; | 658 | case IMM32_HIGH8_MEM: |
659 | displace_or_inc: | ||
660 | kdebug("%s %lx", _inc ? "incr" : "disp", disp); | ||
661 | if (!_inc) | ||
662 | address += disp; | ||
663 | else | ||
664 | *_inc = disp; | ||
589 | break; | 665 | break; |
590 | default: | 666 | default: |
667 | BUG(); | ||
591 | return 0; | 668 | return 0; |
592 | } | 669 | } |
593 | } while ((params >>= 8)); | 670 | } while ((params >>= 8)); |
@@ -601,7 +678,7 @@ static int misalignment_addr(unsigned long *registers, unsigned params, | |||
601 | * determine the register that is acting as source/dest | 678 | * determine the register that is acting as source/dest |
602 | */ | 679 | */ |
603 | static int misalignment_reg(unsigned long *registers, unsigned params, | 680 | static int misalignment_reg(unsigned long *registers, unsigned params, |
604 | unsigned opcode, unsigned disp, | 681 | unsigned opcode, unsigned long disp, |
605 | unsigned long **_register) | 682 | unsigned long **_register) |
606 | { | 683 | { |
607 | params &= 0x7fffffff; | 684 | params &= 0x7fffffff; |
@@ -654,8 +731,239 @@ static int misalignment_reg(unsigned long *registers, unsigned params, | |||
654 | break; | 731 | break; |
655 | 732 | ||
656 | default: | 733 | default: |
734 | BUG(); | ||
657 | return 0; | 735 | return 0; |
658 | } | 736 | } |
659 | 737 | ||
660 | return 1; | 738 | return 1; |
661 | } | 739 | } |
740 | |||
741 | /* | ||
742 | * handle the conditional loop part of the move-and-loop instructions | ||
743 | */ | ||
744 | static void misalignment_MOV_Lcc(struct pt_regs *regs, uint32_t opcode) | ||
745 | { | ||
746 | unsigned long epsw = regs->epsw; | ||
747 | unsigned long NxorV; | ||
748 | |||
749 | kdebug("MOV_Lcc %x [flags=%lx]", opcode, epsw & 0xf); | ||
750 | |||
751 | /* calculate N^V and shift onto the same bit position as Z */ | ||
752 | NxorV = ((epsw >> 3) ^ epsw >> 1) & 1; | ||
753 | |||
754 | switch (opcode & 0xf) { | ||
755 | case 0x0: /* MOV_LLT: N^V */ | ||
756 | if (NxorV) | ||
757 | goto take_the_loop; | ||
758 | return; | ||
759 | case 0x1: /* MOV_LGT: ~(Z or (N^V))*/ | ||
760 | if (!((epsw & EPSW_FLAG_Z) | NxorV)) | ||
761 | goto take_the_loop; | ||
762 | return; | ||
763 | case 0x2: /* MOV_LGE: ~(N^V) */ | ||
764 | if (!NxorV) | ||
765 | goto take_the_loop; | ||
766 | return; | ||
767 | case 0x3: /* MOV_LLE: Z or (N^V) */ | ||
768 | if ((epsw & EPSW_FLAG_Z) | NxorV) | ||
769 | goto take_the_loop; | ||
770 | return; | ||
771 | |||
772 | case 0x4: /* MOV_LCS: C */ | ||
773 | if (epsw & EPSW_FLAG_C) | ||
774 | goto take_the_loop; | ||
775 | return; | ||
776 | case 0x5: /* MOV_LHI: ~(C or Z) */ | ||
777 | if (!(epsw & (EPSW_FLAG_C | EPSW_FLAG_Z))) | ||
778 | goto take_the_loop; | ||
779 | return; | ||
780 | case 0x6: /* MOV_LCC: ~C */ | ||
781 | if (!(epsw & EPSW_FLAG_C)) | ||
782 | goto take_the_loop; | ||
783 | return; | ||
784 | case 0x7: /* MOV_LLS: C or Z */ | ||
785 | if (epsw & (EPSW_FLAG_C | EPSW_FLAG_Z)) | ||
786 | goto take_the_loop; | ||
787 | return; | ||
788 | |||
789 | case 0x8: /* MOV_LEQ: Z */ | ||
790 | if (epsw & EPSW_FLAG_Z) | ||
791 | goto take_the_loop; | ||
792 | return; | ||
793 | case 0x9: /* MOV_LNE: ~Z */ | ||
794 | if (!(epsw & EPSW_FLAG_Z)) | ||
795 | goto take_the_loop; | ||
796 | return; | ||
797 | case 0xa: /* MOV_LRA: always */ | ||
798 | goto take_the_loop; | ||
799 | |||
800 | default: | ||
801 | BUG(); | ||
802 | } | ||
803 | |||
804 | take_the_loop: | ||
805 | /* wind the PC back to just after the SETLB insn */ | ||
806 | kdebug("loop LAR=%lx", regs->lar); | ||
807 | regs->pc = regs->lar - 4; | ||
808 | } | ||
809 | |||
810 | /* | ||
811 | * misalignment handler tests | ||
812 | */ | ||
813 | #ifdef CONFIG_TEST_MISALIGNMENT_HANDLER | ||
814 | static u8 __initdata testbuf[512] __attribute__((aligned(16))) = { | ||
815 | [257] = 0x11, | ||
816 | [258] = 0x22, | ||
817 | [259] = 0x33, | ||
818 | [260] = 0x44, | ||
819 | }; | ||
820 | |||
821 | #define ASSERTCMP(X, OP, Y) \ | ||
822 | do { \ | ||
823 | if (unlikely(!((X) OP (Y)))) { \ | ||
824 | printk(KERN_ERR "\n"); \ | ||
825 | printk(KERN_ERR "MISALIGN: Assertion failed at line %u\n", \ | ||
826 | __LINE__); \ | ||
827 | printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \ | ||
828 | (unsigned long)(X), (unsigned long)(Y)); \ | ||
829 | BUG(); \ | ||
830 | } \ | ||
831 | } while(0) | ||
832 | |||
833 | static int __init test_misalignment(void) | ||
834 | { | ||
835 | register void *r asm("e0"); | ||
836 | register u32 y asm("e1"); | ||
837 | void *p = testbuf, *q; | ||
838 | u32 tmp, tmp2, x; | ||
839 | |||
840 | printk(KERN_NOTICE "==>test_misalignment() [testbuf=%p]\n", p); | ||
841 | p++; | ||
842 | |||
843 | printk(KERN_NOTICE "___ MOV (Am),Dn ___\n"); | ||
844 | q = p + 256; | ||
845 | asm volatile("mov (%0),%1" : "+a"(q), "=d"(x)); | ||
846 | ASSERTCMP(q, ==, p + 256); | ||
847 | ASSERTCMP(x, ==, 0x44332211); | ||
848 | |||
849 | printk(KERN_NOTICE "___ MOV (256,Am),Dn ___\n"); | ||
850 | q = p; | ||
851 | asm volatile("mov (256,%0),%1" : "+a"(q), "=d"(x)); | ||
852 | ASSERTCMP(q, ==, p); | ||
853 | ASSERTCMP(x, ==, 0x44332211); | ||
854 | |||
855 | printk(KERN_NOTICE "___ MOV (Di,Am),Dn ___\n"); | ||
856 | tmp = 256; | ||
857 | q = p; | ||
858 | asm volatile("mov (%2,%0),%1" : "+a"(q), "=d"(x), "+d"(tmp)); | ||
859 | ASSERTCMP(q, ==, p); | ||
860 | ASSERTCMP(x, ==, 0x44332211); | ||
861 | ASSERTCMP(tmp, ==, 256); | ||
862 | |||
863 | printk(KERN_NOTICE "___ MOV (256,Rm),Rn ___\n"); | ||
864 | r = p; | ||
865 | asm volatile("mov (256,%0),%1" : "+r"(r), "=r"(y)); | ||
866 | ASSERTCMP(r, ==, p); | ||
867 | ASSERTCMP(y, ==, 0x44332211); | ||
868 | |||
869 | printk(KERN_NOTICE "___ MOV (Rm+),Rn ___\n"); | ||
870 | r = p + 256; | ||
871 | asm volatile("mov (%0+),%1" : "+r"(r), "=r"(y)); | ||
872 | ASSERTCMP(r, ==, p + 256 + 4); | ||
873 | ASSERTCMP(y, ==, 0x44332211); | ||
874 | |||
875 | printk(KERN_NOTICE "___ MOV (Rm+,8),Rn ___\n"); | ||
876 | r = p + 256; | ||
877 | asm volatile("mov (%0+,8),%1" : "+r"(r), "=r"(y)); | ||
878 | ASSERTCMP(r, ==, p + 256 + 8); | ||
879 | ASSERTCMP(y, ==, 0x44332211); | ||
880 | |||
881 | printk(KERN_NOTICE "___ MOV (7,SP),Rn ___\n"); | ||
882 | asm volatile( | ||
883 | "add -16,sp \n" | ||
884 | "mov +0x11,%0 \n" | ||
885 | "movbu %0,(7,sp) \n" | ||
886 | "mov +0x22,%0 \n" | ||
887 | "movbu %0,(8,sp) \n" | ||
888 | "mov +0x33,%0 \n" | ||
889 | "movbu %0,(9,sp) \n" | ||
890 | "mov +0x44,%0 \n" | ||
891 | "movbu %0,(10,sp) \n" | ||
892 | "mov (7,sp),%1 \n" | ||
893 | "add +16,sp \n" | ||
894 | : "+a"(q), "=d"(x)); | ||
895 | ASSERTCMP(x, ==, 0x44332211); | ||
896 | |||
897 | printk(KERN_NOTICE "___ MOV (259,SP),Rn ___\n"); | ||
898 | asm volatile( | ||
899 | "add -264,sp \n" | ||
900 | "mov +0x11,%0 \n" | ||
901 | "movbu %0,(259,sp) \n" | ||
902 | "mov +0x22,%0 \n" | ||
903 | "movbu %0,(260,sp) \n" | ||
904 | "mov +0x33,%0 \n" | ||
905 | "movbu %0,(261,sp) \n" | ||
906 | "mov +0x55,%0 \n" | ||
907 | "movbu %0,(262,sp) \n" | ||
908 | "mov (259,sp),%1 \n" | ||
909 | "add +264,sp \n" | ||
910 | : "+d"(tmp), "=d"(x)); | ||
911 | ASSERTCMP(x, ==, 0x55332211); | ||
912 | |||
913 | printk(KERN_NOTICE "___ MOV (260,SP),Rn ___\n"); | ||
914 | asm volatile( | ||
915 | "add -264,sp \n" | ||
916 | "mov +0x11,%0 \n" | ||
917 | "movbu %0,(260,sp) \n" | ||
918 | "mov +0x22,%0 \n" | ||
919 | "movbu %0,(261,sp) \n" | ||
920 | "mov +0x33,%0 \n" | ||
921 | "movbu %0,(262,sp) \n" | ||
922 | "mov +0x55,%0 \n" | ||
923 | "movbu %0,(263,sp) \n" | ||
924 | "mov (260,sp),%1 \n" | ||
925 | "add +264,sp \n" | ||
926 | : "+d"(tmp), "=d"(x)); | ||
927 | ASSERTCMP(x, ==, 0x55332211); | ||
928 | |||
929 | |||
930 | printk(KERN_NOTICE "___ MOV_LNE ___\n"); | ||
931 | tmp = 1; | ||
932 | tmp2 = 2; | ||
933 | q = p + 256; | ||
934 | asm volatile( | ||
935 | "setlb \n" | ||
936 | "mov %2,%3 \n" | ||
937 | "mov %1,%2 \n" | ||
938 | "cmp +0,%1 \n" | ||
939 | "mov_lne (%0+,4),%1" | ||
940 | : "+r"(q), "+d"(tmp), "+d"(tmp2), "=d"(x) | ||
941 | : | ||
942 | : "cc"); | ||
943 | ASSERTCMP(q, ==, p + 256 + 12); | ||
944 | ASSERTCMP(x, ==, 0x44332211); | ||
945 | |||
946 | printk(KERN_NOTICE "___ MOV in SETLB ___\n"); | ||
947 | tmp = 1; | ||
948 | tmp2 = 2; | ||
949 | q = p + 256; | ||
950 | asm volatile( | ||
951 | "setlb \n" | ||
952 | "mov %1,%3 \n" | ||
953 | "mov (%0+),%1 \n" | ||
954 | "cmp +0,%1 \n" | ||
955 | "lne " | ||
956 | : "+a"(q), "+d"(tmp), "+d"(tmp2), "=d"(x) | ||
957 | : | ||
958 | : "cc"); | ||
959 | |||
960 | ASSERTCMP(q, ==, p + 256 + 8); | ||
961 | ASSERTCMP(x, ==, 0x44332211); | ||
962 | |||
963 | printk(KERN_NOTICE "<==test_misalignment()\n"); | ||
964 | return 0; | ||
965 | } | ||
966 | |||
967 | arch_initcall(test_misalignment); | ||
968 | |||
969 | #endif /* CONFIG_TEST_MISALIGNMENT_HANDLER */ | ||
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 8d676d8ecde9..9830681446ad 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -113,7 +113,6 @@ static inline void acpi_disable_pci(void) | |||
113 | acpi_pci_disabled = 1; | 113 | acpi_pci_disabled = 1; |
114 | acpi_noirq_set(); | 114 | acpi_noirq_set(); |
115 | } | 115 | } |
116 | extern int acpi_irq_balance_set(char *str); | ||
117 | 116 | ||
118 | /* routines for saving/restoring kernel state */ | 117 | /* routines for saving/restoring kernel state */ |
119 | extern int acpi_save_state_mem(void); | 118 | extern int acpi_save_state_mem(void); |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8c1f76abae9e..4c51a2f8fd31 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -1343,7 +1343,6 @@ static void __init acpi_process_madt(void) | |||
1343 | error = acpi_parse_madt_ioapic_entries(); | 1343 | error = acpi_parse_madt_ioapic_entries(); |
1344 | if (!error) { | 1344 | if (!error) { |
1345 | acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; | 1345 | acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; |
1346 | acpi_irq_balance_set(NULL); | ||
1347 | acpi_ioapic = 1; | 1346 | acpi_ioapic = 1; |
1348 | 1347 | ||
1349 | smp_found_config = 1; | 1348 | smp_found_config = 1; |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 774ac4991568..1c9cc431ea4f 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -128,7 +128,7 @@ static int kvm_register_clock(char *txt) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | #ifdef CONFIG_X86_LOCAL_APIC | 130 | #ifdef CONFIG_X86_LOCAL_APIC |
131 | static void kvm_setup_secondary_clock(void) | 131 | static void __devinit kvm_setup_secondary_clock(void) |
132 | { | 132 | { |
133 | /* | 133 | /* |
134 | * Now that the first cpu already had this clocksource initialized, | 134 | * Now that the first cpu already had this clocksource initialized, |
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index ce3251ce5504..b81125f0bdee 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig | |||
@@ -20,6 +20,8 @@ if VIRTUALIZATION | |||
20 | config KVM | 20 | config KVM |
21 | tristate "Kernel-based Virtual Machine (KVM) support" | 21 | tristate "Kernel-based Virtual Machine (KVM) support" |
22 | depends on HAVE_KVM | 22 | depends on HAVE_KVM |
23 | # for device assignment: | ||
24 | depends on PCI | ||
23 | select PREEMPT_NOTIFIERS | 25 | select PREEMPT_NOTIFIERS |
24 | select MMU_NOTIFIER | 26 | select MMU_NOTIFIER |
25 | select ANON_INODES | 27 | select ANON_INODES |
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 8772dc946823..59ebd37ad79e 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -548,8 +548,10 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm) | |||
548 | mutex_lock(&kvm->lock); | 548 | mutex_lock(&kvm->lock); |
549 | pit->irq_source_id = kvm_request_irq_source_id(kvm); | 549 | pit->irq_source_id = kvm_request_irq_source_id(kvm); |
550 | mutex_unlock(&kvm->lock); | 550 | mutex_unlock(&kvm->lock); |
551 | if (pit->irq_source_id < 0) | 551 | if (pit->irq_source_id < 0) { |
552 | kfree(pit); | ||
552 | return NULL; | 553 | return NULL; |
554 | } | ||
553 | 555 | ||
554 | mutex_init(&pit->pit_state.lock); | 556 | mutex_init(&pit->pit_state.lock); |
555 | mutex_lock(&pit->pit_state.lock); | 557 | mutex_lock(&pit->pit_state.lock); |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2a5e64881d9b..f1983d9477cd 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -314,7 +314,7 @@ static int mmu_topup_memory_caches(struct kvm_vcpu *vcpu) | |||
314 | if (r) | 314 | if (r) |
315 | goto out; | 315 | goto out; |
316 | r = mmu_topup_memory_cache(&vcpu->arch.mmu_rmap_desc_cache, | 316 | r = mmu_topup_memory_cache(&vcpu->arch.mmu_rmap_desc_cache, |
317 | rmap_desc_cache, 1); | 317 | rmap_desc_cache, 4); |
318 | if (r) | 318 | if (r) |
319 | goto out; | 319 | goto out; |
320 | r = mmu_topup_memory_cache_page(&vcpu->arch.mmu_page_cache, 8); | 320 | r = mmu_topup_memory_cache_page(&vcpu->arch.mmu_page_cache, 8); |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 2643b430d83a..d06b4dc0e2ea 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3564,7 +3564,8 @@ static int __init vmx_init(void) | |||
3564 | bypass_guest_pf = 0; | 3564 | bypass_guest_pf = 0; |
3565 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | 3565 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | |
3566 | VMX_EPT_WRITABLE_MASK | | 3566 | VMX_EPT_WRITABLE_MASK | |
3567 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | 3567 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT | |
3568 | VMX_EPT_IGMT_BIT); | ||
3568 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, | 3569 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, |
3569 | VMX_EPT_EXECUTABLE_MASK); | 3570 | VMX_EPT_EXECUTABLE_MASK); |
3570 | kvm_enable_tdp(); | 3571 | kvm_enable_tdp(); |
diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h index 3e010d21fdd7..ec5edc339da6 100644 --- a/arch/x86/kvm/vmx.h +++ b/arch/x86/kvm/vmx.h | |||
@@ -352,6 +352,7 @@ enum vmcs_field { | |||
352 | #define VMX_EPT_READABLE_MASK 0x1ull | 352 | #define VMX_EPT_READABLE_MASK 0x1ull |
353 | #define VMX_EPT_WRITABLE_MASK 0x2ull | 353 | #define VMX_EPT_WRITABLE_MASK 0x2ull |
354 | #define VMX_EPT_EXECUTABLE_MASK 0x4ull | 354 | #define VMX_EPT_EXECUTABLE_MASK 0x4ull |
355 | #define VMX_EPT_IGMT_BIT (1ull << 6) | ||
355 | 356 | ||
356 | #define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul | 357 | #define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul |
357 | 358 | ||
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f4f632917509..b0243fd55ac0 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -312,9 +312,13 @@ config ACPI_DEBUG | |||
312 | bool "Debug Statements" | 312 | bool "Debug Statements" |
313 | default n | 313 | default n |
314 | help | 314 | help |
315 | The ACPI driver can optionally report errors with a great deal | 315 | The ACPI subsystem can produce debug output. Saying Y enables this |
316 | of verbosity. Saying Y enables these statements. This will increase | 316 | output and increases the kernel size by around 50K. |
317 | your kernel size by around 50K. | 317 | |
318 | Use the acpi.debug_layer and acpi.debug_level kernel command-line | ||
319 | parameters documented in Documentation/acpi/debug.txt and | ||
320 | Documentation/kernel-parameters.txt to control the type and | ||
321 | amount of debug output. | ||
318 | 322 | ||
319 | config ACPI_DEBUG_FUNC_TRACE | 323 | config ACPI_DEBUG_FUNC_TRACE |
320 | bool "Additionally enable ACPI function tracing" | 324 | bool "Additionally enable ACPI function tracing" |
@@ -324,14 +328,6 @@ config ACPI_DEBUG_FUNC_TRACE | |||
324 | ACPI Debug Statements slow down ACPI processing. Function trace | 328 | ACPI Debug Statements slow down ACPI processing. Function trace |
325 | is about half of the penalty and is rarely useful. | 329 | is about half of the penalty and is rarely useful. |
326 | 330 | ||
327 | config ACPI_EC | ||
328 | bool | ||
329 | default y | ||
330 | help | ||
331 | This driver is required on some systems for the proper operation of | ||
332 | the battery and thermal drivers. If you are compiling for a | ||
333 | mobile system, say Y. | ||
334 | |||
335 | config ACPI_PCI_SLOT | 331 | config ACPI_PCI_SLOT |
336 | tristate "PCI slot detection driver" | 332 | tristate "PCI slot detection driver" |
337 | default n | 333 | default n |
@@ -341,10 +337,6 @@ config ACPI_PCI_SLOT | |||
341 | help you correlate PCI bus addresses with the physical geography | 337 | help you correlate PCI bus addresses with the physical geography |
342 | of your slots. If you are unsure, say N. | 338 | of your slots. If you are unsure, say N. |
343 | 339 | ||
344 | config ACPI_POWER | ||
345 | bool | ||
346 | default y | ||
347 | |||
348 | config ACPI_SYSTEM | 340 | config ACPI_SYSTEM |
349 | bool | 341 | bool |
350 | default y | 342 | default y |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index d91c027ece8f..3c0c93300f12 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -39,19 +39,23 @@ obj-y += sleep/ | |||
39 | obj-y += bus.o glue.o | 39 | obj-y += bus.o glue.o |
40 | obj-y += scan.o | 40 | obj-y += scan.o |
41 | # Keep EC driver first. Initialization of others depend on it. | 41 | # Keep EC driver first. Initialization of others depend on it. |
42 | obj-$(CONFIG_ACPI_EC) += ec.o | 42 | obj-y += ec.o |
43 | obj-$(CONFIG_ACPI_AC) += ac.o | 43 | obj-$(CONFIG_ACPI_AC) += ac.o |
44 | obj-$(CONFIG_ACPI_BATTERY) += battery.o | 44 | obj-$(CONFIG_ACPI_BATTERY) += battery.o |
45 | obj-$(CONFIG_ACPI_BUTTON) += button.o | 45 | obj-$(CONFIG_ACPI_BUTTON) += button.o |
46 | obj-$(CONFIG_ACPI_FAN) += fan.o | 46 | obj-$(CONFIG_ACPI_FAN) += fan.o |
47 | obj-$(CONFIG_ACPI_DOCK) += dock.o | 47 | obj-$(CONFIG_ACPI_DOCK) += dock.o |
48 | obj-$(CONFIG_ACPI_VIDEO) += video.o | 48 | obj-$(CONFIG_ACPI_VIDEO) += video.o |
49 | ifdef CONFIG_ACPI_VIDEO | ||
50 | obj-y += video_detect.o | ||
51 | endif | ||
52 | |||
49 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o | 53 | obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o |
50 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o | 54 | obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o |
51 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | 55 | obj-$(CONFIG_ACPI_PROCESSOR) += processor.o |
52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 56 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 57 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
54 | obj-$(CONFIG_ACPI_POWER) += power.o | 58 | obj-y += power.o |
55 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o | 59 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o |
56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 60 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
57 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 61 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index d72a1b6c8a94..9b917dac7732 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
38 | #include <acpi/acpi_drivers.h> | 38 | #include <acpi/acpi_drivers.h> |
39 | 39 | ||
40 | #define ACPI_AC_COMPONENT 0x00020000 | ||
41 | #define ACPI_AC_CLASS "ac_adapter" | 40 | #define ACPI_AC_CLASS "ac_adapter" |
42 | #define ACPI_AC_DEVICE_NAME "AC Adapter" | 41 | #define ACPI_AC_DEVICE_NAME "AC Adapter" |
43 | #define ACPI_AC_FILE_STATE "state" | 42 | #define ACPI_AC_FILE_STATE "state" |
@@ -242,7 +241,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) | |||
242 | acpi_ac_get_state(ac); | 241 | acpi_ac_get_state(ac); |
243 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); | 242 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); |
244 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 243 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
245 | device->dev.bus_id, event, | 244 | dev_name(&device->dev), event, |
246 | (u32) ac->state); | 245 | (u32) ac->state); |
247 | #ifdef CONFIG_ACPI_SYSFS_POWER | 246 | #ifdef CONFIG_ACPI_SYSFS_POWER |
248 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 247 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 71d21c51c45f..63a17b55b39b 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/memory_hotplug.h> | 32 | #include <linux/memory_hotplug.h> |
33 | #include <acpi/acpi_drivers.h> | 33 | #include <acpi/acpi_drivers.h> |
34 | 34 | ||
35 | #define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL | ||
36 | #define ACPI_MEMORY_DEVICE_CLASS "memory" | 35 | #define ACPI_MEMORY_DEVICE_CLASS "memory" |
37 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" | 36 | #define ACPI_MEMORY_DEVICE_HID "PNP0C80" |
38 | #define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device" | 37 | #define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device" |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index b2133e89ad9a..1423b0c0cd2e 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF | 47 | #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF |
48 | 48 | ||
49 | #define ACPI_BATTERY_COMPONENT 0x00040000 | ||
50 | #define ACPI_BATTERY_CLASS "battery" | 49 | #define ACPI_BATTERY_CLASS "battery" |
51 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 50 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
52 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 51 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
@@ -782,7 +781,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
782 | acpi_bus_generate_proc_event(device, event, | 781 | acpi_bus_generate_proc_event(device, event, |
783 | acpi_battery_present(battery)); | 782 | acpi_battery_present(battery)); |
784 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 783 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
785 | device->dev.bus_id, event, | 784 | dev_name(&device->dev), event, |
786 | acpi_battery_present(battery)); | 785 | acpi_battery_present(battery)); |
787 | #ifdef CONFIG_ACPI_SYSFS_POWER | 786 | #ifdef CONFIG_ACPI_SYSFS_POWER |
788 | /* acpi_batter_update could remove power_supply object */ | 787 | /* acpi_batter_update could remove power_supply object */ |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index c797c6473f31..7edf6d913c13 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -688,6 +688,14 @@ void __init acpi_early_init(void) | |||
688 | if (acpi_disabled) | 688 | if (acpi_disabled) |
689 | return; | 689 | return; |
690 | 690 | ||
691 | /* | ||
692 | * ACPI CA initializes acpi_dbg_level to non-zero, which means | ||
693 | * we get debug output merely by turning on CONFIG_ACPI_DEBUG. | ||
694 | * Turn it off so we don't get output unless the user specifies | ||
695 | * acpi.debug_level. | ||
696 | */ | ||
697 | acpi_dbg_level = 0; | ||
698 | |||
691 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | 699 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); |
692 | 700 | ||
693 | /* enable workarounds, unless strict ACPI spec. compliance */ | 701 | /* enable workarounds, unless strict ACPI spec. compliance */ |
@@ -774,7 +782,7 @@ static int __init acpi_bus_init(void) | |||
774 | "Unable to initialize ACPI OS objects\n"); | 782 | "Unable to initialize ACPI OS objects\n"); |
775 | goto error1; | 783 | goto error1; |
776 | } | 784 | } |
777 | #ifdef CONFIG_ACPI_EC | 785 | |
778 | /* | 786 | /* |
779 | * ACPI 2.0 requires the EC driver to be loaded and work before | 787 | * ACPI 2.0 requires the EC driver to be loaded and work before |
780 | * the EC device is found in the namespace (i.e. before acpi_initialize_objects() | 788 | * the EC device is found in the namespace (i.e. before acpi_initialize_objects() |
@@ -785,7 +793,6 @@ static int __init acpi_bus_init(void) | |||
785 | */ | 793 | */ |
786 | status = acpi_ec_ecdt_probe(); | 794 | status = acpi_ec_ecdt_probe(); |
787 | /* Ignore result. Not having an ECDT is not fatal. */ | 795 | /* Ignore result. Not having an ECDT is not fatal. */ |
788 | #endif | ||
789 | 796 | ||
790 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); | 797 | status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION); |
791 | if (ACPI_FAILURE(status)) { | 798 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index cb046c3fc3f2..171fd914f435 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <acpi/acpi_bus.h> | 33 | #include <acpi/acpi_bus.h> |
34 | #include <acpi/acpi_drivers.h> | 34 | #include <acpi/acpi_drivers.h> |
35 | 35 | ||
36 | #define ACPI_BUTTON_COMPONENT 0x00080000 | ||
37 | #define ACPI_BUTTON_CLASS "button" | 36 | #define ACPI_BUTTON_CLASS "button" |
38 | #define ACPI_BUTTON_FILE_INFO "info" | 37 | #define ACPI_BUTTON_FILE_INFO "info" |
39 | #define ACPI_BUTTON_FILE_STATE "state" | 38 | #define ACPI_BUTTON_FILE_STATE "state" |
@@ -479,7 +478,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
479 | device->wakeup.gpe_number, | 478 | device->wakeup.gpe_number, |
480 | ACPI_GPE_TYPE_WAKE_RUN); | 479 | ACPI_GPE_TYPE_WAKE_RUN); |
481 | acpi_enable_gpe(device->wakeup.gpe_device, | 480 | acpi_enable_gpe(device->wakeup.gpe_device, |
482 | device->wakeup.gpe_number, ACPI_NOT_ISR); | 481 | device->wakeup.gpe_number); |
483 | device->wakeup.state.enabled = 1; | 482 | device->wakeup.state.enabled = 1; |
484 | } | 483 | } |
485 | 484 | ||
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index 4441e84b28a9..307963bd1043 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
@@ -34,7 +34,6 @@ | |||
34 | ACPI_MODULE_NAME("cm_sbs"); | 34 | ACPI_MODULE_NAME("cm_sbs"); |
35 | #define ACPI_AC_CLASS "ac_adapter" | 35 | #define ACPI_AC_CLASS "ac_adapter" |
36 | #define ACPI_BATTERY_CLASS "battery" | 36 | #define ACPI_BATTERY_CLASS "battery" |
37 | #define ACPI_SBS_COMPONENT 0x00080000 | ||
38 | #define _COMPONENT ACPI_SBS_COMPONENT | 37 | #define _COMPONENT ACPI_SBS_COMPONENT |
39 | static struct proc_dir_entry *acpi_ac_dir; | 38 | static struct proc_dir_entry *acpi_ac_dir; |
40 | static struct proc_dir_entry *acpi_battery_dir; | 39 | static struct proc_dir_entry *acpi_battery_dir; |
@@ -105,9 +104,3 @@ void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) | |||
105 | return; | 104 | return; |
106 | } | 105 | } |
107 | EXPORT_SYMBOL(acpi_unlock_battery_dir); | 106 | EXPORT_SYMBOL(acpi_unlock_battery_dir); |
108 | |||
109 | static int __init acpi_cm_sbs_init(void) | ||
110 | { | ||
111 | return 0; | ||
112 | } | ||
113 | subsys_initcall(acpi_cm_sbs_init); | ||
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 134818b265a9..17020c12623c 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #define INSTALL_NOTIFY_HANDLER 1 | 41 | #define INSTALL_NOTIFY_HANDLER 1 |
42 | #define UNINSTALL_NOTIFY_HANDLER 2 | 42 | #define UNINSTALL_NOTIFY_HANDLER 2 |
43 | 43 | ||
44 | #define ACPI_CONTAINER_COMPONENT 0x01000000 | ||
45 | #define _COMPONENT ACPI_CONTAINER_COMPONENT | 44 | #define _COMPONENT ACPI_CONTAINER_COMPONENT |
46 | ACPI_MODULE_NAME("container"); | 45 | ACPI_MODULE_NAME("container"); |
47 | 46 | ||
diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index abf36b4b1d1d..c48396892008 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c | |||
@@ -44,6 +44,21 @@ static const struct acpi_dlayer acpi_debug_layers[] = { | |||
44 | ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), | 44 | ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER), |
45 | ACPI_DEBUG_INIT(ACPI_COMPILER), | 45 | ACPI_DEBUG_INIT(ACPI_COMPILER), |
46 | ACPI_DEBUG_INIT(ACPI_TOOLS), | 46 | ACPI_DEBUG_INIT(ACPI_TOOLS), |
47 | |||
48 | ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT), | ||
49 | ACPI_DEBUG_INIT(ACPI_AC_COMPONENT), | ||
50 | ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT), | ||
51 | ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT), | ||
52 | ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT), | ||
53 | ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT), | ||
54 | ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT), | ||
55 | ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT), | ||
56 | ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT), | ||
57 | ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT), | ||
58 | ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT), | ||
59 | ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT), | ||
60 | ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT), | ||
61 | ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT), | ||
47 | }; | 62 | }; |
48 | 63 | ||
49 | static const struct acpi_dlevel acpi_debug_levels[] = { | 64 | static const struct acpi_dlevel acpi_debug_levels[] = { |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ef42316f89f5..cf41f9fc24a7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -70,7 +70,7 @@ enum ec_command { | |||
70 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 70 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
71 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ | 71 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ |
72 | 72 | ||
73 | #define ACPI_EC_STORM_THRESHOLD 20 /* number of false interrupts | 73 | #define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts |
74 | per one transaction */ | 74 | per one transaction */ |
75 | 75 | ||
76 | enum { | 76 | enum { |
@@ -100,8 +100,11 @@ struct transaction { | |||
100 | u8 *rdata; | 100 | u8 *rdata; |
101 | unsigned short irq_count; | 101 | unsigned short irq_count; |
102 | u8 command; | 102 | u8 command; |
103 | u8 wi; | ||
104 | u8 ri; | ||
103 | u8 wlen; | 105 | u8 wlen; |
104 | u8 rlen; | 106 | u8 rlen; |
107 | bool done; | ||
105 | }; | 108 | }; |
106 | 109 | ||
107 | static struct acpi_ec { | 110 | static struct acpi_ec { |
@@ -178,34 +181,45 @@ static int ec_transaction_done(struct acpi_ec *ec) | |||
178 | unsigned long flags; | 181 | unsigned long flags; |
179 | int ret = 0; | 182 | int ret = 0; |
180 | spin_lock_irqsave(&ec->curr_lock, flags); | 183 | spin_lock_irqsave(&ec->curr_lock, flags); |
181 | if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen)) | 184 | if (!ec->curr || ec->curr->done) |
182 | ret = 1; | 185 | ret = 1; |
183 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 186 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
184 | return ret; | 187 | return ret; |
185 | } | 188 | } |
186 | 189 | ||
190 | static void start_transaction(struct acpi_ec *ec) | ||
191 | { | ||
192 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
193 | ec->curr->done = false; | ||
194 | acpi_ec_write_cmd(ec, ec->curr->command); | ||
195 | } | ||
196 | |||
187 | static void gpe_transaction(struct acpi_ec *ec, u8 status) | 197 | static void gpe_transaction(struct acpi_ec *ec, u8 status) |
188 | { | 198 | { |
189 | unsigned long flags; | 199 | unsigned long flags; |
190 | spin_lock_irqsave(&ec->curr_lock, flags); | 200 | spin_lock_irqsave(&ec->curr_lock, flags); |
191 | if (!ec->curr) | 201 | if (!ec->curr) |
192 | goto unlock; | 202 | goto unlock; |
193 | if (ec->curr->wlen > 0) { | 203 | if (ec->curr->wlen > ec->curr->wi) { |
194 | if ((status & ACPI_EC_FLAG_IBF) == 0) { | 204 | if ((status & ACPI_EC_FLAG_IBF) == 0) |
195 | acpi_ec_write_data(ec, *(ec->curr->wdata++)); | 205 | acpi_ec_write_data(ec, |
196 | --ec->curr->wlen; | 206 | ec->curr->wdata[ec->curr->wi++]); |
197 | } else | 207 | else |
198 | /* false interrupt, state didn't change */ | 208 | goto err; |
199 | ++ec->curr->irq_count; | 209 | } else if (ec->curr->rlen > ec->curr->ri) { |
200 | |||
201 | } else if (ec->curr->rlen > 0) { | ||
202 | if ((status & ACPI_EC_FLAG_OBF) == 1) { | 210 | if ((status & ACPI_EC_FLAG_OBF) == 1) { |
203 | *(ec->curr->rdata++) = acpi_ec_read_data(ec); | 211 | ec->curr->rdata[ec->curr->ri++] = acpi_ec_read_data(ec); |
204 | --ec->curr->rlen; | 212 | if (ec->curr->rlen == ec->curr->ri) |
213 | ec->curr->done = true; | ||
205 | } else | 214 | } else |
206 | /* false interrupt, state didn't change */ | 215 | goto err; |
207 | ++ec->curr->irq_count; | 216 | } else if (ec->curr->wlen == ec->curr->wi && |
208 | } | 217 | (status & ACPI_EC_FLAG_IBF) == 0) |
218 | ec->curr->done = true; | ||
219 | goto unlock; | ||
220 | err: | ||
221 | /* false interrupt, state didn't change */ | ||
222 | ++ec->curr->irq_count; | ||
209 | unlock: | 223 | unlock: |
210 | spin_unlock_irqrestore(&ec->curr_lock, flags); | 224 | spin_unlock_irqrestore(&ec->curr_lock, flags); |
211 | } | 225 | } |
@@ -215,6 +229,15 @@ static int acpi_ec_wait(struct acpi_ec *ec) | |||
215 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), | 229 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), |
216 | msecs_to_jiffies(ACPI_EC_DELAY))) | 230 | msecs_to_jiffies(ACPI_EC_DELAY))) |
217 | return 0; | 231 | return 0; |
232 | /* try restart command if we get any false interrupts */ | ||
233 | if (ec->curr->irq_count && | ||
234 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
235 | pr_debug(PREFIX "controller reset, restart transaction\n"); | ||
236 | start_transaction(ec); | ||
237 | if (wait_event_timeout(ec->wait, ec_transaction_done(ec), | ||
238 | msecs_to_jiffies(ACPI_EC_DELAY))) | ||
239 | return 0; | ||
240 | } | ||
218 | /* missing GPEs, switch back to poll mode */ | 241 | /* missing GPEs, switch back to poll mode */ |
219 | if (printk_ratelimit()) | 242 | if (printk_ratelimit()) |
220 | pr_info(PREFIX "missing confirmations, " | 243 | pr_info(PREFIX "missing confirmations, " |
@@ -239,10 +262,10 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state) | |||
239 | static int ec_poll(struct acpi_ec *ec) | 262 | static int ec_poll(struct acpi_ec *ec) |
240 | { | 263 | { |
241 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 264 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
242 | msleep(1); | 265 | udelay(ACPI_EC_UDELAY); |
243 | while (time_before(jiffies, delay)) { | 266 | while (time_before(jiffies, delay)) { |
244 | gpe_transaction(ec, acpi_ec_read_status(ec)); | 267 | gpe_transaction(ec, acpi_ec_read_status(ec)); |
245 | msleep(1); | 268 | udelay(ACPI_EC_UDELAY); |
246 | if (ec_transaction_done(ec)) | 269 | if (ec_transaction_done(ec)) |
247 | return 0; | 270 | return 0; |
248 | } | 271 | } |
@@ -259,14 +282,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
259 | /* disable GPE during transaction if storm is detected */ | 282 | /* disable GPE during transaction if storm is detected */ |
260 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { | 283 | if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
261 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 284 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
262 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 285 | acpi_disable_gpe(NULL, ec->gpe); |
263 | } | 286 | } |
264 | /* start transaction */ | 287 | /* start transaction */ |
265 | spin_lock_irqsave(&ec->curr_lock, tmp); | 288 | spin_lock_irqsave(&ec->curr_lock, tmp); |
266 | /* following two actions should be kept atomic */ | 289 | /* following two actions should be kept atomic */ |
267 | t->irq_count = 0; | ||
268 | ec->curr = t; | 290 | ec->curr = t; |
269 | acpi_ec_write_cmd(ec, ec->curr->command); | 291 | start_transaction(ec); |
270 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) | 292 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) |
271 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 293 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
272 | spin_unlock_irqrestore(&ec->curr_lock, tmp); | 294 | spin_unlock_irqrestore(&ec->curr_lock, tmp); |
@@ -283,10 +305,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
283 | /* check if we received SCI during transaction */ | 305 | /* check if we received SCI during transaction */ |
284 | ec_check_sci(ec, acpi_ec_read_status(ec)); | 306 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
285 | /* it is safe to enable GPE outside of transaction */ | 307 | /* it is safe to enable GPE outside of transaction */ |
286 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 308 | acpi_enable_gpe(NULL, ec->gpe); |
287 | } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && | 309 | } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
288 | t->irq_count > ACPI_EC_STORM_THRESHOLD) { | 310 | t->irq_count > ACPI_EC_STORM_THRESHOLD) { |
289 | pr_debug(PREFIX "GPE storm detected\n"); | 311 | pr_info(PREFIX "GPE storm detected, " |
312 | "transactions will use polling mode\n"); | ||
290 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | 313 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); |
291 | } | 314 | } |
292 | return ret; | 315 | return ret; |
@@ -558,17 +581,26 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
558 | pr_debug(PREFIX "~~~> interrupt\n"); | 581 | pr_debug(PREFIX "~~~> interrupt\n"); |
559 | status = acpi_ec_read_status(ec); | 582 | status = acpi_ec_read_status(ec); |
560 | 583 | ||
561 | gpe_transaction(ec, status); | 584 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) { |
562 | if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) | 585 | gpe_transaction(ec, status); |
563 | wake_up(&ec->wait); | 586 | if (ec_transaction_done(ec) && |
587 | (status & ACPI_EC_FLAG_IBF) == 0) | ||
588 | wake_up(&ec->wait); | ||
589 | } | ||
564 | 590 | ||
565 | ec_check_sci(ec, status); | 591 | ec_check_sci(ec, status); |
566 | if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && | 592 | if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
567 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) { | 593 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) { |
568 | /* this is non-query, must be confirmation */ | 594 | /* this is non-query, must be confirmation */ |
569 | if (printk_ratelimit()) | 595 | if (!test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { |
570 | pr_info(PREFIX "non-query interrupt received," | 596 | if (printk_ratelimit()) |
597 | pr_info(PREFIX "non-query interrupt received," | ||
598 | " switching to interrupt mode\n"); | ||
599 | } else { | ||
600 | /* hush, STORM switches the mode every transaction */ | ||
601 | pr_debug(PREFIX "non-query interrupt received," | ||
571 | " switching to interrupt mode\n"); | 602 | " switching to interrupt mode\n"); |
603 | } | ||
572 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 604 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
573 | } | 605 | } |
574 | return ACPI_INTERRUPT_HANDLED; | 606 | return ACPI_INTERRUPT_HANDLED; |
@@ -736,7 +768,7 @@ static acpi_status | |||
736 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | 768 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) |
737 | { | 769 | { |
738 | acpi_status status; | 770 | acpi_status status; |
739 | unsigned long long tmp; | 771 | unsigned long long tmp = 0; |
740 | 772 | ||
741 | struct acpi_ec *ec = context; | 773 | struct acpi_ec *ec = context; |
742 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 774 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
@@ -751,6 +783,7 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
751 | return status; | 783 | return status; |
752 | ec->gpe = tmp; | 784 | ec->gpe = tmp; |
753 | /* Use the global lock for all EC transactions? */ | 785 | /* Use the global lock for all EC transactions? */ |
786 | tmp = 0; | ||
754 | acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); | 787 | acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); |
755 | ec->global_lock = tmp; | 788 | ec->global_lock = tmp; |
756 | ec->handle = handle; | 789 | ec->handle = handle; |
@@ -868,7 +901,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
868 | if (ACPI_FAILURE(status)) | 901 | if (ACPI_FAILURE(status)) |
869 | return -ENODEV; | 902 | return -ENODEV; |
870 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | 903 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); |
871 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 904 | acpi_enable_gpe(NULL, ec->gpe); |
872 | status = acpi_install_address_space_handler(ec->handle, | 905 | status = acpi_install_address_space_handler(ec->handle, |
873 | ACPI_ADR_SPACE_EC, | 906 | ACPI_ADR_SPACE_EC, |
874 | &acpi_ec_space_handler, | 907 | &acpi_ec_space_handler, |
@@ -1007,7 +1040,7 @@ static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | |||
1007 | /* Stop using GPE */ | 1040 | /* Stop using GPE */ |
1008 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1041 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1009 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 1042 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
1010 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 1043 | acpi_disable_gpe(NULL, ec->gpe); |
1011 | return 0; | 1044 | return 0; |
1012 | } | 1045 | } |
1013 | 1046 | ||
@@ -1016,7 +1049,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
1016 | struct acpi_ec *ec = acpi_driver_data(device); | 1049 | struct acpi_ec *ec = acpi_driver_data(device); |
1017 | /* Enable use of GPE back */ | 1050 | /* Enable use of GPE back */ |
1018 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1051 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1019 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 1052 | acpi_enable_gpe(NULL, ec->gpe); |
1020 | return 0; | 1053 | return 0; |
1021 | } | 1054 | } |
1022 | 1055 | ||
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index c5e53aae86f7..f45c74fe745e 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -289,8 +289,6 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
289 | */ | 289 | */ |
290 | status = acpi_hw_low_disable_gpe(gpe_event_info); | 290 | status = acpi_hw_low_disable_gpe(gpe_event_info); |
291 | return_ACPI_STATUS(status); | 291 | return_ACPI_STATUS(status); |
292 | |||
293 | return_ACPI_STATUS(AE_OK); | ||
294 | } | 292 | } |
295 | 293 | ||
296 | /******************************************************************************* | 294 | /******************************************************************************* |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 73bfd6bf962f..41554f736b68 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -248,21 +248,15 @@ ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) | |||
248 | * DESCRIPTION: Enable an ACPI event (general purpose) | 248 | * DESCRIPTION: Enable an ACPI event (general purpose) |
249 | * | 249 | * |
250 | ******************************************************************************/ | 250 | ******************************************************************************/ |
251 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 251 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) |
252 | { | 252 | { |
253 | acpi_status status = AE_OK; | 253 | acpi_status status = AE_OK; |
254 | acpi_cpu_flags flags; | ||
254 | struct acpi_gpe_event_info *gpe_event_info; | 255 | struct acpi_gpe_event_info *gpe_event_info; |
255 | 256 | ||
256 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); | 257 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
257 | 258 | ||
258 | /* Use semaphore lock if not executing at interrupt level */ | 259 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
259 | |||
260 | if (flags & ACPI_NOT_ISR) { | ||
261 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
262 | if (ACPI_FAILURE(status)) { | ||
263 | return_ACPI_STATUS(status); | ||
264 | } | ||
265 | } | ||
266 | 260 | ||
267 | /* Ensure that we have a valid GPE number */ | 261 | /* Ensure that we have a valid GPE number */ |
268 | 262 | ||
@@ -277,9 +271,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
277 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); | 271 | status = acpi_ev_enable_gpe(gpe_event_info, TRUE); |
278 | 272 | ||
279 | unlock_and_exit: | 273 | unlock_and_exit: |
280 | if (flags & ACPI_NOT_ISR) { | 274 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
281 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
282 | } | ||
283 | return_ACPI_STATUS(status); | 275 | return_ACPI_STATUS(status); |
284 | } | 276 | } |
285 | 277 | ||
@@ -299,22 +291,15 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe) | |||
299 | * DESCRIPTION: Disable an ACPI event (general purpose) | 291 | * DESCRIPTION: Disable an ACPI event (general purpose) |
300 | * | 292 | * |
301 | ******************************************************************************/ | 293 | ******************************************************************************/ |
302 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 294 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) |
303 | { | 295 | { |
304 | acpi_status status = AE_OK; | 296 | acpi_status status = AE_OK; |
297 | acpi_cpu_flags flags; | ||
305 | struct acpi_gpe_event_info *gpe_event_info; | 298 | struct acpi_gpe_event_info *gpe_event_info; |
306 | 299 | ||
307 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); | 300 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
308 | 301 | ||
309 | /* Use semaphore lock if not executing at interrupt level */ | 302 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
310 | |||
311 | if (flags & ACPI_NOT_ISR) { | ||
312 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
313 | if (ACPI_FAILURE(status)) { | ||
314 | return_ACPI_STATUS(status); | ||
315 | } | ||
316 | } | ||
317 | |||
318 | /* Ensure that we have a valid GPE number */ | 303 | /* Ensure that we have a valid GPE number */ |
319 | 304 | ||
320 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 305 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
@@ -325,10 +310,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
325 | 310 | ||
326 | status = acpi_ev_disable_gpe(gpe_event_info); | 311 | status = acpi_ev_disable_gpe(gpe_event_info); |
327 | 312 | ||
328 | unlock_and_exit: | 313 | unlock_and_exit: |
329 | if (flags & ACPI_NOT_ISR) { | 314 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
330 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
331 | } | ||
332 | return_ACPI_STATUS(status); | 315 | return_ACPI_STATUS(status); |
333 | } | 316 | } |
334 | 317 | ||
@@ -521,6 +504,9 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
521 | if (value) | 504 | if (value) |
522 | *event_status |= ACPI_EVENT_FLAG_SET; | 505 | *event_status |= ACPI_EVENT_FLAG_SET; |
523 | 506 | ||
507 | if (acpi_gbl_fixed_event_handlers[event].handler) | ||
508 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
509 | |||
524 | return_ACPI_STATUS(status); | 510 | return_ACPI_STATUS(status); |
525 | } | 511 | } |
526 | 512 | ||
@@ -571,6 +557,9 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
571 | 557 | ||
572 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); | 558 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); |
573 | 559 | ||
560 | if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) | ||
561 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
562 | |||
574 | unlock_and_exit: | 563 | unlock_and_exit: |
575 | if (flags & ACPI_NOT_ISR) { | 564 | if (flags & ACPI_NOT_ISR) { |
576 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 565 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 60d54d1f6b19..eaaee1660bdf 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <acpi/acpi_bus.h> | 34 | #include <acpi/acpi_bus.h> |
35 | #include <acpi/acpi_drivers.h> | 35 | #include <acpi/acpi_drivers.h> |
36 | 36 | ||
37 | #define ACPI_FAN_COMPONENT 0x00200000 | ||
38 | #define ACPI_FAN_CLASS "fan" | 37 | #define ACPI_FAN_CLASS "fan" |
39 | #define ACPI_FAN_FILE_STATE "state" | 38 | #define ACPI_FAN_FILE_STATE "state" |
40 | 39 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 24649ada08df..adec3d15810a 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -140,6 +140,46 @@ struct device *acpi_get_physical_device(acpi_handle handle) | |||
140 | 140 | ||
141 | EXPORT_SYMBOL(acpi_get_physical_device); | 141 | EXPORT_SYMBOL(acpi_get_physical_device); |
142 | 142 | ||
143 | /* ToDo: When a PCI bridge is found, return the PCI device behind the bridge | ||
144 | * This should work in general, but did not on a Lenovo T61 for the | ||
145 | * graphics card. But this must be fixed when the PCI device is | ||
146 | * bound and the kernel device struct is attached to the acpi device | ||
147 | * Note: A success call will increase reference count by one | ||
148 | * Do call put_device(dev) on the returned device then | ||
149 | */ | ||
150 | struct device *acpi_get_physical_pci_device(acpi_handle handle) | ||
151 | { | ||
152 | struct device *dev; | ||
153 | long long device_id; | ||
154 | acpi_status status; | ||
155 | |||
156 | status = | ||
157 | acpi_evaluate_integer(handle, "_ADR", NULL, &device_id); | ||
158 | |||
159 | if (ACPI_FAILURE(status)) | ||
160 | return NULL; | ||
161 | |||
162 | /* We need to attempt to determine whether the _ADR refers to a | ||
163 | PCI device or not. There's no terribly good way to do this, | ||
164 | so the best we can hope for is to assume that there'll never | ||
165 | be a device in the host bridge */ | ||
166 | if (device_id >= 0x10000) { | ||
167 | /* It looks like a PCI device. Does it exist? */ | ||
168 | dev = acpi_get_physical_device(handle); | ||
169 | } else { | ||
170 | /* It doesn't look like a PCI device. Does its parent | ||
171 | exist? */ | ||
172 | acpi_handle phandle; | ||
173 | if (acpi_get_parent(handle, &phandle)) | ||
174 | return NULL; | ||
175 | dev = acpi_get_physical_device(phandle); | ||
176 | } | ||
177 | if (!dev) | ||
178 | return NULL; | ||
179 | return dev; | ||
180 | } | ||
181 | EXPORT_SYMBOL(acpi_get_physical_pci_device); | ||
182 | |||
143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 183 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
144 | { | 184 | { |
145 | struct acpi_device *acpi_dev; | 185 | struct acpi_device *acpi_dev; |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index fcfdef7b4fdd..e52ad91ce2dc 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -531,7 +531,7 @@ int __init acpi_irq_penalty_init(void) | |||
531 | return 0; | 531 | return 0; |
532 | } | 532 | } |
533 | 533 | ||
534 | static int acpi_irq_balance; /* 0: static, 1: balance */ | 534 | static int acpi_irq_balance = -1; /* 0: static, 1: balance */ |
535 | 535 | ||
536 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) | 536 | static int acpi_pci_link_allocate(struct acpi_pci_link *link) |
537 | { | 537 | { |
@@ -950,10 +950,17 @@ device_initcall(irqrouter_init_sysfs); | |||
950 | 950 | ||
951 | static int __init acpi_pci_link_init(void) | 951 | static int __init acpi_pci_link_init(void) |
952 | { | 952 | { |
953 | |||
954 | if (acpi_noirq) | 953 | if (acpi_noirq) |
955 | return 0; | 954 | return 0; |
956 | 955 | ||
956 | if (acpi_irq_balance == -1) { | ||
957 | /* no command line switch: enable balancing in IOAPIC mode */ | ||
958 | if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) | ||
959 | acpi_irq_balance = 1; | ||
960 | else | ||
961 | acpi_irq_balance = 0; | ||
962 | } | ||
963 | |||
957 | acpi_link.count = 0; | 964 | acpi_link.count = 0; |
958 | INIT_LIST_HEAD(&acpi_link.entries); | 965 | INIT_LIST_HEAD(&acpi_link.entries); |
959 | 966 | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 1b8f67d21d53..642554b1b60c 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -376,15 +376,9 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) | |||
376 | 376 | ||
377 | static int __init acpi_pci_root_init(void) | 377 | static int __init acpi_pci_root_init(void) |
378 | { | 378 | { |
379 | |||
380 | if (acpi_pci_disabled) | 379 | if (acpi_pci_disabled) |
381 | return 0; | 380 | return 0; |
382 | 381 | ||
383 | /* DEBUG: | ||
384 | acpi_dbg_layer = ACPI_PCI_COMPONENT; | ||
385 | acpi_dbg_level = 0xFFFFFFFF; | ||
386 | */ | ||
387 | |||
388 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 382 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
389 | return -ENODEV; | 383 | return -ENODEV; |
390 | 384 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index a1718e56103b..bb7d50dd2818 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -44,9 +44,8 @@ | |||
44 | #include <acpi/acpi_bus.h> | 44 | #include <acpi/acpi_bus.h> |
45 | #include <acpi/acpi_drivers.h> | 45 | #include <acpi/acpi_drivers.h> |
46 | 46 | ||
47 | #define _COMPONENT ACPI_POWER_COMPONENT | 47 | #define _COMPONENT ACPI_POWER_COMPONENT |
48 | ACPI_MODULE_NAME("power"); | 48 | ACPI_MODULE_NAME("power"); |
49 | #define ACPI_POWER_COMPONENT 0x00800000 | ||
50 | #define ACPI_POWER_CLASS "power_resource" | 49 | #define ACPI_POWER_CLASS "power_resource" |
51 | #define ACPI_POWER_DEVICE_NAME "Power Resource" | 50 | #define ACPI_POWER_DEVICE_NAME "Power Resource" |
52 | #define ACPI_POWER_FILE_INFO "info" | 51 | #define ACPI_POWER_FILE_INFO "info" |
@@ -153,7 +152,8 @@ static int acpi_power_get_state(acpi_handle handle, int *state) | |||
153 | ACPI_POWER_RESOURCE_STATE_OFF; | 152 | ACPI_POWER_RESOURCE_STATE_OFF; |
154 | 153 | ||
155 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", | 154 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", |
156 | acpi_ut_get_node_name(handle), state ? "on" : "off")); | 155 | acpi_ut_get_node_name(handle), |
156 | *state ? "on" : "off")); | ||
157 | 157 | ||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
@@ -516,11 +516,6 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
516 | cl = &device->power.states[device->power.state].resources; | 516 | cl = &device->power.states[device->power.state].resources; |
517 | tl = &device->power.states[state].resources; | 517 | tl = &device->power.states[state].resources; |
518 | 518 | ||
519 | if (!cl->count && !tl->count) { | ||
520 | result = -ENODEV; | ||
521 | goto end; | ||
522 | } | ||
523 | |||
524 | /* TBD: Resources must be ordered. */ | 519 | /* TBD: Resources must be ordered. */ |
525 | 520 | ||
526 | /* | 521 | /* |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 24a362f8034c..34948362f41d 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include <acpi/acpi_drivers.h> | 59 | #include <acpi/acpi_drivers.h> |
60 | #include <acpi/processor.h> | 60 | #include <acpi/processor.h> |
61 | 61 | ||
62 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
63 | #define ACPI_PROCESSOR_CLASS "processor" | 62 | #define ACPI_PROCESSOR_CLASS "processor" |
64 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" | 63 | #define ACPI_PROCESSOR_DEVICE_NAME "Processor" |
65 | #define ACPI_PROCESSOR_FILE_INFO "info" | 64 | #define ACPI_PROCESSOR_FILE_INFO "info" |
@@ -89,6 +88,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr); | |||
89 | 88 | ||
90 | 89 | ||
91 | static const struct acpi_device_id processor_device_ids[] = { | 90 | static const struct acpi_device_id processor_device_ids[] = { |
91 | {ACPI_PROCESSOR_OBJECT_HID, 0}, | ||
92 | {ACPI_PROCESSOR_HID, 0}, | 92 | {ACPI_PROCESSOR_HID, 0}, |
93 | {"", 0}, | 93 | {"", 0}, |
94 | }; | 94 | }; |
@@ -409,7 +409,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
409 | /* Use the acpiid in MADT to map cpus in case of SMP */ | 409 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
410 | 410 | ||
411 | #ifndef CONFIG_SMP | 411 | #ifndef CONFIG_SMP |
412 | static int get_cpu_id(acpi_handle handle, u32 acpi_id) {return -1;} | 412 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) { return -1; } |
413 | #else | 413 | #else |
414 | 414 | ||
415 | static struct acpi_table_madt *madt; | 415 | static struct acpi_table_madt *madt; |
@@ -428,27 +428,35 @@ static int map_lapic_id(struct acpi_subtable_header *entry, | |||
428 | } | 428 | } |
429 | 429 | ||
430 | static int map_lsapic_id(struct acpi_subtable_header *entry, | 430 | static int map_lsapic_id(struct acpi_subtable_header *entry, |
431 | u32 acpi_id, int *apic_id) | 431 | int device_declaration, u32 acpi_id, int *apic_id) |
432 | { | 432 | { |
433 | struct acpi_madt_local_sapic *lsapic = | 433 | struct acpi_madt_local_sapic *lsapic = |
434 | (struct acpi_madt_local_sapic *)entry; | 434 | (struct acpi_madt_local_sapic *)entry; |
435 | u32 tmp = (lsapic->id << 8) | lsapic->eid; | ||
436 | |||
435 | /* Only check enabled APICs*/ | 437 | /* Only check enabled APICs*/ |
436 | if (lsapic->lapic_flags & ACPI_MADT_ENABLED) { | 438 | if (!(lsapic->lapic_flags & ACPI_MADT_ENABLED)) |
437 | /* First check against id */ | 439 | return 0; |
438 | if (lsapic->processor_id == acpi_id) { | 440 | |
439 | *apic_id = (lsapic->id << 8) | lsapic->eid; | 441 | /* Device statement declaration type */ |
440 | return 1; | 442 | if (device_declaration) { |
441 | /* Check against optional uid */ | 443 | if (entry->length < 16) |
442 | } else if (entry->length >= 16 && | 444 | printk(KERN_ERR PREFIX |
443 | lsapic->uid == acpi_id) { | 445 | "Invalid LSAPIC with Device type processor (SAPIC ID %#x)\n", |
444 | *apic_id = lsapic->uid; | 446 | tmp); |
445 | return 1; | 447 | else if (lsapic->uid == acpi_id) |
446 | } | 448 | goto found; |
447 | } | 449 | /* Processor statement declaration type */ |
450 | } else if (lsapic->processor_id == acpi_id) | ||
451 | goto found; | ||
452 | |||
448 | return 0; | 453 | return 0; |
454 | found: | ||
455 | *apic_id = tmp; | ||
456 | return 1; | ||
449 | } | 457 | } |
450 | 458 | ||
451 | static int map_madt_entry(u32 acpi_id) | 459 | static int map_madt_entry(int type, u32 acpi_id) |
452 | { | 460 | { |
453 | unsigned long madt_end, entry; | 461 | unsigned long madt_end, entry; |
454 | int apic_id = -1; | 462 | int apic_id = -1; |
@@ -469,7 +477,7 @@ static int map_madt_entry(u32 acpi_id) | |||
469 | if (map_lapic_id(header, acpi_id, &apic_id)) | 477 | if (map_lapic_id(header, acpi_id, &apic_id)) |
470 | break; | 478 | break; |
471 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 479 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
472 | if (map_lsapic_id(header, acpi_id, &apic_id)) | 480 | if (map_lsapic_id(header, type, acpi_id, &apic_id)) |
473 | break; | 481 | break; |
474 | } | 482 | } |
475 | entry += header->length; | 483 | entry += header->length; |
@@ -477,7 +485,7 @@ static int map_madt_entry(u32 acpi_id) | |||
477 | return apic_id; | 485 | return apic_id; |
478 | } | 486 | } |
479 | 487 | ||
480 | static int map_mat_entry(acpi_handle handle, u32 acpi_id) | 488 | static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) |
481 | { | 489 | { |
482 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 490 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
483 | union acpi_object *obj; | 491 | union acpi_object *obj; |
@@ -500,7 +508,7 @@ static int map_mat_entry(acpi_handle handle, u32 acpi_id) | |||
500 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { | 508 | if (header->type == ACPI_MADT_TYPE_LOCAL_APIC) { |
501 | map_lapic_id(header, acpi_id, &apic_id); | 509 | map_lapic_id(header, acpi_id, &apic_id); |
502 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { | 510 | } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { |
503 | map_lsapic_id(header, acpi_id, &apic_id); | 511 | map_lsapic_id(header, type, acpi_id, &apic_id); |
504 | } | 512 | } |
505 | 513 | ||
506 | exit: | 514 | exit: |
@@ -509,14 +517,14 @@ exit: | |||
509 | return apic_id; | 517 | return apic_id; |
510 | } | 518 | } |
511 | 519 | ||
512 | static int get_cpu_id(acpi_handle handle, u32 acpi_id) | 520 | static int get_cpu_id(acpi_handle handle, int type, u32 acpi_id) |
513 | { | 521 | { |
514 | int i; | 522 | int i; |
515 | int apic_id = -1; | 523 | int apic_id = -1; |
516 | 524 | ||
517 | apic_id = map_mat_entry(handle, acpi_id); | 525 | apic_id = map_mat_entry(handle, type, acpi_id); |
518 | if (apic_id == -1) | 526 | if (apic_id == -1) |
519 | apic_id = map_madt_entry(acpi_id); | 527 | apic_id = map_madt_entry(type, acpi_id); |
520 | if (apic_id == -1) | 528 | if (apic_id == -1) |
521 | return apic_id; | 529 | return apic_id; |
522 | 530 | ||
@@ -532,15 +540,16 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |||
532 | Driver Interface | 540 | Driver Interface |
533 | -------------------------------------------------------------------------- */ | 541 | -------------------------------------------------------------------------- */ |
534 | 542 | ||
535 | static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | 543 | static int acpi_processor_get_info(struct acpi_device *device) |
536 | { | 544 | { |
537 | acpi_status status = 0; | 545 | acpi_status status = 0; |
538 | union acpi_object object = { 0 }; | 546 | union acpi_object object = { 0 }; |
539 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 547 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
540 | int cpu_index; | 548 | struct acpi_processor *pr; |
549 | int cpu_index, device_declaration = 0; | ||
541 | static int cpu0_initialized; | 550 | static int cpu0_initialized; |
542 | 551 | ||
543 | 552 | pr = acpi_driver_data(device); | |
544 | if (!pr) | 553 | if (!pr) |
545 | return -EINVAL; | 554 | return -EINVAL; |
546 | 555 | ||
@@ -561,22 +570,23 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
561 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 570 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
562 | "No bus mastering arbitration control\n")); | 571 | "No bus mastering arbitration control\n")); |
563 | 572 | ||
564 | /* Check if it is a Device with HID and UID */ | 573 | if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) { |
565 | if (has_uid) { | 574 | /* |
575 | * Declared with "Device" statement; match _UID. | ||
576 | * Note that we don't handle string _UIDs yet. | ||
577 | */ | ||
566 | unsigned long long value; | 578 | unsigned long long value; |
567 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, | 579 | status = acpi_evaluate_integer(pr->handle, METHOD_NAME__UID, |
568 | NULL, &value); | 580 | NULL, &value); |
569 | if (ACPI_FAILURE(status)) { | 581 | if (ACPI_FAILURE(status)) { |
570 | printk(KERN_ERR PREFIX "Evaluating processor _UID\n"); | 582 | printk(KERN_ERR PREFIX |
583 | "Evaluating processor _UID [%#x]\n", status); | ||
571 | return -ENODEV; | 584 | return -ENODEV; |
572 | } | 585 | } |
586 | device_declaration = 1; | ||
573 | pr->acpi_id = value; | 587 | pr->acpi_id = value; |
574 | } else { | 588 | } else { |
575 | /* | 589 | /* Declared with "Processor" statement; match ProcessorID */ |
576 | * Evalute the processor object. Note that it is common on SMP to | ||
577 | * have the first (boot) processor with a valid PBLK address while | ||
578 | * all others have a NULL address. | ||
579 | */ | ||
580 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); | 590 | status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); |
581 | if (ACPI_FAILURE(status)) { | 591 | if (ACPI_FAILURE(status)) { |
582 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); | 592 | printk(KERN_ERR PREFIX "Evaluating processor object\n"); |
@@ -584,12 +594,13 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
584 | } | 594 | } |
585 | 595 | ||
586 | /* | 596 | /* |
587 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. | 597 | * TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP. |
588 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in arch/xxx/acpi.c | 598 | * >>> 'acpi_get_processor_id(acpi_id, &id)' in |
589 | */ | 599 | * arch/xxx/acpi.c |
600 | */ | ||
590 | pr->acpi_id = object.processor.proc_id; | 601 | pr->acpi_id = object.processor.proc_id; |
591 | } | 602 | } |
592 | cpu_index = get_cpu_id(pr->handle, pr->acpi_id); | 603 | cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id); |
593 | 604 | ||
594 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 605 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
595 | if (!cpu0_initialized && (cpu_index == -1) && | 606 | if (!cpu0_initialized && (cpu_index == -1) && |
@@ -661,7 +672,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
661 | 672 | ||
662 | pr = acpi_driver_data(device); | 673 | pr = acpi_driver_data(device); |
663 | 674 | ||
664 | result = acpi_processor_get_info(pr, device->flags.unique_id); | 675 | result = acpi_processor_get_info(device); |
665 | if (result) { | 676 | if (result) { |
666 | /* Processor is physically not present */ | 677 | /* Processor is physically not present */ |
667 | return 0; | 678 | return 0; |
@@ -761,20 +772,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
761 | acpi_bus_generate_proc_event(device, event, | 772 | acpi_bus_generate_proc_event(device, event, |
762 | pr->performance_platform_limit); | 773 | pr->performance_platform_limit); |
763 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 774 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
764 | device->dev.bus_id, event, | 775 | dev_name(&device->dev), event, |
765 | pr->performance_platform_limit); | 776 | pr->performance_platform_limit); |
766 | break; | 777 | break; |
767 | case ACPI_PROCESSOR_NOTIFY_POWER: | 778 | case ACPI_PROCESSOR_NOTIFY_POWER: |
768 | acpi_processor_cst_has_changed(pr); | 779 | acpi_processor_cst_has_changed(pr); |
769 | acpi_bus_generate_proc_event(device, event, 0); | 780 | acpi_bus_generate_proc_event(device, event, 0); |
770 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 781 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
771 | device->dev.bus_id, event, 0); | 782 | dev_name(&device->dev), event, 0); |
772 | break; | 783 | break; |
773 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: | 784 | case ACPI_PROCESSOR_NOTIFY_THROTTLING: |
774 | acpi_processor_tstate_has_changed(pr); | 785 | acpi_processor_tstate_has_changed(pr); |
775 | acpi_bus_generate_proc_event(device, event, 0); | 786 | acpi_bus_generate_proc_event(device, event, 0); |
776 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 787 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
777 | device->dev.bus_id, event, 0); | 788 | dev_name(&device->dev), event, 0); |
778 | default: | 789 | default: |
779 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 790 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
780 | "Unsupported event [0x%x]\n", event)); | 791 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 81b40ed5379e..5f8d746a9b81 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include <acpi/processor.h> | 59 | #include <acpi/processor.h> |
60 | #include <asm/processor.h> | 60 | #include <asm/processor.h> |
61 | 61 | ||
62 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
63 | #define ACPI_PROCESSOR_CLASS "processor" | 62 | #define ACPI_PROCESSOR_CLASS "processor" |
64 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 63 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
65 | ACPI_MODULE_NAME("processor_idle"); | 64 | ACPI_MODULE_NAME("processor_idle"); |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index dbcf260ea93f..0d7b772bef50 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -44,9 +44,9 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #include <acpi/acpi_bus.h> | 46 | #include <acpi/acpi_bus.h> |
47 | #include <acpi/acpi_drivers.h> | ||
47 | #include <acpi/processor.h> | 48 | #include <acpi/processor.h> |
48 | 49 | ||
49 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
50 | #define ACPI_PROCESSOR_CLASS "processor" | 50 | #define ACPI_PROCESSOR_CLASS "processor" |
51 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" | 51 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" |
52 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 52 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index ef34b18f95ca..b1eb376fae45 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <acpi/processor.h> | 40 | #include <acpi/processor.h> |
41 | #include <acpi/acpi_drivers.h> | 41 | #include <acpi/acpi_drivers.h> |
42 | 42 | ||
43 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
44 | #define ACPI_PROCESSOR_CLASS "processor" | 43 | #define ACPI_PROCESSOR_CLASS "processor" |
45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 44 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
46 | ACPI_MODULE_NAME("processor_thermal"); | 45 | ACPI_MODULE_NAME("processor_thermal"); |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 3da2df93d924..a0c38c94a8a0 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -38,9 +38,9 @@ | |||
38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
39 | 39 | ||
40 | #include <acpi/acpi_bus.h> | 40 | #include <acpi/acpi_bus.h> |
41 | #include <acpi/acpi_drivers.h> | ||
41 | #include <acpi/processor.h> | 42 | #include <acpi/processor.h> |
42 | 43 | ||
43 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | ||
44 | #define ACPI_PROCESSOR_CLASS "processor" | 44 | #define ACPI_PROCESSOR_CLASS "processor" |
45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 45 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
46 | ACPI_MODULE_NAME("processor_throttling"); | 46 | ACPI_MODULE_NAME("processor_throttling"); |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index 755baf2ca70a..a6b662c00b67 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
@@ -15,28 +15,9 @@ void acpi_reboot(void) | |||
15 | 15 | ||
16 | rr = &acpi_gbl_FADT.reset_register; | 16 | rr = &acpi_gbl_FADT.reset_register; |
17 | 17 | ||
18 | /* | 18 | /* Is the reset register supported? */ |
19 | * Is the ACPI reset register supported? | 19 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
20 | * | 20 | rr->bit_width != 8 || rr->bit_offset != 0) |
21 | * According to ACPI 3.0, FADT.flags.RESET_REG_SUP indicates | ||
22 | * whether the ACPI reset mechanism is supported. | ||
23 | * | ||
24 | * However, some boxes have this bit clear, yet a valid | ||
25 | * ACPI_RESET_REG & RESET_VALUE, and ACPI reboot is the only | ||
26 | * mechanism that works for them after S3. | ||
27 | * | ||
28 | * This suggests that other operating systems may not be checking | ||
29 | * the RESET_REG_SUP bit, and are using other means to decide | ||
30 | * whether to use the ACPI reboot mechanism or not. | ||
31 | * | ||
32 | * So when acpi reboot is requested, | ||
33 | * only the reset_register is checked. If the following | ||
34 | * conditions are met, it indicates that the reset register is supported. | ||
35 | * a. reset_register is not zero | ||
36 | * b. the access width is eight | ||
37 | * c. the bit_offset is zero | ||
38 | */ | ||
39 | if (!(rr->address) || rr->bit_width != 8 || rr->bit_offset != 0) | ||
40 | return; | 21 | return; |
41 | 22 | ||
42 | reset_value = acpi_gbl_FADT.reset_value; | 23 | reset_value = acpi_gbl_FADT.reset_value; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a9dda8e0f9f9..bd5253ee5c85 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -109,8 +109,7 @@ static int acpi_bus_hot_remove_device(void *context) | |||
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 111 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
112 | "Hot-removing device %s...\n", device->dev.bus_id)); | 112 | "Hot-removing device %s...\n", dev_name(&device->dev))); |
113 | |||
114 | 113 | ||
115 | if (acpi_bus_trim(device, 1)) { | 114 | if (acpi_bus_trim(device, 1)) { |
116 | printk(KERN_ERR PREFIX | 115 | printk(KERN_ERR PREFIX |
@@ -460,7 +459,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
460 | acpi_device_bus_id->instance_no = 0; | 459 | acpi_device_bus_id->instance_no = 0; |
461 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); | 460 | list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); |
462 | } | 461 | } |
463 | sprintf(device->dev.bus_id, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); | 462 | dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); |
464 | 463 | ||
465 | if (device->parent) { | 464 | if (device->parent) { |
466 | list_add_tail(&device->node, &device->parent->children); | 465 | list_add_tail(&device->node, &device->parent->children); |
@@ -484,7 +483,8 @@ static int acpi_device_register(struct acpi_device *device, | |||
484 | 483 | ||
485 | result = acpi_device_setup_files(device); | 484 | result = acpi_device_setup_files(device); |
486 | if(result) | 485 | if(result) |
487 | printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", device->dev.bus_id); | 486 | printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", |
487 | dev_name(&device->dev)); | ||
488 | 488 | ||
489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; | 489 | device->removal_type = ACPI_BUS_REMOVAL_NORMAL; |
490 | return 0; | 490 | return 0; |
@@ -919,36 +919,6 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
919 | } | 919 | } |
920 | } | 920 | } |
921 | 921 | ||
922 | static int | ||
923 | acpi_video_bus_match(struct acpi_device *device) | ||
924 | { | ||
925 | acpi_handle h_dummy; | ||
926 | |||
927 | if (!device) | ||
928 | return -EINVAL; | ||
929 | |||
930 | /* Since there is no HID, CID for ACPI Video drivers, we have | ||
931 | * to check well known required nodes for each feature we support. | ||
932 | */ | ||
933 | |||
934 | /* Does this device able to support video switching ? */ | ||
935 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && | ||
936 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
937 | return 0; | ||
938 | |||
939 | /* Does this device able to retrieve a video ROM ? */ | ||
940 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | ||
941 | return 0; | ||
942 | |||
943 | /* Does this device able to configure which video head to be POSTed ? */ | ||
944 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && | ||
945 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && | ||
946 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) | ||
947 | return 0; | ||
948 | |||
949 | return -ENODEV; | ||
950 | } | ||
951 | |||
952 | /* | 922 | /* |
953 | * acpi_bay_match - see if a device is an ejectable driver bay | 923 | * acpi_bay_match - see if a device is an ejectable driver bay |
954 | * | 924 | * |
@@ -1031,7 +1001,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
1031 | will get autoloaded and the device might still match | 1001 | will get autoloaded and the device might still match |
1032 | against another driver. | 1002 | against another driver. |
1033 | */ | 1003 | */ |
1034 | if (ACPI_SUCCESS(acpi_video_bus_match(device))) | 1004 | if (acpi_is_video_device(device)) |
1035 | cid_add = ACPI_VIDEO_HID; | 1005 | cid_add = ACPI_VIDEO_HID; |
1036 | else if (ACPI_SUCCESS(acpi_bay_match(device))) | 1006 | else if (ACPI_SUCCESS(acpi_bay_match(device))) |
1037 | cid_add = ACPI_BAY_HID; | 1007 | cid_add = ACPI_BAY_HID; |
@@ -1043,7 +1013,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
1043 | hid = ACPI_POWER_HID; | 1013 | hid = ACPI_POWER_HID; |
1044 | break; | 1014 | break; |
1045 | case ACPI_BUS_TYPE_PROCESSOR: | 1015 | case ACPI_BUS_TYPE_PROCESSOR: |
1046 | hid = ACPI_PROCESSOR_HID; | 1016 | hid = ACPI_PROCESSOR_OBJECT_HID; |
1047 | break; | 1017 | break; |
1048 | case ACPI_BUS_TYPE_SYSTEM: | 1018 | case ACPI_BUS_TYPE_SYSTEM: |
1049 | hid = ACPI_SYSTEM_HID; | 1019 | hid = ACPI_SYSTEM_HID; |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 631ee2ee2ca0..64e591ba86f2 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -366,8 +366,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
366 | dev->wakeup.state.enabled ? "enabled" : "disabled"); | 366 | dev->wakeup.state.enabled ? "enabled" : "disabled"); |
367 | if (ldev) | 367 | if (ldev) |
368 | seq_printf(seq, "%s:%s", | 368 | seq_printf(seq, "%s:%s", |
369 | ldev->bus ? ldev->bus->name : "no-bus", | 369 | dev_name(ldev) ? ldev->bus->name : "no-bus", |
370 | ldev->bus_id); | 370 | dev_name(ldev)); |
371 | seq_printf(seq, "\n"); | 371 | seq_printf(seq, "\n"); |
372 | put_device(ldev); | 372 | put_device(ldev); |
373 | 373 | ||
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 38655eb132dc..dea4c23df764 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -88,7 +88,7 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
88 | spin_unlock(&acpi_device_lock); | 88 | spin_unlock(&acpi_device_lock); |
89 | if (!dev->wakeup.flags.run_wake) | 89 | if (!dev->wakeup.flags.run_wake) |
90 | acpi_enable_gpe(dev->wakeup.gpe_device, | 90 | acpi_enable_gpe(dev->wakeup.gpe_device, |
91 | dev->wakeup.gpe_number, ACPI_ISR); | 91 | dev->wakeup.gpe_number); |
92 | spin_lock(&acpi_device_lock); | 92 | spin_lock(&acpi_device_lock); |
93 | } | 93 | } |
94 | spin_unlock(&acpi_device_lock); | 94 | spin_unlock(&acpi_device_lock); |
@@ -122,7 +122,7 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
122 | ACPI_GPE_TYPE_WAKE_RUN); | 122 | ACPI_GPE_TYPE_WAKE_RUN); |
123 | /* Re-enable it, since set_gpe_type will disable it */ | 123 | /* Re-enable it, since set_gpe_type will disable it */ |
124 | acpi_enable_gpe(dev->wakeup.gpe_device, | 124 | acpi_enable_gpe(dev->wakeup.gpe_device, |
125 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 125 | dev->wakeup.gpe_number); |
126 | spin_lock(&acpi_device_lock); | 126 | spin_lock(&acpi_device_lock); |
127 | } | 127 | } |
128 | continue; | 128 | continue; |
@@ -133,7 +133,7 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
133 | /* Never disable run-wake GPE */ | 133 | /* Never disable run-wake GPE */ |
134 | if (!dev->wakeup.flags.run_wake) { | 134 | if (!dev->wakeup.flags.run_wake) { |
135 | acpi_disable_gpe(dev->wakeup.gpe_device, | 135 | acpi_disable_gpe(dev->wakeup.gpe_device, |
136 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 136 | dev->wakeup.gpe_number); |
137 | acpi_clear_gpe(dev->wakeup.gpe_device, | 137 | acpi_clear_gpe(dev->wakeup.gpe_device, |
138 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 138 | dev->wakeup.gpe_number, ACPI_NOT_ISR); |
139 | } | 139 | } |
@@ -162,7 +162,7 @@ static int __init acpi_wakeup_device_init(void) | |||
162 | dev->wakeup.gpe_number, | 162 | dev->wakeup.gpe_number, |
163 | ACPI_GPE_TYPE_WAKE_RUN); | 163 | ACPI_GPE_TYPE_WAKE_RUN); |
164 | acpi_enable_gpe(dev->wakeup.gpe_device, | 164 | acpi_enable_gpe(dev->wakeup.gpe_device, |
165 | dev->wakeup.gpe_number, ACPI_NOT_ISR); | 165 | dev->wakeup.gpe_number); |
166 | dev->wakeup.state.enabled = 1; | 166 | dev->wakeup.state.enabled = 1; |
167 | spin_lock(&acpi_device_lock); | 167 | spin_lock(&acpi_device_lock); |
168 | } | 168 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 1d74171b7940..6e4107f82403 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -78,9 +78,15 @@ static ssize_t acpi_table_show(struct kobject *kobj, | |||
78 | container_of(bin_attr, struct acpi_table_attr, attr); | 78 | container_of(bin_attr, struct acpi_table_attr, attr); |
79 | struct acpi_table_header *table_header = NULL; | 79 | struct acpi_table_header *table_header = NULL; |
80 | acpi_status status; | 80 | acpi_status status; |
81 | char name[ACPI_NAME_SIZE]; | ||
82 | |||
83 | if (strncmp(table_attr->name, "NULL", 4)) | ||
84 | memcpy(name, table_attr->name, ACPI_NAME_SIZE); | ||
85 | else | ||
86 | memcpy(name, "\0\0\0\0", 4); | ||
81 | 87 | ||
82 | status = | 88 | status = |
83 | acpi_get_table(table_attr->name, table_attr->instance, | 89 | acpi_get_table(name, table_attr->instance, |
84 | &table_header); | 90 | &table_header); |
85 | if (ACPI_FAILURE(status)) | 91 | if (ACPI_FAILURE(status)) |
86 | return -ENODEV; | 92 | return -ENODEV; |
@@ -95,21 +101,24 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
95 | struct acpi_table_header *header = NULL; | 101 | struct acpi_table_header *header = NULL; |
96 | struct acpi_table_attr *attr = NULL; | 102 | struct acpi_table_attr *attr = NULL; |
97 | 103 | ||
98 | memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE); | 104 | if (table_header->signature[0] != '\0') |
105 | memcpy(table_attr->name, table_header->signature, | ||
106 | ACPI_NAME_SIZE); | ||
107 | else | ||
108 | memcpy(table_attr->name, "NULL", 4); | ||
99 | 109 | ||
100 | list_for_each_entry(attr, &acpi_table_attr_list, node) { | 110 | list_for_each_entry(attr, &acpi_table_attr_list, node) { |
101 | if (!memcmp(table_header->signature, attr->name, | 111 | if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE)) |
102 | ACPI_NAME_SIZE)) | ||
103 | if (table_attr->instance < attr->instance) | 112 | if (table_attr->instance < attr->instance) |
104 | table_attr->instance = attr->instance; | 113 | table_attr->instance = attr->instance; |
105 | } | 114 | } |
106 | table_attr->instance++; | 115 | table_attr->instance++; |
107 | 116 | ||
108 | if (table_attr->instance > 1 || (table_attr->instance == 1 && | 117 | if (table_attr->instance > 1 || (table_attr->instance == 1 && |
109 | !acpi_get_table(table_header-> | 118 | !acpi_get_table |
110 | signature, 2, | 119 | (table_header->signature, 2, &header))) |
111 | &header))) | 120 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", |
112 | sprintf(table_attr->name + 4, "%d", table_attr->instance); | 121 | table_attr->instance); |
113 | 122 | ||
114 | table_attr->attr.size = 0; | 123 | table_attr->attr.size = 0; |
115 | table_attr->attr.read = acpi_table_show; | 124 | table_attr->attr.read = acpi_table_show; |
@@ -167,7 +176,6 @@ static int acpi_system_sysfs_init(void) | |||
167 | #define COUNT_ERROR 2 /* other */ | 176 | #define COUNT_ERROR 2 /* other */ |
168 | #define NUM_COUNTERS_EXTRA 3 | 177 | #define NUM_COUNTERS_EXTRA 3 |
169 | 178 | ||
170 | #define ACPI_EVENT_VALID 0x01 | ||
171 | struct event_counter { | 179 | struct event_counter { |
172 | u32 count; | 180 | u32 count; |
173 | u32 flags; | 181 | u32 flags; |
@@ -312,12 +320,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
312 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) | 320 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) |
313 | result = acpi_get_event_status(index - num_gpes, status); | 321 | result = acpi_get_event_status(index - num_gpes, status); |
314 | 322 | ||
315 | /* | ||
316 | * sleep/power button GPE/Fixed Event is enabled after acpi_system_init, | ||
317 | * check the status at runtime and mark it as valid once it's enabled | ||
318 | */ | ||
319 | if (!result && (*status & ACPI_EVENT_FLAG_ENABLED)) | ||
320 | all_counters[index].flags |= ACPI_EVENT_VALID; | ||
321 | end: | 323 | end: |
322 | return result; | 324 | return result; |
323 | } | 325 | } |
@@ -346,12 +348,14 @@ static ssize_t counter_show(struct kobject *kobj, | |||
346 | if (result) | 348 | if (result) |
347 | goto end; | 349 | goto end; |
348 | 350 | ||
349 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) | 351 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) |
350 | size += sprintf(buf + size, " invalid"); | 352 | size += sprintf(buf + size, " invalid"); |
351 | else if (status & ACPI_EVENT_FLAG_ENABLED) | 353 | else if (status & ACPI_EVENT_FLAG_ENABLED) |
352 | size += sprintf(buf + size, " enable"); | 354 | size += sprintf(buf + size, " enabled"); |
355 | else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) | ||
356 | size += sprintf(buf + size, " wake_enabled"); | ||
353 | else | 357 | else |
354 | size += sprintf(buf + size, " disable"); | 358 | size += sprintf(buf + size, " disabled"); |
355 | 359 | ||
356 | end: | 360 | end: |
357 | size += sprintf(buf + size, "\n"); | 361 | size += sprintf(buf + size, "\n"); |
@@ -385,7 +389,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
385 | if (result) | 389 | if (result) |
386 | goto end; | 390 | goto end; |
387 | 391 | ||
388 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { | 392 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) { |
389 | printk(KERN_WARNING PREFIX | 393 | printk(KERN_WARNING PREFIX |
390 | "Can not change Invalid GPE/Fixed Event status\n"); | 394 | "Can not change Invalid GPE/Fixed Event status\n"); |
391 | return -EINVAL; | 395 | return -EINVAL; |
@@ -394,10 +398,10 @@ static ssize_t counter_set(struct kobject *kobj, | |||
394 | if (index < num_gpes) { | 398 | if (index < num_gpes) { |
395 | if (!strcmp(buf, "disable\n") && | 399 | if (!strcmp(buf, "disable\n") && |
396 | (status & ACPI_EVENT_FLAG_ENABLED)) | 400 | (status & ACPI_EVENT_FLAG_ENABLED)) |
397 | result = acpi_disable_gpe(handle, index, ACPI_NOT_ISR); | 401 | result = acpi_disable_gpe(handle, index); |
398 | else if (!strcmp(buf, "enable\n") && | 402 | else if (!strcmp(buf, "enable\n") && |
399 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 403 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
400 | result = acpi_enable_gpe(handle, index, ACPI_NOT_ISR); | 404 | result = acpi_enable_gpe(handle, index); |
401 | else if (!strcmp(buf, "clear\n") && | 405 | else if (!strcmp(buf, "clear\n") && |
402 | (status & ACPI_EVENT_FLAG_SET)) | 406 | (status & ACPI_EVENT_FLAG_SET)) |
403 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); | 407 | result = acpi_clear_gpe(handle, index, ACPI_NOT_ISR); |
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c index 2c7885e7ffba..2817158fb6a1 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/tables/tbfadt.c | |||
@@ -304,7 +304,7 @@ static void acpi_tb_convert_fadt(void) | |||
304 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at | 304 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at |
305 | * offset 45, 55, 95, and the word located at offset 109, 110. | 305 | * offset 45, 55, 95, and the word located at offset 109, 110. |
306 | */ | 306 | */ |
307 | if (acpi_gbl_FADT.header.revision < 3) { | 307 | if (acpi_gbl_FADT.header.revision < FADT2_REVISION_ID) { |
308 | acpi_gbl_FADT.preferred_profile = 0; | 308 | acpi_gbl_FADT.preferred_profile = 0; |
309 | acpi_gbl_FADT.pstate_control = 0; | 309 | acpi_gbl_FADT.pstate_control = 0; |
310 | acpi_gbl_FADT.cst_control = 0; | 310 | acpi_gbl_FADT.cst_control = 0; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index ad6cae938f0b..073ff09218a9 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <acpi/acpi_bus.h> | 47 | #include <acpi/acpi_bus.h> |
48 | #include <acpi/acpi_drivers.h> | 48 | #include <acpi/acpi_drivers.h> |
49 | 49 | ||
50 | #define ACPI_THERMAL_COMPONENT 0x04000000 | ||
51 | #define ACPI_THERMAL_CLASS "thermal_zone" | 50 | #define ACPI_THERMAL_CLASS "thermal_zone" |
52 | #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" | 51 | #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" |
53 | #define ACPI_THERMAL_FILE_STATE "state" | 52 | #define ACPI_THERMAL_FILE_STATE "state" |
@@ -576,7 +575,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
576 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, | 575 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
577 | tz->trips.critical.flags.enabled); | 576 | tz->trips.critical.flags.enabled); |
578 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | 577 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, |
579 | tz->device->dev.bus_id, | 578 | dev_name(&tz->device->dev), |
580 | ACPI_THERMAL_NOTIFY_CRITICAL, | 579 | ACPI_THERMAL_NOTIFY_CRITICAL, |
581 | tz->trips.critical.flags.enabled); | 580 | tz->trips.critical.flags.enabled); |
582 | 581 | ||
@@ -605,7 +604,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) | |||
605 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, | 604 | acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
606 | tz->trips.hot.flags.enabled); | 605 | tz->trips.hot.flags.enabled); |
607 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, | 606 | acpi_bus_generate_netlink_event(tz->device->pnp.device_class, |
608 | tz->device->dev.bus_id, | 607 | dev_name(&tz->device->dev), |
609 | ACPI_THERMAL_NOTIFY_HOT, | 608 | ACPI_THERMAL_NOTIFY_HOT, |
610 | tz->trips.hot.flags.enabled); | 609 | tz->trips.hot.flags.enabled); |
611 | 610 | ||
@@ -1592,14 +1591,14 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | |||
1592 | acpi_thermal_check(tz); | 1591 | acpi_thermal_check(tz); |
1593 | acpi_bus_generate_proc_event(device, event, 0); | 1592 | acpi_bus_generate_proc_event(device, event, 0); |
1594 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 1593 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
1595 | device->dev.bus_id, event, 0); | 1594 | dev_name(&device->dev), event, 0); |
1596 | break; | 1595 | break; |
1597 | case ACPI_THERMAL_NOTIFY_DEVICES: | 1596 | case ACPI_THERMAL_NOTIFY_DEVICES: |
1598 | acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES); | 1597 | acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES); |
1599 | acpi_thermal_check(tz); | 1598 | acpi_thermal_check(tz); |
1600 | acpi_bus_generate_proc_event(device, event, 0); | 1599 | acpi_bus_generate_proc_event(device, event, 0); |
1601 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 1600 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
1602 | device->dev.bus_id, event, 0); | 1601 | dev_name(&device->dev), event, 0); |
1603 | break; | 1602 | break; |
1604 | default: | 1603 | default: |
1605 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1604 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index a29b0ccac65a..baa441929720 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <acpi/acpi_bus.h> | 41 | #include <acpi/acpi_bus.h> |
42 | #include <acpi/acpi_drivers.h> | 42 | #include <acpi/acpi_drivers.h> |
43 | 43 | ||
44 | #define ACPI_VIDEO_COMPONENT 0x08000000 | ||
45 | #define ACPI_VIDEO_CLASS "video" | 44 | #define ACPI_VIDEO_CLASS "video" |
46 | #define ACPI_VIDEO_BUS_NAME "Video Bus" | 45 | #define ACPI_VIDEO_BUS_NAME "Video Bus" |
47 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" | 46 | #define ACPI_VIDEO_DEVICE_NAME "Video Device" |
@@ -739,7 +738,8 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
739 | device->cap._DSS = 1; | 738 | device->cap._DSS = 1; |
740 | } | 739 | } |
741 | 740 | ||
742 | max_level = acpi_video_init_brightness(device); | 741 | if (acpi_video_backlight_support()) |
742 | max_level = acpi_video_init_brightness(device); | ||
743 | 743 | ||
744 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { | 744 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { |
745 | int result; | 745 | int result; |
@@ -785,18 +785,21 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
785 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 785 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
786 | 786 | ||
787 | } | 787 | } |
788 | if (device->cap._DCS && device->cap._DSS){ | 788 | |
789 | static int count = 0; | 789 | if (acpi_video_display_switch_support()) { |
790 | char *name; | 790 | |
791 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); | 791 | if (device->cap._DCS && device->cap._DSS) { |
792 | if (!name) | 792 | static int count; |
793 | return; | 793 | char *name; |
794 | sprintf(name, "acpi_video%d", count++); | 794 | name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); |
795 | device->output_dev = video_output_register(name, | 795 | if (!name) |
796 | NULL, device, &acpi_output_properties); | 796 | return; |
797 | kfree(name); | 797 | sprintf(name, "acpi_video%d", count++); |
798 | device->output_dev = video_output_register(name, | ||
799 | NULL, device, &acpi_output_properties); | ||
800 | kfree(name); | ||
801 | } | ||
798 | } | 802 | } |
799 | return; | ||
800 | } | 803 | } |
801 | 804 | ||
802 | /* | 805 | /* |
@@ -842,11 +845,16 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
842 | static int acpi_video_bus_check(struct acpi_video_bus *video) | 845 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
843 | { | 846 | { |
844 | acpi_status status = -ENOENT; | 847 | acpi_status status = -ENOENT; |
845 | 848 | struct device *dev; | |
846 | 849 | ||
847 | if (!video) | 850 | if (!video) |
848 | return -EINVAL; | 851 | return -EINVAL; |
849 | 852 | ||
853 | dev = acpi_get_physical_pci_device(video->device->handle); | ||
854 | if (!dev) | ||
855 | return -ENODEV; | ||
856 | put_device(dev); | ||
857 | |||
850 | /* Since there is no HID, CID and so on for VGA driver, we have | 858 | /* Since there is no HID, CID and so on for VGA driver, we have |
851 | * to check well known required nodes. | 859 | * to check well known required nodes. |
852 | */ | 860 | */ |
@@ -2094,12 +2102,6 @@ static int __init acpi_video_init(void) | |||
2094 | { | 2102 | { |
2095 | int result = 0; | 2103 | int result = 0; |
2096 | 2104 | ||
2097 | |||
2098 | /* | ||
2099 | acpi_dbg_level = 0xFFFFFFFF; | ||
2100 | acpi_dbg_layer = 0x08000000; | ||
2101 | */ | ||
2102 | |||
2103 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | 2105 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
2104 | if (!acpi_video_dir) | 2106 | if (!acpi_video_dir) |
2105 | return -ENODEV; | 2107 | return -ENODEV; |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c new file mode 100644 index 000000000000..f022eb6f5637 --- /dev/null +++ b/drivers/acpi/video_detect.c | |||
@@ -0,0 +1,267 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 SuSE Linux Products GmbH | ||
3 | * Thomas Renninger <trenn@suse.de> | ||
4 | * | ||
5 | * May be copied or modified under the terms of the GNU General Public License | ||
6 | * | ||
7 | * video_detect.c: | ||
8 | * Provides acpi_is_video_device() for early scanning of ACPI devices in scan.c | ||
9 | * There a Linux specific (Spec does not provide a HID for video devices) is | ||
10 | * assinged | ||
11 | * | ||
12 | * After PCI devices are glued with ACPI devices | ||
13 | * acpi_get_physical_pci_device() can be called to identify ACPI graphics | ||
14 | * devices for which a real graphics card is plugged in | ||
15 | * | ||
16 | * Now acpi_video_get_capabilities() can be called to check which | ||
17 | * capabilities the graphics cards plugged in support. The check for general | ||
18 | * video capabilities will be triggered by the first caller of | ||
19 | * acpi_video_get_capabilities(NULL); which will happen when the first | ||
20 | * backlight (or display output) switching supporting driver calls: | ||
21 | * acpi_video_backlight_support(); | ||
22 | * | ||
23 | * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B) | ||
24 | * are available, video.ko should be used to handle the device. | ||
25 | * | ||
26 | * Otherwise vendor specific drivers like thinkpad_acpi, asus_acpi, | ||
27 | * sony_acpi,... can take care about backlight brightness and display output | ||
28 | * switching. | ||
29 | * | ||
30 | * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m) | ||
31 | * this file will not be compiled, acpi_video_get_capabilities() and | ||
32 | * acpi_video_backlight_support() will always return 0 and vendor specific | ||
33 | * drivers always can handle backlight. | ||
34 | * | ||
35 | */ | ||
36 | |||
37 | #include <linux/acpi.h> | ||
38 | #include <linux/dmi.h> | ||
39 | |||
40 | ACPI_MODULE_NAME("video"); | ||
41 | #define _COMPONENT ACPI_VIDEO_COMPONENT | ||
42 | |||
43 | static long acpi_video_support; | ||
44 | static bool acpi_video_caps_checked; | ||
45 | |||
46 | static acpi_status | ||
47 | acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | ||
48 | void **retyurn_value) | ||
49 | { | ||
50 | long *cap = context; | ||
51 | acpi_handle h_dummy; | ||
52 | |||
53 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) && | ||
54 | ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) { | ||
55 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " | ||
56 | "support\n")); | ||
57 | *cap |= ACPI_VIDEO_BACKLIGHT; | ||
58 | /* We have backlight support, no need to scan further */ | ||
59 | return AE_CTRL_TERMINATE; | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* Returns true if the device is a video device which can be handled by | ||
65 | * video.ko. | ||
66 | * The device will get a Linux specific CID added in scan.c to | ||
67 | * identify the device as an ACPI graphics device | ||
68 | * Be aware that the graphics device may not be physically present | ||
69 | * Use acpi_video_get_capabilities() to detect general ACPI video | ||
70 | * capabilities of present cards | ||
71 | */ | ||
72 | long acpi_is_video_device(struct acpi_device *device) | ||
73 | { | ||
74 | acpi_handle h_dummy; | ||
75 | long video_caps = 0; | ||
76 | |||
77 | if (!device) | ||
78 | return 0; | ||
79 | |||
80 | /* Does this device able to support video switching ? */ | ||
81 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && | ||
82 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) | ||
83 | video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; | ||
84 | |||
85 | /* Does this device able to retrieve a video ROM ? */ | ||
86 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) | ||
87 | video_caps |= ACPI_VIDEO_ROM_AVAILABLE; | ||
88 | |||
89 | /* Does this device able to configure which video head to be POSTed ? */ | ||
90 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && | ||
91 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && | ||
92 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) | ||
93 | video_caps |= ACPI_VIDEO_DEVICE_POSTING; | ||
94 | |||
95 | /* Only check for backlight functionality if one of the above hit. */ | ||
96 | if (video_caps) | ||
97 | acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle, | ||
98 | ACPI_UINT32_MAX, acpi_backlight_cap_match, | ||
99 | &video_caps, NULL); | ||
100 | |||
101 | return video_caps; | ||
102 | } | ||
103 | EXPORT_SYMBOL(acpi_is_video_device); | ||
104 | |||
105 | static acpi_status | ||
106 | find_video(acpi_handle handle, u32 lvl, void *context, void **rv) | ||
107 | { | ||
108 | long *cap = context; | ||
109 | struct device *dev; | ||
110 | struct acpi_device *acpi_dev; | ||
111 | |||
112 | const struct acpi_device_id video_ids[] = { | ||
113 | {ACPI_VIDEO_HID, 0}, | ||
114 | {"", 0}, | ||
115 | }; | ||
116 | if (acpi_bus_get_device(handle, &acpi_dev)) | ||
117 | return AE_OK; | ||
118 | |||
119 | if (!acpi_match_device_ids(acpi_dev, video_ids)) { | ||
120 | dev = acpi_get_physical_pci_device(handle); | ||
121 | if (!dev) | ||
122 | return AE_OK; | ||
123 | put_device(dev); | ||
124 | *cap |= acpi_is_video_device(acpi_dev); | ||
125 | } | ||
126 | return AE_OK; | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | * Returns the video capabilities of a specific ACPI graphics device | ||
131 | * | ||
132 | * if NULL is passed as argument all ACPI devices are enumerated and | ||
133 | * all graphics capabilities of physically present devices are | ||
134 | * summerized and returned. This is cached and done only once. | ||
135 | */ | ||
136 | long acpi_video_get_capabilities(acpi_handle graphics_handle) | ||
137 | { | ||
138 | long caps = 0; | ||
139 | struct acpi_device *tmp_dev; | ||
140 | acpi_status status; | ||
141 | |||
142 | if (acpi_video_caps_checked && graphics_handle == NULL) | ||
143 | return acpi_video_support; | ||
144 | |||
145 | if (!graphics_handle) { | ||
146 | /* Only do the global walk through all graphics devices once */ | ||
147 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
148 | ACPI_UINT32_MAX, find_video, | ||
149 | &caps, NULL); | ||
150 | /* There might be boot param flags set already... */ | ||
151 | acpi_video_support |= caps; | ||
152 | acpi_video_caps_checked = 1; | ||
153 | /* Add blacklists here. Be careful to use the right *DMI* bits | ||
154 | * to still be able to override logic via boot params, e.g.: | ||
155 | * | ||
156 | * if (dmi_name_in_vendors("XY")) { | ||
157 | * acpi_video_support |= | ||
158 | * ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR; | ||
159 | * acpi_video_support |= | ||
160 | * ACPI_VIDEO_BACKLIGHT_DMI_VENDOR; | ||
161 | *} | ||
162 | */ | ||
163 | } else { | ||
164 | status = acpi_bus_get_device(graphics_handle, &tmp_dev); | ||
165 | if (ACPI_FAILURE(status)) { | ||
166 | ACPI_EXCEPTION((AE_INFO, status, "Invalid device")); | ||
167 | return 0; | ||
168 | } | ||
169 | acpi_walk_namespace(ACPI_TYPE_DEVICE, graphics_handle, | ||
170 | ACPI_UINT32_MAX, find_video, | ||
171 | &caps, NULL); | ||
172 | } | ||
173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "We have 0x%lX video support %s %s\n", | ||
174 | graphics_handle ? caps : acpi_video_support, | ||
175 | graphics_handle ? "on device " : "in general", | ||
176 | graphics_handle ? acpi_device_bid(tmp_dev) : "")); | ||
177 | return caps; | ||
178 | } | ||
179 | EXPORT_SYMBOL(acpi_video_get_capabilities); | ||
180 | |||
181 | /* Returns true if video.ko can do backlight switching */ | ||
182 | int acpi_video_backlight_support(void) | ||
183 | { | ||
184 | /* | ||
185 | * We must check whether the ACPI graphics device is physically plugged | ||
186 | * in. Therefore this must be called after binding PCI and ACPI devices | ||
187 | */ | ||
188 | if (!acpi_video_caps_checked) | ||
189 | acpi_video_get_capabilities(NULL); | ||
190 | |||
191 | /* First check for boot param -> highest prio */ | ||
192 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR) | ||
193 | return 0; | ||
194 | else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO) | ||
195 | return 1; | ||
196 | |||
197 | /* Then check for DMI blacklist -> second highest prio */ | ||
198 | if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VENDOR) | ||
199 | return 0; | ||
200 | else if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_DMI_VIDEO) | ||
201 | return 1; | ||
202 | |||
203 | /* Then go the default way */ | ||
204 | return acpi_video_support & ACPI_VIDEO_BACKLIGHT; | ||
205 | } | ||
206 | EXPORT_SYMBOL(acpi_video_backlight_support); | ||
207 | |||
208 | /* | ||
209 | * Returns true if video.ko can do display output switching. | ||
210 | * This does not work well/at all with binary graphics drivers | ||
211 | * which disable system io ranges and do it on their own. | ||
212 | */ | ||
213 | int acpi_video_display_switch_support(void) | ||
214 | { | ||
215 | if (!acpi_video_caps_checked) | ||
216 | acpi_video_get_capabilities(NULL); | ||
217 | |||
218 | if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR) | ||
219 | return 0; | ||
220 | else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO) | ||
221 | return 1; | ||
222 | |||
223 | if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR) | ||
224 | return 0; | ||
225 | else if (acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO) | ||
226 | return 1; | ||
227 | |||
228 | return acpi_video_support & ACPI_VIDEO_OUTPUT_SWITCHING; | ||
229 | } | ||
230 | EXPORT_SYMBOL(acpi_video_display_switch_support); | ||
231 | |||
232 | /* | ||
233 | * Use acpi_display_output=vendor/video or acpi_backlight=vendor/video | ||
234 | * To force that backlight or display output switching is processed by vendor | ||
235 | * specific acpi drivers or video.ko driver. | ||
236 | */ | ||
237 | int __init acpi_backlight(char *str) | ||
238 | { | ||
239 | if (str == NULL || *str == '\0') | ||
240 | return 1; | ||
241 | else { | ||
242 | if (!strcmp("vendor", str)) | ||
243 | acpi_video_support |= | ||
244 | ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR; | ||
245 | if (!strcmp("video", str)) | ||
246 | acpi_video_support |= | ||
247 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO; | ||
248 | } | ||
249 | return 1; | ||
250 | } | ||
251 | __setup("acpi_backlight=", acpi_backlight); | ||
252 | |||
253 | int __init acpi_display_output(char *str) | ||
254 | { | ||
255 | if (str == NULL || *str == '\0') | ||
256 | return 1; | ||
257 | else { | ||
258 | if (!strcmp("vendor", str)) | ||
259 | acpi_video_support |= | ||
260 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR; | ||
261 | if (!strcmp("video", str)) | ||
262 | acpi_video_support |= | ||
263 | ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO; | ||
264 | } | ||
265 | return 1; | ||
266 | } | ||
267 | __setup("acpi_display_output=", acpi_display_output); | ||
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index 47cd7baf9b1b..8a8b377712c9 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
@@ -660,7 +660,7 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data) | |||
660 | wblock->handler(event, wblock->handler_data); | 660 | wblock->handler(event, wblock->handler_data); |
661 | 661 | ||
662 | acpi_bus_generate_netlink_event( | 662 | acpi_bus_generate_netlink_event( |
663 | device->pnp.device_class, device->dev.bus_id, | 663 | device->pnp.device_class, dev_name(&device->dev), |
664 | event, 0); | 664 | event, 0); |
665 | break; | 665 | break; |
666 | } | 666 | } |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 2457b07dabd6..f4374437a033 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -523,7 +523,7 @@ static int acpi_driver_registered; | |||
523 | 523 | ||
524 | static int sonypi_ec_write(u8 addr, u8 value) | 524 | static int sonypi_ec_write(u8 addr, u8 value) |
525 | { | 525 | { |
526 | #ifdef CONFIG_ACPI_EC | 526 | #ifdef CONFIG_ACPI |
527 | if (SONYPI_ACPI_ACTIVE) | 527 | if (SONYPI_ACPI_ACTIVE) |
528 | return ec_write(addr, value); | 528 | return ec_write(addr, value); |
529 | #endif | 529 | #endif |
@@ -539,7 +539,7 @@ static int sonypi_ec_write(u8 addr, u8 value) | |||
539 | 539 | ||
540 | static int sonypi_ec_read(u8 addr, u8 *value) | 540 | static int sonypi_ec_read(u8 addr, u8 *value) |
541 | { | 541 | { |
542 | #ifdef CONFIG_ACPI_EC | 542 | #ifdef CONFIG_ACPI |
543 | if (SONYPI_ACPI_ACTIVE) | 543 | if (SONYPI_ACPI_ACTIVE) |
544 | return ec_read(addr, value); | 544 | return ec_read(addr, value); |
545 | #endif | 545 | #endif |
diff --git a/drivers/idle/Kconfig b/drivers/idle/Kconfig index 108264de0ac9..f15e90a453d1 100644 --- a/drivers/idle/Kconfig +++ b/drivers/idle/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | 1 | ||
2 | menu "Memory power savings" | 2 | menu "Memory power savings" |
3 | depends on X86_64 | ||
3 | 4 | ||
4 | config I7300_IDLE_IOAT_CHANNEL | 5 | config I7300_IDLE_IOAT_CHANNEL |
5 | bool | 6 | bool |
@@ -7,7 +8,7 @@ config I7300_IDLE_IOAT_CHANNEL | |||
7 | config I7300_IDLE | 8 | config I7300_IDLE |
8 | tristate "Intel chipset idle memory power saving driver" | 9 | tristate "Intel chipset idle memory power saving driver" |
9 | select I7300_IDLE_IOAT_CHANNEL | 10 | select I7300_IDLE_IOAT_CHANNEL |
10 | depends on X86_64 && EXPERIMENTAL | 11 | depends on EXPERIMENTAL |
11 | help | 12 | help |
12 | Enable memory power savings when idle with certain Intel server | 13 | Enable memory power savings when idle with certain Intel server |
13 | chipsets. The chipset must have I/O AT support, such as the | 14 | chipsets. The chipset must have I/O AT support, such as the |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index ecff98043589..160ef482712d 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -1102,9 +1102,7 @@ static u64 fw_vers_string_to_u64(struct iwch_dev *iwch_dev) | |||
1102 | char *cp, *next; | 1102 | char *cp, *next; |
1103 | unsigned fw_maj, fw_min, fw_mic; | 1103 | unsigned fw_maj, fw_min, fw_mic; |
1104 | 1104 | ||
1105 | rtnl_lock(); | ||
1106 | lldev->ethtool_ops->get_drvinfo(lldev, &info); | 1105 | lldev->ethtool_ops->get_drvinfo(lldev, &info); |
1107 | rtnl_unlock(); | ||
1108 | 1106 | ||
1109 | next = info.fw_version + 1; | 1107 | next = info.fw_version + 1; |
1110 | cp = strsep(&next, "."); | 1108 | cp = strsep(&next, "."); |
@@ -1192,9 +1190,7 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, ch | |||
1192 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; | 1190 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; |
1193 | 1191 | ||
1194 | PDBG("%s dev 0x%p\n", __func__, dev); | 1192 | PDBG("%s dev 0x%p\n", __func__, dev); |
1195 | rtnl_lock(); | ||
1196 | lldev->ethtool_ops->get_drvinfo(lldev, &info); | 1193 | lldev->ethtool_ops->get_drvinfo(lldev, &info); |
1197 | rtnl_unlock(); | ||
1198 | return sprintf(buf, "%s\n", info.fw_version); | 1194 | return sprintf(buf, "%s\n", info.fw_version); |
1199 | } | 1195 | } |
1200 | 1196 | ||
@@ -1207,9 +1203,7 @@ static ssize_t show_hca(struct device *dev, struct device_attribute *attr, | |||
1207 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; | 1203 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; |
1208 | 1204 | ||
1209 | PDBG("%s dev 0x%p\n", __func__, dev); | 1205 | PDBG("%s dev 0x%p\n", __func__, dev); |
1210 | rtnl_lock(); | ||
1211 | lldev->ethtool_ops->get_drvinfo(lldev, &info); | 1206 | lldev->ethtool_ops->get_drvinfo(lldev, &info); |
1212 | rtnl_unlock(); | ||
1213 | return sprintf(buf, "%s\n", info.driver); | 1207 | return sprintf(buf, "%s\n", info.driver); |
1214 | } | 1208 | } |
1215 | 1209 | ||
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 3e4585c2318a..19661b2f0406 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -745,7 +745,6 @@ int iwch_post_zb_read(struct iwch_qp *qhp) | |||
745 | wqe->read.rdmaop = T3_READ_REQ; | 745 | wqe->read.rdmaop = T3_READ_REQ; |
746 | wqe->read.reserved[0] = 0; | 746 | wqe->read.reserved[0] = 0; |
747 | wqe->read.reserved[1] = 0; | 747 | wqe->read.reserved[1] = 0; |
748 | wqe->read.reserved[2] = 0; | ||
749 | wqe->read.rem_stag = cpu_to_be32(1); | 748 | wqe->read.rem_stag = cpu_to_be32(1); |
750 | wqe->read.rem_to = cpu_to_be64(1); | 749 | wqe->read.rem_to = cpu_to_be64(1); |
751 | wqe->read.local_stag = cpu_to_be32(1); | 750 | wqe->read.local_stag = cpu_to_be32(1); |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index cb55be04442c..757035ea246f 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
@@ -359,36 +359,48 @@ static void notify_port_conf_change(struct ehca_shca *shca, int port_num) | |||
359 | *old_attr = new_attr; | 359 | *old_attr = new_attr; |
360 | } | 360 | } |
361 | 361 | ||
362 | /* replay modify_qp for sqps -- return 0 if all is well, 1 if AQP1 destroyed */ | ||
363 | static int replay_modify_qp(struct ehca_sport *sport) | ||
364 | { | ||
365 | int aqp1_destroyed; | ||
366 | unsigned long flags; | ||
367 | |||
368 | spin_lock_irqsave(&sport->mod_sqp_lock, flags); | ||
369 | |||
370 | aqp1_destroyed = !sport->ibqp_sqp[IB_QPT_GSI]; | ||
371 | |||
372 | if (sport->ibqp_sqp[IB_QPT_SMI]) | ||
373 | ehca_recover_sqp(sport->ibqp_sqp[IB_QPT_SMI]); | ||
374 | if (!aqp1_destroyed) | ||
375 | ehca_recover_sqp(sport->ibqp_sqp[IB_QPT_GSI]); | ||
376 | |||
377 | spin_unlock_irqrestore(&sport->mod_sqp_lock, flags); | ||
378 | |||
379 | return aqp1_destroyed; | ||
380 | } | ||
381 | |||
362 | static void parse_ec(struct ehca_shca *shca, u64 eqe) | 382 | static void parse_ec(struct ehca_shca *shca, u64 eqe) |
363 | { | 383 | { |
364 | u8 ec = EHCA_BMASK_GET(NEQE_EVENT_CODE, eqe); | 384 | u8 ec = EHCA_BMASK_GET(NEQE_EVENT_CODE, eqe); |
365 | u8 port = EHCA_BMASK_GET(NEQE_PORT_NUMBER, eqe); | 385 | u8 port = EHCA_BMASK_GET(NEQE_PORT_NUMBER, eqe); |
366 | u8 spec_event; | 386 | u8 spec_event; |
367 | struct ehca_sport *sport = &shca->sport[port - 1]; | 387 | struct ehca_sport *sport = &shca->sport[port - 1]; |
368 | unsigned long flags; | ||
369 | 388 | ||
370 | switch (ec) { | 389 | switch (ec) { |
371 | case 0x30: /* port availability change */ | 390 | case 0x30: /* port availability change */ |
372 | if (EHCA_BMASK_GET(NEQE_PORT_AVAILABILITY, eqe)) { | 391 | if (EHCA_BMASK_GET(NEQE_PORT_AVAILABILITY, eqe)) { |
373 | int suppress_event; | 392 | /* only replay modify_qp calls in autodetect mode; |
374 | /* replay modify_qp for sqps */ | 393 | * if AQP1 was destroyed, the port is already down |
375 | spin_lock_irqsave(&sport->mod_sqp_lock, flags); | 394 | * again and we can drop the event. |
376 | suppress_event = !sport->ibqp_sqp[IB_QPT_GSI]; | 395 | */ |
377 | if (sport->ibqp_sqp[IB_QPT_SMI]) | 396 | if (ehca_nr_ports < 0) |
378 | ehca_recover_sqp(sport->ibqp_sqp[IB_QPT_SMI]); | 397 | if (replay_modify_qp(sport)) |
379 | if (!suppress_event) | 398 | break; |
380 | ehca_recover_sqp(sport->ibqp_sqp[IB_QPT_GSI]); | ||
381 | spin_unlock_irqrestore(&sport->mod_sqp_lock, flags); | ||
382 | |||
383 | /* AQP1 was destroyed, ignore this event */ | ||
384 | if (suppress_event) | ||
385 | break; | ||
386 | 399 | ||
387 | sport->port_state = IB_PORT_ACTIVE; | 400 | sport->port_state = IB_PORT_ACTIVE; |
388 | dispatch_port_event(shca, port, IB_EVENT_PORT_ACTIVE, | 401 | dispatch_port_event(shca, port, IB_EVENT_PORT_ACTIVE, |
389 | "is active"); | 402 | "is active"); |
390 | ehca_query_sma_attr(shca, port, | 403 | ehca_query_sma_attr(shca, port, &sport->saved_attr); |
391 | &sport->saved_attr); | ||
392 | } else { | 404 | } else { |
393 | sport->port_state = IB_PORT_DOWN; | 405 | sport->port_state = IB_PORT_DOWN; |
394 | dispatch_port_event(shca, port, IB_EVENT_PORT_ERR, | 406 | dispatch_port_event(shca, port, IB_EVENT_PORT_ERR, |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 4d54b9f64567..9e05ee2db39b 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -860,6 +860,11 @@ static struct ehca_qp *internal_create_qp( | |||
860 | if (qp_type == IB_QPT_GSI) { | 860 | if (qp_type == IB_QPT_GSI) { |
861 | h_ret = ehca_define_sqp(shca, my_qp, init_attr); | 861 | h_ret = ehca_define_sqp(shca, my_qp, init_attr); |
862 | if (h_ret != H_SUCCESS) { | 862 | if (h_ret != H_SUCCESS) { |
863 | kfree(my_qp->mod_qp_parm); | ||
864 | my_qp->mod_qp_parm = NULL; | ||
865 | /* the QP pointer is no longer valid */ | ||
866 | shca->sport[init_attr->port_num - 1].ibqp_sqp[qp_type] = | ||
867 | NULL; | ||
863 | ret = ehca2ib_return_code(h_ret); | 868 | ret = ehca2ib_return_code(h_ret); |
864 | goto create_qp_exit6; | 869 | goto create_qp_exit6; |
865 | } | 870 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index fc0f6d9e6030..2296832f94da 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c | |||
@@ -156,7 +156,7 @@ bail: | |||
156 | /** | 156 | /** |
157 | * ipath_get_rwqe - copy the next RWQE into the QP's RWQE | 157 | * ipath_get_rwqe - copy the next RWQE into the QP's RWQE |
158 | * @qp: the QP | 158 | * @qp: the QP |
159 | * @wr_id_only: update wr_id only, not SGEs | 159 | * @wr_id_only: update qp->r_wr_id only, not qp->r_sge |
160 | * | 160 | * |
161 | * Return 0 if no RWQE is available, otherwise return 1. | 161 | * Return 0 if no RWQE is available, otherwise return 1. |
162 | * | 162 | * |
@@ -173,8 +173,6 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) | |||
173 | u32 tail; | 173 | u32 tail; |
174 | int ret; | 174 | int ret; |
175 | 175 | ||
176 | qp->r_sge.sg_list = qp->r_sg_list; | ||
177 | |||
178 | if (qp->ibqp.srq) { | 176 | if (qp->ibqp.srq) { |
179 | srq = to_isrq(qp->ibqp.srq); | 177 | srq = to_isrq(qp->ibqp.srq); |
180 | handler = srq->ibsrq.event_handler; | 178 | handler = srq->ibsrq.event_handler; |
@@ -206,8 +204,10 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) | |||
206 | wqe = get_rwqe_ptr(rq, tail); | 204 | wqe = get_rwqe_ptr(rq, tail); |
207 | if (++tail >= rq->size) | 205 | if (++tail >= rq->size) |
208 | tail = 0; | 206 | tail = 0; |
209 | } while (!wr_id_only && !ipath_init_sge(qp, wqe, &qp->r_len, | 207 | if (wr_id_only) |
210 | &qp->r_sge)); | 208 | break; |
209 | qp->r_sge.sg_list = qp->r_sg_list; | ||
210 | } while (!ipath_init_sge(qp, wqe, &qp->r_len, &qp->r_sge)); | ||
211 | qp->r_wr_id = wqe->wr_id; | 211 | qp->r_wr_id = wqe->wr_id; |
212 | wq->tail = tail; | 212 | wq->tail = tail; |
213 | 213 | ||
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 87f5c5a87b98..8e4d26d56a95 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
@@ -205,6 +205,7 @@ struct ib_mr *mlx4_ib_alloc_fast_reg_mr(struct ib_pd *pd, | |||
205 | goto err_mr; | 205 | goto err_mr; |
206 | 206 | ||
207 | mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; | 207 | mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; |
208 | mr->umem = NULL; | ||
208 | 209 | ||
209 | return &mr->ibmr; | 210 | return &mr->ibmr; |
210 | 211 | ||
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c index a2b04d62b1a4..aa1dc41f04c8 100644 --- a/drivers/infiniband/hw/nes/nes.c +++ b/drivers/infiniband/hw/nes/nes.c | |||
@@ -95,6 +95,10 @@ unsigned int wqm_quanta = 0x10000; | |||
95 | module_param(wqm_quanta, int, 0644); | 95 | module_param(wqm_quanta, int, 0644); |
96 | MODULE_PARM_DESC(wqm_quanta, "WQM quanta"); | 96 | MODULE_PARM_DESC(wqm_quanta, "WQM quanta"); |
97 | 97 | ||
98 | static unsigned int limit_maxrdreqsz; | ||
99 | module_param(limit_maxrdreqsz, bool, 0644); | ||
100 | MODULE_PARM_DESC(limit_maxrdreqsz, "Limit max read request size to 256 Bytes"); | ||
101 | |||
98 | LIST_HEAD(nes_adapter_list); | 102 | LIST_HEAD(nes_adapter_list); |
99 | static LIST_HEAD(nes_dev_list); | 103 | static LIST_HEAD(nes_dev_list); |
100 | 104 | ||
@@ -588,6 +592,18 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i | |||
588 | nesdev->nesadapter->port_count; | 592 | nesdev->nesadapter->port_count; |
589 | } | 593 | } |
590 | 594 | ||
595 | if ((limit_maxrdreqsz || | ||
596 | ((nesdev->nesadapter->phy_type[0] == NES_PHY_TYPE_GLADIUS) && | ||
597 | (hw_rev == NE020_REV1))) && | ||
598 | (pcie_get_readrq(pcidev) > 256)) { | ||
599 | if (pcie_set_readrq(pcidev, 256)) | ||
600 | printk(KERN_ERR PFX "Unable to set max read request" | ||
601 | " to 256 bytes\n"); | ||
602 | else | ||
603 | nes_debug(NES_DBG_INIT, "Max read request size set" | ||
604 | " to 256 bytes\n"); | ||
605 | } | ||
606 | |||
591 | tasklet_init(&nesdev->dpc_tasklet, nes_dpc, (unsigned long)nesdev); | 607 | tasklet_init(&nesdev->dpc_tasklet, nes_dpc, (unsigned long)nesdev); |
592 | 608 | ||
593 | /* bring up the Control QP */ | 609 | /* bring up the Control QP */ |
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h index 610b9d859597..bc0b4de04450 100644 --- a/drivers/infiniband/hw/nes/nes_hw.h +++ b/drivers/infiniband/hw/nes/nes_hw.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define NES_PHY_TYPE_ARGUS 4 | 40 | #define NES_PHY_TYPE_ARGUS 4 |
41 | #define NES_PHY_TYPE_PUMA_1G 5 | 41 | #define NES_PHY_TYPE_PUMA_1G 5 |
42 | #define NES_PHY_TYPE_PUMA_10G 6 | 42 | #define NES_PHY_TYPE_PUMA_10G 6 |
43 | #define NES_PHY_TYPE_GLADIUS 7 | ||
43 | 44 | ||
44 | #define NES_MULTICAST_PF_MAX 8 | 45 | #define NES_MULTICAST_PF_MAX 8 |
45 | 46 | ||
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 932e56fcf774..d36c9a0bf1bb 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -220,14 +220,14 @@ static int nes_bind_mw(struct ib_qp *ibqp, struct ib_mw *ibmw, | |||
220 | if (nesqp->ibqp_state > IB_QPS_RTS) | 220 | if (nesqp->ibqp_state > IB_QPS_RTS) |
221 | return -EINVAL; | 221 | return -EINVAL; |
222 | 222 | ||
223 | spin_lock_irqsave(&nesqp->lock, flags); | 223 | spin_lock_irqsave(&nesqp->lock, flags); |
224 | 224 | ||
225 | head = nesqp->hwqp.sq_head; | 225 | head = nesqp->hwqp.sq_head; |
226 | qsize = nesqp->hwqp.sq_tail; | 226 | qsize = nesqp->hwqp.sq_tail; |
227 | 227 | ||
228 | /* Check for SQ overflow */ | 228 | /* Check for SQ overflow */ |
229 | if (((head + (2 * qsize) - nesqp->hwqp.sq_tail) % qsize) == (qsize - 1)) { | 229 | if (((head + (2 * qsize) - nesqp->hwqp.sq_tail) % qsize) == (qsize - 1)) { |
230 | spin_unlock_irqrestore(&nesqp->lock, flags); | 230 | spin_unlock_irqrestore(&nesqp->lock, flags); |
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | } | 232 | } |
233 | 233 | ||
@@ -269,7 +269,7 @@ static int nes_bind_mw(struct ib_qp *ibqp, struct ib_mw *ibmw, | |||
269 | nes_write32(nesdev->regs+NES_WQE_ALLOC, | 269 | nes_write32(nesdev->regs+NES_WQE_ALLOC, |
270 | (1 << 24) | 0x00800000 | nesqp->hwqp.qp_id); | 270 | (1 << 24) | 0x00800000 | nesqp->hwqp.qp_id); |
271 | 271 | ||
272 | spin_unlock_irqrestore(&nesqp->lock, flags); | 272 | spin_unlock_irqrestore(&nesqp->lock, flags); |
273 | 273 | ||
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
@@ -349,7 +349,7 @@ static struct ib_fmr *nes_alloc_fmr(struct ib_pd *ibpd, | |||
349 | if (nesfmr->nesmr.pbls_used > nesadapter->free_4kpbl) { | 349 | if (nesfmr->nesmr.pbls_used > nesadapter->free_4kpbl) { |
350 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); | 350 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); |
351 | ret = -ENOMEM; | 351 | ret = -ENOMEM; |
352 | goto failed_vpbl_alloc; | 352 | goto failed_vpbl_avail; |
353 | } else { | 353 | } else { |
354 | nesadapter->free_4kpbl -= nesfmr->nesmr.pbls_used; | 354 | nesadapter->free_4kpbl -= nesfmr->nesmr.pbls_used; |
355 | } | 355 | } |
@@ -357,7 +357,7 @@ static struct ib_fmr *nes_alloc_fmr(struct ib_pd *ibpd, | |||
357 | if (nesfmr->nesmr.pbls_used > nesadapter->free_256pbl) { | 357 | if (nesfmr->nesmr.pbls_used > nesadapter->free_256pbl) { |
358 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); | 358 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); |
359 | ret = -ENOMEM; | 359 | ret = -ENOMEM; |
360 | goto failed_vpbl_alloc; | 360 | goto failed_vpbl_avail; |
361 | } else { | 361 | } else { |
362 | nesadapter->free_256pbl -= nesfmr->nesmr.pbls_used; | 362 | nesadapter->free_256pbl -= nesfmr->nesmr.pbls_used; |
363 | } | 363 | } |
@@ -391,14 +391,14 @@ static struct ib_fmr *nes_alloc_fmr(struct ib_pd *ibpd, | |||
391 | goto failed_vpbl_alloc; | 391 | goto failed_vpbl_alloc; |
392 | } | 392 | } |
393 | 393 | ||
394 | nesfmr->root_vpbl.leaf_vpbl = kzalloc(sizeof(*nesfmr->root_vpbl.leaf_vpbl)*1024, GFP_KERNEL); | 394 | nesfmr->leaf_pbl_cnt = nesfmr->nesmr.pbls_used-1; |
395 | nesfmr->root_vpbl.leaf_vpbl = kzalloc(sizeof(*nesfmr->root_vpbl.leaf_vpbl)*1024, GFP_ATOMIC); | ||
395 | if (!nesfmr->root_vpbl.leaf_vpbl) { | 396 | if (!nesfmr->root_vpbl.leaf_vpbl) { |
396 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); | 397 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); |
397 | ret = -ENOMEM; | 398 | ret = -ENOMEM; |
398 | goto failed_leaf_vpbl_alloc; | 399 | goto failed_leaf_vpbl_alloc; |
399 | } | 400 | } |
400 | 401 | ||
401 | nesfmr->leaf_pbl_cnt = nesfmr->nesmr.pbls_used-1; | ||
402 | nes_debug(NES_DBG_MR, "two level pbl, root_vpbl.pbl_vbase=%p" | 402 | nes_debug(NES_DBG_MR, "two level pbl, root_vpbl.pbl_vbase=%p" |
403 | " leaf_pbl_cnt=%d root_vpbl.leaf_vpbl=%p\n", | 403 | " leaf_pbl_cnt=%d root_vpbl.leaf_vpbl=%p\n", |
404 | nesfmr->root_vpbl.pbl_vbase, nesfmr->leaf_pbl_cnt, nesfmr->root_vpbl.leaf_vpbl); | 404 | nesfmr->root_vpbl.pbl_vbase, nesfmr->leaf_pbl_cnt, nesfmr->root_vpbl.leaf_vpbl); |
@@ -519,6 +519,16 @@ static struct ib_fmr *nes_alloc_fmr(struct ib_pd *ibpd, | |||
519 | nesfmr->root_vpbl.pbl_pbase); | 519 | nesfmr->root_vpbl.pbl_pbase); |
520 | 520 | ||
521 | failed_vpbl_alloc: | 521 | failed_vpbl_alloc: |
522 | if (nesfmr->nesmr.pbls_used != 0) { | ||
523 | spin_lock_irqsave(&nesadapter->pbl_lock, flags); | ||
524 | if (nesfmr->nesmr.pbl_4k) | ||
525 | nesadapter->free_4kpbl += nesfmr->nesmr.pbls_used; | ||
526 | else | ||
527 | nesadapter->free_256pbl += nesfmr->nesmr.pbls_used; | ||
528 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); | ||
529 | } | ||
530 | |||
531 | failed_vpbl_avail: | ||
522 | kfree(nesfmr); | 532 | kfree(nesfmr); |
523 | 533 | ||
524 | failed_fmr_alloc: | 534 | failed_fmr_alloc: |
@@ -534,18 +544,14 @@ static struct ib_fmr *nes_alloc_fmr(struct ib_pd *ibpd, | |||
534 | */ | 544 | */ |
535 | static int nes_dealloc_fmr(struct ib_fmr *ibfmr) | 545 | static int nes_dealloc_fmr(struct ib_fmr *ibfmr) |
536 | { | 546 | { |
547 | unsigned long flags; | ||
537 | struct nes_mr *nesmr = to_nesmr_from_ibfmr(ibfmr); | 548 | struct nes_mr *nesmr = to_nesmr_from_ibfmr(ibfmr); |
538 | struct nes_fmr *nesfmr = to_nesfmr(nesmr); | 549 | struct nes_fmr *nesfmr = to_nesfmr(nesmr); |
539 | struct nes_vnic *nesvnic = to_nesvnic(ibfmr->device); | 550 | struct nes_vnic *nesvnic = to_nesvnic(ibfmr->device); |
540 | struct nes_device *nesdev = nesvnic->nesdev; | 551 | struct nes_device *nesdev = nesvnic->nesdev; |
541 | struct nes_mr temp_nesmr = *nesmr; | 552 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
542 | int i = 0; | 553 | int i = 0; |
543 | 554 | ||
544 | temp_nesmr.ibmw.device = ibfmr->device; | ||
545 | temp_nesmr.ibmw.pd = ibfmr->pd; | ||
546 | temp_nesmr.ibmw.rkey = ibfmr->rkey; | ||
547 | temp_nesmr.ibmw.uobject = NULL; | ||
548 | |||
549 | /* free the resources */ | 555 | /* free the resources */ |
550 | if (nesfmr->leaf_pbl_cnt == 0) { | 556 | if (nesfmr->leaf_pbl_cnt == 0) { |
551 | /* single PBL case */ | 557 | /* single PBL case */ |
@@ -561,8 +567,24 @@ static int nes_dealloc_fmr(struct ib_fmr *ibfmr) | |||
561 | pci_free_consistent(nesdev->pcidev, 8192, nesfmr->root_vpbl.pbl_vbase, | 567 | pci_free_consistent(nesdev->pcidev, 8192, nesfmr->root_vpbl.pbl_vbase, |
562 | nesfmr->root_vpbl.pbl_pbase); | 568 | nesfmr->root_vpbl.pbl_pbase); |
563 | } | 569 | } |
570 | nesmr->ibmw.device = ibfmr->device; | ||
571 | nesmr->ibmw.pd = ibfmr->pd; | ||
572 | nesmr->ibmw.rkey = ibfmr->rkey; | ||
573 | nesmr->ibmw.uobject = NULL; | ||
564 | 574 | ||
565 | return nes_dealloc_mw(&temp_nesmr.ibmw); | 575 | if (nesfmr->nesmr.pbls_used != 0) { |
576 | spin_lock_irqsave(&nesadapter->pbl_lock, flags); | ||
577 | if (nesfmr->nesmr.pbl_4k) { | ||
578 | nesadapter->free_4kpbl += nesfmr->nesmr.pbls_used; | ||
579 | WARN_ON(nesadapter->free_4kpbl > nesadapter->max_4kpbl); | ||
580 | } else { | ||
581 | nesadapter->free_256pbl += nesfmr->nesmr.pbls_used; | ||
582 | WARN_ON(nesadapter->free_256pbl > nesadapter->max_256pbl); | ||
583 | } | ||
584 | spin_unlock_irqrestore(&nesadapter->pbl_lock, flags); | ||
585 | } | ||
586 | |||
587 | return nes_dealloc_mw(&nesmr->ibmw); | ||
566 | } | 588 | } |
567 | 589 | ||
568 | 590 | ||
@@ -1595,7 +1617,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1595 | nes_ucontext->mcrqf = req.mcrqf; | 1617 | nes_ucontext->mcrqf = req.mcrqf; |
1596 | if (nes_ucontext->mcrqf) { | 1618 | if (nes_ucontext->mcrqf) { |
1597 | if (nes_ucontext->mcrqf & 0x80000000) | 1619 | if (nes_ucontext->mcrqf & 0x80000000) |
1598 | nescq->hw_cq.cq_number = nesvnic->nic.qp_id + 12 + (nes_ucontext->mcrqf & 0xf) - 1; | 1620 | nescq->hw_cq.cq_number = nesvnic->nic.qp_id + 28 + 2 * ((nes_ucontext->mcrqf & 0xf) - 1); |
1599 | else if (nes_ucontext->mcrqf & 0x40000000) | 1621 | else if (nes_ucontext->mcrqf & 0x40000000) |
1600 | nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; | 1622 | nescq->hw_cq.cq_number = nes_ucontext->mcrqf & 0xffff; |
1601 | else | 1623 | else |
@@ -3212,7 +3234,7 @@ static int nes_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
3212 | if (nesqp->ibqp_state > IB_QPS_RTS) | 3234 | if (nesqp->ibqp_state > IB_QPS_RTS) |
3213 | return -EINVAL; | 3235 | return -EINVAL; |
3214 | 3236 | ||
3215 | spin_lock_irqsave(&nesqp->lock, flags); | 3237 | spin_lock_irqsave(&nesqp->lock, flags); |
3216 | 3238 | ||
3217 | head = nesqp->hwqp.sq_head; | 3239 | head = nesqp->hwqp.sq_head; |
3218 | 3240 | ||
@@ -3337,7 +3359,7 @@ static int nes_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr, | |||
3337 | (counter << 24) | 0x00800000 | nesqp->hwqp.qp_id); | 3359 | (counter << 24) | 0x00800000 | nesqp->hwqp.qp_id); |
3338 | } | 3360 | } |
3339 | 3361 | ||
3340 | spin_unlock_irqrestore(&nesqp->lock, flags); | 3362 | spin_unlock_irqrestore(&nesqp->lock, flags); |
3341 | 3363 | ||
3342 | if (err) | 3364 | if (err) |
3343 | *bad_wr = ib_wr; | 3365 | *bad_wr = ib_wr; |
@@ -3368,7 +3390,7 @@ static int nes_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, | |||
3368 | if (nesqp->ibqp_state > IB_QPS_RTS) | 3390 | if (nesqp->ibqp_state > IB_QPS_RTS) |
3369 | return -EINVAL; | 3391 | return -EINVAL; |
3370 | 3392 | ||
3371 | spin_lock_irqsave(&nesqp->lock, flags); | 3393 | spin_lock_irqsave(&nesqp->lock, flags); |
3372 | 3394 | ||
3373 | head = nesqp->hwqp.rq_head; | 3395 | head = nesqp->hwqp.rq_head; |
3374 | 3396 | ||
@@ -3421,7 +3443,7 @@ static int nes_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, | |||
3421 | nes_write32(nesdev->regs+NES_WQE_ALLOC, (counter<<24) | nesqp->hwqp.qp_id); | 3443 | nes_write32(nesdev->regs+NES_WQE_ALLOC, (counter<<24) | nesqp->hwqp.qp_id); |
3422 | } | 3444 | } |
3423 | 3445 | ||
3424 | spin_unlock_irqrestore(&nesqp->lock, flags); | 3446 | spin_unlock_irqrestore(&nesqp->lock, flags); |
3425 | 3447 | ||
3426 | if (err) | 3448 | if (err) |
3427 | *bad_wr = ib_wr; | 3449 | *bad_wr = ib_wr; |
@@ -3453,7 +3475,7 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry) | |||
3453 | 3475 | ||
3454 | nes_debug(NES_DBG_CQ, "\n"); | 3476 | nes_debug(NES_DBG_CQ, "\n"); |
3455 | 3477 | ||
3456 | spin_lock_irqsave(&nescq->lock, flags); | 3478 | spin_lock_irqsave(&nescq->lock, flags); |
3457 | 3479 | ||
3458 | head = nescq->hw_cq.cq_head; | 3480 | head = nescq->hw_cq.cq_head; |
3459 | cq_size = nescq->hw_cq.cq_size; | 3481 | cq_size = nescq->hw_cq.cq_size; |
@@ -3562,7 +3584,7 @@ static int nes_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry) | |||
3562 | nes_debug(NES_DBG_CQ, "Reporting %u completions for CQ%u.\n", | 3584 | nes_debug(NES_DBG_CQ, "Reporting %u completions for CQ%u.\n", |
3563 | cqe_count, nescq->hw_cq.cq_number); | 3585 | cqe_count, nescq->hw_cq.cq_number); |
3564 | 3586 | ||
3565 | spin_unlock_irqrestore(&nescq->lock, flags); | 3587 | spin_unlock_irqrestore(&nescq->lock, flags); |
3566 | 3588 | ||
3567 | return cqe_count; | 3589 | return cqe_count; |
3568 | } | 3590 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index fddded7900d1..85257f6b9576 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -106,12 +106,13 @@ int ipoib_open(struct net_device *dev) | |||
106 | 106 | ||
107 | ipoib_dbg(priv, "bringing up interface\n"); | 107 | ipoib_dbg(priv, "bringing up interface\n"); |
108 | 108 | ||
109 | napi_enable(&priv->napi); | ||
110 | set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); | 109 | set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags); |
111 | 110 | ||
112 | if (ipoib_pkey_dev_delay_open(dev)) | 111 | if (ipoib_pkey_dev_delay_open(dev)) |
113 | return 0; | 112 | return 0; |
114 | 113 | ||
114 | napi_enable(&priv->napi); | ||
115 | |||
115 | if (ipoib_ib_dev_open(dev)) { | 116 | if (ipoib_ib_dev_open(dev)) { |
116 | napi_disable(&priv->napi); | 117 | napi_disable(&priv->napi); |
117 | return -EINVAL; | 118 | return -EINVAL; |
@@ -546,6 +547,7 @@ static int path_rec_start(struct net_device *dev, | |||
546 | if (path->query_id < 0) { | 547 | if (path->query_id < 0) { |
547 | ipoib_warn(priv, "ib_sa_path_rec_get failed: %d\n", path->query_id); | 548 | ipoib_warn(priv, "ib_sa_path_rec_get failed: %d\n", path->query_id); |
548 | path->query = NULL; | 549 | path->query = NULL; |
550 | complete(&path->done); | ||
549 | return path->query_id; | 551 | return path->query_id; |
550 | } | 552 | } |
551 | 553 | ||
@@ -662,7 +664,7 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, | |||
662 | skb_push(skb, sizeof *phdr); | 664 | skb_push(skb, sizeof *phdr); |
663 | __skb_queue_tail(&path->queue, skb); | 665 | __skb_queue_tail(&path->queue, skb); |
664 | 666 | ||
665 | if (path_rec_start(dev, path)) { | 667 | if (!path->query && path_rec_start(dev, path)) { |
666 | spin_unlock_irqrestore(&priv->lock, flags); | 668 | spin_unlock_irqrestore(&priv->lock, flags); |
667 | path_free(dev, path); | 669 | path_free(dev, path); |
668 | return; | 670 | return; |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 9494400e8fd0..4494ad27cbf1 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -230,7 +230,7 @@ config HP_WMI | |||
230 | config MSI_LAPTOP | 230 | config MSI_LAPTOP |
231 | tristate "MSI Laptop Extras" | 231 | tristate "MSI Laptop Extras" |
232 | depends on X86 | 232 | depends on X86 |
233 | depends on ACPI_EC | 233 | depends on ACPI |
234 | depends on BACKLIGHT_CLASS_DEVICE | 234 | depends on BACKLIGHT_CLASS_DEVICE |
235 | ---help--- | 235 | ---help--- |
236 | This is a driver for laptops built by MSI (MICRO-STAR | 236 | This is a driver for laptops built by MSI (MICRO-STAR |
@@ -260,7 +260,7 @@ config PANASONIC_LAPTOP | |||
260 | config COMPAL_LAPTOP | 260 | config COMPAL_LAPTOP |
261 | tristate "Compal Laptop Extras" | 261 | tristate "Compal Laptop Extras" |
262 | depends on X86 | 262 | depends on X86 |
263 | depends on ACPI_EC | 263 | depends on ACPI |
264 | depends on BACKLIGHT_CLASS_DEVICE | 264 | depends on BACKLIGHT_CLASS_DEVICE |
265 | ---help--- | 265 | ---help--- |
266 | This is a driver for laptops built by Compal: | 266 | This is a driver for laptops built by Compal: |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index 0532a2de2ce4..94c9f911824e 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -1297,6 +1297,12 @@ static int __init acer_wmi_init(void) | |||
1297 | 1297 | ||
1298 | set_quirks(); | 1298 | set_quirks(); |
1299 | 1299 | ||
1300 | if (!acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) { | ||
1301 | interface->capability &= ~ACER_CAP_BRIGHTNESS; | ||
1302 | printk(ACER_INFO "Brightness must be controlled by " | ||
1303 | "generic video driver\n"); | ||
1304 | } | ||
1305 | |||
1300 | if (platform_driver_register(&acer_platform_driver)) { | 1306 | if (platform_driver_register(&acer_platform_driver)) { |
1301 | printk(ACER_ERR "Unable to register platform driver.\n"); | 1307 | printk(ACER_ERR "Unable to register platform driver.\n"); |
1302 | goto error_platform_register; | 1308 | goto error_platform_register; |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index a9d5228724a6..8fb8b3591048 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -1208,9 +1208,13 @@ static int __init asus_laptop_init(void) | |||
1208 | 1208 | ||
1209 | dev = acpi_get_physical_device(hotk->device->handle); | 1209 | dev = acpi_get_physical_device(hotk->device->handle); |
1210 | 1210 | ||
1211 | result = asus_backlight_init(dev); | 1211 | if (!acpi_video_backlight_support()) { |
1212 | if (result) | 1212 | result = asus_backlight_init(dev); |
1213 | goto fail_backlight; | 1213 | if (result) |
1214 | goto fail_backlight; | ||
1215 | } else | ||
1216 | printk(ASUS_INFO "Brightness ignored, must be controlled by " | ||
1217 | "ACPI video driver\n"); | ||
1214 | 1218 | ||
1215 | result = asus_led_init(dev); | 1219 | result = asus_led_init(dev); |
1216 | if (result) | 1220 | if (result) |
diff --git a/drivers/misc/compal-laptop.c b/drivers/misc/compal-laptop.c index 344b790a6253..11003bba10d3 100644 --- a/drivers/misc/compal-laptop.c +++ b/drivers/misc/compal-laptop.c | |||
@@ -326,12 +326,14 @@ static int __init compal_init(void) | |||
326 | 326 | ||
327 | /* Register backlight stuff */ | 327 | /* Register backlight stuff */ |
328 | 328 | ||
329 | compalbl_device = backlight_device_register("compal-laptop", NULL, NULL, | 329 | if (!acpi_video_backlight_support()) { |
330 | &compalbl_ops); | 330 | compalbl_device = backlight_device_register("compal-laptop", NULL, NULL, |
331 | if (IS_ERR(compalbl_device)) | 331 | &compalbl_ops); |
332 | return PTR_ERR(compalbl_device); | 332 | if (IS_ERR(compalbl_device)) |
333 | return PTR_ERR(compalbl_device); | ||
333 | 334 | ||
334 | compalbl_device->props.max_brightness = COMPAL_LCD_LEVEL_MAX-1; | 335 | compalbl_device->props.max_brightness = COMPAL_LCD_LEVEL_MAX-1; |
336 | } | ||
335 | 337 | ||
336 | ret = platform_driver_register(&compal_driver); | 338 | ret = platform_driver_register(&compal_driver); |
337 | if (ret) | 339 | if (ret) |
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c index 9ef98b2d5039..02fe2b8b8939 100644 --- a/drivers/misc/eeepc-laptop.c +++ b/drivers/misc/eeepc-laptop.c | |||
@@ -825,9 +825,15 @@ static int __init eeepc_laptop_init(void) | |||
825 | return -ENODEV; | 825 | return -ENODEV; |
826 | } | 826 | } |
827 | dev = acpi_get_physical_device(ehotk->device->handle); | 827 | dev = acpi_get_physical_device(ehotk->device->handle); |
828 | result = eeepc_backlight_init(dev); | 828 | |
829 | if (result) | 829 | if (!acpi_video_backlight_support()) { |
830 | goto fail_backlight; | 830 | result = eeepc_backlight_init(dev); |
831 | if (result) | ||
832 | goto fail_backlight; | ||
833 | } else | ||
834 | printk(EEEPC_INFO "Backlight controlled by ACPI video " | ||
835 | "driver\n"); | ||
836 | |||
831 | result = eeepc_hwmon_init(dev); | 837 | result = eeepc_hwmon_init(dev); |
832 | if (result) | 838 | if (result) |
833 | goto fail_hwmon; | 839 | goto fail_hwmon; |
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c index d2cf0bfe3163..a7dd3e9fb79d 100644 --- a/drivers/misc/fujitsu-laptop.c +++ b/drivers/misc/fujitsu-laptop.c | |||
@@ -464,6 +464,14 @@ static int dmi_check_cb_s6410(const struct dmi_system_id *id) | |||
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
466 | 466 | ||
467 | static int dmi_check_cb_s6420(const struct dmi_system_id *id) | ||
468 | { | ||
469 | dmi_check_cb_common(id); | ||
470 | fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */ | ||
471 | fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */ | ||
472 | return 0; | ||
473 | } | ||
474 | |||
467 | static int dmi_check_cb_p8010(const struct dmi_system_id *id) | 475 | static int dmi_check_cb_p8010(const struct dmi_system_id *id) |
468 | { | 476 | { |
469 | dmi_check_cb_common(id); | 477 | dmi_check_cb_common(id); |
@@ -473,7 +481,7 @@ static int dmi_check_cb_p8010(const struct dmi_system_id *id) | |||
473 | return 0; | 481 | return 0; |
474 | } | 482 | } |
475 | 483 | ||
476 | static struct dmi_system_id __initdata fujitsu_dmi_table[] = { | 484 | static struct dmi_system_id fujitsu_dmi_table[] = { |
477 | { | 485 | { |
478 | .ident = "Fujitsu Siemens S6410", | 486 | .ident = "Fujitsu Siemens S6410", |
479 | .matches = { | 487 | .matches = { |
@@ -482,6 +490,13 @@ static struct dmi_system_id __initdata fujitsu_dmi_table[] = { | |||
482 | }, | 490 | }, |
483 | .callback = dmi_check_cb_s6410}, | 491 | .callback = dmi_check_cb_s6410}, |
484 | { | 492 | { |
493 | .ident = "Fujitsu Siemens S6420", | ||
494 | .matches = { | ||
495 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
496 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"), | ||
497 | }, | ||
498 | .callback = dmi_check_cb_s6420}, | ||
499 | { | ||
485 | .ident = "Fujitsu LifeBook P8010", | 500 | .ident = "Fujitsu LifeBook P8010", |
486 | .matches = { | 501 | .matches = { |
487 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | 502 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
@@ -990,16 +1005,16 @@ static int __init fujitsu_init(void) | |||
990 | 1005 | ||
991 | /* Register backlight stuff */ | 1006 | /* Register backlight stuff */ |
992 | 1007 | ||
993 | fujitsu->bl_device = | 1008 | if (!acpi_video_backlight_support()) { |
994 | backlight_device_register("fujitsu-laptop", NULL, NULL, | 1009 | fujitsu->bl_device = |
995 | &fujitsubl_ops); | 1010 | backlight_device_register("fujitsu-laptop", NULL, NULL, |
996 | if (IS_ERR(fujitsu->bl_device)) | 1011 | &fujitsubl_ops); |
997 | return PTR_ERR(fujitsu->bl_device); | 1012 | if (IS_ERR(fujitsu->bl_device)) |
998 | 1013 | return PTR_ERR(fujitsu->bl_device); | |
999 | max_brightness = fujitsu->max_brightness; | 1014 | max_brightness = fujitsu->max_brightness; |
1000 | 1015 | fujitsu->bl_device->props.max_brightness = max_brightness - 1; | |
1001 | fujitsu->bl_device->props.max_brightness = max_brightness - 1; | 1016 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; |
1002 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; | 1017 | } |
1003 | 1018 | ||
1004 | ret = platform_driver_register(&fujitsupf_driver); | 1019 | ret = platform_driver_register(&fujitsupf_driver); |
1005 | if (ret) | 1020 | if (ret) |
@@ -1035,7 +1050,8 @@ fail_hotkey: | |||
1035 | 1050 | ||
1036 | fail_backlight: | 1051 | fail_backlight: |
1037 | 1052 | ||
1038 | backlight_device_unregister(fujitsu->bl_device); | 1053 | if (fujitsu->bl_device) |
1054 | backlight_device_unregister(fujitsu->bl_device); | ||
1039 | 1055 | ||
1040 | fail_platform_device2: | 1056 | fail_platform_device2: |
1041 | 1057 | ||
@@ -1062,7 +1078,8 @@ static void __exit fujitsu_cleanup(void) | |||
1062 | &fujitsupf_attribute_group); | 1078 | &fujitsupf_attribute_group); |
1063 | platform_device_unregister(fujitsu->pf_device); | 1079 | platform_device_unregister(fujitsu->pf_device); |
1064 | platform_driver_unregister(&fujitsupf_driver); | 1080 | platform_driver_unregister(&fujitsupf_driver); |
1065 | backlight_device_unregister(fujitsu->bl_device); | 1081 | if (fujitsu->bl_device) |
1082 | backlight_device_unregister(fujitsu->bl_device); | ||
1066 | 1083 | ||
1067 | acpi_bus_unregister_driver(&acpi_fujitsu_driver); | 1084 | acpi_bus_unregister_driver(&acpi_fujitsu_driver); |
1068 | 1085 | ||
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c index e00a2756e97e..27b7662955bb 100644 --- a/drivers/misc/intel_menlow.c +++ b/drivers/misc/intel_menlow.c | |||
@@ -52,6 +52,11 @@ MODULE_LICENSE("GPL"); | |||
52 | #define MEMORY_ARG_CUR_BANDWIDTH 1 | 52 | #define MEMORY_ARG_CUR_BANDWIDTH 1 |
53 | #define MEMORY_ARG_MAX_BANDWIDTH 0 | 53 | #define MEMORY_ARG_MAX_BANDWIDTH 0 |
54 | 54 | ||
55 | /* | ||
56 | * GTHS returning 'n' would mean that [0,n-1] states are supported | ||
57 | * In that case max_cstate would be n-1 | ||
58 | * GTHS returning '0' would mean that no bandwidth control states are supported | ||
59 | */ | ||
55 | static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, | 60 | static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, |
56 | unsigned long *max_state) | 61 | unsigned long *max_state) |
57 | { | 62 | { |
@@ -71,6 +76,9 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, | |||
71 | if (ACPI_FAILURE(status)) | 76 | if (ACPI_FAILURE(status)) |
72 | return -EFAULT; | 77 | return -EFAULT; |
73 | 78 | ||
79 | if (!value) | ||
80 | return -EINVAL; | ||
81 | |||
74 | *max_state = value - 1; | 82 | *max_state = value - 1; |
75 | return 0; | 83 | return 0; |
76 | } | 84 | } |
@@ -121,7 +129,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, | |||
121 | if (memory_get_int_max_bandwidth(cdev, &max_state)) | 129 | if (memory_get_int_max_bandwidth(cdev, &max_state)) |
122 | return -EFAULT; | 130 | return -EFAULT; |
123 | 131 | ||
124 | if (max_state < 0 || state > max_state) | 132 | if (state > max_state) |
125 | return -EINVAL; | 133 | return -EINVAL; |
126 | 134 | ||
127 | arg_list.count = 1; | 135 | arg_list.count = 1; |
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index de898c6938f3..759763d18e4c 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c | |||
@@ -347,12 +347,16 @@ static int __init msi_init(void) | |||
347 | 347 | ||
348 | /* Register backlight stuff */ | 348 | /* Register backlight stuff */ |
349 | 349 | ||
350 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL, | 350 | if (acpi_video_backlight_support()) { |
351 | &msibl_ops); | 351 | printk(KERN_INFO "MSI: Brightness ignored, must be controlled " |
352 | if (IS_ERR(msibl_device)) | 352 | "by ACPI video driver\n"); |
353 | return PTR_ERR(msibl_device); | 353 | } else { |
354 | 354 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, | |
355 | msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1; | 355 | NULL, &msibl_ops); |
356 | if (IS_ERR(msibl_device)) | ||
357 | return PTR_ERR(msibl_device); | ||
358 | msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1; | ||
359 | } | ||
356 | 360 | ||
357 | ret = platform_driver_register(&msipf_driver); | 361 | ret = platform_driver_register(&msipf_driver); |
358 | if (ret) | 362 | if (ret) |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 06f07e19dc70..7bcb81002dcf 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -1038,7 +1038,11 @@ static int sony_nc_add(struct acpi_device *device) | |||
1038 | goto outinput; | 1038 | goto outinput; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", &handle))) { | 1041 | if (!acpi_video_backlight_support()) { |
1042 | printk(KERN_INFO DRV_PFX "Sony: Brightness ignored, must be " | ||
1043 | "controlled by ACPI video driver\n"); | ||
1044 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | ||
1045 | &handle))) { | ||
1042 | sony_backlight_device = backlight_device_register("sony", NULL, | 1046 | sony_backlight_device = backlight_device_register("sony", NULL, |
1043 | NULL, | 1047 | NULL, |
1044 | &sony_backlight_ops); | 1048 | &sony_backlight_ops); |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 4db1cf9078d9..7a4a26b0edd2 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -4932,16 +4932,25 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
4932 | */ | 4932 | */ |
4933 | b = tpacpi_check_std_acpi_brightness_support(); | 4933 | b = tpacpi_check_std_acpi_brightness_support(); |
4934 | if (b > 0) { | 4934 | if (b > 0) { |
4935 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { | 4935 | |
4936 | printk(TPACPI_NOTICE | 4936 | if (acpi_video_backlight_support()) { |
4937 | "Lenovo BIOS switched to ACPI backlight " | 4937 | if (brightness_enable > 1) { |
4938 | "control mode\n"); | 4938 | printk(TPACPI_NOTICE |
4939 | } | 4939 | "Standard ACPI backlight interface " |
4940 | if (brightness_enable > 1) { | 4940 | "available, not loading native one.\n"); |
4941 | printk(TPACPI_NOTICE | 4941 | return 1; |
4942 | "standard ACPI backlight interface " | 4942 | } else if (brightness_enable == 1) { |
4943 | "available, not loading native one...\n"); | 4943 | printk(TPACPI_NOTICE |
4944 | return 1; | 4944 | "Backlight control force enabled, even if standard " |
4945 | "ACPI backlight interface is available\n"); | ||
4946 | } | ||
4947 | } else { | ||
4948 | if (brightness_enable > 1) { | ||
4949 | printk(TPACPI_NOTICE | ||
4950 | "Standard ACPI backlight interface not " | ||
4951 | "available, thinkpad_acpi native " | ||
4952 | "brightness control enabled\n"); | ||
4953 | } | ||
4945 | } | 4954 | } |
4946 | } | 4955 | } |
4947 | 4956 | ||
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 1ace41a13ac3..5e663ccda4d4 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -1307,8 +1307,10 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1307 | u32 fw_vers = 0; | 1307 | u32 fw_vers = 0; |
1308 | u32 tp_vers = 0; | 1308 | u32 tp_vers = 0; |
1309 | 1309 | ||
1310 | spin_lock(&adapter->stats_lock); | ||
1310 | t3_get_fw_version(adapter, &fw_vers); | 1311 | t3_get_fw_version(adapter, &fw_vers); |
1311 | t3_get_tp_version(adapter, &tp_vers); | 1312 | t3_get_tp_version(adapter, &tp_vers); |
1313 | spin_unlock(&adapter->stats_lock); | ||
1312 | 1314 | ||
1313 | strcpy(info->driver, DRV_NAME); | 1315 | strcpy(info->driver, DRV_NAME); |
1314 | strcpy(info->version, DRV_VERSION); | 1316 | strcpy(info->version, DRV_VERSION); |
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index fa431fad0eec..56a2e213fe62 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
@@ -87,6 +87,9 @@ enum { | |||
87 | 87 | ||
88 | #ifdef CONFIG_MLX4_DEBUG | 88 | #ifdef CONFIG_MLX4_DEBUG |
89 | extern int mlx4_debug_level; | 89 | extern int mlx4_debug_level; |
90 | #else /* CONFIG_MLX4_DEBUG */ | ||
91 | #define mlx4_debug_level (0) | ||
92 | #endif /* CONFIG_MLX4_DEBUG */ | ||
90 | 93 | ||
91 | #define mlx4_dbg(mdev, format, arg...) \ | 94 | #define mlx4_dbg(mdev, format, arg...) \ |
92 | do { \ | 95 | do { \ |
@@ -94,12 +97,6 @@ extern int mlx4_debug_level; | |||
94 | dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \ | 97 | dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \ |
95 | } while (0) | 98 | } while (0) |
96 | 99 | ||
97 | #else /* CONFIG_MLX4_DEBUG */ | ||
98 | |||
99 | #define mlx4_dbg(mdev, format, arg...) do { (void) mdev; } while (0) | ||
100 | |||
101 | #endif /* CONFIG_MLX4_DEBUG */ | ||
102 | |||
103 | #define mlx4_err(mdev, format, arg...) \ | 100 | #define mlx4_err(mdev, format, arg...) \ |
104 | dev_err(&mdev->pdev->dev, format, ## arg) | 101 | dev_err(&mdev->pdev->dev, format, ## arg) |
105 | #define mlx4_info(mdev, format, arg...) \ | 102 | #define mlx4_info(mdev, format, arg...) \ |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 54a279e44c9a..e9f6574930ef 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -380,6 +380,8 @@ struct acpi_bus_type { | |||
380 | int register_acpi_bus_type(struct acpi_bus_type *); | 380 | int register_acpi_bus_type(struct acpi_bus_type *); |
381 | int unregister_acpi_bus_type(struct acpi_bus_type *); | 381 | int unregister_acpi_bus_type(struct acpi_bus_type *); |
382 | struct device *acpi_get_physical_device(acpi_handle); | 382 | struct device *acpi_get_physical_device(acpi_handle); |
383 | struct device *acpi_get_physical_pci_device(acpi_handle); | ||
384 | |||
383 | /* helper */ | 385 | /* helper */ |
384 | acpi_handle acpi_get_child(acpi_handle, acpi_integer); | 386 | acpi_handle acpi_get_child(acpi_handle, acpi_integer); |
385 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); | 387 | acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); |
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index cf04c6011c2a..5fc1bb0f4a90 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -31,8 +31,24 @@ | |||
31 | 31 | ||
32 | #define ACPI_MAX_STRING 80 | 32 | #define ACPI_MAX_STRING 80 |
33 | 33 | ||
34 | /* | ||
35 | * Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt | ||
36 | * if you add to this list. | ||
37 | */ | ||
34 | #define ACPI_BUS_COMPONENT 0x00010000 | 38 | #define ACPI_BUS_COMPONENT 0x00010000 |
39 | #define ACPI_AC_COMPONENT 0x00020000 | ||
40 | #define ACPI_BATTERY_COMPONENT 0x00040000 | ||
41 | #define ACPI_BUTTON_COMPONENT 0x00080000 | ||
42 | #define ACPI_SBS_COMPONENT 0x00100000 | ||
43 | #define ACPI_FAN_COMPONENT 0x00200000 | ||
44 | #define ACPI_PCI_COMPONENT 0x00400000 | ||
45 | #define ACPI_POWER_COMPONENT 0x00800000 | ||
46 | #define ACPI_CONTAINER_COMPONENT 0x01000000 | ||
35 | #define ACPI_SYSTEM_COMPONENT 0x02000000 | 47 | #define ACPI_SYSTEM_COMPONENT 0x02000000 |
48 | #define ACPI_THERMAL_COMPONENT 0x04000000 | ||
49 | #define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 | ||
50 | #define ACPI_VIDEO_COMPONENT 0x10000000 | ||
51 | #define ACPI_PROCESSOR_COMPONENT 0x20000000 | ||
36 | 52 | ||
37 | /* | 53 | /* |
38 | * _HID definitions | 54 | * _HID definitions |
@@ -41,6 +57,7 @@ | |||
41 | */ | 57 | */ |
42 | 58 | ||
43 | #define ACPI_POWER_HID "LNXPOWER" | 59 | #define ACPI_POWER_HID "LNXPOWER" |
60 | #define ACPI_PROCESSOR_OBJECT_HID "ACPI_CPU" | ||
44 | #define ACPI_PROCESSOR_HID "ACPI0007" | 61 | #define ACPI_PROCESSOR_HID "ACPI0007" |
45 | #define ACPI_SYSTEM_HID "LNXSYSTM" | 62 | #define ACPI_SYSTEM_HID "LNXSYSTM" |
46 | #define ACPI_THERMAL_HID "LNXTHERM" | 63 | #define ACPI_THERMAL_HID "LNXTHERM" |
@@ -54,7 +71,6 @@ | |||
54 | PCI | 71 | PCI |
55 | -------------------------------------------------------------------------- */ | 72 | -------------------------------------------------------------------------- */ |
56 | 73 | ||
57 | #define ACPI_PCI_COMPONENT 0x00400000 | ||
58 | 74 | ||
59 | /* ACPI PCI Interrupt Link (pci_link.c) */ | 75 | /* ACPI PCI Interrupt Link (pci_link.c) */ |
60 | 76 | ||
@@ -86,7 +102,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_device *device, int domain, | |||
86 | Power Resource | 102 | Power Resource |
87 | -------------------------------------------------------------------------- */ | 103 | -------------------------------------------------------------------------- */ |
88 | 104 | ||
89 | #ifdef CONFIG_ACPI_POWER | ||
90 | int acpi_device_sleep_wake(struct acpi_device *dev, | 105 | int acpi_device_sleep_wake(struct acpi_device *dev, |
91 | int enable, int sleep_state, int dev_state); | 106 | int enable, int sleep_state, int dev_state); |
92 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); | 107 | int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state); |
@@ -94,15 +109,12 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev); | |||
94 | int acpi_power_get_inferred_state(struct acpi_device *device); | 109 | int acpi_power_get_inferred_state(struct acpi_device *device); |
95 | int acpi_power_transition(struct acpi_device *device, int state); | 110 | int acpi_power_transition(struct acpi_device *device, int state); |
96 | extern int acpi_power_nocheck; | 111 | extern int acpi_power_nocheck; |
97 | #endif | ||
98 | 112 | ||
99 | /* -------------------------------------------------------------------------- | 113 | /* -------------------------------------------------------------------------- |
100 | Embedded Controller | 114 | Embedded Controller |
101 | -------------------------------------------------------------------------- */ | 115 | -------------------------------------------------------------------------- */ |
102 | #ifdef CONFIG_ACPI_EC | ||
103 | int acpi_ec_ecdt_probe(void); | 116 | int acpi_ec_ecdt_probe(void); |
104 | int acpi_boot_ec_enable(void); | 117 | int acpi_boot_ec_enable(void); |
105 | #endif | ||
106 | 118 | ||
107 | /* -------------------------------------------------------------------------- | 119 | /* -------------------------------------------------------------------------- |
108 | Processor | 120 | Processor |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 94d94e126e9f..33bc0e3b1954 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -252,9 +252,9 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); | |||
252 | 252 | ||
253 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); | 253 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type); |
254 | 254 | ||
255 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); | 255 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); |
256 | 256 | ||
257 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); | 257 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); |
258 | 258 | ||
259 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); | 259 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags); |
260 | 260 | ||
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index e8936ab59627..7220361790b3 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -525,6 +525,7 @@ typedef u32 acpi_event_status; | |||
525 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 | 525 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 |
526 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 | 526 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 |
527 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 | 527 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 |
528 | #define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08 | ||
528 | 529 | ||
529 | /* | 530 | /* |
530 | * General Purpose Events (GPE) | 531 | * General Purpose Events (GPE) |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index fd6a452b0ceb..fba8051fb297 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -163,8 +163,6 @@ struct acpi_pci_driver { | |||
163 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | 163 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); |
164 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); | 164 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); |
165 | 165 | ||
166 | #ifdef CONFIG_ACPI_EC | ||
167 | |||
168 | extern int ec_read(u8 addr, u8 *val); | 166 | extern int ec_read(u8 addr, u8 *val); |
169 | extern int ec_write(u8 addr, u8 val); | 167 | extern int ec_write(u8 addr, u8 val); |
170 | extern int ec_transaction(u8 command, | 168 | extern int ec_transaction(u8 command, |
@@ -172,8 +170,6 @@ extern int ec_transaction(u8 command, | |||
172 | u8 *rdata, unsigned rdata_len, | 170 | u8 *rdata, unsigned rdata_len, |
173 | int force_poll); | 171 | int force_poll); |
174 | 172 | ||
175 | #endif /*CONFIG_ACPI_EC*/ | ||
176 | |||
177 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) | 173 | #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) |
178 | 174 | ||
179 | typedef void (*wmi_notify_handler) (u32 value, void *context); | 175 | typedef void (*wmi_notify_handler) (u32 value, void *context); |
@@ -194,6 +190,50 @@ extern bool wmi_has_guid(const char *guid); | |||
194 | 190 | ||
195 | #endif /* CONFIG_ACPI_WMI */ | 191 | #endif /* CONFIG_ACPI_WMI */ |
196 | 192 | ||
193 | #define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001 | ||
194 | #define ACPI_VIDEO_DEVICE_POSTING 0x0002 | ||
195 | #define ACPI_VIDEO_ROM_AVAILABLE 0x0004 | ||
196 | #define ACPI_VIDEO_BACKLIGHT 0x0008 | ||
197 | #define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010 | ||
198 | #define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020 | ||
199 | #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040 | ||
200 | #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080 | ||
201 | #define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100 | ||
202 | #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 | ||
203 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 | ||
204 | #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 | ||
205 | |||
206 | #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) | ||
207 | |||
208 | extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); | ||
209 | extern long acpi_is_video_device(struct acpi_device *device); | ||
210 | extern int acpi_video_backlight_support(void); | ||
211 | extern int acpi_video_display_switch_support(void); | ||
212 | |||
213 | #else | ||
214 | |||
215 | static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle) | ||
216 | { | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static inline long acpi_is_video_device(struct acpi_device *device) | ||
221 | { | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static inline int acpi_video_backlight_support(void) | ||
226 | { | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static inline int acpi_video_display_switch_support(void) | ||
231 | { | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ | ||
236 | |||
197 | extern int acpi_blacklisted(void); | 237 | extern int acpi_blacklisted(void); |
198 | #ifdef CONFIG_DMI | 238 | #ifdef CONFIG_DMI |
199 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); | 239 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); |
@@ -1704,7 +1704,7 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) | |||
1704 | vma = find_vma_prev(mm, addr, &prev); | 1704 | vma = find_vma_prev(mm, addr, &prev); |
1705 | if (vma && (vma->vm_start <= addr)) | 1705 | if (vma && (vma->vm_start <= addr)) |
1706 | return vma; | 1706 | return vma; |
1707 | if (expand_stack(prev, addr)) | 1707 | if (!prev || expand_stack(prev, addr)) |
1708 | return NULL; | 1708 | return NULL; |
1709 | if (prev->vm_flags & VM_LOCKED) { | 1709 | if (prev->vm_flags & VM_LOCKED) { |
1710 | if (mlock_vma_pages_range(prev, addr, prev->vm_end) < 0) | 1710 | if (mlock_vma_pages_range(prev, addr, prev->vm_end) < 0) |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e6085915d86d..4300a679cd86 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -212,7 +212,7 @@ struct sigmatel_spec { | |||
212 | /* i/o switches */ | 212 | /* i/o switches */ |
213 | unsigned int io_switch[2]; | 213 | unsigned int io_switch[2]; |
214 | unsigned int clfe_swap; | 214 | unsigned int clfe_swap; |
215 | unsigned int hp_switch; | 215 | unsigned int hp_switch; /* NID of HP as line-out */ |
216 | unsigned int aloopback; | 216 | unsigned int aloopback; |
217 | 217 | ||
218 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 218 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
@@ -2443,7 +2443,7 @@ static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | |||
2443 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2443 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2444 | struct sigmatel_spec *spec = codec->spec; | 2444 | struct sigmatel_spec *spec = codec->spec; |
2445 | 2445 | ||
2446 | ucontrol->value.integer.value[0] = spec->hp_switch; | 2446 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
2447 | return 0; | 2447 | return 0; |
2448 | } | 2448 | } |
2449 | 2449 | ||
@@ -2452,8 +2452,9 @@ static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
2452 | { | 2452 | { |
2453 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2453 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2454 | struct sigmatel_spec *spec = codec->spec; | 2454 | struct sigmatel_spec *spec = codec->spec; |
2455 | 2455 | int nid = kcontrol->private_value; | |
2456 | spec->hp_switch = ucontrol->value.integer.value[0]; | 2456 | |
2457 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; | ||
2457 | 2458 | ||
2458 | /* check to be sure that the ports are upto date with | 2459 | /* check to be sure that the ports are upto date with |
2459 | * switch changes | 2460 | * switch changes |
@@ -2862,7 +2863,8 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2862 | if (cfg->hp_outs > 1) { | 2863 | if (cfg->hp_outs > 1) { |
2863 | err = stac92xx_add_control(spec, | 2864 | err = stac92xx_add_control(spec, |
2864 | STAC_CTL_WIDGET_HP_SWITCH, | 2865 | STAC_CTL_WIDGET_HP_SWITCH, |
2865 | "Headphone as Line Out Switch", 0); | 2866 | "Headphone as Line Out Switch", |
2867 | cfg->hp_pins[cfg->hp_outs - 1]); | ||
2866 | if (err < 0) | 2868 | if (err < 0) |
2867 | return err; | 2869 | return err; |
2868 | } | 2870 | } |
@@ -3530,6 +3532,12 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) | |||
3530 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) | 3532 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
3531 | return err; | 3533 | return err; |
3532 | 3534 | ||
3535 | if (spec->num_muxes > 0) { | ||
3536 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3537 | if (err < 0) | ||
3538 | return err; | ||
3539 | } | ||
3540 | |||
3533 | if (spec->autocfg.dig_out_pin) | 3541 | if (spec->autocfg.dig_out_pin) |
3534 | spec->multiout.dig_out_nid = 0x05; | 3542 | spec->multiout.dig_out_nid = 0x05; |
3535 | if (spec->autocfg.dig_in_pin) | 3543 | if (spec->autocfg.dig_in_pin) |
@@ -3647,14 +3655,18 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3647 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3655 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3648 | hda_nid_t nid = cfg->input_pins[i]; | 3656 | hda_nid_t nid = cfg->input_pins[i]; |
3649 | if (nid) { | 3657 | if (nid) { |
3650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, | 3658 | unsigned int pinctl; |
3651 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3659 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
3652 | /* if PINCTL already set then skip */ | 3660 | /* for mic pins, force to initialize */ |
3653 | if (pinctl & AC_PINCAP_IN) | 3661 | pinctl = stac92xx_get_vref(codec, nid); |
3654 | continue; | 3662 | } else { |
3655 | pinctl = AC_PINCTL_IN_EN; | 3663 | pinctl = snd_hda_codec_read(codec, nid, 0, |
3656 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3664 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3657 | pinctl |= stac92xx_get_vref(codec, nid); | 3665 | /* if PINCTL already set then skip */ |
3666 | if (pinctl & AC_PINCTL_IN_EN) | ||
3667 | continue; | ||
3668 | } | ||
3669 | pinctl |= AC_PINCTL_IN_EN; | ||
3658 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3670 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
3659 | } | 3671 | } |
3660 | } | 3672 | } |
@@ -3776,11 +3788,30 @@ static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
3776 | return 0; | 3788 | return 0; |
3777 | } | 3789 | } |
3778 | 3790 | ||
3791 | /* return non-zero if the hp-pin of the given array index isn't | ||
3792 | * a jack-detection target | ||
3793 | */ | ||
3794 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) | ||
3795 | { | ||
3796 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3797 | |||
3798 | /* ignore sensing of shared line and mic jacks */ | ||
3799 | if (spec->line_switch && | ||
3800 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE]) | ||
3801 | return 1; | ||
3802 | if (spec->mic_switch && | ||
3803 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC]) | ||
3804 | return 1; | ||
3805 | /* ignore if the pin is set as line-out */ | ||
3806 | if (cfg->hp_pins[i] == spec->hp_switch) | ||
3807 | return 1; | ||
3808 | return 0; | ||
3809 | } | ||
3810 | |||
3779 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | 3811 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
3780 | { | 3812 | { |
3781 | struct sigmatel_spec *spec = codec->spec; | 3813 | struct sigmatel_spec *spec = codec->spec; |
3782 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3814 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3783 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; | ||
3784 | int i, presence; | 3815 | int i, presence; |
3785 | 3816 | ||
3786 | presence = 0; | 3817 | presence = 0; |
@@ -3791,15 +3822,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3791 | for (i = 0; i < cfg->hp_outs; i++) { | 3822 | for (i = 0; i < cfg->hp_outs; i++) { |
3792 | if (presence) | 3823 | if (presence) |
3793 | break; | 3824 | break; |
3794 | if (spec->hp_switch && cfg->hp_pins[i] == nid) | 3825 | if (no_hp_sensing(spec, i)) |
3795 | break; | 3826 | continue; |
3796 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3827 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3797 | } | 3828 | } |
3798 | 3829 | ||
3799 | if (presence) { | 3830 | if (presence) { |
3800 | /* disable lineouts, enable hp */ | 3831 | /* disable lineouts */ |
3801 | if (spec->hp_switch) | 3832 | if (spec->hp_switch) |
3802 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3833 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
3834 | AC_PINCTL_OUT_EN); | ||
3803 | for (i = 0; i < cfg->line_outs; i++) | 3835 | for (i = 0; i < cfg->line_outs; i++) |
3804 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 3836 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
3805 | AC_PINCTL_OUT_EN); | 3837 | AC_PINCTL_OUT_EN); |
@@ -3811,9 +3843,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3811 | spec->gpio_dir, spec->gpio_data & | 3843 | spec->gpio_dir, spec->gpio_data & |
3812 | ~spec->eapd_mask); | 3844 | ~spec->eapd_mask); |
3813 | } else { | 3845 | } else { |
3814 | /* enable lineouts, disable hp */ | 3846 | /* enable lineouts */ |
3815 | if (spec->hp_switch) | 3847 | if (spec->hp_switch) |
3816 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3848 | stac92xx_set_pinctl(codec, spec->hp_switch, |
3849 | AC_PINCTL_OUT_EN); | ||
3817 | for (i = 0; i < cfg->line_outs; i++) | 3850 | for (i = 0; i < cfg->line_outs; i++) |
3818 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 3851 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
3819 | AC_PINCTL_OUT_EN); | 3852 | AC_PINCTL_OUT_EN); |
@@ -3825,8 +3858,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3825 | spec->gpio_dir, spec->gpio_data | | 3858 | spec->gpio_dir, spec->gpio_data | |
3826 | spec->eapd_mask); | 3859 | spec->eapd_mask); |
3827 | } | 3860 | } |
3828 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) | 3861 | /* toggle hp outs */ |
3829 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3862 | for (i = 0; i < cfg->hp_outs; i++) { |
3863 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; | ||
3864 | if (no_hp_sensing(spec, i)) | ||
3865 | continue; | ||
3866 | if (presence) | ||
3867 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); | ||
3868 | else | ||
3869 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); | ||
3870 | } | ||
3830 | } | 3871 | } |
3831 | 3872 | ||
3832 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3873 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |