diff options
author | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
commit | 292dd876ee765c478b27c93cc51e93a558ed58bf (patch) | |
tree | 5b740e93253295baee2a9c414a6c66d03d44a9ef /drivers/acpi | |
parent | d4ec6c7cc9a15a7a529719bc3b84f46812f9842e (diff) | |
parent | 9fdb62af92c741addbea15545f214a6e89460865 (diff) |
Pull release into acpica branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 3 | ||||
-rw-r--r-- | drivers/acpi/asus_acpi.c | 35 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 289 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 4 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 7 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 30 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 148 | ||||
-rw-r--r-- | drivers/acpi/processor_perflib.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_thermal.c | 7 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 7 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 27 | ||||
-rw-r--r-- | drivers/acpi/sleep/poweroff.c | 15 | ||||
-rw-r--r-- | drivers/acpi/sleep/sleep.h | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/wakeup.c | 6 | ||||
-rw-r--r-- | drivers/acpi/tables.c | 4 | ||||
-rw-r--r-- | drivers/acpi/video.c | 8 |
16 files changed, 329 insertions, 267 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index fce21c257523..0cce28c4025b 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -168,7 +168,6 @@ config ACPI_NUMA | |||
168 | config ACPI_ASUS | 168 | config ACPI_ASUS |
169 | tristate "ASUS/Medion Laptop Extras" | 169 | tristate "ASUS/Medion Laptop Extras" |
170 | depends on X86 | 170 | depends on X86 |
171 | default y | ||
172 | ---help--- | 171 | ---help--- |
173 | This driver provides support for extra features of ACPI-compatible | 172 | This driver provides support for extra features of ACPI-compatible |
174 | ASUS laptops. As some of Medion laptops are made by ASUS, it may also | 173 | ASUS laptops. As some of Medion laptops are made by ASUS, it may also |
@@ -209,7 +208,6 @@ config ACPI_IBM | |||
209 | config ACPI_TOSHIBA | 208 | config ACPI_TOSHIBA |
210 | tristate "Toshiba Laptop Extras" | 209 | tristate "Toshiba Laptop Extras" |
211 | depends on X86 | 210 | depends on X86 |
212 | default y | ||
213 | ---help--- | 211 | ---help--- |
214 | This driver adds support for access to certain system settings | 212 | This driver adds support for access to certain system settings |
215 | on "legacy free" Toshiba laptops. These laptops can be recognized by | 213 | on "legacy free" Toshiba laptops. These laptops can be recognized by |
@@ -269,7 +267,6 @@ config ACPI_DEBUG | |||
269 | 267 | ||
270 | config ACPI_EC | 268 | config ACPI_EC |
271 | bool | 269 | bool |
272 | depends on X86 | ||
273 | default y | 270 | default y |
274 | help | 271 | help |
275 | This driver is required on some systems for the proper operation of | 272 | This driver is required on some systems for the proper operation of |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index fec895af6ae6..f4c87750dbf2 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -78,9 +78,9 @@ MODULE_LICENSE("GPL"); | |||
78 | static uid_t asus_uid; | 78 | static uid_t asus_uid; |
79 | static gid_t asus_gid; | 79 | static gid_t asus_gid; |
80 | module_param(asus_uid, uint, 0); | 80 | module_param(asus_uid, uint, 0); |
81 | MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); | 81 | MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n"); |
82 | module_param(asus_gid, uint, 0); | 82 | module_param(asus_gid, uint, 0); |
83 | MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); | 83 | MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n"); |
84 | 84 | ||
85 | /* For each model, all features implemented, | 85 | /* For each model, all features implemented, |
86 | * those marked with R are relative to HOTK, A for absolute */ | 86 | * those marked with R are relative to HOTK, A for absolute */ |
@@ -302,7 +302,7 @@ static struct model_data model_conf[END_MODEL] = { | |||
302 | .brightness_set = "SPLV", | 302 | .brightness_set = "SPLV", |
303 | .brightness_get = "GPLV", | 303 | .brightness_get = "GPLV", |
304 | .display_set = "SDSP", | 304 | .display_set = "SDSP", |
305 | .display_get = "\\SSTE"}, | 305 | .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"}, |
306 | { | 306 | { |
307 | .name = "M6R", | 307 | .name = "M6R", |
308 | .mt_mled = "MLED", | 308 | .mt_mled = "MLED", |
@@ -851,6 +851,8 @@ static int __init asus_hotk_add_fs(struct acpi_device *device) | |||
851 | mode = S_IFREG | S_IRUGO | S_IWUGO; | 851 | mode = S_IFREG | S_IRUGO | S_IWUGO; |
852 | } else { | 852 | } else { |
853 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; | 853 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; |
854 | printk(KERN_WARNING " asus_uid and asus_gid parameters are " | ||
855 | "deprecated, use chown and chmod instead!\n"); | ||
854 | } | 856 | } |
855 | 857 | ||
856 | acpi_device_dir(device) = asus_proc_dir; | 858 | acpi_device_dir(device) = asus_proc_dir; |
@@ -987,9 +989,21 @@ static int __init asus_hotk_get_info(void) | |||
987 | printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", | 989 | printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", |
988 | bsts_result); | 990 | bsts_result); |
989 | 991 | ||
990 | /* Samsung P30 has a device with a valid _HID whose INIT does not | 992 | /* This is unlikely with implicit return */ |
991 | * return anything. Catch this one and any similar here */ | 993 | if (buffer.pointer == NULL) |
992 | if (buffer.pointer == NULL) { | 994 | return -EINVAL; |
995 | |||
996 | model = (union acpi_object *) buffer.pointer; | ||
997 | /* | ||
998 | * Samsung P30 has a device with a valid _HID whose INIT does not | ||
999 | * return anything. It used to be possible to catch this exception, | ||
1000 | * but the implicit return code will now happily confuse the | ||
1001 | * driver. We assume that every ACPI_TYPE_STRING is a valid model | ||
1002 | * identifier but it's still possible to get completely bogus data. | ||
1003 | */ | ||
1004 | if (model->type == ACPI_TYPE_STRING) { | ||
1005 | printk(KERN_NOTICE " %s model detected, ", model->string.pointer); | ||
1006 | } else { | ||
993 | if (asus_info && /* Samsung P30 */ | 1007 | if (asus_info && /* Samsung P30 */ |
994 | strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { | 1008 | strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { |
995 | hotk->model = P30; | 1009 | hotk->model = P30; |
@@ -1002,13 +1016,10 @@ static int __init asus_hotk_get_info(void) | |||
1002 | "the developers with your DSDT\n"); | 1016 | "the developers with your DSDT\n"); |
1003 | } | 1017 | } |
1004 | hotk->methods = &model_conf[hotk->model]; | 1018 | hotk->methods = &model_conf[hotk->model]; |
1005 | return AE_OK; | 1019 | |
1006 | } | 1020 | acpi_os_free(model); |
1007 | 1021 | ||
1008 | model = (union acpi_object *)buffer.pointer; | 1022 | return AE_OK; |
1009 | if (model->type == ACPI_TYPE_STRING) { | ||
1010 | printk(KERN_NOTICE " %s model detected, ", | ||
1011 | model->string.pointer); | ||
1012 | } | 1023 | } |
1013 | 1024 | ||
1014 | hotk->model = END_MODEL; | 1025 | hotk->model = END_MODEL; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 0ecbfa5db1ba..79b09d76c180 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -60,20 +60,20 @@ ACPI_MODULE_NAME("acpi_ec") | |||
60 | #define ACPI_EC_BURST_ENABLE 0x82 | 60 | #define ACPI_EC_BURST_ENABLE 0x82 |
61 | #define ACPI_EC_BURST_DISABLE 0x83 | 61 | #define ACPI_EC_BURST_DISABLE 0x83 |
62 | #define ACPI_EC_COMMAND_QUERY 0x84 | 62 | #define ACPI_EC_COMMAND_QUERY 0x84 |
63 | #define EC_POLLING 0xFF | 63 | #define EC_POLL 0xFF |
64 | #define EC_BURST 0x00 | 64 | #define EC_INTR 0x00 |
65 | static int acpi_ec_remove(struct acpi_device *device, int type); | 65 | static int acpi_ec_remove(struct acpi_device *device, int type); |
66 | static int acpi_ec_start(struct acpi_device *device); | 66 | static int acpi_ec_start(struct acpi_device *device); |
67 | static int acpi_ec_stop(struct acpi_device *device, int type); | 67 | static int acpi_ec_stop(struct acpi_device *device, int type); |
68 | static int acpi_ec_burst_add(struct acpi_device *device); | 68 | static int acpi_ec_intr_add(struct acpi_device *device); |
69 | static int acpi_ec_polling_add(struct acpi_device *device); | 69 | static int acpi_ec_poll_add(struct acpi_device *device); |
70 | 70 | ||
71 | static struct acpi_driver acpi_ec_driver = { | 71 | static struct acpi_driver acpi_ec_driver = { |
72 | .name = ACPI_EC_DRIVER_NAME, | 72 | .name = ACPI_EC_DRIVER_NAME, |
73 | .class = ACPI_EC_CLASS, | 73 | .class = ACPI_EC_CLASS, |
74 | .ids = ACPI_EC_HID, | 74 | .ids = ACPI_EC_HID, |
75 | .ops = { | 75 | .ops = { |
76 | .add = acpi_ec_polling_add, | 76 | .add = acpi_ec_intr_add, |
77 | .remove = acpi_ec_remove, | 77 | .remove = acpi_ec_remove, |
78 | .start = acpi_ec_start, | 78 | .start = acpi_ec_start, |
79 | .stop = acpi_ec_stop, | 79 | .stop = acpi_ec_stop, |
@@ -105,7 +105,7 @@ union acpi_ec { | |||
105 | atomic_t pending_gpe; | 105 | atomic_t pending_gpe; |
106 | struct semaphore sem; | 106 | struct semaphore sem; |
107 | wait_queue_head_t wait; | 107 | wait_queue_head_t wait; |
108 | } burst; | 108 | } intr; |
109 | 109 | ||
110 | struct { | 110 | struct { |
111 | u32 mode; | 111 | u32 mode; |
@@ -117,43 +117,43 @@ union acpi_ec { | |||
117 | struct acpi_generic_address data_addr; | 117 | struct acpi_generic_address data_addr; |
118 | unsigned long global_lock; | 118 | unsigned long global_lock; |
119 | spinlock_t lock; | 119 | spinlock_t lock; |
120 | } polling; | 120 | } poll; |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); | 123 | static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event); |
124 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); | 124 | static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event); |
125 | static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); | 125 | static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data); |
126 | static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); | 126 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data); |
127 | static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); | 127 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data); |
128 | static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); | 128 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data); |
129 | static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); | 129 | static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data); |
130 | static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); | 130 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data); |
131 | static void acpi_ec_gpe_polling_query(void *ec_cxt); | 131 | static void acpi_ec_gpe_poll_query(void *ec_cxt); |
132 | static void acpi_ec_gpe_burst_query(void *ec_cxt); | 132 | static void acpi_ec_gpe_intr_query(void *ec_cxt); |
133 | static u32 acpi_ec_gpe_polling_handler(void *data); | 133 | static u32 acpi_ec_gpe_poll_handler(void *data); |
134 | static u32 acpi_ec_gpe_burst_handler(void *data); | 134 | static u32 acpi_ec_gpe_intr_handler(void *data); |
135 | static acpi_status __init | 135 | static acpi_status __init |
136 | acpi_fake_ecdt_polling_callback(acpi_handle handle, | 136 | acpi_fake_ecdt_poll_callback(acpi_handle handle, |
137 | u32 Level, void *context, void **retval); | 137 | u32 Level, void *context, void **retval); |
138 | 138 | ||
139 | static acpi_status __init | 139 | static acpi_status __init |
140 | acpi_fake_ecdt_burst_callback(acpi_handle handle, | 140 | acpi_fake_ecdt_intr_callback(acpi_handle handle, |
141 | u32 Level, void *context, void **retval); | 141 | u32 Level, void *context, void **retval); |
142 | 142 | ||
143 | static int __init acpi_ec_polling_get_real_ecdt(void); | 143 | static int __init acpi_ec_poll_get_real_ecdt(void); |
144 | static int __init acpi_ec_burst_get_real_ecdt(void); | 144 | static int __init acpi_ec_intr_get_real_ecdt(void); |
145 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 145 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
146 | static union acpi_ec *ec_ecdt; | 146 | static union acpi_ec *ec_ecdt; |
147 | 147 | ||
148 | /* External interfaces use first EC only, so remember */ | 148 | /* External interfaces use first EC only, so remember */ |
149 | static struct acpi_device *first_ec; | 149 | static struct acpi_device *first_ec; |
150 | static int acpi_ec_polling_mode = EC_POLLING; | 150 | static int acpi_ec_poll_mode = EC_INTR; |
151 | 151 | ||
152 | /* -------------------------------------------------------------------------- | 152 | /* -------------------------------------------------------------------------- |
153 | Transaction Management | 153 | Transaction Management |
154 | -------------------------------------------------------------------------- */ | 154 | -------------------------------------------------------------------------- */ |
155 | 155 | ||
156 | static inline u32 acpi_ec_read_status(union acpi_ec *ec) | 156 | static u32 acpi_ec_read_status(union acpi_ec *ec) |
157 | { | 157 | { |
158 | u32 status = 0; | 158 | u32 status = 0; |
159 | 159 | ||
@@ -163,13 +163,13 @@ static inline u32 acpi_ec_read_status(union acpi_ec *ec) | |||
163 | 163 | ||
164 | static int acpi_ec_wait(union acpi_ec *ec, u8 event) | 164 | static int acpi_ec_wait(union acpi_ec *ec, u8 event) |
165 | { | 165 | { |
166 | if (acpi_ec_polling_mode) | 166 | if (acpi_ec_poll_mode) |
167 | return acpi_ec_polling_wait(ec, event); | 167 | return acpi_ec_poll_wait(ec, event); |
168 | else | 168 | else |
169 | return acpi_ec_burst_wait(ec, event); | 169 | return acpi_ec_intr_wait(ec, event); |
170 | } | 170 | } |
171 | 171 | ||
172 | static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) | 172 | static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event) |
173 | { | 173 | { |
174 | u32 acpi_ec_status = 0; | 174 | u32 acpi_ec_status = 0; |
175 | u32 i = ACPI_EC_UDELAY_COUNT; | 175 | u32 i = ACPI_EC_UDELAY_COUNT; |
@@ -203,36 +203,31 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) | |||
203 | 203 | ||
204 | return -ETIME; | 204 | return -ETIME; |
205 | } | 205 | } |
206 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | 206 | static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) |
207 | { | 207 | { |
208 | int result = 0; | 208 | int result = 0; |
209 | 209 | ||
210 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); | 210 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); |
211 | 211 | ||
212 | ec->burst.expect_event = event; | 212 | ec->intr.expect_event = event; |
213 | smp_mb(); | 213 | smp_mb(); |
214 | 214 | ||
215 | switch (event) { | 215 | switch (event) { |
216 | case ACPI_EC_EVENT_OBF: | ||
217 | if (acpi_ec_read_status(ec) & event) { | ||
218 | ec->burst.expect_event = 0; | ||
219 | return_VALUE(0); | ||
220 | } | ||
221 | break; | ||
222 | |||
223 | case ACPI_EC_EVENT_IBE: | 216 | case ACPI_EC_EVENT_IBE: |
224 | if (~acpi_ec_read_status(ec) & event) { | 217 | if (~acpi_ec_read_status(ec) & event) { |
225 | ec->burst.expect_event = 0; | 218 | ec->intr.expect_event = 0; |
226 | return_VALUE(0); | 219 | return_VALUE(0); |
227 | } | 220 | } |
228 | break; | 221 | break; |
222 | default: | ||
223 | break; | ||
229 | } | 224 | } |
230 | 225 | ||
231 | result = wait_event_timeout(ec->burst.wait, | 226 | result = wait_event_timeout(ec->intr.wait, |
232 | !ec->burst.expect_event, | 227 | !ec->intr.expect_event, |
233 | msecs_to_jiffies(ACPI_EC_DELAY)); | 228 | msecs_to_jiffies(ACPI_EC_DELAY)); |
234 | 229 | ||
235 | ec->burst.expect_event = 0; | 230 | ec->intr.expect_event = 0; |
236 | smp_mb(); | 231 | smp_mb(); |
237 | 232 | ||
238 | /* | 233 | /* |
@@ -255,7 +250,12 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | |||
255 | return_VALUE(-ETIME); | 250 | return_VALUE(-ETIME); |
256 | } | 251 | } |
257 | 252 | ||
258 | static int acpi_ec_enter_burst_mode(union acpi_ec *ec) | 253 | #ifdef ACPI_FUTURE_USAGE |
254 | /* | ||
255 | * Note: samsung nv5000 doesn't work with ec burst mode. | ||
256 | * http://bugzilla.kernel.org/show_bug.cgi?id=4980 | ||
257 | */ | ||
258 | int acpi_ec_enter_burst_mode(union acpi_ec *ec) | ||
259 | { | 259 | { |
260 | u32 tmp = 0; | 260 | u32 tmp = 0; |
261 | int status = 0; | 261 | int status = 0; |
@@ -270,45 +270,56 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec) | |||
270 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, | 270 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, |
271 | &ec->common.command_addr); | 271 | &ec->common.command_addr); |
272 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 272 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
273 | if (status) | ||
274 | return_VALUE(-EINVAL); | ||
275 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); | 273 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); |
276 | if (tmp != 0x90) { /* Burst ACK byte */ | 274 | if (tmp != 0x90) { /* Burst ACK byte */ |
277 | return_VALUE(-EINVAL); | 275 | return_VALUE(-EINVAL); |
278 | } | 276 | } |
279 | } | 277 | } |
280 | 278 | ||
281 | atomic_set(&ec->burst.leaving_burst, 0); | 279 | atomic_set(&ec->intr.leaving_burst, 0); |
282 | return_VALUE(0); | 280 | return_VALUE(0); |
283 | end: | 281 | end: |
284 | printk("Error in acpi_ec_wait\n"); | 282 | printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); |
285 | return_VALUE(-1); | 283 | return_VALUE(-1); |
286 | } | 284 | } |
287 | 285 | ||
288 | static int acpi_ec_leave_burst_mode(union acpi_ec *ec) | 286 | int acpi_ec_leave_burst_mode(union acpi_ec *ec) |
289 | { | 287 | { |
288 | int status = 0; | ||
290 | 289 | ||
291 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | 290 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); |
292 | 291 | ||
293 | atomic_set(&ec->burst.leaving_burst, 1); | 292 | status = acpi_ec_read_status(ec); |
293 | if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ | ||
294 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
295 | if(status) | ||
296 | goto end; | ||
297 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); | ||
298 | acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | ||
299 | } | ||
300 | atomic_set(&ec->intr.leaving_burst, 1); | ||
294 | return_VALUE(0); | 301 | return_VALUE(0); |
302 | end: | ||
303 | printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); | ||
304 | return_VALUE(-1); | ||
295 | } | 305 | } |
306 | #endif /* ACPI_FUTURE_USAGE */ | ||
296 | 307 | ||
297 | static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) | 308 | static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) |
298 | { | 309 | { |
299 | if (acpi_ec_polling_mode) | 310 | if (acpi_ec_poll_mode) |
300 | return acpi_ec_polling_read(ec, address, data); | 311 | return acpi_ec_poll_read(ec, address, data); |
301 | else | 312 | else |
302 | return acpi_ec_burst_read(ec, address, data); | 313 | return acpi_ec_intr_read(ec, address, data); |
303 | } | 314 | } |
304 | static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) | 315 | static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) |
305 | { | 316 | { |
306 | if (acpi_ec_polling_mode) | 317 | if (acpi_ec_poll_mode) |
307 | return acpi_ec_polling_write(ec, address, data); | 318 | return acpi_ec_poll_write(ec, address, data); |
308 | else | 319 | else |
309 | return acpi_ec_burst_write(ec, address, data); | 320 | return acpi_ec_intr_write(ec, address, data); |
310 | } | 321 | } |
311 | static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | 322 | static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) |
312 | { | 323 | { |
313 | acpi_status status = AE_OK; | 324 | acpi_status status = AE_OK; |
314 | int result = 0; | 325 | int result = 0; |
@@ -328,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
328 | return_VALUE(-ENODEV); | 339 | return_VALUE(-ENODEV); |
329 | } | 340 | } |
330 | 341 | ||
331 | spin_lock_irqsave(&ec->polling.lock, flags); | 342 | spin_lock_irqsave(&ec->poll.lock, flags); |
332 | 343 | ||
333 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 344 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
334 | &ec->common.command_addr); | 345 | &ec->common.command_addr); |
@@ -347,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
347 | *data, address)); | 358 | *data, address)); |
348 | 359 | ||
349 | end: | 360 | end: |
350 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 361 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
351 | 362 | ||
352 | if (ec->common.global_lock) | 363 | if (ec->common.global_lock) |
353 | acpi_release_global_lock(glk); | 364 | acpi_release_global_lock(glk); |
@@ -355,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) | |||
355 | return_VALUE(result); | 366 | return_VALUE(result); |
356 | } | 367 | } |
357 | 368 | ||
358 | static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | 369 | static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) |
359 | { | 370 | { |
360 | int result = 0; | 371 | int result = 0; |
361 | acpi_status status = AE_OK; | 372 | acpi_status status = AE_OK; |
@@ -373,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
373 | return_VALUE(-ENODEV); | 384 | return_VALUE(-ENODEV); |
374 | } | 385 | } |
375 | 386 | ||
376 | spin_lock_irqsave(&ec->polling.lock, flags); | 387 | spin_lock_irqsave(&ec->poll.lock, flags); |
377 | 388 | ||
378 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 389 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
379 | &ec->common.command_addr); | 390 | &ec->common.command_addr); |
@@ -395,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
395 | data, address)); | 406 | data, address)); |
396 | 407 | ||
397 | end: | 408 | end: |
398 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 409 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
399 | 410 | ||
400 | if (ec->common.global_lock) | 411 | if (ec->common.global_lock) |
401 | acpi_release_global_lock(glk); | 412 | acpi_release_global_lock(glk); |
@@ -403,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) | |||
403 | return_VALUE(result); | 414 | return_VALUE(result); |
404 | } | 415 | } |
405 | 416 | ||
406 | static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | 417 | static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) |
407 | { | 418 | { |
408 | int status = 0; | 419 | int status = 0; |
409 | u32 glk; | 420 | u32 glk; |
@@ -422,25 +433,24 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
422 | } | 433 | } |
423 | 434 | ||
424 | WARN_ON(in_interrupt()); | 435 | WARN_ON(in_interrupt()); |
425 | down(&ec->burst.sem); | 436 | down(&ec->intr.sem); |
426 | 437 | ||
427 | acpi_ec_enter_burst_mode(ec); | ||
428 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 438 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
429 | if (status) { | 439 | if (status) { |
430 | printk("read EC, IB not empty\n"); | 440 | printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); |
431 | goto end; | 441 | goto end; |
432 | } | 442 | } |
433 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 443 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
434 | &ec->common.command_addr); | 444 | &ec->common.command_addr); |
435 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 445 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
436 | if (status) { | 446 | if (status) { |
437 | printk("read EC, IB not empty\n"); | 447 | printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); |
438 | } | 448 | } |
439 | 449 | ||
440 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | 450 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
441 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 451 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
442 | if (status) { | 452 | if (status) { |
443 | printk("read EC, OB not full\n"); | 453 | printk(KERN_DEBUG PREFIX "read EC, OB not full\n"); |
444 | goto end; | 454 | goto end; |
445 | } | 455 | } |
446 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | 456 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); |
@@ -448,8 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
448 | *data, address)); | 458 | *data, address)); |
449 | 459 | ||
450 | end: | 460 | end: |
451 | acpi_ec_leave_burst_mode(ec); | 461 | up(&ec->intr.sem); |
452 | up(&ec->burst.sem); | ||
453 | 462 | ||
454 | if (ec->common.global_lock) | 463 | if (ec->common.global_lock) |
455 | acpi_release_global_lock(glk); | 464 | acpi_release_global_lock(glk); |
@@ -457,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) | |||
457 | return_VALUE(status); | 466 | return_VALUE(status); |
458 | } | 467 | } |
459 | 468 | ||
460 | static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | 469 | static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) |
461 | { | 470 | { |
462 | int status = 0; | 471 | int status = 0; |
463 | u32 glk; | 472 | u32 glk; |
@@ -474,25 +483,23 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | |||
474 | } | 483 | } |
475 | 484 | ||
476 | WARN_ON(in_interrupt()); | 485 | WARN_ON(in_interrupt()); |
477 | down(&ec->burst.sem); | 486 | down(&ec->intr.sem); |
478 | |||
479 | acpi_ec_enter_burst_mode(ec); | ||
480 | 487 | ||
481 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 488 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
482 | if (status) { | 489 | if (status) { |
483 | printk("write EC, IB not empty\n"); | 490 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
484 | } | 491 | } |
485 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 492 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
486 | &ec->common.command_addr); | 493 | &ec->common.command_addr); |
487 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 494 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
488 | if (status) { | 495 | if (status) { |
489 | printk("write EC, IB not empty\n"); | 496 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
490 | } | 497 | } |
491 | 498 | ||
492 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | 499 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
493 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 500 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
494 | if (status) { | 501 | if (status) { |
495 | printk("write EC, IB not empty\n"); | 502 | printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); |
496 | } | 503 | } |
497 | 504 | ||
498 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); | 505 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); |
@@ -500,8 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) | |||
500 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", | 507 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", |
501 | data, address)); | 508 | data, address)); |
502 | 509 | ||
503 | acpi_ec_leave_burst_mode(ec); | 510 | up(&ec->intr.sem); |
504 | up(&ec->burst.sem); | ||
505 | 511 | ||
506 | if (ec->common.global_lock) | 512 | if (ec->common.global_lock) |
507 | acpi_release_global_lock(glk); | 513 | acpi_release_global_lock(glk); |
@@ -553,12 +559,12 @@ EXPORT_SYMBOL(ec_write); | |||
553 | 559 | ||
554 | static int acpi_ec_query(union acpi_ec *ec, u32 * data) | 560 | static int acpi_ec_query(union acpi_ec *ec, u32 * data) |
555 | { | 561 | { |
556 | if (acpi_ec_polling_mode) | 562 | if (acpi_ec_poll_mode) |
557 | return acpi_ec_polling_query(ec, data); | 563 | return acpi_ec_poll_query(ec, data); |
558 | else | 564 | else |
559 | return acpi_ec_burst_query(ec, data); | 565 | return acpi_ec_intr_query(ec, data); |
560 | } | 566 | } |
561 | static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | 567 | static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) |
562 | { | 568 | { |
563 | int result = 0; | 569 | int result = 0; |
564 | acpi_status status = AE_OK; | 570 | acpi_status status = AE_OK; |
@@ -583,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | |||
583 | * Note that successful completion of the query causes the ACPI_EC_SCI | 589 | * Note that successful completion of the query causes the ACPI_EC_SCI |
584 | * bit to be cleared (and thus clearing the interrupt source). | 590 | * bit to be cleared (and thus clearing the interrupt source). |
585 | */ | 591 | */ |
586 | spin_lock_irqsave(&ec->polling.lock, flags); | 592 | spin_lock_irqsave(&ec->poll.lock, flags); |
587 | 593 | ||
588 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, | 594 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, |
589 | &ec->common.command_addr); | 595 | &ec->common.command_addr); |
@@ -596,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) | |||
596 | result = -ENODATA; | 602 | result = -ENODATA; |
597 | 603 | ||
598 | end: | 604 | end: |
599 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 605 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
600 | 606 | ||
601 | if (ec->common.global_lock) | 607 | if (ec->common.global_lock) |
602 | acpi_release_global_lock(glk); | 608 | acpi_release_global_lock(glk); |
603 | 609 | ||
604 | return_VALUE(result); | 610 | return_VALUE(result); |
605 | } | 611 | } |
606 | static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | 612 | static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) |
607 | { | 613 | { |
608 | int status = 0; | 614 | int status = 0; |
609 | u32 glk; | 615 | u32 glk; |
@@ -620,11 +626,11 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
620 | return_VALUE(-ENODEV); | 626 | return_VALUE(-ENODEV); |
621 | } | 627 | } |
622 | 628 | ||
623 | down(&ec->burst.sem); | 629 | down(&ec->intr.sem); |
624 | 630 | ||
625 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 631 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
626 | if (status) { | 632 | if (status) { |
627 | printk("query EC, IB not empty\n"); | 633 | printk(KERN_DEBUG PREFIX "query EC, IB not empty\n"); |
628 | goto end; | 634 | goto end; |
629 | } | 635 | } |
630 | /* | 636 | /* |
@@ -636,7 +642,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
636 | &ec->common.command_addr); | 642 | &ec->common.command_addr); |
637 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 643 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
638 | if (status) { | 644 | if (status) { |
639 | printk("query EC, OB not full\n"); | 645 | printk(KERN_DEBUG PREFIX "query EC, OB not full\n"); |
640 | goto end; | 646 | goto end; |
641 | } | 647 | } |
642 | 648 | ||
@@ -645,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) | |||
645 | status = -ENODATA; | 651 | status = -ENODATA; |
646 | 652 | ||
647 | end: | 653 | end: |
648 | up(&ec->burst.sem); | 654 | up(&ec->intr.sem); |
649 | 655 | ||
650 | if (ec->common.global_lock) | 656 | if (ec->common.global_lock) |
651 | acpi_release_global_lock(glk); | 657 | acpi_release_global_lock(glk); |
@@ -664,13 +670,13 @@ union acpi_ec_query_data { | |||
664 | 670 | ||
665 | static void acpi_ec_gpe_query(void *ec_cxt) | 671 | static void acpi_ec_gpe_query(void *ec_cxt) |
666 | { | 672 | { |
667 | if (acpi_ec_polling_mode) | 673 | if (acpi_ec_poll_mode) |
668 | acpi_ec_gpe_polling_query(ec_cxt); | 674 | acpi_ec_gpe_poll_query(ec_cxt); |
669 | else | 675 | else |
670 | acpi_ec_gpe_burst_query(ec_cxt); | 676 | acpi_ec_gpe_intr_query(ec_cxt); |
671 | } | 677 | } |
672 | 678 | ||
673 | static void acpi_ec_gpe_polling_query(void *ec_cxt) | 679 | static void acpi_ec_gpe_poll_query(void *ec_cxt) |
674 | { | 680 | { |
675 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 681 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
676 | u32 value = 0; | 682 | u32 value = 0; |
@@ -685,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) | |||
685 | if (!ec_cxt) | 691 | if (!ec_cxt) |
686 | goto end; | 692 | goto end; |
687 | 693 | ||
688 | spin_lock_irqsave(&ec->polling.lock, flags); | 694 | spin_lock_irqsave(&ec->poll.lock, flags); |
689 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | 695 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
690 | spin_unlock_irqrestore(&ec->polling.lock, flags); | 696 | spin_unlock_irqrestore(&ec->poll.lock, flags); |
691 | 697 | ||
692 | /* TBD: Implement asynch events! | 698 | /* TBD: Implement asynch events! |
693 | * NOTE: All we care about are EC-SCI's. Other EC events are | 699 | * NOTE: All we care about are EC-SCI's. Other EC events are |
@@ -711,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt) | |||
711 | end: | 717 | end: |
712 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | 718 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
713 | } | 719 | } |
714 | static void acpi_ec_gpe_burst_query(void *ec_cxt) | 720 | static void acpi_ec_gpe_intr_query(void *ec_cxt) |
715 | { | 721 | { |
716 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 722 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
717 | u32 value; | 723 | u32 value; |
@@ -736,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt) | |||
736 | 742 | ||
737 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); | 743 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); |
738 | end: | 744 | end: |
739 | atomic_dec(&ec->burst.pending_gpe); | 745 | atomic_dec(&ec->intr.pending_gpe); |
740 | return; | 746 | return; |
741 | } | 747 | } |
742 | 748 | ||
743 | static u32 acpi_ec_gpe_handler(void *data) | 749 | static u32 acpi_ec_gpe_handler(void *data) |
744 | { | 750 | { |
745 | if (acpi_ec_polling_mode) | 751 | if (acpi_ec_poll_mode) |
746 | return acpi_ec_gpe_polling_handler(data); | 752 | return acpi_ec_gpe_poll_handler(data); |
747 | else | 753 | else |
748 | return acpi_ec_gpe_burst_handler(data); | 754 | return acpi_ec_gpe_intr_handler(data); |
749 | } | 755 | } |
750 | static u32 acpi_ec_gpe_polling_handler(void *data) | 756 | static u32 acpi_ec_gpe_poll_handler(void *data) |
751 | { | 757 | { |
752 | acpi_status status = AE_OK; | 758 | acpi_status status = AE_OK; |
753 | union acpi_ec *ec = (union acpi_ec *)data; | 759 | union acpi_ec *ec = (union acpi_ec *)data; |
@@ -765,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data) | |||
765 | else | 771 | else |
766 | return ACPI_INTERRUPT_NOT_HANDLED; | 772 | return ACPI_INTERRUPT_NOT_HANDLED; |
767 | } | 773 | } |
768 | static u32 acpi_ec_gpe_burst_handler(void *data) | 774 | static u32 acpi_ec_gpe_intr_handler(void *data) |
769 | { | 775 | { |
770 | acpi_status status = AE_OK; | 776 | acpi_status status = AE_OK; |
771 | u32 value; | 777 | u32 value; |
@@ -777,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data) | |||
777 | acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 783 | acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
778 | value = acpi_ec_read_status(ec); | 784 | value = acpi_ec_read_status(ec); |
779 | 785 | ||
780 | switch (ec->burst.expect_event) { | 786 | switch (ec->intr.expect_event) { |
781 | case ACPI_EC_EVENT_OBF: | 787 | case ACPI_EC_EVENT_OBF: |
782 | if (!(value & ACPI_EC_FLAG_OBF)) | 788 | if (!(value & ACPI_EC_FLAG_OBF)) |
783 | break; | 789 | break; |
784 | case ACPI_EC_EVENT_IBE: | 790 | case ACPI_EC_EVENT_IBE: |
785 | if ((value & ACPI_EC_FLAG_IBF)) | 791 | if ((value & ACPI_EC_FLAG_IBF)) |
786 | break; | 792 | break; |
787 | ec->burst.expect_event = 0; | 793 | ec->intr.expect_event = 0; |
788 | wake_up(&ec->burst.wait); | 794 | wake_up(&ec->intr.wait); |
789 | return ACPI_INTERRUPT_HANDLED; | 795 | return ACPI_INTERRUPT_HANDLED; |
790 | default: | 796 | default: |
791 | break; | 797 | break; |
792 | } | 798 | } |
793 | 799 | ||
794 | if (value & ACPI_EC_FLAG_SCI) { | 800 | if (value & ACPI_EC_FLAG_SCI) { |
795 | atomic_add(1, &ec->burst.pending_gpe); | 801 | atomic_add(1, &ec->intr.pending_gpe); |
796 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, |
797 | acpi_ec_gpe_query, ec); | 803 | acpi_ec_gpe_query, ec); |
798 | return status == AE_OK ? | 804 | return status == AE_OK ? |
@@ -980,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) | |||
980 | Driver Interface | 986 | Driver Interface |
981 | -------------------------------------------------------------------------- */ | 987 | -------------------------------------------------------------------------- */ |
982 | 988 | ||
983 | static int acpi_ec_polling_add(struct acpi_device *device) | 989 | static int acpi_ec_poll_add(struct acpi_device *device) |
984 | { | 990 | { |
985 | int result = 0; | 991 | int result = 0; |
986 | acpi_status status = AE_OK; | 992 | acpi_status status = AE_OK; |
@@ -999,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
999 | 1005 | ||
1000 | ec->common.handle = device->handle; | 1006 | ec->common.handle = device->handle; |
1001 | ec->common.uid = -1; | 1007 | ec->common.uid = -1; |
1002 | spin_lock_init(&ec->polling.lock); | 1008 | spin_lock_init(&ec->poll.lock); |
1003 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1009 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1004 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1010 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1005 | acpi_driver_data(device) = ec; | 1011 | acpi_driver_data(device) = ec; |
@@ -1038,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
1038 | if (result) | 1044 | if (result) |
1039 | goto end; | 1045 | goto end; |
1040 | 1046 | ||
1041 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | 1047 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n", |
1042 | acpi_device_name(device), acpi_device_bid(device), | 1048 | acpi_device_name(device), acpi_device_bid(device), |
1043 | (u32) ec->common.gpe_bit); | 1049 | (u32) ec->common.gpe_bit); |
1044 | 1050 | ||
@@ -1051,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device) | |||
1051 | 1057 | ||
1052 | return_VALUE(result); | 1058 | return_VALUE(result); |
1053 | } | 1059 | } |
1054 | static int acpi_ec_burst_add(struct acpi_device *device) | 1060 | static int acpi_ec_intr_add(struct acpi_device *device) |
1055 | { | 1061 | { |
1056 | int result = 0; | 1062 | int result = 0; |
1057 | acpi_status status = AE_OK; | 1063 | acpi_status status = AE_OK; |
@@ -1070,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device) | |||
1070 | 1076 | ||
1071 | ec->common.handle = device->handle; | 1077 | ec->common.handle = device->handle; |
1072 | ec->common.uid = -1; | 1078 | ec->common.uid = -1; |
1073 | atomic_set(&ec->burst.pending_gpe, 0); | 1079 | atomic_set(&ec->intr.pending_gpe, 0); |
1074 | atomic_set(&ec->burst.leaving_burst, 1); | 1080 | atomic_set(&ec->intr.leaving_burst, 1); |
1075 | init_MUTEX(&ec->burst.sem); | 1081 | init_MUTEX(&ec->intr.sem); |
1076 | init_waitqueue_head(&ec->burst.wait); | 1082 | init_waitqueue_head(&ec->intr.wait); |
1077 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1083 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1078 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1084 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1079 | acpi_driver_data(device) = ec; | 1085 | acpi_driver_data(device) = ec; |
@@ -1112,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device) | |||
1112 | if (result) | 1118 | if (result) |
1113 | goto end; | 1119 | goto end; |
1114 | 1120 | ||
1115 | printk("burst-mode-ec-10-Aug\n"); | 1121 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n", |
1116 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | ||
1117 | acpi_device_name(device), acpi_device_bid(device), | 1122 | acpi_device_name(device), acpi_device_bid(device), |
1118 | (u32) ec->common.gpe_bit); | 1123 | (u32) ec->common.gpe_bit); |
1119 | 1124 | ||
@@ -1267,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle, | |||
1267 | u32 Level, void *context, void **retval) | 1272 | u32 Level, void *context, void **retval) |
1268 | { | 1273 | { |
1269 | 1274 | ||
1270 | if (acpi_ec_polling_mode) | 1275 | if (acpi_ec_poll_mode) |
1271 | return acpi_fake_ecdt_polling_callback(handle, | 1276 | return acpi_fake_ecdt_poll_callback(handle, |
1272 | Level, context, retval); | 1277 | Level, context, retval); |
1273 | else | 1278 | else |
1274 | return acpi_fake_ecdt_burst_callback(handle, | 1279 | return acpi_fake_ecdt_intr_callback(handle, |
1275 | Level, context, retval); | 1280 | Level, context, retval); |
1276 | } | 1281 | } |
1277 | 1282 | ||
1278 | static acpi_status __init | 1283 | static acpi_status __init |
1279 | acpi_fake_ecdt_polling_callback(acpi_handle handle, | 1284 | acpi_fake_ecdt_poll_callback(acpi_handle handle, |
1280 | u32 Level, void *context, void **retval) | 1285 | u32 Level, void *context, void **retval) |
1281 | { | 1286 | { |
1282 | acpi_status status; | 1287 | acpi_status status; |
@@ -1295,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, | |||
1295 | &ec_ecdt->common.gpe_bit); | 1300 | &ec_ecdt->common.gpe_bit); |
1296 | if (ACPI_FAILURE(status)) | 1301 | if (ACPI_FAILURE(status)) |
1297 | return status; | 1302 | return status; |
1298 | spin_lock_init(&ec_ecdt->polling.lock); | 1303 | spin_lock_init(&ec_ecdt->poll.lock); |
1299 | ec_ecdt->common.global_lock = TRUE; | 1304 | ec_ecdt->common.global_lock = TRUE; |
1300 | ec_ecdt->common.handle = handle; | 1305 | ec_ecdt->common.handle = handle; |
1301 | 1306 | ||
@@ -1308,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle, | |||
1308 | } | 1313 | } |
1309 | 1314 | ||
1310 | static acpi_status __init | 1315 | static acpi_status __init |
1311 | acpi_fake_ecdt_burst_callback(acpi_handle handle, | 1316 | acpi_fake_ecdt_intr_callback(acpi_handle handle, |
1312 | u32 Level, void *context, void **retval) | 1317 | u32 Level, void *context, void **retval) |
1313 | { | 1318 | { |
1314 | acpi_status status; | 1319 | acpi_status status; |
1315 | 1320 | ||
1316 | init_MUTEX(&ec_ecdt->burst.sem); | 1321 | init_MUTEX(&ec_ecdt->intr.sem); |
1317 | init_waitqueue_head(&ec_ecdt->burst.wait); | 1322 | init_waitqueue_head(&ec_ecdt->intr.wait); |
1318 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 1323 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
1319 | acpi_ec_io_ports, ec_ecdt); | 1324 | acpi_ec_io_ports, ec_ecdt); |
1320 | if (ACPI_FAILURE(status)) | 1325 | if (ACPI_FAILURE(status)) |
@@ -1380,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void) | |||
1380 | 1385 | ||
1381 | static int __init acpi_ec_get_real_ecdt(void) | 1386 | static int __init acpi_ec_get_real_ecdt(void) |
1382 | { | 1387 | { |
1383 | if (acpi_ec_polling_mode) | 1388 | if (acpi_ec_poll_mode) |
1384 | return acpi_ec_polling_get_real_ecdt(); | 1389 | return acpi_ec_poll_get_real_ecdt(); |
1385 | else | 1390 | else |
1386 | return acpi_ec_burst_get_real_ecdt(); | 1391 | return acpi_ec_intr_get_real_ecdt(); |
1387 | } | 1392 | } |
1388 | 1393 | ||
1389 | static int __init acpi_ec_polling_get_real_ecdt(void) | 1394 | static int __init acpi_ec_poll_get_real_ecdt(void) |
1390 | { | 1395 | { |
1391 | acpi_status status; | 1396 | acpi_status status; |
1392 | struct acpi_table_ecdt *ecdt_ptr; | 1397 | struct acpi_table_ecdt *ecdt_ptr; |
@@ -1411,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) | |||
1411 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1416 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1412 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1417 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
1413 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | 1418 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; |
1414 | spin_lock_init(&ec_ecdt->polling.lock); | 1419 | spin_lock_init(&ec_ecdt->poll.lock); |
1415 | /* use the GL just to be safe */ | 1420 | /* use the GL just to be safe */ |
1416 | ec_ecdt->common.global_lock = TRUE; | 1421 | ec_ecdt->common.global_lock = TRUE; |
1417 | ec_ecdt->common.uid = ecdt_ptr->uid; | 1422 | ec_ecdt->common.uid = ecdt_ptr->uid; |
@@ -1431,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void) | |||
1431 | return -ENODEV; | 1436 | return -ENODEV; |
1432 | } | 1437 | } |
1433 | 1438 | ||
1434 | static int __init acpi_ec_burst_get_real_ecdt(void) | 1439 | static int __init acpi_ec_intr_get_real_ecdt(void) |
1435 | { | 1440 | { |
1436 | acpi_status status; | 1441 | acpi_status status; |
1437 | struct acpi_table_ecdt *ecdt_ptr; | 1442 | struct acpi_table_ecdt *ecdt_ptr; |
@@ -1452,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void) | |||
1452 | return -ENOMEM; | 1457 | return -ENOMEM; |
1453 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); | 1458 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
1454 | 1459 | ||
1455 | init_MUTEX(&ec_ecdt->burst.sem); | 1460 | init_MUTEX(&ec_ecdt->intr.sem); |
1456 | init_waitqueue_head(&ec_ecdt->burst.wait); | 1461 | init_waitqueue_head(&ec_ecdt->intr.wait); |
1457 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; | 1462 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; |
1458 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1463 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1459 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1464 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
@@ -1571,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str) | |||
1571 | } | 1576 | } |
1572 | 1577 | ||
1573 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); | 1578 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); |
1574 | static int __init acpi_ec_set_polling_mode(char *str) | 1579 | static int __init acpi_ec_set_intr_mode(char *str) |
1575 | { | 1580 | { |
1576 | int burst; | 1581 | int intr; |
1577 | 1582 | ||
1578 | if (!get_option(&str, &burst)) | 1583 | if (!get_option(&str, &intr)) |
1579 | return 0; | 1584 | return 0; |
1580 | 1585 | ||
1581 | if (burst) { | 1586 | if (intr) { |
1582 | acpi_ec_polling_mode = EC_BURST; | 1587 | acpi_ec_poll_mode = EC_INTR; |
1583 | acpi_ec_driver.ops.add = acpi_ec_burst_add; | 1588 | acpi_ec_driver.ops.add = acpi_ec_intr_add; |
1584 | } else { | 1589 | } else { |
1585 | acpi_ec_polling_mode = EC_POLLING; | 1590 | acpi_ec_poll_mode = EC_POLL; |
1586 | acpi_ec_driver.ops.add = acpi_ec_polling_add; | 1591 | acpi_ec_driver.ops.add = acpi_ec_poll_add; |
1587 | } | 1592 | } |
1588 | printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); | 1593 | printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling"); |
1589 | return 0; | 1594 | return 0; |
1590 | } | 1595 | } |
1591 | 1596 | ||
1592 | __setup("ec_burst=", acpi_ec_set_polling_mode); | 1597 | __setup("ec_intr=", acpi_ec_set_intr_mode); |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 58e7c47354ee..cc4a4903842a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -204,11 +204,13 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, | |||
204 | 204 | ||
205 | return AE_OK; | 205 | return AE_OK; |
206 | } | 206 | } |
207 | EXPORT_SYMBOL_GPL(acpi_os_map_memory); | ||
207 | 208 | ||
208 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | 209 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) |
209 | { | 210 | { |
210 | iounmap(virt); | 211 | iounmap(virt); |
211 | } | 212 | } |
213 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); | ||
212 | 214 | ||
213 | #ifdef ACPI_FUTURE_USAGE | 215 | #ifdef ACPI_FUTURE_USAGE |
214 | acpi_status | 216 | acpi_status |
@@ -836,7 +838,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
836 | static const int quantum_ms = 1000 / HZ; | 838 | static const int quantum_ms = 1000 / HZ; |
837 | 839 | ||
838 | ret = down_trylock(sem); | 840 | ret = down_trylock(sem); |
839 | for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { | 841 | for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) { |
840 | schedule_timeout_interruptible(1); | 842 | schedule_timeout_interruptible(1); |
841 | ret = down_trylock(sem); | 843 | ret = down_trylock(sem); |
842 | } | 844 | } |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 726dda1fce1c..65aee79b3971 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -361,8 +361,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, | |||
361 | 361 | ||
362 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { | 362 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { |
363 | /* PC card has the same IRQ as its cardbridge */ | 363 | /* PC card has the same IRQ as its cardbridge */ |
364 | pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, | 364 | bridge_pin = bridge->pin; |
365 | &bridge_pin); | ||
366 | if (!bridge_pin) { | 365 | if (!bridge_pin) { |
367 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 366 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
368 | "No interrupt pin configured for device %s\n", | 367 | "No interrupt pin configured for device %s\n", |
@@ -412,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
412 | if (!dev) | 411 | if (!dev) |
413 | return_VALUE(-EINVAL); | 412 | return_VALUE(-EINVAL); |
414 | 413 | ||
415 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 414 | pin = dev->pin; |
416 | if (!pin) { | 415 | if (!pin) { |
417 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 416 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
418 | "No interrupt pin configured for device %s\n", | 417 | "No interrupt pin configured for device %s\n", |
@@ -503,7 +502,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) | |||
503 | if (!dev || !dev->bus) | 502 | if (!dev || !dev->bus) |
504 | return_VOID; | 503 | return_VOID; |
505 | 504 | ||
506 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 505 | pin = dev->pin; |
507 | if (!pin) | 506 | if (!pin) |
508 | return_VOID; | 507 | return_VOID; |
509 | pin--; | 508 | pin--; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 1278aca96fe3..99a3a28594da 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -253,31 +253,21 @@ static int acpi_processor_errata(struct acpi_processor *pr) | |||
253 | * _PDC is required for a BIOS-OS handshake for most of the newer | 253 | * _PDC is required for a BIOS-OS handshake for most of the newer |
254 | * ACPI processor features. | 254 | * ACPI processor features. |
255 | */ | 255 | */ |
256 | 256 | static int acpi_processor_set_pdc(struct acpi_processor *pr) | |
257 | int acpi_processor_set_pdc(struct acpi_processor *pr, | ||
258 | struct acpi_object_list *pdc_in) | ||
259 | { | 257 | { |
258 | struct acpi_object_list *pdc_in = pr->pdc; | ||
260 | acpi_status status = AE_OK; | 259 | acpi_status status = AE_OK; |
261 | u32 arg0_buf[3]; | ||
262 | union acpi_object arg0 = { ACPI_TYPE_BUFFER }; | ||
263 | struct acpi_object_list no_object = { 1, &arg0 }; | ||
264 | struct acpi_object_list *pdc; | ||
265 | 260 | ||
266 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); | 261 | ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); |
267 | 262 | ||
268 | arg0.buffer.length = 12; | 263 | if (!pdc_in) |
269 | arg0.buffer.pointer = (u8 *) arg0_buf; | 264 | return_VALUE(status); |
270 | arg0_buf[0] = ACPI_PDC_REVISION_ID; | ||
271 | arg0_buf[1] = 0; | ||
272 | arg0_buf[2] = 0; | ||
273 | |||
274 | pdc = (pdc_in) ? pdc_in : &no_object; | ||
275 | 265 | ||
276 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL); | 266 | status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); |
277 | 267 | ||
278 | if ((ACPI_FAILURE(status)) && (pdc_in)) | 268 | if (ACPI_FAILURE(status)) |
279 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 269 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
280 | "Error evaluating _PDC, using legacy perf. control...\n")); | 270 | "Could not evaluate _PDC, using legacy perf. control...\n")); |
281 | 271 | ||
282 | return_VALUE(status); | 272 | return_VALUE(status); |
283 | } | 273 | } |
@@ -357,7 +347,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) | |||
357 | ACPI_PROCESSOR_FILE_THROTTLING)); | 347 | ACPI_PROCESSOR_FILE_THROTTLING)); |
358 | else { | 348 | else { |
359 | entry->proc_fops = &acpi_processor_throttling_fops; | 349 | entry->proc_fops = &acpi_processor_throttling_fops; |
360 | entry->proc_fops->write = acpi_processor_write_throttling; | ||
361 | entry->data = acpi_driver_data(device); | 350 | entry->data = acpi_driver_data(device); |
362 | entry->owner = THIS_MODULE; | 351 | entry->owner = THIS_MODULE; |
363 | } | 352 | } |
@@ -372,7 +361,6 @@ static int acpi_processor_add_fs(struct acpi_device *device) | |||
372 | ACPI_PROCESSOR_FILE_LIMIT)); | 361 | ACPI_PROCESSOR_FILE_LIMIT)); |
373 | else { | 362 | else { |
374 | entry->proc_fops = &acpi_processor_limit_fops; | 363 | entry->proc_fops = &acpi_processor_limit_fops; |
375 | entry->proc_fops->write = acpi_processor_write_limit; | ||
376 | entry->data = acpi_driver_data(device); | 364 | entry->data = acpi_driver_data(device); |
377 | entry->owner = THIS_MODULE; | 365 | entry->owner = THIS_MODULE; |
378 | } | 366 | } |
@@ -589,6 +577,10 @@ static int acpi_processor_start(struct acpi_device *device) | |||
589 | "Error installing device notify handler\n")); | 577 | "Error installing device notify handler\n")); |
590 | } | 578 | } |
591 | 579 | ||
580 | /* _PDC call should be done before doing anything else (if reqd.). */ | ||
581 | arch_acpi_processor_init_pdc(pr); | ||
582 | acpi_processor_set_pdc(pr); | ||
583 | |||
592 | acpi_processor_power_init(pr, device); | 584 | acpi_processor_power_init(pr, device); |
593 | 585 | ||
594 | if (pr->flags.throttling) { | 586 | if (pr->flags.throttling) { |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 807b0df308f1..be2dae52f6fa 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -95,22 +95,57 @@ static int set_max_cstate(struct dmi_system_id *id) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { | 97 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { |
98 | {set_max_cstate, "IBM ThinkPad R40e", { | 98 | { set_max_cstate, "IBM ThinkPad R40e", { |
99 | DMI_MATCH(DMI_BIOS_VENDOR, | 99 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
100 | "IBM"), | 100 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, |
101 | DMI_MATCH(DMI_BIOS_VERSION, | 101 | { set_max_cstate, "IBM ThinkPad R40e", { |
102 | "1SET60WW")}, | 102 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
103 | (void *)1}, | 103 | DMI_MATCH(DMI_BIOS_VERSION,"1SET43WW") }, (void*)1}, |
104 | {set_max_cstate, "Medion 41700", { | 104 | { set_max_cstate, "IBM ThinkPad R40e", { |
105 | DMI_MATCH(DMI_BIOS_VENDOR, | 105 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
106 | "Phoenix Technologies LTD"), | 106 | DMI_MATCH(DMI_BIOS_VERSION,"1SET45WW") }, (void*)1}, |
107 | DMI_MATCH(DMI_BIOS_VERSION, | 107 | { set_max_cstate, "IBM ThinkPad R40e", { |
108 | "R01-A1J")}, (void *)1}, | 108 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
109 | {set_max_cstate, "Clevo 5600D", { | 109 | DMI_MATCH(DMI_BIOS_VERSION,"1SET47WW") }, (void*)1}, |
110 | DMI_MATCH(DMI_BIOS_VENDOR, | 110 | { set_max_cstate, "IBM ThinkPad R40e", { |
111 | "Phoenix Technologies LTD"), | 111 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
112 | DMI_MATCH(DMI_BIOS_VERSION, | 112 | DMI_MATCH(DMI_BIOS_VERSION,"1SET50WW") }, (void*)1}, |
113 | "SHE845M0.86C.0013.D.0302131307")}, | 113 | { set_max_cstate, "IBM ThinkPad R40e", { |
114 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
115 | DMI_MATCH(DMI_BIOS_VERSION,"1SET52WW") }, (void*)1}, | ||
116 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
117 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
118 | DMI_MATCH(DMI_BIOS_VERSION,"1SET55WW") }, (void*)1}, | ||
119 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
120 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
121 | DMI_MATCH(DMI_BIOS_VERSION,"1SET56WW") }, (void*)1}, | ||
122 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
123 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
124 | DMI_MATCH(DMI_BIOS_VERSION,"1SET59WW") }, (void*)1}, | ||
125 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
126 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
127 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, | ||
128 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
129 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
130 | DMI_MATCH(DMI_BIOS_VERSION,"1SET61WW") }, (void*)1}, | ||
131 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
132 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
133 | DMI_MATCH(DMI_BIOS_VERSION,"1SET62WW") }, (void*)1}, | ||
134 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
135 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
136 | DMI_MATCH(DMI_BIOS_VERSION,"1SET64WW") }, (void*)1}, | ||
137 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
138 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
139 | DMI_MATCH(DMI_BIOS_VERSION,"1SET65WW") }, (void*)1}, | ||
140 | { set_max_cstate, "IBM ThinkPad R40e", { | ||
141 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | ||
142 | DMI_MATCH(DMI_BIOS_VERSION,"1SET68WW") }, (void*)1}, | ||
143 | { set_max_cstate, "Medion 41700", { | ||
144 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | ||
145 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J")}, (void *)1}, | ||
146 | { set_max_cstate, "Clevo 5600D", { | ||
147 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | ||
148 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")}, | ||
114 | (void *)2}, | 149 | (void *)2}, |
115 | {}, | 150 | {}, |
116 | }; | 151 | }; |
@@ -550,18 +585,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
550 | if (!pr->pblk) | 585 | if (!pr->pblk) |
551 | return_VALUE(-ENODEV); | 586 | return_VALUE(-ENODEV); |
552 | 587 | ||
553 | memset(pr->power.states, 0, sizeof(pr->power.states)); | ||
554 | |||
555 | /* if info is obtained from pblk/fadt, type equals state */ | 588 | /* if info is obtained from pblk/fadt, type equals state */ |
556 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | ||
557 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; | 589 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; |
558 | pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; | 590 | pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; |
559 | 591 | ||
560 | /* the C0 state only exists as a filler in our array, | ||
561 | * and all processors need to support C1 */ | ||
562 | pr->power.states[ACPI_STATE_C0].valid = 1; | ||
563 | pr->power.states[ACPI_STATE_C1].valid = 1; | ||
564 | |||
565 | #ifndef CONFIG_HOTPLUG_CPU | 592 | #ifndef CONFIG_HOTPLUG_CPU |
566 | /* | 593 | /* |
567 | * Check for P_LVL2_UP flag before entering C2 and above on | 594 | * Check for P_LVL2_UP flag before entering C2 and above on |
@@ -591,12 +618,11 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) | |||
591 | { | 618 | { |
592 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | 619 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); |
593 | 620 | ||
621 | /* Zero initialize all the C-states info. */ | ||
594 | memset(pr->power.states, 0, sizeof(pr->power.states)); | 622 | memset(pr->power.states, 0, sizeof(pr->power.states)); |
595 | 623 | ||
596 | /* if info is obtained from pblk/fadt, type equals state */ | 624 | /* set the first C-State to C1 */ |
597 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 625 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
598 | pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; | ||
599 | pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3; | ||
600 | 626 | ||
601 | /* the C0 state only exists as a filler in our array, | 627 | /* the C0 state only exists as a filler in our array, |
602 | * and all processors need to support C1 */ | 628 | * and all processors need to support C1 */ |
@@ -610,6 +636,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
610 | { | 636 | { |
611 | acpi_status status = 0; | 637 | acpi_status status = 0; |
612 | acpi_integer count; | 638 | acpi_integer count; |
639 | int current_count; | ||
613 | int i; | 640 | int i; |
614 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 641 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
615 | union acpi_object *cst; | 642 | union acpi_object *cst; |
@@ -619,10 +646,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
619 | if (nocst) | 646 | if (nocst) |
620 | return_VALUE(-ENODEV); | 647 | return_VALUE(-ENODEV); |
621 | 648 | ||
622 | pr->power.count = 0; | 649 | current_count = 1; |
623 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 650 | |
624 | memset(&(pr->power.states[i]), 0, | 651 | /* Zero initialize C2 onwards and prepare for fresh CST lookup */ |
625 | sizeof(struct acpi_processor_cx)); | 652 | for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++) |
653 | memset(&(pr->power.states[i]), 0, | ||
654 | sizeof(struct acpi_processor_cx)); | ||
626 | 655 | ||
627 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); | 656 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); |
628 | if (ACPI_FAILURE(status)) { | 657 | if (ACPI_FAILURE(status)) { |
@@ -650,16 +679,6 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
650 | goto end; | 679 | goto end; |
651 | } | 680 | } |
652 | 681 | ||
653 | /* We support up to ACPI_PROCESSOR_MAX_POWER. */ | ||
654 | if (count > ACPI_PROCESSOR_MAX_POWER) { | ||
655 | printk(KERN_WARNING | ||
656 | "Limiting number of power states to max (%d)\n", | ||
657 | ACPI_PROCESSOR_MAX_POWER); | ||
658 | printk(KERN_WARNING | ||
659 | "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); | ||
660 | count = ACPI_PROCESSOR_MAX_POWER; | ||
661 | } | ||
662 | |||
663 | /* Tell driver that at least _CST is supported. */ | 682 | /* Tell driver that at least _CST is supported. */ |
664 | pr->flags.has_cst = 1; | 683 | pr->flags.has_cst = 1; |
665 | 684 | ||
@@ -703,7 +722,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
703 | (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) | 722 | (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) |
704 | continue; | 723 | continue; |
705 | 724 | ||
706 | if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3)) | 725 | if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) |
707 | continue; | 726 | continue; |
708 | 727 | ||
709 | obj = (union acpi_object *)&(element->package.elements[2]); | 728 | obj = (union acpi_object *)&(element->package.elements[2]); |
@@ -718,15 +737,28 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
718 | 737 | ||
719 | cx.power = obj->integer.value; | 738 | cx.power = obj->integer.value; |
720 | 739 | ||
721 | (pr->power.count)++; | 740 | current_count++; |
722 | memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx)); | 741 | memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx)); |
742 | |||
743 | /* | ||
744 | * We support total ACPI_PROCESSOR_MAX_POWER - 1 | ||
745 | * (From 1 through ACPI_PROCESSOR_MAX_POWER - 1) | ||
746 | */ | ||
747 | if (current_count >= (ACPI_PROCESSOR_MAX_POWER - 1)) { | ||
748 | printk(KERN_WARNING | ||
749 | "Limiting number of power states to max (%d)\n", | ||
750 | ACPI_PROCESSOR_MAX_POWER); | ||
751 | printk(KERN_WARNING | ||
752 | "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n"); | ||
753 | break; | ||
754 | } | ||
723 | } | 755 | } |
724 | 756 | ||
725 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", | 757 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", |
726 | pr->power.count)); | 758 | current_count)); |
727 | 759 | ||
728 | /* Validate number of power states discovered */ | 760 | /* Validate number of power states discovered */ |
729 | if (pr->power.count < 2) | 761 | if (current_count < 2) |
730 | status = -EFAULT; | 762 | status = -EFAULT; |
731 | 763 | ||
732 | end: | 764 | end: |
@@ -843,6 +875,15 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
843 | unsigned int i; | 875 | unsigned int i; |
844 | unsigned int working = 0; | 876 | unsigned int working = 0; |
845 | 877 | ||
878 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | ||
879 | struct cpuinfo_x86 *c = cpu_data + pr->id; | ||
880 | cpumask_t mask = cpumask_of_cpu(pr->id); | ||
881 | |||
882 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
883 | on_each_cpu(switch_ipi_to_APIC_timer, &mask, 1, 1); | ||
884 | } | ||
885 | #endif | ||
886 | |||
846 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 887 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
847 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 888 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
848 | 889 | ||
@@ -857,6 +898,12 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
857 | 898 | ||
858 | case ACPI_STATE_C3: | 899 | case ACPI_STATE_C3: |
859 | acpi_processor_power_verify_c3(pr, cx); | 900 | acpi_processor_power_verify_c3(pr, cx); |
901 | #ifdef ARCH_APICTIMER_STOPS_ON_C3 | ||
902 | if (c->x86_vendor == X86_VENDOR_INTEL) { | ||
903 | on_each_cpu(switch_APIC_timer_to_ipi, | ||
904 | &mask, 1, 1); | ||
905 | } | ||
906 | #endif | ||
860 | break; | 907 | break; |
861 | } | 908 | } |
862 | 909 | ||
@@ -877,12 +924,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
877 | /* NOTE: the idle thread may not be running while calling | 924 | /* NOTE: the idle thread may not be running while calling |
878 | * this function */ | 925 | * this function */ |
879 | 926 | ||
927 | /* Adding C1 state */ | ||
928 | acpi_processor_get_power_info_default_c1(pr); | ||
880 | result = acpi_processor_get_power_info_cst(pr); | 929 | result = acpi_processor_get_power_info_cst(pr); |
881 | if (result == -ENODEV) | 930 | if (result == -ENODEV) |
882 | result = acpi_processor_get_power_info_fadt(pr); | 931 | acpi_processor_get_power_info_fadt(pr); |
883 | 932 | ||
884 | if ((result) || (acpi_processor_power_verify(pr) < 2)) | 933 | pr->power.count = acpi_processor_power_verify(pr); |
885 | result = acpi_processor_get_power_info_default_c1(pr); | ||
886 | 934 | ||
887 | /* | 935 | /* |
888 | * Set Default Policy | 936 | * Set Default Policy |
@@ -1051,8 +1099,6 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1051 | } | 1099 | } |
1052 | } | 1100 | } |
1053 | 1101 | ||
1054 | acpi_processor_power_init_pdc(&(pr->power), pr->id); | ||
1055 | acpi_processor_set_pdc(pr, pr->power.pdc); | ||
1056 | acpi_processor_get_power_info(pr); | 1102 | acpi_processor_get_power_info(pr); |
1057 | 1103 | ||
1058 | /* | 1104 | /* |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 22c7bb66c200..abbdb37a7f5f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -315,8 +315,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |||
315 | if (!pr || !pr->performance || !pr->handle) | 315 | if (!pr || !pr->performance || !pr->handle) |
316 | return_VALUE(-EINVAL); | 316 | return_VALUE(-EINVAL); |
317 | 317 | ||
318 | acpi_processor_set_pdc(pr, pr->performance->pdc); | ||
319 | |||
320 | status = acpi_get_handle(pr->handle, "_PCT", &handle); | 318 | status = acpi_get_handle(pr->handle, "_PCT", &handle); |
321 | if (ACPI_FAILURE(status)) { | 319 | if (ACPI_FAILURE(status)) { |
322 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 320 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -520,8 +518,8 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) | |||
520 | "Unable to create '%s' fs entry\n", | 518 | "Unable to create '%s' fs entry\n", |
521 | ACPI_PROCESSOR_FILE_PERFORMANCE)); | 519 | ACPI_PROCESSOR_FILE_PERFORMANCE)); |
522 | else { | 520 | else { |
521 | acpi_processor_perf_fops.write = acpi_processor_write_performance; | ||
523 | entry->proc_fops = &acpi_processor_perf_fops; | 522 | entry->proc_fops = &acpi_processor_perf_fops; |
524 | entry->proc_fops->write = acpi_processor_write_performance; | ||
525 | entry->data = acpi_driver_data(device); | 523 | entry->data = acpi_driver_data(device); |
526 | entry->owner = THIS_MODULE; | 524 | entry->owner = THIS_MODULE; |
527 | } | 525 | } |
diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index dc9817cfb882..f99ad05cd6a2 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c | |||
@@ -348,9 +348,9 @@ static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) | |||
348 | PDE(inode)->data); | 348 | PDE(inode)->data); |
349 | } | 349 | } |
350 | 350 | ||
351 | ssize_t acpi_processor_write_limit(struct file * file, | 351 | static ssize_t acpi_processor_write_limit(struct file * file, |
352 | const char __user * buffer, | 352 | const char __user * buffer, |
353 | size_t count, loff_t * data) | 353 | size_t count, loff_t * data) |
354 | { | 354 | { |
355 | int result = 0; | 355 | int result = 0; |
356 | struct seq_file *m = (struct seq_file *)file->private_data; | 356 | struct seq_file *m = (struct seq_file *)file->private_data; |
@@ -394,6 +394,7 @@ ssize_t acpi_processor_write_limit(struct file * file, | |||
394 | struct file_operations acpi_processor_limit_fops = { | 394 | struct file_operations acpi_processor_limit_fops = { |
395 | .open = acpi_processor_limit_open_fs, | 395 | .open = acpi_processor_limit_open_fs, |
396 | .read = seq_read, | 396 | .read = seq_read, |
397 | .write = acpi_processor_write_limit, | ||
397 | .llseek = seq_lseek, | 398 | .llseek = seq_lseek, |
398 | .release = single_release, | 399 | .release = single_release, |
399 | }; | 400 | }; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 74a52d4e79ae..b966549ec000 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -306,9 +306,9 @@ static int acpi_processor_throttling_open_fs(struct inode *inode, | |||
306 | PDE(inode)->data); | 306 | PDE(inode)->data); |
307 | } | 307 | } |
308 | 308 | ||
309 | ssize_t acpi_processor_write_throttling(struct file * file, | 309 | static ssize_t acpi_processor_write_throttling(struct file * file, |
310 | const char __user * buffer, | 310 | const char __user * buffer, |
311 | size_t count, loff_t * data) | 311 | size_t count, loff_t * data) |
312 | { | 312 | { |
313 | int result = 0; | 313 | int result = 0; |
314 | struct seq_file *m = (struct seq_file *)file->private_data; | 314 | struct seq_file *m = (struct seq_file *)file->private_data; |
@@ -337,6 +337,7 @@ ssize_t acpi_processor_write_throttling(struct file * file, | |||
337 | struct file_operations acpi_processor_throttling_fops = { | 337 | struct file_operations acpi_processor_throttling_fops = { |
338 | .open = acpi_processor_throttling_open_fs, | 338 | .open = acpi_processor_throttling_open_fs, |
339 | .read = seq_read, | 339 | .read = seq_read, |
340 | .write = acpi_processor_write_throttling, | ||
340 | .llseek = seq_lseek, | 341 | .llseek = seq_lseek, |
341 | .release = single_release, | 342 | .release = single_release, |
342 | }; | 343 | }; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index c60516d0f66b..9271e5209ac1 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -475,8 +475,10 @@ static LIST_HEAD(acpi_bus_drivers); | |||
475 | static DECLARE_MUTEX(acpi_bus_drivers_lock); | 475 | static DECLARE_MUTEX(acpi_bus_drivers_lock); |
476 | 476 | ||
477 | /** | 477 | /** |
478 | * acpi_bus_match | 478 | * acpi_bus_match - match device IDs to driver's supported IDs |
479 | * -------------- | 479 | * @device: the device that we are trying to match to a driver |
480 | * @driver: driver whose device id table is being checked | ||
481 | * | ||
480 | * Checks the device's hardware (_HID) or compatible (_CID) ids to see if it | 482 | * Checks the device's hardware (_HID) or compatible (_CID) ids to see if it |
481 | * matches the specified driver's criteria. | 483 | * matches the specified driver's criteria. |
482 | */ | 484 | */ |
@@ -489,8 +491,10 @@ acpi_bus_match(struct acpi_device *device, struct acpi_driver *driver) | |||
489 | } | 491 | } |
490 | 492 | ||
491 | /** | 493 | /** |
492 | * acpi_bus_driver_init | 494 | * acpi_bus_driver_init - add a device to a driver |
493 | * -------------------- | 495 | * @device: the device to add and initialize |
496 | * @driver: driver for the device | ||
497 | * | ||
494 | * Used to initialize a device via its device driver. Called whenever a | 498 | * Used to initialize a device via its device driver. Called whenever a |
495 | * driver is bound to a device. Invokes the driver's add() and start() ops. | 499 | * driver is bound to a device. Invokes the driver's add() and start() ops. |
496 | */ | 500 | */ |
@@ -603,8 +607,9 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
603 | } | 607 | } |
604 | 608 | ||
605 | /** | 609 | /** |
606 | * acpi_bus_register_driver | 610 | * acpi_bus_register_driver - register a driver with the ACPI bus |
607 | * ------------------------ | 611 | * @driver: driver being registered |
612 | * | ||
608 | * Registers a driver with the ACPI bus. Searches the namespace for all | 613 | * Registers a driver with the ACPI bus. Searches the namespace for all |
609 | * devices that match the driver's criteria and binds. Returns the | 614 | * devices that match the driver's criteria and binds. Returns the |
610 | * number of devices that were claimed by the driver, or a negative | 615 | * number of devices that were claimed by the driver, or a negative |
@@ -633,8 +638,9 @@ int acpi_bus_register_driver(struct acpi_driver *driver) | |||
633 | EXPORT_SYMBOL(acpi_bus_register_driver); | 638 | EXPORT_SYMBOL(acpi_bus_register_driver); |
634 | 639 | ||
635 | /** | 640 | /** |
636 | * acpi_bus_unregister_driver | 641 | * acpi_bus_unregister_driver - unregisters a driver with the APIC bus |
637 | * -------------------------- | 642 | * @driver: driver to unregister |
643 | * | ||
638 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 644 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
639 | * devices that match the driver's criteria and unbinds. | 645 | * devices that match the driver's criteria and unbinds. |
640 | */ | 646 | */ |
@@ -660,8 +666,9 @@ int acpi_bus_unregister_driver(struct acpi_driver *driver) | |||
660 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 666 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
661 | 667 | ||
662 | /** | 668 | /** |
663 | * acpi_bus_find_driver | 669 | * acpi_bus_find_driver - check if there is a driver installed for the device |
664 | * -------------------- | 670 | * @device: device that we are trying to find a supporting driver for |
671 | * | ||
665 | * Parses the list of registered drivers looking for a driver applicable for | 672 | * Parses the list of registered drivers looking for a driver applicable for |
666 | * the specified device. | 673 | * the specified device. |
667 | */ | 674 | */ |
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index af7935a95bcc..47fb4b394eec 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -33,9 +33,7 @@ int acpi_sleep_prepare(u32 acpi_state) | |||
33 | ACPI_FLUSH_CPU_CACHE(); | 33 | ACPI_FLUSH_CPU_CACHE(); |
34 | acpi_enable_wakeup_device_prep(acpi_state); | 34 | acpi_enable_wakeup_device_prep(acpi_state); |
35 | #endif | 35 | #endif |
36 | if (acpi_state == ACPI_STATE_S5) { | 36 | acpi_gpe_sleep_prepare(acpi_state); |
37 | acpi_wakeup_gpe_poweroff_prepare(); | ||
38 | } | ||
39 | acpi_enter_sleep_state_prep(acpi_state); | 37 | acpi_enter_sleep_state_prep(acpi_state); |
40 | return 0; | 38 | return 0; |
41 | } | 39 | } |
@@ -53,11 +51,16 @@ void acpi_power_off(void) | |||
53 | 51 | ||
54 | static int acpi_shutdown(struct sys_device *x) | 52 | static int acpi_shutdown(struct sys_device *x) |
55 | { | 53 | { |
56 | if (system_state == SYSTEM_POWER_OFF) { | 54 | switch (system_state) { |
57 | /* Prepare if we are going to power off the system */ | 55 | case SYSTEM_POWER_OFF: |
56 | /* Prepare to power off the system */ | ||
58 | return acpi_sleep_prepare(ACPI_STATE_S5); | 57 | return acpi_sleep_prepare(ACPI_STATE_S5); |
58 | case SYSTEM_SUSPEND_DISK: | ||
59 | /* Prepare to suspend the system to disk */ | ||
60 | return acpi_sleep_prepare(ACPI_STATE_S4); | ||
61 | default: | ||
62 | return 0; | ||
59 | } | 63 | } |
60 | return 0; | ||
61 | } | 64 | } |
62 | 65 | ||
63 | static struct sysdev_class acpi_sysclass = { | 66 | static struct sysdev_class acpi_sysclass = { |
diff --git a/drivers/acpi/sleep/sleep.h b/drivers/acpi/sleep/sleep.h index efd0001c6f05..f3e70397a7d6 100644 --- a/drivers/acpi/sleep/sleep.h +++ b/drivers/acpi/sleep/sleep.h | |||
@@ -5,4 +5,4 @@ extern int acpi_suspend (u32 state); | |||
5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); | 5 | extern void acpi_enable_wakeup_device_prep(u8 sleep_state); |
6 | extern void acpi_enable_wakeup_device(u8 sleep_state); | 6 | extern void acpi_enable_wakeup_device(u8 sleep_state); |
7 | extern void acpi_disable_wakeup_device(u8 sleep_state); | 7 | extern void acpi_disable_wakeup_device(u8 sleep_state); |
8 | extern void acpi_wakeup_gpe_poweroff_prepare(void); | 8 | extern void acpi_gpe_sleep_prepare(u32 sleep_state); |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 4134ed43d026..85df0ceda2a9 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -192,7 +192,7 @@ late_initcall(acpi_wakeup_device_init); | |||
192 | * RUNTIME GPEs, we simply mark all GPES that | 192 | * RUNTIME GPEs, we simply mark all GPES that |
193 | * are not enabled for wakeup from S5 as RUNTIME. | 193 | * are not enabled for wakeup from S5 as RUNTIME. |
194 | */ | 194 | */ |
195 | void acpi_wakeup_gpe_poweroff_prepare(void) | 195 | void acpi_gpe_sleep_prepare(u32 sleep_state) |
196 | { | 196 | { |
197 | struct list_head *node, *next; | 197 | struct list_head *node, *next; |
198 | 198 | ||
@@ -201,8 +201,8 @@ void acpi_wakeup_gpe_poweroff_prepare(void) | |||
201 | struct acpi_device, | 201 | struct acpi_device, |
202 | wakeup_list); | 202 | wakeup_list); |
203 | 203 | ||
204 | /* The GPE can wakeup system from S5, don't touch it */ | 204 | /* The GPE can wakeup system from this state, don't touch it */ |
205 | if ((u32) dev->wakeup.sleep_state == ACPI_STATE_S5) | 205 | if ((u32) dev->wakeup.sleep_state >= sleep_state) |
206 | continue; | 206 | continue; |
207 | /* acpi_set_gpe_type will automatically disable GPE */ | 207 | /* acpi_set_gpe_type will automatically disable GPE */ |
208 | acpi_set_gpe_type(dev->wakeup.gpe_device, | 208 | acpi_set_gpe_type(dev->wakeup.gpe_device, |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index a2bf25b05e1c..31d4f3ffc265 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #define PREFIX "ACPI: " | 38 | #define PREFIX "ACPI: " |
39 | 39 | ||
40 | #define ACPI_MAX_TABLES 256 | 40 | #define ACPI_MAX_TABLES 128 |
41 | 41 | ||
42 | static char *acpi_table_signatures[ACPI_TABLE_COUNT] = { | 42 | static char *acpi_table_signatures[ACPI_TABLE_COUNT] = { |
43 | [ACPI_TABLE_UNKNOWN] = "????", | 43 | [ACPI_TABLE_UNKNOWN] = "????", |
@@ -74,7 +74,7 @@ struct acpi_table_sdt { | |||
74 | static unsigned long sdt_pa; /* Physical Address */ | 74 | static unsigned long sdt_pa; /* Physical Address */ |
75 | static unsigned long sdt_count; /* Table count */ | 75 | static unsigned long sdt_count; /* Table count */ |
76 | 76 | ||
77 | static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES]; | 77 | static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata; |
78 | 78 | ||
79 | void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr) | 79 | void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr) |
80 | { | 80 | { |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index d10668f14699..bd4887518373 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -920,8 +920,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
920 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 920 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
921 | "Unable to create 'state' fs entry\n")); | 921 | "Unable to create 'state' fs entry\n")); |
922 | else { | 922 | else { |
923 | acpi_video_device_state_fops.write = acpi_video_device_write_state; | ||
923 | entry->proc_fops = &acpi_video_device_state_fops; | 924 | entry->proc_fops = &acpi_video_device_state_fops; |
924 | entry->proc_fops->write = acpi_video_device_write_state; | ||
925 | entry->data = acpi_driver_data(device); | 925 | entry->data = acpi_driver_data(device); |
926 | entry->owner = THIS_MODULE; | 926 | entry->owner = THIS_MODULE; |
927 | } | 927 | } |
@@ -934,8 +934,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
934 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 934 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
935 | "Unable to create 'brightness' fs entry\n")); | 935 | "Unable to create 'brightness' fs entry\n")); |
936 | else { | 936 | else { |
937 | acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; | ||
937 | entry->proc_fops = &acpi_video_device_brightness_fops; | 938 | entry->proc_fops = &acpi_video_device_brightness_fops; |
938 | entry->proc_fops->write = acpi_video_device_write_brightness; | ||
939 | entry->data = acpi_driver_data(device); | 939 | entry->data = acpi_driver_data(device); |
940 | entry->owner = THIS_MODULE; | 940 | entry->owner = THIS_MODULE; |
941 | } | 941 | } |
@@ -1239,8 +1239,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) | |||
1239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1240 | "Unable to create 'POST' fs entry\n")); | 1240 | "Unable to create 'POST' fs entry\n")); |
1241 | else { | 1241 | else { |
1242 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; | ||
1242 | entry->proc_fops = &acpi_video_bus_POST_fops; | 1243 | entry->proc_fops = &acpi_video_bus_POST_fops; |
1243 | entry->proc_fops->write = acpi_video_bus_write_POST; | ||
1244 | entry->data = acpi_driver_data(device); | 1244 | entry->data = acpi_driver_data(device); |
1245 | entry->owner = THIS_MODULE; | 1245 | entry->owner = THIS_MODULE; |
1246 | } | 1246 | } |
@@ -1253,8 +1253,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) | |||
1253 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1253 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1254 | "Unable to create 'DOS' fs entry\n")); | 1254 | "Unable to create 'DOS' fs entry\n")); |
1255 | else { | 1255 | else { |
1256 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; | ||
1256 | entry->proc_fops = &acpi_video_bus_DOS_fops; | 1257 | entry->proc_fops = &acpi_video_bus_DOS_fops; |
1257 | entry->proc_fops->write = acpi_video_bus_write_DOS; | ||
1258 | entry->data = acpi_driver_data(device); | 1258 | entry->data = acpi_driver_data(device); |
1259 | entry->owner = THIS_MODULE; | 1259 | entry->owner = THIS_MODULE; |
1260 | } | 1260 | } |