diff options
Diffstat (limited to 'drivers/acpi')
63 files changed, 1528 insertions, 1227 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 139f41f033d8..1121a1f4b5d7 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -280,6 +280,14 @@ config ACPI_DEBUG | |||
280 | of verbosity. Saying Y enables these statements. This will increase | 280 | of verbosity. Saying Y enables these statements. This will increase |
281 | your kernel size by around 50K. | 281 | your kernel size by around 50K. |
282 | 282 | ||
283 | config ACPI_DEBUG_FUNC_TRACE | ||
284 | bool "Additionally enable ACPI function tracing" | ||
285 | default n | ||
286 | depends on ACPI_DEBUG | ||
287 | help | ||
288 | ACPI Debug Statements slow down ACPI processing. Function trace | ||
289 | is about half of the penalty and is rarely useful. | ||
290 | |||
283 | config ACPI_EC | 291 | config ACPI_EC |
284 | bool | 292 | bool |
285 | default y | 293 | default y |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index b770deab968c..3cd79caad70c 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -1357,7 +1357,7 @@ static struct backlight_ops asus_backlight_data = { | |||
1357 | .update_status = set_brightness_status, | 1357 | .update_status = set_brightness_status, |
1358 | }; | 1358 | }; |
1359 | 1359 | ||
1360 | static void __exit asus_acpi_exit(void) | 1360 | static void asus_acpi_exit(void) |
1361 | { | 1361 | { |
1362 | if (asus_backlight_device) | 1362 | if (asus_backlight_device) |
1363 | backlight_device_unregister(asus_backlight_device); | 1363 | backlight_device_unregister(asus_backlight_device); |
@@ -1398,7 +1398,7 @@ static int __init asus_acpi_init(void) | |||
1398 | if (!asus_hotk_found) { | 1398 | if (!asus_hotk_found) { |
1399 | acpi_bus_unregister_driver(&asus_hotk_driver); | 1399 | acpi_bus_unregister_driver(&asus_hotk_driver); |
1400 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | 1400 | remove_proc_entry(PROC_ASUS, acpi_root_dir); |
1401 | return result; | 1401 | return -ENODEV; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | asus_backlight_device = backlight_device_register("asus",NULL,NULL, | 1404 | asus_backlight_device = backlight_device_register("asus",NULL,NULL, |
@@ -1407,6 +1407,7 @@ static int __init asus_acpi_init(void) | |||
1407 | printk(KERN_ERR "Could not register asus backlight device\n"); | 1407 | printk(KERN_ERR "Could not register asus backlight device\n"); |
1408 | asus_backlight_device = NULL; | 1408 | asus_backlight_device = NULL; |
1409 | asus_acpi_exit(); | 1409 | asus_acpi_exit(); |
1410 | return -ENODEV; | ||
1410 | } | 1411 | } |
1411 | asus_backlight_device->props.max_brightness = 15; | 1412 | asus_backlight_device->props.max_brightness = 15; |
1412 | 1413 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e64c76c8b726..cad932de383d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -43,21 +43,30 @@ | |||
43 | #define ACPI_BATTERY_CLASS "battery" | 43 | #define ACPI_BATTERY_CLASS "battery" |
44 | #define ACPI_BATTERY_HID "PNP0C0A" | 44 | #define ACPI_BATTERY_HID "PNP0C0A" |
45 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 45 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
46 | #define ACPI_BATTERY_FILE_INFO "info" | ||
47 | #define ACPI_BATTERY_FILE_STATUS "state" | ||
48 | #define ACPI_BATTERY_FILE_ALARM "alarm" | ||
49 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 46 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
50 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | 47 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 |
51 | #define ACPI_BATTERY_UNITS_WATTS "mW" | 48 | #define ACPI_BATTERY_UNITS_WATTS "mW" |
52 | #define ACPI_BATTERY_UNITS_AMPS "mA" | 49 | #define ACPI_BATTERY_UNITS_AMPS "mA" |
53 | 50 | ||
54 | #define _COMPONENT ACPI_BATTERY_COMPONENT | 51 | #define _COMPONENT ACPI_BATTERY_COMPONENT |
52 | |||
53 | #define ACPI_BATTERY_UPDATE_TIME 0 | ||
54 | |||
55 | #define ACPI_BATTERY_NONE_UPDATE 0 | ||
56 | #define ACPI_BATTERY_EASY_UPDATE 1 | ||
57 | #define ACPI_BATTERY_INIT_UPDATE 2 | ||
58 | |||
55 | ACPI_MODULE_NAME("battery"); | 59 | ACPI_MODULE_NAME("battery"); |
56 | 60 | ||
57 | MODULE_AUTHOR("Paul Diefenbaugh"); | 61 | MODULE_AUTHOR("Paul Diefenbaugh"); |
58 | MODULE_DESCRIPTION("ACPI Battery Driver"); | 62 | MODULE_DESCRIPTION("ACPI Battery Driver"); |
59 | MODULE_LICENSE("GPL"); | 63 | MODULE_LICENSE("GPL"); |
60 | 64 | ||
65 | static unsigned int update_time = ACPI_BATTERY_UPDATE_TIME; | ||
66 | |||
67 | /* 0 - every time, > 0 - by update_time */ | ||
68 | module_param(update_time, uint, 0644); | ||
69 | |||
61 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); | 70 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
62 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | 71 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
63 | 72 | ||
@@ -76,7 +85,7 @@ static struct acpi_driver acpi_battery_driver = { | |||
76 | }, | 85 | }, |
77 | }; | 86 | }; |
78 | 87 | ||
79 | struct acpi_battery_status { | 88 | struct acpi_battery_state { |
80 | acpi_integer state; | 89 | acpi_integer state; |
81 | acpi_integer present_rate; | 90 | acpi_integer present_rate; |
82 | acpi_integer remaining_capacity; | 91 | acpi_integer remaining_capacity; |
@@ -99,33 +108,111 @@ struct acpi_battery_info { | |||
99 | acpi_string oem_info; | 108 | acpi_string oem_info; |
100 | }; | 109 | }; |
101 | 110 | ||
102 | struct acpi_battery_flags { | 111 | enum acpi_battery_files{ |
103 | u8 present:1; /* Bay occupied? */ | 112 | ACPI_BATTERY_INFO = 0, |
104 | u8 power_unit:1; /* 0=watts, 1=apms */ | 113 | ACPI_BATTERY_STATE, |
105 | u8 alarm:1; /* _BTP present? */ | 114 | ACPI_BATTERY_ALARM, |
106 | u8 reserved:5; | 115 | ACPI_BATTERY_NUMFILES, |
107 | }; | 116 | }; |
108 | 117 | ||
109 | struct acpi_battery_trips { | 118 | struct acpi_battery_flags { |
110 | unsigned long warning; | 119 | u8 battery_present_prev; |
111 | unsigned long low; | 120 | u8 alarm_present; |
121 | u8 init_update; | ||
122 | u8 update[ACPI_BATTERY_NUMFILES]; | ||
123 | u8 power_unit; | ||
112 | }; | 124 | }; |
113 | 125 | ||
114 | struct acpi_battery { | 126 | struct acpi_battery { |
115 | struct acpi_device * device; | 127 | struct mutex mutex; |
128 | struct acpi_device *device; | ||
116 | struct acpi_battery_flags flags; | 129 | struct acpi_battery_flags flags; |
117 | struct acpi_battery_trips trips; | 130 | struct acpi_buffer bif_data; |
131 | struct acpi_buffer bst_data; | ||
118 | unsigned long alarm; | 132 | unsigned long alarm; |
119 | struct acpi_battery_info *info; | 133 | unsigned long update_time[ACPI_BATTERY_NUMFILES]; |
120 | }; | 134 | }; |
121 | 135 | ||
136 | inline int acpi_battery_present(struct acpi_battery *battery) | ||
137 | { | ||
138 | return battery->device->status.battery_present; | ||
139 | } | ||
140 | inline char *acpi_battery_power_units(struct acpi_battery *battery) | ||
141 | { | ||
142 | if (battery->flags.power_unit) | ||
143 | return ACPI_BATTERY_UNITS_AMPS; | ||
144 | else | ||
145 | return ACPI_BATTERY_UNITS_WATTS; | ||
146 | } | ||
147 | |||
148 | inline acpi_handle acpi_battery_handle(struct acpi_battery *battery) | ||
149 | { | ||
150 | return battery->device->handle; | ||
151 | } | ||
152 | |||
122 | /* -------------------------------------------------------------------------- | 153 | /* -------------------------------------------------------------------------- |
123 | Battery Management | 154 | Battery Management |
124 | -------------------------------------------------------------------------- */ | 155 | -------------------------------------------------------------------------- */ |
125 | 156 | ||
126 | static int | 157 | static void acpi_battery_check_result(struct acpi_battery *battery, int result) |
127 | acpi_battery_get_info(struct acpi_battery *battery, | 158 | { |
128 | struct acpi_battery_info **bif) | 159 | if (!battery) |
160 | return; | ||
161 | |||
162 | if (result) { | ||
163 | battery->flags.init_update = 1; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | static int acpi_battery_extract_package(struct acpi_battery *battery, | ||
168 | union acpi_object *package, | ||
169 | struct acpi_buffer *format, | ||
170 | struct acpi_buffer *data, | ||
171 | char *package_name) | ||
172 | { | ||
173 | acpi_status status = AE_OK; | ||
174 | struct acpi_buffer data_null = { 0, NULL }; | ||
175 | |||
176 | status = acpi_extract_package(package, format, &data_null); | ||
177 | if (status != AE_BUFFER_OVERFLOW) { | ||
178 | ACPI_EXCEPTION((AE_INFO, status, "Extracting size %s", | ||
179 | package_name)); | ||
180 | return -ENODEV; | ||
181 | } | ||
182 | |||
183 | if (data_null.length != data->length) { | ||
184 | kfree(data->pointer); | ||
185 | data->pointer = kzalloc(data_null.length, GFP_KERNEL); | ||
186 | if (!data->pointer) { | ||
187 | ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "kzalloc()")); | ||
188 | return -ENOMEM; | ||
189 | } | ||
190 | data->length = data_null.length; | ||
191 | } | ||
192 | |||
193 | status = acpi_extract_package(package, format, data); | ||
194 | if (ACPI_FAILURE(status)) { | ||
195 | ACPI_EXCEPTION((AE_INFO, status, "Extracting %s", | ||
196 | package_name)); | ||
197 | return -ENODEV; | ||
198 | } | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static int acpi_battery_get_status(struct acpi_battery *battery) | ||
204 | { | ||
205 | int result = 0; | ||
206 | |||
207 | result = acpi_bus_get_status(battery->device); | ||
208 | if (result) { | ||
209 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Evaluating _STA")); | ||
210 | return -ENODEV; | ||
211 | } | ||
212 | return result; | ||
213 | } | ||
214 | |||
215 | static int acpi_battery_get_info(struct acpi_battery *battery) | ||
129 | { | 216 | { |
130 | int result = 0; | 217 | int result = 0; |
131 | acpi_status status = 0; | 218 | acpi_status status = 0; |
@@ -133,16 +220,20 @@ acpi_battery_get_info(struct acpi_battery *battery, | |||
133 | struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF), | 220 | struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF), |
134 | ACPI_BATTERY_FORMAT_BIF | 221 | ACPI_BATTERY_FORMAT_BIF |
135 | }; | 222 | }; |
136 | struct acpi_buffer data = { 0, NULL }; | ||
137 | union acpi_object *package = NULL; | 223 | union acpi_object *package = NULL; |
224 | struct acpi_buffer *data = NULL; | ||
225 | struct acpi_battery_info *bif = NULL; | ||
138 | 226 | ||
227 | battery->update_time[ACPI_BATTERY_INFO] = get_seconds(); | ||
139 | 228 | ||
140 | if (!battery || !bif) | 229 | if (!acpi_battery_present(battery)) |
141 | return -EINVAL; | 230 | return 0; |
142 | 231 | ||
143 | /* Evalute _BIF */ | 232 | /* Evaluate _BIF */ |
144 | 233 | ||
145 | status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer); | 234 | status = |
235 | acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL, | ||
236 | &buffer); | ||
146 | if (ACPI_FAILURE(status)) { | 237 | if (ACPI_FAILURE(status)) { |
147 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 238 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); |
148 | return -ENODEV; | 239 | return -ENODEV; |
@@ -150,41 +241,29 @@ acpi_battery_get_info(struct acpi_battery *battery, | |||
150 | 241 | ||
151 | package = buffer.pointer; | 242 | package = buffer.pointer; |
152 | 243 | ||
153 | /* Extract Package Data */ | 244 | data = &battery->bif_data; |
154 | |||
155 | status = acpi_extract_package(package, &format, &data); | ||
156 | if (status != AE_BUFFER_OVERFLOW) { | ||
157 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); | ||
158 | result = -ENODEV; | ||
159 | goto end; | ||
160 | } | ||
161 | 245 | ||
162 | data.pointer = kzalloc(data.length, GFP_KERNEL); | 246 | /* Extract Package Data */ |
163 | if (!data.pointer) { | ||
164 | result = -ENOMEM; | ||
165 | goto end; | ||
166 | } | ||
167 | 247 | ||
168 | status = acpi_extract_package(package, &format, &data); | 248 | result = |
169 | if (ACPI_FAILURE(status)) { | 249 | acpi_battery_extract_package(battery, package, &format, data, |
170 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); | 250 | "_BIF"); |
171 | kfree(data.pointer); | 251 | if (result) |
172 | result = -ENODEV; | ||
173 | goto end; | 252 | goto end; |
174 | } | ||
175 | 253 | ||
176 | end: | 254 | end: |
255 | |||
177 | kfree(buffer.pointer); | 256 | kfree(buffer.pointer); |
178 | 257 | ||
179 | if (!result) | 258 | if (!result) { |
180 | (*bif) = data.pointer; | 259 | bif = data->pointer; |
260 | battery->flags.power_unit = bif->power_unit; | ||
261 | } | ||
181 | 262 | ||
182 | return result; | 263 | return result; |
183 | } | 264 | } |
184 | 265 | ||
185 | static int | 266 | static int acpi_battery_get_state(struct acpi_battery *battery) |
186 | acpi_battery_get_status(struct acpi_battery *battery, | ||
187 | struct acpi_battery_status **bst) | ||
188 | { | 267 | { |
189 | int result = 0; | 268 | int result = 0; |
190 | acpi_status status = 0; | 269 | acpi_status status = 0; |
@@ -192,16 +271,19 @@ acpi_battery_get_status(struct acpi_battery *battery, | |||
192 | struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST), | 271 | struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST), |
193 | ACPI_BATTERY_FORMAT_BST | 272 | ACPI_BATTERY_FORMAT_BST |
194 | }; | 273 | }; |
195 | struct acpi_buffer data = { 0, NULL }; | ||
196 | union acpi_object *package = NULL; | 274 | union acpi_object *package = NULL; |
275 | struct acpi_buffer *data = NULL; | ||
197 | 276 | ||
277 | battery->update_time[ACPI_BATTERY_STATE] = get_seconds(); | ||
198 | 278 | ||
199 | if (!battery || !bst) | 279 | if (!acpi_battery_present(battery)) |
200 | return -EINVAL; | 280 | return 0; |
201 | 281 | ||
202 | /* Evalute _BST */ | 282 | /* Evaluate _BST */ |
203 | 283 | ||
204 | status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer); | 284 | status = |
285 | acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL, | ||
286 | &buffer); | ||
205 | if (ACPI_FAILURE(status)) { | 287 | if (ACPI_FAILURE(status)) { |
206 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); | 288 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); |
207 | return -ENODEV; | 289 | return -ENODEV; |
@@ -209,55 +291,49 @@ acpi_battery_get_status(struct acpi_battery *battery, | |||
209 | 291 | ||
210 | package = buffer.pointer; | 292 | package = buffer.pointer; |
211 | 293 | ||
212 | /* Extract Package Data */ | 294 | data = &battery->bst_data; |
213 | |||
214 | status = acpi_extract_package(package, &format, &data); | ||
215 | if (status != AE_BUFFER_OVERFLOW) { | ||
216 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); | ||
217 | result = -ENODEV; | ||
218 | goto end; | ||
219 | } | ||
220 | 295 | ||
221 | data.pointer = kzalloc(data.length, GFP_KERNEL); | 296 | /* Extract Package Data */ |
222 | if (!data.pointer) { | ||
223 | result = -ENOMEM; | ||
224 | goto end; | ||
225 | } | ||
226 | 297 | ||
227 | status = acpi_extract_package(package, &format, &data); | 298 | result = |
228 | if (ACPI_FAILURE(status)) { | 299 | acpi_battery_extract_package(battery, package, &format, data, |
229 | ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); | 300 | "_BST"); |
230 | kfree(data.pointer); | 301 | if (result) |
231 | result = -ENODEV; | ||
232 | goto end; | 302 | goto end; |
233 | } | ||
234 | 303 | ||
235 | end: | 304 | end: |
236 | kfree(buffer.pointer); | 305 | kfree(buffer.pointer); |
237 | 306 | ||
238 | if (!result) | ||
239 | (*bst) = data.pointer; | ||
240 | |||
241 | return result; | 307 | return result; |
242 | } | 308 | } |
243 | 309 | ||
244 | static int | 310 | static int acpi_battery_get_alarm(struct acpi_battery *battery) |
245 | acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) | 311 | { |
312 | battery->update_time[ACPI_BATTERY_ALARM] = get_seconds(); | ||
313 | |||
314 | return 0; | ||
315 | } | ||
316 | |||
317 | static int acpi_battery_set_alarm(struct acpi_battery *battery, | ||
318 | unsigned long alarm) | ||
246 | { | 319 | { |
247 | acpi_status status = 0; | 320 | acpi_status status = 0; |
248 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 321 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
249 | struct acpi_object_list arg_list = { 1, &arg0 }; | 322 | struct acpi_object_list arg_list = { 1, &arg0 }; |
250 | 323 | ||
324 | battery->update_time[ACPI_BATTERY_ALARM] = get_seconds(); | ||
251 | 325 | ||
252 | if (!battery) | 326 | if (!acpi_battery_present(battery)) |
253 | return -EINVAL; | 327 | return -ENODEV; |
254 | 328 | ||
255 | if (!battery->flags.alarm) | 329 | if (!battery->flags.alarm_present) |
256 | return -ENODEV; | 330 | return -ENODEV; |
257 | 331 | ||
258 | arg0.integer.value = alarm; | 332 | arg0.integer.value = alarm; |
259 | 333 | ||
260 | status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL); | 334 | status = |
335 | acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", | ||
336 | &arg_list, NULL); | ||
261 | if (ACPI_FAILURE(status)) | 337 | if (ACPI_FAILURE(status)) |
262 | return -ENODEV; | 338 | return -ENODEV; |
263 | 339 | ||
@@ -268,65 +344,114 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) | |||
268 | return 0; | 344 | return 0; |
269 | } | 345 | } |
270 | 346 | ||
271 | static int acpi_battery_check(struct acpi_battery *battery) | 347 | static int acpi_battery_init_alarm(struct acpi_battery *battery) |
272 | { | 348 | { |
273 | int result = 0; | 349 | int result = 0; |
274 | acpi_status status = AE_OK; | 350 | acpi_status status = AE_OK; |
275 | acpi_handle handle = NULL; | 351 | acpi_handle handle = NULL; |
276 | struct acpi_device *device = NULL; | 352 | struct acpi_battery_info *bif = battery->bif_data.pointer; |
277 | struct acpi_battery_info *bif = NULL; | 353 | unsigned long alarm = battery->alarm; |
278 | 354 | ||
355 | /* See if alarms are supported, and if so, set default */ | ||
279 | 356 | ||
280 | if (!battery) | 357 | status = acpi_get_handle(acpi_battery_handle(battery), "_BTP", &handle); |
281 | return -EINVAL; | 358 | if (ACPI_SUCCESS(status)) { |
282 | 359 | battery->flags.alarm_present = 1; | |
283 | device = battery->device; | 360 | if (!alarm && bif) { |
361 | alarm = bif->design_capacity_warning; | ||
362 | } | ||
363 | result = acpi_battery_set_alarm(battery, alarm); | ||
364 | if (result) | ||
365 | goto end; | ||
366 | } else { | ||
367 | battery->flags.alarm_present = 0; | ||
368 | } | ||
284 | 369 | ||
285 | result = acpi_bus_get_status(device); | 370 | end: |
286 | if (result) | ||
287 | return result; | ||
288 | 371 | ||
289 | /* Insertion? */ | 372 | return result; |
373 | } | ||
290 | 374 | ||
291 | if (!battery->flags.present && device->status.battery_present) { | 375 | static int acpi_battery_init_update(struct acpi_battery *battery) |
376 | { | ||
377 | int result = 0; | ||
292 | 378 | ||
293 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Battery inserted\n")); | 379 | result = acpi_battery_get_status(battery); |
380 | if (result) | ||
381 | return result; | ||
294 | 382 | ||
295 | /* Evalute _BIF to get certain static information */ | 383 | battery->flags.battery_present_prev = acpi_battery_present(battery); |
296 | 384 | ||
297 | result = acpi_battery_get_info(battery, &bif); | 385 | if (acpi_battery_present(battery)) { |
386 | result = acpi_battery_get_info(battery); | ||
387 | if (result) | ||
388 | return result; | ||
389 | result = acpi_battery_get_state(battery); | ||
298 | if (result) | 390 | if (result) |
299 | return result; | 391 | return result; |
300 | 392 | ||
301 | battery->flags.power_unit = bif->power_unit; | 393 | acpi_battery_init_alarm(battery); |
302 | battery->trips.warning = bif->design_capacity_warning; | 394 | } |
303 | battery->trips.low = bif->design_capacity_low; | 395 | |
304 | kfree(bif); | 396 | return result; |
397 | } | ||
305 | 398 | ||
306 | /* See if alarms are supported, and if so, set default */ | 399 | static int acpi_battery_update(struct acpi_battery *battery, |
400 | int update, int *update_result_ptr) | ||
401 | { | ||
402 | int result = 0; | ||
403 | int update_result = ACPI_BATTERY_NONE_UPDATE; | ||
404 | |||
405 | if (!acpi_battery_present(battery)) { | ||
406 | update = 1; | ||
407 | } | ||
307 | 408 | ||
308 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); | 409 | if (battery->flags.init_update) { |
309 | if (ACPI_SUCCESS(status)) { | 410 | result = acpi_battery_init_update(battery); |
310 | battery->flags.alarm = 1; | 411 | if (result) |
311 | acpi_battery_set_alarm(battery, battery->trips.warning); | 412 | goto end; |
413 | update_result = ACPI_BATTERY_INIT_UPDATE; | ||
414 | } else if (update) { | ||
415 | result = acpi_battery_get_status(battery); | ||
416 | if (result) | ||
417 | goto end; | ||
418 | if ((!battery->flags.battery_present_prev & acpi_battery_present(battery)) | ||
419 | || (battery->flags.battery_present_prev & !acpi_battery_present(battery))) { | ||
420 | result = acpi_battery_init_update(battery); | ||
421 | if (result) | ||
422 | goto end; | ||
423 | update_result = ACPI_BATTERY_INIT_UPDATE; | ||
424 | } else { | ||
425 | update_result = ACPI_BATTERY_EASY_UPDATE; | ||
312 | } | 426 | } |
313 | } | 427 | } |
314 | 428 | ||
315 | /* Removal? */ | 429 | end: |
316 | 430 | ||
317 | else if (battery->flags.present && !device->status.battery_present) { | 431 | battery->flags.init_update = (result != 0); |
318 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Battery removed\n")); | ||
319 | } | ||
320 | 432 | ||
321 | battery->flags.present = device->status.battery_present; | 433 | *update_result_ptr = update_result; |
322 | 434 | ||
323 | return result; | 435 | return result; |
324 | } | 436 | } |
325 | 437 | ||
326 | static void acpi_battery_check_present(struct acpi_battery *battery) | 438 | static void acpi_battery_notify_update(struct acpi_battery *battery) |
327 | { | 439 | { |
328 | if (!battery->flags.present) { | 440 | acpi_battery_get_status(battery); |
329 | acpi_battery_check(battery); | 441 | |
442 | if (battery->flags.init_update) { | ||
443 | return; | ||
444 | } | ||
445 | |||
446 | if ((!battery->flags.battery_present_prev & | ||
447 | acpi_battery_present(battery)) || | ||
448 | (battery->flags.battery_present_prev & | ||
449 | !acpi_battery_present(battery))) { | ||
450 | battery->flags.init_update = 1; | ||
451 | } else { | ||
452 | battery->flags.update[ACPI_BATTERY_INFO] = 1; | ||
453 | battery->flags.update[ACPI_BATTERY_STATE] = 1; | ||
454 | battery->flags.update[ACPI_BATTERY_ALARM] = 1; | ||
330 | } | 455 | } |
331 | } | 456 | } |
332 | 457 | ||
@@ -335,37 +460,33 @@ static void acpi_battery_check_present(struct acpi_battery *battery) | |||
335 | -------------------------------------------------------------------------- */ | 460 | -------------------------------------------------------------------------- */ |
336 | 461 | ||
337 | static struct proc_dir_entry *acpi_battery_dir; | 462 | static struct proc_dir_entry *acpi_battery_dir; |
338 | static int acpi_battery_read_info(struct seq_file *seq, void *offset) | 463 | |
464 | static int acpi_battery_print_info(struct seq_file *seq, int result) | ||
339 | { | 465 | { |
340 | int result = 0; | ||
341 | struct acpi_battery *battery = seq->private; | 466 | struct acpi_battery *battery = seq->private; |
342 | struct acpi_battery_info *bif = NULL; | 467 | struct acpi_battery_info *bif = NULL; |
343 | char *units = "?"; | 468 | char *units = "?"; |
344 | 469 | ||
345 | 470 | if (result) | |
346 | if (!battery) | ||
347 | goto end; | 471 | goto end; |
348 | 472 | ||
349 | acpi_battery_check_present(battery); | 473 | if (acpi_battery_present(battery)) |
350 | |||
351 | if (battery->flags.present) | ||
352 | seq_printf(seq, "present: yes\n"); | 474 | seq_printf(seq, "present: yes\n"); |
353 | else { | 475 | else { |
354 | seq_printf(seq, "present: no\n"); | 476 | seq_printf(seq, "present: no\n"); |
355 | goto end; | 477 | goto end; |
356 | } | 478 | } |
357 | 479 | ||
358 | /* Battery Info (_BIF) */ | 480 | bif = battery->bif_data.pointer; |
359 | 481 | if (!bif) { | |
360 | result = acpi_battery_get_info(battery, &bif); | 482 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "BIF buffer is NULL")); |
361 | if (result || !bif) { | 483 | result = -ENODEV; |
362 | seq_printf(seq, "ERROR: Unable to read battery information\n"); | ||
363 | goto end; | 484 | goto end; |
364 | } | 485 | } |
365 | 486 | ||
366 | units = | 487 | /* Battery Units */ |
367 | bif-> | 488 | |
368 | power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; | 489 | units = acpi_battery_power_units(battery); |
369 | 490 | ||
370 | if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) | 491 | if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
371 | seq_printf(seq, "design capacity: unknown\n"); | 492 | seq_printf(seq, "design capacity: unknown\n"); |
@@ -396,7 +517,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
396 | else | 517 | else |
397 | seq_printf(seq, "design voltage: %d mV\n", | 518 | seq_printf(seq, "design voltage: %d mV\n", |
398 | (u32) bif->design_voltage); | 519 | (u32) bif->design_voltage); |
399 | |||
400 | seq_printf(seq, "design capacity warning: %d %sh\n", | 520 | seq_printf(seq, "design capacity warning: %d %sh\n", |
401 | (u32) bif->design_capacity_warning, units); | 521 | (u32) bif->design_capacity_warning, units); |
402 | seq_printf(seq, "design capacity low: %d %sh\n", | 522 | seq_printf(seq, "design capacity low: %d %sh\n", |
@@ -411,50 +531,40 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
411 | seq_printf(seq, "OEM info: %s\n", bif->oem_info); | 531 | seq_printf(seq, "OEM info: %s\n", bif->oem_info); |
412 | 532 | ||
413 | end: | 533 | end: |
414 | kfree(bif); | ||
415 | 534 | ||
416 | return 0; | 535 | if (result) |
417 | } | 536 | seq_printf(seq, "ERROR: Unable to read battery info\n"); |
418 | 537 | ||
419 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) | 538 | return result; |
420 | { | ||
421 | return single_open(file, acpi_battery_read_info, PDE(inode)->data); | ||
422 | } | 539 | } |
423 | 540 | ||
424 | static int acpi_battery_read_state(struct seq_file *seq, void *offset) | 541 | static int acpi_battery_print_state(struct seq_file *seq, int result) |
425 | { | 542 | { |
426 | int result = 0; | ||
427 | struct acpi_battery *battery = seq->private; | 543 | struct acpi_battery *battery = seq->private; |
428 | struct acpi_battery_status *bst = NULL; | 544 | struct acpi_battery_state *bst = NULL; |
429 | char *units = "?"; | 545 | char *units = "?"; |
430 | 546 | ||
431 | 547 | if (result) | |
432 | if (!battery) | ||
433 | goto end; | 548 | goto end; |
434 | 549 | ||
435 | acpi_battery_check_present(battery); | 550 | if (acpi_battery_present(battery)) |
436 | |||
437 | if (battery->flags.present) | ||
438 | seq_printf(seq, "present: yes\n"); | 551 | seq_printf(seq, "present: yes\n"); |
439 | else { | 552 | else { |
440 | seq_printf(seq, "present: no\n"); | 553 | seq_printf(seq, "present: no\n"); |
441 | goto end; | 554 | goto end; |
442 | } | 555 | } |
443 | 556 | ||
444 | /* Battery Units */ | 557 | bst = battery->bst_data.pointer; |
445 | 558 | if (!bst) { | |
446 | units = | 559 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "BST buffer is NULL")); |
447 | battery->flags. | 560 | result = -ENODEV; |
448 | power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; | ||
449 | |||
450 | /* Battery Status (_BST) */ | ||
451 | |||
452 | result = acpi_battery_get_status(battery, &bst); | ||
453 | if (result || !bst) { | ||
454 | seq_printf(seq, "ERROR: Unable to read battery status\n"); | ||
455 | goto end; | 561 | goto end; |
456 | } | 562 | } |
457 | 563 | ||
564 | /* Battery Units */ | ||
565 | |||
566 | units = acpi_battery_power_units(battery); | ||
567 | |||
458 | if (!(bst->state & 0x04)) | 568 | if (!(bst->state & 0x04)) |
459 | seq_printf(seq, "capacity state: ok\n"); | 569 | seq_printf(seq, "capacity state: ok\n"); |
460 | else | 570 | else |
@@ -490,48 +600,43 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
490 | (u32) bst->present_voltage); | 600 | (u32) bst->present_voltage); |
491 | 601 | ||
492 | end: | 602 | end: |
493 | kfree(bst); | ||
494 | 603 | ||
495 | return 0; | 604 | if (result) { |
496 | } | 605 | seq_printf(seq, "ERROR: Unable to read battery state\n"); |
606 | } | ||
497 | 607 | ||
498 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | 608 | return result; |
499 | { | ||
500 | return single_open(file, acpi_battery_read_state, PDE(inode)->data); | ||
501 | } | 609 | } |
502 | 610 | ||
503 | static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | 611 | static int acpi_battery_print_alarm(struct seq_file *seq, int result) |
504 | { | 612 | { |
505 | struct acpi_battery *battery = seq->private; | 613 | struct acpi_battery *battery = seq->private; |
506 | char *units = "?"; | 614 | char *units = "?"; |
507 | 615 | ||
508 | 616 | if (result) | |
509 | if (!battery) | ||
510 | goto end; | 617 | goto end; |
511 | 618 | ||
512 | acpi_battery_check_present(battery); | 619 | if (!acpi_battery_present(battery)) { |
513 | |||
514 | if (!battery->flags.present) { | ||
515 | seq_printf(seq, "present: no\n"); | 620 | seq_printf(seq, "present: no\n"); |
516 | goto end; | 621 | goto end; |
517 | } | 622 | } |
518 | 623 | ||
519 | /* Battery Units */ | 624 | /* Battery Units */ |
520 | 625 | ||
521 | units = | 626 | units = acpi_battery_power_units(battery); |
522 | battery->flags. | ||
523 | power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS; | ||
524 | |||
525 | /* Battery Alarm */ | ||
526 | 627 | ||
527 | seq_printf(seq, "alarm: "); | 628 | seq_printf(seq, "alarm: "); |
528 | if (!battery->alarm) | 629 | if (!battery->alarm) |
529 | seq_printf(seq, "unsupported\n"); | 630 | seq_printf(seq, "unsupported\n"); |
530 | else | 631 | else |
531 | seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units); | 632 | seq_printf(seq, "%lu %sh\n", battery->alarm, units); |
532 | 633 | ||
533 | end: | 634 | end: |
534 | return 0; | 635 | |
636 | if (result) | ||
637 | seq_printf(seq, "ERROR: Unable to read battery alarm\n"); | ||
638 | |||
639 | return result; | ||
535 | } | 640 | } |
536 | 641 | ||
537 | static ssize_t | 642 | static ssize_t |
@@ -543,27 +648,113 @@ acpi_battery_write_alarm(struct file *file, | |||
543 | char alarm_string[12] = { '\0' }; | 648 | char alarm_string[12] = { '\0' }; |
544 | struct seq_file *m = file->private_data; | 649 | struct seq_file *m = file->private_data; |
545 | struct acpi_battery *battery = m->private; | 650 | struct acpi_battery *battery = m->private; |
546 | 651 | int update_result = ACPI_BATTERY_NONE_UPDATE; | |
547 | 652 | ||
548 | if (!battery || (count > sizeof(alarm_string) - 1)) | 653 | if (!battery || (count > sizeof(alarm_string) - 1)) |
549 | return -EINVAL; | 654 | return -EINVAL; |
550 | 655 | ||
551 | acpi_battery_check_present(battery); | 656 | mutex_lock(&battery->mutex); |
552 | 657 | ||
553 | if (!battery->flags.present) | 658 | result = acpi_battery_update(battery, 1, &update_result); |
554 | return -ENODEV; | 659 | if (result) { |
660 | result = -ENODEV; | ||
661 | goto end; | ||
662 | } | ||
663 | |||
664 | if (!acpi_battery_present(battery)) { | ||
665 | result = -ENODEV; | ||
666 | goto end; | ||
667 | } | ||
555 | 668 | ||
556 | if (copy_from_user(alarm_string, buffer, count)) | 669 | if (copy_from_user(alarm_string, buffer, count)) { |
557 | return -EFAULT; | 670 | result = -EFAULT; |
671 | goto end; | ||
672 | } | ||
558 | 673 | ||
559 | alarm_string[count] = '\0'; | 674 | alarm_string[count] = '\0'; |
560 | 675 | ||
561 | result = acpi_battery_set_alarm(battery, | 676 | result = acpi_battery_set_alarm(battery, |
562 | simple_strtoul(alarm_string, NULL, 0)); | 677 | simple_strtoul(alarm_string, NULL, 0)); |
563 | if (result) | 678 | if (result) |
564 | return result; | 679 | goto end; |
680 | |||
681 | end: | ||
565 | 682 | ||
566 | return count; | 683 | acpi_battery_check_result(battery, result); |
684 | |||
685 | if (!result) | ||
686 | result = count; | ||
687 | |||
688 | mutex_unlock(&battery->mutex); | ||
689 | |||
690 | return result; | ||
691 | } | ||
692 | |||
693 | typedef int(*print_func)(struct seq_file *seq, int result); | ||
694 | typedef int(*get_func)(struct acpi_battery *battery); | ||
695 | |||
696 | static struct acpi_read_mux { | ||
697 | print_func print; | ||
698 | get_func get; | ||
699 | } acpi_read_funcs[ACPI_BATTERY_NUMFILES] = { | ||
700 | {.get = acpi_battery_get_info, .print = acpi_battery_print_info}, | ||
701 | {.get = acpi_battery_get_state, .print = acpi_battery_print_state}, | ||
702 | {.get = acpi_battery_get_alarm, .print = acpi_battery_print_alarm}, | ||
703 | }; | ||
704 | |||
705 | static int acpi_battery_read(int fid, struct seq_file *seq) | ||
706 | { | ||
707 | struct acpi_battery *battery = seq->private; | ||
708 | int result = 0; | ||
709 | int update_result = ACPI_BATTERY_NONE_UPDATE; | ||
710 | int update = 0; | ||
711 | |||
712 | mutex_lock(&battery->mutex); | ||
713 | |||
714 | update = (get_seconds() - battery->update_time[fid] >= update_time); | ||
715 | update = (update | battery->flags.update[fid]); | ||
716 | |||
717 | result = acpi_battery_update(battery, update, &update_result); | ||
718 | if (result) | ||
719 | goto end; | ||
720 | |||
721 | if (update_result == ACPI_BATTERY_EASY_UPDATE) { | ||
722 | result = acpi_read_funcs[fid].get(battery); | ||
723 | if (result) | ||
724 | goto end; | ||
725 | } | ||
726 | |||
727 | end: | ||
728 | result = acpi_read_funcs[fid].print(seq, result); | ||
729 | acpi_battery_check_result(battery, result); | ||
730 | battery->flags.update[fid] = result; | ||
731 | mutex_unlock(&battery->mutex); | ||
732 | return result; | ||
733 | } | ||
734 | |||
735 | static int acpi_battery_read_info(struct seq_file *seq, void *offset) | ||
736 | { | ||
737 | return acpi_battery_read(ACPI_BATTERY_INFO, seq); | ||
738 | } | ||
739 | |||
740 | static int acpi_battery_read_state(struct seq_file *seq, void *offset) | ||
741 | { | ||
742 | return acpi_battery_read(ACPI_BATTERY_STATE, seq); | ||
743 | } | ||
744 | |||
745 | static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | ||
746 | { | ||
747 | return acpi_battery_read(ACPI_BATTERY_ALARM, seq); | ||
748 | } | ||
749 | |||
750 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) | ||
751 | { | ||
752 | return single_open(file, acpi_battery_read_info, PDE(inode)->data); | ||
753 | } | ||
754 | |||
755 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | ||
756 | { | ||
757 | return single_open(file, acpi_battery_read_state, PDE(inode)->data); | ||
567 | } | 758 | } |
568 | 759 | ||
569 | static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) | 760 | static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) |
@@ -571,35 +762,51 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) | |||
571 | return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); | 762 | return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); |
572 | } | 763 | } |
573 | 764 | ||
574 | static const struct file_operations acpi_battery_info_ops = { | 765 | static struct battery_file { |
766 | struct file_operations ops; | ||
767 | mode_t mode; | ||
768 | char *name; | ||
769 | } acpi_battery_file[] = { | ||
770 | { | ||
771 | .name = "info", | ||
772 | .mode = S_IRUGO, | ||
773 | .ops = { | ||
575 | .open = acpi_battery_info_open_fs, | 774 | .open = acpi_battery_info_open_fs, |
576 | .read = seq_read, | 775 | .read = seq_read, |
577 | .llseek = seq_lseek, | 776 | .llseek = seq_lseek, |
578 | .release = single_release, | 777 | .release = single_release, |
579 | .owner = THIS_MODULE, | 778 | .owner = THIS_MODULE, |
580 | }; | 779 | }, |
581 | 780 | }, | |
582 | static const struct file_operations acpi_battery_state_ops = { | 781 | { |
782 | .name = "state", | ||
783 | .mode = S_IRUGO, | ||
784 | .ops = { | ||
583 | .open = acpi_battery_state_open_fs, | 785 | .open = acpi_battery_state_open_fs, |
584 | .read = seq_read, | 786 | .read = seq_read, |
585 | .llseek = seq_lseek, | 787 | .llseek = seq_lseek, |
586 | .release = single_release, | 788 | .release = single_release, |
587 | .owner = THIS_MODULE, | 789 | .owner = THIS_MODULE, |
588 | }; | 790 | }, |
589 | 791 | }, | |
590 | static const struct file_operations acpi_battery_alarm_ops = { | 792 | { |
793 | .name = "alarm", | ||
794 | .mode = S_IFREG | S_IRUGO | S_IWUSR, | ||
795 | .ops = { | ||
591 | .open = acpi_battery_alarm_open_fs, | 796 | .open = acpi_battery_alarm_open_fs, |
592 | .read = seq_read, | 797 | .read = seq_read, |
593 | .write = acpi_battery_write_alarm, | 798 | .write = acpi_battery_write_alarm, |
594 | .llseek = seq_lseek, | 799 | .llseek = seq_lseek, |
595 | .release = single_release, | 800 | .release = single_release, |
596 | .owner = THIS_MODULE, | 801 | .owner = THIS_MODULE, |
802 | }, | ||
803 | }, | ||
597 | }; | 804 | }; |
598 | 805 | ||
599 | static int acpi_battery_add_fs(struct acpi_device *device) | 806 | static int acpi_battery_add_fs(struct acpi_device *device) |
600 | { | 807 | { |
601 | struct proc_dir_entry *entry = NULL; | 808 | struct proc_dir_entry *entry = NULL; |
602 | 809 | int i; | |
603 | 810 | ||
604 | if (!acpi_device_dir(device)) { | 811 | if (!acpi_device_dir(device)) { |
605 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 812 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
@@ -609,38 +816,16 @@ static int acpi_battery_add_fs(struct acpi_device *device) | |||
609 | acpi_device_dir(device)->owner = THIS_MODULE; | 816 | acpi_device_dir(device)->owner = THIS_MODULE; |
610 | } | 817 | } |
611 | 818 | ||
612 | /* 'info' [R] */ | 819 | for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { |
613 | entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, | 820 | entry = create_proc_entry(acpi_battery_file[i].name, |
614 | S_IRUGO, acpi_device_dir(device)); | 821 | acpi_battery_file[i].mode, acpi_device_dir(device)); |
615 | if (!entry) | 822 | if (!entry) |
616 | return -ENODEV; | 823 | return -ENODEV; |
617 | else { | 824 | else { |
618 | entry->proc_fops = &acpi_battery_info_ops; | 825 | entry->proc_fops = &acpi_battery_file[i].ops; |
619 | entry->data = acpi_driver_data(device); | 826 | entry->data = acpi_driver_data(device); |
620 | entry->owner = THIS_MODULE; | 827 | entry->owner = THIS_MODULE; |
621 | } | 828 | } |
622 | |||
623 | /* 'status' [R] */ | ||
624 | entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, | ||
625 | S_IRUGO, acpi_device_dir(device)); | ||
626 | if (!entry) | ||
627 | return -ENODEV; | ||
628 | else { | ||
629 | entry->proc_fops = &acpi_battery_state_ops; | ||
630 | entry->data = acpi_driver_data(device); | ||
631 | entry->owner = THIS_MODULE; | ||
632 | } | ||
633 | |||
634 | /* 'alarm' [R/W] */ | ||
635 | entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM, | ||
636 | S_IFREG | S_IRUGO | S_IWUSR, | ||
637 | acpi_device_dir(device)); | ||
638 | if (!entry) | ||
639 | return -ENODEV; | ||
640 | else { | ||
641 | entry->proc_fops = &acpi_battery_alarm_ops; | ||
642 | entry->data = acpi_driver_data(device); | ||
643 | entry->owner = THIS_MODULE; | ||
644 | } | 829 | } |
645 | 830 | ||
646 | return 0; | 831 | return 0; |
@@ -648,15 +833,12 @@ static int acpi_battery_add_fs(struct acpi_device *device) | |||
648 | 833 | ||
649 | static int acpi_battery_remove_fs(struct acpi_device *device) | 834 | static int acpi_battery_remove_fs(struct acpi_device *device) |
650 | { | 835 | { |
651 | 836 | int i; | |
652 | if (acpi_device_dir(device)) { | 837 | if (acpi_device_dir(device)) { |
653 | remove_proc_entry(ACPI_BATTERY_FILE_ALARM, | 838 | for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { |
839 | remove_proc_entry(acpi_battery_file[i].name, | ||
654 | acpi_device_dir(device)); | 840 | acpi_device_dir(device)); |
655 | remove_proc_entry(ACPI_BATTERY_FILE_STATUS, | 841 | } |
656 | acpi_device_dir(device)); | ||
657 | remove_proc_entry(ACPI_BATTERY_FILE_INFO, | ||
658 | acpi_device_dir(device)); | ||
659 | |||
660 | remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); | 842 | remove_proc_entry(acpi_device_bid(device), acpi_battery_dir); |
661 | acpi_device_dir(device) = NULL; | 843 | acpi_device_dir(device) = NULL; |
662 | } | 844 | } |
@@ -673,7 +855,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
673 | struct acpi_battery *battery = data; | 855 | struct acpi_battery *battery = data; |
674 | struct acpi_device *device = NULL; | 856 | struct acpi_device *device = NULL; |
675 | 857 | ||
676 | |||
677 | if (!battery) | 858 | if (!battery) |
678 | return; | 859 | return; |
679 | 860 | ||
@@ -684,8 +865,10 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) | |||
684 | case ACPI_BATTERY_NOTIFY_INFO: | 865 | case ACPI_BATTERY_NOTIFY_INFO: |
685 | case ACPI_NOTIFY_BUS_CHECK: | 866 | case ACPI_NOTIFY_BUS_CHECK: |
686 | case ACPI_NOTIFY_DEVICE_CHECK: | 867 | case ACPI_NOTIFY_DEVICE_CHECK: |
687 | acpi_battery_check(battery); | 868 | device = battery->device; |
688 | acpi_bus_generate_event(device, event, battery->flags.present); | 869 | acpi_battery_notify_update(battery); |
870 | acpi_bus_generate_event(device, event, | ||
871 | acpi_battery_present(battery)); | ||
689 | break; | 872 | break; |
690 | default: | 873 | default: |
691 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 874 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -702,7 +885,6 @@ static int acpi_battery_add(struct acpi_device *device) | |||
702 | acpi_status status = 0; | 885 | acpi_status status = 0; |
703 | struct acpi_battery *battery = NULL; | 886 | struct acpi_battery *battery = NULL; |
704 | 887 | ||
705 | |||
706 | if (!device) | 888 | if (!device) |
707 | return -EINVAL; | 889 | return -EINVAL; |
708 | 890 | ||
@@ -710,15 +892,21 @@ static int acpi_battery_add(struct acpi_device *device) | |||
710 | if (!battery) | 892 | if (!battery) |
711 | return -ENOMEM; | 893 | return -ENOMEM; |
712 | 894 | ||
895 | mutex_init(&battery->mutex); | ||
896 | |||
897 | mutex_lock(&battery->mutex); | ||
898 | |||
713 | battery->device = device; | 899 | battery->device = device; |
714 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); | 900 | strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); |
715 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 901 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
716 | acpi_driver_data(device) = battery; | 902 | acpi_driver_data(device) = battery; |
717 | 903 | ||
718 | result = acpi_battery_check(battery); | 904 | result = acpi_battery_get_status(battery); |
719 | if (result) | 905 | if (result) |
720 | goto end; | 906 | goto end; |
721 | 907 | ||
908 | battery->flags.init_update = 1; | ||
909 | |||
722 | result = acpi_battery_add_fs(device); | 910 | result = acpi_battery_add_fs(device); |
723 | if (result) | 911 | if (result) |
724 | goto end; | 912 | goto end; |
@@ -727,6 +915,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
727 | ACPI_ALL_NOTIFY, | 915 | ACPI_ALL_NOTIFY, |
728 | acpi_battery_notify, battery); | 916 | acpi_battery_notify, battery); |
729 | if (ACPI_FAILURE(status)) { | 917 | if (ACPI_FAILURE(status)) { |
918 | ACPI_EXCEPTION((AE_INFO, status, "Installing notify handler")); | ||
730 | result = -ENODEV; | 919 | result = -ENODEV; |
731 | goto end; | 920 | goto end; |
732 | } | 921 | } |
@@ -736,11 +925,14 @@ static int acpi_battery_add(struct acpi_device *device) | |||
736 | device->status.battery_present ? "present" : "absent"); | 925 | device->status.battery_present ? "present" : "absent"); |
737 | 926 | ||
738 | end: | 927 | end: |
928 | |||
739 | if (result) { | 929 | if (result) { |
740 | acpi_battery_remove_fs(device); | 930 | acpi_battery_remove_fs(device); |
741 | kfree(battery); | 931 | kfree(battery); |
742 | } | 932 | } |
743 | 933 | ||
934 | mutex_unlock(&battery->mutex); | ||
935 | |||
744 | return result; | 936 | return result; |
745 | } | 937 | } |
746 | 938 | ||
@@ -749,18 +941,27 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
749 | acpi_status status = 0; | 941 | acpi_status status = 0; |
750 | struct acpi_battery *battery = NULL; | 942 | struct acpi_battery *battery = NULL; |
751 | 943 | ||
752 | |||
753 | if (!device || !acpi_driver_data(device)) | 944 | if (!device || !acpi_driver_data(device)) |
754 | return -EINVAL; | 945 | return -EINVAL; |
755 | 946 | ||
756 | battery = acpi_driver_data(device); | 947 | battery = acpi_driver_data(device); |
757 | 948 | ||
949 | mutex_lock(&battery->mutex); | ||
950 | |||
758 | status = acpi_remove_notify_handler(device->handle, | 951 | status = acpi_remove_notify_handler(device->handle, |
759 | ACPI_ALL_NOTIFY, | 952 | ACPI_ALL_NOTIFY, |
760 | acpi_battery_notify); | 953 | acpi_battery_notify); |
761 | 954 | ||
762 | acpi_battery_remove_fs(device); | 955 | acpi_battery_remove_fs(device); |
763 | 956 | ||
957 | kfree(battery->bif_data.pointer); | ||
958 | |||
959 | kfree(battery->bst_data.pointer); | ||
960 | |||
961 | mutex_unlock(&battery->mutex); | ||
962 | |||
963 | mutex_destroy(&battery->mutex); | ||
964 | |||
764 | kfree(battery); | 965 | kfree(battery); |
765 | 966 | ||
766 | return 0; | 967 | return 0; |
@@ -775,7 +976,10 @@ static int acpi_battery_resume(struct acpi_device *device) | |||
775 | return -EINVAL; | 976 | return -EINVAL; |
776 | 977 | ||
777 | battery = device->driver_data; | 978 | battery = device->driver_data; |
778 | return acpi_battery_check(battery); | 979 | |
980 | battery->flags.init_update = 1; | ||
981 | |||
982 | return 0; | ||
779 | } | 983 | } |
780 | 984 | ||
781 | static int __init acpi_battery_init(void) | 985 | static int __init acpi_battery_init(void) |
@@ -800,7 +1004,6 @@ static int __init acpi_battery_init(void) | |||
800 | 1004 | ||
801 | static void __exit acpi_battery_exit(void) | 1005 | static void __exit acpi_battery_exit(void) |
802 | { | 1006 | { |
803 | |||
804 | acpi_bus_unregister_driver(&acpi_battery_driver); | 1007 | acpi_bus_unregister_driver(&acpi_battery_driver); |
805 | 1008 | ||
806 | acpi_unlock_battery_dir(acpi_battery_dir); | 1009 | acpi_unlock_battery_dir(acpi_battery_dir); |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1683e5c5b94c..1cbe61905824 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -231,8 +231,10 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
231 | * Obtain the method mutex if necessary. Do not acquire mutex for a | 231 | * Obtain the method mutex if necessary. Do not acquire mutex for a |
232 | * recursive call. | 232 | * recursive call. |
233 | */ | 233 | */ |
234 | if (acpi_os_get_thread_id() != | 234 | if (!walk_state || |
235 | obj_desc->method.mutex->mutex.owner_thread_id) { | 235 | !obj_desc->method.mutex->mutex.owner_thread || |
236 | (walk_state->thread != | ||
237 | obj_desc->method.mutex->mutex.owner_thread)) { | ||
236 | /* | 238 | /* |
237 | * Acquire the method mutex. This releases the interpreter if we | 239 | * Acquire the method mutex. This releases the interpreter if we |
238 | * block (and reacquires it before it returns) | 240 | * block (and reacquires it before it returns) |
@@ -246,14 +248,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
246 | } | 248 | } |
247 | 249 | ||
248 | /* Update the mutex and walk info and save the original sync_level */ | 250 | /* Update the mutex and walk info and save the original sync_level */ |
249 | obj_desc->method.mutex->mutex.owner_thread_id = | ||
250 | acpi_os_get_thread_id(); | ||
251 | 251 | ||
252 | if (walk_state) { | 252 | if (walk_state) { |
253 | obj_desc->method.mutex->mutex. | 253 | obj_desc->method.mutex->mutex. |
254 | original_sync_level = | 254 | original_sync_level = |
255 | walk_state->thread->current_sync_level; | 255 | walk_state->thread->current_sync_level; |
256 | 256 | ||
257 | obj_desc->method.mutex->mutex.owner_thread = | ||
258 | walk_state->thread; | ||
257 | walk_state->thread->current_sync_level = | 259 | walk_state->thread->current_sync_level = |
258 | obj_desc->method.sync_level; | 260 | obj_desc->method.sync_level; |
259 | } else { | 261 | } else { |
@@ -567,7 +569,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
567 | 569 | ||
568 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 570 | acpi_os_release_mutex(method_desc->method.mutex->mutex. |
569 | os_mutex); | 571 | os_mutex); |
570 | method_desc->method.mutex->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 572 | method_desc->method.mutex->mutex.owner_thread = NULL; |
571 | } | 573 | } |
572 | } | 574 | } |
573 | 575 | ||
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6c6104a7a247..fc9da4879cbf 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -866,8 +866,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
866 | ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && | 866 | ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && |
867 | (op->common.parent->common.aml_opcode != | 867 | (op->common.parent->common.aml_opcode != |
868 | AML_VAR_PACKAGE_OP) | 868 | AML_VAR_PACKAGE_OP) |
869 | && (op->common.parent->common.aml_opcode != | 869 | && (op->common.parent->common.aml_opcode != AML_NAME_OP))) { |
870 | AML_NAME_OP))) { | ||
871 | walk_state->result_obj = obj_desc; | 870 | walk_state->result_obj = obj_desc; |
872 | } | 871 | } |
873 | } | 872 | } |
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index e4073e05a75c..71503c036f7c 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -556,10 +556,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
556 | * indicate this to the interpreter, set the | 556 | * indicate this to the interpreter, set the |
557 | * object to the root | 557 | * object to the root |
558 | */ | 558 | */ |
559 | obj_desc = | 559 | obj_desc = ACPI_CAST_PTR(union |
560 | ACPI_CAST_PTR(union | 560 | acpi_operand_object, |
561 | acpi_operand_object, | 561 | acpi_gbl_root_node); |
562 | acpi_gbl_root_node); | ||
563 | status = AE_OK; | 562 | status = AE_OK; |
564 | } else { | 563 | } else { |
565 | /* | 564 | /* |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 16c8e38b51ef..5afcdd9c7449 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -630,12 +630,9 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
630 | * | 630 | * |
631 | ******************************************************************************/ | 631 | ******************************************************************************/ |
632 | 632 | ||
633 | struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | 633 | struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object |
634 | union acpi_parse_object | 634 | *origin, union acpi_operand_object |
635 | *origin, | 635 | *method_desc, struct acpi_thread_state |
636 | union acpi_operand_object | ||
637 | *method_desc, | ||
638 | struct acpi_thread_state | ||
639 | *thread) | 636 | *thread) |
640 | { | 637 | { |
641 | struct acpi_walk_state *walk_state; | 638 | struct acpi_walk_state *walk_state; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index e08cf98f504f..10e851021eca 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -34,25 +34,26 @@ | |||
34 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
35 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/list.h> | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | #include <acpi/acpi_bus.h> | 39 | #include <acpi/acpi_bus.h> |
39 | #include <acpi/acpi_drivers.h> | 40 | #include <acpi/acpi_drivers.h> |
40 | #include <acpi/actypes.h> | 41 | #include <acpi/actypes.h> |
41 | 42 | ||
42 | #define _COMPONENT ACPI_EC_COMPONENT | ||
43 | ACPI_MODULE_NAME("ec"); | ||
44 | #define ACPI_EC_COMPONENT 0x00100000 | ||
45 | #define ACPI_EC_CLASS "embedded_controller" | 43 | #define ACPI_EC_CLASS "embedded_controller" |
46 | #define ACPI_EC_HID "PNP0C09" | 44 | #define ACPI_EC_HID "PNP0C09" |
47 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" | 45 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" |
48 | #define ACPI_EC_FILE_INFO "info" | 46 | #define ACPI_EC_FILE_INFO "info" |
47 | |||
49 | #undef PREFIX | 48 | #undef PREFIX |
50 | #define PREFIX "ACPI: EC: " | 49 | #define PREFIX "ACPI: EC: " |
50 | |||
51 | /* EC status register */ | 51 | /* EC status register */ |
52 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 52 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
53 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 53 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
54 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | 54 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ |
55 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 55 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
56 | |||
56 | /* EC commands */ | 57 | /* EC commands */ |
57 | enum ec_command { | 58 | enum ec_command { |
58 | ACPI_EC_COMMAND_READ = 0x80, | 59 | ACPI_EC_COMMAND_READ = 0x80, |
@@ -61,6 +62,7 @@ enum ec_command { | |||
61 | ACPI_EC_BURST_DISABLE = 0x83, | 62 | ACPI_EC_BURST_DISABLE = 0x83, |
62 | ACPI_EC_COMMAND_QUERY = 0x84, | 63 | ACPI_EC_COMMAND_QUERY = 0x84, |
63 | }; | 64 | }; |
65 | |||
64 | /* EC events */ | 66 | /* EC events */ |
65 | enum ec_event { | 67 | enum ec_event { |
66 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ | 68 | ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ |
@@ -94,6 +96,16 @@ static struct acpi_driver acpi_ec_driver = { | |||
94 | 96 | ||
95 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 97 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
96 | /* External interfaces use first EC only, so remember */ | 98 | /* External interfaces use first EC only, so remember */ |
99 | typedef int (*acpi_ec_query_func) (void *data); | ||
100 | |||
101 | struct acpi_ec_query_handler { | ||
102 | struct list_head node; | ||
103 | acpi_ec_query_func func; | ||
104 | acpi_handle handle; | ||
105 | void *data; | ||
106 | u8 query_bit; | ||
107 | }; | ||
108 | |||
97 | static struct acpi_ec { | 109 | static struct acpi_ec { |
98 | acpi_handle handle; | 110 | acpi_handle handle; |
99 | unsigned long gpe; | 111 | unsigned long gpe; |
@@ -104,6 +116,7 @@ static struct acpi_ec { | |||
104 | atomic_t query_pending; | 116 | atomic_t query_pending; |
105 | atomic_t event_count; | 117 | atomic_t event_count; |
106 | wait_queue_head_t wait; | 118 | wait_queue_head_t wait; |
119 | struct list_head list; | ||
107 | } *boot_ec, *first_ec; | 120 | } *boot_ec, *first_ec; |
108 | 121 | ||
109 | /* -------------------------------------------------------------------------- | 122 | /* -------------------------------------------------------------------------- |
@@ -147,9 +160,10 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event, | |||
147 | return 0; | 160 | return 0; |
148 | } | 161 | } |
149 | 162 | ||
150 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count) | 163 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, |
164 | unsigned count, int force_poll) | ||
151 | { | 165 | { |
152 | if (acpi_ec_mode == EC_POLL) { | 166 | if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) { |
153 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 167 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
154 | while (time_before(jiffies, delay)) { | 168 | while (time_before(jiffies, delay)) { |
155 | if (acpi_ec_check_status(ec, event, 0)) | 169 | if (acpi_ec_check_status(ec, event, 0)) |
@@ -173,14 +187,15 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count) | |||
173 | 187 | ||
174 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 188 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
175 | const u8 * wdata, unsigned wdata_len, | 189 | const u8 * wdata, unsigned wdata_len, |
176 | u8 * rdata, unsigned rdata_len) | 190 | u8 * rdata, unsigned rdata_len, |
191 | int force_poll) | ||
177 | { | 192 | { |
178 | int result = 0; | 193 | int result = 0; |
179 | unsigned count = atomic_read(&ec->event_count); | 194 | unsigned count = atomic_read(&ec->event_count); |
180 | acpi_ec_write_cmd(ec, command); | 195 | acpi_ec_write_cmd(ec, command); |
181 | 196 | ||
182 | for (; wdata_len > 0; --wdata_len) { | 197 | for (; wdata_len > 0; --wdata_len) { |
183 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); | 198 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); |
184 | if (result) { | 199 | if (result) { |
185 | printk(KERN_ERR PREFIX | 200 | printk(KERN_ERR PREFIX |
186 | "write_cmd timeout, command = %d\n", command); | 201 | "write_cmd timeout, command = %d\n", command); |
@@ -191,7 +206,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
191 | } | 206 | } |
192 | 207 | ||
193 | if (!rdata_len) { | 208 | if (!rdata_len) { |
194 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count); | 209 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll); |
195 | if (result) { | 210 | if (result) { |
196 | printk(KERN_ERR PREFIX | 211 | printk(KERN_ERR PREFIX |
197 | "finish-write timeout, command = %d\n", command); | 212 | "finish-write timeout, command = %d\n", command); |
@@ -202,7 +217,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
202 | } | 217 | } |
203 | 218 | ||
204 | for (; rdata_len > 0; --rdata_len) { | 219 | for (; rdata_len > 0; --rdata_len) { |
205 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count); | 220 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll); |
206 | if (result) { | 221 | if (result) { |
207 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 222 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
208 | command); | 223 | command); |
@@ -217,7 +232,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
217 | 232 | ||
218 | static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | 233 | static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, |
219 | const u8 * wdata, unsigned wdata_len, | 234 | const u8 * wdata, unsigned wdata_len, |
220 | u8 * rdata, unsigned rdata_len) | 235 | u8 * rdata, unsigned rdata_len, |
236 | int force_poll) | ||
221 | { | 237 | { |
222 | int status; | 238 | int status; |
223 | u32 glk; | 239 | u32 glk; |
@@ -240,16 +256,17 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
240 | /* Make sure GPE is enabled before doing transaction */ | 256 | /* Make sure GPE is enabled before doing transaction */ |
241 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | 257 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); |
242 | 258 | ||
243 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); | 259 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0, 0); |
244 | if (status) { | 260 | if (status) { |
245 | printk(KERN_DEBUG PREFIX | 261 | printk(KERN_ERR PREFIX |
246 | "input buffer is not empty, aborting transaction\n"); | 262 | "input buffer is not empty, aborting transaction\n"); |
247 | goto end; | 263 | goto end; |
248 | } | 264 | } |
249 | 265 | ||
250 | status = acpi_ec_transaction_unlocked(ec, command, | 266 | status = acpi_ec_transaction_unlocked(ec, command, |
251 | wdata, wdata_len, | 267 | wdata, wdata_len, |
252 | rdata, rdata_len); | 268 | rdata, rdata_len, |
269 | force_poll); | ||
253 | 270 | ||
254 | end: | 271 | end: |
255 | 272 | ||
@@ -267,12 +284,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
267 | int acpi_ec_burst_enable(struct acpi_ec *ec) | 284 | int acpi_ec_burst_enable(struct acpi_ec *ec) |
268 | { | 285 | { |
269 | u8 d; | 286 | u8 d; |
270 | return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1); | 287 | return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1, 0); |
271 | } | 288 | } |
272 | 289 | ||
273 | int acpi_ec_burst_disable(struct acpi_ec *ec) | 290 | int acpi_ec_burst_disable(struct acpi_ec *ec) |
274 | { | 291 | { |
275 | return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0); | 292 | return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0, 0); |
276 | } | 293 | } |
277 | 294 | ||
278 | static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) | 295 | static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) |
@@ -281,7 +298,7 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data) | |||
281 | u8 d; | 298 | u8 d; |
282 | 299 | ||
283 | result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ, | 300 | result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ, |
284 | &address, 1, &d, 1); | 301 | &address, 1, &d, 1, 0); |
285 | *data = d; | 302 | *data = d; |
286 | return result; | 303 | return result; |
287 | } | 304 | } |
@@ -290,7 +307,7 @@ static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) | |||
290 | { | 307 | { |
291 | u8 wdata[2] = { address, data }; | 308 | u8 wdata[2] = { address, data }; |
292 | return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, | 309 | return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, |
293 | wdata, 2, NULL, 0); | 310 | wdata, 2, NULL, 0, 0); |
294 | } | 311 | } |
295 | 312 | ||
296 | /* | 313 | /* |
@@ -349,13 +366,15 @@ EXPORT_SYMBOL(ec_write); | |||
349 | 366 | ||
350 | int ec_transaction(u8 command, | 367 | int ec_transaction(u8 command, |
351 | const u8 * wdata, unsigned wdata_len, | 368 | const u8 * wdata, unsigned wdata_len, |
352 | u8 * rdata, unsigned rdata_len) | 369 | u8 * rdata, unsigned rdata_len, |
370 | int force_poll) | ||
353 | { | 371 | { |
354 | if (!first_ec) | 372 | if (!first_ec) |
355 | return -ENODEV; | 373 | return -ENODEV; |
356 | 374 | ||
357 | return acpi_ec_transaction(first_ec, command, wdata, | 375 | return acpi_ec_transaction(first_ec, command, wdata, |
358 | wdata_len, rdata, rdata_len); | 376 | wdata_len, rdata, rdata_len, |
377 | force_poll); | ||
359 | } | 378 | } |
360 | 379 | ||
361 | EXPORT_SYMBOL(ec_transaction); | 380 | EXPORT_SYMBOL(ec_transaction); |
@@ -374,7 +393,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | |||
374 | * bit to be cleared (and thus clearing the interrupt source). | 393 | * bit to be cleared (and thus clearing the interrupt source). |
375 | */ | 394 | */ |
376 | 395 | ||
377 | result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1); | 396 | result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1, 0); |
378 | if (result) | 397 | if (result) |
379 | return result; | 398 | return result; |
380 | 399 | ||
@@ -388,21 +407,67 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data) | |||
388 | /* -------------------------------------------------------------------------- | 407 | /* -------------------------------------------------------------------------- |
389 | Event Management | 408 | Event Management |
390 | -------------------------------------------------------------------------- */ | 409 | -------------------------------------------------------------------------- */ |
410 | int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit, | ||
411 | acpi_handle handle, acpi_ec_query_func func, | ||
412 | void *data) | ||
413 | { | ||
414 | struct acpi_ec_query_handler *handler = | ||
415 | kzalloc(sizeof(struct acpi_ec_query_handler), GFP_KERNEL); | ||
416 | if (!handler) | ||
417 | return -ENOMEM; | ||
418 | |||
419 | handler->query_bit = query_bit; | ||
420 | handler->handle = handle; | ||
421 | handler->func = func; | ||
422 | handler->data = data; | ||
423 | mutex_lock(&ec->lock); | ||
424 | list_add_tail(&handler->node, &ec->list); | ||
425 | mutex_unlock(&ec->lock); | ||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler); | ||
430 | |||
431 | void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) | ||
432 | { | ||
433 | struct acpi_ec_query_handler *handler; | ||
434 | mutex_lock(&ec->lock); | ||
435 | list_for_each_entry(handler, &ec->list, node) { | ||
436 | if (query_bit == handler->query_bit) { | ||
437 | list_del(&handler->node); | ||
438 | kfree(handler); | ||
439 | break; | ||
440 | } | ||
441 | } | ||
442 | mutex_unlock(&ec->lock); | ||
443 | } | ||
444 | |||
445 | EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); | ||
391 | 446 | ||
392 | static void acpi_ec_gpe_query(void *ec_cxt) | 447 | static void acpi_ec_gpe_query(void *ec_cxt) |
393 | { | 448 | { |
394 | struct acpi_ec *ec = ec_cxt; | 449 | struct acpi_ec *ec = ec_cxt; |
395 | u8 value = 0; | 450 | u8 value = 0; |
396 | char object_name[8]; | 451 | struct acpi_ec_query_handler *handler, copy; |
397 | 452 | ||
398 | if (!ec || acpi_ec_query(ec, &value)) | 453 | if (!ec || acpi_ec_query(ec, &value)) |
399 | return; | 454 | return; |
400 | 455 | mutex_lock(&ec->lock); | |
401 | snprintf(object_name, 8, "_Q%2.2X", value); | 456 | list_for_each_entry(handler, &ec->list, node) { |
402 | 457 | if (value == handler->query_bit) { | |
403 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s", object_name)); | 458 | /* have custom handler for this bit */ |
404 | 459 | memcpy(©, handler, sizeof(copy)); | |
405 | acpi_evaluate_object(ec->handle, object_name, NULL, NULL); | 460 | mutex_unlock(&ec->lock); |
461 | if (copy.func) { | ||
462 | copy.func(copy.data); | ||
463 | } else if (copy.handle) { | ||
464 | acpi_evaluate_object(copy.handle, NULL, NULL, NULL); | ||
465 | } | ||
466 | return; | ||
467 | } | ||
468 | } | ||
469 | mutex_unlock(&ec->lock); | ||
470 | printk(KERN_ERR PREFIX "Handler for query 0x%x is not found!\n", value); | ||
406 | } | 471 | } |
407 | 472 | ||
408 | static u32 acpi_ec_gpe_handler(void *data) | 473 | static u32 acpi_ec_gpe_handler(void *data) |
@@ -410,6 +475,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
410 | acpi_status status = AE_OK; | 475 | acpi_status status = AE_OK; |
411 | u8 value; | 476 | u8 value; |
412 | struct acpi_ec *ec = data; | 477 | struct acpi_ec *ec = data; |
478 | |||
413 | atomic_inc(&ec->event_count); | 479 | atomic_inc(&ec->event_count); |
414 | 480 | ||
415 | if (acpi_ec_mode == EC_INTR) { | 481 | if (acpi_ec_mode == EC_INTR) { |
@@ -420,8 +486,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
420 | if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { | 486 | if ((value & ACPI_EC_FLAG_SCI) && !atomic_read(&ec->query_pending)) { |
421 | atomic_set(&ec->query_pending, 1); | 487 | atomic_set(&ec->query_pending, 1); |
422 | status = | 488 | status = |
423 | acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, | 489 | acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); |
424 | ec); | ||
425 | } | 490 | } |
426 | 491 | ||
427 | return status == AE_OK ? | 492 | return status == AE_OK ? |
@@ -447,57 +512,35 @@ acpi_ec_space_setup(acpi_handle region_handle, | |||
447 | } | 512 | } |
448 | 513 | ||
449 | static acpi_status | 514 | static acpi_status |
450 | acpi_ec_space_handler(u32 function, | 515 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
451 | acpi_physical_address address, | 516 | u32 bits, acpi_integer *value, |
452 | u32 bit_width, | ||
453 | acpi_integer * value, | ||
454 | void *handler_context, void *region_context) | 517 | void *handler_context, void *region_context) |
455 | { | 518 | { |
456 | int result = 0; | ||
457 | struct acpi_ec *ec = handler_context; | 519 | struct acpi_ec *ec = handler_context; |
458 | u64 temp = *value; | 520 | int result = 0, i = 0; |
459 | acpi_integer f_v = 0; | 521 | u8 temp = 0; |
460 | int i = 0; | ||
461 | 522 | ||
462 | if ((address > 0xFF) || !value || !handler_context) | 523 | if ((address > 0xFF) || !value || !handler_context) |
463 | return AE_BAD_PARAMETER; | 524 | return AE_BAD_PARAMETER; |
464 | 525 | ||
465 | if (bit_width != 8 && acpi_strict) { | 526 | if (function != ACPI_READ && function != ACPI_WRITE) |
466 | return AE_BAD_PARAMETER; | 527 | return AE_BAD_PARAMETER; |
467 | } | ||
468 | |||
469 | next_byte: | ||
470 | switch (function) { | ||
471 | case ACPI_READ: | ||
472 | temp = 0; | ||
473 | result = acpi_ec_read(ec, (u8) address, (u8 *) & temp); | ||
474 | break; | ||
475 | case ACPI_WRITE: | ||
476 | result = acpi_ec_write(ec, (u8) address, (u8) temp); | ||
477 | break; | ||
478 | default: | ||
479 | result = -EINVAL; | ||
480 | goto out; | ||
481 | break; | ||
482 | } | ||
483 | 528 | ||
484 | bit_width -= 8; | 529 | if (bits != 8 && acpi_strict) |
485 | if (bit_width) { | 530 | return AE_BAD_PARAMETER; |
486 | if (function == ACPI_READ) | ||
487 | f_v |= temp << 8 * i; | ||
488 | if (function == ACPI_WRITE) | ||
489 | temp >>= 8; | ||
490 | i++; | ||
491 | address++; | ||
492 | goto next_byte; | ||
493 | } | ||
494 | 531 | ||
495 | if (function == ACPI_READ) { | 532 | while (bits - i > 0) { |
496 | f_v |= temp << 8 * i; | 533 | if (function == ACPI_READ) { |
497 | *value = f_v; | 534 | result = acpi_ec_read(ec, address, &temp); |
535 | (*value) |= ((acpi_integer)temp) << i; | ||
536 | } else { | ||
537 | temp = 0xff & ((*value) >> i); | ||
538 | result = acpi_ec_write(ec, address, temp); | ||
539 | } | ||
540 | i += 8; | ||
541 | ++address; | ||
498 | } | 542 | } |
499 | 543 | ||
500 | out: | ||
501 | switch (result) { | 544 | switch (result) { |
502 | case -EINVAL: | 545 | case -EINVAL: |
503 | return AE_BAD_PARAMETER; | 546 | return AE_BAD_PARAMETER; |
@@ -590,9 +633,6 @@ static int acpi_ec_remove_fs(struct acpi_device *device) | |||
590 | static acpi_status | 633 | static acpi_status |
591 | ec_parse_io_ports(struct acpi_resource *resource, void *context); | 634 | ec_parse_io_ports(struct acpi_resource *resource, void *context); |
592 | 635 | ||
593 | static acpi_status | ||
594 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval); | ||
595 | |||
596 | static struct acpi_ec *make_acpi_ec(void) | 636 | static struct acpi_ec *make_acpi_ec(void) |
597 | { | 637 | { |
598 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 638 | struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL); |
@@ -603,13 +643,52 @@ static struct acpi_ec *make_acpi_ec(void) | |||
603 | atomic_set(&ec->event_count, 1); | 643 | atomic_set(&ec->event_count, 1); |
604 | mutex_init(&ec->lock); | 644 | mutex_init(&ec->lock); |
605 | init_waitqueue_head(&ec->wait); | 645 | init_waitqueue_head(&ec->wait); |
646 | INIT_LIST_HEAD(&ec->list); | ||
606 | 647 | ||
607 | return ec; | 648 | return ec; |
608 | } | 649 | } |
609 | 650 | ||
651 | static acpi_status | ||
652 | acpi_ec_register_query_methods(acpi_handle handle, u32 level, | ||
653 | void *context, void **return_value) | ||
654 | { | ||
655 | struct acpi_namespace_node *node = handle; | ||
656 | struct acpi_ec *ec = context; | ||
657 | int value = 0; | ||
658 | if (sscanf(node->name.ascii, "_Q%x", &value) == 1) { | ||
659 | acpi_ec_add_query_handler(ec, value, handle, NULL, NULL); | ||
660 | } | ||
661 | return AE_OK; | ||
662 | } | ||
663 | |||
664 | static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle) | ||
665 | { | ||
666 | if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
667 | ec_parse_io_ports, ec))) | ||
668 | return -EINVAL; | ||
669 | |||
670 | /* Get GPE bit assignment (EC events). */ | ||
671 | /* TODO: Add support for _GPE returning a package */ | ||
672 | if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe))) | ||
673 | return -EINVAL; | ||
674 | |||
675 | /* Use the global lock for all EC transactions? */ | ||
676 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | ||
677 | |||
678 | /* Find and register all query methods */ | ||
679 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, | ||
680 | acpi_ec_register_query_methods, ec, NULL); | ||
681 | |||
682 | ec->handle = handle; | ||
683 | |||
684 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx", | ||
685 | ec->gpe, ec->command_addr, ec->data_addr); | ||
686 | |||
687 | return 0; | ||
688 | } | ||
689 | |||
610 | static int acpi_ec_add(struct acpi_device *device) | 690 | static int acpi_ec_add(struct acpi_device *device) |
611 | { | 691 | { |
612 | acpi_status status = AE_OK; | ||
613 | struct acpi_ec *ec = NULL; | 692 | struct acpi_ec *ec = NULL; |
614 | 693 | ||
615 | if (!device) | 694 | if (!device) |
@@ -622,8 +701,7 @@ static int acpi_ec_add(struct acpi_device *device) | |||
622 | if (!ec) | 701 | if (!ec) |
623 | return -ENOMEM; | 702 | return -ENOMEM; |
624 | 703 | ||
625 | status = ec_parse_device(device->handle, 0, ec, NULL); | 704 | if (ec_parse_device(ec, device->handle)) { |
626 | if (status != AE_CTRL_TERMINATE) { | ||
627 | kfree(ec); | 705 | kfree(ec); |
628 | return -EINVAL; | 706 | return -EINVAL; |
629 | } | 707 | } |
@@ -634,6 +712,8 @@ static int acpi_ec_add(struct acpi_device *device) | |||
634 | /* We might have incorrect info for GL at boot time */ | 712 | /* We might have incorrect info for GL at boot time */ |
635 | mutex_lock(&boot_ec->lock); | 713 | mutex_lock(&boot_ec->lock); |
636 | boot_ec->global_lock = ec->global_lock; | 714 | boot_ec->global_lock = ec->global_lock; |
715 | /* Copy handlers from new ec into boot ec */ | ||
716 | list_splice(&ec->list, &boot_ec->list); | ||
637 | mutex_unlock(&boot_ec->lock); | 717 | mutex_unlock(&boot_ec->lock); |
638 | kfree(ec); | 718 | kfree(ec); |
639 | ec = boot_ec; | 719 | ec = boot_ec; |
@@ -644,22 +724,24 @@ static int acpi_ec_add(struct acpi_device *device) | |||
644 | acpi_driver_data(device) = ec; | 724 | acpi_driver_data(device) = ec; |
645 | 725 | ||
646 | acpi_ec_add_fs(device); | 726 | acpi_ec_add_fs(device); |
647 | |||
648 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s [%s] (gpe %d) interrupt mode.", | ||
649 | acpi_device_name(device), acpi_device_bid(device), | ||
650 | (u32) ec->gpe)); | ||
651 | |||
652 | return 0; | 727 | return 0; |
653 | } | 728 | } |
654 | 729 | ||
655 | static int acpi_ec_remove(struct acpi_device *device, int type) | 730 | static int acpi_ec_remove(struct acpi_device *device, int type) |
656 | { | 731 | { |
657 | struct acpi_ec *ec; | 732 | struct acpi_ec *ec; |
733 | struct acpi_ec_query_handler *handler; | ||
658 | 734 | ||
659 | if (!device) | 735 | if (!device) |
660 | return -EINVAL; | 736 | return -EINVAL; |
661 | 737 | ||
662 | ec = acpi_driver_data(device); | 738 | ec = acpi_driver_data(device); |
739 | mutex_lock(&ec->lock); | ||
740 | list_for_each_entry(handler, &ec->list, node) { | ||
741 | list_del(&handler->node); | ||
742 | kfree(handler); | ||
743 | } | ||
744 | mutex_unlock(&ec->lock); | ||
663 | acpi_ec_remove_fs(device); | 745 | acpi_ec_remove_fs(device); |
664 | acpi_driver_data(device) = NULL; | 746 | acpi_driver_data(device) = NULL; |
665 | if (ec == first_ec) | 747 | if (ec == first_ec) |
@@ -715,15 +797,13 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
715 | return -ENODEV; | 797 | return -ENODEV; |
716 | } | 798 | } |
717 | 799 | ||
718 | /* EC is fully operational, allow queries */ | ||
719 | atomic_set(&ec->query_pending, 0); | ||
720 | |||
721 | return 0; | 800 | return 0; |
722 | } | 801 | } |
723 | 802 | ||
724 | static int acpi_ec_start(struct acpi_device *device) | 803 | static int acpi_ec_start(struct acpi_device *device) |
725 | { | 804 | { |
726 | struct acpi_ec *ec; | 805 | struct acpi_ec *ec; |
806 | int ret = 0; | ||
727 | 807 | ||
728 | if (!device) | 808 | if (!device) |
729 | return -EINVAL; | 809 | return -EINVAL; |
@@ -733,14 +813,14 @@ static int acpi_ec_start(struct acpi_device *device) | |||
733 | if (!ec) | 813 | if (!ec) |
734 | return -EINVAL; | 814 | return -EINVAL; |
735 | 815 | ||
736 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02lx, ports=0x%2lx,0x%2lx", | ||
737 | ec->gpe, ec->command_addr, ec->data_addr)); | ||
738 | |||
739 | /* Boot EC is already working */ | 816 | /* Boot EC is already working */ |
740 | if (ec == boot_ec) | 817 | if (ec != boot_ec) |
741 | return 0; | 818 | ret = ec_install_handlers(ec); |
819 | |||
820 | /* EC is fully operational, allow queries */ | ||
821 | atomic_set(&ec->query_pending, 0); | ||
742 | 822 | ||
743 | return ec_install_handlers(ec); | 823 | return ret; |
744 | } | 824 | } |
745 | 825 | ||
746 | static int acpi_ec_stop(struct acpi_device *device, int type) | 826 | static int acpi_ec_stop(struct acpi_device *device, int type) |
@@ -772,34 +852,6 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
772 | return 0; | 852 | return 0; |
773 | } | 853 | } |
774 | 854 | ||
775 | static acpi_status | ||
776 | ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | ||
777 | { | ||
778 | acpi_status status; | ||
779 | |||
780 | struct acpi_ec *ec = context; | ||
781 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
782 | ec_parse_io_ports, ec); | ||
783 | if (ACPI_FAILURE(status)) | ||
784 | return status; | ||
785 | |||
786 | /* Get GPE bit assignment (EC events). */ | ||
787 | /* TODO: Add support for _GPE returning a package */ | ||
788 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); | ||
789 | if (ACPI_FAILURE(status)) | ||
790 | return status; | ||
791 | |||
792 | /* Use the global lock for all EC transactions? */ | ||
793 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | ||
794 | |||
795 | ec->handle = handle; | ||
796 | |||
797 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "GPE=0x%02lx, ports=0x%2lx, 0x%2lx", | ||
798 | ec->gpe, ec->command_addr, ec->data_addr)); | ||
799 | |||
800 | return AE_CTRL_TERMINATE; | ||
801 | } | ||
802 | |||
803 | int __init acpi_ec_ecdt_probe(void) | 855 | int __init acpi_ec_ecdt_probe(void) |
804 | { | 856 | { |
805 | int ret; | 857 | int ret; |
@@ -818,7 +870,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
818 | if (ACPI_FAILURE(status)) | 870 | if (ACPI_FAILURE(status)) |
819 | goto error; | 871 | goto error; |
820 | 872 | ||
821 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found ECDT")); | 873 | printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); |
822 | 874 | ||
823 | boot_ec->command_addr = ecdt_ptr->control.address; | 875 | boot_ec->command_addr = ecdt_ptr->control.address; |
824 | boot_ec->data_addr = ecdt_ptr->data.address; | 876 | boot_ec->data_addr = ecdt_ptr->data.address; |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 635ba449ebc2..e22f4a973c0f 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -341,9 +341,8 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
341 | 341 | ||
342 | /* A Non-NULL gpe_device means this is a GPE Block Device */ | 342 | /* A Non-NULL gpe_device means this is a GPE Block Device */ |
343 | 343 | ||
344 | obj_desc = | 344 | obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *) |
345 | acpi_ns_get_attached_object((struct acpi_namespace_node *) | 345 | gpe_device); |
346 | gpe_device); | ||
347 | if (!obj_desc || !obj_desc->device.gpe_block) { | 346 | if (!obj_desc || !obj_desc->device.gpe_block) { |
348 | return (NULL); | 347 | return (NULL); |
349 | } | 348 | } |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index ad5bc76edf46..361ebe6c4a6f 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -586,6 +586,10 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
586 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 586 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
587 | if (gpe_xrupt->previous) { | 587 | if (gpe_xrupt->previous) { |
588 | gpe_xrupt->previous->next = gpe_xrupt->next; | 588 | gpe_xrupt->previous->next = gpe_xrupt->next; |
589 | } else { | ||
590 | /* No previous, update list head */ | ||
591 | |||
592 | acpi_gbl_gpe_xrupt_list_head = gpe_xrupt->next; | ||
589 | } | 593 | } |
590 | 594 | ||
591 | if (gpe_xrupt->next) { | 595 | if (gpe_xrupt->next) { |
@@ -1033,8 +1037,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1033 | 1037 | ||
1034 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 1038 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
1035 | ACPI_GPE_DISPATCH_METHOD) | 1039 | ACPI_GPE_DISPATCH_METHOD) |
1036 | && (gpe_event_info-> | 1040 | && (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) { |
1037 | flags & ACPI_GPE_TYPE_RUNTIME)) { | ||
1038 | gpe_enabled_count++; | 1041 | gpe_enabled_count++; |
1039 | } | 1042 | } |
1040 | 1043 | ||
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index cae786ca8600..21cb749d0c75 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -196,15 +196,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
196 | notify_info->notify.value = (u16) notify_value; | 196 | notify_info->notify.value = (u16) notify_value; |
197 | notify_info->notify.handler_obj = handler_obj; | 197 | notify_info->notify.handler_obj = handler_obj; |
198 | 198 | ||
199 | acpi_ex_exit_interpreter(); | 199 | status = |
200 | 200 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, | |
201 | acpi_ev_notify_dispatch(notify_info); | 201 | notify_info); |
202 | |||
203 | status = acpi_ex_enter_interpreter(); | ||
204 | if (ACPI_FAILURE(status)) { | 202 | if (ACPI_FAILURE(status)) { |
205 | return_ACPI_STATUS(status); | 203 | acpi_ut_delete_generic_state(notify_info); |
206 | } | 204 | } |
207 | |||
208 | } | 205 | } |
209 | 206 | ||
210 | if (!handler_obj) { | 207 | if (!handler_obj) { |
@@ -323,8 +320,9 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
323 | acpi_gbl_global_lock_acquired = TRUE; | 320 | acpi_gbl_global_lock_acquired = TRUE; |
324 | /* Send a unit to the semaphore */ | 321 | /* Send a unit to the semaphore */ |
325 | 322 | ||
326 | if (ACPI_FAILURE(acpi_os_signal_semaphore( | 323 | if (ACPI_FAILURE |
327 | acpi_gbl_global_lock_semaphore, 1))) { | 324 | (acpi_os_signal_semaphore |
325 | (acpi_gbl_global_lock_semaphore, 1))) { | ||
328 | ACPI_ERROR((AE_INFO, | 326 | ACPI_ERROR((AE_INFO, |
329 | "Could not signal Global Lock semaphore")); | 327 | "Could not signal Global Lock semaphore")); |
330 | } | 328 | } |
@@ -450,7 +448,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
450 | } | 448 | } |
451 | 449 | ||
452 | if (ACPI_FAILURE(status)) { | 450 | if (ACPI_FAILURE(status)) { |
453 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout); | 451 | status = |
452 | acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, | ||
453 | timeout); | ||
454 | } | 454 | } |
455 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) { |
456 | return_ACPI_STATUS(status); | 456 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 96b0e8431748..e99f0c435a47 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
291 | u32 bit_width, acpi_integer * value) | 291 | u32 bit_width, acpi_integer * value) |
292 | { | 292 | { |
293 | acpi_status status; | 293 | acpi_status status; |
294 | acpi_status status2; | ||
295 | acpi_adr_space_handler handler; | 294 | acpi_adr_space_handler handler; |
296 | acpi_adr_space_setup region_setup; | 295 | acpi_adr_space_setup region_setup; |
297 | union acpi_operand_object *handler_desc; | 296 | union acpi_operand_object *handler_desc; |
@@ -345,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
345 | * setup will potentially execute control methods | 344 | * setup will potentially execute control methods |
346 | * (e.g., _REG method for this region) | 345 | * (e.g., _REG method for this region) |
347 | */ | 346 | */ |
348 | acpi_ex_exit_interpreter(); | 347 | acpi_ex_relinquish_interpreter(); |
349 | 348 | ||
350 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, | 349 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, |
351 | handler_desc->address_space.context, | 350 | handler_desc->address_space.context, |
@@ -353,10 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
353 | 352 | ||
354 | /* Re-enter the interpreter */ | 353 | /* Re-enter the interpreter */ |
355 | 354 | ||
356 | status2 = acpi_ex_enter_interpreter(); | 355 | acpi_ex_reacquire_interpreter(); |
357 | if (ACPI_FAILURE(status2)) { | ||
358 | return_ACPI_STATUS(status2); | ||
359 | } | ||
360 | 356 | ||
361 | /* Check for failure of the Region Setup */ | 357 | /* Check for failure of the Region Setup */ |
362 | 358 | ||
@@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
409 | * exit the interpreter because the handler *might* block -- we don't | 405 | * exit the interpreter because the handler *might* block -- we don't |
410 | * know what it will do, so we can't hold the lock on the intepreter. | 406 | * know what it will do, so we can't hold the lock on the intepreter. |
411 | */ | 407 | */ |
412 | acpi_ex_exit_interpreter(); | 408 | acpi_ex_relinquish_interpreter(); |
413 | } | 409 | } |
414 | 410 | ||
415 | /* Call the handler */ | 411 | /* Call the handler */ |
@@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
430 | * We just returned from a non-default handler, we must re-enter the | 426 | * We just returned from a non-default handler, we must re-enter the |
431 | * interpreter | 427 | * interpreter |
432 | */ | 428 | */ |
433 | status2 = acpi_ex_enter_interpreter(); | 429 | acpi_ex_reacquire_interpreter(); |
434 | if (ACPI_FAILURE(status2)) { | ||
435 | return_ACPI_STATUS(status2); | ||
436 | } | ||
437 | } | 430 | } |
438 | 431 | ||
439 | return_ACPI_STATUS(status); | 432 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index a4fa7e6822a3..23ee7bc4a705 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -228,7 +228,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
228 | 228 | ||
229 | /* Install a handler for this PCI root bridge */ | 229 | /* Install a handler for this PCI root bridge */ |
230 | 230 | ||
231 | status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); | 231 | status = |
232 | acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); | ||
232 | if (ACPI_FAILURE(status)) { | 233 | if (ACPI_FAILURE(status)) { |
233 | if (status == AE_SAME_HANDLER) { | 234 | if (status == AE_SAME_HANDLER) { |
234 | /* | 235 | /* |
@@ -283,6 +284,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
283 | } | 284 | } |
284 | 285 | ||
285 | if (!pci_device_node) { | 286 | if (!pci_device_node) { |
287 | ACPI_FREE(pci_id); | ||
286 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 288 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
287 | } | 289 | } |
288 | 290 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index a3379bafa676..6d866a01f5f4 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -91,7 +91,6 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
91 | 91 | ||
92 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) | 92 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) |
93 | #endif /* ACPI_FUTURE_USAGE */ | 93 | #endif /* ACPI_FUTURE_USAGE */ |
94 | |||
95 | /******************************************************************************* | 94 | /******************************************************************************* |
96 | * | 95 | * |
97 | * FUNCTION: acpi_install_fixed_event_handler | 96 | * FUNCTION: acpi_install_fixed_event_handler |
@@ -768,11 +767,9 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
768 | return (AE_BAD_PARAMETER); | 767 | return (AE_BAD_PARAMETER); |
769 | } | 768 | } |
770 | 769 | ||
771 | status = acpi_ex_enter_interpreter(); | 770 | /* Must lock interpreter to prevent race conditions */ |
772 | if (ACPI_FAILURE(status)) { | ||
773 | return (status); | ||
774 | } | ||
775 | 771 | ||
772 | acpi_ex_enter_interpreter(); | ||
776 | status = acpi_ev_acquire_global_lock(timeout); | 773 | status = acpi_ev_acquire_global_lock(timeout); |
777 | acpi_ex_exit_interpreter(); | 774 | acpi_ex_exit_interpreter(); |
778 | 775 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 17065e98807c..9cbd3414a574 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -472,7 +472,6 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
472 | } | 472 | } |
473 | 473 | ||
474 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | 474 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) |
475 | |||
476 | #ifdef ACPI_FUTURE_USAGE | 475 | #ifdef ACPI_FUTURE_USAGE |
477 | /******************************************************************************* | 476 | /******************************************************************************* |
478 | * | 477 | * |
@@ -568,7 +567,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
568 | 567 | ||
569 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) | 568 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) |
570 | #endif /* ACPI_FUTURE_USAGE */ | 569 | #endif /* ACPI_FUTURE_USAGE */ |
571 | |||
572 | /******************************************************************************* | 570 | /******************************************************************************* |
573 | * | 571 | * |
574 | * FUNCTION: acpi_install_gpe_block | 572 | * FUNCTION: acpi_install_gpe_block |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index d470e8b1f4ea..79f2c0d42c06 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -512,9 +512,8 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
512 | * Create a new string object and string buffer | 512 | * Create a new string object and string buffer |
513 | * (-1 because of extra separator included in string_length from above) | 513 | * (-1 because of extra separator included in string_length from above) |
514 | */ | 514 | */ |
515 | return_desc = | 515 | return_desc = acpi_ut_create_string_object((acpi_size) |
516 | acpi_ut_create_string_object((acpi_size) | 516 | (string_length - 1)); |
517 | (string_length - 1)); | ||
518 | if (!return_desc) { | 517 | if (!return_desc) { |
519 | return_ACPI_STATUS(AE_NO_MEMORY); | 518 | return_ACPI_STATUS(AE_NO_MEMORY); |
520 | } | 519 | } |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index ae97812681a3..6e9a23e47fef 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -50,7 +50,6 @@ | |||
50 | 50 | ||
51 | #define _COMPONENT ACPI_EXECUTER | 51 | #define _COMPONENT ACPI_EXECUTER |
52 | ACPI_MODULE_NAME("excreate") | 52 | ACPI_MODULE_NAME("excreate") |
53 | |||
54 | #ifndef ACPI_NO_METHOD_EXECUTION | 53 | #ifndef ACPI_NO_METHOD_EXECUTION |
55 | /******************************************************************************* | 54 | /******************************************************************************* |
56 | * | 55 | * |
@@ -583,10 +582,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
583 | * Get the sync_level. If method is serialized, a mutex will be | 582 | * Get the sync_level. If method is serialized, a mutex will be |
584 | * created for this method when it is parsed. | 583 | * created for this method when it is parsed. |
585 | */ | 584 | */ |
586 | if (acpi_gbl_all_methods_serialized) { | 585 | if (method_flags & AML_METHOD_SERIALIZED) { |
587 | obj_desc->method.sync_level = 0; | ||
588 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; | ||
589 | } else if (method_flags & AML_METHOD_SERIALIZED) { | ||
590 | /* | 586 | /* |
591 | * ACPI 1.0: sync_level = 0 | 587 | * ACPI 1.0: sync_level = 0 |
592 | * ACPI 2.0: sync_level = sync_level in method declaration | 588 | * ACPI 2.0: sync_level = sync_level in method declaration |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 1a73c14df2c5..51c9c29987c3 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -134,7 +134,7 @@ static struct acpi_exdump_info acpi_ex_dump_method[8] = { | |||
134 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { | 134 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { |
135 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, | 135 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, |
136 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, | 136 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, |
137 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread_id), "Owner Thread"}, | 137 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, |
138 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), | 138 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), |
139 | "Acquire Depth"}, | 139 | "Acquire Depth"}, |
140 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} | 140 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} |
@@ -451,9 +451,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
451 | 451 | ||
452 | ACPI_FUNCTION_NAME(ex_dump_operand) | 452 | ACPI_FUNCTION_NAME(ex_dump_operand) |
453 | 453 | ||
454 | if (! | 454 | if (!((ACPI_LV_EXEC & acpi_dbg_level) |
455 | ((ACPI_LV_EXEC & acpi_dbg_level) | 455 | && (_COMPONENT & acpi_dbg_layer))) { |
456 | && (_COMPONENT & acpi_dbg_layer))) { | ||
457 | return; | 456 | return; |
458 | } | 457 | } |
459 | 458 | ||
@@ -844,9 +843,8 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags) | |||
844 | ACPI_FUNCTION_ENTRY(); | 843 | ACPI_FUNCTION_ENTRY(); |
845 | 844 | ||
846 | if (!flags) { | 845 | if (!flags) { |
847 | if (! | 846 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) |
848 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | 847 | && (_COMPONENT & acpi_dbg_layer))) { |
849 | && (_COMPONENT & acpi_dbg_layer))) { | ||
850 | return; | 848 | return; |
851 | } | 849 | } |
852 | } | 850 | } |
@@ -1011,9 +1009,8 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
1011 | } | 1009 | } |
1012 | 1010 | ||
1013 | if (!flags) { | 1011 | if (!flags) { |
1014 | if (! | 1012 | if (!((ACPI_LV_OBJECTS & acpi_dbg_level) |
1015 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | 1013 | && (_COMPONENT & acpi_dbg_layer))) { |
1016 | && (_COMPONENT & acpi_dbg_layer))) { | ||
1017 | return_VOID; | 1014 | return_VOID; |
1018 | } | 1015 | } |
1019 | } | 1016 | } |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 4eb883bda6ae..6748e3ef0997 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -66,9 +66,10 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
66 | * | 66 | * |
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc, | 69 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) |
70 | struct acpi_thread_state *thread) | ||
71 | { | 70 | { |
71 | struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; | ||
72 | |||
72 | if (!thread) { | 73 | if (!thread) { |
73 | return; | 74 | return; |
74 | } | 75 | } |
@@ -173,13 +174,16 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
173 | 174 | ||
174 | /* Support for multiple acquires by the owning thread */ | 175 | /* Support for multiple acquires by the owning thread */ |
175 | 176 | ||
176 | if (obj_desc->mutex.owner_thread_id == acpi_os_get_thread_id()) { | 177 | if (obj_desc->mutex.owner_thread) { |
177 | /* | 178 | if (obj_desc->mutex.owner_thread->thread_id == |
178 | * The mutex is already owned by this thread, just increment the | 179 | walk_state->thread->thread_id) { |
179 | * acquisition depth | 180 | /* |
180 | */ | 181 | * The mutex is already owned by this thread, just increment the |
181 | obj_desc->mutex.acquisition_depth++; | 182 | * acquisition depth |
182 | return_ACPI_STATUS(AE_OK); | 183 | */ |
184 | obj_desc->mutex.acquisition_depth++; | ||
185 | return_ACPI_STATUS(AE_OK); | ||
186 | } | ||
183 | } | 187 | } |
184 | 188 | ||
185 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | 189 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ |
@@ -202,7 +206,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
202 | 206 | ||
203 | /* Have the mutex: update mutex and walk info and save the sync_level */ | 207 | /* Have the mutex: update mutex and walk info and save the sync_level */ |
204 | 208 | ||
205 | obj_desc->mutex.owner_thread_id = acpi_os_get_thread_id(); | 209 | obj_desc->mutex.owner_thread = walk_state->thread; |
206 | obj_desc->mutex.acquisition_depth = 1; | 210 | obj_desc->mutex.acquisition_depth = 1; |
207 | obj_desc->mutex.original_sync_level = | 211 | obj_desc->mutex.original_sync_level = |
208 | walk_state->thread->current_sync_level; | 212 | walk_state->thread->current_sync_level; |
@@ -242,7 +246,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
242 | 246 | ||
243 | /* The mutex must have been previously acquired in order to release it */ | 247 | /* The mutex must have been previously acquired in order to release it */ |
244 | 248 | ||
245 | if (!obj_desc->mutex.owner_thread_id) { | 249 | if (!obj_desc->mutex.owner_thread) { |
246 | ACPI_ERROR((AE_INFO, | 250 | ACPI_ERROR((AE_INFO, |
247 | "Cannot release Mutex [%4.4s], not acquired", | 251 | "Cannot release Mutex [%4.4s], not acquired", |
248 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 252 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
@@ -262,14 +266,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
262 | * The Mutex is owned, but this thread must be the owner. | 266 | * The Mutex is owned, but this thread must be the owner. |
263 | * Special case for Global Lock, any thread can release | 267 | * Special case for Global Lock, any thread can release |
264 | */ | 268 | */ |
265 | if ((obj_desc->mutex.owner_thread_id != | 269 | if ((obj_desc->mutex.owner_thread->thread_id != |
266 | walk_state->thread->thread_id) | 270 | walk_state->thread->thread_id) |
267 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { | 271 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { |
268 | ACPI_ERROR((AE_INFO, | 272 | ACPI_ERROR((AE_INFO, |
269 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", | 273 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", |
270 | (unsigned long)walk_state->thread->thread_id, | 274 | (unsigned long)walk_state->thread->thread_id, |
271 | acpi_ut_get_node_name(obj_desc->mutex.node), | 275 | acpi_ut_get_node_name(obj_desc->mutex.node), |
272 | (unsigned long)obj_desc->mutex.owner_thread_id)); | 276 | (unsigned long)obj_desc->mutex.owner_thread-> |
277 | thread_id)); | ||
273 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 278 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
274 | } | 279 | } |
275 | 280 | ||
@@ -296,7 +301,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
296 | 301 | ||
297 | /* Unlink the mutex from the owner's list */ | 302 | /* Unlink the mutex from the owner's list */ |
298 | 303 | ||
299 | acpi_ex_unlink_mutex(obj_desc, walk_state->thread); | 304 | acpi_ex_unlink_mutex(obj_desc); |
300 | 305 | ||
301 | /* Release the mutex, special case for Global Lock */ | 306 | /* Release the mutex, special case for Global Lock */ |
302 | 307 | ||
@@ -308,7 +313,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
308 | 313 | ||
309 | /* Update the mutex and restore sync_level */ | 314 | /* Update the mutex and restore sync_level */ |
310 | 315 | ||
311 | obj_desc->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 316 | obj_desc->mutex.owner_thread = NULL; |
312 | walk_state->thread->current_sync_level = | 317 | walk_state->thread->current_sync_level = |
313 | obj_desc->mutex.original_sync_level; | 318 | obj_desc->mutex.original_sync_level; |
314 | 319 | ||
@@ -363,7 +368,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
363 | 368 | ||
364 | /* Mark mutex unowned */ | 369 | /* Mark mutex unowned */ |
365 | 370 | ||
366 | obj_desc->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 371 | obj_desc->mutex.owner_thread = NULL; |
367 | 372 | ||
368 | /* Update Thread sync_level (Last mutex is the important one) */ | 373 | /* Update Thread sync_level (Last mutex is the important one) */ |
369 | 374 | ||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 1ee4fb1175c6..308eae52dc05 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -177,8 +177,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
177 | 177 | ||
178 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); | 178 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); |
179 | 179 | ||
180 | for (index = 0; | 180 | for (index = 0; (index < ACPI_NAME_SIZE) |
181 | (index < ACPI_NAME_SIZE) | ||
182 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { | 181 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { |
183 | char_buf[index] = *aml_address++; | 182 | char_buf[index] = *aml_address++; |
184 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 183 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index a6696621ff1b..efe5d4b461a4 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -242,7 +242,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
242 | obj_desc->common_field.bit_length, | 242 | obj_desc->common_field.bit_length, |
243 | 0xFFFFFFFF | 243 | 0xFFFFFFFF |
244 | /* Temp until we pass region_length as parameter */ | 244 | /* Temp until we pass region_length as parameter */ |
245 | ); | 245 | ); |
246 | bit_length = byte_alignment * 8; | 246 | bit_length = byte_alignment * 8; |
247 | #endif | 247 | #endif |
248 | 248 | ||
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index ba761862a599..09d897b3f6d5 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -354,8 +354,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
354 | if ((opcode == AML_STORE_OP) && | 354 | if ((opcode == AML_STORE_OP) && |
355 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == | 355 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
356 | ACPI_TYPE_LOCAL_REFERENCE) | 356 | ACPI_TYPE_LOCAL_REFERENCE) |
357 | && ((*stack_ptr)->reference.opcode == | 357 | && ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { |
358 | AML_INDEX_OP)) { | ||
359 | goto next_operand; | 358 | goto next_operand; |
360 | } | 359 | } |
361 | break; | 360 | break; |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index b2edf620ba89..9460baff3032 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -66,7 +66,6 @@ ACPI_MODULE_NAME("exsystem") | |||
66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) |
67 | { | 67 | { |
68 | acpi_status status; | 68 | acpi_status status; |
69 | acpi_status status2; | ||
70 | 69 | ||
71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); | 70 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 71 | ||
@@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
79 | 78 | ||
80 | /* We must wait, so unlock the interpreter */ | 79 | /* We must wait, so unlock the interpreter */ |
81 | 80 | ||
82 | acpi_ex_exit_interpreter(); | 81 | acpi_ex_relinquish_interpreter(); |
83 | 82 | ||
84 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 83 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
85 | 84 | ||
@@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
89 | 88 | ||
90 | /* Reacquire the interpreter */ | 89 | /* Reacquire the interpreter */ |
91 | 90 | ||
92 | status2 = acpi_ex_enter_interpreter(); | 91 | acpi_ex_reacquire_interpreter(); |
93 | if (ACPI_FAILURE(status2)) { | ||
94 | |||
95 | /* Report fatal error, could not acquire interpreter */ | ||
96 | |||
97 | return_ACPI_STATUS(status2); | ||
98 | } | ||
99 | } | 92 | } |
100 | 93 | ||
101 | return_ACPI_STATUS(status); | 94 | return_ACPI_STATUS(status); |
@@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
119 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | 112 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) |
120 | { | 113 | { |
121 | acpi_status status; | 114 | acpi_status status; |
122 | acpi_status status2; | ||
123 | 115 | ||
124 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); | 116 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); |
125 | 117 | ||
@@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
132 | 124 | ||
133 | /* We must wait, so unlock the interpreter */ | 125 | /* We must wait, so unlock the interpreter */ |
134 | 126 | ||
135 | acpi_ex_exit_interpreter(); | 127 | acpi_ex_relinquish_interpreter(); |
136 | 128 | ||
137 | status = acpi_os_acquire_mutex(mutex, timeout); | 129 | status = acpi_os_acquire_mutex(mutex, timeout); |
138 | 130 | ||
@@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
142 | 134 | ||
143 | /* Reacquire the interpreter */ | 135 | /* Reacquire the interpreter */ |
144 | 136 | ||
145 | status2 = acpi_ex_enter_interpreter(); | 137 | acpi_ex_reacquire_interpreter(); |
146 | if (ACPI_FAILURE(status2)) { | ||
147 | |||
148 | /* Report fatal error, could not acquire interpreter */ | ||
149 | |||
150 | return_ACPI_STATUS(status2); | ||
151 | } | ||
152 | } | 138 | } |
153 | 139 | ||
154 | return_ACPI_STATUS(status); | 140 | return_ACPI_STATUS(status); |
@@ -209,20 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
209 | 195 | ||
210 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | 196 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) |
211 | { | 197 | { |
212 | acpi_status status; | ||
213 | |||
214 | ACPI_FUNCTION_ENTRY(); | 198 | ACPI_FUNCTION_ENTRY(); |
215 | 199 | ||
216 | /* Since this thread will sleep, we must release the interpreter */ | 200 | /* Since this thread will sleep, we must release the interpreter */ |
217 | 201 | ||
218 | acpi_ex_exit_interpreter(); | 202 | acpi_ex_relinquish_interpreter(); |
219 | 203 | ||
220 | acpi_os_sleep(how_long); | 204 | acpi_os_sleep(how_long); |
221 | 205 | ||
222 | /* And now we must get the interpreter again */ | 206 | /* And now we must get the interpreter again */ |
223 | 207 | ||
224 | status = acpi_ex_enter_interpreter(); | 208 | acpi_ex_reacquire_interpreter(); |
225 | return (status); | 209 | return (AE_OK); |
226 | } | 210 | } |
227 | 211 | ||
228 | /******************************************************************************* | 212 | /******************************************************************************* |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index aea461f3a48c..6b0aeccbb69b 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -76,14 +76,15 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | |||
76 | * | 76 | * |
77 | * PARAMETERS: None | 77 | * PARAMETERS: None |
78 | * | 78 | * |
79 | * RETURN: Status | 79 | * RETURN: None |
80 | * | 80 | * |
81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter | 81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter |
82 | * the interpreter region is a fatal system error | 82 | * the interpreter region is a fatal system error. Used in |
83 | * conjunction with exit_interpreter. | ||
83 | * | 84 | * |
84 | ******************************************************************************/ | 85 | ******************************************************************************/ |
85 | 86 | ||
86 | acpi_status acpi_ex_enter_interpreter(void) | 87 | void acpi_ex_enter_interpreter(void) |
87 | { | 88 | { |
88 | acpi_status status; | 89 | acpi_status status; |
89 | 90 | ||
@@ -91,31 +92,55 @@ acpi_status acpi_ex_enter_interpreter(void) | |||
91 | 92 | ||
92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); | 93 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
93 | if (ACPI_FAILURE(status)) { | 94 | if (ACPI_FAILURE(status)) { |
94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); | 95 | ACPI_ERROR((AE_INFO, |
96 | "Could not acquire AML Interpreter mutex")); | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return_ACPI_STATUS(status); | 99 | return_VOID; |
98 | } | 100 | } |
99 | 101 | ||
100 | /******************************************************************************* | 102 | /******************************************************************************* |
101 | * | 103 | * |
102 | * FUNCTION: acpi_ex_exit_interpreter | 104 | * FUNCTION: acpi_ex_reacquire_interpreter |
103 | * | 105 | * |
104 | * PARAMETERS: None | 106 | * PARAMETERS: None |
105 | * | 107 | * |
106 | * RETURN: None | 108 | * RETURN: None |
107 | * | 109 | * |
108 | * DESCRIPTION: Exit the interpreter execution region | 110 | * DESCRIPTION: Reacquire the interpreter execution region from within the |
111 | * interpreter code. Failure to enter the interpreter region is a | ||
112 | * fatal system error. Used in conjuction with | ||
113 | * relinquish_interpreter | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | void acpi_ex_reacquire_interpreter(void) | ||
118 | { | ||
119 | ACPI_FUNCTION_TRACE(ex_reacquire_interpreter); | ||
120 | |||
121 | /* | ||
122 | * If the global serialized flag is set, do not release the interpreter, | ||
123 | * since it was not actually released by acpi_ex_relinquish_interpreter. | ||
124 | * This forces the interpreter to be single threaded. | ||
125 | */ | ||
126 | if (!acpi_gbl_all_methods_serialized) { | ||
127 | acpi_ex_enter_interpreter(); | ||
128 | } | ||
129 | |||
130 | return_VOID; | ||
131 | } | ||
132 | |||
133 | /******************************************************************************* | ||
134 | * | ||
135 | * FUNCTION: acpi_ex_exit_interpreter | ||
136 | * | ||
137 | * PARAMETERS: None | ||
138 | * | ||
139 | * RETURN: None | ||
109 | * | 140 | * |
110 | * Cases where the interpreter is unlocked: | 141 | * DESCRIPTION: Exit the interpreter execution region. This is the top level |
111 | * 1) Completion of the execution of a control method | 142 | * routine used to exit the interpreter when all processing has |
112 | * 2) Method blocked on a Sleep() AML opcode | 143 | * been completed. |
113 | * 3) Method blocked on an Acquire() AML opcode | ||
114 | * 4) Method blocked on a Wait() AML opcode | ||
115 | * 5) Method blocked to acquire the global lock | ||
116 | * 6) Method blocked to execute a serialized control method that is | ||
117 | * already executing | ||
118 | * 7) About to invoke a user-installed opregion handler | ||
119 | * | 144 | * |
120 | ******************************************************************************/ | 145 | ******************************************************************************/ |
121 | 146 | ||
@@ -127,7 +152,46 @@ void acpi_ex_exit_interpreter(void) | |||
127 | 152 | ||
128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | 153 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
129 | if (ACPI_FAILURE(status)) { | 154 | if (ACPI_FAILURE(status)) { |
130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); | 155 | ACPI_ERROR((AE_INFO, |
156 | "Could not release AML Interpreter mutex")); | ||
157 | } | ||
158 | |||
159 | return_VOID; | ||
160 | } | ||
161 | |||
162 | /******************************************************************************* | ||
163 | * | ||
164 | * FUNCTION: acpi_ex_relinquish_interpreter | ||
165 | * | ||
166 | * PARAMETERS: None | ||
167 | * | ||
168 | * RETURN: None | ||
169 | * | ||
170 | * DESCRIPTION: Exit the interpreter execution region, from within the | ||
171 | * interpreter - before attempting an operation that will possibly | ||
172 | * block the running thread. | ||
173 | * | ||
174 | * Cases where the interpreter is unlocked internally | ||
175 | * 1) Method to be blocked on a Sleep() AML opcode | ||
176 | * 2) Method to be blocked on an Acquire() AML opcode | ||
177 | * 3) Method to be blocked on a Wait() AML opcode | ||
178 | * 4) Method to be blocked to acquire the global lock | ||
179 | * 5) Method to be blocked waiting to execute a serialized control method | ||
180 | * that is currently executing | ||
181 | * 6) About to invoke a user-installed opregion handler | ||
182 | * | ||
183 | ******************************************************************************/ | ||
184 | |||
185 | void acpi_ex_relinquish_interpreter(void) | ||
186 | { | ||
187 | ACPI_FUNCTION_TRACE(ex_relinquish_interpreter); | ||
188 | |||
189 | /* | ||
190 | * If the global serialized flag is set, do not release the interpreter. | ||
191 | * This forces the interpreter to be single threaded. | ||
192 | */ | ||
193 | if (!acpi_gbl_all_methods_serialized) { | ||
194 | acpi_ex_exit_interpreter(); | ||
131 | } | 195 | } |
132 | 196 | ||
133 | return_VOID; | 197 | return_VOID; |
@@ -141,8 +205,8 @@ void acpi_ex_exit_interpreter(void) | |||
141 | * | 205 | * |
142 | * RETURN: none | 206 | * RETURN: none |
143 | * | 207 | * |
144 | * DESCRIPTION: Truncate a number to 32-bits if the currently executing method | 208 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is |
145 | * belongs to a 32-bit ACPI table. | 209 | * 32-bit, as determined by the revision of the DSDT. |
146 | * | 210 | * |
147 | ******************************************************************************/ | 211 | ******************************************************************************/ |
148 | 212 | ||
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index c84b1faba28c..76c525dc590b 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -152,7 +152,6 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
152 | 152 | ||
153 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) | 153 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) |
154 | #endif | 154 | #endif |
155 | |||
156 | /******************************************************************************* | 155 | /******************************************************************************* |
157 | * | 156 | * |
158 | * FUNCTION: acpi_enter_sleep_state_prep | 157 | * FUNCTION: acpi_enter_sleep_state_prep |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 26fd0dd6953d..97b2ac57c16b 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -75,7 +75,7 @@ ACPI_MODULE_NAME("nseval") | |||
75 | * MUTEX: Locks interpreter | 75 | * MUTEX: Locks interpreter |
76 | * | 76 | * |
77 | ******************************************************************************/ | 77 | ******************************************************************************/ |
78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | 81 | ||
@@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
154 | * Execute the method via the interpreter. The interpreter is locked | 154 | * Execute the method via the interpreter. The interpreter is locked |
155 | * here before calling into the AML parser | 155 | * here before calling into the AML parser |
156 | */ | 156 | */ |
157 | status = acpi_ex_enter_interpreter(); | 157 | acpi_ex_enter_interpreter(); |
158 | if (ACPI_FAILURE(status)) { | ||
159 | return_ACPI_STATUS(status); | ||
160 | } | ||
161 | |||
162 | status = acpi_ps_execute_method(info); | 158 | status = acpi_ps_execute_method(info); |
163 | acpi_ex_exit_interpreter(); | 159 | acpi_ex_exit_interpreter(); |
164 | } else { | 160 | } else { |
@@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
182 | * resolution, we must lock it because we could access an opregion. | 178 | * resolution, we must lock it because we could access an opregion. |
183 | * The opregion access code assumes that the interpreter is locked. | 179 | * The opregion access code assumes that the interpreter is locked. |
184 | */ | 180 | */ |
185 | status = acpi_ex_enter_interpreter(); | 181 | acpi_ex_enter_interpreter(); |
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | 182 | ||
190 | /* Function has a strange interface */ | 183 | /* Function has a strange interface */ |
191 | 184 | ||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index c4ab615f77fe..33db2241044e 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
214 | u32 level, void *context, void **return_value) | 214 | u32 level, void *context, void **return_value) |
215 | { | 215 | { |
216 | acpi_object_type type; | 216 | acpi_object_type type; |
217 | acpi_status status; | 217 | acpi_status status = AE_OK; |
218 | struct acpi_init_walk_info *info = | 218 | struct acpi_init_walk_info *info = |
219 | (struct acpi_init_walk_info *)context; | 219 | (struct acpi_init_walk_info *)context; |
220 | struct acpi_namespace_node *node = | 220 | struct acpi_namespace_node *node = |
@@ -268,10 +268,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
268 | /* | 268 | /* |
269 | * Must lock the interpreter before executing AML code | 269 | * Must lock the interpreter before executing AML code |
270 | */ | 270 | */ |
271 | status = acpi_ex_enter_interpreter(); | 271 | acpi_ex_enter_interpreter(); |
272 | if (ACPI_FAILURE(status)) { | ||
273 | return (status); | ||
274 | } | ||
275 | 272 | ||
276 | /* | 273 | /* |
277 | * Each of these types can contain executable AML code within the | 274 | * Each of these types can contain executable AML code within the |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 94eb8f332d94..280b8357c46c 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -65,10 +65,8 @@ ACPI_MODULE_NAME("nswalk") | |||
65 | * within Scope is returned. | 65 | * within Scope is returned. |
66 | * | 66 | * |
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | 68 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct acpi_namespace_node |
69 | struct acpi_namespace_node | 69 | *parent_node, struct acpi_namespace_node |
70 | *parent_node, | ||
71 | struct acpi_namespace_node | ||
72 | *child_node) | 70 | *child_node) |
73 | { | 71 | { |
74 | struct acpi_namespace_node *next_node = NULL; | 72 | struct acpi_namespace_node *next_node = NULL; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 8904d0fae6a2..be4f2899de74 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -48,7 +48,6 @@ | |||
48 | 48 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
51 | |||
52 | #ifdef ACPI_FUTURE_USAGE | 51 | #ifdef ACPI_FUTURE_USAGE |
53 | /******************************************************************************* | 52 | /******************************************************************************* |
54 | * | 53 | * |
@@ -73,8 +72,8 @@ ACPI_MODULE_NAME("nsxfeval") | |||
73 | acpi_status | 72 | acpi_status |
74 | acpi_evaluate_object_typed(acpi_handle handle, | 73 | acpi_evaluate_object_typed(acpi_handle handle, |
75 | acpi_string pathname, | 74 | acpi_string pathname, |
76 | struct acpi_object_list * external_params, | 75 | struct acpi_object_list *external_params, |
77 | struct acpi_buffer * return_buffer, | 76 | struct acpi_buffer *return_buffer, |
78 | acpi_object_type return_type) | 77 | acpi_object_type return_type) |
79 | { | 78 | { |
80 | acpi_status status; | 79 | acpi_status status; |
@@ -143,7 +142,6 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
143 | 142 | ||
144 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) | 143 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) |
145 | #endif /* ACPI_FUTURE_USAGE */ | 144 | #endif /* ACPI_FUTURE_USAGE */ |
146 | |||
147 | /******************************************************************************* | 145 | /******************************************************************************* |
148 | * | 146 | * |
149 | * FUNCTION: acpi_evaluate_object | 147 | * FUNCTION: acpi_evaluate_object |
@@ -170,7 +168,6 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | struct acpi_buffer *return_buffer) | 168 | struct acpi_buffer *return_buffer) |
171 | { | 169 | { |
172 | acpi_status status; | 170 | acpi_status status; |
173 | acpi_status status2; | ||
174 | struct acpi_evaluate_info *info; | 171 | struct acpi_evaluate_info *info; |
175 | acpi_size buffer_space_needed; | 172 | acpi_size buffer_space_needed; |
176 | u32 i; | 173 | u32 i; |
@@ -329,14 +326,12 @@ acpi_evaluate_object(acpi_handle handle, | |||
329 | * Delete the internal return object. NOTE: Interpreter must be | 326 | * Delete the internal return object. NOTE: Interpreter must be |
330 | * locked to avoid race condition. | 327 | * locked to avoid race condition. |
331 | */ | 328 | */ |
332 | status2 = acpi_ex_enter_interpreter(); | 329 | acpi_ex_enter_interpreter(); |
333 | if (ACPI_SUCCESS(status2)) { | ||
334 | 330 | ||
335 | /* Remove one reference on the return object (should delete it) */ | 331 | /* Remove one reference on the return object (should delete it) */ |
336 | 332 | ||
337 | acpi_ut_remove_reference(info->return_object); | 333 | acpi_ut_remove_reference(info->return_object); |
338 | acpi_ex_exit_interpreter(); | 334 | acpi_ex_exit_interpreter(); |
339 | } | ||
340 | } | 335 | } |
341 | 336 | ||
342 | cleanup: | 337 | cleanup: |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 8fcd6a15517f..ab04d848b19d 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -36,30 +36,34 @@ | |||
36 | ACPI_MODULE_NAME("numa"); | 36 | ACPI_MODULE_NAME("numa"); |
37 | 37 | ||
38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; | 38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; |
39 | #define PXM_INVAL -1 | ||
40 | #define NID_INVAL -1 | ||
41 | 39 | ||
42 | /* maps to convert between proximity domain and logical node ID */ | 40 | /* maps to convert between proximity domain and logical node ID */ |
43 | int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] | 41 | static int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] |
44 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; | 42 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; |
45 | int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] | 43 | static int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] |
46 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; | 44 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; |
47 | 45 | ||
48 | int __cpuinit pxm_to_node(int pxm) | 46 | int pxm_to_node(int pxm) |
49 | { | 47 | { |
50 | if (pxm < 0) | 48 | if (pxm < 0) |
51 | return NID_INVAL; | 49 | return NID_INVAL; |
52 | return pxm_to_node_map[pxm]; | 50 | return pxm_to_node_map[pxm]; |
53 | } | 51 | } |
54 | 52 | ||
55 | int __cpuinit node_to_pxm(int node) | 53 | int node_to_pxm(int node) |
56 | { | 54 | { |
57 | if (node < 0) | 55 | if (node < 0) |
58 | return PXM_INVAL; | 56 | return PXM_INVAL; |
59 | return node_to_pxm_map[node]; | 57 | return node_to_pxm_map[node]; |
60 | } | 58 | } |
61 | 59 | ||
62 | int __cpuinit acpi_map_pxm_to_node(int pxm) | 60 | void __acpi_map_pxm_to_node(int pxm, int node) |
61 | { | ||
62 | pxm_to_node_map[pxm] = node; | ||
63 | node_to_pxm_map[node] = pxm; | ||
64 | } | ||
65 | |||
66 | int acpi_map_pxm_to_node(int pxm) | ||
63 | { | 67 | { |
64 | int node = pxm_to_node_map[pxm]; | 68 | int node = pxm_to_node_map[pxm]; |
65 | 69 | ||
@@ -67,8 +71,7 @@ int __cpuinit acpi_map_pxm_to_node(int pxm) | |||
67 | if (nodes_weight(nodes_found_map) >= MAX_NUMNODES) | 71 | if (nodes_weight(nodes_found_map) >= MAX_NUMNODES) |
68 | return NID_INVAL; | 72 | return NID_INVAL; |
69 | node = first_unset_node(nodes_found_map); | 73 | node = first_unset_node(nodes_found_map); |
70 | pxm_to_node_map[pxm] = node; | 74 | __acpi_map_pxm_to_node(pxm, node); |
71 | node_to_pxm_map[node] = pxm; | ||
72 | node_set(node, nodes_found_map); | 75 | node_set(node, nodes_found_map); |
73 | } | 76 | } |
74 | 77 | ||
@@ -83,7 +86,8 @@ void __cpuinit acpi_unmap_pxm_to_node(int node) | |||
83 | node_clear(node, nodes_found_map); | 86 | node_clear(node, nodes_found_map); |
84 | } | 87 | } |
85 | 88 | ||
86 | void __init acpi_table_print_srat_entry(struct acpi_subtable_header * header) | 89 | static void __init |
90 | acpi_table_print_srat_entry(struct acpi_subtable_header *header) | ||
87 | { | 91 | { |
88 | 92 | ||
89 | ACPI_FUNCTION_NAME("acpi_table_print_srat_entry"); | 93 | ACPI_FUNCTION_NAME("acpi_table_print_srat_entry"); |
@@ -200,7 +204,7 @@ static int __init acpi_parse_srat(struct acpi_table_header *table) | |||
200 | return 0; | 204 | return 0; |
201 | } | 205 | } |
202 | 206 | ||
203 | int __init | 207 | static int __init |
204 | acpi_table_parse_srat(enum acpi_srat_type id, | 208 | acpi_table_parse_srat(enum acpi_srat_type id, |
205 | acpi_table_entry_handler handler, unsigned int max_entries) | 209 | acpi_table_entry_handler handler, unsigned int max_entries) |
206 | { | 210 | { |
@@ -211,14 +215,13 @@ acpi_table_parse_srat(enum acpi_srat_type id, | |||
211 | 215 | ||
212 | int __init acpi_numa_init(void) | 216 | int __init acpi_numa_init(void) |
213 | { | 217 | { |
214 | int result; | ||
215 | |||
216 | /* SRAT: Static Resource Affinity Table */ | 218 | /* SRAT: Static Resource Affinity Table */ |
217 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { | 219 | if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { |
218 | result = acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, | 220 | acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, |
219 | acpi_parse_processor_affinity, | 221 | acpi_parse_processor_affinity, NR_CPUS); |
220 | NR_CPUS); | 222 | acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, |
221 | result = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific | 223 | acpi_parse_memory_affinity, |
224 | NR_NODE_MEMBLKS); | ||
222 | } | 225 | } |
223 | 226 | ||
224 | /* SLIT: System Locality Information Table */ | 227 | /* SLIT: System Locality Information Table */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c2bed56915e1..00d53c2fd1e8 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/kmod.h> | 34 | #include <linux/kmod.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/dmi.h> | ||
36 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
37 | #include <linux/nmi.h> | 38 | #include <linux/nmi.h> |
38 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
@@ -71,6 +72,22 @@ static unsigned int acpi_irq_irq; | |||
71 | static acpi_osd_handler acpi_irq_handler; | 72 | static acpi_osd_handler acpi_irq_handler; |
72 | static void *acpi_irq_context; | 73 | static void *acpi_irq_context; |
73 | static struct workqueue_struct *kacpid_wq; | 74 | static struct workqueue_struct *kacpid_wq; |
75 | static struct workqueue_struct *kacpi_notify_wq; | ||
76 | |||
77 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | ||
78 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; | ||
79 | |||
80 | #define OSI_LINUX_ENABLED | ||
81 | #ifdef OSI_LINUX_ENABLED | ||
82 | int osi_linux = 1; /* enable _OSI(Linux) by default */ | ||
83 | #else | ||
84 | int osi_linux; /* disable _OSI(Linux) by default */ | ||
85 | #endif | ||
86 | |||
87 | |||
88 | #ifdef CONFIG_DMI | ||
89 | static struct __initdata dmi_system_id acpi_osl_dmi_table[]; | ||
90 | #endif | ||
74 | 91 | ||
75 | static void __init acpi_request_region (struct acpi_generic_address *addr, | 92 | static void __init acpi_request_region (struct acpi_generic_address *addr, |
76 | unsigned int length, char *desc) | 93 | unsigned int length, char *desc) |
@@ -120,8 +137,9 @@ static int __init acpi_reserve_resources(void) | |||
120 | } | 137 | } |
121 | device_initcall(acpi_reserve_resources); | 138 | device_initcall(acpi_reserve_resources); |
122 | 139 | ||
123 | acpi_status acpi_os_initialize(void) | 140 | acpi_status __init acpi_os_initialize(void) |
124 | { | 141 | { |
142 | dmi_check_system(acpi_osl_dmi_table); | ||
125 | return AE_OK; | 143 | return AE_OK; |
126 | } | 144 | } |
127 | 145 | ||
@@ -137,8 +155,9 @@ acpi_status acpi_os_initialize1(void) | |||
137 | return AE_NULL_ENTRY; | 155 | return AE_NULL_ENTRY; |
138 | } | 156 | } |
139 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 157 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
158 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | ||
140 | BUG_ON(!kacpid_wq); | 159 | BUG_ON(!kacpid_wq); |
141 | 160 | BUG_ON(!kacpi_notify_wq); | |
142 | return AE_OK; | 161 | return AE_OK; |
143 | } | 162 | } |
144 | 163 | ||
@@ -150,6 +169,7 @@ acpi_status acpi_os_terminate(void) | |||
150 | } | 169 | } |
151 | 170 | ||
152 | destroy_workqueue(kacpid_wq); | 171 | destroy_workqueue(kacpid_wq); |
172 | destroy_workqueue(kacpi_notify_wq); | ||
153 | 173 | ||
154 | return AE_OK; | 174 | return AE_OK; |
155 | } | 175 | } |
@@ -603,6 +623,23 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | |||
603 | static void acpi_os_execute_deferred(struct work_struct *work) | 623 | static void acpi_os_execute_deferred(struct work_struct *work) |
604 | { | 624 | { |
605 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | 625 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); |
626 | if (!dpc) { | ||
627 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | ||
628 | return; | ||
629 | } | ||
630 | |||
631 | dpc->function(dpc->context); | ||
632 | kfree(dpc); | ||
633 | |||
634 | /* Yield cpu to notify thread */ | ||
635 | cond_resched(); | ||
636 | |||
637 | return; | ||
638 | } | ||
639 | |||
640 | static void acpi_os_execute_notify(struct work_struct *work) | ||
641 | { | ||
642 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | ||
606 | 643 | ||
607 | if (!dpc) { | 644 | if (!dpc) { |
608 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | 645 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
@@ -637,14 +674,12 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
637 | acpi_status status = AE_OK; | 674 | acpi_status status = AE_OK; |
638 | struct acpi_os_dpc *dpc; | 675 | struct acpi_os_dpc *dpc; |
639 | 676 | ||
640 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
641 | |||
642 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 677 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
643 | "Scheduling function [%p(%p)] for deferred execution.\n", | 678 | "Scheduling function [%p(%p)] for deferred execution.\n", |
644 | function, context)); | 679 | function, context)); |
645 | 680 | ||
646 | if (!function) | 681 | if (!function) |
647 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 682 | return AE_BAD_PARAMETER; |
648 | 683 | ||
649 | /* | 684 | /* |
650 | * Allocate/initialize DPC structure. Note that this memory will be | 685 | * Allocate/initialize DPC structure. Note that this memory will be |
@@ -662,14 +697,21 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
662 | dpc->function = function; | 697 | dpc->function = function; |
663 | dpc->context = context; | 698 | dpc->context = context; |
664 | 699 | ||
665 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 700 | if (type == OSL_NOTIFY_HANDLER) { |
666 | if (!queue_work(kacpid_wq, &dpc->work)) { | 701 | INIT_WORK(&dpc->work, acpi_os_execute_notify); |
667 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 702 | if (!queue_work(kacpi_notify_wq, &dpc->work)) { |
703 | status = AE_ERROR; | ||
704 | kfree(dpc); | ||
705 | } | ||
706 | } else { | ||
707 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
708 | if (!queue_work(kacpid_wq, &dpc->work)) { | ||
709 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
668 | "Call to queue_work() failed.\n")); | 710 | "Call to queue_work() failed.\n")); |
669 | kfree(dpc); | 711 | status = AE_ERROR; |
670 | status = AE_ERROR; | 712 | kfree(dpc); |
713 | } | ||
671 | } | 714 | } |
672 | |||
673 | return_ACPI_STATUS(status); | 715 | return_ACPI_STATUS(status); |
674 | } | 716 | } |
675 | 717 | ||
@@ -935,20 +977,38 @@ static int __init acpi_os_name_setup(char *str) | |||
935 | 977 | ||
936 | __setup("acpi_os_name=", acpi_os_name_setup); | 978 | __setup("acpi_os_name=", acpi_os_name_setup); |
937 | 979 | ||
980 | static void enable_osi_linux(int enable) { | ||
981 | |||
982 | if (osi_linux != enable) | ||
983 | printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n", | ||
984 | enable ? "En": "Dis"); | ||
985 | |||
986 | osi_linux = enable; | ||
987 | return; | ||
988 | } | ||
989 | |||
938 | /* | 990 | /* |
939 | * _OSI control | 991 | * Modify the list of "OS Interfaces" reported to BIOS via _OSI |
992 | * | ||
940 | * empty string disables _OSI | 993 | * empty string disables _OSI |
941 | * TBD additional string adds to _OSI | 994 | * string starting with '!' disables that string |
995 | * otherwise string is added to list, augmenting built-in strings | ||
942 | */ | 996 | */ |
943 | static int __init acpi_osi_setup(char *str) | 997 | static int __init acpi_osi_setup(char *str) |
944 | { | 998 | { |
945 | if (str == NULL || *str == '\0') { | 999 | if (str == NULL || *str == '\0') { |
946 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | 1000 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); |
947 | acpi_gbl_create_osi_method = FALSE; | 1001 | acpi_gbl_create_osi_method = FALSE; |
948 | } else { | 1002 | } else if (!strcmp("!Linux", str)) { |
949 | /* TBD */ | 1003 | enable_osi_linux(0); |
950 | printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", | 1004 | } else if (*str == '!') { |
951 | str); | 1005 | if (acpi_osi_invalidate(++str) == AE_OK) |
1006 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); | ||
1007 | } else if (!strcmp("Linux", str)) { | ||
1008 | enable_osi_linux(1); | ||
1009 | } else if (*osi_additional_string == '\0') { | ||
1010 | strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); | ||
1011 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); | ||
952 | } | 1012 | } |
953 | 1013 | ||
954 | return 1; | 1014 | return 1; |
@@ -1038,7 +1098,7 @@ void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) | |||
1038 | acpi_status | 1098 | acpi_status |
1039 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) | 1099 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
1040 | { | 1100 | { |
1041 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); | 1101 | *cache = kmem_cache_create(name, size, 0, 0, NULL); |
1042 | if (*cache == NULL) | 1102 | if (*cache == NULL) |
1043 | return AE_ERROR; | 1103 | return AE_ERROR; |
1044 | else | 1104 | else |
@@ -1118,11 +1178,28 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1118 | acpi_status | 1178 | acpi_status |
1119 | acpi_os_validate_interface (char *interface) | 1179 | acpi_os_validate_interface (char *interface) |
1120 | { | 1180 | { |
1121 | 1181 | if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) | |
1122 | return AE_SUPPORT; | 1182 | return AE_OK; |
1183 | if (!strcmp("Linux", interface)) { | ||
1184 | printk(KERN_WARNING PREFIX | ||
1185 | "System BIOS is requesting _OSI(Linux)\n"); | ||
1186 | #ifdef OSI_LINUX_ENABLED | ||
1187 | printk(KERN_WARNING PREFIX | ||
1188 | "Please test with \"acpi_osi=!Linux\"\n" | ||
1189 | "Please send dmidecode " | ||
1190 | "to linux-acpi@vger.kernel.org\n"); | ||
1191 | #else | ||
1192 | printk(KERN_WARNING PREFIX | ||
1193 | "If \"acpi_osi=Linux\" works better,\n" | ||
1194 | "Please send dmidecode " | ||
1195 | "to linux-acpi@vger.kernel.org\n"); | ||
1196 | #endif | ||
1197 | if(osi_linux) | ||
1198 | return AE_OK; | ||
1199 | } | ||
1200 | return AE_SUPPORT; | ||
1123 | } | 1201 | } |
1124 | 1202 | ||
1125 | |||
1126 | /****************************************************************************** | 1203 | /****************************************************************************** |
1127 | * | 1204 | * |
1128 | * FUNCTION: acpi_os_validate_address | 1205 | * FUNCTION: acpi_os_validate_address |
@@ -1149,5 +1226,51 @@ acpi_os_validate_address ( | |||
1149 | return AE_OK; | 1226 | return AE_OK; |
1150 | } | 1227 | } |
1151 | 1228 | ||
1229 | #ifdef CONFIG_DMI | ||
1230 | #ifdef OSI_LINUX_ENABLED | ||
1231 | static int dmi_osi_not_linux(struct dmi_system_id *d) | ||
1232 | { | ||
1233 | printk(KERN_NOTICE "%s detected: requires not _OSI(Linux)\n", d->ident); | ||
1234 | enable_osi_linux(0); | ||
1235 | return 0; | ||
1236 | } | ||
1237 | #else | ||
1238 | static int dmi_osi_linux(struct dmi_system_id *d) | ||
1239 | { | ||
1240 | printk(KERN_NOTICE "%s detected: requires _OSI(Linux)\n", d->ident); | ||
1241 | enable_osi_linux(1); | ||
1242 | return 0; | ||
1243 | } | ||
1244 | #endif | ||
1245 | |||
1246 | static struct dmi_system_id acpi_osl_dmi_table[] __initdata = { | ||
1247 | #ifdef OSI_LINUX_ENABLED | ||
1248 | /* | ||
1249 | * Boxes that need NOT _OSI(Linux) | ||
1250 | */ | ||
1251 | { | ||
1252 | .callback = dmi_osi_not_linux, | ||
1253 | .ident = "Toshiba Satellite P100", | ||
1254 | .matches = { | ||
1255 | DMI_MATCH(DMI_BOARD_VENDOR, "TOSHIBA"), | ||
1256 | DMI_MATCH(DMI_BOARD_NAME, "Satellite P100"), | ||
1257 | }, | ||
1258 | }, | ||
1259 | #else | ||
1260 | /* | ||
1261 | * Boxes that need _OSI(Linux) | ||
1262 | */ | ||
1263 | { | ||
1264 | .callback = dmi_osi_linux, | ||
1265 | .ident = "Intel Napa CRB", | ||
1266 | .matches = { | ||
1267 | DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"), | ||
1268 | DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"), | ||
1269 | }, | ||
1270 | }, | ||
1271 | #endif | ||
1272 | {} | ||
1273 | }; | ||
1274 | #endif /* CONFIG_DMI */ | ||
1152 | 1275 | ||
1153 | #endif | 1276 | #endif |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 16d8b6cc3c22..9296e86761d7 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -185,459 +185,453 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { | |||
185 | /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ | 185 | /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ |
186 | 186 | ||
187 | /* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, | 187 | /* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, |
188 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 188 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
189 | /* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, | 189 | /* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, |
190 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 190 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
191 | /* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, | 191 | /* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, |
192 | ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, | 192 | ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, |
193 | AML_TYPE_NAMED_SIMPLE, | 193 | AML_TYPE_NAMED_SIMPLE, |
194 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 194 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
195 | AML_NSNODE | AML_NAMED), | 195 | AML_NSNODE | AML_NAMED), |
196 | /* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, | 196 | /* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, |
197 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, | 197 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, |
198 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 198 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
199 | AML_NSNODE | AML_NAMED), | 199 | AML_NSNODE | AML_NAMED), |
200 | /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, | 200 | /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, |
201 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 201 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
202 | AML_TYPE_LITERAL, AML_CONSTANT), | 202 | AML_TYPE_LITERAL, AML_CONSTANT), |
203 | /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, | 203 | /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, |
204 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 204 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
205 | AML_TYPE_LITERAL, AML_CONSTANT), | 205 | AML_TYPE_LITERAL, AML_CONSTANT), |
206 | /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, | 206 | /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, |
207 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 207 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
208 | AML_TYPE_LITERAL, AML_CONSTANT), | 208 | AML_TYPE_LITERAL, AML_CONSTANT), |
209 | /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, | 209 | /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, |
210 | ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, | 210 | ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, |
211 | AML_TYPE_LITERAL, AML_CONSTANT), | 211 | AML_TYPE_LITERAL, AML_CONSTANT), |
212 | /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, | 212 | /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, |
213 | ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, | 213 | ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, |
214 | AML_TYPE_NAMED_NO_OBJ, | 214 | AML_TYPE_NAMED_NO_OBJ, |
215 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 215 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
216 | AML_NSNODE | AML_NAMED), | 216 | AML_NSNODE | AML_NAMED), |
217 | /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, | 217 | /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, |
218 | ACPI_TYPE_BUFFER, AML_CLASS_CREATE, | 218 | ACPI_TYPE_BUFFER, AML_CLASS_CREATE, |
219 | AML_TYPE_CREATE_OBJECT, | 219 | AML_TYPE_CREATE_OBJECT, |
220 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), | 220 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), |
221 | /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, | 221 | /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, |
222 | ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, | 222 | ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, |
223 | AML_TYPE_CREATE_OBJECT, | 223 | AML_TYPE_CREATE_OBJECT, |
224 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), | 224 | AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), |
225 | /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, | 225 | /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, |
226 | ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, | 226 | ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, |
227 | AML_TYPE_NAMED_COMPLEX, | 227 | AML_TYPE_NAMED_COMPLEX, |
228 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 228 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
229 | AML_NSNODE | AML_NAMED | AML_DEFER), | 229 | AML_NSNODE | AML_NAMED | AML_DEFER), |
230 | /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, | 230 | /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, |
231 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 231 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
232 | AML_TYPE_LOCAL_VARIABLE, 0), | 232 | AML_TYPE_LOCAL_VARIABLE, 0), |
233 | /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, | 233 | /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, |
234 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 234 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
235 | AML_TYPE_LOCAL_VARIABLE, 0), | 235 | AML_TYPE_LOCAL_VARIABLE, 0), |
236 | /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, | 236 | /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, |
237 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 237 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
238 | AML_TYPE_LOCAL_VARIABLE, 0), | 238 | AML_TYPE_LOCAL_VARIABLE, 0), |
239 | /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, | 239 | /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, |
240 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 240 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
241 | AML_TYPE_LOCAL_VARIABLE, 0), | 241 | AML_TYPE_LOCAL_VARIABLE, 0), |
242 | /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, | 242 | /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, |
243 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 243 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
244 | AML_TYPE_LOCAL_VARIABLE, 0), | 244 | AML_TYPE_LOCAL_VARIABLE, 0), |
245 | /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, | 245 | /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, |
246 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 246 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
247 | AML_TYPE_LOCAL_VARIABLE, 0), | 247 | AML_TYPE_LOCAL_VARIABLE, 0), |
248 | /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, | 248 | /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, |
249 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 249 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
250 | AML_TYPE_LOCAL_VARIABLE, 0), | 250 | AML_TYPE_LOCAL_VARIABLE, 0), |
251 | /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, | 251 | /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, |
252 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 252 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
253 | AML_TYPE_LOCAL_VARIABLE, 0), | 253 | AML_TYPE_LOCAL_VARIABLE, 0), |
254 | /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, | 254 | /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, |
255 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 255 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
256 | AML_TYPE_METHOD_ARGUMENT, 0), | 256 | AML_TYPE_METHOD_ARGUMENT, 0), |
257 | /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, | 257 | /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, |
258 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 258 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
259 | AML_TYPE_METHOD_ARGUMENT, 0), | 259 | AML_TYPE_METHOD_ARGUMENT, 0), |
260 | /* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2, | 260 | /* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2, |
261 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 261 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
262 | AML_TYPE_METHOD_ARGUMENT, 0), | 262 | AML_TYPE_METHOD_ARGUMENT, 0), |
263 | /* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3, | 263 | /* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3, |
264 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 264 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
265 | AML_TYPE_METHOD_ARGUMENT, 0), | 265 | AML_TYPE_METHOD_ARGUMENT, 0), |
266 | /* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4, | 266 | /* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4, |
267 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 267 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
268 | AML_TYPE_METHOD_ARGUMENT, 0), | 268 | AML_TYPE_METHOD_ARGUMENT, 0), |
269 | /* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5, | 269 | /* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5, |
270 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 270 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
271 | AML_TYPE_METHOD_ARGUMENT, 0), | 271 | AML_TYPE_METHOD_ARGUMENT, 0), |
272 | /* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6, | 272 | /* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6, |
273 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 273 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
274 | AML_TYPE_METHOD_ARGUMENT, 0), | 274 | AML_TYPE_METHOD_ARGUMENT, 0), |
275 | /* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, | 275 | /* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, |
276 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 276 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
277 | AML_FLAGS_EXEC_1A_1T_1R), | 277 | AML_FLAGS_EXEC_1A_1T_1R), |
278 | /* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, | 278 | /* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, |
279 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, | 279 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, |
280 | AML_FLAGS_EXEC_1A_0T_1R), | 280 | AML_FLAGS_EXEC_1A_0T_1R), |
281 | /* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, | 281 | /* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, |
282 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 282 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
283 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 283 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
284 | /* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, | 284 | /* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, |
285 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 285 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
286 | AML_TYPE_EXEC_2A_1T_1R, | 286 | AML_TYPE_EXEC_2A_1T_1R, |
287 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 287 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
288 | /* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, | 288 | /* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, |
289 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 289 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
290 | AML_TYPE_EXEC_2A_1T_1R, | 290 | AML_TYPE_EXEC_2A_1T_1R, |
291 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 291 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
292 | /* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, | 292 | /* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, |
293 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 293 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
294 | AML_TYPE_EXEC_1A_0T_1R, | 294 | AML_TYPE_EXEC_1A_0T_1R, |
295 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 295 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
296 | /* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, | 296 | /* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, |
297 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 297 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
298 | AML_TYPE_EXEC_1A_0T_1R, | 298 | AML_TYPE_EXEC_1A_0T_1R, |
299 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 299 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
300 | /* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, | 300 | /* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, |
301 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 301 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
302 | AML_TYPE_EXEC_2A_1T_1R, | 302 | AML_TYPE_EXEC_2A_1T_1R, |
303 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 303 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
304 | /* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, | 304 | /* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, |
305 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 305 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
306 | AML_TYPE_EXEC_2A_2T_1R, | 306 | AML_TYPE_EXEC_2A_2T_1R, |
307 | AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), | 307 | AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), |
308 | /* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, | 308 | /* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, |
309 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 309 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
310 | AML_TYPE_EXEC_2A_1T_1R, | 310 | AML_TYPE_EXEC_2A_1T_1R, |
311 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 311 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
312 | /* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, | 312 | /* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, |
313 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 313 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
314 | AML_TYPE_EXEC_2A_1T_1R, | 314 | AML_TYPE_EXEC_2A_1T_1R, |
315 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 315 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
316 | /* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, | 316 | /* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, |
317 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 317 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
318 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 318 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
319 | /* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, | 319 | /* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, |
320 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 320 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
321 | AML_TYPE_EXEC_2A_1T_1R, | 321 | AML_TYPE_EXEC_2A_1T_1R, |
322 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 322 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
323 | /* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, | 323 | /* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, |
324 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 324 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
325 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 325 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
326 | /* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, | 326 | /* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, |
327 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 327 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
328 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 328 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
329 | /* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, | 329 | /* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, |
330 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 330 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
331 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), | 331 | AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), |
332 | /* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, | 332 | /* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, |
333 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 333 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
334 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 334 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
335 | /* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, | 335 | /* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, |
336 | ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, | 336 | ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, |
337 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 337 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
338 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 338 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
339 | /* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, | 339 | /* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, |
340 | ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, | 340 | ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, |
341 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 341 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
342 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 342 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
343 | /* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, | 343 | /* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, |
344 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 344 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
345 | AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), | 345 | AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), |
346 | /* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, | 346 | /* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, |
347 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 347 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
348 | AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), | 348 | AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), |
349 | /* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, | 349 | /* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, |
350 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 350 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
351 | AML_TYPE_EXEC_1A_0T_1R, | 351 | AML_TYPE_EXEC_1A_0T_1R, |
352 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), | 352 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), |
353 | /* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, | 353 | /* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, |
354 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 354 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
355 | AML_FLAGS_EXEC_2A_1T_1R), | 355 | AML_FLAGS_EXEC_2A_1T_1R), |
356 | /* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, | 356 | /* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, |
357 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, | 357 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, |
358 | AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), | 358 | AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), |
359 | /* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP, | 359 | /* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP, |
360 | ARGI_CREATE_DWORD_FIELD_OP, | 360 | ARGI_CREATE_DWORD_FIELD_OP, |
361 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 361 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
362 | AML_TYPE_CREATE_FIELD, | 362 | AML_TYPE_CREATE_FIELD, |
363 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 363 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
364 | AML_DEFER | AML_CREATE), | 364 | AML_DEFER | AML_CREATE), |
365 | /* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, | 365 | /* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, |
366 | ARGI_CREATE_WORD_FIELD_OP, | 366 | ARGI_CREATE_WORD_FIELD_OP, |
367 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 367 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
368 | AML_TYPE_CREATE_FIELD, | 368 | AML_TYPE_CREATE_FIELD, |
369 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 369 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
370 | AML_DEFER | AML_CREATE), | 370 | AML_DEFER | AML_CREATE), |
371 | /* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, | 371 | /* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, |
372 | ARGI_CREATE_BYTE_FIELD_OP, | 372 | ARGI_CREATE_BYTE_FIELD_OP, |
373 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 373 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
374 | AML_TYPE_CREATE_FIELD, | 374 | AML_TYPE_CREATE_FIELD, |
375 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 375 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
376 | AML_DEFER | AML_CREATE), | 376 | AML_DEFER | AML_CREATE), |
377 | /* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, | 377 | /* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, |
378 | ARGI_CREATE_BIT_FIELD_OP, | 378 | ARGI_CREATE_BIT_FIELD_OP, |
379 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 379 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
380 | AML_TYPE_CREATE_FIELD, | 380 | AML_TYPE_CREATE_FIELD, |
381 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 381 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
382 | AML_DEFER | AML_CREATE), | 382 | AML_DEFER | AML_CREATE), |
383 | /* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, | 383 | /* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, |
384 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 384 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
385 | AML_TYPE_EXEC_1A_0T_1R, | 385 | AML_TYPE_EXEC_1A_0T_1R, |
386 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), | 386 | AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE), |
387 | /* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, | 387 | /* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, |
388 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 388 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
389 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | | 389 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), |
390 | AML_CONSTANT), | ||
391 | /* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, | 390 | /* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, |
392 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 391 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
393 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | | 392 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT), |
394 | AML_CONSTANT), | ||
395 | /* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, | 393 | /* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, |
396 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, | 394 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, |
397 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), | 395 | AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), |
398 | /* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, | 396 | /* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, |
399 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 397 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
400 | AML_TYPE_EXEC_2A_0T_1R, | 398 | AML_TYPE_EXEC_2A_0T_1R, |
401 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 399 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
402 | /* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, | 400 | /* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, |
403 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 401 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
404 | AML_TYPE_EXEC_2A_0T_1R, | 402 | AML_TYPE_EXEC_2A_0T_1R, |
405 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 403 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
406 | /* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, | 404 | /* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, |
407 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 405 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
408 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), | 406 | AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), |
409 | /* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, | 407 | /* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, |
410 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 408 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
411 | /* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, | 409 | /* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, |
412 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 410 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
413 | /* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, | 411 | /* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, |
414 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), | 412 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), |
415 | /* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, | 413 | /* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, |
416 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 414 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
417 | /* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, | 415 | /* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, |
418 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, | 416 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, |
419 | AML_TYPE_CONTROL, AML_HAS_ARGS), | 417 | AML_TYPE_CONTROL, AML_HAS_ARGS), |
420 | /* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, | 418 | /* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, |
421 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 419 | AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
422 | /* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, | 420 | /* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, |
423 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 421 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
424 | /* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, | 422 | /* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, |
425 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), | 423 | AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), |
426 | 424 | ||
427 | /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ | 425 | /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ |
428 | 426 | ||
429 | /* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, | 427 | /* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, |
430 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 428 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, |
431 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 429 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
432 | AML_NSNODE | AML_NAMED), | 430 | AML_NSNODE | AML_NAMED), |
433 | /* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, | 431 | /* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, |
434 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 432 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, |
435 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), | 433 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), |
436 | /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, | 434 | /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, |
437 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 435 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
438 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), | 436 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), |
439 | /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, | 437 | /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, |
440 | ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, | 438 | ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, |
441 | AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, | 439 | AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, |
442 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 440 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
443 | AML_DEFER | AML_FIELD | AML_CREATE), | 441 | AML_DEFER | AML_FIELD | AML_CREATE), |
444 | /* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, | 442 | /* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, |
445 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, | 443 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, |
446 | AML_FLAGS_EXEC_1A_1T_0R), | 444 | AML_FLAGS_EXEC_1A_1T_0R), |
447 | /* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, | 445 | /* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, |
448 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 446 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
449 | AML_FLAGS_EXEC_1A_0T_0R), | 447 | AML_FLAGS_EXEC_1A_0T_0R), |
450 | /* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, | 448 | /* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, |
451 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 449 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
452 | AML_FLAGS_EXEC_1A_0T_0R), | 450 | AML_FLAGS_EXEC_1A_0T_0R), |
453 | /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, | 451 | /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, |
454 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 452 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
455 | AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), | 453 | AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), |
456 | /* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, | 454 | /* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, |
457 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 455 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
458 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 456 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
459 | /* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, | 457 | /* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, |
460 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, | 458 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, |
461 | AML_FLAGS_EXEC_2A_0T_1R), | 459 | AML_FLAGS_EXEC_2A_0T_1R), |
462 | /* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, | 460 | /* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, |
463 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, | 461 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, |
464 | AML_FLAGS_EXEC_1A_0T_0R), | 462 | AML_FLAGS_EXEC_1A_0T_0R), |
465 | /* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, | 463 | /* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, |
466 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 464 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
467 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 465 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
468 | /* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, | 466 | /* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, |
469 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 467 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
470 | AML_TYPE_EXEC_1A_1T_1R, | 468 | AML_TYPE_EXEC_1A_1T_1R, |
471 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 469 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
472 | /* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, | 470 | /* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, |
473 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 471 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
474 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 472 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
475 | /* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, | 473 | /* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, |
476 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 474 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
477 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), | 475 | AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), |
478 | /* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, | 476 | /* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, |
479 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 477 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
480 | AML_TYPE_CONSTANT, 0), | 478 | AML_TYPE_CONSTANT, 0), |
481 | /* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, | 479 | /* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, |
482 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 480 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
483 | AML_TYPE_CONSTANT, 0), | 481 | AML_TYPE_CONSTANT, 0), |
484 | /* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, | 482 | /* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, |
485 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, | 483 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, |
486 | AML_FLAGS_EXEC_3A_0T_0R), | 484 | AML_FLAGS_EXEC_3A_0T_0R), |
487 | /* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, | 485 | /* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, |
488 | ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, | 486 | ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, |
489 | AML_TYPE_NAMED_COMPLEX, | 487 | AML_TYPE_NAMED_COMPLEX, |
490 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 488 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
491 | AML_NSNODE | AML_NAMED | AML_DEFER), | 489 | AML_NSNODE | AML_NAMED | AML_DEFER), |
492 | /* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, | 490 | /* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, |
493 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, | 491 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, |
494 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 492 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), |
495 | AML_FIELD), | ||
496 | /* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, | 493 | /* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, |
497 | ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, | 494 | ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, |
498 | AML_TYPE_NAMED_NO_OBJ, | 495 | AML_TYPE_NAMED_NO_OBJ, |
499 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 496 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
500 | AML_NSNODE | AML_NAMED), | 497 | AML_NSNODE | AML_NAMED), |
501 | /* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, | 498 | /* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, |
502 | ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, | 499 | ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, |
503 | AML_TYPE_NAMED_SIMPLE, | 500 | AML_TYPE_NAMED_SIMPLE, |
504 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 501 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
505 | AML_NSNODE | AML_NAMED), | 502 | AML_NSNODE | AML_NAMED), |
506 | /* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, | 503 | /* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, |
507 | ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, | 504 | ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, |
508 | AML_TYPE_NAMED_SIMPLE, | 505 | AML_TYPE_NAMED_SIMPLE, |
509 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 506 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
510 | AML_NSNODE | AML_NAMED), | 507 | AML_NSNODE | AML_NAMED), |
511 | /* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP, | 508 | /* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP, |
512 | ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, | 509 | ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, |
513 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, | 510 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, |
514 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 511 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
515 | AML_NSNODE | AML_NAMED), | 512 | AML_NSNODE | AML_NAMED), |
516 | /* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, | 513 | /* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, |
517 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 514 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
518 | AML_TYPE_NAMED_FIELD, | 515 | AML_TYPE_NAMED_FIELD, |
519 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 516 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), |
520 | AML_FIELD), | ||
521 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, | 517 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, |
522 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 518 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
523 | AML_TYPE_NAMED_FIELD, | 519 | AML_TYPE_NAMED_FIELD, |
524 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 520 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), |
525 | AML_FIELD), | ||
526 | 521 | ||
527 | /* Internal opcodes that map to invalid AML opcodes */ | 522 | /* Internal opcodes that map to invalid AML opcodes */ |
528 | 523 | ||
529 | /* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, | 524 | /* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, |
530 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 525 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
531 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), | 526 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), |
532 | /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, | 527 | /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, |
533 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 528 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
534 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), | 529 | AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), |
535 | /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, | 530 | /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, |
536 | ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, | 531 | ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, |
537 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, | 532 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, |
538 | AML_HAS_ARGS | AML_CONSTANT), | 533 | AML_HAS_ARGS | AML_CONSTANT), |
539 | /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, | 534 | /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, |
540 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, | 535 | ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, |
541 | AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), | 536 | AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), |
542 | /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, | 537 | /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, |
543 | ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, | 538 | ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, |
544 | AML_TYPE_METHOD_CALL, | 539 | AML_TYPE_METHOD_CALL, |
545 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), | 540 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), |
546 | /* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, | 541 | /* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, |
547 | ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, | 542 | ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, |
548 | AML_TYPE_LITERAL, 0), | 543 | AML_TYPE_LITERAL, 0), |
549 | /* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP, | 544 | /* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP, |
550 | ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, | 545 | ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, |
551 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 546 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
552 | /* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, | 547 | /* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, |
553 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, | 548 | ACPI_TYPE_ANY, AML_CLASS_INTERNAL, |
554 | AML_TYPE_BOGUS, | 549 | AML_TYPE_BOGUS, |
555 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), | 550 | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), |
556 | /* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP, | 551 | /* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP, |
557 | ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, | 552 | ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, |
558 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 553 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
559 | /* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP, | 554 | /* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP, |
560 | ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, | 555 | ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, |
561 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), | 556 | AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), |
562 | /* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 557 | /* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
563 | AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, | 558 | AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, |
564 | AML_HAS_ARGS | AML_HAS_RETVAL), | 559 | AML_HAS_ARGS | AML_HAS_RETVAL), |
565 | /* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, | 560 | /* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, |
566 | AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), | 561 | AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), |
567 | /* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 562 | /* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
568 | AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), | 563 | AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), |
569 | /* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, | 564 | /* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, |
570 | AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), | 565 | AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), |
571 | 566 | ||
572 | /* ACPI 2.0 opcodes */ | 567 | /* ACPI 2.0 opcodes */ |
573 | 568 | ||
574 | /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, | 569 | /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, |
575 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, | 570 | ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, |
576 | AML_TYPE_LITERAL, AML_CONSTANT), | 571 | AML_TYPE_LITERAL, AML_CONSTANT), |
577 | /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, | 572 | /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, |
578 | ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, | 573 | ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, |
579 | AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, | 574 | AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, |
580 | AML_HAS_ARGS | AML_DEFER), | 575 | AML_HAS_ARGS | AML_DEFER), |
581 | /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, | 576 | /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, |
582 | ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, | 577 | ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, |
583 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 578 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
584 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 579 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
585 | /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, | 580 | /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, |
586 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, | 581 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, |
587 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 582 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
588 | /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, | 583 | /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, |
589 | ARGI_CREATE_QWORD_FIELD_OP, | 584 | ARGI_CREATE_QWORD_FIELD_OP, |
590 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, | 585 | ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, |
591 | AML_TYPE_CREATE_FIELD, | 586 | AML_TYPE_CREATE_FIELD, |
592 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | | 587 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | |
593 | AML_DEFER | AML_CREATE), | 588 | AML_DEFER | AML_CREATE), |
594 | /* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, | 589 | /* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, |
595 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 590 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
596 | AML_TYPE_EXEC_1A_1T_1R, | 591 | AML_TYPE_EXEC_1A_1T_1R, |
597 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 592 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
598 | /* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP, | 593 | /* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP, |
599 | ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, | 594 | ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, |
600 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, | 595 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, |
601 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 596 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
602 | /* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, | 597 | /* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, |
603 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 598 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
604 | AML_TYPE_EXEC_1A_1T_1R, | 599 | AML_TYPE_EXEC_1A_1T_1R, |
605 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 600 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
606 | /* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, | 601 | /* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, |
607 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 602 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
608 | AML_TYPE_EXEC_1A_1T_1R, | 603 | AML_TYPE_EXEC_1A_1T_1R, |
609 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), | 604 | AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), |
610 | /* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, | 605 | /* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, |
611 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 606 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
612 | AML_TYPE_EXEC_2A_1T_1R, | 607 | AML_TYPE_EXEC_2A_1T_1R, |
613 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), | 608 | AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), |
614 | /* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, | 609 | /* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, |
615 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 610 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
616 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), | 611 | AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), |
617 | /* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, | 612 | /* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, |
618 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, | 613 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, |
619 | AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), | 614 | AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), |
620 | /* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, | 615 | /* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, |
621 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), | 616 | ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), |
622 | /* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, | 617 | /* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, |
623 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, | 618 | ACPI_TYPE_ANY, AML_CLASS_EXECUTE, |
624 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), | 619 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), |
625 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, | 620 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, |
626 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, | 621 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, |
627 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 622 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, |
628 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 623 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
629 | AML_NSNODE | AML_NAMED), | 624 | AML_NSNODE | AML_NAMED), |
630 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, | 625 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, |
631 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 626 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
632 | AML_TYPE_NAMED_NO_OBJ, | 627 | AML_TYPE_NAMED_NO_OBJ, |
633 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 628 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), |
634 | AML_NSNODE), | ||
635 | 629 | ||
636 | /* ACPI 3.0 opcodes */ | 630 | /* ACPI 3.0 opcodes */ |
637 | 631 | ||
638 | /* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, | 632 | /* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, |
639 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, | 633 | AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, |
640 | AML_FLAGS_EXEC_0A_0T_1R) | 634 | AML_FLAGS_EXEC_0A_0T_1R) |
641 | 635 | ||
642 | /*! [End] no source code translation !*/ | 636 | /*! [End] no source code translation !*/ |
643 | }; | 637 | }; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index f7de02a6f497..e1ca86dfdd66 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -115,7 +115,6 @@ struct acpi_processor_errata errata __read_mostly; | |||
115 | 115 | ||
116 | static int acpi_processor_errata_piix4(struct pci_dev *dev) | 116 | static int acpi_processor_errata_piix4(struct pci_dev *dev) |
117 | { | 117 | { |
118 | u8 rev = 0; | ||
119 | u8 value1 = 0; | 118 | u8 value1 = 0; |
120 | u8 value2 = 0; | 119 | u8 value2 = 0; |
121 | 120 | ||
@@ -127,9 +126,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) | |||
127 | * Note that 'dev' references the PIIX4 ACPI Controller. | 126 | * Note that 'dev' references the PIIX4 ACPI Controller. |
128 | */ | 127 | */ |
129 | 128 | ||
130 | pci_read_config_byte(dev, PCI_REVISION_ID, &rev); | 129 | switch (dev->revision) { |
131 | |||
132 | switch (rev) { | ||
133 | case 0: | 130 | case 0: |
134 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); | 131 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); |
135 | break; | 132 | break; |
@@ -147,7 +144,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) | |||
147 | break; | 144 | break; |
148 | } | 145 | } |
149 | 146 | ||
150 | switch (rev) { | 147 | switch (dev->revision) { |
151 | 148 | ||
152 | case 0: /* PIIX4 A-step */ | 149 | case 0: /* PIIX4 A-step */ |
153 | case 1: /* PIIX4 B-step */ | 150 | case 1: /* PIIX4 B-step */ |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index ee5759bef945..bb5d23be4260 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -332,16 +332,18 @@ static void acpi_processor_idle(void) | |||
332 | int sleep_ticks = 0; | 332 | int sleep_ticks = 0; |
333 | u32 t1, t2 = 0; | 333 | u32 t1, t2 = 0; |
334 | 334 | ||
335 | pr = processors[smp_processor_id()]; | ||
336 | if (!pr) | ||
337 | return; | ||
338 | |||
339 | /* | 335 | /* |
340 | * Interrupts must be disabled during bus mastering calculations and | 336 | * Interrupts must be disabled during bus mastering calculations and |
341 | * for C2/C3 transitions. | 337 | * for C2/C3 transitions. |
342 | */ | 338 | */ |
343 | local_irq_disable(); | 339 | local_irq_disable(); |
344 | 340 | ||
341 | pr = processors[smp_processor_id()]; | ||
342 | if (!pr) { | ||
343 | local_irq_enable(); | ||
344 | return; | ||
345 | } | ||
346 | |||
345 | /* | 347 | /* |
346 | * Check whether we truly need to go idle, or should | 348 | * Check whether we truly need to go idle, or should |
347 | * reschedule: | 349 | * reschedule: |
@@ -473,7 +475,7 @@ static void acpi_processor_idle(void) | |||
473 | /* Get end time (ticks) */ | 475 | /* Get end time (ticks) */ |
474 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 476 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
475 | 477 | ||
476 | #ifdef CONFIG_GENERIC_TIME | 478 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) |
477 | /* TSC halts in C2, so notify users */ | 479 | /* TSC halts in C2, so notify users */ |
478 | mark_tsc_unstable("possible TSC halt in C2"); | 480 | mark_tsc_unstable("possible TSC halt in C2"); |
479 | #endif | 481 | #endif |
@@ -515,7 +517,7 @@ static void acpi_processor_idle(void) | |||
515 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | 517 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); |
516 | } | 518 | } |
517 | 519 | ||
518 | #ifdef CONFIG_GENERIC_TIME | 520 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) |
519 | /* TSC halts in C3, so notify users */ | 521 | /* TSC halts in C3, so notify users */ |
520 | mark_tsc_unstable("TSC halts in C3"); | 522 | mark_tsc_unstable("TSC halts in C3"); |
521 | #endif | 523 | #endif |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 8c6d3fdec38a..0dd2ce8a3475 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -567,7 +567,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
567 | (*sub_object_list)->string. | 567 | (*sub_object_list)->string. |
568 | length + 1); | 568 | length + 1); |
569 | } else { | 569 | } else { |
570 | temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); | 570 | temp_size_needed += |
571 | acpi_ns_get_pathname_length((*sub_object_list)->reference.node); | ||
571 | } | 572 | } |
572 | } else { | 573 | } else { |
573 | /* | 574 | /* |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index cc48ab05676c..50da494c3ee2 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -267,16 +267,19 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
267 | * If BIOS erroneously reversed the _PRT source_name and source_index, | 267 | * If BIOS erroneously reversed the _PRT source_name and source_index, |
268 | * then reverse them back. | 268 | * then reverse them back. |
269 | */ | 269 | */ |
270 | if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) { | 270 | if (ACPI_GET_OBJECT_TYPE(sub_object_list[3]) != |
271 | ACPI_TYPE_INTEGER) { | ||
271 | if (acpi_gbl_enable_interpreter_slack) { | 272 | if (acpi_gbl_enable_interpreter_slack) { |
272 | source_name_index = 3; | 273 | source_name_index = 3; |
273 | source_index_index = 2; | 274 | source_index_index = 2; |
274 | printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n"); | 275 | printk(KERN_WARNING |
276 | "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | 277 | } else { |
276 | ACPI_ERROR((AE_INFO, | 278 | ACPI_ERROR((AE_INFO, |
277 | "(PRT[%X].source_index) Need Integer, found %s", | 279 | "(PRT[%X].source_index) Need Integer, found %s", |
278 | index, | 280 | index, |
279 | acpi_ut_get_object_type_name(sub_object_list[3]))); | 281 | acpi_ut_get_object_type_name |
282 | (sub_object_list[3]))); | ||
280 | return_ACPI_STATUS(AE_BAD_DATA); | 283 | return_ACPI_STATUS(AE_BAD_DATA); |
281 | } | 284 | } |
282 | } | 285 | } |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index de20a5d6decf..46da116a4030 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsdump") | 48 | ACPI_MODULE_NAME("rsdump") |
49 | |||
50 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 49 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
51 | /* Local prototypes */ | 50 | /* Local prototypes */ |
52 | static void acpi_rs_out_string(char *title, char *value); | 51 | static void acpi_rs_out_string(char *title, char *value); |
@@ -489,10 +488,9 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) | |||
489 | /* | 488 | /* |
490 | * Optional resource_source for Address resources | 489 | * Optional resource_source for Address resources |
491 | */ | 490 | */ |
492 | acpi_rs_dump_resource_source(ACPI_CAST_PTR | 491 | acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct |
493 | (struct | 492 | acpi_resource_source, |
494 | acpi_resource_source, | 493 | target)); |
495 | target)); | ||
496 | break; | 494 | break; |
497 | 495 | ||
498 | default: | 496 | default: |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 7e3c335ab320..2c2adb6292c1 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -142,7 +142,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { | |||
142 | }; | 142 | }; |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
146 | /* | 146 | /* |
147 | * Base sizes for external AML resource descriptors, indexed by internal type. | 147 | * Base sizes for external AML resource descriptors, indexed by internal type. |
148 | * Includes size of the descriptor header (1 byte for small descriptors, | 148 | * Includes size of the descriptor header (1 byte for small descriptors, |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index a92755c8877d..ca21e4660c79 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -153,10 +153,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
153 | 153 | ||
154 | /* Perform the conversion */ | 154 | /* Perform the conversion */ |
155 | 155 | ||
156 | status = acpi_rs_convert_resource_to_aml(resource, | 156 | status = acpi_rs_convert_resource_to_aml(resource, ACPI_CAST_PTR(union |
157 | ACPI_CAST_PTR(union | 157 | aml_resource, |
158 | aml_resource, | 158 | aml), |
159 | aml), | ||
160 | acpi_gbl_set_resource_dispatch | 159 | acpi_gbl_set_resource_dispatch |
161 | [resource->type]); | 160 | [resource->type]); |
162 | if (ACPI_FAILURE(status)) { | 161 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 3b63b561b94e..c7081afa893a 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | #define _COMPONENT ACPI_RESOURCES | 47 | #define _COMPONENT ACPI_RESOURCES |
48 | ACPI_MODULE_NAME("rsmisc") | 48 | ACPI_MODULE_NAME("rsmisc") |
49 | |||
50 | #define INIT_RESOURCE_TYPE(i) i->resource_offset | 49 | #define INIT_RESOURCE_TYPE(i) i->resource_offset |
51 | #define INIT_RESOURCE_LENGTH(i) i->aml_offset | 50 | #define INIT_RESOURCE_LENGTH(i) i->aml_offset |
52 | #define INIT_TABLE_LENGTH(i) i->value | 51 | #define INIT_TABLE_LENGTH(i) i->value |
@@ -429,8 +428,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
429 | * Optional resource_source (Index and String) | 428 | * Optional resource_source (Index and String) |
430 | */ | 429 | */ |
431 | aml_length = | 430 | aml_length = |
432 | acpi_rs_set_resource_source(aml, | 431 | acpi_rs_set_resource_source(aml, (acpi_rs_length) |
433 | (acpi_rs_length) | ||
434 | aml_length, source); | 432 | aml_length, source); |
435 | acpi_rs_set_resource_length(aml_length, aml); | 433 | acpi_rs_set_resource_length(aml_length, aml); |
436 | break; | 434 | break; |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 2442a8f8df57..11c0bd7b9cfd 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -353,10 +353,8 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
353 | * | 353 | * |
354 | * Zero the entire area of the buffer. | 354 | * Zero the entire area of the buffer. |
355 | */ | 355 | */ |
356 | total_length = | 356 | total_length = (u32) |
357 | (u32) | 357 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1; |
358 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + | ||
359 | 1; | ||
360 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | 358 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); |
361 | 359 | ||
362 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | 360 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 991f8901498c..f63813a358c5 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -217,7 +217,6 @@ acpi_get_current_resources(acpi_handle device_handle, | |||
217 | } | 217 | } |
218 | 218 | ||
219 | ACPI_EXPORT_SYMBOL(acpi_get_current_resources) | 219 | ACPI_EXPORT_SYMBOL(acpi_get_current_resources) |
220 | |||
221 | #ifdef ACPI_FUTURE_USAGE | 220 | #ifdef ACPI_FUTURE_USAGE |
222 | /******************************************************************************* | 221 | /******************************************************************************* |
223 | * | 222 | * |
@@ -261,7 +260,6 @@ acpi_get_possible_resources(acpi_handle device_handle, | |||
261 | 260 | ||
262 | ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) | 261 | ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) |
263 | #endif /* ACPI_FUTURE_USAGE */ | 262 | #endif /* ACPI_FUTURE_USAGE */ |
264 | |||
265 | /******************************************************************************* | 263 | /******************************************************************************* |
266 | * | 264 | * |
267 | * FUNCTION: acpi_set_current_resources | 265 | * FUNCTION: acpi_set_current_resources |
@@ -496,7 +494,6 @@ ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) | |||
496 | * each resource in the list. | 494 | * each resource in the list. |
497 | * | 495 | * |
498 | ******************************************************************************/ | 496 | ******************************************************************************/ |
499 | |||
500 | acpi_status | 497 | acpi_status |
501 | acpi_walk_resources(acpi_handle device_handle, | 498 | acpi_walk_resources(acpi_handle device_handle, |
502 | char *name, | 499 | char *name, |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index c1bae106833c..974d00ccfe84 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -127,7 +127,7 @@ static int acpi_sbs_resume(struct acpi_device *device); | |||
127 | static struct acpi_driver acpi_sbs_driver = { | 127 | static struct acpi_driver acpi_sbs_driver = { |
128 | .name = "sbs", | 128 | .name = "sbs", |
129 | .class = ACPI_SBS_CLASS, | 129 | .class = ACPI_SBS_CLASS, |
130 | .ids = ACPI_SBS_HID, | 130 | .ids = "ACPI0001,ACPI0005", |
131 | .ops = { | 131 | .ops = { |
132 | .add = acpi_sbs_add, | 132 | .add = acpi_sbs_add, |
133 | .remove = acpi_sbs_remove, | 133 | .remove = acpi_sbs_remove, |
@@ -176,10 +176,8 @@ struct acpi_battery { | |||
176 | }; | 176 | }; |
177 | 177 | ||
178 | struct acpi_sbs { | 178 | struct acpi_sbs { |
179 | acpi_handle handle; | ||
180 | int base; | 179 | int base; |
181 | struct acpi_device *device; | 180 | struct acpi_device *device; |
182 | struct acpi_ec_smbus *smbus; | ||
183 | struct mutex mutex; | 181 | struct mutex mutex; |
184 | int sbsm_present; | 182 | int sbsm_present; |
185 | int sbsm_batteries_supported; | 183 | int sbsm_batteries_supported; |
@@ -511,7 +509,7 @@ static int acpi_sbsm_get_info(struct acpi_sbs *sbs) | |||
511 | "acpi_sbs_read_word() failed")); | 509 | "acpi_sbs_read_word() failed")); |
512 | goto end; | 510 | goto end; |
513 | } | 511 | } |
514 | 512 | sbs->sbsm_present = 1; | |
515 | sbs->sbsm_batteries_supported = battery_system_info & 0x000f; | 513 | sbs->sbsm_batteries_supported = battery_system_info & 0x000f; |
516 | 514 | ||
517 | end: | 515 | end: |
@@ -1630,13 +1628,12 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1630 | { | 1628 | { |
1631 | struct acpi_sbs *sbs = NULL; | 1629 | struct acpi_sbs *sbs = NULL; |
1632 | int result = 0, remove_result = 0; | 1630 | int result = 0, remove_result = 0; |
1633 | unsigned long sbs_obj; | ||
1634 | int id; | 1631 | int id; |
1635 | acpi_status status = AE_OK; | 1632 | acpi_status status = AE_OK; |
1636 | unsigned long val; | 1633 | unsigned long val; |
1637 | 1634 | ||
1638 | status = | 1635 | status = |
1639 | acpi_evaluate_integer(device->parent->handle, "_EC", NULL, &val); | 1636 | acpi_evaluate_integer(device->handle, "_EC", NULL, &val); |
1640 | if (ACPI_FAILURE(status)) { | 1637 | if (ACPI_FAILURE(status)) { |
1641 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC")); | 1638 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC")); |
1642 | return -EIO; | 1639 | return -EIO; |
@@ -1653,7 +1650,7 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1653 | 1650 | ||
1654 | sbs_mutex_lock(sbs); | 1651 | sbs_mutex_lock(sbs); |
1655 | 1652 | ||
1656 | sbs->base = (val & 0xff00ull) >> 8; | 1653 | sbs->base = 0xff & (val >> 8); |
1657 | sbs->device = device; | 1654 | sbs->device = device; |
1658 | 1655 | ||
1659 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); | 1656 | strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); |
@@ -1665,24 +1662,10 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1665 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed")); | 1662 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed")); |
1666 | goto end; | 1663 | goto end; |
1667 | } | 1664 | } |
1668 | status = acpi_evaluate_integer(device->handle, "_SBS", NULL, &sbs_obj); | ||
1669 | if (status) { | ||
1670 | ACPI_EXCEPTION((AE_INFO, status, | ||
1671 | "acpi_evaluate_integer() failed")); | ||
1672 | result = -EIO; | ||
1673 | goto end; | ||
1674 | } | ||
1675 | if (sbs_obj > 0) { | ||
1676 | result = acpi_sbsm_get_info(sbs); | ||
1677 | if (result) { | ||
1678 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | ||
1679 | "acpi_sbsm_get_info() failed")); | ||
1680 | goto end; | ||
1681 | } | ||
1682 | sbs->sbsm_present = 1; | ||
1683 | } | ||
1684 | 1665 | ||
1685 | if (sbs->sbsm_present == 0) { | 1666 | acpi_sbsm_get_info(sbs); |
1667 | |||
1668 | if (!sbs->sbsm_present) { | ||
1686 | result = acpi_battery_add(sbs, 0); | 1669 | result = acpi_battery_add(sbs, 0); |
1687 | if (result) { | 1670 | if (result) { |
1688 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, | 1671 | ACPI_EXCEPTION((AE_INFO, AE_ERROR, |
@@ -1702,8 +1685,6 @@ static int acpi_sbs_add(struct acpi_device *device) | |||
1702 | } | 1685 | } |
1703 | } | 1686 | } |
1704 | 1687 | ||
1705 | sbs->handle = device->handle; | ||
1706 | |||
1707 | init_timer(&sbs->update_timer); | 1688 | init_timer(&sbs->update_timer); |
1708 | result = acpi_check_update_proc(sbs); | 1689 | result = acpi_check_update_proc(sbs); |
1709 | if (result) | 1690 | if (result) |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 52b23471dd69..42127c0d612c 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -217,12 +217,28 @@ static void acpi_hibernation_finish(void) | |||
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | static int acpi_hibernation_pre_restore(void) | ||
221 | { | ||
222 | acpi_status status; | ||
223 | |||
224 | status = acpi_hw_disable_all_gpes(); | ||
225 | |||
226 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | ||
227 | } | ||
228 | |||
229 | static void acpi_hibernation_restore_cleanup(void) | ||
230 | { | ||
231 | acpi_hw_enable_all_runtime_gpes(); | ||
232 | } | ||
233 | |||
220 | static struct hibernation_ops acpi_hibernation_ops = { | 234 | static struct hibernation_ops acpi_hibernation_ops = { |
221 | .prepare = acpi_hibernation_prepare, | 235 | .prepare = acpi_hibernation_prepare, |
222 | .enter = acpi_hibernation_enter, | 236 | .enter = acpi_hibernation_enter, |
223 | .finish = acpi_hibernation_finish, | 237 | .finish = acpi_hibernation_finish, |
238 | .pre_restore = acpi_hibernation_pre_restore, | ||
239 | .restore_cleanup = acpi_hibernation_restore_cleanup, | ||
224 | }; | 240 | }; |
225 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | 241 | #endif /* CONFIG_SOFTWARE_SUSPEND */ |
226 | 242 | ||
227 | /* | 243 | /* |
228 | * Toshiba fails to preserve interrupts over S1, reinitialization | 244 | * Toshiba fails to preserve interrupts over S1, reinitialization |
@@ -276,4 +292,3 @@ int __init acpi_sleep_init(void) | |||
276 | 292 | ||
277 | return 0; | 293 | return 0; |
278 | } | 294 | } |
279 | |||
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index d9801eff6489..39e40d56b034 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -39,7 +39,13 @@ int acpi_sleep_prepare(u32 acpi_state) | |||
39 | 39 | ||
40 | #ifdef CONFIG_PM | 40 | #ifdef CONFIG_PM |
41 | 41 | ||
42 | void acpi_power_off(void) | 42 | static void acpi_power_off_prepare(void) |
43 | { | ||
44 | /* Prepare to power off the system */ | ||
45 | acpi_sleep_prepare(ACPI_STATE_S5); | ||
46 | } | ||
47 | |||
48 | static void acpi_power_off(void) | ||
43 | { | 49 | { |
44 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 50 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
45 | printk("%s called\n", __FUNCTION__); | 51 | printk("%s called\n", __FUNCTION__); |
@@ -48,30 +54,6 @@ void acpi_power_off(void) | |||
48 | acpi_enter_sleep_state(ACPI_STATE_S5); | 54 | acpi_enter_sleep_state(ACPI_STATE_S5); |
49 | } | 55 | } |
50 | 56 | ||
51 | static int acpi_shutdown(struct sys_device *x) | ||
52 | { | ||
53 | switch (system_state) { | ||
54 | case SYSTEM_POWER_OFF: | ||
55 | /* Prepare to power off the system */ | ||
56 | return acpi_sleep_prepare(ACPI_STATE_S5); | ||
57 | case SYSTEM_SUSPEND_DISK: | ||
58 | /* Prepare to suspend the system to disk */ | ||
59 | return acpi_sleep_prepare(ACPI_STATE_S4); | ||
60 | default: | ||
61 | return 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static struct sysdev_class acpi_sysclass = { | ||
66 | set_kset_name("acpi"), | ||
67 | .shutdown = acpi_shutdown | ||
68 | }; | ||
69 | |||
70 | static struct sys_device device_acpi = { | ||
71 | .id = 0, | ||
72 | .cls = &acpi_sysclass, | ||
73 | }; | ||
74 | |||
75 | static int acpi_poweroff_init(void) | 57 | static int acpi_poweroff_init(void) |
76 | { | 58 | { |
77 | if (!acpi_disabled) { | 59 | if (!acpi_disabled) { |
@@ -81,13 +63,8 @@ static int acpi_poweroff_init(void) | |||
81 | status = | 63 | status = |
82 | acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); | 64 | acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); |
83 | if (ACPI_SUCCESS(status)) { | 65 | if (ACPI_SUCCESS(status)) { |
84 | int error; | 66 | pm_power_off_prepare = acpi_power_off_prepare; |
85 | error = sysdev_class_register(&acpi_sysclass); | 67 | pm_power_off = acpi_power_off; |
86 | if (!error) | ||
87 | error = sysdev_register(&device_acpi); | ||
88 | if (!error) | ||
89 | pm_power_off = acpi_power_off; | ||
90 | return error; | ||
91 | } | 68 | } |
92 | } | 69 | } |
93 | return 0; | 70 | return 0; |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 76b45f0b8341..61f1822cc350 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -349,8 +349,7 @@ acpi_system_write_alarm(struct file *file, | |||
349 | end: | 349 | end: |
350 | return_VALUE(result ? result : count); | 350 | return_VALUE(result ? result : count); |
351 | } | 351 | } |
352 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 352 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
353 | |||
354 | 353 | ||
355 | extern struct list_head acpi_wakeup_device_list; | 354 | extern struct list_head acpi_wakeup_device_list; |
356 | extern spinlock_t acpi_device_lock; | 355 | extern spinlock_t acpi_device_lock; |
@@ -380,8 +379,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
380 | dev->wakeup.state.enabled ? "enabled" : "disabled"); | 379 | dev->wakeup.state.enabled ? "enabled" : "disabled"); |
381 | if (ldev) | 380 | if (ldev) |
382 | seq_printf(seq, "%s:%s", | 381 | seq_printf(seq, "%s:%s", |
383 | ldev->bus ? ldev->bus->name : "no-bus", | 382 | ldev->bus ? ldev->bus->name : "no-bus", |
384 | ldev->bus_id); | 383 | ldev->bus_id); |
385 | seq_printf(seq, "\n"); | 384 | seq_printf(seq, "\n"); |
386 | put_device(ldev); | 385 | put_device(ldev); |
387 | 386 | ||
@@ -490,7 +489,7 @@ static u32 rtc_handler(void *context) | |||
490 | 489 | ||
491 | return ACPI_INTERRUPT_HANDLED; | 490 | return ACPI_INTERRUPT_HANDLED; |
492 | } | 491 | } |
493 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 492 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
494 | 493 | ||
495 | static int __init acpi_sleep_proc_init(void) | 494 | static int __init acpi_sleep_proc_init(void) |
496 | { | 495 | { |
@@ -517,7 +516,7 @@ static int __init acpi_sleep_proc_init(void) | |||
517 | entry->proc_fops = &acpi_system_alarm_fops; | 516 | entry->proc_fops = &acpi_system_alarm_fops; |
518 | 517 | ||
519 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); | 518 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); |
520 | #endif /* HAVE_ACPI_LEGACY_ALARM */ | 519 | #endif /* HAVE_ACPI_LEGACY_ALARM */ |
521 | 520 | ||
522 | /* 'wakeup device' [R/W] */ | 521 | /* 'wakeup device' [R/W] */ |
523 | entry = | 522 | entry = |
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c index 1db833eb2417..002bb33003af 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/tables/tbfadt.c | |||
@@ -211,14 +211,17 @@ void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) | |||
211 | * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. | 211 | * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. |
212 | * Performs validation on some important FADT fields. | 212 | * Performs validation on some important FADT fields. |
213 | * | 213 | * |
214 | * NOTE: We create a local copy of the FADT regardless of the version. | ||
215 | * | ||
214 | ******************************************************************************/ | 216 | ******************************************************************************/ |
215 | 217 | ||
216 | void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | 218 | void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) |
217 | { | 219 | { |
218 | 220 | ||
219 | /* | 221 | /* |
220 | * Check if the FADT is larger than what we know about (ACPI 2.0 version). | 222 | * Check if the FADT is larger than the largest table that we expect |
221 | * Truncate the table, but make some noise. | 223 | * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue |
224 | * a warning. | ||
222 | */ | 225 | */ |
223 | if (length > sizeof(struct acpi_table_fadt)) { | 226 | if (length > sizeof(struct acpi_table_fadt)) { |
224 | ACPI_WARNING((AE_INFO, | 227 | ACPI_WARNING((AE_INFO, |
@@ -227,10 +230,12 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
227 | sizeof(struct acpi_table_fadt))); | 230 | sizeof(struct acpi_table_fadt))); |
228 | } | 231 | } |
229 | 232 | ||
230 | /* Copy the entire FADT locally. Zero first for tb_convert_fadt */ | 233 | /* Clear the entire local FADT */ |
231 | 234 | ||
232 | ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); | 235 | ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); |
233 | 236 | ||
237 | /* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */ | ||
238 | |||
234 | ACPI_MEMCPY(&acpi_gbl_FADT, table, | 239 | ACPI_MEMCPY(&acpi_gbl_FADT, table, |
235 | ACPI_MIN(length, sizeof(struct acpi_table_fadt))); | 240 | ACPI_MIN(length, sizeof(struct acpi_table_fadt))); |
236 | 241 | ||
@@ -251,7 +256,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) | |||
251 | * RETURN: None | 256 | * RETURN: None |
252 | * | 257 | * |
253 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. | 258 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. |
254 | * -> Expand all 32-bit addresses to 64-bit. | 259 | * Expand all 32-bit addresses to 64-bit. |
255 | * | 260 | * |
256 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), | 261 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), |
257 | * and must contain a copy of the actual FADT. | 262 | * and must contain a copy of the actual FADT. |
@@ -292,8 +297,23 @@ static void acpi_tb_convert_fadt(void) | |||
292 | } | 297 | } |
293 | 298 | ||
294 | /* | 299 | /* |
295 | * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address | 300 | * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which |
296 | * structures as necessary. | 301 | * should be zero are indeed zero. This will workaround BIOSs that |
302 | * inadvertently place values in these fields. | ||
303 | * | ||
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. | ||
306 | */ | ||
307 | if (acpi_gbl_FADT.header.revision < 3) { | ||
308 | acpi_gbl_FADT.preferred_profile = 0; | ||
309 | acpi_gbl_FADT.pstate_control = 0; | ||
310 | acpi_gbl_FADT.cst_control = 0; | ||
311 | acpi_gbl_FADT.boot_flags = 0; | ||
312 | } | ||
313 | |||
314 | /* | ||
315 | * Expand the ACPI 1.0 32-bit V1.0 addresses to the ACPI 2.0 64-bit "X" | ||
316 | * generic address structures as necessary. | ||
297 | */ | 317 | */ |
298 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { | 318 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
299 | target = | 319 | target = |
@@ -334,7 +354,8 @@ static void acpi_tb_convert_fadt(void) | |||
334 | (acpi_gbl_FADT.xpm1a_event_block.address + | 354 | (acpi_gbl_FADT.xpm1a_event_block.address + |
335 | pm1_register_length)); | 355 | pm1_register_length)); |
336 | /* Don't forget to copy space_id of the GAS */ | 356 | /* Don't forget to copy space_id of the GAS */ |
337 | acpi_gbl_xpm1a_enable.space_id = acpi_gbl_FADT.xpm1a_event_block.space_id; | 357 | acpi_gbl_xpm1a_enable.space_id = |
358 | acpi_gbl_FADT.xpm1a_event_block.space_id; | ||
338 | 359 | ||
339 | /* The PM1B register block is optional, ignore if not present */ | 360 | /* The PM1B register block is optional, ignore if not present */ |
340 | 361 | ||
@@ -344,20 +365,9 @@ static void acpi_tb_convert_fadt(void) | |||
344 | (acpi_gbl_FADT.xpm1b_event_block. | 365 | (acpi_gbl_FADT.xpm1b_event_block. |
345 | address + pm1_register_length)); | 366 | address + pm1_register_length)); |
346 | /* Don't forget to copy space_id of the GAS */ | 367 | /* Don't forget to copy space_id of the GAS */ |
347 | acpi_gbl_xpm1b_enable.space_id = acpi_gbl_FADT.xpm1a_event_block.space_id; | 368 | acpi_gbl_xpm1b_enable.space_id = |
348 | 369 | acpi_gbl_FADT.xpm1a_event_block.space_id; | |
349 | } | ||
350 | 370 | ||
351 | /* | ||
352 | * For ACPI 1.0 FADTs, ensure that reserved fields (which should be zero) | ||
353 | * are indeed zero. This will workaround BIOSs that inadvertently placed | ||
354 | * values in these fields. | ||
355 | */ | ||
356 | if (acpi_gbl_FADT.header.revision < 3) { | ||
357 | acpi_gbl_FADT.preferred_profile = 0; | ||
358 | acpi_gbl_FADT.pstate_control = 0; | ||
359 | acpi_gbl_FADT.cst_control = 0; | ||
360 | acpi_gbl_FADT.boot_flags = 0; | ||
361 | } | 371 | } |
362 | } | 372 | } |
363 | 373 | ||
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 0e7b121a99ce..3bc0c67a9283 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -123,14 +123,14 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, | |||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | /* The table must be either an SSDT or a PSDT */ | 126 | /* The table must be either an SSDT or a PSDT or an OEMx */ |
127 | 127 | ||
128 | if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) | 128 | if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) |
129 | && | 129 | && |
130 | (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))) | 130 | (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)) |
131 | { | 131 | && (strncmp(table_desc->pointer->signature, "OEM", 3))) { |
132 | ACPI_ERROR((AE_INFO, | 132 | ACPI_ERROR((AE_INFO, |
133 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 133 | "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", |
134 | table_desc->pointer->signature)); | 134 | table_desc->pointer->signature)); |
135 | return_ACPI_STATUS(AE_BAD_SIGNATURE); | 135 | return_ACPI_STATUS(AE_BAD_SIGNATURE); |
136 | } | 136 | } |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 417ef5fa7666..5b302c4e293f 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -201,6 +201,7 @@ acpi_status acpi_reallocate_root_table(void) | |||
201 | 201 | ||
202 | return_ACPI_STATUS(AE_OK); | 202 | return_ACPI_STATUS(AE_OK); |
203 | } | 203 | } |
204 | |||
204 | /******************************************************************************* | 205 | /******************************************************************************* |
205 | * | 206 | * |
206 | * FUNCTION: acpi_load_table | 207 | * FUNCTION: acpi_load_table |
@@ -262,7 +263,7 @@ ACPI_EXPORT_SYMBOL(acpi_load_table) | |||
262 | acpi_status | 263 | acpi_status |
263 | acpi_get_table_header(char *signature, | 264 | acpi_get_table_header(char *signature, |
264 | acpi_native_uint instance, | 265 | acpi_native_uint instance, |
265 | struct acpi_table_header *out_table_header) | 266 | struct acpi_table_header * out_table_header) |
266 | { | 267 | { |
267 | acpi_native_uint i; | 268 | acpi_native_uint i; |
268 | acpi_native_uint j; | 269 | acpi_native_uint j; |
@@ -321,7 +322,6 @@ acpi_get_table_header(char *signature, | |||
321 | 322 | ||
322 | ACPI_EXPORT_SYMBOL(acpi_get_table_header) | 323 | ACPI_EXPORT_SYMBOL(acpi_get_table_header) |
323 | 324 | ||
324 | |||
325 | /****************************************************************************** | 325 | /****************************************************************************** |
326 | * | 326 | * |
327 | * FUNCTION: acpi_unload_table_id | 327 | * FUNCTION: acpi_unload_table_id |
@@ -346,11 +346,11 @@ acpi_status acpi_unload_table_id(acpi_owner_id id) | |||
346 | continue; | 346 | continue; |
347 | } | 347 | } |
348 | /* | 348 | /* |
349 | * Delete all namespace objects owned by this table. Note that these | 349 | * Delete all namespace objects owned by this table. Note that these |
350 | * objects can appear anywhere in the namespace by virtue of the AML | 350 | * objects can appear anywhere in the namespace by virtue of the AML |
351 | * "Scope" operator. Thus, we need to track ownership by an ID, not | 351 | * "Scope" operator. Thus, we need to track ownership by an ID, not |
352 | * simply a position within the hierarchy | 352 | * simply a position within the hierarchy |
353 | */ | 353 | */ |
354 | acpi_tb_delete_namespace_by_owner(i); | 354 | acpi_tb_delete_namespace_by_owner(i); |
355 | status = acpi_tb_release_owner_id(i); | 355 | status = acpi_tb_release_owner_id(i); |
356 | acpi_tb_set_table_loaded_flag(i, FALSE); | 356 | acpi_tb_set_table_loaded_flag(i, FALSE); |
@@ -376,7 +376,7 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id) | |||
376 | *****************************************************************************/ | 376 | *****************************************************************************/ |
377 | acpi_status | 377 | acpi_status |
378 | acpi_get_table(char *signature, | 378 | acpi_get_table(char *signature, |
379 | acpi_native_uint instance, struct acpi_table_header ** out_table) | 379 | acpi_native_uint instance, struct acpi_table_header **out_table) |
380 | { | 380 | { |
381 | acpi_native_uint i; | 381 | acpi_native_uint i; |
382 | acpi_native_uint j; | 382 | acpi_native_uint j; |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 589b98b7b216..58f1338981bc 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/jiffies.h> | 40 | #include <linux/jiffies.h> |
41 | #include <linux/kmod.h> | 41 | #include <linux/kmod.h> |
42 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
43 | #include <linux/reboot.h> | ||
43 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
44 | 45 | ||
45 | #include <acpi/acpi_bus.h> | 46 | #include <acpi/acpi_bus.h> |
@@ -59,9 +60,6 @@ | |||
59 | #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0 | 60 | #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0 |
60 | #define ACPI_THERMAL_NOTIFY_HOT 0xF1 | 61 | #define ACPI_THERMAL_NOTIFY_HOT 0xF1 |
61 | #define ACPI_THERMAL_MODE_ACTIVE 0x00 | 62 | #define ACPI_THERMAL_MODE_ACTIVE 0x00 |
62 | #define ACPI_THERMAL_MODE_PASSIVE 0x01 | ||
63 | #define ACPI_THERMAL_MODE_CRITICAL 0xff | ||
64 | #define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff" | ||
65 | 63 | ||
66 | #define ACPI_THERMAL_MAX_ACTIVE 10 | 64 | #define ACPI_THERMAL_MAX_ACTIVE 10 |
67 | #define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 | 65 | #define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 |
@@ -86,9 +84,6 @@ static int acpi_thermal_resume(struct acpi_device *device); | |||
86 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 84 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
87 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 85 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
88 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 86 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
89 | static ssize_t acpi_thermal_write_trip_points(struct file *, | ||
90 | const char __user *, size_t, | ||
91 | loff_t *); | ||
92 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); | 87 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); |
93 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, | 88 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, |
94 | const char __user *, size_t, | 89 | const char __user *, size_t, |
@@ -167,7 +162,6 @@ struct acpi_thermal { | |||
167 | unsigned long temperature; | 162 | unsigned long temperature; |
168 | unsigned long last_temperature; | 163 | unsigned long last_temperature; |
169 | unsigned long polling_frequency; | 164 | unsigned long polling_frequency; |
170 | u8 cooling_mode; | ||
171 | volatile u8 zombie; | 165 | volatile u8 zombie; |
172 | struct acpi_thermal_flags flags; | 166 | struct acpi_thermal_flags flags; |
173 | struct acpi_thermal_state state; | 167 | struct acpi_thermal_state state; |
@@ -193,7 +187,6 @@ static const struct file_operations acpi_thermal_temp_fops = { | |||
193 | static const struct file_operations acpi_thermal_trip_fops = { | 187 | static const struct file_operations acpi_thermal_trip_fops = { |
194 | .open = acpi_thermal_trip_open_fs, | 188 | .open = acpi_thermal_trip_open_fs, |
195 | .read = seq_read, | 189 | .read = seq_read, |
196 | .write = acpi_thermal_write_trip_points, | ||
197 | .llseek = seq_lseek, | 190 | .llseek = seq_lseek, |
198 | .release = single_release, | 191 | .release = single_release, |
199 | }; | 192 | }; |
@@ -297,11 +290,6 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) | |||
297 | if (ACPI_FAILURE(status)) | 290 | if (ACPI_FAILURE(status)) |
298 | return -ENODEV; | 291 | return -ENODEV; |
299 | 292 | ||
300 | tz->cooling_mode = mode; | ||
301 | |||
302 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", | ||
303 | mode ? "passive" : "active")); | ||
304 | |||
305 | return 0; | 293 | return 0; |
306 | } | 294 | } |
307 | 295 | ||
@@ -431,26 +419,6 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz) | |||
431 | return 0; | 419 | return 0; |
432 | } | 420 | } |
433 | 421 | ||
434 | static int acpi_thermal_call_usermode(char *path) | ||
435 | { | ||
436 | char *argv[2] = { NULL, NULL }; | ||
437 | char *envp[3] = { NULL, NULL, NULL }; | ||
438 | |||
439 | |||
440 | if (!path) | ||
441 | return -EINVAL; | ||
442 | |||
443 | argv[0] = path; | ||
444 | |||
445 | /* minimal command environment */ | ||
446 | envp[0] = "HOME=/"; | ||
447 | envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; | ||
448 | |||
449 | call_usermodehelper(argv[0], argv, envp, 0); | ||
450 | |||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int acpi_thermal_critical(struct acpi_thermal *tz) | 422 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
455 | { | 423 | { |
456 | if (!tz || !tz->trips.critical.flags.valid) | 424 | if (!tz || !tz->trips.critical.flags.valid) |
@@ -468,7 +436,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) | |||
468 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, | 436 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
469 | tz->trips.critical.flags.enabled); | 437 | tz->trips.critical.flags.enabled); |
470 | 438 | ||
471 | acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); | 439 | orderly_poweroff(true); |
472 | 440 | ||
473 | return 0; | 441 | return 0; |
474 | } | 442 | } |
@@ -839,6 +807,9 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) | |||
839 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | 807 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) |
840 | { | 808 | { |
841 | struct acpi_thermal *tz = seq->private; | 809 | struct acpi_thermal *tz = seq->private; |
810 | struct acpi_device *device; | ||
811 | acpi_status status; | ||
812 | |||
842 | int i = 0; | 813 | int i = 0; |
843 | int j = 0; | 814 | int j = 0; |
844 | 815 | ||
@@ -861,9 +832,10 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
861 | tz->trips.passive.tc1, tz->trips.passive.tc2, | 832 | tz->trips.passive.tc1, tz->trips.passive.tc2, |
862 | tz->trips.passive.tsp); | 833 | tz->trips.passive.tsp); |
863 | for (j = 0; j < tz->trips.passive.devices.count; j++) { | 834 | for (j = 0; j < tz->trips.passive.devices.count; j++) { |
864 | 835 | status = acpi_bus_get_device(tz->trips.passive.devices. | |
865 | seq_printf(seq, "0x%p ", | 836 | handles[j], &device); |
866 | tz->trips.passive.devices.handles[j]); | 837 | seq_printf(seq, "%4.4s ", status ? "" : |
838 | acpi_device_bid(device)); | ||
867 | } | 839 | } |
868 | seq_puts(seq, "\n"); | 840 | seq_puts(seq, "\n"); |
869 | } | 841 | } |
@@ -874,9 +846,13 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | |||
874 | seq_printf(seq, "active[%d]: %ld C: devices=", | 846 | seq_printf(seq, "active[%d]: %ld C: devices=", |
875 | i, | 847 | i, |
876 | KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); | 848 | KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); |
877 | for (j = 0; j < tz->trips.active[i].devices.count; j++) | 849 | for (j = 0; j < tz->trips.active[i].devices.count; j++){ |
878 | seq_printf(seq, "0x%p ", | 850 | status = acpi_bus_get_device(tz->trips.active[i]. |
879 | tz->trips.active[i].devices.handles[j]); | 851 | devices.handles[j], |
852 | &device); | ||
853 | seq_printf(seq, "%4.4s ", status ? "" : | ||
854 | acpi_device_bid(device)); | ||
855 | } | ||
880 | seq_puts(seq, "\n"); | 856 | seq_puts(seq, "\n"); |
881 | } | 857 | } |
882 | 858 | ||
@@ -889,67 +865,6 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) | |||
889 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); | 865 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); |
890 | } | 866 | } |
891 | 867 | ||
892 | static ssize_t | ||
893 | acpi_thermal_write_trip_points(struct file *file, | ||
894 | const char __user * buffer, | ||
895 | size_t count, loff_t * ppos) | ||
896 | { | ||
897 | struct seq_file *m = file->private_data; | ||
898 | struct acpi_thermal *tz = m->private; | ||
899 | |||
900 | char *limit_string; | ||
901 | int num, critical, hot, passive; | ||
902 | int *active; | ||
903 | int i = 0; | ||
904 | |||
905 | |||
906 | limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); | ||
907 | if (!limit_string) | ||
908 | return -ENOMEM; | ||
909 | |||
910 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | ||
911 | if (!active) { | ||
912 | kfree(limit_string); | ||
913 | return -ENOMEM; | ||
914 | } | ||
915 | |||
916 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | ||
917 | count = -EINVAL; | ||
918 | goto end; | ||
919 | } | ||
920 | |||
921 | if (copy_from_user(limit_string, buffer, count)) { | ||
922 | count = -EFAULT; | ||
923 | goto end; | ||
924 | } | ||
925 | |||
926 | limit_string[count] = '\0'; | ||
927 | |||
928 | num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", | ||
929 | &critical, &hot, &passive, | ||
930 | &active[0], &active[1], &active[2], &active[3], &active[4], | ||
931 | &active[5], &active[6], &active[7], &active[8], | ||
932 | &active[9]); | ||
933 | if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { | ||
934 | count = -EINVAL; | ||
935 | goto end; | ||
936 | } | ||
937 | |||
938 | tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical); | ||
939 | tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot); | ||
940 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive); | ||
941 | for (i = 0; i < num - 3; i++) { | ||
942 | if (!(tz->trips.active[i].flags.valid)) | ||
943 | break; | ||
944 | tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]); | ||
945 | } | ||
946 | |||
947 | end: | ||
948 | kfree(active); | ||
949 | kfree(limit_string); | ||
950 | return count; | ||
951 | } | ||
952 | |||
953 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | 868 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) |
954 | { | 869 | { |
955 | struct acpi_thermal *tz = seq->private; | 870 | struct acpi_thermal *tz = seq->private; |
@@ -958,15 +873,10 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | |||
958 | if (!tz) | 873 | if (!tz) |
959 | goto end; | 874 | goto end; |
960 | 875 | ||
961 | if (!tz->flags.cooling_mode) { | 876 | if (!tz->flags.cooling_mode) |
962 | seq_puts(seq, "<setting not supported>\n"); | 877 | seq_puts(seq, "<setting not supported>\n"); |
963 | } | ||
964 | |||
965 | if (tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL) | ||
966 | seq_printf(seq, "cooling mode: critical\n"); | ||
967 | else | 878 | else |
968 | seq_printf(seq, "cooling mode: %s\n", | 879 | seq_puts(seq, "0 - Active; 1 - Passive\n"); |
969 | tz->cooling_mode ? "passive" : "active"); | ||
970 | 880 | ||
971 | end: | 881 | end: |
972 | return 0; | 882 | return 0; |
@@ -1223,28 +1133,6 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) | |||
1223 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); | 1133 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); |
1224 | if (!result) | 1134 | if (!result) |
1225 | tz->flags.cooling_mode = 1; | 1135 | tz->flags.cooling_mode = 1; |
1226 | else { | ||
1227 | /* Oh,we have not _SCP method. | ||
1228 | Generally show cooling_mode by _ACx, _PSV,spec 12.2 */ | ||
1229 | tz->flags.cooling_mode = 0; | ||
1230 | if (tz->trips.active[0].flags.valid | ||
1231 | && tz->trips.passive.flags.valid) { | ||
1232 | if (tz->trips.passive.temperature > | ||
1233 | tz->trips.active[0].temperature) | ||
1234 | tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; | ||
1235 | else | ||
1236 | tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; | ||
1237 | } else if (!tz->trips.active[0].flags.valid | ||
1238 | && tz->trips.passive.flags.valid) { | ||
1239 | tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; | ||
1240 | } else if (tz->trips.active[0].flags.valid | ||
1241 | && !tz->trips.passive.flags.valid) { | ||
1242 | tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; | ||
1243 | } else { | ||
1244 | /* _ACx and _PSV are optional, but _CRT is required */ | ||
1245 | tz->cooling_mode = ACPI_THERMAL_MODE_CRITICAL; | ||
1246 | } | ||
1247 | } | ||
1248 | 1136 | ||
1249 | /* Get default polling frequency [_TZP] (optional) */ | 1137 | /* Get default polling frequency [_TZP] (optional) */ |
1250 | if (tzp) | 1138 | if (tzp) |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 3906d47b9783..13369b45563f 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -524,7 +524,7 @@ static acpi_status __init add_device(void) | |||
524 | return AE_OK; | 524 | return AE_OK; |
525 | } | 525 | } |
526 | 526 | ||
527 | static acpi_status __exit remove_device(void) | 527 | static acpi_status remove_device(void) |
528 | { | 528 | { |
529 | ProcItem *item; | 529 | ProcItem *item; |
530 | 530 | ||
@@ -538,7 +538,7 @@ static struct backlight_ops toshiba_backlight_data = { | |||
538 | .update_status = set_lcd_status, | 538 | .update_status = set_lcd_status, |
539 | }; | 539 | }; |
540 | 540 | ||
541 | static void __exit toshiba_acpi_exit(void) | 541 | static void toshiba_acpi_exit(void) |
542 | { | 542 | { |
543 | if (toshiba_backlight_device) | 543 | if (toshiba_backlight_device) |
544 | backlight_device_unregister(toshiba_backlight_device); | 544 | backlight_device_unregister(toshiba_backlight_device); |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 55a764807499..6e56d5f7c43a 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -107,7 +107,6 @@ acpi_status acpi_ut_create_caches(void) | |||
107 | if (ACPI_FAILURE(status)) { | 107 | if (ACPI_FAILURE(status)) { |
108 | return (status); | 108 | return (status); |
109 | } | 109 | } |
110 | |||
111 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 110 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
112 | 111 | ||
113 | /* Memory allocation lists */ | 112 | /* Memory allocation lists */ |
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 870f6edeb5f2..285a0f531760 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utcache") | 47 | ACPI_MODULE_NAME("utcache") |
48 | |||
49 | #ifdef ACPI_USE_LOCAL_CACHE | 48 | #ifdef ACPI_USE_LOCAL_CACHE |
50 | /******************************************************************************* | 49 | /******************************************************************************* |
51 | * | 50 | * |
@@ -64,7 +63,7 @@ ACPI_MODULE_NAME("utcache") | |||
64 | acpi_status | 63 | acpi_status |
65 | acpi_os_create_cache(char *cache_name, | 64 | acpi_os_create_cache(char *cache_name, |
66 | u16 object_size, | 65 | u16 object_size, |
67 | u16 max_depth, struct acpi_memory_list **return_cache) | 66 | u16 max_depth, struct acpi_memory_list ** return_cache) |
68 | { | 67 | { |
69 | struct acpi_memory_list *cache; | 68 | struct acpi_memory_list *cache; |
70 | 69 | ||
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 84d529db0a66..879eaa10d3ae 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -68,6 +68,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj, | |||
68 | union acpi_operand_object **return_obj); | 68 | union acpi_operand_object **return_obj); |
69 | 69 | ||
70 | static acpi_status | 70 | static acpi_status |
71 | acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, | ||
72 | union acpi_operand_object **internal_object); | ||
73 | |||
74 | static acpi_status | ||
71 | acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | 75 | acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, |
72 | union acpi_operand_object *dest_desc); | 76 | union acpi_operand_object *dest_desc); |
73 | 77 | ||
@@ -518,77 +522,73 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
518 | return_ACPI_STATUS(AE_NO_MEMORY); | 522 | return_ACPI_STATUS(AE_NO_MEMORY); |
519 | } | 523 | } |
520 | 524 | ||
521 | #ifdef ACPI_FUTURE_IMPLEMENTATION | ||
522 | /* Code to convert packages that are parameters to control methods */ | ||
523 | |||
524 | /******************************************************************************* | 525 | /******************************************************************************* |
525 | * | 526 | * |
526 | * FUNCTION: acpi_ut_copy_epackage_to_ipackage | 527 | * FUNCTION: acpi_ut_copy_epackage_to_ipackage |
527 | * | 528 | * |
528 | * PARAMETERS: *internal_object - Pointer to the object we are returning | 529 | * PARAMETERS: external_object - The external object to be converted |
529 | * *Buffer - Where the object is returned | 530 | * internal_object - Where the internal object is returned |
530 | * *space_used - Where the length of the object is returned | ||
531 | * | 531 | * |
532 | * RETURN: Status | 532 | * RETURN: Status |
533 | * | 533 | * |
534 | * DESCRIPTION: This function is called to place a package object in a user | 534 | * DESCRIPTION: Copy an external package object to an internal package. |
535 | * buffer. A package object by definition contains other objects. | 535 | * Handles nested packages. |
536 | * | ||
537 | * The buffer is assumed to have sufficient space for the object. | ||
538 | * The caller must have verified the buffer length needed using the | ||
539 | * acpi_ut_get_object_size function before calling this function. | ||
540 | * | 536 | * |
541 | ******************************************************************************/ | 537 | ******************************************************************************/ |
542 | 538 | ||
543 | static acpi_status | 539 | static acpi_status |
544 | acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, | 540 | acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, |
545 | u8 * buffer, u32 * space_used) | 541 | union acpi_operand_object **internal_object) |
546 | { | 542 | { |
547 | u8 *free_space; | 543 | acpi_status status = AE_OK; |
548 | union acpi_object *external_object; | 544 | union acpi_operand_object *package_object; |
549 | u32 length = 0; | 545 | union acpi_operand_object **package_elements; |
550 | u32 this_index; | 546 | acpi_native_uint i; |
551 | u32 object_space = 0; | ||
552 | union acpi_operand_object *this_internal_obj; | ||
553 | union acpi_object *this_external_obj; | ||
554 | 547 | ||
555 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); | 548 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
556 | 549 | ||
557 | /* | 550 | /* Create the package object */ |
558 | * First package at head of the buffer | ||
559 | */ | ||
560 | external_object = (union acpi_object *)buffer; | ||
561 | 551 | ||
562 | /* | 552 | package_object = |
563 | * Free space begins right after the first package | 553 | acpi_ut_create_package_object(external_object->package.count); |
564 | */ | 554 | if (!package_object) { |
565 | free_space = buffer + sizeof(union acpi_object); | 555 | return_ACPI_STATUS(AE_NO_MEMORY); |
556 | } | ||
566 | 557 | ||
567 | external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); | 558 | package_elements = package_object->package.elements; |
568 | external_object->package.count = internal_object->package.count; | ||
569 | external_object->package.elements = (union acpi_object *)free_space; | ||
570 | 559 | ||
571 | /* | 560 | /* |
572 | * Build an array of ACPI_OBJECTS in the buffer | 561 | * Recursive implementation. Probably ok, since nested external packages |
573 | * and move the free space past it | 562 | * as parameters should be very rare. |
574 | */ | 563 | */ |
575 | free_space += | 564 | for (i = 0; i < external_object->package.count; i++) { |
576 | external_object->package.count * sizeof(union acpi_object); | 565 | status = |
566 | acpi_ut_copy_eobject_to_iobject(&external_object->package. | ||
567 | elements[i], | ||
568 | &package_elements[i]); | ||
569 | if (ACPI_FAILURE(status)) { | ||
577 | 570 | ||
578 | /* Call walk_package */ | 571 | /* Truncate package and delete it */ |
579 | 572 | ||
580 | } | 573 | package_object->package.count = i; |
574 | package_elements[i] = NULL; | ||
575 | acpi_ut_remove_reference(package_object); | ||
576 | return_ACPI_STATUS(status); | ||
577 | } | ||
578 | } | ||
581 | 579 | ||
582 | #endif /* Future implementation */ | 580 | *internal_object = package_object; |
581 | return_ACPI_STATUS(status); | ||
582 | } | ||
583 | 583 | ||
584 | /******************************************************************************* | 584 | /******************************************************************************* |
585 | * | 585 | * |
586 | * FUNCTION: acpi_ut_copy_eobject_to_iobject | 586 | * FUNCTION: acpi_ut_copy_eobject_to_iobject |
587 | * | 587 | * |
588 | * PARAMETERS: *internal_object - The external object to be converted | 588 | * PARAMETERS: external_object - The external object to be converted |
589 | * *buffer_ptr - Where the internal object is returned | 589 | * internal_object - Where the internal object is returned |
590 | * | 590 | * |
591 | * RETURN: Status - the status of the call | 591 | * RETURN: Status - the status of the call |
592 | * | 592 | * |
593 | * DESCRIPTION: Converts an external object to an internal object. | 593 | * DESCRIPTION: Converts an external object to an internal object. |
594 | * | 594 | * |
@@ -603,16 +603,10 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); | 603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); |
604 | 604 | ||
605 | if (external_object->type == ACPI_TYPE_PACKAGE) { | 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { |
606 | /* | 606 | status = |
607 | * Packages as external input to control methods are not supported, | 607 | acpi_ut_copy_epackage_to_ipackage(external_object, |
608 | */ | 608 | internal_object); |
609 | ACPI_ERROR((AE_INFO, | 609 | } else { |
610 | "Packages as parameters not implemented!")); | ||
611 | |||
612 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); | ||
613 | } | ||
614 | |||
615 | else { | ||
616 | /* | 610 | /* |
617 | * Build a simple object (no nested objects) | 611 | * Build a simple object (no nested objects) |
618 | */ | 612 | */ |
@@ -803,31 +797,19 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, | |||
803 | * Create and build the package object | 797 | * Create and build the package object |
804 | */ | 798 | */ |
805 | target_object = | 799 | target_object = |
806 | acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); | 800 | acpi_ut_create_package_object(source_object->package.count); |
807 | if (!target_object) { | 801 | if (!target_object) { |
808 | return (AE_NO_MEMORY); | 802 | return (AE_NO_MEMORY); |
809 | } | 803 | } |
810 | 804 | ||
811 | target_object->package.count = source_object->package.count; | ||
812 | target_object->common.flags = source_object->common.flags; | 805 | target_object->common.flags = source_object->common.flags; |
813 | 806 | ||
814 | /* | 807 | /* Pass the new package object back to the package walk routine */ |
815 | * Create the object array | ||
816 | */ | ||
817 | target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); | ||
818 | if (!target_object->package.elements) { | ||
819 | status = AE_NO_MEMORY; | ||
820 | goto error_exit; | ||
821 | } | ||
822 | 808 | ||
823 | /* | ||
824 | * Pass the new package object back to the package walk routine | ||
825 | */ | ||
826 | state->pkg.this_target_obj = target_object; | 809 | state->pkg.this_target_obj = target_object; |
827 | 810 | ||
828 | /* | 811 | /* Store the object pointer in the parent package object */ |
829 | * Store the object pointer in the parent package object | 812 | |
830 | */ | ||
831 | *this_target_ptr = target_object; | 813 | *this_target_ptr = target_object; |
832 | break; | 814 | break; |
833 | 815 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 61ad4f2daee2..c7e128e5369b 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utdebug") | 47 | ACPI_MODULE_NAME("utdebug") |
48 | |||
49 | #ifdef ACPI_DEBUG_OUTPUT | 48 | #ifdef ACPI_DEBUG_OUTPUT |
50 | static acpi_thread_id acpi_gbl_prev_thread_id; | 49 | static acpi_thread_id acpi_gbl_prev_thread_id; |
51 | static char *acpi_gbl_fn_entry_str = "----Entry"; | 50 | static char *acpi_gbl_fn_entry_str = "----Entry"; |
@@ -181,7 +180,8 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
181 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
182 | acpi_os_printf | 181 | acpi_os_printf |
183 | ("\n**** Context Switch from TID %lX to TID %lX ****\n\n", | 182 | ("\n**** Context Switch from TID %lX to TID %lX ****\n\n", |
184 | (unsigned long)acpi_gbl_prev_thread_id, (unsigned long)thread_id); | 183 | (unsigned long)acpi_gbl_prev_thread_id, |
184 | (unsigned long)thread_id); | ||
185 | } | 185 | } |
186 | 186 | ||
187 | acpi_gbl_prev_thread_id = thread_id; | 187 | acpi_gbl_prev_thread_id = thread_id; |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 673a0caa4073..f777cebdc46d 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -170,6 +170,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
170 | acpi_os_delete_mutex(object->mutex.os_mutex); | 170 | acpi_os_delete_mutex(object->mutex.os_mutex); |
171 | acpi_gbl_global_lock_mutex = NULL; | 171 | acpi_gbl_global_lock_mutex = NULL; |
172 | } else { | 172 | } else { |
173 | acpi_ex_unlink_mutex(object); | ||
173 | acpi_os_delete_mutex(object->mutex.os_mutex); | 174 | acpi_os_delete_mutex(object->mutex.os_mutex); |
174 | } | 175 | } |
175 | break; | 176 | break; |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 13d5879cd98b..8ec6f8e48138 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -59,10 +59,9 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
59 | /* | 59 | /* |
60 | * Strings supported by the _OSI predefined (internal) method. | 60 | * Strings supported by the _OSI predefined (internal) method. |
61 | */ | 61 | */ |
62 | static const char *acpi_interfaces_supported[] = { | 62 | static char *acpi_interfaces_supported[] = { |
63 | /* Operating System Vendor Strings */ | 63 | /* Operating System Vendor Strings */ |
64 | 64 | ||
65 | "Linux", | ||
66 | "Windows 2000", | 65 | "Windows 2000", |
67 | "Windows 2001", | 66 | "Windows 2001", |
68 | "Windows 2001 SP0", | 67 | "Windows 2001 SP0", |
@@ -158,6 +157,31 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
158 | 157 | ||
159 | /******************************************************************************* | 158 | /******************************************************************************* |
160 | * | 159 | * |
160 | * FUNCTION: acpi_osi_invalidate | ||
161 | * | ||
162 | * PARAMETERS: interface_string | ||
163 | * | ||
164 | * RETURN: Status | ||
165 | * | ||
166 | * DESCRIPTION: invalidate string in pre-defiend _OSI string list | ||
167 | * | ||
168 | ******************************************************************************/ | ||
169 | |||
170 | acpi_status acpi_osi_invalidate(char *interface) | ||
171 | { | ||
172 | int i; | ||
173 | |||
174 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | ||
175 | if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) { | ||
176 | *acpi_interfaces_supported[i] = '\0'; | ||
177 | return AE_OK; | ||
178 | } | ||
179 | } | ||
180 | return AE_NOT_FOUND; | ||
181 | } | ||
182 | |||
183 | /******************************************************************************* | ||
184 | * | ||
161 | * FUNCTION: acpi_ut_evaluate_object | 185 | * FUNCTION: acpi_ut_evaluate_object |
162 | * | 186 | * |
163 | * PARAMETERS: prefix_node - Starting node | 187 | * PARAMETERS: prefix_node - Starting node |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index af33358a964b..1621655d6e2b 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -55,12 +55,10 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) | |||
55 | * Static global variable initialization. | 55 | * Static global variable initialization. |
56 | * | 56 | * |
57 | ******************************************************************************/ | 57 | ******************************************************************************/ |
58 | |||
59 | /* | 58 | /* |
60 | * We want the debug switches statically initialized so they | 59 | * We want the debug switches statically initialized so they |
61 | * are already set when the debugger is entered. | 60 | * are already set when the debugger is entered. |
62 | */ | 61 | */ |
63 | |||
64 | /* Debug switch - level and trace mask */ | 62 | /* Debug switch - level and trace mask */ |
65 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; | 63 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
66 | 64 | ||
@@ -735,5 +733,5 @@ void acpi_ut_init_globals(void) | |||
735 | } | 733 | } |
736 | 734 | ||
737 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | 735 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) |
738 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | 736 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) |
739 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) | 737 | ACPI_EXPORT_SYMBOL(acpi_gpe_count) |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 50133fffe420..2d19f71e9cfa 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -802,9 +802,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
802 | 802 | ||
803 | valid_digits++; | 803 | valid_digits++; |
804 | 804 | ||
805 | if (sign_of0x | 805 | if (sign_of0x && ((valid_digits > 16) |
806 | && ((valid_digits > 16) | 806 | || ((valid_digits > 8) && mode32))) { |
807 | || ((valid_digits > 8) && mode32))) { | ||
808 | /* | 807 | /* |
809 | * This is to_integer operation case. | 808 | * This is to_integer operation case. |
810 | * No any restrictions for string-to-integer conversion, | 809 | * No any restrictions for string-to-integer conversion, |
@@ -1049,6 +1048,7 @@ acpi_ut_exception(char *module_name, | |||
1049 | acpi_os_vprintf(format, args); | 1048 | acpi_os_vprintf(format, args); |
1050 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1049 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
1051 | } | 1050 | } |
1051 | |||
1052 | EXPORT_SYMBOL(acpi_ut_exception); | 1052 | EXPORT_SYMBOL(acpi_ut_exception); |
1053 | 1053 | ||
1054 | void ACPI_INTERNAL_VAR_XFACE | 1054 | void ACPI_INTERNAL_VAR_XFACE |
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index cbad2ef5987d..4820bc86d1f5 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -244,7 +244,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
244 | 244 | ||
245 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 245 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
246 | "Thread %lX attempting to acquire Mutex [%s]\n", | 246 | "Thread %lX attempting to acquire Mutex [%s]\n", |
247 | (unsigned long) this_thread_id, | 247 | (unsigned long)this_thread_id, |
248 | acpi_ut_get_mutex_name(mutex_id))); | 248 | acpi_ut_get_mutex_name(mutex_id))); |
249 | 249 | ||
250 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 250 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
@@ -252,7 +252,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
252 | if (ACPI_SUCCESS(status)) { | 252 | if (ACPI_SUCCESS(status)) { |
253 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
254 | "Thread %lX acquired Mutex [%s]\n", | 254 | "Thread %lX acquired Mutex [%s]\n", |
255 | (unsigned long) this_thread_id, | 255 | (unsigned long)this_thread_id, |
256 | acpi_ut_get_mutex_name(mutex_id))); | 256 | acpi_ut_get_mutex_name(mutex_id))); |
257 | 257 | ||
258 | acpi_gbl_mutex_info[mutex_id].use_count++; | 258 | acpi_gbl_mutex_info[mutex_id].use_count++; |
@@ -260,7 +260,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
260 | } else { | 260 | } else { |
261 | ACPI_EXCEPTION((AE_INFO, status, | 261 | ACPI_EXCEPTION((AE_INFO, status, |
262 | "Thread %lX could not acquire Mutex [%X]", | 262 | "Thread %lX could not acquire Mutex [%X]", |
263 | (unsigned long) this_thread_id, mutex_id)); | 263 | (unsigned long)this_thread_id, mutex_id)); |
264 | } | 264 | } |
265 | 265 | ||
266 | return (status); | 266 | return (status); |
@@ -287,7 +287,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
287 | this_thread_id = acpi_os_get_thread_id(); | 287 | this_thread_id = acpi_os_get_thread_id(); |
288 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 288 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
289 | "Thread %lX releasing Mutex [%s]\n", | 289 | "Thread %lX releasing Mutex [%s]\n", |
290 | (unsigned long) this_thread_id, | 290 | (unsigned long)this_thread_id, |
291 | acpi_ut_get_mutex_name(mutex_id))); | 291 | acpi_ut_get_mutex_name(mutex_id))); |
292 | 292 | ||
293 | if (mutex_id > ACPI_MAX_MUTEX) { | 293 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 4696124759e1..76ee766c84f9 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -146,6 +146,48 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | |||
146 | 146 | ||
147 | /******************************************************************************* | 147 | /******************************************************************************* |
148 | * | 148 | * |
149 | * FUNCTION: acpi_ut_create_package_object | ||
150 | * | ||
151 | * PARAMETERS: Count - Number of package elements | ||
152 | * | ||
153 | * RETURN: Pointer to a new Package object, null on failure | ||
154 | * | ||
155 | * DESCRIPTION: Create a fully initialized package object | ||
156 | * | ||
157 | ******************************************************************************/ | ||
158 | |||
159 | union acpi_operand_object *acpi_ut_create_package_object(u32 count) | ||
160 | { | ||
161 | union acpi_operand_object *package_desc; | ||
162 | union acpi_operand_object **package_elements; | ||
163 | |||
164 | ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count); | ||
165 | |||
166 | /* Create a new Package object */ | ||
167 | |||
168 | package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); | ||
169 | if (!package_desc) { | ||
170 | return_PTR(NULL); | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Create the element array. Count+1 allows the array to be null | ||
175 | * terminated. | ||
176 | */ | ||
177 | package_elements = ACPI_ALLOCATE_ZEROED((acpi_size) | ||
178 | (count + 1) * sizeof(void *)); | ||
179 | if (!package_elements) { | ||
180 | acpi_ut_remove_reference(package_desc); | ||
181 | return_PTR(NULL); | ||
182 | } | ||
183 | |||
184 | package_desc->package.count = count; | ||
185 | package_desc->package.elements = package_elements; | ||
186 | return_PTR(package_desc); | ||
187 | } | ||
188 | |||
189 | /******************************************************************************* | ||
190 | * | ||
149 | * FUNCTION: acpi_ut_create_buffer_object | 191 | * FUNCTION: acpi_ut_create_buffer_object |
150 | * | 192 | * |
151 | * PARAMETERS: buffer_size - Size of buffer to be created | 193 | * PARAMETERS: buffer_size - Size of buffer to be created |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index e8fe1ba6cc24..cbbd3315a1e2 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utresrc") | 48 | ACPI_MODULE_NAME("utresrc") |
49 | |||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 49 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
51 | /* | 50 | /* |
52 | * Strings used to decode resource descriptors. | 51 | * Strings used to decode resource descriptors. |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index de3276f4f468..2d496918b3cd 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utxface") | |||
61 | * called, so any early initialization belongs here. | 61 | * called, so any early initialization belongs here. |
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | acpi_status acpi_initialize_subsystem(void) | 64 | acpi_status __init acpi_initialize_subsystem(void) |
65 | { | 65 | { |
66 | acpi_status status; | 66 | acpi_status status; |
67 | 67 | ||
@@ -108,8 +108,6 @@ acpi_status acpi_initialize_subsystem(void) | |||
108 | return_ACPI_STATUS(status); | 108 | return_ACPI_STATUS(status); |
109 | } | 109 | } |
110 | 110 | ||
111 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
112 | |||
113 | /******************************************************************************* | 111 | /******************************************************************************* |
114 | * | 112 | * |
115 | * FUNCTION: acpi_enable_subsystem | 113 | * FUNCTION: acpi_enable_subsystem |
@@ -337,7 +335,6 @@ acpi_status acpi_terminate(void) | |||
337 | } | 335 | } |
338 | 336 | ||
339 | ACPI_EXPORT_SYMBOL(acpi_terminate) | 337 | ACPI_EXPORT_SYMBOL(acpi_terminate) |
340 | |||
341 | #ifdef ACPI_FUTURE_USAGE | 338 | #ifdef ACPI_FUTURE_USAGE |
342 | /******************************************************************************* | 339 | /******************************************************************************* |
343 | * | 340 | * |
@@ -470,7 +467,6 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
470 | 467 | ||
471 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | 468 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) |
472 | #endif /* ACPI_FUTURE_USAGE */ | 469 | #endif /* ACPI_FUTURE_USAGE */ |
473 | |||
474 | /***************************************************************************** | 470 | /***************************************************************************** |
475 | * | 471 | * |
476 | * FUNCTION: acpi_purge_cached_objects | 472 | * FUNCTION: acpi_purge_cached_objects |