diff options
Diffstat (limited to 'drivers')
221 files changed, 3506 insertions, 3040 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b811f2173f6..0f9de2b44c0 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -66,7 +66,6 @@ config ACPI_PROCFS | |||
66 | config ACPI_PROCFS_POWER | 66 | config ACPI_PROCFS_POWER |
67 | bool "Deprecated power /proc/acpi directories" | 67 | bool "Deprecated power /proc/acpi directories" |
68 | depends on PROC_FS | 68 | depends on PROC_FS |
69 | default y | ||
70 | help | 69 | help |
71 | For backwards compatibility, this option allows | 70 | For backwards compatibility, this option allows |
72 | deprecated power /proc/acpi/ directories to exist, even when | 71 | deprecated power /proc/acpi/ directories to exist, even when |
@@ -90,13 +89,6 @@ config ACPI_POWER_METER | |||
90 | To compile this driver as a module, choose M here: | 89 | To compile this driver as a module, choose M here: |
91 | the module will be called power-meter. | 90 | the module will be called power-meter. |
92 | 91 | ||
93 | config ACPI_SYSFS_POWER | ||
94 | bool "Future power /sys interface" | ||
95 | select POWER_SUPPLY | ||
96 | default y | ||
97 | help | ||
98 | Say N to disable power /sys interface | ||
99 | |||
100 | config ACPI_EC_DEBUGFS | 92 | config ACPI_EC_DEBUGFS |
101 | tristate "EC read/write access through /sys/kernel/debug/ec" | 93 | tristate "EC read/write access through /sys/kernel/debug/ec" |
102 | default n | 94 | default n |
@@ -105,7 +97,7 @@ config ACPI_EC_DEBUGFS | |||
105 | 97 | ||
106 | Be aware that using this interface can confuse your Embedded | 98 | Be aware that using this interface can confuse your Embedded |
107 | Controller in a way that a normal reboot is not enough. You then | 99 | Controller in a way that a normal reboot is not enough. You then |
108 | have to power of your system, and remove the laptop battery for | 100 | have to power off your system, and remove the laptop battery for |
109 | some seconds. | 101 | some seconds. |
110 | An Embedded Controller typically is available on laptops and reads | 102 | An Embedded Controller typically is available on laptops and reads |
111 | sensor values like battery state and temperature. | 103 | sensor values like battery state and temperature. |
@@ -136,6 +128,7 @@ config ACPI_PROC_EVENT | |||
136 | config ACPI_AC | 128 | config ACPI_AC |
137 | tristate "AC Adapter" | 129 | tristate "AC Adapter" |
138 | depends on X86 | 130 | depends on X86 |
131 | select POWER_SUPPLY | ||
139 | default y | 132 | default y |
140 | help | 133 | help |
141 | This driver supports the AC Adapter object, which indicates | 134 | This driver supports the AC Adapter object, which indicates |
@@ -148,6 +141,7 @@ config ACPI_AC | |||
148 | config ACPI_BATTERY | 141 | config ACPI_BATTERY |
149 | tristate "Battery" | 142 | tristate "Battery" |
150 | depends on X86 | 143 | depends on X86 |
144 | select POWER_SUPPLY | ||
151 | default y | 145 | default y |
152 | help | 146 | help |
153 | This driver adds support for battery information through | 147 | This driver adds support for battery information through |
@@ -364,6 +358,7 @@ config ACPI_HOTPLUG_MEMORY | |||
364 | config ACPI_SBS | 358 | config ACPI_SBS |
365 | tristate "Smart Battery System" | 359 | tristate "Smart Battery System" |
366 | depends on X86 | 360 | depends on X86 |
361 | select POWER_SUPPLY | ||
367 | help | 362 | help |
368 | This driver supports the Smart Battery System, another | 363 | This driver supports the Smart Battery System, another |
369 | type of access to battery information, found on some laptops. | 364 | type of access to battery information, found on some laptops. |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 56205a0b85d..ba9afeaa23a 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -32,9 +32,7 @@ | |||
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #endif | 34 | #endif |
35 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
36 | #include <linux/power_supply.h> | 35 | #include <linux/power_supply.h> |
37 | #endif | ||
38 | #include <acpi/acpi_bus.h> | 36 | #include <acpi/acpi_bus.h> |
39 | #include <acpi/acpi_drivers.h> | 37 | #include <acpi/acpi_drivers.h> |
40 | 38 | ||
@@ -86,9 +84,7 @@ static struct acpi_driver acpi_ac_driver = { | |||
86 | }; | 84 | }; |
87 | 85 | ||
88 | struct acpi_ac { | 86 | struct acpi_ac { |
89 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
90 | struct power_supply charger; | 87 | struct power_supply charger; |
91 | #endif | ||
92 | struct acpi_device * device; | 88 | struct acpi_device * device; |
93 | unsigned long long state; | 89 | unsigned long long state; |
94 | }; | 90 | }; |
@@ -104,7 +100,6 @@ static const struct file_operations acpi_ac_fops = { | |||
104 | .release = single_release, | 100 | .release = single_release, |
105 | }; | 101 | }; |
106 | #endif | 102 | #endif |
107 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
108 | static int get_ac_property(struct power_supply *psy, | 103 | static int get_ac_property(struct power_supply *psy, |
109 | enum power_supply_property psp, | 104 | enum power_supply_property psp, |
110 | union power_supply_propval *val) | 105 | union power_supply_propval *val) |
@@ -123,7 +118,6 @@ static int get_ac_property(struct power_supply *psy, | |||
123 | static enum power_supply_property ac_props[] = { | 118 | static enum power_supply_property ac_props[] = { |
124 | POWER_SUPPLY_PROP_ONLINE, | 119 | POWER_SUPPLY_PROP_ONLINE, |
125 | }; | 120 | }; |
126 | #endif | ||
127 | /* -------------------------------------------------------------------------- | 121 | /* -------------------------------------------------------------------------- |
128 | AC Adapter Management | 122 | AC Adapter Management |
129 | -------------------------------------------------------------------------- */ | 123 | -------------------------------------------------------------------------- */ |
@@ -247,9 +241,7 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
247 | dev_name(&device->dev), event, | 241 | dev_name(&device->dev), event, |
248 | (u32) ac->state); | 242 | (u32) ac->state); |
249 | acpi_notifier_call_chain(device, event, (u32) ac->state); | 243 | acpi_notifier_call_chain(device, event, (u32) ac->state); |
250 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
251 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 244 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
252 | #endif | ||
253 | } | 245 | } |
254 | 246 | ||
255 | return; | 247 | return; |
@@ -282,14 +274,12 @@ static int acpi_ac_add(struct acpi_device *device) | |||
282 | #endif | 274 | #endif |
283 | if (result) | 275 | if (result) |
284 | goto end; | 276 | goto end; |
285 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
286 | ac->charger.name = acpi_device_bid(device); | 277 | ac->charger.name = acpi_device_bid(device); |
287 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; | 278 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
288 | ac->charger.properties = ac_props; | 279 | ac->charger.properties = ac_props; |
289 | ac->charger.num_properties = ARRAY_SIZE(ac_props); | 280 | ac->charger.num_properties = ARRAY_SIZE(ac_props); |
290 | ac->charger.get_property = get_ac_property; | 281 | ac->charger.get_property = get_ac_property; |
291 | power_supply_register(&ac->device->dev, &ac->charger); | 282 | power_supply_register(&ac->device->dev, &ac->charger); |
292 | #endif | ||
293 | 283 | ||
294 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", | 284 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", |
295 | acpi_device_name(device), acpi_device_bid(device), | 285 | acpi_device_name(device), acpi_device_bid(device), |
@@ -316,10 +306,8 @@ static int acpi_ac_resume(struct acpi_device *device) | |||
316 | old_state = ac->state; | 306 | old_state = ac->state; |
317 | if (acpi_ac_get_state(ac)) | 307 | if (acpi_ac_get_state(ac)) |
318 | return 0; | 308 | return 0; |
319 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
320 | if (old_state != ac->state) | 309 | if (old_state != ac->state) |
321 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); | 310 | kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); |
322 | #endif | ||
323 | return 0; | 311 | return 0; |
324 | } | 312 | } |
325 | 313 | ||
@@ -333,10 +321,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
333 | 321 | ||
334 | ac = acpi_driver_data(device); | 322 | ac = acpi_driver_data(device); |
335 | 323 | ||
336 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
337 | if (ac->charger.dev) | 324 | if (ac->charger.dev) |
338 | power_supply_unregister(&ac->charger); | 325 | power_supply_unregister(&ac->charger); |
339 | #endif | ||
340 | #ifdef CONFIG_ACPI_PROCFS_POWER | 326 | #ifdef CONFIG_ACPI_PROCFS_POWER |
341 | acpi_ac_remove_fs(device); | 327 | acpi_ac_remove_fs(device); |
342 | #endif | 328 | #endif |
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index b76848c80be..6b115f6c431 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -382,31 +382,32 @@ static void acpi_pad_remove_sysfs(struct acpi_device *device) | |||
382 | device_remove_file(&device->dev, &dev_attr_rrtime); | 382 | device_remove_file(&device->dev, &dev_attr_rrtime); |
383 | } | 383 | } |
384 | 384 | ||
385 | /* Query firmware how many CPUs should be idle */ | 385 | /* |
386 | static int acpi_pad_pur(acpi_handle handle, int *num_cpus) | 386 | * Query firmware how many CPUs should be idle |
387 | * return -1 on failure | ||
388 | */ | ||
389 | static int acpi_pad_pur(acpi_handle handle) | ||
387 | { | 390 | { |
388 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 391 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
389 | union acpi_object *package; | 392 | union acpi_object *package; |
390 | int rev, num, ret = -EINVAL; | 393 | int num = -1; |
391 | 394 | ||
392 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) | 395 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) |
393 | return -EINVAL; | 396 | return num; |
394 | 397 | ||
395 | if (!buffer.length || !buffer.pointer) | 398 | if (!buffer.length || !buffer.pointer) |
396 | return -EINVAL; | 399 | return num; |
397 | 400 | ||
398 | package = buffer.pointer; | 401 | package = buffer.pointer; |
399 | if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) | 402 | |
400 | goto out; | 403 | if (package->type == ACPI_TYPE_PACKAGE && |
401 | rev = package->package.elements[0].integer.value; | 404 | package->package.count == 2 && |
402 | num = package->package.elements[1].integer.value; | 405 | package->package.elements[0].integer.value == 1) /* rev 1 */ |
403 | if (rev != 1 || num < 0) | 406 | |
404 | goto out; | 407 | num = package->package.elements[1].integer.value; |
405 | *num_cpus = num; | 408 | |
406 | ret = 0; | ||
407 | out: | ||
408 | kfree(buffer.pointer); | 409 | kfree(buffer.pointer); |
409 | return ret; | 410 | return num; |
410 | } | 411 | } |
411 | 412 | ||
412 | /* Notify firmware how many CPUs are idle */ | 413 | /* Notify firmware how many CPUs are idle */ |
@@ -433,7 +434,8 @@ static void acpi_pad_handle_notify(acpi_handle handle) | |||
433 | uint32_t idle_cpus; | 434 | uint32_t idle_cpus; |
434 | 435 | ||
435 | mutex_lock(&isolated_cpus_lock); | 436 | mutex_lock(&isolated_cpus_lock); |
436 | if (acpi_pad_pur(handle, &num_cpus)) { | 437 | num_cpus = acpi_pad_pur(handle); |
438 | if (num_cpus < 0) { | ||
437 | mutex_unlock(&isolated_cpus_lock); | 439 | mutex_unlock(&isolated_cpus_lock); |
438 | return; | 440 | return; |
439 | } | 441 | } |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index d93cc06f4bf..a7e1d1aa410 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -21,7 +21,7 @@ acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ | |||
21 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ | 21 | excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ |
22 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o | 22 | exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o exdebug.o |
23 | 23 | ||
24 | acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o | 24 | acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o hwpci.o |
25 | 25 | ||
26 | acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o | 26 | acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o |
27 | 27 | ||
@@ -44,4 +44,5 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | |||
44 | 44 | ||
45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ |
48 | utosi.o utxferror.o | ||
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index 48faf3eba9f..72e9d5eb083 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -105,6 +105,8 @@ void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg); | |||
105 | acpi_status | 105 | acpi_status |
106 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); | 106 | acpi_db_display_objects(char *obj_type_arg, char *display_count_arg); |
107 | 107 | ||
108 | void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg); | ||
109 | |||
108 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); | 110 | acpi_status acpi_db_find_name_in_namespace(char *name_arg); |
109 | 111 | ||
110 | void acpi_db_set_scope(char *name); | 112 | void acpi_db_set_scope(char *name); |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 36867cd70ea..a6f99cc37a1 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -105,8 +105,9 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
105 | struct acpi_gpe_block_info **return_gpe_block); | 105 | struct acpi_gpe_block_info **return_gpe_block); |
106 | 106 | ||
107 | acpi_status | 107 | acpi_status |
108 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | 108 | acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
109 | struct acpi_gpe_block_info *gpe_block); | 109 | struct acpi_gpe_block_info *gpe_block, |
110 | void *ignored); | ||
110 | 111 | ||
111 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); | 112 | acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block); |
112 | 113 | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 1d192142c69..ad88fcae4eb 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -132,6 +132,7 @@ struct acpi_table_fadt acpi_gbl_FADT; | |||
132 | u32 acpi_current_gpe_count; | 132 | u32 acpi_current_gpe_count; |
133 | u32 acpi_gbl_trace_flags; | 133 | u32 acpi_gbl_trace_flags; |
134 | acpi_name acpi_gbl_trace_method_name; | 134 | acpi_name acpi_gbl_trace_method_name; |
135 | u8 acpi_gbl_system_awake_and_running; | ||
135 | 136 | ||
136 | #endif | 137 | #endif |
137 | 138 | ||
@@ -187,6 +188,10 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width; | |||
187 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; | 188 | ACPI_EXTERN u8 acpi_gbl_integer_byte_width; |
188 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | 189 | ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; |
189 | 190 | ||
191 | /* Mutex for _OSI support */ | ||
192 | |||
193 | ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex; | ||
194 | |||
190 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ | 195 | /* Reader/Writer lock is used for namespace walk and dynamic table unload */ |
191 | 196 | ||
192 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; | 197 | ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock; |
@@ -255,6 +260,7 @@ ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler; | |||
255 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; | 260 | ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler; |
256 | ACPI_EXTERN void *acpi_gbl_table_handler_context; | 261 | ACPI_EXTERN void *acpi_gbl_table_handler_context; |
257 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; | 262 | ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; |
263 | ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; | ||
258 | 264 | ||
259 | /* Owner ID support */ | 265 | /* Owner ID support */ |
260 | 266 | ||
@@ -273,8 +279,8 @@ ACPI_EXTERN u8 acpi_gbl_debugger_configuration; | |||
273 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; | 279 | ACPI_EXTERN u8 acpi_gbl_step_to_next_call; |
274 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; | 280 | ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present; |
275 | ACPI_EXTERN u8 acpi_gbl_events_initialized; | 281 | ACPI_EXTERN u8 acpi_gbl_events_initialized; |
276 | ACPI_EXTERN u8 acpi_gbl_system_awake_and_running; | ||
277 | ACPI_EXTERN u8 acpi_gbl_osi_data; | 282 | ACPI_EXTERN u8 acpi_gbl_osi_data; |
283 | ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces; | ||
278 | 284 | ||
279 | #ifndef DEFINE_ACPI_GLOBALS | 285 | #ifndef DEFINE_ACPI_GLOBALS |
280 | 286 | ||
@@ -364,6 +370,7 @@ ACPI_EXTERN struct acpi_fixed_event_handler | |||
364 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | 370 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; |
365 | ACPI_EXTERN struct acpi_gpe_block_info | 371 | ACPI_EXTERN struct acpi_gpe_block_info |
366 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | 372 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; |
373 | ACPI_EXTERN u8 acpi_all_gpes_initialized; | ||
367 | 374 | ||
368 | /***************************************************************************** | 375 | /***************************************************************************** |
369 | * | 376 | * |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 120b3af5659..167470ad2d2 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -121,6 +121,13 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
121 | struct acpi_gpe_block_info *gpe_block, | 121 | struct acpi_gpe_block_info *gpe_block, |
122 | void *context); | 122 | void *context); |
123 | 123 | ||
124 | /* | ||
125 | * hwpci - PCI configuration support | ||
126 | */ | ||
127 | acpi_status | ||
128 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, | ||
129 | acpi_handle root_pci_device, acpi_handle pci_region); | ||
130 | |||
124 | #ifdef ACPI_FUTURE_USAGE | 131 | #ifdef ACPI_FUTURE_USAGE |
125 | /* | 132 | /* |
126 | * hwtimer - ACPI Timer prototypes | 133 | * hwtimer - ACPI Timer prototypes |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index df85b53a674..2ceb0c05b2d 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -413,6 +413,7 @@ struct acpi_handler_info { | |||
413 | void *context; /* Context to be passed to handler */ | 413 | void *context; /* Context to be passed to handler */ |
414 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ | 414 | struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ |
415 | u8 orig_flags; /* Original misc info about this GPE */ | 415 | u8 orig_flags; /* Original misc info about this GPE */ |
416 | u8 orig_enabled; /* Set if the GPE was originally enabled */ | ||
416 | }; | 417 | }; |
417 | 418 | ||
418 | union acpi_gpe_dispatch_info { | 419 | union acpi_gpe_dispatch_info { |
@@ -457,6 +458,7 @@ struct acpi_gpe_block_info { | |||
457 | u32 register_count; /* Number of register pairs in block */ | 458 | u32 register_count; /* Number of register pairs in block */ |
458 | u16 gpe_count; /* Number of individual GPEs in block */ | 459 | u16 gpe_count; /* Number of individual GPEs in block */ |
459 | u8 block_base_number; /* Base GPE number for this block */ | 460 | u8 block_base_number; /* Base GPE number for this block */ |
461 | u8 initialized; /* If set, the GPE block has been initialized */ | ||
460 | }; | 462 | }; |
461 | 463 | ||
462 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ | 464 | /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ |
@@ -473,7 +475,6 @@ struct acpi_gpe_walk_info { | |||
473 | struct acpi_gpe_block_info *gpe_block; | 475 | struct acpi_gpe_block_info *gpe_block; |
474 | u16 count; | 476 | u16 count; |
475 | acpi_owner_id owner_id; | 477 | acpi_owner_id owner_id; |
476 | u8 enable_this_gpe; | ||
477 | u8 execute_by_owner_id; | 478 | u8 execute_by_owner_id; |
478 | }; | 479 | }; |
479 | 480 | ||
@@ -854,6 +855,7 @@ struct acpi_bit_register_info { | |||
854 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 855 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
855 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 856 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
856 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 857 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
858 | ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ | ||
857 | ACPI_BITMASK_WAKE_STATUS) | 859 | ACPI_BITMASK_WAKE_STATUS) |
858 | 860 | ||
859 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 861 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
@@ -908,15 +910,21 @@ struct acpi_bit_register_info { | |||
908 | #define ACPI_OSI_WIN_VISTA 0x07 | 910 | #define ACPI_OSI_WIN_VISTA 0x07 |
909 | #define ACPI_OSI_WINSRV_2008 0x08 | 911 | #define ACPI_OSI_WINSRV_2008 0x08 |
910 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 | 912 | #define ACPI_OSI_WIN_VISTA_SP1 0x09 |
911 | #define ACPI_OSI_WIN_7 0x0A | 913 | #define ACPI_OSI_WIN_VISTA_SP2 0x0A |
914 | #define ACPI_OSI_WIN_7 0x0B | ||
912 | 915 | ||
913 | #define ACPI_ALWAYS_ILLEGAL 0x00 | 916 | #define ACPI_ALWAYS_ILLEGAL 0x00 |
914 | 917 | ||
915 | struct acpi_interface_info { | 918 | struct acpi_interface_info { |
916 | char *name; | 919 | char *name; |
920 | struct acpi_interface_info *next; | ||
921 | u8 flags; | ||
917 | u8 value; | 922 | u8 value; |
918 | }; | 923 | }; |
919 | 924 | ||
925 | #define ACPI_OSI_INVALID 0x01 | ||
926 | #define ACPI_OSI_DYNAMIC 0x02 | ||
927 | |||
920 | struct acpi_port_info { | 928 | struct acpi_port_info { |
921 | char *name; | 929 | char *name; |
922 | u16 start; | 930 | u16 start; |
@@ -996,7 +1004,7 @@ struct acpi_port_info { | |||
996 | struct acpi_db_method_info { | 1004 | struct acpi_db_method_info { |
997 | acpi_handle main_thread_gate; | 1005 | acpi_handle main_thread_gate; |
998 | acpi_handle thread_complete_gate; | 1006 | acpi_handle thread_complete_gate; |
999 | u32 *threads; | 1007 | acpi_thread_id *threads; |
1000 | u32 num_threads; | 1008 | u32 num_threads; |
1001 | u32 num_created; | 1009 | u32 num_created; |
1002 | u32 num_completed; | 1010 | u32 num_completed; |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 9894929a2ab..8d5c9e0a495 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -338,8 +338,8 @@ | |||
338 | * the plist contains a set of parens to allow variable-length lists. | 338 | * the plist contains a set of parens to allow variable-length lists. |
339 | * These macros are used for both the debug and non-debug versions of the code. | 339 | * These macros are used for both the debug and non-debug versions of the code. |
340 | */ | 340 | */ |
341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); | 341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); |
342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); | 342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); |
343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist | 343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist |
344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist | 344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist |
345 | 345 | ||
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 9f60ff00220..d44d3bc5b84 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -339,18 +339,6 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); | |||
339 | u32 acpi_ns_local(acpi_object_type type); | 339 | u32 acpi_ns_local(acpi_object_type type); |
340 | 340 | ||
341 | void | 341 | void |
342 | acpi_ns_report_error(const char *module_name, | ||
343 | u32 line_number, | ||
344 | const char *internal_name, acpi_status lookup_status); | ||
345 | |||
346 | void | ||
347 | acpi_ns_report_method_error(const char *module_name, | ||
348 | u32 line_number, | ||
349 | const char *message, | ||
350 | struct acpi_namespace_node *node, | ||
351 | const char *path, acpi_status lookup_status); | ||
352 | |||
353 | void | ||
354 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); | 342 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); |
355 | 343 | ||
356 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); | 344 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 54857fa87aa..bdbfaf22bd1 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -248,7 +248,7 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
248 | u32 base_byte_offset; /* Byte offset within containing object */\ | 248 | u32 base_byte_offset; /* Byte offset within containing object */\ |
249 | u32 value; /* Value to store into the Bank or Index register */\ | 249 | u32 value; /* Value to store into the Bank or Index register */\ |
250 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | 250 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ |
251 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | 251 | |
252 | 252 | ||
253 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 253 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ |
254 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ | 254 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 35df755251c..72e4183c193 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -312,8 +312,6 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list); | |||
312 | /* | 312 | /* |
313 | * uteval - object evaluation | 313 | * uteval - object evaluation |
314 | */ | 314 | */ |
315 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | ||
316 | |||
317 | acpi_status | 315 | acpi_status |
318 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | 316 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, |
319 | char *path, | 317 | char *path, |
@@ -395,6 +393,21 @@ acpi_status | |||
395 | acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); | 393 | acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length); |
396 | 394 | ||
397 | /* | 395 | /* |
396 | * utosi - Support for the _OSI predefined control method | ||
397 | */ | ||
398 | acpi_status acpi_ut_initialize_interfaces(void); | ||
399 | |||
400 | void acpi_ut_interface_terminate(void); | ||
401 | |||
402 | acpi_status acpi_ut_install_interface(acpi_string interface_name); | ||
403 | |||
404 | acpi_status acpi_ut_remove_interface(acpi_string interface_name); | ||
405 | |||
406 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name); | ||
407 | |||
408 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state); | ||
409 | |||
410 | /* | ||
398 | * utstate - Generic state creation/cache routines | 411 | * utstate - Generic state creation/cache routines |
399 | */ | 412 | */ |
400 | void | 413 | void |
@@ -473,17 +486,6 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); | |||
473 | 486 | ||
474 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); | 487 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); |
475 | 488 | ||
476 | void ACPI_INTERNAL_VAR_XFACE | ||
477 | acpi_ut_predefined_warning(const char *module_name, | ||
478 | u32 line_number, | ||
479 | char *pathname, | ||
480 | u8 node_flags, const char *format, ...); | ||
481 | |||
482 | void ACPI_INTERNAL_VAR_XFACE | ||
483 | acpi_ut_predefined_info(const char *module_name, | ||
484 | u32 line_number, | ||
485 | char *pathname, u8 node_flags, const char *format, ...); | ||
486 | |||
487 | /* Values for Base above (16=Hex, 10=Decimal) */ | 489 | /* Values for Base above (16=Hex, 10=Decimal) */ |
488 | 490 | ||
489 | #define ACPI_ANY_BASE 0 | 491 | #define ACPI_ANY_BASE 0 |
@@ -574,6 +576,32 @@ acpi_status | |||
574 | acpi_ut_create_list(char *list_name, | 576 | acpi_ut_create_list(char *list_name, |
575 | u16 object_size, struct acpi_memory_list **return_cache); | 577 | u16 object_size, struct acpi_memory_list **return_cache); |
576 | 578 | ||
577 | #endif | 579 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
580 | |||
581 | /* | ||
582 | * utxferror - various error/warning output functions | ||
583 | */ | ||
584 | void ACPI_INTERNAL_VAR_XFACE | ||
585 | acpi_ut_predefined_warning(const char *module_name, | ||
586 | u32 line_number, | ||
587 | char *pathname, | ||
588 | u8 node_flags, const char *format, ...); | ||
589 | |||
590 | void ACPI_INTERNAL_VAR_XFACE | ||
591 | acpi_ut_predefined_info(const char *module_name, | ||
592 | u32 line_number, | ||
593 | char *pathname, u8 node_flags, const char *format, ...); | ||
594 | |||
595 | void | ||
596 | acpi_ut_namespace_error(const char *module_name, | ||
597 | u32 line_number, | ||
598 | const char *internal_name, acpi_status lookup_status); | ||
599 | |||
600 | void | ||
601 | acpi_ut_method_error(const char *module_name, | ||
602 | u32 line_number, | ||
603 | const char *message, | ||
604 | struct acpi_namespace_node *node, | ||
605 | const char *path, acpi_status lookup_status); | ||
578 | 606 | ||
579 | #endif /* _ACUTILS_H */ | 607 | #endif /* _ACUTILS_H */ |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 64750ee96e2..d94dd8974b5 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -573,7 +573,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
573 | 573 | ||
574 | acpi_os_release_mutex(method_desc->method. | 574 | acpi_os_release_mutex(method_desc->method. |
575 | mutex->mutex.os_mutex); | 575 | mutex->mutex.os_mutex); |
576 | method_desc->method.mutex->mutex.thread_id = NULL; | 576 | method_desc->method.mutex->mutex.thread_id = 0; |
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index d555b374e31..6b0b5d08d97 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
300 | * we must enter this object into the namespace. The created | 300 | * we must enter this object into the namespace. The created |
301 | * object is temporary and will be deleted upon completion of | 301 | * object is temporary and will be deleted upon completion of |
302 | * the execution of this method. | 302 | * the execution of this method. |
303 | * | ||
304 | * Note 10/2010: Except for the Scope() op. This opcode does | ||
305 | * not actually create a new object, it refers to an existing | ||
306 | * object. However, for Scope(), we want to indeed open a | ||
307 | * new scope. | ||
303 | */ | 308 | */ |
304 | status = acpi_ds_load2_begin_op(walk_state, NULL); | 309 | if (op->common.aml_opcode != AML_SCOPE_OP) { |
310 | status = | ||
311 | acpi_ds_load2_begin_op(walk_state, NULL); | ||
312 | } else { | ||
313 | status = | ||
314 | acpi_ds_scope_stack_push(op->named.node, | ||
315 | op->named.node-> | ||
316 | type, walk_state); | ||
317 | if (ACPI_FAILURE(status)) { | ||
318 | return_ACPI_STATUS(status); | ||
319 | } | ||
320 | } | ||
305 | } | 321 | } |
306 | |||
307 | break; | 322 | break; |
308 | 323 | ||
309 | case AML_CLASS_EXECUTE: | 324 | case AML_CLASS_EXECUTE: |
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index 303618889da..c61c3039c31 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -95,47 +95,6 @@ acpi_status acpi_ev_initialize_events(void) | |||
95 | 95 | ||
96 | /******************************************************************************* | 96 | /******************************************************************************* |
97 | * | 97 | * |
98 | * FUNCTION: acpi_ev_install_fadt_gpes | ||
99 | * | ||
100 | * PARAMETERS: None | ||
101 | * | ||
102 | * RETURN: Status | ||
103 | * | ||
104 | * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks | ||
105 | * (0 and 1). The HW must be fully initialized at this point, | ||
106 | * including global lock support. | ||
107 | * | ||
108 | ******************************************************************************/ | ||
109 | |||
110 | acpi_status acpi_ev_install_fadt_gpes(void) | ||
111 | { | ||
112 | acpi_status status; | ||
113 | |||
114 | ACPI_FUNCTION_TRACE(ev_install_fadt_gpes); | ||
115 | |||
116 | /* Namespace must be locked */ | ||
117 | |||
118 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
119 | if (ACPI_FAILURE(status)) { | ||
120 | return (status); | ||
121 | } | ||
122 | |||
123 | /* FADT GPE Block 0 */ | ||
124 | |||
125 | (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, | ||
126 | acpi_gbl_gpe_fadt_blocks[0]); | ||
127 | |||
128 | /* FADT GPE Block 1 */ | ||
129 | |||
130 | (void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device, | ||
131 | acpi_gbl_gpe_fadt_blocks[1]); | ||
132 | |||
133 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
134 | return_ACPI_STATUS(AE_OK); | ||
135 | } | ||
136 | |||
137 | /******************************************************************************* | ||
138 | * | ||
139 | * FUNCTION: acpi_ev_install_xrupt_handlers | 98 | * FUNCTION: acpi_ev_install_xrupt_handlers |
140 | * | 99 | * |
141 | * PARAMETERS: None | 100 | * PARAMETERS: None |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 85445fb5844..020add3eee1 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -363,6 +363,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
363 | gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH); | 363 | gpe_block->gpe_count = (u16)(register_count * ACPI_GPE_REGISTER_WIDTH); |
364 | gpe_block->register_count = register_count; | 364 | gpe_block->register_count = register_count; |
365 | gpe_block->block_base_number = gpe_block_base_number; | 365 | gpe_block->block_base_number = gpe_block_base_number; |
366 | gpe_block->initialized = FALSE; | ||
366 | 367 | ||
367 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, | 368 | ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, |
368 | sizeof(struct acpi_generic_address)); | 369 | sizeof(struct acpi_generic_address)); |
@@ -385,11 +386,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
385 | return_ACPI_STATUS(status); | 386 | return_ACPI_STATUS(status); |
386 | } | 387 | } |
387 | 388 | ||
389 | acpi_all_gpes_initialized = FALSE; | ||
390 | |||
388 | /* Find all GPE methods (_Lxx or_Exx) for this block */ | 391 | /* Find all GPE methods (_Lxx or_Exx) for this block */ |
389 | 392 | ||
390 | walk_info.gpe_block = gpe_block; | 393 | walk_info.gpe_block = gpe_block; |
391 | walk_info.gpe_device = gpe_device; | 394 | walk_info.gpe_device = gpe_device; |
392 | walk_info.enable_this_gpe = FALSE; | ||
393 | walk_info.execute_by_owner_id = FALSE; | 395 | walk_info.execute_by_owner_id = FALSE; |
394 | 396 | ||
395 | status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, | 397 | status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device, |
@@ -434,35 +436,34 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
434 | ******************************************************************************/ | 436 | ******************************************************************************/ |
435 | 437 | ||
436 | acpi_status | 438 | acpi_status |
437 | acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | 439 | acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
438 | struct acpi_gpe_block_info *gpe_block) | 440 | struct acpi_gpe_block_info *gpe_block, |
441 | void *ignored) | ||
439 | { | 442 | { |
440 | acpi_status status; | 443 | acpi_status status; |
441 | struct acpi_gpe_event_info *gpe_event_info; | 444 | struct acpi_gpe_event_info *gpe_event_info; |
442 | u32 gpe_enabled_count; | 445 | u32 gpe_enabled_count; |
443 | u32 gpe_index; | 446 | u32 gpe_index; |
444 | u32 gpe_number; | ||
445 | u32 i; | 447 | u32 i; |
446 | u32 j; | 448 | u32 j; |
447 | 449 | ||
448 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); | 450 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); |
449 | 451 | ||
450 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | 452 | /* |
451 | 453 | * Ignore a null GPE block (e.g., if no GPE block 1 exists) and | |
452 | if (!gpe_block) { | 454 | * GPE blocks that have been initialized already. |
455 | */ | ||
456 | if (!gpe_block || gpe_block->initialized) { | ||
453 | return_ACPI_STATUS(AE_OK); | 457 | return_ACPI_STATUS(AE_OK); |
454 | } | 458 | } |
455 | 459 | ||
456 | /* | 460 | /* |
457 | * Enable all GPEs that have a corresponding method. Any other GPEs | 461 | * Enable all GPEs that have a corresponding method and have the |
458 | * within this block must be enabled via the acpi_enable_gpe interface. | 462 | * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block must |
463 | * be enabled via the acpi_enable_gpe() interface. | ||
459 | */ | 464 | */ |
460 | gpe_enabled_count = 0; | 465 | gpe_enabled_count = 0; |
461 | 466 | ||
462 | if (gpe_device == acpi_gbl_fadt_gpe_device) { | ||
463 | gpe_device = NULL; | ||
464 | } | ||
465 | |||
466 | for (i = 0; i < gpe_block->register_count; i++) { | 467 | for (i = 0; i < gpe_block->register_count; i++) { |
467 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 468 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
468 | 469 | ||
@@ -470,27 +471,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
470 | 471 | ||
471 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; | 472 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; |
472 | gpe_event_info = &gpe_block->event_info[gpe_index]; | 473 | gpe_event_info = &gpe_block->event_info[gpe_index]; |
473 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
474 | 474 | ||
475 | /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ | 475 | /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ |
476 | 476 | ||
477 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) { | 477 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) |
478 | || (gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { | ||
478 | continue; | 479 | continue; |
479 | } | 480 | } |
480 | 481 | ||
481 | /* | 482 | status = acpi_raw_enable_gpe(gpe_event_info); |
482 | * If the GPE has already been enabled for runtime | ||
483 | * signaling, make sure it remains enabled, but do not | ||
484 | * increment its reference counter. | ||
485 | */ | ||
486 | status = gpe_event_info->runtime_count ? | ||
487 | acpi_ev_enable_gpe(gpe_event_info) : | ||
488 | acpi_enable_gpe(gpe_device, gpe_number); | ||
489 | |||
490 | if (ACPI_FAILURE(status)) { | 483 | if (ACPI_FAILURE(status)) { |
491 | ACPI_EXCEPTION((AE_INFO, status, | 484 | ACPI_EXCEPTION((AE_INFO, status, |
492 | "Could not enable GPE 0x%02X", | 485 | "Could not enable GPE 0x%02X", |
493 | gpe_number)); | 486 | gpe_index + gpe_block->block_base_number)); |
494 | continue; | 487 | continue; |
495 | } | 488 | } |
496 | 489 | ||
@@ -504,5 +497,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
504 | gpe_enabled_count)); | 497 | gpe_enabled_count)); |
505 | } | 498 | } |
506 | 499 | ||
500 | gpe_block->initialized = TRUE; | ||
501 | |||
507 | return_ACPI_STATUS(AE_OK); | 502 | return_ACPI_STATUS(AE_OK); |
508 | } | 503 | } |
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index 3084c5de1bb..2c7def95f72 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c | |||
@@ -210,8 +210,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
210 | * | 210 | * |
211 | * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a | 211 | * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a |
212 | * result of a Load() or load_table() operation. If new GPE | 212 | * result of a Load() or load_table() operation. If new GPE |
213 | * methods have been installed, register the new methods and | 213 | * methods have been installed, register the new methods. |
214 | * enable and runtime GPEs that are associated with them. | ||
215 | * | 214 | * |
216 | ******************************************************************************/ | 215 | ******************************************************************************/ |
217 | 216 | ||
@@ -239,7 +238,6 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id) | |||
239 | walk_info.owner_id = table_owner_id; | 238 | walk_info.owner_id = table_owner_id; |
240 | walk_info.execute_by_owner_id = TRUE; | 239 | walk_info.execute_by_owner_id = TRUE; |
241 | walk_info.count = 0; | 240 | walk_info.count = 0; |
242 | walk_info.enable_this_gpe = TRUE; | ||
243 | 241 | ||
244 | /* Walk the interrupt level descriptor list */ | 242 | /* Walk the interrupt level descriptor list */ |
245 | 243 | ||
@@ -301,8 +299,6 @@ void acpi_ev_update_gpes(acpi_owner_id table_owner_id) | |||
301 | * | 299 | * |
302 | * If walk_info->execute_by_owner_id is TRUE, we only execute examine GPE methods | 300 | * If walk_info->execute_by_owner_id is TRUE, we only execute examine GPE methods |
303 | * with that owner. | 301 | * with that owner. |
304 | * If walk_info->enable_this_gpe is TRUE, the GPE that is referred to by a GPE | ||
305 | * method is immediately enabled (Used for Load/load_table operators) | ||
306 | * | 302 | * |
307 | ******************************************************************************/ | 303 | ******************************************************************************/ |
308 | 304 | ||
@@ -315,8 +311,6 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
315 | struct acpi_gpe_walk_info *walk_info = | 311 | struct acpi_gpe_walk_info *walk_info = |
316 | ACPI_CAST_PTR(struct acpi_gpe_walk_info, context); | 312 | ACPI_CAST_PTR(struct acpi_gpe_walk_info, context); |
317 | struct acpi_gpe_event_info *gpe_event_info; | 313 | struct acpi_gpe_event_info *gpe_event_info; |
318 | struct acpi_namespace_node *gpe_device; | ||
319 | acpi_status status; | ||
320 | u32 gpe_number; | 314 | u32 gpe_number; |
321 | char name[ACPI_NAME_SIZE + 1]; | 315 | char name[ACPI_NAME_SIZE + 1]; |
322 | u8 type; | 316 | u8 type; |
@@ -421,29 +415,6 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle, | |||
421 | gpe_event_info->flags |= (u8)(type | ACPI_GPE_DISPATCH_METHOD); | 415 | gpe_event_info->flags |= (u8)(type | ACPI_GPE_DISPATCH_METHOD); |
422 | gpe_event_info->dispatch.method_node = method_node; | 416 | gpe_event_info->dispatch.method_node = method_node; |
423 | 417 | ||
424 | /* | ||
425 | * Enable this GPE if requested. This only happens when during the | ||
426 | * execution of a Load or load_table operator. We have found a new | ||
427 | * GPE method and want to immediately enable the GPE if it is a | ||
428 | * runtime GPE. | ||
429 | */ | ||
430 | if (walk_info->enable_this_gpe) { | ||
431 | |||
432 | walk_info->count++; | ||
433 | gpe_device = walk_info->gpe_device; | ||
434 | |||
435 | if (gpe_device == acpi_gbl_fadt_gpe_device) { | ||
436 | gpe_device = NULL; | ||
437 | } | ||
438 | |||
439 | status = acpi_enable_gpe(gpe_device, gpe_number); | ||
440 | if (ACPI_FAILURE(status)) { | ||
441 | ACPI_EXCEPTION((AE_INFO, status, | ||
442 | "Could not enable GPE 0x%02X", | ||
443 | gpe_number)); | ||
444 | } | ||
445 | } | ||
446 | |||
447 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 418 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
448 | "Registered GPE method %s as GPE number 0x%.2X\n", | 419 | "Registered GPE method %s as GPE number 0x%.2X\n", |
449 | name, gpe_number)); | 420 | name, gpe_number)); |
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index df0aea9a8cf..fcaed9fb44f 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
@@ -553,7 +553,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
553 | acpi_gbl_global_lock_acquired = FALSE; | 553 | acpi_gbl_global_lock_acquired = FALSE; |
554 | 554 | ||
555 | /* Release the local GL mutex */ | 555 | /* Release the local GL mutex */ |
556 | acpi_ev_global_lock_thread_id = NULL; | 556 | acpi_ev_global_lock_thread_id = 0; |
557 | acpi_ev_global_lock_acquired = 0; | 557 | acpi_ev_global_lock_acquired = 0; |
558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); | 558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
559 | return_ACPI_STATUS(status); | 559 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index f40d271bf56..0b47a6dc929 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -289,8 +289,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Get the PCI device and function numbers from the _ADR object contained | 292 | * Get the PCI device and function numbers from the _ADR object |
293 | * in the parent's scope. | 293 | * contained in the parent's scope. |
294 | */ | 294 | */ |
295 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, | 295 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, |
296 | pci_device_node, &pci_value); | 296 | pci_device_node, &pci_value); |
@@ -320,9 +320,15 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
320 | pci_id->bus = ACPI_LOWORD(pci_value); | 320 | pci_id->bus = ACPI_LOWORD(pci_value); |
321 | } | 321 | } |
322 | 322 | ||
323 | /* Complete this device's pci_id */ | 323 | /* Complete/update the PCI ID for this device */ |
324 | 324 | ||
325 | acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id); | 325 | status = |
326 | acpi_hw_derive_pci_id(pci_id, pci_root_node, | ||
327 | region_obj->region.node); | ||
328 | if (ACPI_FAILURE(status)) { | ||
329 | ACPI_FREE(pci_id); | ||
330 | return_ACPI_STATUS(status); | ||
331 | } | ||
326 | 332 | ||
327 | *region_context = pci_id; | 333 | *region_context = pci_id; |
328 | return_ACPI_STATUS(AE_OK); | 334 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 14e48add32f..36af222cac6 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -726,15 +726,16 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
726 | (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); | 726 | (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); |
727 | 727 | ||
728 | /* | 728 | /* |
729 | * If the GPE is associated with a method and it cannot wake up the | 729 | * If the GPE is associated with a method, it might have been enabled |
730 | * system from sleep states, it was enabled automatically during | 730 | * automatically during initialization, in which case it has to be |
731 | * initialization, so it has to be disabled now to avoid spurious | 731 | * disabled now to avoid spurious execution of the handler. |
732 | * execution of the handler. | ||
733 | */ | 732 | */ |
734 | 733 | ||
735 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) | 734 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) |
736 | && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) | 735 | && gpe_event_info->runtime_count) { |
736 | handler->orig_enabled = 1; | ||
737 | (void)acpi_raw_disable_gpe(gpe_event_info); | 737 | (void)acpi_raw_disable_gpe(gpe_event_info); |
738 | } | ||
738 | 739 | ||
739 | /* Install the handler */ | 740 | /* Install the handler */ |
740 | 741 | ||
@@ -837,13 +838,13 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
837 | gpe_event_info->flags |= handler->orig_flags; | 838 | gpe_event_info->flags |= handler->orig_flags; |
838 | 839 | ||
839 | /* | 840 | /* |
840 | * If the GPE was previously associated with a method and it cannot wake | 841 | * If the GPE was previously associated with a method and it was |
841 | * up the system from sleep states, it should be enabled at this point | 842 | * enabled, it should be enabled at this point to restore the |
842 | * to restore the post-initialization configuration. | 843 | * post-initialization configuration. |
843 | */ | 844 | */ |
844 | 845 | ||
845 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) | 846 | if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD) |
846 | && !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) | 847 | && handler->orig_enabled) |
847 | (void)acpi_raw_enable_gpe(gpe_event_info); | 848 | (void)acpi_raw_enable_gpe(gpe_event_info); |
848 | 849 | ||
849 | /* Now we can free the handler object */ | 850 | /* Now we can free the handler object */ |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 304825528d4..a1dabe3fd8a 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -379,21 +379,12 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number) | |||
379 | /* Ensure that we have a valid GPE number */ | 379 | /* Ensure that we have a valid GPE number */ |
380 | 380 | ||
381 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 381 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
382 | if (!gpe_event_info) { | 382 | if (gpe_event_info) { |
383 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
384 | } else { | ||
383 | status = AE_BAD_PARAMETER; | 385 | status = AE_BAD_PARAMETER; |
384 | goto unlock_and_exit; | ||
385 | } | ||
386 | |||
387 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { | ||
388 | goto unlock_and_exit; | ||
389 | } | 386 | } |
390 | 387 | ||
391 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | ||
392 | if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) { | ||
393 | (void)acpi_raw_disable_gpe(gpe_event_info); | ||
394 | } | ||
395 | |||
396 | unlock_and_exit: | ||
397 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 388 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
398 | return_ACPI_STATUS(status); | 389 | return_ACPI_STATUS(status); |
399 | } | 390 | } |
@@ -651,7 +642,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
651 | struct acpi_generic_address *gpe_block_address, | 642 | struct acpi_generic_address *gpe_block_address, |
652 | u32 register_count, u32 interrupt_number) | 643 | u32 register_count, u32 interrupt_number) |
653 | { | 644 | { |
654 | acpi_status status; | 645 | acpi_status status = AE_OK; |
655 | union acpi_operand_object *obj_desc; | 646 | union acpi_operand_object *obj_desc; |
656 | struct acpi_namespace_node *node; | 647 | struct acpi_namespace_node *node; |
657 | struct acpi_gpe_block_info *gpe_block; | 648 | struct acpi_gpe_block_info *gpe_block; |
@@ -715,10 +706,6 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
715 | 706 | ||
716 | obj_desc->device.gpe_block = gpe_block; | 707 | obj_desc->device.gpe_block = gpe_block; |
717 | 708 | ||
718 | /* Enable the runtime GPEs in the new block */ | ||
719 | |||
720 | status = acpi_ev_initialize_gpe_block(node, gpe_block); | ||
721 | |||
722 | unlock_and_exit: | 709 | unlock_and_exit: |
723 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 710 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
724 | return_ACPI_STATUS(status); | 711 | return_ACPI_STATUS(status); |
@@ -924,3 +911,43 @@ acpi_status acpi_enable_all_runtime_gpes(void) | |||
924 | 911 | ||
925 | return_ACPI_STATUS(status); | 912 | return_ACPI_STATUS(status); |
926 | } | 913 | } |
914 | |||
915 | /****************************************************************************** | ||
916 | * | ||
917 | * FUNCTION: acpi_update_gpes | ||
918 | * | ||
919 | * PARAMETERS: None | ||
920 | * | ||
921 | * RETURN: None | ||
922 | * | ||
923 | * DESCRIPTION: Enable all GPEs that have associated _Lxx or _Exx methods and | ||
924 | * are not pointed to by any device _PRW methods indicating that | ||
925 | * these GPEs are generally intended for system or device wakeup | ||
926 | * (such GPEs have to be enabled directly when the devices whose | ||
927 | * _PRW methods point to them are set up for wakeup signaling). | ||
928 | * | ||
929 | ******************************************************************************/ | ||
930 | |||
931 | acpi_status acpi_update_gpes(void) | ||
932 | { | ||
933 | acpi_status status; | ||
934 | |||
935 | ACPI_FUNCTION_TRACE(acpi_update_gpes); | ||
936 | |||
937 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
938 | if (ACPI_FAILURE(status)) { | ||
939 | return_ACPI_STATUS(status); | ||
940 | } else if (acpi_all_gpes_initialized) { | ||
941 | goto unlock; | ||
942 | } | ||
943 | |||
944 | status = acpi_ev_walk_gpe_list(acpi_ev_initialize_gpe_block, NULL); | ||
945 | if (ACPI_SUCCESS(status)) { | ||
946 | acpi_all_gpes_initialized = TRUE; | ||
947 | } | ||
948 | |||
949 | unlock: | ||
950 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
951 | |||
952 | return_ACPI_STATUS(status); | ||
953 | } | ||
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index 541cbc1544d..ce9314f7945 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -64,6 +64,12 @@ ACPI_MODULE_NAME("evxfregn") | |||
64 | * | 64 | * |
65 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. | 65 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. |
66 | * | 66 | * |
67 | * NOTE: This function should only be called after acpi_enable_subsystem has | ||
68 | * been called. This is because any _REG methods associated with the Space ID | ||
69 | * are executed here, and these methods can only be safely executed after | ||
70 | * the default handlers have been installed and the hardware has been | ||
71 | * initialized (via acpi_enable_subsystem.) | ||
72 | * | ||
67 | ******************************************************************************/ | 73 | ******************************************************************************/ |
68 | acpi_status | 74 | acpi_status |
69 | acpi_install_address_space_handler(acpi_handle device, | 75 | acpi_install_address_space_handler(acpi_handle device, |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 047217303a4..38293fd3e08 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -119,8 +119,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Exit now for SMBus or IPMI address space, it has a non-linear address space | 122 | * Exit now for SMBus or IPMI address space, it has a non-linear |
123 | * and the request cannot be directly validated | 123 | * address space and the request cannot be directly validated |
124 | */ | 124 | */ |
125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || | 125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS || |
126 | rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { | 126 | rgn_desc->region.space_id == ACPI_ADR_SPACE_IPMI) { |
@@ -147,8 +147,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
147 | * (Region length is specified in bytes) | 147 | * (Region length is specified in bytes) |
148 | */ | 148 | */ |
149 | if (rgn_desc->region.length < | 149 | if (rgn_desc->region.length < |
150 | (obj_desc->common_field.base_byte_offset + | 150 | (obj_desc->common_field.base_byte_offset + field_datum_byte_offset + |
151 | field_datum_byte_offset + | ||
152 | obj_desc->common_field.access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
153 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
154 | /* | 153 | /* |
@@ -680,6 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
680 | u32 buffer_tail_bits; | 679 | u32 buffer_tail_bits; |
681 | u32 datum_count; | 680 | u32 datum_count; |
682 | u32 field_datum_count; | 681 | u32 field_datum_count; |
682 | u32 access_bit_width; | ||
683 | u32 i; | 683 | u32 i; |
684 | 684 | ||
685 | ACPI_FUNCTION_TRACE(ex_extract_from_field); | 685 | ACPI_FUNCTION_TRACE(ex_extract_from_field); |
@@ -694,16 +694,36 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
694 | 694 | ||
695 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); | 695 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); |
696 | } | 696 | } |
697 | |||
697 | ACPI_MEMSET(buffer, 0, buffer_length); | 698 | ACPI_MEMSET(buffer, 0, buffer_length); |
699 | access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); | ||
700 | |||
701 | /* Handle the simple case here */ | ||
702 | |||
703 | if ((obj_desc->common_field.start_field_bit_offset == 0) && | ||
704 | (obj_desc->common_field.bit_length == access_bit_width)) { | ||
705 | status = acpi_ex_field_datum_io(obj_desc, 0, buffer, ACPI_READ); | ||
706 | return_ACPI_STATUS(status); | ||
707 | } | ||
708 | |||
709 | /* TBD: Move to common setup code */ | ||
710 | |||
711 | /* Field algorithm is limited to sizeof(u64), truncate if needed */ | ||
712 | |||
713 | if (obj_desc->common_field.access_byte_width > sizeof(u64)) { | ||
714 | obj_desc->common_field.access_byte_width = sizeof(u64); | ||
715 | access_bit_width = sizeof(u64) * 8; | ||
716 | } | ||
698 | 717 | ||
699 | /* Compute the number of datums (access width data items) */ | 718 | /* Compute the number of datums (access width data items) */ |
700 | 719 | ||
701 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 720 | datum_count = |
702 | obj_desc->common_field.access_bit_width); | 721 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
722 | access_bit_width); | ||
723 | |||
703 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 724 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
704 | obj_desc->common_field. | 725 | obj_desc->common_field. |
705 | start_field_bit_offset, | 726 | start_field_bit_offset, |
706 | obj_desc->common_field. | ||
707 | access_bit_width); | 727 | access_bit_width); |
708 | 728 | ||
709 | /* Priming read from the field */ | 729 | /* Priming read from the field */ |
@@ -738,12 +758,11 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
738 | * This avoids the differences in behavior between different compilers | 758 | * This avoids the differences in behavior between different compilers |
739 | * concerning shift values larger than the target data width. | 759 | * concerning shift values larger than the target data width. |
740 | */ | 760 | */ |
741 | if ((obj_desc->common_field.access_bit_width - | 761 | if (access_bit_width - |
742 | obj_desc->common_field.start_field_bit_offset) < | 762 | obj_desc->common_field.start_field_bit_offset < |
743 | ACPI_INTEGER_BIT_SIZE) { | 763 | ACPI_INTEGER_BIT_SIZE) { |
744 | merged_datum |= | 764 | merged_datum |= |
745 | raw_datum << (obj_desc->common_field. | 765 | raw_datum << (access_bit_width - |
746 | access_bit_width - | ||
747 | obj_desc->common_field. | 766 | obj_desc->common_field. |
748 | start_field_bit_offset); | 767 | start_field_bit_offset); |
749 | } | 768 | } |
@@ -765,8 +784,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
765 | 784 | ||
766 | /* Mask off any extra bits in the last datum */ | 785 | /* Mask off any extra bits in the last datum */ |
767 | 786 | ||
768 | buffer_tail_bits = obj_desc->common_field.bit_length % | 787 | buffer_tail_bits = obj_desc->common_field.bit_length % access_bit_width; |
769 | obj_desc->common_field.access_bit_width; | ||
770 | if (buffer_tail_bits) { | 788 | if (buffer_tail_bits) { |
771 | merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); | 789 | merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
772 | } | 790 | } |
@@ -798,6 +816,7 @@ acpi_status | |||
798 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | 816 | acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, |
799 | void *buffer, u32 buffer_length) | 817 | void *buffer, u32 buffer_length) |
800 | { | 818 | { |
819 | void *new_buffer; | ||
801 | acpi_status status; | 820 | acpi_status status; |
802 | u64 mask; | 821 | u64 mask; |
803 | u64 width_mask; | 822 | u64 width_mask; |
@@ -808,9 +827,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
808 | u32 buffer_tail_bits; | 827 | u32 buffer_tail_bits; |
809 | u32 datum_count; | 828 | u32 datum_count; |
810 | u32 field_datum_count; | 829 | u32 field_datum_count; |
811 | u32 i; | 830 | u32 access_bit_width; |
812 | u32 required_length; | 831 | u32 required_length; |
813 | void *new_buffer; | 832 | u32 i; |
814 | 833 | ||
815 | ACPI_FUNCTION_TRACE(ex_insert_into_field); | 834 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
816 | 835 | ||
@@ -844,17 +863,24 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
844 | buffer_length = required_length; | 863 | buffer_length = required_length; |
845 | } | 864 | } |
846 | 865 | ||
866 | /* TBD: Move to common setup code */ | ||
867 | |||
868 | /* Algo is limited to sizeof(u64), so cut the access_byte_width */ | ||
869 | if (obj_desc->common_field.access_byte_width > sizeof(u64)) { | ||
870 | obj_desc->common_field.access_byte_width = sizeof(u64); | ||
871 | } | ||
872 | |||
873 | access_bit_width = ACPI_MUL_8(obj_desc->common_field.access_byte_width); | ||
874 | |||
847 | /* | 875 | /* |
848 | * Create the bitmasks used for bit insertion. | 876 | * Create the bitmasks used for bit insertion. |
849 | * Note: This if/else is used to bypass compiler differences with the | 877 | * Note: This if/else is used to bypass compiler differences with the |
850 | * shift operator | 878 | * shift operator |
851 | */ | 879 | */ |
852 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { | 880 | if (access_bit_width == ACPI_INTEGER_BIT_SIZE) { |
853 | width_mask = ACPI_UINT64_MAX; | 881 | width_mask = ACPI_UINT64_MAX; |
854 | } else { | 882 | } else { |
855 | width_mask = | 883 | width_mask = ACPI_MASK_BITS_ABOVE(access_bit_width); |
856 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. | ||
857 | access_bit_width); | ||
858 | } | 884 | } |
859 | 885 | ||
860 | mask = width_mask & | 886 | mask = width_mask & |
@@ -863,12 +889,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
863 | /* Compute the number of datums (access width data items) */ | 889 | /* Compute the number of datums (access width data items) */ |
864 | 890 | ||
865 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 891 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
866 | obj_desc->common_field.access_bit_width); | 892 | access_bit_width); |
867 | 893 | ||
868 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 894 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
869 | obj_desc->common_field. | 895 | obj_desc->common_field. |
870 | start_field_bit_offset, | 896 | start_field_bit_offset, |
871 | obj_desc->common_field. | ||
872 | access_bit_width); | 897 | access_bit_width); |
873 | 898 | ||
874 | /* Get initial Datum from the input buffer */ | 899 | /* Get initial Datum from the input buffer */ |
@@ -905,12 +930,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
905 | * This avoids the differences in behavior between different compilers | 930 | * This avoids the differences in behavior between different compilers |
906 | * concerning shift values larger than the target data width. | 931 | * concerning shift values larger than the target data width. |
907 | */ | 932 | */ |
908 | if ((obj_desc->common_field.access_bit_width - | 933 | if ((access_bit_width - |
909 | obj_desc->common_field.start_field_bit_offset) < | 934 | obj_desc->common_field.start_field_bit_offset) < |
910 | ACPI_INTEGER_BIT_SIZE) { | 935 | ACPI_INTEGER_BIT_SIZE) { |
911 | merged_datum = | 936 | merged_datum = |
912 | raw_datum >> (obj_desc->common_field. | 937 | raw_datum >> (access_bit_width - |
913 | access_bit_width - | ||
914 | obj_desc->common_field. | 938 | obj_desc->common_field. |
915 | start_field_bit_offset); | 939 | start_field_bit_offset); |
916 | } else { | 940 | } else { |
@@ -929,6 +953,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
929 | ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, | 953 | ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset, |
930 | ACPI_MIN(obj_desc->common_field.access_byte_width, | 954 | ACPI_MIN(obj_desc->common_field.access_byte_width, |
931 | buffer_length - buffer_offset)); | 955 | buffer_length - buffer_offset)); |
956 | |||
932 | merged_datum |= | 957 | merged_datum |= |
933 | raw_datum << obj_desc->common_field.start_field_bit_offset; | 958 | raw_datum << obj_desc->common_field.start_field_bit_offset; |
934 | } | 959 | } |
@@ -937,7 +962,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
937 | 962 | ||
938 | buffer_tail_bits = (obj_desc->common_field.bit_length + | 963 | buffer_tail_bits = (obj_desc->common_field.bit_length + |
939 | obj_desc->common_field.start_field_bit_offset) % | 964 | obj_desc->common_field.start_field_bit_offset) % |
940 | obj_desc->common_field.access_bit_width; | 965 | access_bit_width; |
941 | if (buffer_tail_bits) { | 966 | if (buffer_tail_bits) { |
942 | mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); | 967 | mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits); |
943 | } | 968 | } |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index f73be97043c..6af14e43f83 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -336,7 +336,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | |||
336 | 336 | ||
337 | /* Clear mutex info */ | 337 | /* Clear mutex info */ |
338 | 338 | ||
339 | obj_desc->mutex.thread_id = NULL; | 339 | obj_desc->mutex.thread_id = 0; |
340 | return_ACPI_STATUS(status); | 340 | return_ACPI_STATUS(status); |
341 | } | 341 | } |
342 | 342 | ||
@@ -393,10 +393,10 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && | 393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && |
394 | (obj_desc != acpi_gbl_global_lock_mutex)) { | 394 | (obj_desc != acpi_gbl_global_lock_mutex)) { |
395 | ACPI_ERROR((AE_INFO, | 395 | ACPI_ERROR((AE_INFO, |
396 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", | 396 | "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", |
397 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), | 397 | (u32)walk_state->thread->thread_id, |
398 | acpi_ut_get_node_name(obj_desc->mutex.node), | 398 | acpi_ut_get_node_name(obj_desc->mutex.node), |
399 | ACPI_CAST_PTR(void, owner_thread->thread_id))); | 399 | (u32)owner_thread->thread_id)); |
400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
401 | } | 401 | } |
402 | 402 | ||
@@ -488,7 +488,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
488 | /* Mark mutex unowned */ | 488 | /* Mark mutex unowned */ |
489 | 489 | ||
490 | obj_desc->mutex.owner_thread = NULL; | 490 | obj_desc->mutex.owner_thread = NULL; |
491 | obj_desc->mutex.thread_id = NULL; | 491 | obj_desc->mutex.thread_id = 0; |
492 | 492 | ||
493 | /* Update Thread sync_level (Last mutex is the important one) */ | 493 | /* Update Thread sync_level (Last mutex is the important one) */ |
494 | 494 | ||
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 98a331d2249..7aae29f73d3 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -355,12 +355,10 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
355 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 355 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
356 | } | 356 | } |
357 | 357 | ||
358 | /* Setup width (access granularity) fields */ | 358 | /* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */ |
359 | 359 | ||
360 | obj_desc->common_field.access_byte_width = (u8) | 360 | obj_desc->common_field.access_byte_width = (u8) |
361 | ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */ | 361 | ACPI_DIV_8(access_bit_width); |
362 | |||
363 | obj_desc->common_field.access_bit_width = (u8) access_bit_width; | ||
364 | 362 | ||
365 | /* | 363 | /* |
366 | * base_byte_offset is the address of the start of the field within the | 364 | * base_byte_offset is the address of the start of the field within the |
@@ -405,8 +403,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
405 | { | 403 | { |
406 | union acpi_operand_object *obj_desc; | 404 | union acpi_operand_object *obj_desc; |
407 | union acpi_operand_object *second_desc = NULL; | 405 | union acpi_operand_object *second_desc = NULL; |
408 | u32 type; | ||
409 | acpi_status status; | 406 | acpi_status status; |
407 | u32 access_byte_width; | ||
408 | u32 type; | ||
410 | 409 | ||
411 | ACPI_FUNCTION_TRACE(ex_prep_field_value); | 410 | ACPI_FUNCTION_TRACE(ex_prep_field_value); |
412 | 411 | ||
@@ -421,8 +420,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
421 | type = acpi_ns_get_type(info->region_node); | 420 | type = acpi_ns_get_type(info->region_node); |
422 | if (type != ACPI_TYPE_REGION) { | 421 | if (type != ACPI_TYPE_REGION) { |
423 | ACPI_ERROR((AE_INFO, | 422 | ACPI_ERROR((AE_INFO, |
424 | "Needed Region, found type 0x%X (%s)", | 423 | "Needed Region, found type 0x%X (%s)", type, |
425 | type, acpi_ut_get_type_name(type))); | 424 | acpi_ut_get_type_name(type))); |
426 | 425 | ||
427 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 426 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
428 | } | 427 | } |
@@ -438,7 +437,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
438 | /* Initialize areas of the object that are common to all fields */ | 437 | /* Initialize areas of the object that are common to all fields */ |
439 | 438 | ||
440 | obj_desc->common_field.node = info->field_node; | 439 | obj_desc->common_field.node = info->field_node; |
441 | status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags, | 440 | status = acpi_ex_prep_common_field_object(obj_desc, |
441 | info->field_flags, | ||
442 | info->attribute, | 442 | info->attribute, |
443 | info->field_bit_position, | 443 | info->field_bit_position, |
444 | info->field_bit_length); | 444 | info->field_bit_length); |
@@ -455,26 +455,25 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
455 | obj_desc->field.region_obj = | 455 | obj_desc->field.region_obj = |
456 | acpi_ns_get_attached_object(info->region_node); | 456 | acpi_ns_get_attached_object(info->region_node); |
457 | 457 | ||
458 | /* An additional reference for the container */ | 458 | /* Allow full data read from EC address space */ |
459 | 459 | ||
460 | acpi_ut_add_reference(obj_desc->field.region_obj); | 460 | if ((obj_desc->field.region_obj->region.space_id == |
461 | ACPI_ADR_SPACE_EC) | ||
462 | && (obj_desc->common_field.bit_length > 8)) { | ||
463 | access_byte_width = | ||
464 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field. | ||
465 | bit_length); | ||
466 | |||
467 | /* Maximum byte width supported is 255 */ | ||
461 | 468 | ||
462 | /* allow full data read from EC address space */ | 469 | if (access_byte_width < 256) { |
463 | if (obj_desc->field.region_obj->region.space_id == | ||
464 | ACPI_ADR_SPACE_EC) { | ||
465 | if (obj_desc->common_field.bit_length > 8) { | ||
466 | unsigned width = | ||
467 | ACPI_ROUND_BITS_UP_TO_BYTES( | ||
468 | obj_desc->common_field.bit_length); | ||
469 | // access_bit_width is u8, don't overflow it | ||
470 | if (width > 8) | ||
471 | width = 8; | ||
472 | obj_desc->common_field.access_byte_width = | 470 | obj_desc->common_field.access_byte_width = |
473 | width; | 471 | (u8)access_byte_width; |
474 | obj_desc->common_field.access_bit_width = | ||
475 | 8 * width; | ||
476 | } | 472 | } |
477 | } | 473 | } |
474 | /* An additional reference for the container */ | ||
475 | |||
476 | acpi_ut_add_reference(obj_desc->field.region_obj); | ||
478 | 477 | ||
479 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 478 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
480 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", | 479 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 8819d2ac5ae..de17e10da0e 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -353,7 +353,6 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
353 | acpi_status status = AE_OK; | 353 | acpi_status status = AE_OK; |
354 | struct acpi_pci_id *pci_id; | 354 | struct acpi_pci_id *pci_id; |
355 | u16 pci_register; | 355 | u16 pci_register; |
356 | u32 value32; | ||
357 | 356 | ||
358 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); | 357 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
359 | 358 | ||
@@ -381,8 +380,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
381 | case ACPI_READ: | 380 | case ACPI_READ: |
382 | 381 | ||
383 | status = acpi_os_read_pci_configuration(pci_id, pci_register, | 382 | status = acpi_os_read_pci_configuration(pci_id, pci_register, |
384 | &value32, bit_width); | 383 | value, bit_width); |
385 | *value = value32; | ||
386 | break; | 384 | break; |
387 | 385 | ||
388 | case ACPI_WRITE: | 386 | case ACPI_WRITE: |
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 74c24d517f8..4093522eed4 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -109,7 +109,7 @@ void acpi_ex_enter_interpreter(void) | |||
109 | * | 109 | * |
110 | * DESCRIPTION: Reacquire the interpreter execution region from within the | 110 | * DESCRIPTION: Reacquire the interpreter execution region from within the |
111 | * interpreter code. Failure to enter the interpreter region is a | 111 | * interpreter code. Failure to enter the interpreter region is a |
112 | * fatal system error. Used in conjuction with | 112 | * fatal system error. Used in conjunction with |
113 | * relinquish_interpreter | 113 | * relinquish_interpreter |
114 | * | 114 | * |
115 | ******************************************************************************/ | 115 | ******************************************************************************/ |
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c new file mode 100644 index 00000000000..ad21c7d8bf4 --- /dev/null +++ b/drivers/acpi/acpica/hwpci.c | |||
@@ -0,0 +1,412 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: hwpci - Obtain PCI bus, device, and function numbers | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | |||
47 | #define _COMPONENT ACPI_NAMESPACE | ||
48 | ACPI_MODULE_NAME("hwpci") | ||
49 | |||
50 | /* PCI configuration space values */ | ||
51 | #define PCI_CFG_HEADER_TYPE_REG 0x0E | ||
52 | #define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18 | ||
53 | #define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19 | ||
54 | /* PCI header values */ | ||
55 | #define PCI_HEADER_TYPE_MASK 0x7F | ||
56 | #define PCI_TYPE_BRIDGE 0x01 | ||
57 | #define PCI_TYPE_CARDBUS_BRIDGE 0x02 | ||
58 | typedef struct acpi_pci_device { | ||
59 | acpi_handle device; | ||
60 | struct acpi_pci_device *next; | ||
61 | |||
62 | } acpi_pci_device; | ||
63 | |||
64 | /* Local prototypes */ | ||
65 | |||
66 | static acpi_status | ||
67 | acpi_hw_build_pci_list(acpi_handle root_pci_device, | ||
68 | acpi_handle pci_region, | ||
69 | struct acpi_pci_device **return_list_head); | ||
70 | |||
71 | static acpi_status | ||
72 | acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, | ||
73 | struct acpi_pci_device *list_head); | ||
74 | |||
75 | static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head); | ||
76 | |||
77 | static acpi_status | ||
78 | acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, | ||
79 | acpi_handle pci_device, | ||
80 | u16 *bus_number, u8 *is_bridge); | ||
81 | |||
82 | /******************************************************************************* | ||
83 | * | ||
84 | * FUNCTION: acpi_hw_derive_pci_id | ||
85 | * | ||
86 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
87 | * modified by this function. | ||
88 | * root_pci_device - A handle to a PCI device object. This | ||
89 | * object must be a PCI Root Bridge having a | ||
90 | * _HID value of either PNP0A03 or PNP0A08 | ||
91 | * pci_region - A handle to a PCI configuration space | ||
92 | * Operation Region being initialized | ||
93 | * | ||
94 | * RETURN: Status | ||
95 | * | ||
96 | * DESCRIPTION: This function derives a full PCI ID for a PCI device, | ||
97 | * consisting of a Segment number, Bus number, Device number, | ||
98 | * and function code. | ||
99 | * | ||
100 | * The PCI hardware dynamically configures PCI bus numbers | ||
101 | * depending on the bus topology discovered during system | ||
102 | * initialization. This function is invoked during configuration | ||
103 | * of a PCI_Config Operation Region in order to (possibly) update | ||
104 | * the Bus/Device/Function numbers in the pci_id with the actual | ||
105 | * values as determined by the hardware and operating system | ||
106 | * configuration. | ||
107 | * | ||
108 | * The pci_id parameter is initially populated during the Operation | ||
109 | * Region initialization. This function is then called, and is | ||
110 | * will make any necessary modifications to the Bus, Device, or | ||
111 | * Function number PCI ID subfields as appropriate for the | ||
112 | * current hardware and OS configuration. | ||
113 | * | ||
114 | * NOTE: Created 08/2010. Replaces the previous OSL acpi_os_derive_pci_id | ||
115 | * interface since this feature is OS-independent. This module | ||
116 | * specifically avoids any use of recursion by building a local | ||
117 | * temporary device list. | ||
118 | * | ||
119 | ******************************************************************************/ | ||
120 | |||
121 | acpi_status | ||
122 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, | ||
123 | acpi_handle root_pci_device, acpi_handle pci_region) | ||
124 | { | ||
125 | acpi_status status; | ||
126 | struct acpi_pci_device *list_head = NULL; | ||
127 | |||
128 | ACPI_FUNCTION_TRACE(hw_derive_pci_id); | ||
129 | |||
130 | if (!pci_id) { | ||
131 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
132 | } | ||
133 | |||
134 | /* Build a list of PCI devices, from pci_region up to root_pci_device */ | ||
135 | |||
136 | status = | ||
137 | acpi_hw_build_pci_list(root_pci_device, pci_region, &list_head); | ||
138 | if (ACPI_SUCCESS(status)) { | ||
139 | |||
140 | /* Walk the list, updating the PCI device/function/bus numbers */ | ||
141 | |||
142 | status = acpi_hw_process_pci_list(pci_id, list_head); | ||
143 | } | ||
144 | |||
145 | /* Always delete the list */ | ||
146 | |||
147 | acpi_hw_delete_pci_list(list_head); | ||
148 | return_ACPI_STATUS(status); | ||
149 | } | ||
150 | |||
151 | /******************************************************************************* | ||
152 | * | ||
153 | * FUNCTION: acpi_hw_build_pci_list | ||
154 | * | ||
155 | * PARAMETERS: root_pci_device - A handle to a PCI device object. This | ||
156 | * object is guaranteed to be a PCI Root | ||
157 | * Bridge having a _HID value of either | ||
158 | * PNP0A03 or PNP0A08 | ||
159 | * pci_region - A handle to the PCI configuration space | ||
160 | * Operation Region | ||
161 | * return_list_head - Where the PCI device list is returned | ||
162 | * | ||
163 | * RETURN: Status | ||
164 | * | ||
165 | * DESCRIPTION: Builds a list of devices from the input PCI region up to the | ||
166 | * Root PCI device for this namespace subtree. | ||
167 | * | ||
168 | ******************************************************************************/ | ||
169 | |||
170 | static acpi_status | ||
171 | acpi_hw_build_pci_list(acpi_handle root_pci_device, | ||
172 | acpi_handle pci_region, | ||
173 | struct acpi_pci_device **return_list_head) | ||
174 | { | ||
175 | acpi_handle current_device; | ||
176 | acpi_handle parent_device; | ||
177 | acpi_status status; | ||
178 | struct acpi_pci_device *list_element; | ||
179 | struct acpi_pci_device *list_head = NULL; | ||
180 | |||
181 | /* | ||
182 | * Ascend namespace branch until the root_pci_device is reached, building | ||
183 | * a list of device nodes. Loop will exit when either the PCI device is | ||
184 | * found, or the root of the namespace is reached. | ||
185 | */ | ||
186 | current_device = pci_region; | ||
187 | while (1) { | ||
188 | status = acpi_get_parent(current_device, &parent_device); | ||
189 | if (ACPI_FAILURE(status)) { | ||
190 | return (status); | ||
191 | } | ||
192 | |||
193 | /* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */ | ||
194 | |||
195 | if (parent_device == root_pci_device) { | ||
196 | *return_list_head = list_head; | ||
197 | return (AE_OK); | ||
198 | } | ||
199 | |||
200 | list_element = ACPI_ALLOCATE(sizeof(struct acpi_pci_device)); | ||
201 | if (!list_element) { | ||
202 | return (AE_NO_MEMORY); | ||
203 | } | ||
204 | |||
205 | /* Put new element at the head of the list */ | ||
206 | |||
207 | list_element->next = list_head; | ||
208 | list_element->device = parent_device; | ||
209 | list_head = list_element; | ||
210 | |||
211 | current_device = parent_device; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | /******************************************************************************* | ||
216 | * | ||
217 | * FUNCTION: acpi_hw_process_pci_list | ||
218 | * | ||
219 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
220 | * modified by this function. | ||
221 | * list_head - Device list created by | ||
222 | * acpi_hw_build_pci_list | ||
223 | * | ||
224 | * RETURN: Status | ||
225 | * | ||
226 | * DESCRIPTION: Walk downward through the PCI device list, getting the device | ||
227 | * info for each, via the PCI configuration space and updating | ||
228 | * the PCI ID as necessary. Deletes the list during traversal. | ||
229 | * | ||
230 | ******************************************************************************/ | ||
231 | |||
232 | static acpi_status | ||
233 | acpi_hw_process_pci_list(struct acpi_pci_id *pci_id, | ||
234 | struct acpi_pci_device *list_head) | ||
235 | { | ||
236 | acpi_status status = AE_OK; | ||
237 | struct acpi_pci_device *info; | ||
238 | u16 bus_number; | ||
239 | u8 is_bridge = TRUE; | ||
240 | |||
241 | ACPI_FUNCTION_NAME(hw_process_pci_list); | ||
242 | |||
243 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
244 | "Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n", | ||
245 | pci_id->segment, pci_id->bus, pci_id->device, | ||
246 | pci_id->function)); | ||
247 | |||
248 | bus_number = pci_id->bus; | ||
249 | |||
250 | /* | ||
251 | * Descend down the namespace tree, collecting PCI device, function, | ||
252 | * and bus numbers. bus_number is only important for PCI bridges. | ||
253 | * Algorithm: As we descend the tree, use the last valid PCI device, | ||
254 | * function, and bus numbers that are discovered, and assign them | ||
255 | * to the PCI ID for the target device. | ||
256 | */ | ||
257 | info = list_head; | ||
258 | while (info) { | ||
259 | status = acpi_hw_get_pci_device_info(pci_id, info->device, | ||
260 | &bus_number, &is_bridge); | ||
261 | if (ACPI_FAILURE(status)) { | ||
262 | return_ACPI_STATUS(status); | ||
263 | } | ||
264 | |||
265 | info = info->next; | ||
266 | } | ||
267 | |||
268 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
269 | "Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X " | ||
270 | "Status %X BusNumber %X IsBridge %X\n", | ||
271 | pci_id->segment, pci_id->bus, pci_id->device, | ||
272 | pci_id->function, status, bus_number, is_bridge)); | ||
273 | |||
274 | return_ACPI_STATUS(AE_OK); | ||
275 | } | ||
276 | |||
277 | /******************************************************************************* | ||
278 | * | ||
279 | * FUNCTION: acpi_hw_delete_pci_list | ||
280 | * | ||
281 | * PARAMETERS: list_head - Device list created by | ||
282 | * acpi_hw_build_pci_list | ||
283 | * | ||
284 | * RETURN: None | ||
285 | * | ||
286 | * DESCRIPTION: Free the entire PCI list. | ||
287 | * | ||
288 | ******************************************************************************/ | ||
289 | |||
290 | static void acpi_hw_delete_pci_list(struct acpi_pci_device *list_head) | ||
291 | { | ||
292 | struct acpi_pci_device *next; | ||
293 | struct acpi_pci_device *previous; | ||
294 | |||
295 | next = list_head; | ||
296 | while (next) { | ||
297 | previous = next; | ||
298 | next = previous->next; | ||
299 | ACPI_FREE(previous); | ||
300 | } | ||
301 | } | ||
302 | |||
303 | /******************************************************************************* | ||
304 | * | ||
305 | * FUNCTION: acpi_hw_get_pci_device_info | ||
306 | * | ||
307 | * PARAMETERS: pci_id - Initial values for the PCI ID. May be | ||
308 | * modified by this function. | ||
309 | * pci_device - Handle for the PCI device object | ||
310 | * bus_number - Where a PCI bridge bus number is returned | ||
311 | * is_bridge - Return value, indicates if this PCI | ||
312 | * device is a PCI bridge | ||
313 | * | ||
314 | * RETURN: Status | ||
315 | * | ||
316 | * DESCRIPTION: Get the device info for a single PCI device object. Get the | ||
317 | * _ADR (contains PCI device and function numbers), and for PCI | ||
318 | * bridge devices, get the bus number from PCI configuration | ||
319 | * space. | ||
320 | * | ||
321 | ******************************************************************************/ | ||
322 | |||
323 | static acpi_status | ||
324 | acpi_hw_get_pci_device_info(struct acpi_pci_id *pci_id, | ||
325 | acpi_handle pci_device, | ||
326 | u16 *bus_number, u8 *is_bridge) | ||
327 | { | ||
328 | acpi_status status; | ||
329 | acpi_object_type object_type; | ||
330 | u64 return_value; | ||
331 | u64 pci_value; | ||
332 | |||
333 | /* We only care about objects of type Device */ | ||
334 | |||
335 | status = acpi_get_type(pci_device, &object_type); | ||
336 | if (ACPI_FAILURE(status)) { | ||
337 | return (status); | ||
338 | } | ||
339 | |||
340 | if (object_type != ACPI_TYPE_DEVICE) { | ||
341 | return (AE_OK); | ||
342 | } | ||
343 | |||
344 | /* We need an _ADR. Ignore device if not present */ | ||
345 | |||
346 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, | ||
347 | pci_device, &return_value); | ||
348 | if (ACPI_FAILURE(status)) { | ||
349 | return (AE_OK); | ||
350 | } | ||
351 | |||
352 | /* | ||
353 | * From _ADR, get the PCI Device and Function and | ||
354 | * update the PCI ID. | ||
355 | */ | ||
356 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(return_value)); | ||
357 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(return_value)); | ||
358 | |||
359 | /* | ||
360 | * If the previous device was a bridge, use the previous | ||
361 | * device bus number | ||
362 | */ | ||
363 | if (*is_bridge) { | ||
364 | pci_id->bus = *bus_number; | ||
365 | } | ||
366 | |||
367 | /* | ||
368 | * Get the bus numbers from PCI Config space: | ||
369 | * | ||
370 | * First, get the PCI header_type | ||
371 | */ | ||
372 | *is_bridge = FALSE; | ||
373 | status = acpi_os_read_pci_configuration(pci_id, | ||
374 | PCI_CFG_HEADER_TYPE_REG, | ||
375 | &pci_value, 8); | ||
376 | if (ACPI_FAILURE(status)) { | ||
377 | return (status); | ||
378 | } | ||
379 | |||
380 | /* We only care about bridges (1=pci_bridge, 2=card_bus_bridge) */ | ||
381 | |||
382 | pci_value &= PCI_HEADER_TYPE_MASK; | ||
383 | |||
384 | if ((pci_value != PCI_TYPE_BRIDGE) && | ||
385 | (pci_value != PCI_TYPE_CARDBUS_BRIDGE)) { | ||
386 | return (AE_OK); | ||
387 | } | ||
388 | |||
389 | /* Bridge: Get the Primary bus_number */ | ||
390 | |||
391 | status = acpi_os_read_pci_configuration(pci_id, | ||
392 | PCI_CFG_PRIMARY_BUS_NUMBER_REG, | ||
393 | &pci_value, 8); | ||
394 | if (ACPI_FAILURE(status)) { | ||
395 | return (status); | ||
396 | } | ||
397 | |||
398 | *is_bridge = TRUE; | ||
399 | pci_id->bus = (u16)pci_value; | ||
400 | |||
401 | /* Bridge: Get the Secondary bus_number */ | ||
402 | |||
403 | status = acpi_os_read_pci_configuration(pci_id, | ||
404 | PCI_CFG_SECONDARY_BUS_NUMBER_REG, | ||
405 | &pci_value, 8); | ||
406 | if (ACPI_FAILURE(status)) { | ||
407 | return (status); | ||
408 | } | ||
409 | |||
410 | *bus_number = (u16)pci_value; | ||
411 | return (AE_OK); | ||
412 | } | ||
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 4009498fbab..4ef9f43ea92 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -74,10 +74,18 @@ acpi_ns_repair_ALR(struct acpi_predefined_data *data, | |||
74 | union acpi_operand_object **return_object_ptr); | 74 | union acpi_operand_object **return_object_ptr); |
75 | 75 | ||
76 | static acpi_status | 76 | static acpi_status |
77 | acpi_ns_repair_CID(struct acpi_predefined_data *data, | ||
78 | union acpi_operand_object **return_object_ptr); | ||
79 | |||
80 | static acpi_status | ||
77 | acpi_ns_repair_FDE(struct acpi_predefined_data *data, | 81 | acpi_ns_repair_FDE(struct acpi_predefined_data *data, |
78 | union acpi_operand_object **return_object_ptr); | 82 | union acpi_operand_object **return_object_ptr); |
79 | 83 | ||
80 | static acpi_status | 84 | static acpi_status |
85 | acpi_ns_repair_HID(struct acpi_predefined_data *data, | ||
86 | union acpi_operand_object **return_object_ptr); | ||
87 | |||
88 | static acpi_status | ||
81 | acpi_ns_repair_PSS(struct acpi_predefined_data *data, | 89 | acpi_ns_repair_PSS(struct acpi_predefined_data *data, |
82 | union acpi_operand_object **return_object_ptr); | 90 | union acpi_operand_object **return_object_ptr); |
83 | 91 | ||
@@ -108,8 +116,10 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
108 | * As necessary: | 116 | * As necessary: |
109 | * | 117 | * |
110 | * _ALR: Sort the list ascending by ambient_illuminance | 118 | * _ALR: Sort the list ascending by ambient_illuminance |
119 | * _CID: Strings: uppercase all, remove any leading asterisk | ||
111 | * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs | 120 | * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs |
112 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs | 121 | * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs |
122 | * _HID: Strings: uppercase all, remove any leading asterisk | ||
113 | * _PSS: Sort the list descending by Power | 123 | * _PSS: Sort the list descending by Power |
114 | * _TSS: Sort the list descending by Power | 124 | * _TSS: Sort the list descending by Power |
115 | * | 125 | * |
@@ -122,8 +132,10 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
122 | */ | 132 | */ |
123 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { | 133 | static const struct acpi_repair_info acpi_ns_repairable_names[] = { |
124 | {"_ALR", acpi_ns_repair_ALR}, | 134 | {"_ALR", acpi_ns_repair_ALR}, |
135 | {"_CID", acpi_ns_repair_CID}, | ||
125 | {"_FDE", acpi_ns_repair_FDE}, | 136 | {"_FDE", acpi_ns_repair_FDE}, |
126 | {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ | 137 | {"_GTM", acpi_ns_repair_FDE}, /* _GTM has same repair as _FDE */ |
138 | {"_HID", acpi_ns_repair_HID}, | ||
127 | {"_PSS", acpi_ns_repair_PSS}, | 139 | {"_PSS", acpi_ns_repair_PSS}, |
128 | {"_TSS", acpi_ns_repair_TSS}, | 140 | {"_TSS", acpi_ns_repair_TSS}, |
129 | {{0, 0, 0, 0}, NULL} /* Table terminator */ | 141 | {{0, 0, 0, 0}, NULL} /* Table terminator */ |
@@ -321,6 +333,157 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data, | |||
321 | 333 | ||
322 | /****************************************************************************** | 334 | /****************************************************************************** |
323 | * | 335 | * |
336 | * FUNCTION: acpi_ns_repair_CID | ||
337 | * | ||
338 | * PARAMETERS: Data - Pointer to validation data structure | ||
339 | * return_object_ptr - Pointer to the object returned from the | ||
340 | * evaluation of a method or object | ||
341 | * | ||
342 | * RETURN: Status. AE_OK if object is OK or was repaired successfully | ||
343 | * | ||
344 | * DESCRIPTION: Repair for the _CID object. If a string, ensure that all | ||
345 | * letters are uppercase and that there is no leading asterisk. | ||
346 | * If a Package, ensure same for all string elements. | ||
347 | * | ||
348 | *****************************************************************************/ | ||
349 | |||
350 | static acpi_status | ||
351 | acpi_ns_repair_CID(struct acpi_predefined_data *data, | ||
352 | union acpi_operand_object **return_object_ptr) | ||
353 | { | ||
354 | acpi_status status; | ||
355 | union acpi_operand_object *return_object = *return_object_ptr; | ||
356 | union acpi_operand_object **element_ptr; | ||
357 | union acpi_operand_object *original_element; | ||
358 | u16 original_ref_count; | ||
359 | u32 i; | ||
360 | |||
361 | /* Check for _CID as a simple string */ | ||
362 | |||
363 | if (return_object->common.type == ACPI_TYPE_STRING) { | ||
364 | status = acpi_ns_repair_HID(data, return_object_ptr); | ||
365 | return (status); | ||
366 | } | ||
367 | |||
368 | /* Exit if not a Package */ | ||
369 | |||
370 | if (return_object->common.type != ACPI_TYPE_PACKAGE) { | ||
371 | return (AE_OK); | ||
372 | } | ||
373 | |||
374 | /* Examine each element of the _CID package */ | ||
375 | |||
376 | element_ptr = return_object->package.elements; | ||
377 | for (i = 0; i < return_object->package.count; i++) { | ||
378 | original_element = *element_ptr; | ||
379 | original_ref_count = original_element->common.reference_count; | ||
380 | |||
381 | status = acpi_ns_repair_HID(data, element_ptr); | ||
382 | if (ACPI_FAILURE(status)) { | ||
383 | return (status); | ||
384 | } | ||
385 | |||
386 | /* Take care with reference counts */ | ||
387 | |||
388 | if (original_element != *element_ptr) { | ||
389 | |||
390 | /* Element was replaced */ | ||
391 | |||
392 | (*element_ptr)->common.reference_count = | ||
393 | original_ref_count; | ||
394 | |||
395 | acpi_ut_remove_reference(original_element); | ||
396 | } | ||
397 | |||
398 | element_ptr++; | ||
399 | } | ||
400 | |||
401 | return (AE_OK); | ||
402 | } | ||
403 | |||
404 | /****************************************************************************** | ||
405 | * | ||
406 | * FUNCTION: acpi_ns_repair_HID | ||
407 | * | ||
408 | * PARAMETERS: Data - Pointer to validation data structure | ||
409 | * return_object_ptr - Pointer to the object returned from the | ||
410 | * evaluation of a method or object | ||
411 | * | ||
412 | * RETURN: Status. AE_OK if object is OK or was repaired successfully | ||
413 | * | ||
414 | * DESCRIPTION: Repair for the _HID object. If a string, ensure that all | ||
415 | * letters are uppercase and that there is no leading asterisk. | ||
416 | * | ||
417 | *****************************************************************************/ | ||
418 | |||
419 | static acpi_status | ||
420 | acpi_ns_repair_HID(struct acpi_predefined_data *data, | ||
421 | union acpi_operand_object **return_object_ptr) | ||
422 | { | ||
423 | union acpi_operand_object *return_object = *return_object_ptr; | ||
424 | union acpi_operand_object *new_string; | ||
425 | char *source; | ||
426 | char *dest; | ||
427 | |||
428 | ACPI_FUNCTION_NAME(ns_repair_HID); | ||
429 | |||
430 | /* We only care about string _HID objects (not integers) */ | ||
431 | |||
432 | if (return_object->common.type != ACPI_TYPE_STRING) { | ||
433 | return (AE_OK); | ||
434 | } | ||
435 | |||
436 | if (return_object->string.length == 0) { | ||
437 | ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags, | ||
438 | "Invalid zero-length _HID or _CID string")); | ||
439 | |||
440 | /* Return AE_OK anyway, let driver handle it */ | ||
441 | |||
442 | data->flags |= ACPI_OBJECT_REPAIRED; | ||
443 | return (AE_OK); | ||
444 | } | ||
445 | |||
446 | /* It is simplest to always create a new string object */ | ||
447 | |||
448 | new_string = acpi_ut_create_string_object(return_object->string.length); | ||
449 | if (!new_string) { | ||
450 | return (AE_NO_MEMORY); | ||
451 | } | ||
452 | |||
453 | /* | ||
454 | * Remove a leading asterisk if present. For some unknown reason, there | ||
455 | * are many machines in the field that contains IDs like this. | ||
456 | * | ||
457 | * Examples: "*PNP0C03", "*ACPI0003" | ||
458 | */ | ||
459 | source = return_object->string.pointer; | ||
460 | if (*source == '*') { | ||
461 | source++; | ||
462 | new_string->string.length--; | ||
463 | |||
464 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
465 | "%s: Removed invalid leading asterisk\n", | ||
466 | data->pathname)); | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * Copy and uppercase the string. From the ACPI specification: | ||
471 | * | ||
472 | * A valid PNP ID must be of the form "AAA####" where A is an uppercase | ||
473 | * letter and # is a hex digit. A valid ACPI ID must be of the form | ||
474 | * "ACPI####" where # is a hex digit. | ||
475 | */ | ||
476 | for (dest = new_string->string.pointer; *source; dest++, source++) { | ||
477 | *dest = (char)ACPI_TOUPPER(*source); | ||
478 | } | ||
479 | |||
480 | acpi_ut_remove_reference(return_object); | ||
481 | *return_object_ptr = new_string; | ||
482 | return (AE_OK); | ||
483 | } | ||
484 | |||
485 | /****************************************************************************** | ||
486 | * | ||
324 | * FUNCTION: acpi_ns_repair_TSS | 487 | * FUNCTION: acpi_ns_repair_TSS |
325 | * | 488 | * |
326 | * PARAMETERS: Data - Pointer to validation data structure | 489 | * PARAMETERS: Data - Pointer to validation data structure |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index e1add3491b0..a7d6ad9c111 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -60,104 +60,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); | |||
60 | 60 | ||
61 | /******************************************************************************* | 61 | /******************************************************************************* |
62 | * | 62 | * |
63 | * FUNCTION: acpi_ns_report_error | ||
64 | * | ||
65 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
66 | * line_number - Caller's line number (for error output) | ||
67 | * internal_name - Name or path of the namespace node | ||
68 | * lookup_status - Exception code from NS lookup | ||
69 | * | ||
70 | * RETURN: None | ||
71 | * | ||
72 | * DESCRIPTION: Print warning message with full pathname | ||
73 | * | ||
74 | ******************************************************************************/ | ||
75 | |||
76 | void | ||
77 | acpi_ns_report_error(const char *module_name, | ||
78 | u32 line_number, | ||
79 | const char *internal_name, acpi_status lookup_status) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | u32 bad_name; | ||
83 | char *name = NULL; | ||
84 | |||
85 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
86 | |||
87 | if (lookup_status == AE_BAD_CHARACTER) { | ||
88 | |||
89 | /* There is a non-ascii character in the name */ | ||
90 | |||
91 | ACPI_MOVE_32_TO_32(&bad_name, | ||
92 | ACPI_CAST_PTR(u32, internal_name)); | ||
93 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
94 | } else { | ||
95 | /* Convert path to external format */ | ||
96 | |||
97 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
98 | internal_name, NULL, &name); | ||
99 | |||
100 | /* Print target name */ | ||
101 | |||
102 | if (ACPI_SUCCESS(status)) { | ||
103 | acpi_os_printf("[%s]", name); | ||
104 | } else { | ||
105 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
106 | } | ||
107 | |||
108 | if (name) { | ||
109 | ACPI_FREE(name); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | acpi_os_printf(" Namespace lookup failure, %s\n", | ||
114 | acpi_format_exception(lookup_status)); | ||
115 | } | ||
116 | |||
117 | /******************************************************************************* | ||
118 | * | ||
119 | * FUNCTION: acpi_ns_report_method_error | ||
120 | * | ||
121 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
122 | * line_number - Caller's line number (for error output) | ||
123 | * Message - Error message to use on failure | ||
124 | * prefix_node - Prefix relative to the path | ||
125 | * Path - Path to the node (optional) | ||
126 | * method_status - Execution status | ||
127 | * | ||
128 | * RETURN: None | ||
129 | * | ||
130 | * DESCRIPTION: Print warning message with full pathname | ||
131 | * | ||
132 | ******************************************************************************/ | ||
133 | |||
134 | void | ||
135 | acpi_ns_report_method_error(const char *module_name, | ||
136 | u32 line_number, | ||
137 | const char *message, | ||
138 | struct acpi_namespace_node *prefix_node, | ||
139 | const char *path, acpi_status method_status) | ||
140 | { | ||
141 | acpi_status status; | ||
142 | struct acpi_namespace_node *node = prefix_node; | ||
143 | |||
144 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
145 | |||
146 | if (path) { | ||
147 | status = | ||
148 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
149 | &node); | ||
150 | if (ACPI_FAILURE(status)) { | ||
151 | acpi_os_printf("[Could not get node by pathname]"); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | acpi_ns_print_node_pathname(node, message); | ||
156 | acpi_os_printf(", %s\n", acpi_format_exception(method_status)); | ||
157 | } | ||
158 | |||
159 | /******************************************************************************* | ||
160 | * | ||
161 | * FUNCTION: acpi_ns_print_node_pathname | 63 | * FUNCTION: acpi_ns_print_node_pathname |
162 | * | 64 | * |
163 | * PARAMETERS: Node - Object | 65 | * PARAMETERS: Node - Object |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 22cfcfbd9ff..491191e6cf6 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
@@ -149,7 +149,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type) | |||
149 | 149 | ||
150 | /* | 150 | /* |
151 | * 16-, 32-, and 64-bit cases must use the move macros that perform | 151 | * 16-, 32-, and 64-bit cases must use the move macros that perform |
152 | * endian conversion and/or accomodate hardware that cannot perform | 152 | * endian conversion and/or accommodate hardware that cannot perform |
153 | * misaligned memory transfers | 153 | * misaligned memory transfers |
154 | */ | 154 | */ |
155 | case ACPI_RSC_MOVE16: | 155 | case ACPI_RSC_MOVE16: |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 1728cb9bf60..d2ff4325c42 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -49,7 +49,7 @@ | |||
49 | ACPI_MODULE_NAME("tbfadt") | 49 | ACPI_MODULE_NAME("tbfadt") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static inline void | 52 | static ACPI_INLINE void |
53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
54 | u8 space_id, u8 byte_width, u64 address); | 54 | u8 space_id, u8 byte_width, u64 address); |
55 | 55 | ||
@@ -181,7 +181,7 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
181 | * | 181 | * |
182 | ******************************************************************************/ | 182 | ******************************************************************************/ |
183 | 183 | ||
184 | static inline void | 184 | static ACPI_INLINE void |
185 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 185 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
186 | u8 space_id, u8 byte_width, u64 address) | 186 | u8 space_id, u8 byte_width, u64 address) |
187 | { | 187 | { |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 98351064005..f21c486929a 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -179,9 +179,8 @@ acpi_debug_print(u32 requested_debug_level, | |||
179 | if (thread_id != acpi_gbl_prev_thread_id) { | 179 | if (thread_id != acpi_gbl_prev_thread_id) { |
180 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
181 | acpi_os_printf | 181 | acpi_os_printf |
182 | ("\n**** Context Switch from TID %p to TID %p ****\n\n", | 182 | ("\n**** Context Switch from TID %u to TID %u ****\n\n", |
183 | ACPI_CAST_PTR(void, acpi_gbl_prev_thread_id), | 183 | (u32)acpi_gbl_prev_thread_id, (u32)thread_id); |
184 | ACPI_CAST_PTR(void, thread_id)); | ||
185 | } | 184 | } |
186 | 185 | ||
187 | acpi_gbl_prev_thread_id = thread_id; | 186 | acpi_gbl_prev_thread_id = thread_id; |
@@ -194,7 +193,7 @@ acpi_debug_print(u32 requested_debug_level, | |||
194 | acpi_os_printf("%8s-%04ld ", module_name, line_number); | 193 | acpi_os_printf("%8s-%04ld ", module_name, line_number); |
195 | 194 | ||
196 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 195 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
197 | acpi_os_printf("[%p] ", ACPI_CAST_PTR(void, thread_id)); | 196 | acpi_os_printf("[%u] ", (u32)thread_id); |
198 | } | 197 | } |
199 | 198 | ||
200 | acpi_os_printf("[%02ld] %-22.22s: ", | 199 | acpi_os_printf("[%02ld] %-22.22s: ", |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 6dfdeb65349..22f59ef604e 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -48,153 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("uteval") | 49 | ACPI_MODULE_NAME("uteval") |
50 | 50 | ||
51 | /* | ||
52 | * Strings supported by the _OSI predefined (internal) method. | ||
53 | * | ||
54 | * March 2009: Removed "Linux" as this host no longer wants to respond true | ||
55 | * for this string. Basically, the only safe OS strings are windows-related | ||
56 | * and in many or most cases represent the only test path within the | ||
57 | * BIOS-provided ASL code. | ||
58 | * | ||
59 | * The second element of each entry is used to track the newest version of | ||
60 | * Windows that the BIOS has requested. | ||
61 | */ | ||
62 | static struct acpi_interface_info acpi_interfaces_supported[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ | ||
66 | {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ | ||
67 | {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ | ||
68 | {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ | ||
69 | {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ | ||
70 | {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ | ||
71 | {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ | ||
72 | {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ | ||
73 | {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | ||
74 | {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | ||
75 | |||
76 | /* Feature Group Strings */ | ||
77 | |||
78 | {"Extended Address Space Descriptor", 0} | ||
79 | |||
80 | /* | ||
81 | * All "optional" feature group strings (features that are implemented | ||
82 | * by the host) should be implemented in the host version of | ||
83 | * acpi_os_validate_interface and should not be added here. | ||
84 | */ | ||
85 | }; | ||
86 | |||
87 | /******************************************************************************* | ||
88 | * | ||
89 | * FUNCTION: acpi_ut_osi_implementation | ||
90 | * | ||
91 | * PARAMETERS: walk_state - Current walk state | ||
92 | * | ||
93 | * RETURN: Status | ||
94 | * | ||
95 | * DESCRIPTION: Implementation of the _OSI predefined control method | ||
96 | * | ||
97 | ******************************************************************************/ | ||
98 | |||
99 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | ||
100 | { | ||
101 | acpi_status status; | ||
102 | union acpi_operand_object *string_desc; | ||
103 | union acpi_operand_object *return_desc; | ||
104 | u32 return_value; | ||
105 | u32 i; | ||
106 | |||
107 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | ||
108 | |||
109 | /* Validate the string input argument */ | ||
110 | |||
111 | string_desc = walk_state->arguments[0].object; | ||
112 | if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { | ||
113 | return_ACPI_STATUS(AE_TYPE); | ||
114 | } | ||
115 | |||
116 | /* Create a return object */ | ||
117 | |||
118 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
119 | if (!return_desc) { | ||
120 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
121 | } | ||
122 | |||
123 | /* Default return value is 0, NOT SUPPORTED */ | ||
124 | |||
125 | return_value = 0; | ||
126 | |||
127 | /* Compare input string to static table of supported interfaces */ | ||
128 | |||
129 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | ||
130 | if (!ACPI_STRCMP(string_desc->string.pointer, | ||
131 | acpi_interfaces_supported[i].name)) { | ||
132 | /* | ||
133 | * The interface is supported. | ||
134 | * Update the osi_data if necessary. We keep track of the latest | ||
135 | * version of Windows that has been requested by the BIOS. | ||
136 | */ | ||
137 | if (acpi_interfaces_supported[i].value > | ||
138 | acpi_gbl_osi_data) { | ||
139 | acpi_gbl_osi_data = | ||
140 | acpi_interfaces_supported[i].value; | ||
141 | } | ||
142 | |||
143 | return_value = ACPI_UINT32_MAX; | ||
144 | goto exit; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * Did not match the string in the static table, call the host OSL to | ||
150 | * check for a match with one of the optional strings (such as | ||
151 | * "Module Device", "3.0 Thermal Model", etc.) | ||
152 | */ | ||
153 | status = acpi_os_validate_interface(string_desc->string.pointer); | ||
154 | if (ACPI_SUCCESS(status)) { | ||
155 | |||
156 | /* The interface is supported */ | ||
157 | |||
158 | return_value = ACPI_UINT32_MAX; | ||
159 | } | ||
160 | |||
161 | exit: | ||
162 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, | ||
163 | "ACPI: BIOS _OSI(%s) is %ssupported\n", | ||
164 | string_desc->string.pointer, return_value == 0 ? "not " : "")); | ||
165 | |||
166 | /* Complete the return value */ | ||
167 | |||
168 | return_desc->integer.value = return_value; | ||
169 | walk_state->return_desc = return_desc; | ||
170 | return_ACPI_STATUS (AE_OK); | ||
171 | } | ||
172 | |||
173 | /******************************************************************************* | ||
174 | * | ||
175 | * FUNCTION: acpi_osi_invalidate | ||
176 | * | ||
177 | * PARAMETERS: interface_string | ||
178 | * | ||
179 | * RETURN: Status | ||
180 | * | ||
181 | * DESCRIPTION: invalidate string in pre-defiend _OSI string list | ||
182 | * | ||
183 | ******************************************************************************/ | ||
184 | |||
185 | acpi_status acpi_osi_invalidate(char *interface) | ||
186 | { | ||
187 | int i; | ||
188 | |||
189 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | ||
190 | if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i].name)) { | ||
191 | *acpi_interfaces_supported[i].name = '\0'; | ||
192 | return AE_OK; | ||
193 | } | ||
194 | } | ||
195 | return AE_NOT_FOUND; | ||
196 | } | ||
197 | |||
198 | /******************************************************************************* | 51 | /******************************************************************************* |
199 | * | 52 | * |
200 | * FUNCTION: acpi_ut_evaluate_object | 53 | * FUNCTION: acpi_ut_evaluate_object |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 0558747579e..e87bc6760be 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -154,14 +154,16 @@ ACPI_EXPORT_SYMBOL(acpi_format_exception) | |||
154 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run | 154 | * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run |
155 | * during the initialization sequence. | 155 | * during the initialization sequence. |
156 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to | 156 | * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to |
157 | * perform a Notify() operation on it. | 157 | * perform a Notify() operation on it. 09/2010: Changed to type Device. |
158 | * This still allows notifies, but does not confuse host code that | ||
159 | * searches for valid thermal_zone objects. | ||
158 | */ | 160 | */ |
159 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { | 161 | const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { |
160 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 162 | {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
161 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 163 | {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
162 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, | 164 | {"_SB_", ACPI_TYPE_DEVICE, NULL}, |
163 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, | 165 | {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, |
164 | {"_TZ_", ACPI_TYPE_THERMAL, NULL}, | 166 | {"_TZ_", ACPI_TYPE_DEVICE, NULL}, |
165 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, | 167 | {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, |
166 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, | 168 | {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, |
167 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, | 169 | {"_GL_", ACPI_TYPE_MUTEX, (char *)1}, |
@@ -766,6 +768,7 @@ acpi_status acpi_ut_init_globals(void) | |||
766 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 768 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
767 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 769 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
768 | acpi_current_gpe_count = 0; | 770 | acpi_current_gpe_count = 0; |
771 | acpi_all_gpes_initialized = FALSE; | ||
769 | 772 | ||
770 | /* Global handlers */ | 773 | /* Global handlers */ |
771 | 774 | ||
@@ -774,6 +777,7 @@ acpi_status acpi_ut_init_globals(void) | |||
774 | acpi_gbl_exception_handler = NULL; | 777 | acpi_gbl_exception_handler = NULL; |
775 | acpi_gbl_init_handler = NULL; | 778 | acpi_gbl_init_handler = NULL; |
776 | acpi_gbl_table_handler = NULL; | 779 | acpi_gbl_table_handler = NULL; |
780 | acpi_gbl_interface_handler = NULL; | ||
777 | 781 | ||
778 | /* Global Lock support */ | 782 | /* Global Lock support */ |
779 | 783 | ||
@@ -800,6 +804,7 @@ acpi_status acpi_ut_init_globals(void) | |||
800 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; | 804 | acpi_gbl_debugger_configuration = DEBUGGER_THREADING; |
801 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | 805 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
802 | acpi_gbl_osi_data = 0; | 806 | acpi_gbl_osi_data = 0; |
807 | acpi_gbl_osi_mutex = NULL; | ||
803 | 808 | ||
804 | /* Hardware oriented */ | 809 | /* Hardware oriented */ |
805 | 810 | ||
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 1397fadd0d4..d2906328535 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
@@ -48,42 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
49 | ACPI_MODULE_NAME("utids") | 49 | ACPI_MODULE_NAME("utids") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void acpi_ut_copy_id_string(char *destination, char *source); | ||
53 | |||
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_ut_copy_id_string | ||
57 | * | ||
58 | * PARAMETERS: Destination - Where to copy the string | ||
59 | * Source - Source string | ||
60 | * | ||
61 | * RETURN: None | ||
62 | * | ||
63 | * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. | ||
64 | * Performs removal of a leading asterisk if present -- workaround | ||
65 | * for a known issue on a bunch of machines. | ||
66 | * | ||
67 | ******************************************************************************/ | ||
68 | |||
69 | static void acpi_ut_copy_id_string(char *destination, char *source) | ||
70 | { | ||
71 | |||
72 | /* | ||
73 | * Workaround for ID strings that have a leading asterisk. This construct | ||
74 | * is not allowed by the ACPI specification (ID strings must be | ||
75 | * alphanumeric), but enough existing machines have this embedded in their | ||
76 | * ID strings that the following code is useful. | ||
77 | */ | ||
78 | if (*source == '*') { | ||
79 | source++; | ||
80 | } | ||
81 | |||
82 | /* Do the actual copy */ | ||
83 | |||
84 | ACPI_STRCPY(destination, source); | ||
85 | } | ||
86 | |||
87 | /******************************************************************************* | 51 | /******************************************************************************* |
88 | * | 52 | * |
89 | * FUNCTION: acpi_ut_execute_HID | 53 | * FUNCTION: acpi_ut_execute_HID |
@@ -101,7 +65,6 @@ static void acpi_ut_copy_id_string(char *destination, char *source) | |||
101 | * NOTE: Internal function, no parameter validation | 65 | * NOTE: Internal function, no parameter validation |
102 | * | 66 | * |
103 | ******************************************************************************/ | 67 | ******************************************************************************/ |
104 | |||
105 | acpi_status | 68 | acpi_status |
106 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | 69 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, |
107 | struct acpica_device_id **return_id) | 70 | struct acpica_device_id **return_id) |
@@ -147,7 +110,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
147 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | 110 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
148 | acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); | 111 | acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value); |
149 | } else { | 112 | } else { |
150 | acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer); | 113 | ACPI_STRCPY(hid->string, obj_desc->string.pointer); |
151 | } | 114 | } |
152 | 115 | ||
153 | hid->length = length; | 116 | hid->length = length; |
@@ -224,7 +187,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
224 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { | 187 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
225 | acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); | 188 | acpi_ex_integer_to_string(uid->string, obj_desc->integer.value); |
226 | } else { | 189 | } else { |
227 | acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer); | 190 | ACPI_STRCPY(uid->string, obj_desc->string.pointer); |
228 | } | 191 | } |
229 | 192 | ||
230 | uid->length = length; | 193 | uid->length = length; |
@@ -357,8 +320,8 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node, | |||
357 | 320 | ||
358 | /* Copy the String CID from the returned object */ | 321 | /* Copy the String CID from the returned object */ |
359 | 322 | ||
360 | acpi_ut_copy_id_string(next_id_string, | 323 | ACPI_STRCPY(next_id_string, |
361 | cid_objects[i]->string.pointer); | 324 | cid_objects[i]->string.pointer); |
362 | length = cid_objects[i]->string.length + 1; | 325 | length = cid_objects[i]->string.length + 1; |
363 | } | 326 | } |
364 | 327 | ||
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index a39c93dac71..c1b1c803ea9 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -117,6 +117,10 @@ void acpi_ut_subsystem_shutdown(void) | |||
117 | /* Close the acpi_event Handling */ | 117 | /* Close the acpi_event Handling */ |
118 | 118 | ||
119 | acpi_ev_terminate(); | 119 | acpi_ev_terminate(); |
120 | |||
121 | /* Delete any dynamic _OSI interfaces */ | ||
122 | |||
123 | acpi_ut_interface_terminate(); | ||
120 | #endif | 124 | #endif |
121 | 125 | ||
122 | /* Close the Namespace */ | 126 | /* Close the Namespace */ |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index 35059a14eb7..49cf7b7fd81 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
@@ -48,11 +48,27 @@ | |||
48 | ACPI_MODULE_NAME("utmath") | 48 | ACPI_MODULE_NAME("utmath") |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * Support for double-precision integer divide. This code is included here | 51 | * Optional support for 64-bit double-precision integer divide. This code |
52 | * in order to support kernel environments where the double-precision math | 52 | * is configurable and is implemented in order to support 32-bit kernel |
53 | * library is not available. | 53 | * environments where a 64-bit double-precision math library is not available. |
54 | * | ||
55 | * Support for a more normal 64-bit divide/modulo (with check for a divide- | ||
56 | * by-zero) appears after this optional section of code. | ||
54 | */ | 57 | */ |
55 | #ifndef ACPI_USE_NATIVE_DIVIDE | 58 | #ifndef ACPI_USE_NATIVE_DIVIDE |
59 | /* Structures used only for 64-bit divide */ | ||
60 | typedef struct uint64_struct { | ||
61 | u32 lo; | ||
62 | u32 hi; | ||
63 | |||
64 | } uint64_struct; | ||
65 | |||
66 | typedef union uint64_overlay { | ||
67 | u64 full; | ||
68 | struct uint64_struct part; | ||
69 | |||
70 | } uint64_overlay; | ||
71 | |||
56 | /******************************************************************************* | 72 | /******************************************************************************* |
57 | * | 73 | * |
58 | * FUNCTION: acpi_ut_short_divide | 74 | * FUNCTION: acpi_ut_short_divide |
@@ -69,6 +85,7 @@ ACPI_MODULE_NAME("utmath") | |||
69 | * 32-bit remainder. | 85 | * 32-bit remainder. |
70 | * | 86 | * |
71 | ******************************************************************************/ | 87 | ******************************************************************************/ |
88 | |||
72 | acpi_status | 89 | acpi_status |
73 | acpi_ut_short_divide(u64 dividend, | 90 | acpi_ut_short_divide(u64 dividend, |
74 | u32 divisor, u64 *out_quotient, u32 *out_remainder) | 91 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index e8d0724ee40..c7d0e05ef5a 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -50,11 +50,6 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utmisc") | 51 | ACPI_MODULE_NAME("utmisc") |
52 | 52 | ||
53 | /* | ||
54 | * Common suffix for messages | ||
55 | */ | ||
56 | #define ACPI_COMMON_MSG_SUFFIX \ | ||
57 | acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
58 | /******************************************************************************* | 53 | /******************************************************************************* |
59 | * | 54 | * |
60 | * FUNCTION: acpi_ut_validate_exception | 55 | * FUNCTION: acpi_ut_validate_exception |
@@ -1044,160 +1039,3 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1044 | 1039 | ||
1045 | return_ACPI_STATUS(AE_AML_INTERNAL); | 1040 | return_ACPI_STATUS(AE_AML_INTERNAL); |
1046 | } | 1041 | } |
1047 | |||
1048 | /******************************************************************************* | ||
1049 | * | ||
1050 | * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info | ||
1051 | * | ||
1052 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1053 | * line_number - Caller's line number (for error output) | ||
1054 | * Format - Printf format string + additional args | ||
1055 | * | ||
1056 | * RETURN: None | ||
1057 | * | ||
1058 | * DESCRIPTION: Print message with module/line/version info | ||
1059 | * | ||
1060 | ******************************************************************************/ | ||
1061 | |||
1062 | void ACPI_INTERNAL_VAR_XFACE | ||
1063 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
1064 | { | ||
1065 | va_list args; | ||
1066 | |||
1067 | acpi_os_printf("ACPI Error: "); | ||
1068 | |||
1069 | va_start(args, format); | ||
1070 | acpi_os_vprintf(format, args); | ||
1071 | ACPI_COMMON_MSG_SUFFIX; | ||
1072 | va_end(args); | ||
1073 | } | ||
1074 | |||
1075 | void ACPI_INTERNAL_VAR_XFACE | ||
1076 | acpi_exception(const char *module_name, | ||
1077 | u32 line_number, acpi_status status, const char *format, ...) | ||
1078 | { | ||
1079 | va_list args; | ||
1080 | |||
1081 | acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); | ||
1082 | |||
1083 | va_start(args, format); | ||
1084 | acpi_os_vprintf(format, args); | ||
1085 | ACPI_COMMON_MSG_SUFFIX; | ||
1086 | va_end(args); | ||
1087 | } | ||
1088 | |||
1089 | void ACPI_INTERNAL_VAR_XFACE | ||
1090 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
1091 | { | ||
1092 | va_list args; | ||
1093 | |||
1094 | acpi_os_printf("ACPI Warning: "); | ||
1095 | |||
1096 | va_start(args, format); | ||
1097 | acpi_os_vprintf(format, args); | ||
1098 | ACPI_COMMON_MSG_SUFFIX; | ||
1099 | va_end(args); | ||
1100 | } | ||
1101 | |||
1102 | void ACPI_INTERNAL_VAR_XFACE | ||
1103 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
1104 | { | ||
1105 | va_list args; | ||
1106 | |||
1107 | acpi_os_printf("ACPI: "); | ||
1108 | |||
1109 | va_start(args, format); | ||
1110 | acpi_os_vprintf(format, args); | ||
1111 | acpi_os_printf("\n"); | ||
1112 | va_end(args); | ||
1113 | } | ||
1114 | |||
1115 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
1116 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
1117 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
1118 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
1119 | |||
1120 | /******************************************************************************* | ||
1121 | * | ||
1122 | * FUNCTION: acpi_ut_predefined_warning | ||
1123 | * | ||
1124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1125 | * line_number - Caller's line number (for error output) | ||
1126 | * Pathname - Full pathname to the node | ||
1127 | * node_flags - From Namespace node for the method/object | ||
1128 | * Format - Printf format string + additional args | ||
1129 | * | ||
1130 | * RETURN: None | ||
1131 | * | ||
1132 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
1133 | * only emitted the first time a problem with a particular | ||
1134 | * method/object is detected. This prevents a flood of error | ||
1135 | * messages for methods that are repeatedly evaluated. | ||
1136 | * | ||
1137 | ******************************************************************************/ | ||
1138 | |||
1139 | void ACPI_INTERNAL_VAR_XFACE | ||
1140 | acpi_ut_predefined_warning(const char *module_name, | ||
1141 | u32 line_number, | ||
1142 | char *pathname, | ||
1143 | u8 node_flags, const char *format, ...) | ||
1144 | { | ||
1145 | va_list args; | ||
1146 | |||
1147 | /* | ||
1148 | * Warning messages for this method/object will be disabled after the | ||
1149 | * first time a validation fails or an object is successfully repaired. | ||
1150 | */ | ||
1151 | if (node_flags & ANOBJ_EVALUATED) { | ||
1152 | return; | ||
1153 | } | ||
1154 | |||
1155 | acpi_os_printf("ACPI Warning for %s: ", pathname); | ||
1156 | |||
1157 | va_start(args, format); | ||
1158 | acpi_os_vprintf(format, args); | ||
1159 | ACPI_COMMON_MSG_SUFFIX; | ||
1160 | va_end(args); | ||
1161 | } | ||
1162 | |||
1163 | /******************************************************************************* | ||
1164 | * | ||
1165 | * FUNCTION: acpi_ut_predefined_info | ||
1166 | * | ||
1167 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1168 | * line_number - Caller's line number (for error output) | ||
1169 | * Pathname - Full pathname to the node | ||
1170 | * node_flags - From Namespace node for the method/object | ||
1171 | * Format - Printf format string + additional args | ||
1172 | * | ||
1173 | * RETURN: None | ||
1174 | * | ||
1175 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
1176 | * are only emitted the first time a problem with a particular | ||
1177 | * method/object is detected. This prevents a flood of | ||
1178 | * messages for methods that are repeatedly evaluated. | ||
1179 | * | ||
1180 | ******************************************************************************/ | ||
1181 | |||
1182 | void ACPI_INTERNAL_VAR_XFACE | ||
1183 | acpi_ut_predefined_info(const char *module_name, | ||
1184 | u32 line_number, | ||
1185 | char *pathname, u8 node_flags, const char *format, ...) | ||
1186 | { | ||
1187 | va_list args; | ||
1188 | |||
1189 | /* | ||
1190 | * Warning messages for this method/object will be disabled after the | ||
1191 | * first time a validation fails or an object is successfully repaired. | ||
1192 | */ | ||
1193 | if (node_flags & ANOBJ_EVALUATED) { | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | acpi_os_printf("ACPI Info for %s: ", pathname); | ||
1198 | |||
1199 | va_start(args, format); | ||
1200 | acpi_os_vprintf(format, args); | ||
1201 | ACPI_COMMON_MSG_SUFFIX; | ||
1202 | va_end(args); | ||
1203 | } | ||
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index f5cca3a1300..d9efa495b43 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -86,6 +86,12 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
86 | spin_lock_init(acpi_gbl_gpe_lock); | 86 | spin_lock_init(acpi_gbl_gpe_lock); |
87 | spin_lock_init(acpi_gbl_hardware_lock); | 87 | spin_lock_init(acpi_gbl_hardware_lock); |
88 | 88 | ||
89 | /* Mutex for _OSI support */ | ||
90 | status = acpi_os_create_mutex(&acpi_gbl_osi_mutex); | ||
91 | if (ACPI_FAILURE(status)) { | ||
92 | return_ACPI_STATUS(status); | ||
93 | } | ||
94 | |||
89 | /* Create the reader/writer lock for namespace access */ | 95 | /* Create the reader/writer lock for namespace access */ |
90 | 96 | ||
91 | status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); | 97 | status = acpi_ut_create_rw_lock(&acpi_gbl_namespace_rw_lock); |
@@ -117,6 +123,8 @@ void acpi_ut_mutex_terminate(void) | |||
117 | acpi_ut_delete_mutex(i); | 123 | acpi_ut_delete_mutex(i); |
118 | } | 124 | } |
119 | 125 | ||
126 | acpi_os_delete_mutex(acpi_gbl_osi_mutex); | ||
127 | |||
120 | /* Delete the spinlocks */ | 128 | /* Delete the spinlocks */ |
121 | 129 | ||
122 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 130 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
@@ -220,18 +228,17 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
220 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 228 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
221 | if (i == mutex_id) { | 229 | if (i == mutex_id) { |
222 | ACPI_ERROR((AE_INFO, | 230 | ACPI_ERROR((AE_INFO, |
223 | "Mutex [%s] already acquired by this thread [%p]", | 231 | "Mutex [%s] already acquired by this thread [%u]", |
224 | acpi_ut_get_mutex_name | 232 | acpi_ut_get_mutex_name |
225 | (mutex_id), | 233 | (mutex_id), |
226 | ACPI_CAST_PTR(void, | 234 | (u32)this_thread_id)); |
227 | this_thread_id))); | ||
228 | 235 | ||
229 | return (AE_ALREADY_ACQUIRED); | 236 | return (AE_ALREADY_ACQUIRED); |
230 | } | 237 | } |
231 | 238 | ||
232 | ACPI_ERROR((AE_INFO, | 239 | ACPI_ERROR((AE_INFO, |
233 | "Invalid acquire order: Thread %p owns [%s], wants [%s]", | 240 | "Invalid acquire order: Thread %u owns [%s], wants [%s]", |
234 | ACPI_CAST_PTR(void, this_thread_id), | 241 | (u32)this_thread_id, |
235 | acpi_ut_get_mutex_name(i), | 242 | acpi_ut_get_mutex_name(i), |
236 | acpi_ut_get_mutex_name(mutex_id))); | 243 | acpi_ut_get_mutex_name(mutex_id))); |
237 | 244 | ||
@@ -242,24 +249,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
242 | #endif | 249 | #endif |
243 | 250 | ||
244 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 251 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
245 | "Thread %p attempting to acquire Mutex [%s]\n", | 252 | "Thread %u attempting to acquire Mutex [%s]\n", |
246 | ACPI_CAST_PTR(void, this_thread_id), | 253 | (u32)this_thread_id, |
247 | acpi_ut_get_mutex_name(mutex_id))); | 254 | acpi_ut_get_mutex_name(mutex_id))); |
248 | 255 | ||
249 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 256 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
250 | ACPI_WAIT_FOREVER); | 257 | ACPI_WAIT_FOREVER); |
251 | if (ACPI_SUCCESS(status)) { | 258 | if (ACPI_SUCCESS(status)) { |
252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
253 | "Thread %p acquired Mutex [%s]\n", | 260 | "Thread %u acquired Mutex [%s]\n", |
254 | ACPI_CAST_PTR(void, this_thread_id), | 261 | (u32)this_thread_id, |
255 | acpi_ut_get_mutex_name(mutex_id))); | 262 | acpi_ut_get_mutex_name(mutex_id))); |
256 | 263 | ||
257 | acpi_gbl_mutex_info[mutex_id].use_count++; | 264 | acpi_gbl_mutex_info[mutex_id].use_count++; |
258 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; | 265 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; |
259 | } else { | 266 | } else { |
260 | ACPI_EXCEPTION((AE_INFO, status, | 267 | ACPI_EXCEPTION((AE_INFO, status, |
261 | "Thread %p could not acquire Mutex [0x%X]", | 268 | "Thread %u could not acquire Mutex [0x%X]", |
262 | ACPI_CAST_PTR(void, this_thread_id), mutex_id)); | 269 | (u32)this_thread_id, mutex_id)); |
263 | } | 270 | } |
264 | 271 | ||
265 | return (status); | 272 | return (status); |
@@ -279,10 +286,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
279 | 286 | ||
280 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 287 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
281 | { | 288 | { |
289 | acpi_thread_id this_thread_id; | ||
290 | |||
282 | ACPI_FUNCTION_NAME(ut_release_mutex); | 291 | ACPI_FUNCTION_NAME(ut_release_mutex); |
283 | 292 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", | 293 | this_thread_id = acpi_os_get_thread_id(); |
285 | ACPI_CAST_PTR(void, acpi_os_get_thread_id()), | 294 | |
295 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", | ||
296 | (u32)this_thread_id, | ||
286 | acpi_ut_get_mutex_name(mutex_id))); | 297 | acpi_ut_get_mutex_name(mutex_id))); |
287 | 298 | ||
288 | if (mutex_id > ACPI_MAX_MUTEX) { | 299 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c new file mode 100644 index 00000000000..18c59a85fdc --- /dev/null +++ b/drivers/acpi/acpica/utosi.c | |||
@@ -0,0 +1,380 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utosi - Support for the _OSI predefined control method | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | |||
47 | #define _COMPONENT ACPI_UTILITIES | ||
48 | ACPI_MODULE_NAME("utosi") | ||
49 | |||
50 | /* | ||
51 | * Strings supported by the _OSI predefined control method (which is | ||
52 | * implemented internally within this module.) | ||
53 | * | ||
54 | * March 2009: Removed "Linux" as this host no longer wants to respond true | ||
55 | * for this string. Basically, the only safe OS strings are windows-related | ||
56 | * and in many or most cases represent the only test path within the | ||
57 | * BIOS-provided ASL code. | ||
58 | * | ||
59 | * The last element of each entry is used to track the newest version of | ||
60 | * Windows that the BIOS has requested. | ||
61 | */ | ||
62 | static struct acpi_interface_info acpi_default_supported_interfaces[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | {"Windows 2000", NULL, 0, ACPI_OSI_WIN_2000}, /* Windows 2000 */ | ||
66 | {"Windows 2001", NULL, 0, ACPI_OSI_WIN_XP}, /* Windows XP */ | ||
67 | {"Windows 2001 SP1", NULL, 0, ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ | ||
68 | {"Windows 2001.1", NULL, 0, ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ | ||
69 | {"Windows 2001 SP2", NULL, 0, ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ | ||
70 | {"Windows 2001.1 SP1", NULL, 0, ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ | ||
71 | {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ | ||
72 | {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ | ||
73 | {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ | ||
74 | {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ | ||
75 | {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ | ||
76 | |||
77 | /* Feature Group Strings */ | ||
78 | |||
79 | {"Extended Address Space Descriptor", NULL, 0, 0} | ||
80 | |||
81 | /* | ||
82 | * All "optional" feature group strings (features that are implemented | ||
83 | * by the host) should be dynamically added by the host via | ||
84 | * acpi_install_interface and should not be manually added here. | ||
85 | * | ||
86 | * Examples of optional feature group strings: | ||
87 | * | ||
88 | * "Module Device" | ||
89 | * "Processor Device" | ||
90 | * "3.0 Thermal Model" | ||
91 | * "3.0 _SCP Extensions" | ||
92 | * "Processor Aggregator Device" | ||
93 | */ | ||
94 | }; | ||
95 | |||
96 | /******************************************************************************* | ||
97 | * | ||
98 | * FUNCTION: acpi_ut_initialize_interfaces | ||
99 | * | ||
100 | * PARAMETERS: None | ||
101 | * | ||
102 | * RETURN: Status | ||
103 | * | ||
104 | * DESCRIPTION: Initialize the global _OSI supported interfaces list | ||
105 | * | ||
106 | ******************************************************************************/ | ||
107 | |||
108 | acpi_status acpi_ut_initialize_interfaces(void) | ||
109 | { | ||
110 | u32 i; | ||
111 | |||
112 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
113 | acpi_gbl_supported_interfaces = acpi_default_supported_interfaces; | ||
114 | |||
115 | /* Link the static list of supported interfaces */ | ||
116 | |||
117 | for (i = 0; | ||
118 | i < (ACPI_ARRAY_LENGTH(acpi_default_supported_interfaces) - 1); | ||
119 | i++) { | ||
120 | acpi_default_supported_interfaces[i].next = | ||
121 | &acpi_default_supported_interfaces[(acpi_size) i + 1]; | ||
122 | } | ||
123 | |||
124 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
125 | return (AE_OK); | ||
126 | } | ||
127 | |||
128 | /******************************************************************************* | ||
129 | * | ||
130 | * FUNCTION: acpi_ut_interface_terminate | ||
131 | * | ||
132 | * PARAMETERS: None | ||
133 | * | ||
134 | * RETURN: None | ||
135 | * | ||
136 | * DESCRIPTION: Delete all interfaces in the global list. Sets | ||
137 | * acpi_gbl_supported_interfaces to NULL. | ||
138 | * | ||
139 | ******************************************************************************/ | ||
140 | |||
141 | void acpi_ut_interface_terminate(void) | ||
142 | { | ||
143 | struct acpi_interface_info *next_interface; | ||
144 | |||
145 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
146 | next_interface = acpi_gbl_supported_interfaces; | ||
147 | |||
148 | while (next_interface) { | ||
149 | acpi_gbl_supported_interfaces = next_interface->next; | ||
150 | |||
151 | /* Only interfaces added at runtime can be freed */ | ||
152 | |||
153 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | ||
154 | ACPI_FREE(next_interface->name); | ||
155 | ACPI_FREE(next_interface); | ||
156 | } | ||
157 | |||
158 | next_interface = acpi_gbl_supported_interfaces; | ||
159 | } | ||
160 | |||
161 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
162 | } | ||
163 | |||
164 | /******************************************************************************* | ||
165 | * | ||
166 | * FUNCTION: acpi_ut_install_interface | ||
167 | * | ||
168 | * PARAMETERS: interface_name - The interface to install | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Install the interface into the global interface list. | ||
173 | * Caller MUST hold acpi_gbl_osi_mutex | ||
174 | * | ||
175 | ******************************************************************************/ | ||
176 | |||
177 | acpi_status acpi_ut_install_interface(acpi_string interface_name) | ||
178 | { | ||
179 | struct acpi_interface_info *interface_info; | ||
180 | |||
181 | /* Allocate info block and space for the name string */ | ||
182 | |||
183 | interface_info = | ||
184 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_interface_info)); | ||
185 | if (!interface_info) { | ||
186 | return (AE_NO_MEMORY); | ||
187 | } | ||
188 | |||
189 | interface_info->name = | ||
190 | ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1); | ||
191 | if (!interface_info->name) { | ||
192 | ACPI_FREE(interface_info); | ||
193 | return (AE_NO_MEMORY); | ||
194 | } | ||
195 | |||
196 | /* Initialize new info and insert at the head of the global list */ | ||
197 | |||
198 | ACPI_STRCPY(interface_info->name, interface_name); | ||
199 | interface_info->flags = ACPI_OSI_DYNAMIC; | ||
200 | interface_info->next = acpi_gbl_supported_interfaces; | ||
201 | |||
202 | acpi_gbl_supported_interfaces = interface_info; | ||
203 | return (AE_OK); | ||
204 | } | ||
205 | |||
206 | /******************************************************************************* | ||
207 | * | ||
208 | * FUNCTION: acpi_ut_remove_interface | ||
209 | * | ||
210 | * PARAMETERS: interface_name - The interface to remove | ||
211 | * | ||
212 | * RETURN: Status | ||
213 | * | ||
214 | * DESCRIPTION: Remove the interface from the global interface list. | ||
215 | * Caller MUST hold acpi_gbl_osi_mutex | ||
216 | * | ||
217 | ******************************************************************************/ | ||
218 | |||
219 | acpi_status acpi_ut_remove_interface(acpi_string interface_name) | ||
220 | { | ||
221 | struct acpi_interface_info *previous_interface; | ||
222 | struct acpi_interface_info *next_interface; | ||
223 | |||
224 | previous_interface = next_interface = acpi_gbl_supported_interfaces; | ||
225 | while (next_interface) { | ||
226 | if (!ACPI_STRCMP(interface_name, next_interface->name)) { | ||
227 | |||
228 | /* Found: name is in either the static list or was added at runtime */ | ||
229 | |||
230 | if (next_interface->flags & ACPI_OSI_DYNAMIC) { | ||
231 | |||
232 | /* Interface was added dynamically, remove and free it */ | ||
233 | |||
234 | if (previous_interface == next_interface) { | ||
235 | acpi_gbl_supported_interfaces = | ||
236 | next_interface->next; | ||
237 | } else { | ||
238 | previous_interface->next = | ||
239 | next_interface->next; | ||
240 | } | ||
241 | |||
242 | ACPI_FREE(next_interface->name); | ||
243 | ACPI_FREE(next_interface); | ||
244 | } else { | ||
245 | /* | ||
246 | * Interface is in static list. If marked invalid, then it | ||
247 | * does not actually exist. Else, mark it invalid. | ||
248 | */ | ||
249 | if (next_interface->flags & ACPI_OSI_INVALID) { | ||
250 | return (AE_NOT_EXIST); | ||
251 | } | ||
252 | |||
253 | next_interface->flags |= ACPI_OSI_INVALID; | ||
254 | } | ||
255 | |||
256 | return (AE_OK); | ||
257 | } | ||
258 | |||
259 | previous_interface = next_interface; | ||
260 | next_interface = next_interface->next; | ||
261 | } | ||
262 | |||
263 | /* Interface was not found */ | ||
264 | |||
265 | return (AE_NOT_EXIST); | ||
266 | } | ||
267 | |||
268 | /******************************************************************************* | ||
269 | * | ||
270 | * FUNCTION: acpi_ut_get_interface | ||
271 | * | ||
272 | * PARAMETERS: interface_name - The interface to find | ||
273 | * | ||
274 | * RETURN: struct acpi_interface_info if found. NULL if not found. | ||
275 | * | ||
276 | * DESCRIPTION: Search for the specified interface name in the global list. | ||
277 | * Caller MUST hold acpi_gbl_osi_mutex | ||
278 | * | ||
279 | ******************************************************************************/ | ||
280 | |||
281 | struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name) | ||
282 | { | ||
283 | struct acpi_interface_info *next_interface; | ||
284 | |||
285 | next_interface = acpi_gbl_supported_interfaces; | ||
286 | while (next_interface) { | ||
287 | if (!ACPI_STRCMP(interface_name, next_interface->name)) { | ||
288 | return (next_interface); | ||
289 | } | ||
290 | |||
291 | next_interface = next_interface->next; | ||
292 | } | ||
293 | |||
294 | return (NULL); | ||
295 | } | ||
296 | |||
297 | /******************************************************************************* | ||
298 | * | ||
299 | * FUNCTION: acpi_ut_osi_implementation | ||
300 | * | ||
301 | * PARAMETERS: walk_state - Current walk state | ||
302 | * | ||
303 | * RETURN: Status | ||
304 | * | ||
305 | * DESCRIPTION: Implementation of the _OSI predefined control method. When | ||
306 | * an invocation of _OSI is encountered in the system AML, | ||
307 | * control is transferred to this function. | ||
308 | * | ||
309 | ******************************************************************************/ | ||
310 | |||
311 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state * walk_state) | ||
312 | { | ||
313 | union acpi_operand_object *string_desc; | ||
314 | union acpi_operand_object *return_desc; | ||
315 | struct acpi_interface_info *interface_info; | ||
316 | acpi_interface_handler interface_handler; | ||
317 | u32 return_value; | ||
318 | |||
319 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | ||
320 | |||
321 | /* Validate the string input argument (from the AML caller) */ | ||
322 | |||
323 | string_desc = walk_state->arguments[0].object; | ||
324 | if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) { | ||
325 | return_ACPI_STATUS(AE_TYPE); | ||
326 | } | ||
327 | |||
328 | /* Create a return object */ | ||
329 | |||
330 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
331 | if (!return_desc) { | ||
332 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
333 | } | ||
334 | |||
335 | /* Default return value is 0, NOT SUPPORTED */ | ||
336 | |||
337 | return_value = 0; | ||
338 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
339 | |||
340 | /* Lookup the interface in the global _OSI list */ | ||
341 | |||
342 | interface_info = acpi_ut_get_interface(string_desc->string.pointer); | ||
343 | if (interface_info && !(interface_info->flags & ACPI_OSI_INVALID)) { | ||
344 | /* | ||
345 | * The interface is supported. | ||
346 | * Update the osi_data if necessary. We keep track of the latest | ||
347 | * version of Windows that has been requested by the BIOS. | ||
348 | */ | ||
349 | if (interface_info->value > acpi_gbl_osi_data) { | ||
350 | acpi_gbl_osi_data = interface_info->value; | ||
351 | } | ||
352 | |||
353 | return_value = ACPI_UINT32_MAX; | ||
354 | } | ||
355 | |||
356 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
357 | |||
358 | /* | ||
359 | * Invoke an optional _OSI interface handler. The host OS may wish | ||
360 | * to do some interface-specific handling. For example, warn about | ||
361 | * certain interfaces or override the true/false support value. | ||
362 | */ | ||
363 | interface_handler = acpi_gbl_interface_handler; | ||
364 | if (interface_handler) { | ||
365 | return_value = | ||
366 | interface_handler(string_desc->string.pointer, | ||
367 | return_value); | ||
368 | } | ||
369 | |||
370 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, | ||
371 | "ACPI: BIOS _OSI(\"%s\") is %ssupported\n", | ||
372 | string_desc->string.pointer, | ||
373 | return_value == 0 ? "not " : "")); | ||
374 | |||
375 | /* Complete the return object */ | ||
376 | |||
377 | return_desc->integer.value = return_value; | ||
378 | walk_state->return_desc = return_desc; | ||
379 | return_ACPI_STATUS(AE_OK); | ||
380 | } | ||
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index 7f8cefcb2b3..1f484c9a688 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -110,6 +110,15 @@ acpi_status __init acpi_initialize_subsystem(void) | |||
110 | return_ACPI_STATUS(status); | 110 | return_ACPI_STATUS(status); |
111 | } | 111 | } |
112 | 112 | ||
113 | /* Initialize the global OSI interfaces list with the static names */ | ||
114 | |||
115 | status = acpi_ut_initialize_interfaces(); | ||
116 | if (ACPI_FAILURE(status)) { | ||
117 | ACPI_EXCEPTION((AE_INFO, status, | ||
118 | "During OSI interfaces initialization")); | ||
119 | return_ACPI_STATUS(status); | ||
120 | } | ||
121 | |||
113 | /* If configured, initialize the AML debugger */ | 122 | /* If configured, initialize the AML debugger */ |
114 | 123 | ||
115 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); | 124 | ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); |
@@ -290,19 +299,6 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
290 | } | 299 | } |
291 | 300 | ||
292 | /* | 301 | /* |
293 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
294 | * (GPE block 0 and 1). | ||
295 | * | ||
296 | * NOTE: Currently, there seems to be no need to run the _REG methods | ||
297 | * before enabling the GPEs. | ||
298 | */ | ||
299 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
300 | status = acpi_ev_install_fadt_gpes(); | ||
301 | if (ACPI_FAILURE(status)) | ||
302 | return (status); | ||
303 | } | ||
304 | |||
305 | /* | ||
306 | * Empty the caches (delete the cached objects) on the assumption that | 302 | * Empty the caches (delete the cached objects) on the assumption that |
307 | * the table load filled them up more than they will be at runtime -- | 303 | * the table load filled them up more than they will be at runtime -- |
308 | * thus wasting non-paged memory. | 304 | * thus wasting non-paged memory. |
@@ -506,6 +502,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
506 | 502 | ||
507 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | 503 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) |
508 | #endif /* ACPI_FUTURE_USAGE */ | 504 | #endif /* ACPI_FUTURE_USAGE */ |
505 | |||
509 | /***************************************************************************** | 506 | /***************************************************************************** |
510 | * | 507 | * |
511 | * FUNCTION: acpi_purge_cached_objects | 508 | * FUNCTION: acpi_purge_cached_objects |
@@ -529,4 +526,117 @@ acpi_status acpi_purge_cached_objects(void) | |||
529 | } | 526 | } |
530 | 527 | ||
531 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | 528 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) |
532 | #endif | 529 | |
530 | /***************************************************************************** | ||
531 | * | ||
532 | * FUNCTION: acpi_install_interface | ||
533 | * | ||
534 | * PARAMETERS: interface_name - The interface to install | ||
535 | * | ||
536 | * RETURN: Status | ||
537 | * | ||
538 | * DESCRIPTION: Install an _OSI interface to the global list | ||
539 | * | ||
540 | ****************************************************************************/ | ||
541 | acpi_status acpi_install_interface(acpi_string interface_name) | ||
542 | { | ||
543 | acpi_status status; | ||
544 | struct acpi_interface_info *interface_info; | ||
545 | |||
546 | /* Parameter validation */ | ||
547 | |||
548 | if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { | ||
549 | return (AE_BAD_PARAMETER); | ||
550 | } | ||
551 | |||
552 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
553 | |||
554 | /* Check if the interface name is already in the global list */ | ||
555 | |||
556 | interface_info = acpi_ut_get_interface(interface_name); | ||
557 | if (interface_info) { | ||
558 | /* | ||
559 | * The interface already exists in the list. This is OK if the | ||
560 | * interface has been marked invalid -- just clear the bit. | ||
561 | */ | ||
562 | if (interface_info->flags & ACPI_OSI_INVALID) { | ||
563 | interface_info->flags &= ~ACPI_OSI_INVALID; | ||
564 | status = AE_OK; | ||
565 | } else { | ||
566 | status = AE_ALREADY_EXISTS; | ||
567 | } | ||
568 | } else { | ||
569 | /* New interface name, install into the global list */ | ||
570 | |||
571 | status = acpi_ut_install_interface(interface_name); | ||
572 | } | ||
573 | |||
574 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
575 | return (status); | ||
576 | } | ||
577 | |||
578 | ACPI_EXPORT_SYMBOL(acpi_install_interface) | ||
579 | |||
580 | /***************************************************************************** | ||
581 | * | ||
582 | * FUNCTION: acpi_remove_interface | ||
583 | * | ||
584 | * PARAMETERS: interface_name - The interface to remove | ||
585 | * | ||
586 | * RETURN: Status | ||
587 | * | ||
588 | * DESCRIPTION: Remove an _OSI interface from the global list | ||
589 | * | ||
590 | ****************************************************************************/ | ||
591 | acpi_status acpi_remove_interface(acpi_string interface_name) | ||
592 | { | ||
593 | acpi_status status; | ||
594 | |||
595 | /* Parameter validation */ | ||
596 | |||
597 | if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) { | ||
598 | return (AE_BAD_PARAMETER); | ||
599 | } | ||
600 | |||
601 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
602 | |||
603 | status = acpi_ut_remove_interface(interface_name); | ||
604 | |||
605 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
606 | return (status); | ||
607 | } | ||
608 | |||
609 | ACPI_EXPORT_SYMBOL(acpi_remove_interface) | ||
610 | |||
611 | /***************************************************************************** | ||
612 | * | ||
613 | * FUNCTION: acpi_install_interface_handler | ||
614 | * | ||
615 | * PARAMETERS: Handler - The _OSI interface handler to install | ||
616 | * NULL means "remove existing handler" | ||
617 | * | ||
618 | * RETURN: Status | ||
619 | * | ||
620 | * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. | ||
621 | * invoked during execution of the internal implementation of | ||
622 | * _OSI. A NULL handler simply removes any existing handler. | ||
623 | * | ||
624 | ****************************************************************************/ | ||
625 | acpi_status acpi_install_interface_handler(acpi_interface_handler handler) | ||
626 | { | ||
627 | acpi_status status = AE_OK; | ||
628 | |||
629 | (void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex, ACPI_WAIT_FOREVER); | ||
630 | |||
631 | if (handler && acpi_gbl_interface_handler) { | ||
632 | status = AE_ALREADY_EXISTS; | ||
633 | } else { | ||
634 | acpi_gbl_interface_handler = handler; | ||
635 | } | ||
636 | |||
637 | acpi_os_release_mutex(acpi_gbl_osi_mutex); | ||
638 | return (status); | ||
639 | } | ||
640 | |||
641 | ACPI_EXPORT_SYMBOL(acpi_install_interface_handler) | ||
642 | #endif /* !ACPI_ASL_COMPILER */ | ||
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c new file mode 100644 index 00000000000..6f12e314fba --- /dev/null +++ b/drivers/acpi/acpica/utxferror.c | |||
@@ -0,0 +1,415 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utxferror - Various error/warning output functions | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utxferror") | ||
50 | |||
51 | /* | ||
52 | * This module is used for the in-kernel ACPICA as well as the ACPICA | ||
53 | * tools/applications. | ||
54 | * | ||
55 | * For the i_aSL compiler case, the output is redirected to stderr so that | ||
56 | * any of the various ACPI errors and warnings do not appear in the output | ||
57 | * files, for either the compiler or disassembler portions of the tool. | ||
58 | */ | ||
59 | #ifdef ACPI_ASL_COMPILER | ||
60 | #include <stdio.h> | ||
61 | extern FILE *acpi_gbl_output_file; | ||
62 | |||
63 | #define ACPI_MSG_REDIRECT_BEGIN \ | ||
64 | FILE *output_file = acpi_gbl_output_file; \ | ||
65 | acpi_os_redirect_output (stderr); | ||
66 | |||
67 | #define ACPI_MSG_REDIRECT_END \ | ||
68 | acpi_os_redirect_output (output_file); | ||
69 | |||
70 | #else | ||
71 | /* | ||
72 | * non-i_aSL case - no redirection, nothing to do | ||
73 | */ | ||
74 | #define ACPI_MSG_REDIRECT_BEGIN | ||
75 | #define ACPI_MSG_REDIRECT_END | ||
76 | #endif | ||
77 | /* | ||
78 | * Common message prefixes | ||
79 | */ | ||
80 | #define ACPI_MSG_ERROR "ACPI Error: " | ||
81 | #define ACPI_MSG_EXCEPTION "ACPI Exception: " | ||
82 | #define ACPI_MSG_WARNING "ACPI Warning: " | ||
83 | #define ACPI_MSG_INFO "ACPI: " | ||
84 | /* | ||
85 | * Common message suffix | ||
86 | */ | ||
87 | #define ACPI_MSG_SUFFIX \ | ||
88 | acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
89 | /******************************************************************************* | ||
90 | * | ||
91 | * FUNCTION: acpi_error | ||
92 | * | ||
93 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
94 | * line_number - Caller's line number (for error output) | ||
95 | * Format - Printf format string + additional args | ||
96 | * | ||
97 | * RETURN: None | ||
98 | * | ||
99 | * DESCRIPTION: Print "ACPI Error" message with module/line/version info | ||
100 | * | ||
101 | ******************************************************************************/ | ||
102 | void ACPI_INTERNAL_VAR_XFACE | ||
103 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
104 | { | ||
105 | va_list arg_list; | ||
106 | |||
107 | ACPI_MSG_REDIRECT_BEGIN; | ||
108 | acpi_os_printf(ACPI_MSG_ERROR); | ||
109 | |||
110 | va_start(arg_list, format); | ||
111 | acpi_os_vprintf(format, arg_list); | ||
112 | ACPI_MSG_SUFFIX; | ||
113 | va_end(arg_list); | ||
114 | |||
115 | ACPI_MSG_REDIRECT_END; | ||
116 | } | ||
117 | |||
118 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
119 | |||
120 | /******************************************************************************* | ||
121 | * | ||
122 | * FUNCTION: acpi_exception | ||
123 | * | ||
124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
125 | * line_number - Caller's line number (for error output) | ||
126 | * Status - Status to be formatted | ||
127 | * Format - Printf format string + additional args | ||
128 | * | ||
129 | * RETURN: None | ||
130 | * | ||
131 | * DESCRIPTION: Print "ACPI Exception" message with module/line/version info | ||
132 | * and decoded acpi_status. | ||
133 | * | ||
134 | ******************************************************************************/ | ||
135 | void ACPI_INTERNAL_VAR_XFACE | ||
136 | acpi_exception(const char *module_name, | ||
137 | u32 line_number, acpi_status status, const char *format, ...) | ||
138 | { | ||
139 | va_list arg_list; | ||
140 | |||
141 | ACPI_MSG_REDIRECT_BEGIN; | ||
142 | acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", | ||
143 | acpi_format_exception(status)); | ||
144 | |||
145 | va_start(arg_list, format); | ||
146 | acpi_os_vprintf(format, arg_list); | ||
147 | ACPI_MSG_SUFFIX; | ||
148 | va_end(arg_list); | ||
149 | |||
150 | ACPI_MSG_REDIRECT_END; | ||
151 | } | ||
152 | |||
153 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
154 | |||
155 | /******************************************************************************* | ||
156 | * | ||
157 | * FUNCTION: acpi_warning | ||
158 | * | ||
159 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
160 | * line_number - Caller's line number (for error output) | ||
161 | * Format - Printf format string + additional args | ||
162 | * | ||
163 | * RETURN: None | ||
164 | * | ||
165 | * DESCRIPTION: Print "ACPI Warning" message with module/line/version info | ||
166 | * | ||
167 | ******************************************************************************/ | ||
168 | void ACPI_INTERNAL_VAR_XFACE | ||
169 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
170 | { | ||
171 | va_list arg_list; | ||
172 | |||
173 | ACPI_MSG_REDIRECT_BEGIN; | ||
174 | acpi_os_printf(ACPI_MSG_WARNING); | ||
175 | |||
176 | va_start(arg_list, format); | ||
177 | acpi_os_vprintf(format, arg_list); | ||
178 | ACPI_MSG_SUFFIX; | ||
179 | va_end(arg_list); | ||
180 | |||
181 | ACPI_MSG_REDIRECT_END; | ||
182 | } | ||
183 | |||
184 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
185 | |||
186 | /******************************************************************************* | ||
187 | * | ||
188 | * FUNCTION: acpi_info | ||
189 | * | ||
190 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
191 | * line_number - Caller's line number (for error output) | ||
192 | * Format - Printf format string + additional args | ||
193 | * | ||
194 | * RETURN: None | ||
195 | * | ||
196 | * DESCRIPTION: Print generic "ACPI:" information message. There is no | ||
197 | * module/line/version info in order to keep the message simple. | ||
198 | * | ||
199 | * TBD: module_name and line_number args are not needed, should be removed. | ||
200 | * | ||
201 | ******************************************************************************/ | ||
202 | void ACPI_INTERNAL_VAR_XFACE | ||
203 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
204 | { | ||
205 | va_list arg_list; | ||
206 | |||
207 | ACPI_MSG_REDIRECT_BEGIN; | ||
208 | acpi_os_printf(ACPI_MSG_INFO); | ||
209 | |||
210 | va_start(arg_list, format); | ||
211 | acpi_os_vprintf(format, arg_list); | ||
212 | acpi_os_printf("\n"); | ||
213 | va_end(arg_list); | ||
214 | |||
215 | ACPI_MSG_REDIRECT_END; | ||
216 | } | ||
217 | |||
218 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
219 | |||
220 | /* | ||
221 | * The remainder of this module contains internal error functions that may | ||
222 | * be configured out. | ||
223 | */ | ||
224 | #if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) | ||
225 | /******************************************************************************* | ||
226 | * | ||
227 | * FUNCTION: acpi_ut_predefined_warning | ||
228 | * | ||
229 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
230 | * line_number - Caller's line number (for error output) | ||
231 | * Pathname - Full pathname to the node | ||
232 | * node_flags - From Namespace node for the method/object | ||
233 | * Format - Printf format string + additional args | ||
234 | * | ||
235 | * RETURN: None | ||
236 | * | ||
237 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
238 | * only emitted the first time a problem with a particular | ||
239 | * method/object is detected. This prevents a flood of error | ||
240 | * messages for methods that are repeatedly evaluated. | ||
241 | * | ||
242 | ******************************************************************************/ | ||
243 | void ACPI_INTERNAL_VAR_XFACE | ||
244 | acpi_ut_predefined_warning(const char *module_name, | ||
245 | u32 line_number, | ||
246 | char *pathname, | ||
247 | u8 node_flags, const char *format, ...) | ||
248 | { | ||
249 | va_list arg_list; | ||
250 | |||
251 | /* | ||
252 | * Warning messages for this method/object will be disabled after the | ||
253 | * first time a validation fails or an object is successfully repaired. | ||
254 | */ | ||
255 | if (node_flags & ANOBJ_EVALUATED) { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname); | ||
260 | |||
261 | va_start(arg_list, format); | ||
262 | acpi_os_vprintf(format, arg_list); | ||
263 | ACPI_MSG_SUFFIX; | ||
264 | va_end(arg_list); | ||
265 | } | ||
266 | |||
267 | /******************************************************************************* | ||
268 | * | ||
269 | * FUNCTION: acpi_ut_predefined_info | ||
270 | * | ||
271 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
272 | * line_number - Caller's line number (for error output) | ||
273 | * Pathname - Full pathname to the node | ||
274 | * node_flags - From Namespace node for the method/object | ||
275 | * Format - Printf format string + additional args | ||
276 | * | ||
277 | * RETURN: None | ||
278 | * | ||
279 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
280 | * are only emitted the first time a problem with a particular | ||
281 | * method/object is detected. This prevents a flood of | ||
282 | * messages for methods that are repeatedly evaluated. | ||
283 | * | ||
284 | ******************************************************************************/ | ||
285 | |||
286 | void ACPI_INTERNAL_VAR_XFACE | ||
287 | acpi_ut_predefined_info(const char *module_name, | ||
288 | u32 line_number, | ||
289 | char *pathname, u8 node_flags, const char *format, ...) | ||
290 | { | ||
291 | va_list arg_list; | ||
292 | |||
293 | /* | ||
294 | * Warning messages for this method/object will be disabled after the | ||
295 | * first time a validation fails or an object is successfully repaired. | ||
296 | */ | ||
297 | if (node_flags & ANOBJ_EVALUATED) { | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname); | ||
302 | |||
303 | va_start(arg_list, format); | ||
304 | acpi_os_vprintf(format, arg_list); | ||
305 | ACPI_MSG_SUFFIX; | ||
306 | va_end(arg_list); | ||
307 | } | ||
308 | |||
309 | /******************************************************************************* | ||
310 | * | ||
311 | * FUNCTION: acpi_ut_namespace_error | ||
312 | * | ||
313 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
314 | * line_number - Caller's line number (for error output) | ||
315 | * internal_name - Name or path of the namespace node | ||
316 | * lookup_status - Exception code from NS lookup | ||
317 | * | ||
318 | * RETURN: None | ||
319 | * | ||
320 | * DESCRIPTION: Print error message with the full pathname for the NS node. | ||
321 | * | ||
322 | ******************************************************************************/ | ||
323 | |||
324 | void | ||
325 | acpi_ut_namespace_error(const char *module_name, | ||
326 | u32 line_number, | ||
327 | const char *internal_name, acpi_status lookup_status) | ||
328 | { | ||
329 | acpi_status status; | ||
330 | u32 bad_name; | ||
331 | char *name = NULL; | ||
332 | |||
333 | ACPI_MSG_REDIRECT_BEGIN; | ||
334 | acpi_os_printf(ACPI_MSG_ERROR); | ||
335 | |||
336 | if (lookup_status == AE_BAD_CHARACTER) { | ||
337 | |||
338 | /* There is a non-ascii character in the name */ | ||
339 | |||
340 | ACPI_MOVE_32_TO_32(&bad_name, | ||
341 | ACPI_CAST_PTR(u32, internal_name)); | ||
342 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
343 | } else { | ||
344 | /* Convert path to external format */ | ||
345 | |||
346 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
347 | internal_name, NULL, &name); | ||
348 | |||
349 | /* Print target name */ | ||
350 | |||
351 | if (ACPI_SUCCESS(status)) { | ||
352 | acpi_os_printf("[%s]", name); | ||
353 | } else { | ||
354 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
355 | } | ||
356 | |||
357 | if (name) { | ||
358 | ACPI_FREE(name); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | acpi_os_printf(" Namespace lookup failure, %s", | ||
363 | acpi_format_exception(lookup_status)); | ||
364 | |||
365 | ACPI_MSG_SUFFIX; | ||
366 | ACPI_MSG_REDIRECT_END; | ||
367 | } | ||
368 | |||
369 | /******************************************************************************* | ||
370 | * | ||
371 | * FUNCTION: acpi_ut_method_error | ||
372 | * | ||
373 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
374 | * line_number - Caller's line number (for error output) | ||
375 | * Message - Error message to use on failure | ||
376 | * prefix_node - Prefix relative to the path | ||
377 | * Path - Path to the node (optional) | ||
378 | * method_status - Execution status | ||
379 | * | ||
380 | * RETURN: None | ||
381 | * | ||
382 | * DESCRIPTION: Print error message with the full pathname for the method. | ||
383 | * | ||
384 | ******************************************************************************/ | ||
385 | |||
386 | void | ||
387 | acpi_ut_method_error(const char *module_name, | ||
388 | u32 line_number, | ||
389 | const char *message, | ||
390 | struct acpi_namespace_node *prefix_node, | ||
391 | const char *path, acpi_status method_status) | ||
392 | { | ||
393 | acpi_status status; | ||
394 | struct acpi_namespace_node *node = prefix_node; | ||
395 | |||
396 | ACPI_MSG_REDIRECT_BEGIN; | ||
397 | acpi_os_printf(ACPI_MSG_ERROR); | ||
398 | |||
399 | if (path) { | ||
400 | status = | ||
401 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
402 | &node); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | acpi_os_printf("[Could not get node by pathname]"); | ||
405 | } | ||
406 | } | ||
407 | |||
408 | acpi_ns_print_node_pathname(node, message); | ||
409 | acpi_os_printf(", %s", acpi_format_exception(method_status)); | ||
410 | |||
411 | ACPI_MSG_SUFFIX; | ||
412 | ACPI_MSG_REDIRECT_END; | ||
413 | } | ||
414 | |||
415 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 907e350f1c7..fca34ccfd29 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig | |||
@@ -34,6 +34,6 @@ config ACPI_APEI_ERST_DEBUG | |||
34 | depends on ACPI_APEI | 34 | depends on ACPI_APEI |
35 | help | 35 | help |
36 | ERST is a way provided by APEI to save and retrieve hardware | 36 | ERST is a way provided by APEI to save and retrieve hardware |
37 | error infomation to and from a persistent store. Enable this | 37 | error information to and from a persistent store. Enable this |
38 | if you want to debugging and testing the ERST kernel support | 38 | if you want to debugging and testing the ERST kernel support |
39 | and firmware implementation. | 39 | and firmware implementation. |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 73fd0c7487c..4a904a4bf05 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -445,11 +445,15 @@ EXPORT_SYMBOL_GPL(apei_resources_sub); | |||
445 | int apei_resources_request(struct apei_resources *resources, | 445 | int apei_resources_request(struct apei_resources *resources, |
446 | const char *desc) | 446 | const char *desc) |
447 | { | 447 | { |
448 | struct apei_res *res, *res_bak; | 448 | struct apei_res *res, *res_bak = NULL; |
449 | struct resource *r; | 449 | struct resource *r; |
450 | int rc; | ||
450 | 451 | ||
451 | apei_resources_sub(resources, &apei_resources_all); | 452 | rc = apei_resources_sub(resources, &apei_resources_all); |
453 | if (rc) | ||
454 | return rc; | ||
452 | 455 | ||
456 | rc = -EINVAL; | ||
453 | list_for_each_entry(res, &resources->iomem, list) { | 457 | list_for_each_entry(res, &resources->iomem, list) { |
454 | r = request_mem_region(res->start, res->end - res->start, | 458 | r = request_mem_region(res->start, res->end - res->start, |
455 | desc); | 459 | desc); |
@@ -475,7 +479,11 @@ int apei_resources_request(struct apei_resources *resources, | |||
475 | } | 479 | } |
476 | } | 480 | } |
477 | 481 | ||
478 | apei_resources_merge(&apei_resources_all, resources); | 482 | rc = apei_resources_merge(&apei_resources_all, resources); |
483 | if (rc) { | ||
484 | pr_err(APEI_PFX "Fail to merge resources!\n"); | ||
485 | goto err_unmap_ioport; | ||
486 | } | ||
479 | 487 | ||
480 | return 0; | 488 | return 0; |
481 | err_unmap_ioport: | 489 | err_unmap_ioport: |
@@ -491,12 +499,13 @@ err_unmap_iomem: | |||
491 | break; | 499 | break; |
492 | release_mem_region(res->start, res->end - res->start); | 500 | release_mem_region(res->start, res->end - res->start); |
493 | } | 501 | } |
494 | return -EINVAL; | 502 | return rc; |
495 | } | 503 | } |
496 | EXPORT_SYMBOL_GPL(apei_resources_request); | 504 | EXPORT_SYMBOL_GPL(apei_resources_request); |
497 | 505 | ||
498 | void apei_resources_release(struct apei_resources *resources) | 506 | void apei_resources_release(struct apei_resources *resources) |
499 | { | 507 | { |
508 | int rc; | ||
500 | struct apei_res *res; | 509 | struct apei_res *res; |
501 | 510 | ||
502 | list_for_each_entry(res, &resources->iomem, list) | 511 | list_for_each_entry(res, &resources->iomem, list) |
@@ -504,7 +513,9 @@ void apei_resources_release(struct apei_resources *resources) | |||
504 | list_for_each_entry(res, &resources->ioport, list) | 513 | list_for_each_entry(res, &resources->ioport, list) |
505 | release_region(res->start, res->end - res->start); | 514 | release_region(res->start, res->end - res->start); |
506 | 515 | ||
507 | apei_resources_sub(&apei_resources_all, resources); | 516 | rc = apei_resources_sub(&apei_resources_all, resources); |
517 | if (rc) | ||
518 | pr_err(APEI_PFX "Fail to sub resources!\n"); | ||
508 | } | 519 | } |
509 | EXPORT_SYMBOL_GPL(apei_resources_release); | 520 | EXPORT_SYMBOL_GPL(apei_resources_release); |
510 | 521 | ||
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 465c885938e..cf29df69380 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c | |||
@@ -426,7 +426,9 @@ DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL, | |||
426 | 426 | ||
427 | static int einj_check_table(struct acpi_table_einj *einj_tab) | 427 | static int einj_check_table(struct acpi_table_einj *einj_tab) |
428 | { | 428 | { |
429 | if (einj_tab->header_length != sizeof(struct acpi_table_einj)) | 429 | if ((einj_tab->header_length != |
430 | (sizeof(struct acpi_table_einj) - sizeof(einj_tab->header))) | ||
431 | && (einj_tab->header_length != sizeof(struct acpi_table_einj))) | ||
430 | return -EINVAL; | 432 | return -EINVAL; |
431 | if (einj_tab->header.length < sizeof(struct acpi_table_einj)) | 433 | if (einj_tab->header.length < sizeof(struct acpi_table_einj)) |
432 | return -EINVAL; | 434 | return -EINVAL; |
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c index 5281ddda277..da1228a9a54 100644 --- a/drivers/acpi/apei/erst-dbg.c +++ b/drivers/acpi/apei/erst-dbg.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * APEI Error Record Serialization Table debug support | 2 | * APEI Error Record Serialization Table debug support |
3 | * | 3 | * |
4 | * ERST is a way provided by APEI to save and retrieve hardware error | 4 | * ERST is a way provided by APEI to save and retrieve hardware error |
5 | * infomation to and from a persistent store. This file provide the | 5 | * information to and from a persistent store. This file provide the |
6 | * debugging/testing support for ERST kernel support and firmware | 6 | * debugging/testing support for ERST kernel support and firmware |
7 | * implementation. | 7 | * implementation. |
8 | * | 8 | * |
@@ -111,11 +111,13 @@ retry: | |||
111 | goto out; | 111 | goto out; |
112 | } | 112 | } |
113 | if (len > erst_dbg_buf_len) { | 113 | if (len > erst_dbg_buf_len) { |
114 | kfree(erst_dbg_buf); | 114 | void *p; |
115 | rc = -ENOMEM; | 115 | rc = -ENOMEM; |
116 | erst_dbg_buf = kmalloc(len, GFP_KERNEL); | 116 | p = kmalloc(len, GFP_KERNEL); |
117 | if (!erst_dbg_buf) | 117 | if (!p) |
118 | goto out; | 118 | goto out; |
119 | kfree(erst_dbg_buf); | ||
120 | erst_dbg_buf = p; | ||
119 | erst_dbg_buf_len = len; | 121 | erst_dbg_buf_len = len; |
120 | goto retry; | 122 | goto retry; |
121 | } | 123 | } |
@@ -150,11 +152,13 @@ static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf, | |||
150 | if (mutex_lock_interruptible(&erst_dbg_mutex)) | 152 | if (mutex_lock_interruptible(&erst_dbg_mutex)) |
151 | return -EINTR; | 153 | return -EINTR; |
152 | if (usize > erst_dbg_buf_len) { | 154 | if (usize > erst_dbg_buf_len) { |
153 | kfree(erst_dbg_buf); | 155 | void *p; |
154 | rc = -ENOMEM; | 156 | rc = -ENOMEM; |
155 | erst_dbg_buf = kmalloc(usize, GFP_KERNEL); | 157 | p = kmalloc(usize, GFP_KERNEL); |
156 | if (!erst_dbg_buf) | 158 | if (!p) |
157 | goto out; | 159 | goto out; |
160 | kfree(erst_dbg_buf); | ||
161 | erst_dbg_buf = p; | ||
158 | erst_dbg_buf_len = usize; | 162 | erst_dbg_buf_len = usize; |
159 | } | 163 | } |
160 | rc = copy_from_user(erst_dbg_buf, ubuf, usize); | 164 | rc = copy_from_user(erst_dbg_buf, ubuf, usize); |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 18645f4e83c..1211c03149e 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * APEI Error Record Serialization Table support | 2 | * APEI Error Record Serialization Table support |
3 | * | 3 | * |
4 | * ERST is a way provided by APEI to save and retrieve hardware error | 4 | * ERST is a way provided by APEI to save and retrieve hardware error |
5 | * infomation to and from a persistent store. | 5 | * information to and from a persistent store. |
6 | * | 6 | * |
7 | * For more information about ERST, please refer to ACPI Specification | 7 | * For more information about ERST, please refer to ACPI Specification |
8 | * version 4.0, section 17.4. | 8 | * version 4.0, section 17.4. |
@@ -266,13 +266,30 @@ static int erst_exec_move_data(struct apei_exec_context *ctx, | |||
266 | { | 266 | { |
267 | int rc; | 267 | int rc; |
268 | u64 offset; | 268 | u64 offset; |
269 | void *src, *dst; | ||
270 | |||
271 | /* ioremap does not work in interrupt context */ | ||
272 | if (in_interrupt()) { | ||
273 | pr_warning(ERST_PFX | ||
274 | "MOVE_DATA can not be used in interrupt context"); | ||
275 | return -EBUSY; | ||
276 | } | ||
269 | 277 | ||
270 | rc = __apei_exec_read_register(entry, &offset); | 278 | rc = __apei_exec_read_register(entry, &offset); |
271 | if (rc) | 279 | if (rc) |
272 | return rc; | 280 | return rc; |
273 | memmove((void *)ctx->dst_base + offset, | 281 | |
274 | (void *)ctx->src_base + offset, | 282 | src = ioremap(ctx->src_base + offset, ctx->var2); |
275 | ctx->var2); | 283 | if (!src) |
284 | return -ENOMEM; | ||
285 | dst = ioremap(ctx->dst_base + offset, ctx->var2); | ||
286 | if (!dst) | ||
287 | return -ENOMEM; | ||
288 | |||
289 | memmove(dst, src, ctx->var2); | ||
290 | |||
291 | iounmap(src); | ||
292 | iounmap(dst); | ||
276 | 293 | ||
277 | return 0; | 294 | return 0; |
278 | } | 295 | } |
@@ -750,7 +767,9 @@ __setup("erst_disable", setup_erst_disable); | |||
750 | 767 | ||
751 | static int erst_check_table(struct acpi_table_erst *erst_tab) | 768 | static int erst_check_table(struct acpi_table_erst *erst_tab) |
752 | { | 769 | { |
753 | if (erst_tab->header_length != sizeof(struct acpi_table_erst)) | 770 | if ((erst_tab->header_length != |
771 | (sizeof(struct acpi_table_erst) - sizeof(erst_tab->header))) | ||
772 | && (erst_tab->header_length != sizeof(struct acpi_table_einj))) | ||
754 | return -EINVAL; | 773 | return -EINVAL; |
755 | if (erst_tab->header.length < sizeof(struct acpi_table_erst)) | 774 | if (erst_tab->header.length < sizeof(struct acpi_table_erst)) |
756 | return -EINVAL; | 775 | return -EINVAL; |
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 385a6059714..0d505e59214 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -302,7 +302,7 @@ static int __devinit ghes_probe(struct platform_device *ghes_dev) | |||
302 | struct ghes *ghes = NULL; | 302 | struct ghes *ghes = NULL; |
303 | int rc = -EINVAL; | 303 | int rc = -EINVAL; |
304 | 304 | ||
305 | generic = ghes_dev->dev.platform_data; | 305 | generic = *(struct acpi_hest_generic **)ghes_dev->dev.platform_data; |
306 | if (!generic->enabled) | 306 | if (!generic->enabled) |
307 | return -ENODEV; | 307 | return -ENODEV; |
308 | 308 | ||
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index 343168d1826..1a3508a7fe0 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c | |||
@@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) | |||
137 | 137 | ||
138 | static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) | 138 | static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) |
139 | { | 139 | { |
140 | struct acpi_hest_generic *generic; | ||
141 | struct platform_device *ghes_dev; | 140 | struct platform_device *ghes_dev; |
142 | struct ghes_arr *ghes_arr = data; | 141 | struct ghes_arr *ghes_arr = data; |
143 | int rc; | 142 | int rc; |
144 | 143 | ||
145 | if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) | 144 | if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) |
146 | return 0; | 145 | return 0; |
147 | generic = (struct acpi_hest_generic *)hest_hdr; | 146 | |
148 | if (!generic->enabled) | 147 | if (!((struct acpi_hest_generic *)hest_hdr)->enabled) |
149 | return 0; | 148 | return 0; |
150 | ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); | 149 | ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); |
151 | if (!ghes_dev) | 150 | if (!ghes_dev) |
152 | return -ENOMEM; | 151 | return -ENOMEM; |
153 | ghes_dev->dev.platform_data = generic; | 152 | |
153 | rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *)); | ||
154 | if (rc) | ||
155 | goto err; | ||
156 | |||
154 | rc = platform_device_add(ghes_dev); | 157 | rc = platform_device_add(ghes_dev); |
155 | if (rc) | 158 | if (rc) |
156 | goto err; | 159 | goto err; |
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c index 8f8bd736d4f..542e5390389 100644 --- a/drivers/acpi/atomicio.c +++ b/drivers/acpi/atomicio.c | |||
@@ -142,7 +142,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr, | |||
142 | list_add_tail_rcu(&map->list, &acpi_iomaps); | 142 | list_add_tail_rcu(&map->list, &acpi_iomaps); |
143 | spin_unlock_irqrestore(&acpi_iomaps_lock, flags); | 143 | spin_unlock_irqrestore(&acpi_iomaps_lock, flags); |
144 | 144 | ||
145 | return vaddr + (paddr - pg_off); | 145 | return map->vaddr + (paddr - map->paddr); |
146 | err_unmap: | 146 | err_unmap: |
147 | iounmap(vaddr); | 147 | iounmap(vaddr); |
148 | return NULL; | 148 | return NULL; |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index dc58402b0a1..95649d37307 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -42,10 +42,7 @@ | |||
42 | 42 | ||
43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
45 | |||
46 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
47 | #include <linux/power_supply.h> | 45 | #include <linux/power_supply.h> |
48 | #endif | ||
49 | 46 | ||
50 | #define PREFIX "ACPI: " | 47 | #define PREFIX "ACPI: " |
51 | 48 | ||
@@ -98,13 +95,12 @@ enum { | |||
98 | * due to bad math. | 95 | * due to bad math. |
99 | */ | 96 | */ |
100 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, | 97 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, |
98 | ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, | ||
101 | }; | 99 | }; |
102 | 100 | ||
103 | struct acpi_battery { | 101 | struct acpi_battery { |
104 | struct mutex lock; | 102 | struct mutex lock; |
105 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
106 | struct power_supply bat; | 103 | struct power_supply bat; |
107 | #endif | ||
108 | struct acpi_device *device; | 104 | struct acpi_device *device; |
109 | unsigned long update_time; | 105 | unsigned long update_time; |
110 | int rate_now; | 106 | int rate_now; |
@@ -141,7 +137,6 @@ inline int acpi_battery_present(struct acpi_battery *battery) | |||
141 | return battery->device->status.battery_present; | 137 | return battery->device->status.battery_present; |
142 | } | 138 | } |
143 | 139 | ||
144 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
145 | static int acpi_battery_technology(struct acpi_battery *battery) | 140 | static int acpi_battery_technology(struct acpi_battery *battery) |
146 | { | 141 | { |
147 | if (!strcasecmp("NiCd", battery->type)) | 142 | if (!strcasecmp("NiCd", battery->type)) |
@@ -186,6 +181,7 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
186 | enum power_supply_property psp, | 181 | enum power_supply_property psp, |
187 | union power_supply_propval *val) | 182 | union power_supply_propval *val) |
188 | { | 183 | { |
184 | int ret = 0; | ||
189 | struct acpi_battery *battery = to_acpi_battery(psy); | 185 | struct acpi_battery *battery = to_acpi_battery(psy); |
190 | 186 | ||
191 | if (acpi_battery_present(battery)) { | 187 | if (acpi_battery_present(battery)) { |
@@ -214,26 +210,44 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
214 | val->intval = battery->cycle_count; | 210 | val->intval = battery->cycle_count; |
215 | break; | 211 | break; |
216 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 212 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
217 | val->intval = battery->design_voltage * 1000; | 213 | if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) |
214 | ret = -ENODEV; | ||
215 | else | ||
216 | val->intval = battery->design_voltage * 1000; | ||
218 | break; | 217 | break; |
219 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | 218 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: |
220 | val->intval = battery->voltage_now * 1000; | 219 | if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN) |
220 | ret = -ENODEV; | ||
221 | else | ||
222 | val->intval = battery->voltage_now * 1000; | ||
221 | break; | 223 | break; |
222 | case POWER_SUPPLY_PROP_CURRENT_NOW: | 224 | case POWER_SUPPLY_PROP_CURRENT_NOW: |
223 | case POWER_SUPPLY_PROP_POWER_NOW: | 225 | case POWER_SUPPLY_PROP_POWER_NOW: |
224 | val->intval = battery->rate_now * 1000; | 226 | if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) |
227 | ret = -ENODEV; | ||
228 | else | ||
229 | val->intval = battery->rate_now * 1000; | ||
225 | break; | 230 | break; |
226 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | 231 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: |
227 | case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: | 232 | case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: |
228 | val->intval = battery->design_capacity * 1000; | 233 | if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
234 | ret = -ENODEV; | ||
235 | else | ||
236 | val->intval = battery->design_capacity * 1000; | ||
229 | break; | 237 | break; |
230 | case POWER_SUPPLY_PROP_CHARGE_FULL: | 238 | case POWER_SUPPLY_PROP_CHARGE_FULL: |
231 | case POWER_SUPPLY_PROP_ENERGY_FULL: | 239 | case POWER_SUPPLY_PROP_ENERGY_FULL: |
232 | val->intval = battery->full_charge_capacity * 1000; | 240 | if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
241 | ret = -ENODEV; | ||
242 | else | ||
243 | val->intval = battery->full_charge_capacity * 1000; | ||
233 | break; | 244 | break; |
234 | case POWER_SUPPLY_PROP_CHARGE_NOW: | 245 | case POWER_SUPPLY_PROP_CHARGE_NOW: |
235 | case POWER_SUPPLY_PROP_ENERGY_NOW: | 246 | case POWER_SUPPLY_PROP_ENERGY_NOW: |
236 | val->intval = battery->capacity_now * 1000; | 247 | if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) |
248 | ret = -ENODEV; | ||
249 | else | ||
250 | val->intval = battery->capacity_now * 1000; | ||
237 | break; | 251 | break; |
238 | case POWER_SUPPLY_PROP_MODEL_NAME: | 252 | case POWER_SUPPLY_PROP_MODEL_NAME: |
239 | val->strval = battery->model_number; | 253 | val->strval = battery->model_number; |
@@ -245,9 +259,9 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
245 | val->strval = battery->serial_number; | 259 | val->strval = battery->serial_number; |
246 | break; | 260 | break; |
247 | default: | 261 | default: |
248 | return -EINVAL; | 262 | ret = -EINVAL; |
249 | } | 263 | } |
250 | return 0; | 264 | return ret; |
251 | } | 265 | } |
252 | 266 | ||
253 | static enum power_supply_property charge_battery_props[] = { | 267 | static enum power_supply_property charge_battery_props[] = { |
@@ -273,7 +287,6 @@ static enum power_supply_property energy_battery_props[] = { | |||
273 | POWER_SUPPLY_PROP_CYCLE_COUNT, | 287 | POWER_SUPPLY_PROP_CYCLE_COUNT, |
274 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 288 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
275 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 289 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
276 | POWER_SUPPLY_PROP_CURRENT_NOW, | ||
277 | POWER_SUPPLY_PROP_POWER_NOW, | 290 | POWER_SUPPLY_PROP_POWER_NOW, |
278 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | 291 | POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, |
279 | POWER_SUPPLY_PROP_ENERGY_FULL, | 292 | POWER_SUPPLY_PROP_ENERGY_FULL, |
@@ -282,7 +295,6 @@ static enum power_supply_property energy_battery_props[] = { | |||
282 | POWER_SUPPLY_PROP_MANUFACTURER, | 295 | POWER_SUPPLY_PROP_MANUFACTURER, |
283 | POWER_SUPPLY_PROP_SERIAL_NUMBER, | 296 | POWER_SUPPLY_PROP_SERIAL_NUMBER, |
284 | }; | 297 | }; |
285 | #endif | ||
286 | 298 | ||
287 | #ifdef CONFIG_ACPI_PROCFS_POWER | 299 | #ifdef CONFIG_ACPI_PROCFS_POWER |
288 | inline char *acpi_battery_units(struct acpi_battery *battery) | 300 | inline char *acpi_battery_units(struct acpi_battery *battery) |
@@ -413,6 +425,8 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
413 | result = extract_package(battery, buffer.pointer, | 425 | result = extract_package(battery, buffer.pointer, |
414 | info_offsets, ARRAY_SIZE(info_offsets)); | 426 | info_offsets, ARRAY_SIZE(info_offsets)); |
415 | kfree(buffer.pointer); | 427 | kfree(buffer.pointer); |
428 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) | ||
429 | battery->full_charge_capacity = battery->design_capacity; | ||
416 | return result; | 430 | return result; |
417 | } | 431 | } |
418 | 432 | ||
@@ -449,6 +463,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
449 | battery->rate_now != -1) | 463 | battery->rate_now != -1) |
450 | battery->rate_now = abs((s16)battery->rate_now); | 464 | battery->rate_now = abs((s16)battery->rate_now); |
451 | 465 | ||
466 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | ||
467 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | ||
468 | battery->capacity_now = (battery->capacity_now * | ||
469 | battery->full_charge_capacity) / 100; | ||
452 | return result; | 470 | return result; |
453 | } | 471 | } |
454 | 472 | ||
@@ -493,7 +511,6 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
493 | return acpi_battery_set_alarm(battery); | 511 | return acpi_battery_set_alarm(battery); |
494 | } | 512 | } |
495 | 513 | ||
496 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
497 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 514 | static ssize_t acpi_battery_alarm_show(struct device *dev, |
498 | struct device_attribute *attr, | 515 | struct device_attribute *attr, |
499 | char *buf) | 516 | char *buf) |
@@ -553,7 +570,6 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
553 | power_supply_unregister(&battery->bat); | 570 | power_supply_unregister(&battery->bat); |
554 | battery->bat.dev = NULL; | 571 | battery->bat.dev = NULL; |
555 | } | 572 | } |
556 | #endif | ||
557 | 573 | ||
558 | static void acpi_battery_quirks(struct acpi_battery *battery) | 574 | static void acpi_battery_quirks(struct acpi_battery *battery) |
559 | { | 575 | { |
@@ -562,6 +578,33 @@ static void acpi_battery_quirks(struct acpi_battery *battery) | |||
562 | } | 578 | } |
563 | } | 579 | } |
564 | 580 | ||
581 | /* | ||
582 | * According to the ACPI spec, some kinds of primary batteries can | ||
583 | * report percentage battery remaining capacity directly to OS. | ||
584 | * In this case, it reports the Last Full Charged Capacity == 100 | ||
585 | * and BatteryPresentRate == 0xFFFFFFFF. | ||
586 | * | ||
587 | * Now we found some battery reports percentage remaining capacity | ||
588 | * even if it's rechargeable. | ||
589 | * https://bugzilla.kernel.org/show_bug.cgi?id=15979 | ||
590 | * | ||
591 | * Handle this correctly so that they won't break userspace. | ||
592 | */ | ||
593 | static void acpi_battery_quirks2(struct acpi_battery *battery) | ||
594 | { | ||
595 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) | ||
596 | return ; | ||
597 | |||
598 | if (battery->full_charge_capacity == 100 && | ||
599 | battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN && | ||
600 | battery->capacity_now >=0 && battery->capacity_now <= 100) { | ||
601 | set_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags); | ||
602 | battery->full_charge_capacity = battery->design_capacity; | ||
603 | battery->capacity_now = (battery->capacity_now * | ||
604 | battery->full_charge_capacity) / 100; | ||
605 | } | ||
606 | } | ||
607 | |||
565 | static int acpi_battery_update(struct acpi_battery *battery) | 608 | static int acpi_battery_update(struct acpi_battery *battery) |
566 | { | 609 | { |
567 | int result, old_present = acpi_battery_present(battery); | 610 | int result, old_present = acpi_battery_present(battery); |
@@ -569,9 +612,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
569 | if (result) | 612 | if (result) |
570 | return result; | 613 | return result; |
571 | if (!acpi_battery_present(battery)) { | 614 | if (!acpi_battery_present(battery)) { |
572 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
573 | sysfs_remove_battery(battery); | 615 | sysfs_remove_battery(battery); |
574 | #endif | ||
575 | battery->update_time = 0; | 616 | battery->update_time = 0; |
576 | return 0; | 617 | return 0; |
577 | } | 618 | } |
@@ -583,11 +624,11 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
583 | acpi_battery_quirks(battery); | 624 | acpi_battery_quirks(battery); |
584 | acpi_battery_init_alarm(battery); | 625 | acpi_battery_init_alarm(battery); |
585 | } | 626 | } |
586 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
587 | if (!battery->bat.dev) | 627 | if (!battery->bat.dev) |
588 | sysfs_add_battery(battery); | 628 | sysfs_add_battery(battery); |
589 | #endif | 629 | result = acpi_battery_get_state(battery); |
590 | return acpi_battery_get_state(battery); | 630 | acpi_battery_quirks2(battery); |
631 | return result; | ||
591 | } | 632 | } |
592 | 633 | ||
593 | /* -------------------------------------------------------------------------- | 634 | /* -------------------------------------------------------------------------- |
@@ -868,26 +909,20 @@ static void acpi_battery_remove_fs(struct acpi_device *device) | |||
868 | static void acpi_battery_notify(struct acpi_device *device, u32 event) | 909 | static void acpi_battery_notify(struct acpi_device *device, u32 event) |
869 | { | 910 | { |
870 | struct acpi_battery *battery = acpi_driver_data(device); | 911 | struct acpi_battery *battery = acpi_driver_data(device); |
871 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
872 | struct device *old; | 912 | struct device *old; |
873 | #endif | ||
874 | 913 | ||
875 | if (!battery) | 914 | if (!battery) |
876 | return; | 915 | return; |
877 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
878 | old = battery->bat.dev; | 916 | old = battery->bat.dev; |
879 | #endif | ||
880 | acpi_battery_update(battery); | 917 | acpi_battery_update(battery); |
881 | acpi_bus_generate_proc_event(device, event, | 918 | acpi_bus_generate_proc_event(device, event, |
882 | acpi_battery_present(battery)); | 919 | acpi_battery_present(battery)); |
883 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 920 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
884 | dev_name(&device->dev), event, | 921 | dev_name(&device->dev), event, |
885 | acpi_battery_present(battery)); | 922 | acpi_battery_present(battery)); |
886 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
887 | /* acpi_battery_update could remove power_supply object */ | 923 | /* acpi_battery_update could remove power_supply object */ |
888 | if (old && battery->bat.dev) | 924 | if (old && battery->bat.dev) |
889 | power_supply_changed(&battery->bat); | 925 | power_supply_changed(&battery->bat); |
890 | #endif | ||
891 | } | 926 | } |
892 | 927 | ||
893 | static int acpi_battery_add(struct acpi_device *device) | 928 | static int acpi_battery_add(struct acpi_device *device) |
@@ -935,9 +970,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
935 | #ifdef CONFIG_ACPI_PROCFS_POWER | 970 | #ifdef CONFIG_ACPI_PROCFS_POWER |
936 | acpi_battery_remove_fs(device); | 971 | acpi_battery_remove_fs(device); |
937 | #endif | 972 | #endif |
938 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
939 | sysfs_remove_battery(battery); | 973 | sysfs_remove_battery(battery); |
940 | #endif | ||
941 | mutex_destroy(&battery->lock); | 974 | mutex_destroy(&battery->lock); |
942 | kfree(battery); | 975 | kfree(battery); |
943 | return 0; | 976 | return 0; |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 2bb28b9d91c..af308d03f49 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -183,6 +183,8 @@ static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) | |||
183 | { | 183 | { |
184 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | 184 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
185 | acpi_osi_setup("!Windows 2006"); | 185 | acpi_osi_setup("!Windows 2006"); |
186 | acpi_osi_setup("!Windows 2006 SP1"); | ||
187 | acpi_osi_setup("!Windows 2006 SP2"); | ||
186 | return 0; | 188 | return 0; |
187 | } | 189 | } |
188 | static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) | 190 | static int __init dmi_disable_osi_win7(const struct dmi_system_id *d) |
@@ -202,6 +204,23 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
202 | }, | 204 | }, |
203 | }, | 205 | }, |
204 | { | 206 | { |
207 | /* | ||
208 | * There have a NVIF method in MSI GX723 DSDT need call by Nvidia | ||
209 | * driver (e.g. nouveau) when user press brightness hotkey. | ||
210 | * Currently, nouveau driver didn't do the job and it causes there | ||
211 | * have a infinite while loop in DSDT when user press hotkey. | ||
212 | * We add MSI GX723's dmi information to this table for workaround | ||
213 | * this issue. | ||
214 | * Will remove MSI GX723 from the table after nouveau grows support. | ||
215 | */ | ||
216 | .callback = dmi_disable_osi_vista, | ||
217 | .ident = "MSI GX723", | ||
218 | .matches = { | ||
219 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | ||
220 | DMI_MATCH(DMI_PRODUCT_NAME, "GX723"), | ||
221 | }, | ||
222 | }, | ||
223 | { | ||
205 | .callback = dmi_disable_osi_vista, | 224 | .callback = dmi_disable_osi_vista, |
206 | .ident = "Sony VGN-NS10J_S", | 225 | .ident = "Sony VGN-NS10J_S", |
207 | .matches = { | 226 | .matches = { |
@@ -226,6 +245,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
226 | }, | 245 | }, |
227 | }, | 246 | }, |
228 | { | 247 | { |
248 | .callback = dmi_disable_osi_vista, | ||
249 | .ident = "Toshiba Satellite L355", | ||
250 | .matches = { | ||
251 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
252 | DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"), | ||
253 | }, | ||
254 | }, | ||
255 | { | ||
229 | .callback = dmi_disable_osi_win7, | 256 | .callback = dmi_disable_osi_win7, |
230 | .ident = "ASUS K50IJ", | 257 | .ident = "ASUS K50IJ", |
231 | .matches = { | 258 | .matches = { |
@@ -233,6 +260,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
233 | DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), | 260 | DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"), |
234 | }, | 261 | }, |
235 | }, | 262 | }, |
263 | { | ||
264 | .callback = dmi_disable_osi_vista, | ||
265 | .ident = "Toshiba P305D", | ||
266 | .matches = { | ||
267 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
268 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"), | ||
269 | }, | ||
270 | }, | ||
236 | 271 | ||
237 | /* | 272 | /* |
238 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 273 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5c221ab535d..310e3b9749c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -55,7 +55,7 @@ EXPORT_SYMBOL(acpi_root_dir); | |||
55 | static int set_power_nocheck(const struct dmi_system_id *id) | 55 | static int set_power_nocheck(const struct dmi_system_id *id) |
56 | { | 56 | { |
57 | printk(KERN_NOTICE PREFIX "%s detected - " | 57 | printk(KERN_NOTICE PREFIX "%s detected - " |
58 | "disable power check in power transistion\n", id->ident); | 58 | "disable power check in power transition\n", id->ident); |
59 | acpi_power_nocheck = 1; | 59 | acpi_power_nocheck = 1; |
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |
@@ -80,23 +80,15 @@ static int set_copy_dsdt(const struct dmi_system_id *id) | |||
80 | 80 | ||
81 | static struct dmi_system_id dsdt_dmi_table[] __initdata = { | 81 | static struct dmi_system_id dsdt_dmi_table[] __initdata = { |
82 | /* | 82 | /* |
83 | * Insyde BIOS on some TOSHIBA machines corrupt the DSDT. | 83 | * Invoke DSDT corruption work-around on all Toshiba Satellite. |
84 | * https://bugzilla.kernel.org/show_bug.cgi?id=14679 | 84 | * https://bugzilla.kernel.org/show_bug.cgi?id=14679 |
85 | */ | 85 | */ |
86 | { | 86 | { |
87 | .callback = set_copy_dsdt, | 87 | .callback = set_copy_dsdt, |
88 | .ident = "TOSHIBA Satellite A505", | 88 | .ident = "TOSHIBA Satellite", |
89 | .matches = { | 89 | .matches = { |
90 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 90 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
91 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite A505"), | 91 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), |
92 | }, | ||
93 | }, | ||
94 | { | ||
95 | .callback = set_copy_dsdt, | ||
96 | .ident = "TOSHIBA Satellite L505D", | ||
97 | .matches = { | ||
98 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
99 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L505D"), | ||
100 | }, | 92 | }, |
101 | }, | 93 | }, |
102 | {} | 94 | {} |
@@ -1027,7 +1019,7 @@ static int __init acpi_init(void) | |||
1027 | 1019 | ||
1028 | /* | 1020 | /* |
1029 | * If the laptop falls into the DMI check table, the power state check | 1021 | * If the laptop falls into the DMI check table, the power state check |
1030 | * will be disabled in the course of device power transistion. | 1022 | * will be disabled in the course of device power transition. |
1031 | */ | 1023 | */ |
1032 | dmi_check_system(power_nocheck_dmi_table); | 1024 | dmi_check_system(power_nocheck_dmi_table); |
1033 | 1025 | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 1575a9b51f1..71ef9cd0735 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -338,7 +338,8 @@ static int acpi_button_add(struct acpi_device *device) | |||
338 | { | 338 | { |
339 | struct acpi_button *button; | 339 | struct acpi_button *button; |
340 | struct input_dev *input; | 340 | struct input_dev *input; |
341 | char *hid, *name, *class; | 341 | const char *hid = acpi_device_hid(device); |
342 | char *name, *class; | ||
342 | int error; | 343 | int error; |
343 | 344 | ||
344 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); | 345 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); |
@@ -353,7 +354,6 @@ static int acpi_button_add(struct acpi_device *device) | |||
353 | goto err_free_button; | 354 | goto err_free_button; |
354 | } | 355 | } |
355 | 356 | ||
356 | hid = acpi_device_hid(device); | ||
357 | name = acpi_device_name(device); | 357 | name = acpi_device_name(device); |
358 | class = acpi_device_class(device); | 358 | class = acpi_device_class(device); |
359 | 359 | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 3fe29e992be..44f99bd8374 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -725,6 +725,7 @@ static void dock_notify(acpi_handle handle, u32 event, void *data) | |||
725 | complete_dock(ds); | 725 | complete_dock(ds); |
726 | dock_event(ds, event, DOCK_EVENT); | 726 | dock_event(ds, event, DOCK_EVENT); |
727 | dock_lock(ds, 1); | 727 | dock_lock(ds, 1); |
728 | acpi_update_gpes(); | ||
728 | break; | 729 | break; |
729 | } | 730 | } |
730 | if (dock_present(ds) || dock_in_progress(ds)) | 731 | if (dock_present(ds) || dock_in_progress(ds)) |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 8a3b840c0bb..60049080c86 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/proc_fs.h> | ||
31 | #include <linux/seq_file.h> | ||
32 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
33 | #include <linux/thermal.h> | 31 | #include <linux/thermal.h> |
34 | #include <acpi/acpi_bus.h> | 32 | #include <acpi/acpi_bus.h> |
@@ -119,122 +117,6 @@ static struct thermal_cooling_device_ops fan_cooling_ops = { | |||
119 | }; | 117 | }; |
120 | 118 | ||
121 | /* -------------------------------------------------------------------------- | 119 | /* -------------------------------------------------------------------------- |
122 | FS Interface (/proc) | ||
123 | -------------------------------------------------------------------------- */ | ||
124 | #ifdef CONFIG_ACPI_PROCFS | ||
125 | |||
126 | static struct proc_dir_entry *acpi_fan_dir; | ||
127 | |||
128 | static int acpi_fan_read_state(struct seq_file *seq, void *offset) | ||
129 | { | ||
130 | struct acpi_device *device = seq->private; | ||
131 | int state = 0; | ||
132 | |||
133 | |||
134 | if (device) { | ||
135 | if (acpi_bus_get_power(device->handle, &state)) | ||
136 | seq_printf(seq, "status: ERROR\n"); | ||
137 | else | ||
138 | seq_printf(seq, "status: %s\n", | ||
139 | !state ? "on" : "off"); | ||
140 | } | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) | ||
145 | { | ||
146 | return single_open(file, acpi_fan_read_state, PDE(inode)->data); | ||
147 | } | ||
148 | |||
149 | static ssize_t | ||
150 | acpi_fan_write_state(struct file *file, const char __user * buffer, | ||
151 | size_t count, loff_t * ppos) | ||
152 | { | ||
153 | int result = 0; | ||
154 | struct seq_file *m = file->private_data; | ||
155 | struct acpi_device *device = m->private; | ||
156 | char state_string[3] = { '\0' }; | ||
157 | |||
158 | if (count > sizeof(state_string) - 1) | ||
159 | return -EINVAL; | ||
160 | |||
161 | if (copy_from_user(state_string, buffer, count)) | ||
162 | return -EFAULT; | ||
163 | |||
164 | state_string[count] = '\0'; | ||
165 | if ((state_string[0] < '0') || (state_string[0] > '3')) | ||
166 | return -EINVAL; | ||
167 | if (state_string[1] == '\n') | ||
168 | state_string[1] = '\0'; | ||
169 | if (state_string[1] != '\0') | ||
170 | return -EINVAL; | ||
171 | |||
172 | result = acpi_bus_set_power(device->handle, | ||
173 | simple_strtoul(state_string, NULL, 0)); | ||
174 | if (result) | ||
175 | return result; | ||
176 | |||
177 | return count; | ||
178 | } | ||
179 | |||
180 | static const struct file_operations acpi_fan_state_ops = { | ||
181 | .open = acpi_fan_state_open_fs, | ||
182 | .read = seq_read, | ||
183 | .write = acpi_fan_write_state, | ||
184 | .llseek = seq_lseek, | ||
185 | .release = single_release, | ||
186 | .owner = THIS_MODULE, | ||
187 | }; | ||
188 | |||
189 | static int acpi_fan_add_fs(struct acpi_device *device) | ||
190 | { | ||
191 | struct proc_dir_entry *entry = NULL; | ||
192 | |||
193 | |||
194 | if (!device) | ||
195 | return -EINVAL; | ||
196 | |||
197 | if (!acpi_device_dir(device)) { | ||
198 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
199 | acpi_fan_dir); | ||
200 | if (!acpi_device_dir(device)) | ||
201 | return -ENODEV; | ||
202 | } | ||
203 | |||
204 | /* 'status' [R/W] */ | ||
205 | entry = proc_create_data(ACPI_FAN_FILE_STATE, | ||
206 | S_IFREG | S_IRUGO | S_IWUSR, | ||
207 | acpi_device_dir(device), | ||
208 | &acpi_fan_state_ops, | ||
209 | device); | ||
210 | if (!entry) | ||
211 | return -ENODEV; | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static int acpi_fan_remove_fs(struct acpi_device *device) | ||
216 | { | ||
217 | |||
218 | if (acpi_device_dir(device)) { | ||
219 | remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); | ||
220 | remove_proc_entry(acpi_device_bid(device), acpi_fan_dir); | ||
221 | acpi_device_dir(device) = NULL; | ||
222 | } | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | #else | ||
227 | static int acpi_fan_add_fs(struct acpi_device *device) | ||
228 | { | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static int acpi_fan_remove_fs(struct acpi_device *device) | ||
233 | { | ||
234 | return 0; | ||
235 | } | ||
236 | #endif | ||
237 | /* -------------------------------------------------------------------------- | ||
238 | Driver Interface | 120 | Driver Interface |
239 | -------------------------------------------------------------------------- */ | 121 | -------------------------------------------------------------------------- */ |
240 | 122 | ||
@@ -284,10 +166,6 @@ static int acpi_fan_add(struct acpi_device *device) | |||
284 | dev_err(&device->dev, "Failed to create sysfs link " | 166 | dev_err(&device->dev, "Failed to create sysfs link " |
285 | "'device'\n"); | 167 | "'device'\n"); |
286 | 168 | ||
287 | result = acpi_fan_add_fs(device); | ||
288 | if (result) | ||
289 | goto end; | ||
290 | |||
291 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", | 169 | printk(KERN_INFO PREFIX "%s [%s] (%s)\n", |
292 | acpi_device_name(device), acpi_device_bid(device), | 170 | acpi_device_name(device), acpi_device_bid(device), |
293 | !device->power.state ? "on" : "off"); | 171 | !device->power.state ? "on" : "off"); |
@@ -303,7 +181,6 @@ static int acpi_fan_remove(struct acpi_device *device, int type) | |||
303 | if (!device || !cdev) | 181 | if (!device || !cdev) |
304 | return -EINVAL; | 182 | return -EINVAL; |
305 | 183 | ||
306 | acpi_fan_remove_fs(device); | ||
307 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | 184 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); |
308 | sysfs_remove_link(&cdev->device.kobj, "device"); | 185 | sysfs_remove_link(&cdev->device.kobj, "device"); |
309 | thermal_cooling_device_unregister(cdev); | 186 | thermal_cooling_device_unregister(cdev); |
@@ -347,19 +224,9 @@ static int __init acpi_fan_init(void) | |||
347 | { | 224 | { |
348 | int result = 0; | 225 | int result = 0; |
349 | 226 | ||
350 | #ifdef CONFIG_ACPI_PROCFS | ||
351 | acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); | ||
352 | if (!acpi_fan_dir) | ||
353 | return -ENODEV; | ||
354 | #endif | ||
355 | |||
356 | result = acpi_bus_register_driver(&acpi_fan_driver); | 227 | result = acpi_bus_register_driver(&acpi_fan_driver); |
357 | if (result < 0) { | 228 | if (result < 0) |
358 | #ifdef CONFIG_ACPI_PROCFS | ||
359 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); | ||
360 | #endif | ||
361 | return -ENODEV; | 229 | return -ENODEV; |
362 | } | ||
363 | 230 | ||
364 | return 0; | 231 | return 0; |
365 | } | 232 | } |
@@ -369,8 +236,6 @@ static void __exit acpi_fan_exit(void) | |||
369 | 236 | ||
370 | acpi_bus_unregister_driver(&acpi_fan_driver); | 237 | acpi_bus_unregister_driver(&acpi_fan_driver); |
371 | 238 | ||
372 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); | ||
373 | |||
374 | return; | 239 | return; |
375 | } | 240 | } |
376 | 241 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 65b25a303b8..d3bed219c44 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -96,7 +96,9 @@ static LIST_HEAD(resource_list_head); | |||
96 | static DEFINE_SPINLOCK(acpi_res_lock); | 96 | static DEFINE_SPINLOCK(acpi_res_lock); |
97 | 97 | ||
98 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | 98 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ |
99 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; | 99 | static char osi_setup_string[OSI_STRING_LENGTH_MAX]; |
100 | |||
101 | static void __init acpi_osi_setup_late(void); | ||
100 | 102 | ||
101 | /* | 103 | /* |
102 | * The story of _OSI(Linux) | 104 | * The story of _OSI(Linux) |
@@ -138,6 +140,20 @@ static struct osi_linux { | |||
138 | unsigned int known:1; | 140 | unsigned int known:1; |
139 | } osi_linux = { 0, 0, 0, 0}; | 141 | } osi_linux = { 0, 0, 0, 0}; |
140 | 142 | ||
143 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) | ||
144 | { | ||
145 | if (!strcmp("Linux", interface)) { | ||
146 | |||
147 | printk(KERN_NOTICE FW_BUG PREFIX | ||
148 | "BIOS _OSI(Linux) query %s%s\n", | ||
149 | osi_linux.enable ? "honored" : "ignored", | ||
150 | osi_linux.cmdline ? " via cmdline" : | ||
151 | osi_linux.dmi ? " via DMI" : ""); | ||
152 | } | ||
153 | |||
154 | return supported; | ||
155 | } | ||
156 | |||
141 | static void __init acpi_request_region (struct acpi_generic_address *addr, | 157 | static void __init acpi_request_region (struct acpi_generic_address *addr, |
142 | unsigned int length, char *desc) | 158 | unsigned int length, char *desc) |
143 | { | 159 | { |
@@ -198,6 +214,8 @@ acpi_status acpi_os_initialize1(void) | |||
198 | BUG_ON(!kacpid_wq); | 214 | BUG_ON(!kacpid_wq); |
199 | BUG_ON(!kacpi_notify_wq); | 215 | BUG_ON(!kacpi_notify_wq); |
200 | BUG_ON(!kacpi_hotplug_wq); | 216 | BUG_ON(!kacpi_hotplug_wq); |
217 | acpi_install_interface_handler(acpi_osi_handler); | ||
218 | acpi_osi_setup_late(); | ||
201 | return AE_OK; | 219 | return AE_OK; |
202 | } | 220 | } |
203 | 221 | ||
@@ -547,9 +565,10 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) | |||
547 | 565 | ||
548 | acpi_status | 566 | acpi_status |
549 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | 567 | acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
550 | u32 *value, u32 width) | 568 | u64 *value, u32 width) |
551 | { | 569 | { |
552 | int result, size; | 570 | int result, size; |
571 | u32 value32; | ||
553 | 572 | ||
554 | if (!value) | 573 | if (!value) |
555 | return AE_BAD_PARAMETER; | 574 | return AE_BAD_PARAMETER; |
@@ -570,7 +589,8 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
570 | 589 | ||
571 | result = raw_pci_read(pci_id->segment, pci_id->bus, | 590 | result = raw_pci_read(pci_id->segment, pci_id->bus, |
572 | PCI_DEVFN(pci_id->device, pci_id->function), | 591 | PCI_DEVFN(pci_id->device, pci_id->function), |
573 | reg, size, value); | 592 | reg, size, &value32); |
593 | *value = value32; | ||
574 | 594 | ||
575 | return (result ? AE_ERROR : AE_OK); | 595 | return (result ? AE_ERROR : AE_OK); |
576 | } | 596 | } |
@@ -602,74 +622,6 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
602 | return (result ? AE_ERROR : AE_OK); | 622 | return (result ? AE_ERROR : AE_OK); |
603 | } | 623 | } |
604 | 624 | ||
605 | /* TODO: Change code to take advantage of driver model more */ | ||
606 | static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */ | ||
607 | acpi_handle chandle, /* current node */ | ||
608 | struct acpi_pci_id **id, | ||
609 | int *is_bridge, u8 * bus_number) | ||
610 | { | ||
611 | acpi_handle handle; | ||
612 | struct acpi_pci_id *pci_id = *id; | ||
613 | acpi_status status; | ||
614 | unsigned long long temp; | ||
615 | acpi_object_type type; | ||
616 | |||
617 | acpi_get_parent(chandle, &handle); | ||
618 | if (handle != rhandle) { | ||
619 | acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, | ||
620 | bus_number); | ||
621 | |||
622 | status = acpi_get_type(handle, &type); | ||
623 | if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE)) | ||
624 | return; | ||
625 | |||
626 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, | ||
627 | &temp); | ||
628 | if (ACPI_SUCCESS(status)) { | ||
629 | u32 val; | ||
630 | pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp)); | ||
631 | pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp)); | ||
632 | |||
633 | if (*is_bridge) | ||
634 | pci_id->bus = *bus_number; | ||
635 | |||
636 | /* any nicer way to get bus number of bridge ? */ | ||
637 | status = | ||
638 | acpi_os_read_pci_configuration(pci_id, 0x0e, &val, | ||
639 | 8); | ||
640 | if (ACPI_SUCCESS(status) | ||
641 | && ((val & 0x7f) == 1 || (val & 0x7f) == 2)) { | ||
642 | status = | ||
643 | acpi_os_read_pci_configuration(pci_id, 0x18, | ||
644 | &val, 8); | ||
645 | if (!ACPI_SUCCESS(status)) { | ||
646 | /* Certainly broken... FIX ME */ | ||
647 | return; | ||
648 | } | ||
649 | *is_bridge = 1; | ||
650 | pci_id->bus = val; | ||
651 | status = | ||
652 | acpi_os_read_pci_configuration(pci_id, 0x19, | ||
653 | &val, 8); | ||
654 | if (ACPI_SUCCESS(status)) { | ||
655 | *bus_number = val; | ||
656 | } | ||
657 | } else | ||
658 | *is_bridge = 0; | ||
659 | } | ||
660 | } | ||
661 | } | ||
662 | |||
663 | void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | ||
664 | acpi_handle chandle, /* current node */ | ||
665 | struct acpi_pci_id **id) | ||
666 | { | ||
667 | int is_bridge = 1; | ||
668 | u8 bus_number = (*id)->bus; | ||
669 | |||
670 | acpi_os_derive_pci_id_2(rhandle, chandle, id, &is_bridge, &bus_number); | ||
671 | } | ||
672 | |||
673 | static void acpi_os_execute_deferred(struct work_struct *work) | 625 | static void acpi_os_execute_deferred(struct work_struct *work) |
674 | { | 626 | { |
675 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | 627 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); |
@@ -977,6 +929,12 @@ static void __init set_osi_linux(unsigned int enable) | |||
977 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", | 929 | printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", |
978 | enable ? "Add": "Delet"); | 930 | enable ? "Add": "Delet"); |
979 | } | 931 | } |
932 | |||
933 | if (osi_linux.enable) | ||
934 | acpi_osi_setup("Linux"); | ||
935 | else | ||
936 | acpi_osi_setup("!Linux"); | ||
937 | |||
980 | return; | 938 | return; |
981 | } | 939 | } |
982 | 940 | ||
@@ -1011,21 +969,33 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | |||
1011 | * string starting with '!' disables that string | 969 | * string starting with '!' disables that string |
1012 | * otherwise string is added to list, augmenting built-in strings | 970 | * otherwise string is added to list, augmenting built-in strings |
1013 | */ | 971 | */ |
1014 | int __init acpi_osi_setup(char *str) | 972 | static void __init acpi_osi_setup_late(void) |
1015 | { | 973 | { |
1016 | if (str == NULL || *str == '\0') { | 974 | char *str = osi_setup_string; |
1017 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | 975 | |
1018 | acpi_gbl_create_osi_method = FALSE; | 976 | if (*str == '\0') |
1019 | } else if (!strcmp("!Linux", str)) { | 977 | return; |
978 | |||
979 | if (!strcmp("!Linux", str)) { | ||
1020 | acpi_cmdline_osi_linux(0); /* !enable */ | 980 | acpi_cmdline_osi_linux(0); /* !enable */ |
1021 | } else if (*str == '!') { | 981 | } else if (*str == '!') { |
1022 | if (acpi_osi_invalidate(++str) == AE_OK) | 982 | if (acpi_remove_interface(++str) == AE_OK) |
1023 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); | 983 | printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); |
1024 | } else if (!strcmp("Linux", str)) { | 984 | } else if (!strcmp("Linux", str)) { |
1025 | acpi_cmdline_osi_linux(1); /* enable */ | 985 | acpi_cmdline_osi_linux(1); /* enable */ |
1026 | } else if (*osi_additional_string == '\0') { | 986 | } else { |
1027 | strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX); | 987 | if (acpi_install_interface(str) == AE_OK) |
1028 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); | 988 | printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); |
989 | } | ||
990 | } | ||
991 | |||
992 | int __init acpi_osi_setup(char *str) | ||
993 | { | ||
994 | if (str == NULL || *str == '\0') { | ||
995 | printk(KERN_INFO PREFIX "_OSI method disabled\n"); | ||
996 | acpi_gbl_create_osi_method = FALSE; | ||
997 | } else { | ||
998 | strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); | ||
1029 | } | 999 | } |
1030 | 1000 | ||
1031 | return 1; | 1001 | return 1; |
@@ -1282,38 +1252,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1282 | return (AE_OK); | 1252 | return (AE_OK); |
1283 | } | 1253 | } |
1284 | 1254 | ||
1285 | /****************************************************************************** | ||
1286 | * | ||
1287 | * FUNCTION: acpi_os_validate_interface | ||
1288 | * | ||
1289 | * PARAMETERS: interface - Requested interface to be validated | ||
1290 | * | ||
1291 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | ||
1292 | * | ||
1293 | * DESCRIPTION: Match an interface string to the interfaces supported by the | ||
1294 | * host. Strings originate from an AML call to the _OSI method. | ||
1295 | * | ||
1296 | *****************************************************************************/ | ||
1297 | |||
1298 | acpi_status | ||
1299 | acpi_os_validate_interface (char *interface) | ||
1300 | { | ||
1301 | if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX)) | ||
1302 | return AE_OK; | ||
1303 | if (!strcmp("Linux", interface)) { | ||
1304 | |||
1305 | printk(KERN_NOTICE PREFIX | ||
1306 | "BIOS _OSI(Linux) query %s%s\n", | ||
1307 | osi_linux.enable ? "honored" : "ignored", | ||
1308 | osi_linux.cmdline ? " via cmdline" : | ||
1309 | osi_linux.dmi ? " via DMI" : ""); | ||
1310 | |||
1311 | if (osi_linux.enable) | ||
1312 | return AE_OK; | ||
1313 | } | ||
1314 | return AE_SUPPORT; | ||
1315 | } | ||
1316 | |||
1317 | static inline int acpi_res_list_add(struct acpi_res_list *res) | 1255 | static inline int acpi_res_list_add(struct acpi_res_list *res) |
1318 | { | 1256 | { |
1319 | struct acpi_res_list *res_list_elem; | 1257 | struct acpi_res_list *res_list_elem; |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index e4804fb05e2..f907cfbfa13 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/proc_fs.h> | ||
36 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
37 | #include <linux/pm.h> | 36 | #include <linux/pm.h> |
38 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8d47a5846ae..9ff80a7e9f6 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
37 | #include <linux/proc_fs.h> | ||
38 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
39 | #include <linux/pm.h> | 38 | #include <linux/pm.h> |
40 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 3ba8d1f44a7..96668ad0962 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/proc_fs.h> | ||
31 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
32 | #include <linux/pm.h> | 31 | #include <linux/pm.h> |
33 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index e9699aaed10..bec561c14be 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -29,12 +29,6 @@ static int set_no_mwait(const struct dmi_system_id *id) | |||
29 | 29 | ||
30 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { | 30 | static struct dmi_system_id __cpuinitdata processor_idle_dmi_table[] = { |
31 | { | 31 | { |
32 | set_no_mwait, "IFL91 board", { | ||
33 | DMI_MATCH(DMI_BIOS_VENDOR, "COMPAL"), | ||
34 | DMI_MATCH(DMI_SYS_VENDOR, "ZEPTO"), | ||
35 | DMI_MATCH(DMI_PRODUCT_VERSION, "3215W"), | ||
36 | DMI_MATCH(DMI_BOARD_NAME, "IFL91") }, NULL}, | ||
37 | { | ||
38 | set_no_mwait, "Extensa 5220", { | 32 | set_no_mwait, "Extensa 5220", { |
39 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), | 33 | DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"), |
40 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 34 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -352,4 +346,5 @@ void __init acpi_early_processor_set_pdc(void) | |||
352 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, | 346 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
353 | ACPI_UINT32_MAX, | 347 | ACPI_UINT32_MAX, |
354 | early_init_pdc, NULL, NULL, NULL); | 348 | early_init_pdc, NULL, NULL, NULL); |
349 | acpi_get_devices("ACPI0007", early_init_pdc, NULL, NULL); | ||
355 | } | 350 | } |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 15602189238..356c320bdd0 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -40,8 +40,10 @@ | |||
40 | #include <linux/pm.h> | 40 | #include <linux/pm.h> |
41 | #include <linux/cpufreq.h> | 41 | #include <linux/cpufreq.h> |
42 | #include <linux/cpu.h> | 42 | #include <linux/cpu.h> |
43 | #ifdef CONFIG_ACPI_PROCFS | ||
43 | #include <linux/proc_fs.h> | 44 | #include <linux/proc_fs.h> |
44 | #include <linux/seq_file.h> | 45 | #include <linux/seq_file.h> |
46 | #endif | ||
45 | #include <linux/dmi.h> | 47 | #include <linux/dmi.h> |
46 | #include <linux/moduleparam.h> | 48 | #include <linux/moduleparam.h> |
47 | #include <linux/cpuidle.h> | 49 | #include <linux/cpuidle.h> |
@@ -244,6 +246,7 @@ static int acpi_processor_errata(struct acpi_processor *pr) | |||
244 | return result; | 246 | return result; |
245 | } | 247 | } |
246 | 248 | ||
249 | #ifdef CONFIG_ACPI_PROCFS | ||
247 | static struct proc_dir_entry *acpi_processor_dir = NULL; | 250 | static struct proc_dir_entry *acpi_processor_dir = NULL; |
248 | 251 | ||
249 | static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) | 252 | static int __cpuinit acpi_processor_add_fs(struct acpi_device *device) |
@@ -280,7 +283,16 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
280 | 283 | ||
281 | return 0; | 284 | return 0; |
282 | } | 285 | } |
283 | 286 | #else | |
287 | static inline int acpi_processor_add_fs(struct acpi_device *device) | ||
288 | { | ||
289 | return 0; | ||
290 | } | ||
291 | static inline int acpi_processor_remove_fs(struct acpi_device *device) | ||
292 | { | ||
293 | return 0; | ||
294 | } | ||
295 | #endif | ||
284 | /* -------------------------------------------------------------------------- | 296 | /* -------------------------------------------------------------------------- |
285 | Driver Interface | 297 | Driver Interface |
286 | -------------------------------------------------------------------------- */ | 298 | -------------------------------------------------------------------------- */ |
@@ -842,15 +854,17 @@ static int __init acpi_processor_init(void) | |||
842 | 854 | ||
843 | memset(&errata, 0, sizeof(errata)); | 855 | memset(&errata, 0, sizeof(errata)); |
844 | 856 | ||
857 | #ifdef CONFIG_ACPI_PROCFS | ||
845 | acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); | 858 | acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
846 | if (!acpi_processor_dir) | 859 | if (!acpi_processor_dir) |
847 | return -ENOMEM; | 860 | return -ENOMEM; |
861 | #endif | ||
848 | 862 | ||
849 | if (!cpuidle_register_driver(&acpi_idle_driver)) { | 863 | if (!cpuidle_register_driver(&acpi_idle_driver)) { |
850 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", | 864 | printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", |
851 | acpi_idle_driver.name); | 865 | acpi_idle_driver.name); |
852 | } else { | 866 | } else { |
853 | printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s", | 867 | printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n", |
854 | cpuidle_get_driver()->name); | 868 | cpuidle_get_driver()->name); |
855 | } | 869 | } |
856 | 870 | ||
@@ -871,7 +885,9 @@ static int __init acpi_processor_init(void) | |||
871 | out_cpuidle: | 885 | out_cpuidle: |
872 | cpuidle_unregister_driver(&acpi_idle_driver); | 886 | cpuidle_unregister_driver(&acpi_idle_driver); |
873 | 887 | ||
888 | #ifdef CONFIG_ACPI_PROCFS | ||
874 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | 889 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
890 | #endif | ||
875 | 891 | ||
876 | return result; | 892 | return result; |
877 | } | 893 | } |
@@ -891,7 +907,9 @@ static void __exit acpi_processor_exit(void) | |||
891 | 907 | ||
892 | cpuidle_unregister_driver(&acpi_idle_driver); | 908 | cpuidle_unregister_driver(&acpi_idle_driver); |
893 | 909 | ||
910 | #ifdef CONFIG_ACPI_PROCFS | ||
894 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); | 911 | remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); |
912 | #endif | ||
895 | 913 | ||
896 | return; | 914 | return; |
897 | } | 915 | } |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index ba1bd263d90..3a73a93596e 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -447,8 +447,8 @@ int acpi_processor_notify_smm(struct module *calling_module) | |||
447 | if (!try_module_get(calling_module)) | 447 | if (!try_module_get(calling_module)) |
448 | return -EINVAL; | 448 | return -EINVAL; |
449 | 449 | ||
450 | /* is_done is set to negative if an error occured, | 450 | /* is_done is set to negative if an error occurred, |
451 | * and to postitive if _no_ error occured, but SMM | 451 | * and to postitive if _no_ error occurred, but SMM |
452 | * was already notified. This avoids double notification | 452 | * was already notified. This avoids double notification |
453 | * which might lead to unexpected results... | 453 | * which might lead to unexpected results... |
454 | */ | 454 | */ |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 730863855ed..ff3632717c5 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -32,8 +32,10 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/cpufreq.h> | 34 | #include <linux/cpufreq.h> |
35 | #ifdef CONFIG_ACPI_PROCFS | ||
35 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 37 | #include <linux/seq_file.h> |
38 | #endif | ||
37 | 39 | ||
38 | #include <asm/io.h> | 40 | #include <asm/io.h> |
39 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
@@ -1214,6 +1216,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
1214 | return result; | 1216 | return result; |
1215 | } | 1217 | } |
1216 | 1218 | ||
1219 | #ifdef CONFIG_ACPI_PROCFS | ||
1217 | /* proc interface */ | 1220 | /* proc interface */ |
1218 | static int acpi_processor_throttling_seq_show(struct seq_file *seq, | 1221 | static int acpi_processor_throttling_seq_show(struct seq_file *seq, |
1219 | void *offset) | 1222 | void *offset) |
@@ -1322,3 +1325,4 @@ const struct file_operations acpi_processor_throttling_fops = { | |||
1322 | .llseek = seq_lseek, | 1325 | .llseek = seq_lseek, |
1323 | .release = single_release, | 1326 | .release = single_release, |
1324 | }; | 1327 | }; |
1328 | #endif | ||
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 4ff76e8174e..e5dbedb16bb 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -40,10 +40,7 @@ | |||
40 | #include <linux/timer.h> | 40 | #include <linux/timer.h> |
41 | #include <linux/jiffies.h> | 41 | #include <linux/jiffies.h> |
42 | #include <linux/delay.h> | 42 | #include <linux/delay.h> |
43 | |||
44 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
45 | #include <linux/power_supply.h> | 43 | #include <linux/power_supply.h> |
46 | #endif | ||
47 | 44 | ||
48 | #include "sbshc.h" | 45 | #include "sbshc.h" |
49 | 46 | ||
@@ -85,9 +82,7 @@ static const struct acpi_device_id sbs_device_ids[] = { | |||
85 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | 82 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); |
86 | 83 | ||
87 | struct acpi_battery { | 84 | struct acpi_battery { |
88 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
89 | struct power_supply bat; | 85 | struct power_supply bat; |
90 | #endif | ||
91 | struct acpi_sbs *sbs; | 86 | struct acpi_sbs *sbs; |
92 | #ifdef CONFIG_ACPI_PROCFS_POWER | 87 | #ifdef CONFIG_ACPI_PROCFS_POWER |
93 | struct proc_dir_entry *proc_entry; | 88 | struct proc_dir_entry *proc_entry; |
@@ -120,9 +115,7 @@ struct acpi_battery { | |||
120 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 115 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
121 | 116 | ||
122 | struct acpi_sbs { | 117 | struct acpi_sbs { |
123 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
124 | struct power_supply charger; | 118 | struct power_supply charger; |
125 | #endif | ||
126 | struct acpi_device *device; | 119 | struct acpi_device *device; |
127 | struct acpi_smb_hc *hc; | 120 | struct acpi_smb_hc *hc; |
128 | struct mutex lock; | 121 | struct mutex lock; |
@@ -166,7 +159,6 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) | |||
166 | acpi_battery_ipscale(battery); | 159 | acpi_battery_ipscale(battery); |
167 | } | 160 | } |
168 | 161 | ||
169 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
170 | static int sbs_get_ac_property(struct power_supply *psy, | 162 | static int sbs_get_ac_property(struct power_supply *psy, |
171 | enum power_supply_property psp, | 163 | enum power_supply_property psp, |
172 | union power_supply_propval *val) | 164 | union power_supply_propval *val) |
@@ -313,7 +305,6 @@ static enum power_supply_property sbs_energy_battery_props[] = { | |||
313 | POWER_SUPPLY_PROP_MANUFACTURER, | 305 | POWER_SUPPLY_PROP_MANUFACTURER, |
314 | }; | 306 | }; |
315 | 307 | ||
316 | #endif | ||
317 | 308 | ||
318 | /* -------------------------------------------------------------------------- | 309 | /* -------------------------------------------------------------------------- |
319 | Smart Battery System Management | 310 | Smart Battery System Management |
@@ -449,7 +440,6 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) | |||
449 | return result; | 440 | return result; |
450 | } | 441 | } |
451 | 442 | ||
452 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
453 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 443 | static ssize_t acpi_battery_alarm_show(struct device *dev, |
454 | struct device_attribute *attr, | 444 | struct device_attribute *attr, |
455 | char *buf) | 445 | char *buf) |
@@ -479,7 +469,6 @@ static struct device_attribute alarm_attr = { | |||
479 | .show = acpi_battery_alarm_show, | 469 | .show = acpi_battery_alarm_show, |
480 | .store = acpi_battery_alarm_store, | 470 | .store = acpi_battery_alarm_store, |
481 | }; | 471 | }; |
482 | #endif | ||
483 | 472 | ||
484 | /* -------------------------------------------------------------------------- | 473 | /* -------------------------------------------------------------------------- |
485 | FS Interface (/proc/acpi) | 474 | FS Interface (/proc/acpi) |
@@ -798,7 +787,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
798 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 787 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
799 | battery); | 788 | battery); |
800 | #endif | 789 | #endif |
801 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
802 | battery->bat.name = battery->name; | 790 | battery->bat.name = battery->name; |
803 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; | 791 | battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; |
804 | if (!acpi_battery_mode(battery)) { | 792 | if (!acpi_battery_mode(battery)) { |
@@ -819,7 +807,6 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
819 | goto end; | 807 | goto end; |
820 | battery->have_sysfs_alarm = 1; | 808 | battery->have_sysfs_alarm = 1; |
821 | end: | 809 | end: |
822 | #endif | ||
823 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 810 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
824 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 811 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
825 | battery->name, battery->present ? "present" : "absent"); | 812 | battery->name, battery->present ? "present" : "absent"); |
@@ -828,17 +815,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
828 | 815 | ||
829 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 816 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
830 | { | 817 | { |
831 | #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) | ||
832 | struct acpi_battery *battery = &sbs->battery[id]; | 818 | struct acpi_battery *battery = &sbs->battery[id]; |
833 | #endif | ||
834 | 819 | ||
835 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
836 | if (battery->bat.dev) { | 820 | if (battery->bat.dev) { |
837 | if (battery->have_sysfs_alarm) | 821 | if (battery->have_sysfs_alarm) |
838 | device_remove_file(battery->bat.dev, &alarm_attr); | 822 | device_remove_file(battery->bat.dev, &alarm_attr); |
839 | power_supply_unregister(&battery->bat); | 823 | power_supply_unregister(&battery->bat); |
840 | } | 824 | } |
841 | #endif | ||
842 | #ifdef CONFIG_ACPI_PROCFS_POWER | 825 | #ifdef CONFIG_ACPI_PROCFS_POWER |
843 | if (battery->proc_entry) | 826 | if (battery->proc_entry) |
844 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | 827 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); |
@@ -859,14 +842,12 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
859 | if (result) | 842 | if (result) |
860 | goto end; | 843 | goto end; |
861 | #endif | 844 | #endif |
862 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
863 | sbs->charger.name = "sbs-charger"; | 845 | sbs->charger.name = "sbs-charger"; |
864 | sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; | 846 | sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; |
865 | sbs->charger.properties = sbs_ac_props; | 847 | sbs->charger.properties = sbs_ac_props; |
866 | sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); | 848 | sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); |
867 | sbs->charger.get_property = sbs_get_ac_property; | 849 | sbs->charger.get_property = sbs_get_ac_property; |
868 | power_supply_register(&sbs->device->dev, &sbs->charger); | 850 | power_supply_register(&sbs->device->dev, &sbs->charger); |
869 | #endif | ||
870 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", | 851 | printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", |
871 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 852 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
872 | ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); | 853 | ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); |
@@ -876,10 +857,8 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
876 | 857 | ||
877 | static void acpi_charger_remove(struct acpi_sbs *sbs) | 858 | static void acpi_charger_remove(struct acpi_sbs *sbs) |
878 | { | 859 | { |
879 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
880 | if (sbs->charger.dev) | 860 | if (sbs->charger.dev) |
881 | power_supply_unregister(&sbs->charger); | 861 | power_supply_unregister(&sbs->charger); |
882 | #endif | ||
883 | #ifdef CONFIG_ACPI_PROCFS_POWER | 862 | #ifdef CONFIG_ACPI_PROCFS_POWER |
884 | if (sbs->charger_entry) | 863 | if (sbs->charger_entry) |
885 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
@@ -900,9 +879,7 @@ static void acpi_sbs_callback(void *context) | |||
900 | ACPI_SBS_NOTIFY_STATUS, | 879 | ACPI_SBS_NOTIFY_STATUS, |
901 | sbs->charger_present); | 880 | sbs->charger_present); |
902 | #endif | 881 | #endif |
903 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
904 | kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); | 882 | kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); |
905 | #endif | ||
906 | } | 883 | } |
907 | if (sbs->manager_present) { | 884 | if (sbs->manager_present) { |
908 | for (id = 0; id < MAX_SBS_BAT; ++id) { | 885 | for (id = 0; id < MAX_SBS_BAT; ++id) { |
@@ -919,9 +896,7 @@ static void acpi_sbs_callback(void *context) | |||
919 | ACPI_SBS_NOTIFY_STATUS, | 896 | ACPI_SBS_NOTIFY_STATUS, |
920 | bat->present); | 897 | bat->present); |
921 | #endif | 898 | #endif |
922 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
923 | kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); | 899 | kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); |
924 | #endif | ||
925 | } | 900 | } |
926 | } | 901 | } |
927 | } | 902 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index b23825ecfa3..2b6c21d86b9 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -26,6 +26,8 @@ extern struct acpi_device *acpi_root; | |||
26 | 26 | ||
27 | #define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) | 27 | #define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) |
28 | 28 | ||
29 | static const char *dummy_hid = "device"; | ||
30 | |||
29 | static LIST_HEAD(acpi_device_list); | 31 | static LIST_HEAD(acpi_device_list); |
30 | static LIST_HEAD(acpi_bus_id_list); | 32 | static LIST_HEAD(acpi_bus_id_list); |
31 | DEFINE_MUTEX(acpi_device_lock); | 33 | DEFINE_MUTEX(acpi_device_lock); |
@@ -49,6 +51,9 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
49 | int count; | 51 | int count; |
50 | struct acpi_hardware_id *id; | 52 | struct acpi_hardware_id *id; |
51 | 53 | ||
54 | if (list_empty(&acpi_dev->pnp.ids)) | ||
55 | return 0; | ||
56 | |||
52 | len = snprintf(modalias, size, "acpi:"); | 57 | len = snprintf(modalias, size, "acpi:"); |
53 | size -= len; | 58 | size -= len; |
54 | 59 | ||
@@ -202,13 +207,15 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
202 | goto end; | 207 | goto end; |
203 | } | 208 | } |
204 | 209 | ||
205 | result = device_create_file(&dev->dev, &dev_attr_hid); | 210 | if (!list_empty(&dev->pnp.ids)) { |
206 | if (result) | 211 | result = device_create_file(&dev->dev, &dev_attr_hid); |
207 | goto end; | 212 | if (result) |
213 | goto end; | ||
208 | 214 | ||
209 | result = device_create_file(&dev->dev, &dev_attr_modalias); | 215 | result = device_create_file(&dev->dev, &dev_attr_modalias); |
210 | if (result) | 216 | if (result) |
211 | goto end; | 217 | goto end; |
218 | } | ||
212 | 219 | ||
213 | /* | 220 | /* |
214 | * If device has _EJ0, 'eject' file is created that is used to trigger | 221 | * If device has _EJ0, 'eject' file is created that is used to trigger |
@@ -316,6 +323,9 @@ static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
316 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 323 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
317 | int len; | 324 | int len; |
318 | 325 | ||
326 | if (list_empty(&acpi_dev->pnp.ids)) | ||
327 | return 0; | ||
328 | |||
319 | if (add_uevent_var(env, "MODALIAS=")) | 329 | if (add_uevent_var(env, "MODALIAS=")) |
320 | return -ENOMEM; | 330 | return -ENOMEM; |
321 | len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], | 331 | len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], |
@@ -1010,10 +1020,13 @@ static int acpi_dock_match(struct acpi_device *device) | |||
1010 | return acpi_get_handle(device->handle, "_DCK", &tmp); | 1020 | return acpi_get_handle(device->handle, "_DCK", &tmp); |
1011 | } | 1021 | } |
1012 | 1022 | ||
1013 | char *acpi_device_hid(struct acpi_device *device) | 1023 | const char *acpi_device_hid(struct acpi_device *device) |
1014 | { | 1024 | { |
1015 | struct acpi_hardware_id *hid; | 1025 | struct acpi_hardware_id *hid; |
1016 | 1026 | ||
1027 | if (list_empty(&device->pnp.ids)) | ||
1028 | return dummy_hid; | ||
1029 | |||
1017 | hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list); | 1030 | hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list); |
1018 | return hid->id; | 1031 | return hid->id; |
1019 | } | 1032 | } |
@@ -1142,16 +1155,6 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
1142 | acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF); | 1155 | acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF); |
1143 | break; | 1156 | break; |
1144 | } | 1157 | } |
1145 | |||
1146 | /* | ||
1147 | * We build acpi_devices for some objects that don't have _HID or _CID, | ||
1148 | * e.g., PCI bridges and slots. Drivers can't bind to these objects, | ||
1149 | * but we do use them indirectly by traversing the acpi_device tree. | ||
1150 | * This generic ID isn't useful for driver binding, but it provides | ||
1151 | * the useful property that "every acpi_device has an ID." | ||
1152 | */ | ||
1153 | if (list_empty(&device->pnp.ids)) | ||
1154 | acpi_add_id(device, "device"); | ||
1155 | } | 1158 | } |
1156 | 1159 | ||
1157 | static int acpi_device_set_context(struct acpi_device *device) | 1160 | static int acpi_device_set_context(struct acpi_device *device) |
@@ -1431,6 +1434,7 @@ EXPORT_SYMBOL(acpi_bus_add); | |||
1431 | int acpi_bus_start(struct acpi_device *device) | 1434 | int acpi_bus_start(struct acpi_device *device) |
1432 | { | 1435 | { |
1433 | struct acpi_bus_ops ops; | 1436 | struct acpi_bus_ops ops; |
1437 | int result; | ||
1434 | 1438 | ||
1435 | if (!device) | 1439 | if (!device) |
1436 | return -EINVAL; | 1440 | return -EINVAL; |
@@ -1438,7 +1442,11 @@ int acpi_bus_start(struct acpi_device *device) | |||
1438 | memset(&ops, 0, sizeof(ops)); | 1442 | memset(&ops, 0, sizeof(ops)); |
1439 | ops.acpi_op_start = 1; | 1443 | ops.acpi_op_start = 1; |
1440 | 1444 | ||
1441 | return acpi_bus_scan(device->handle, &ops, NULL); | 1445 | result = acpi_bus_scan(device->handle, &ops, NULL); |
1446 | |||
1447 | acpi_update_gpes(); | ||
1448 | |||
1449 | return result; | ||
1442 | } | 1450 | } |
1443 | EXPORT_SYMBOL(acpi_bus_start); | 1451 | EXPORT_SYMBOL(acpi_bus_start); |
1444 | 1452 | ||
@@ -1552,6 +1560,8 @@ int __init acpi_scan_init(void) | |||
1552 | 1560 | ||
1553 | if (result) | 1561 | if (result) |
1554 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); | 1562 | acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); |
1563 | else | ||
1564 | acpi_update_gpes(); | ||
1555 | 1565 | ||
1556 | return result; | 1566 | return result; |
1557 | } | 1567 | } |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index cf82989ae75..e807f4196f8 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | u8 sleep_states[ACPI_S_STATE_COUNT]; | 28 | u8 sleep_states[ACPI_S_STATE_COUNT]; |
29 | 29 | ||
30 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
31 | |||
30 | static void acpi_sleep_tts_switch(u32 acpi_state) | 32 | static void acpi_sleep_tts_switch(u32 acpi_state) |
31 | { | 33 | { |
32 | union acpi_object in_arg = { ACPI_TYPE_INTEGER }; | 34 | union acpi_object in_arg = { ACPI_TYPE_INTEGER }; |
@@ -79,8 +81,6 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
79 | } | 81 | } |
80 | 82 | ||
81 | #ifdef CONFIG_ACPI_SLEEP | 83 | #ifdef CONFIG_ACPI_SLEEP |
82 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
83 | |||
84 | /* | 84 | /* |
85 | * The ACPI specification wants us to save NVS memory regions during hibernation | 85 | * The ACPI specification wants us to save NVS memory regions during hibernation |
86 | * and to restore them during the subsequent resume. Windows does that also for | 86 | * and to restore them during the subsequent resume. Windows does that also for |
@@ -363,6 +363,12 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d) | |||
363 | return 0; | 363 | return 0; |
364 | } | 364 | } |
365 | 365 | ||
366 | static int __init init_nvs_nosave(const struct dmi_system_id *d) | ||
367 | { | ||
368 | acpi_nvs_nosave(); | ||
369 | return 0; | ||
370 | } | ||
371 | |||
366 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 372 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { |
367 | { | 373 | { |
368 | .callback = init_old_suspend_ordering, | 374 | .callback = init_old_suspend_ordering, |
@@ -397,6 +403,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | |||
397 | DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), | 403 | DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), |
398 | }, | 404 | }, |
399 | }, | 405 | }, |
406 | { | ||
407 | .callback = init_nvs_nosave, | ||
408 | .ident = "Sony Vaio VGN-SR11M", | ||
409 | .matches = { | ||
410 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
411 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"), | ||
412 | }, | ||
413 | }, | ||
414 | { | ||
415 | .callback = init_nvs_nosave, | ||
416 | .ident = "Everex StepNote Series", | ||
417 | .matches = { | ||
418 | DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."), | ||
419 | DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"), | ||
420 | }, | ||
421 | }, | ||
400 | {}, | 422 | {}, |
401 | }; | 423 | }; |
402 | #endif /* CONFIG_SUSPEND */ | 424 | #endif /* CONFIG_SUSPEND */ |
@@ -540,7 +562,7 @@ int acpi_suspend(u32 acpi_state) | |||
540 | return -EINVAL; | 562 | return -EINVAL; |
541 | } | 563 | } |
542 | 564 | ||
543 | #ifdef CONFIG_PM_SLEEP | 565 | #ifdef CONFIG_PM_OPS |
544 | /** | 566 | /** |
545 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device | 567 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device |
546 | * in the system sleep state given by %acpi_target_sleep_state | 568 | * in the system sleep state given by %acpi_target_sleep_state |
@@ -602,7 +624,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
602 | * can wake the system. _S0W may be valid, too. | 624 | * can wake the system. _S0W may be valid, too. |
603 | */ | 625 | */ |
604 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | 626 | if (acpi_target_sleep_state == ACPI_STATE_S0 || |
605 | (device_may_wakeup(dev) && adev->wakeup.state.enabled && | 627 | (device_may_wakeup(dev) && |
606 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | 628 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { |
607 | acpi_status status; | 629 | acpi_status status; |
608 | 630 | ||
@@ -610,7 +632,9 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
610 | status = acpi_evaluate_integer(handle, acpi_method, NULL, | 632 | status = acpi_evaluate_integer(handle, acpi_method, NULL, |
611 | &d_max); | 633 | &d_max); |
612 | if (ACPI_FAILURE(status)) { | 634 | if (ACPI_FAILURE(status)) { |
613 | d_max = d_min; | 635 | if (acpi_target_sleep_state != ACPI_STATE_S0 || |
636 | status != AE_NOT_FOUND) | ||
637 | d_max = d_min; | ||
614 | } else if (d_max < d_min) { | 638 | } else if (d_max < d_min) { |
615 | /* Warn the user of the broken DSDT */ | 639 | /* Warn the user of the broken DSDT */ |
616 | printk(KERN_WARNING "ACPI: Wrong value from %s\n", | 640 | printk(KERN_WARNING "ACPI: Wrong value from %s\n", |
@@ -624,7 +648,9 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) | |||
624 | *d_min_p = d_min; | 648 | *d_min_p = d_min; |
625 | return d_max; | 649 | return d_max; |
626 | } | 650 | } |
651 | #endif /* CONFIG_PM_OPS */ | ||
627 | 652 | ||
653 | #ifdef CONFIG_PM_SLEEP | ||
628 | /** | 654 | /** |
629 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up | 655 | * acpi_pm_device_sleep_wake - enable or disable the system wake-up |
630 | * capability of given device | 656 | * capability of given device |
@@ -655,7 +681,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) | |||
655 | 681 | ||
656 | return error; | 682 | return error; |
657 | } | 683 | } |
658 | #endif | 684 | #endif /* CONFIG_PM_SLEEP */ |
659 | 685 | ||
660 | static void acpi_power_off_prepare(void) | 686 | static void acpi_power_off_prepare(void) |
661 | { | 687 | { |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 68e2e4582fa..f8588f81048 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -100,7 +100,7 @@ static const struct acpi_dlevel acpi_debug_levels[] = { | |||
100 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), | 100 | ACPI_DEBUG_INIT(ACPI_LV_EVENTS), |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static int param_get_debug_layer(char *buffer, struct kernel_param *kp) | 103 | static int param_get_debug_layer(char *buffer, const struct kernel_param *kp) |
104 | { | 104 | { |
105 | int result = 0; | 105 | int result = 0; |
106 | int i; | 106 | int i; |
@@ -128,7 +128,7 @@ static int param_get_debug_layer(char *buffer, struct kernel_param *kp) | |||
128 | return result; | 128 | return result; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int param_get_debug_level(char *buffer, struct kernel_param *kp) | 131 | static int param_get_debug_level(char *buffer, const struct kernel_param *kp) |
132 | { | 132 | { |
133 | int result = 0; | 133 | int result = 0; |
134 | int i; | 134 | int i; |
@@ -149,10 +149,18 @@ static int param_get_debug_level(char *buffer, struct kernel_param *kp) | |||
149 | return result; | 149 | return result; |
150 | } | 150 | } |
151 | 151 | ||
152 | module_param_call(debug_layer, param_set_uint, param_get_debug_layer, | 152 | static struct kernel_param_ops param_ops_debug_layer = { |
153 | &acpi_dbg_layer, 0644); | 153 | .set = param_set_uint, |
154 | module_param_call(debug_level, param_set_uint, param_get_debug_level, | 154 | .get = param_get_debug_layer, |
155 | &acpi_dbg_level, 0644); | 155 | }; |
156 | |||
157 | static struct kernel_param_ops param_ops_debug_level = { | ||
158 | .set = param_set_uint, | ||
159 | .get = param_get_debug_level, | ||
160 | }; | ||
161 | |||
162 | module_param_cb(debug_layer, ¶m_ops_debug_layer, &acpi_dbg_layer, 0644); | ||
163 | module_param_cb(debug_level, ¶m_ops_debug_level, &acpi_dbg_level, 0644); | ||
156 | 164 | ||
157 | static char trace_method_name[6]; | 165 | static char trace_method_name[6]; |
158 | module_param_string(trace_method_name, trace_method_name, 6, 0644); | 166 | module_param_string(trace_method_name, trace_method_name, 6, 0644); |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 2f8f17131d9..5a27b0a3131 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -37,12 +37,6 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
40 | |||
41 | #ifdef CONFIG_ACPI_PROCFS | ||
42 | #include <linux/proc_fs.h> | ||
43 | #include <linux/seq_file.h> | ||
44 | #endif | ||
45 | |||
46 | #include <linux/jiffies.h> | 40 | #include <linux/jiffies.h> |
47 | #include <linux/kmod.h> | 41 | #include <linux/kmod.h> |
48 | #include <linux/reboot.h> | 42 | #include <linux/reboot.h> |
@@ -195,61 +189,6 @@ struct acpi_thermal { | |||
195 | struct mutex lock; | 189 | struct mutex lock; |
196 | }; | 190 | }; |
197 | 191 | ||
198 | #ifdef CONFIG_ACPI_PROCFS | ||
199 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | ||
200 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | ||
201 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | ||
202 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); | ||
203 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, | ||
204 | const char __user *, size_t, | ||
205 | loff_t *); | ||
206 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); | ||
207 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, | ||
208 | size_t, loff_t *); | ||
209 | |||
210 | static const struct file_operations acpi_thermal_state_fops = { | ||
211 | .owner = THIS_MODULE, | ||
212 | .open = acpi_thermal_state_open_fs, | ||
213 | .read = seq_read, | ||
214 | .llseek = seq_lseek, | ||
215 | .release = single_release, | ||
216 | }; | ||
217 | |||
218 | static const struct file_operations acpi_thermal_temp_fops = { | ||
219 | .owner = THIS_MODULE, | ||
220 | .open = acpi_thermal_temp_open_fs, | ||
221 | .read = seq_read, | ||
222 | .llseek = seq_lseek, | ||
223 | .release = single_release, | ||
224 | }; | ||
225 | |||
226 | static const struct file_operations acpi_thermal_trip_fops = { | ||
227 | .owner = THIS_MODULE, | ||
228 | .open = acpi_thermal_trip_open_fs, | ||
229 | .read = seq_read, | ||
230 | .llseek = seq_lseek, | ||
231 | .release = single_release, | ||
232 | }; | ||
233 | |||
234 | static const struct file_operations acpi_thermal_cooling_fops = { | ||
235 | .owner = THIS_MODULE, | ||
236 | .open = acpi_thermal_cooling_open_fs, | ||
237 | .read = seq_read, | ||
238 | .write = acpi_thermal_write_cooling_mode, | ||
239 | .llseek = seq_lseek, | ||
240 | .release = single_release, | ||
241 | }; | ||
242 | |||
243 | static const struct file_operations acpi_thermal_polling_fops = { | ||
244 | .owner = THIS_MODULE, | ||
245 | .open = acpi_thermal_polling_open_fs, | ||
246 | .read = seq_read, | ||
247 | .write = acpi_thermal_write_polling, | ||
248 | .llseek = seq_lseek, | ||
249 | .release = single_release, | ||
250 | }; | ||
251 | #endif /* CONFIG_ACPI_PROCFS*/ | ||
252 | |||
253 | /* -------------------------------------------------------------------------- | 192 | /* -------------------------------------------------------------------------- |
254 | Thermal Zone Management | 193 | Thermal Zone Management |
255 | -------------------------------------------------------------------------- */ | 194 | -------------------------------------------------------------------------- */ |
@@ -958,358 +897,6 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz) | |||
958 | 897 | ||
959 | 898 | ||
960 | /* -------------------------------------------------------------------------- | 899 | /* -------------------------------------------------------------------------- |
961 | FS Interface (/proc) | ||
962 | -------------------------------------------------------------------------- */ | ||
963 | #ifdef CONFIG_ACPI_PROCFS | ||
964 | static struct proc_dir_entry *acpi_thermal_dir; | ||
965 | |||
966 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | ||
967 | { | ||
968 | struct acpi_thermal *tz = seq->private; | ||
969 | |||
970 | |||
971 | if (!tz) | ||
972 | goto end; | ||
973 | |||
974 | seq_puts(seq, "state: "); | ||
975 | |||
976 | if (!tz->state.critical && !tz->state.hot && !tz->state.passive | ||
977 | && !tz->state.active) | ||
978 | seq_puts(seq, "ok\n"); | ||
979 | else { | ||
980 | if (tz->state.critical) | ||
981 | seq_puts(seq, "critical "); | ||
982 | if (tz->state.hot) | ||
983 | seq_puts(seq, "hot "); | ||
984 | if (tz->state.passive) | ||
985 | seq_puts(seq, "passive "); | ||
986 | if (tz->state.active) | ||
987 | seq_printf(seq, "active[%d]", tz->state.active_index); | ||
988 | seq_puts(seq, "\n"); | ||
989 | } | ||
990 | |||
991 | end: | ||
992 | return 0; | ||
993 | } | ||
994 | |||
995 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) | ||
996 | { | ||
997 | return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data); | ||
998 | } | ||
999 | |||
1000 | static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | ||
1001 | { | ||
1002 | int result = 0; | ||
1003 | struct acpi_thermal *tz = seq->private; | ||
1004 | |||
1005 | |||
1006 | if (!tz) | ||
1007 | goto end; | ||
1008 | |||
1009 | result = acpi_thermal_get_temperature(tz); | ||
1010 | if (result) | ||
1011 | goto end; | ||
1012 | |||
1013 | seq_printf(seq, "temperature: %ld C\n", | ||
1014 | KELVIN_TO_CELSIUS(tz->temperature)); | ||
1015 | |||
1016 | end: | ||
1017 | return 0; | ||
1018 | } | ||
1019 | |||
1020 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) | ||
1021 | { | ||
1022 | return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data); | ||
1023 | } | ||
1024 | |||
1025 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | ||
1026 | { | ||
1027 | struct acpi_thermal *tz = seq->private; | ||
1028 | struct acpi_device *device; | ||
1029 | acpi_status status; | ||
1030 | |||
1031 | int i = 0; | ||
1032 | int j = 0; | ||
1033 | |||
1034 | |||
1035 | if (!tz) | ||
1036 | goto end; | ||
1037 | |||
1038 | if (tz->trips.critical.flags.valid) | ||
1039 | seq_printf(seq, "critical (S5): %ld C%s", | ||
1040 | KELVIN_TO_CELSIUS(tz->trips.critical.temperature), | ||
1041 | nocrt ? " <disabled>\n" : "\n"); | ||
1042 | |||
1043 | if (tz->trips.hot.flags.valid) | ||
1044 | seq_printf(seq, "hot (S4): %ld C%s", | ||
1045 | KELVIN_TO_CELSIUS(tz->trips.hot.temperature), | ||
1046 | nocrt ? " <disabled>\n" : "\n"); | ||
1047 | |||
1048 | if (tz->trips.passive.flags.valid) { | ||
1049 | seq_printf(seq, | ||
1050 | "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=", | ||
1051 | KELVIN_TO_CELSIUS(tz->trips.passive.temperature), | ||
1052 | tz->trips.passive.tc1, tz->trips.passive.tc2, | ||
1053 | tz->trips.passive.tsp); | ||
1054 | for (j = 0; j < tz->trips.passive.devices.count; j++) { | ||
1055 | status = acpi_bus_get_device(tz->trips.passive.devices. | ||
1056 | handles[j], &device); | ||
1057 | seq_printf(seq, "%4.4s ", status ? "" : | ||
1058 | acpi_device_bid(device)); | ||
1059 | } | ||
1060 | seq_puts(seq, "\n"); | ||
1061 | } else { | ||
1062 | seq_printf(seq, "passive (forced):"); | ||
1063 | if (tz->thermal_zone->forced_passive) | ||
1064 | seq_printf(seq, " %i C\n", | ||
1065 | tz->thermal_zone->forced_passive / 1000); | ||
1066 | else | ||
1067 | seq_printf(seq, "<not set>\n"); | ||
1068 | } | ||
1069 | |||
1070 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { | ||
1071 | if (!(tz->trips.active[i].flags.valid)) | ||
1072 | break; | ||
1073 | seq_printf(seq, "active[%d]: %ld C: devices=", | ||
1074 | i, | ||
1075 | KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); | ||
1076 | for (j = 0; j < tz->trips.active[i].devices.count; j++){ | ||
1077 | status = acpi_bus_get_device(tz->trips.active[i]. | ||
1078 | devices.handles[j], | ||
1079 | &device); | ||
1080 | seq_printf(seq, "%4.4s ", status ? "" : | ||
1081 | acpi_device_bid(device)); | ||
1082 | } | ||
1083 | seq_puts(seq, "\n"); | ||
1084 | } | ||
1085 | |||
1086 | end: | ||
1087 | return 0; | ||
1088 | } | ||
1089 | |||
1090 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) | ||
1091 | { | ||
1092 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); | ||
1093 | } | ||
1094 | |||
1095 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | ||
1096 | { | ||
1097 | struct acpi_thermal *tz = seq->private; | ||
1098 | |||
1099 | |||
1100 | if (!tz) | ||
1101 | goto end; | ||
1102 | |||
1103 | if (!tz->flags.cooling_mode) | ||
1104 | seq_puts(seq, "<setting not supported>\n"); | ||
1105 | else | ||
1106 | seq_puts(seq, "0 - Active; 1 - Passive\n"); | ||
1107 | |||
1108 | end: | ||
1109 | return 0; | ||
1110 | } | ||
1111 | |||
1112 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) | ||
1113 | { | ||
1114 | return single_open(file, acpi_thermal_cooling_seq_show, | ||
1115 | PDE(inode)->data); | ||
1116 | } | ||
1117 | |||
1118 | static ssize_t | ||
1119 | acpi_thermal_write_cooling_mode(struct file *file, | ||
1120 | const char __user * buffer, | ||
1121 | size_t count, loff_t * ppos) | ||
1122 | { | ||
1123 | struct seq_file *m = file->private_data; | ||
1124 | struct acpi_thermal *tz = m->private; | ||
1125 | int result = 0; | ||
1126 | char mode_string[12] = { '\0' }; | ||
1127 | |||
1128 | |||
1129 | if (!tz || (count > sizeof(mode_string) - 1)) | ||
1130 | return -EINVAL; | ||
1131 | |||
1132 | if (!tz->flags.cooling_mode) | ||
1133 | return -ENODEV; | ||
1134 | |||
1135 | if (copy_from_user(mode_string, buffer, count)) | ||
1136 | return -EFAULT; | ||
1137 | |||
1138 | mode_string[count] = '\0'; | ||
1139 | |||
1140 | result = acpi_thermal_set_cooling_mode(tz, | ||
1141 | simple_strtoul(mode_string, NULL, | ||
1142 | 0)); | ||
1143 | if (result) | ||
1144 | return result; | ||
1145 | |||
1146 | acpi_thermal_check(tz); | ||
1147 | |||
1148 | return count; | ||
1149 | } | ||
1150 | |||
1151 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) | ||
1152 | { | ||
1153 | struct acpi_thermal *tz = seq->private; | ||
1154 | |||
1155 | |||
1156 | if (!tz) | ||
1157 | goto end; | ||
1158 | |||
1159 | if (!tz->thermal_zone->polling_delay) { | ||
1160 | seq_puts(seq, "<polling disabled>\n"); | ||
1161 | goto end; | ||
1162 | } | ||
1163 | |||
1164 | seq_printf(seq, "polling frequency: %d seconds\n", | ||
1165 | (tz->thermal_zone->polling_delay / 1000)); | ||
1166 | |||
1167 | end: | ||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) | ||
1172 | { | ||
1173 | return single_open(file, acpi_thermal_polling_seq_show, | ||
1174 | PDE(inode)->data); | ||
1175 | } | ||
1176 | |||
1177 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) | ||
1178 | { | ||
1179 | if (!tz) | ||
1180 | return -EINVAL; | ||
1181 | |||
1182 | /* Convert value to deci-seconds */ | ||
1183 | tz->polling_frequency = seconds * 10; | ||
1184 | |||
1185 | tz->thermal_zone->polling_delay = seconds * 1000; | ||
1186 | |||
1187 | if (tz->tz_enabled) | ||
1188 | thermal_zone_device_update(tz->thermal_zone); | ||
1189 | |||
1190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
1191 | "Polling frequency set to %lu seconds\n", | ||
1192 | tz->polling_frequency/10)); | ||
1193 | |||
1194 | return 0; | ||
1195 | } | ||
1196 | |||
1197 | static ssize_t | ||
1198 | acpi_thermal_write_polling(struct file *file, | ||
1199 | const char __user * buffer, | ||
1200 | size_t count, loff_t * ppos) | ||
1201 | { | ||
1202 | struct seq_file *m = file->private_data; | ||
1203 | struct acpi_thermal *tz = m->private; | ||
1204 | int result = 0; | ||
1205 | char polling_string[12] = { '\0' }; | ||
1206 | int seconds = 0; | ||
1207 | |||
1208 | |||
1209 | if (!tz || (count > sizeof(polling_string) - 1)) | ||
1210 | return -EINVAL; | ||
1211 | |||
1212 | if (copy_from_user(polling_string, buffer, count)) | ||
1213 | return -EFAULT; | ||
1214 | |||
1215 | polling_string[count] = '\0'; | ||
1216 | |||
1217 | seconds = simple_strtoul(polling_string, NULL, 0); | ||
1218 | |||
1219 | result = acpi_thermal_set_polling(tz, seconds); | ||
1220 | if (result) | ||
1221 | return result; | ||
1222 | |||
1223 | acpi_thermal_check(tz); | ||
1224 | |||
1225 | return count; | ||
1226 | } | ||
1227 | |||
1228 | static int acpi_thermal_add_fs(struct acpi_device *device) | ||
1229 | { | ||
1230 | struct proc_dir_entry *entry = NULL; | ||
1231 | |||
1232 | |||
1233 | if (!acpi_device_dir(device)) { | ||
1234 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
1235 | acpi_thermal_dir); | ||
1236 | if (!acpi_device_dir(device)) | ||
1237 | return -ENODEV; | ||
1238 | } | ||
1239 | |||
1240 | /* 'state' [R] */ | ||
1241 | entry = proc_create_data(ACPI_THERMAL_FILE_STATE, | ||
1242 | S_IRUGO, acpi_device_dir(device), | ||
1243 | &acpi_thermal_state_fops, | ||
1244 | acpi_driver_data(device)); | ||
1245 | if (!entry) | ||
1246 | return -ENODEV; | ||
1247 | |||
1248 | /* 'temperature' [R] */ | ||
1249 | entry = proc_create_data(ACPI_THERMAL_FILE_TEMPERATURE, | ||
1250 | S_IRUGO, acpi_device_dir(device), | ||
1251 | &acpi_thermal_temp_fops, | ||
1252 | acpi_driver_data(device)); | ||
1253 | if (!entry) | ||
1254 | return -ENODEV; | ||
1255 | |||
1256 | /* 'trip_points' [R] */ | ||
1257 | entry = proc_create_data(ACPI_THERMAL_FILE_TRIP_POINTS, | ||
1258 | S_IRUGO, | ||
1259 | acpi_device_dir(device), | ||
1260 | &acpi_thermal_trip_fops, | ||
1261 | acpi_driver_data(device)); | ||
1262 | if (!entry) | ||
1263 | return -ENODEV; | ||
1264 | |||
1265 | /* 'cooling_mode' [R/W] */ | ||
1266 | entry = proc_create_data(ACPI_THERMAL_FILE_COOLING_MODE, | ||
1267 | S_IFREG | S_IRUGO | S_IWUSR, | ||
1268 | acpi_device_dir(device), | ||
1269 | &acpi_thermal_cooling_fops, | ||
1270 | acpi_driver_data(device)); | ||
1271 | if (!entry) | ||
1272 | return -ENODEV; | ||
1273 | |||
1274 | /* 'polling_frequency' [R/W] */ | ||
1275 | entry = proc_create_data(ACPI_THERMAL_FILE_POLLING_FREQ, | ||
1276 | S_IFREG | S_IRUGO | S_IWUSR, | ||
1277 | acpi_device_dir(device), | ||
1278 | &acpi_thermal_polling_fops, | ||
1279 | acpi_driver_data(device)); | ||
1280 | if (!entry) | ||
1281 | return -ENODEV; | ||
1282 | return 0; | ||
1283 | } | ||
1284 | |||
1285 | static int acpi_thermal_remove_fs(struct acpi_device *device) | ||
1286 | { | ||
1287 | |||
1288 | if (acpi_device_dir(device)) { | ||
1289 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, | ||
1290 | acpi_device_dir(device)); | ||
1291 | remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, | ||
1292 | acpi_device_dir(device)); | ||
1293 | remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, | ||
1294 | acpi_device_dir(device)); | ||
1295 | remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, | ||
1296 | acpi_device_dir(device)); | ||
1297 | remove_proc_entry(ACPI_THERMAL_FILE_STATE, | ||
1298 | acpi_device_dir(device)); | ||
1299 | remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir); | ||
1300 | acpi_device_dir(device) = NULL; | ||
1301 | } | ||
1302 | |||
1303 | return 0; | ||
1304 | } | ||
1305 | #else | ||
1306 | static inline int acpi_thermal_add_fs(struct acpi_device *device) { return 0; } | ||
1307 | static inline int acpi_thermal_remove_fs(struct acpi_device *device) | ||
1308 | { | ||
1309 | return 0; | ||
1310 | } | ||
1311 | #endif /* CONFIG_ACPI_PROCFS */ | ||
1312 | /* -------------------------------------------------------------------------- | ||
1313 | Driver Interface | 900 | Driver Interface |
1314 | -------------------------------------------------------------------------- */ | 901 | -------------------------------------------------------------------------- */ |
1315 | 902 | ||
@@ -1428,17 +1015,11 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1428 | if (result) | 1015 | if (result) |
1429 | goto free_memory; | 1016 | goto free_memory; |
1430 | 1017 | ||
1431 | result = acpi_thermal_add_fs(device); | ||
1432 | if (result) | ||
1433 | goto unregister_thermal_zone; | ||
1434 | |||
1435 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", | 1018 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", |
1436 | acpi_device_name(device), acpi_device_bid(device), | 1019 | acpi_device_name(device), acpi_device_bid(device), |
1437 | KELVIN_TO_CELSIUS(tz->temperature)); | 1020 | KELVIN_TO_CELSIUS(tz->temperature)); |
1438 | goto end; | 1021 | goto end; |
1439 | 1022 | ||
1440 | unregister_thermal_zone: | ||
1441 | thermal_zone_device_unregister(tz->thermal_zone); | ||
1442 | free_memory: | 1023 | free_memory: |
1443 | kfree(tz); | 1024 | kfree(tz); |
1444 | end: | 1025 | end: |
@@ -1454,7 +1035,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1454 | 1035 | ||
1455 | tz = acpi_driver_data(device); | 1036 | tz = acpi_driver_data(device); |
1456 | 1037 | ||
1457 | acpi_thermal_remove_fs(device); | ||
1458 | acpi_thermal_unregister_thermal_zone(tz); | 1038 | acpi_thermal_unregister_thermal_zone(tz); |
1459 | mutex_destroy(&tz->lock); | 1039 | mutex_destroy(&tz->lock); |
1460 | kfree(tz); | 1040 | kfree(tz); |
@@ -1580,19 +1160,9 @@ static int __init acpi_thermal_init(void) | |||
1580 | return -ENODEV; | 1160 | return -ENODEV; |
1581 | } | 1161 | } |
1582 | 1162 | ||
1583 | #ifdef CONFIG_ACPI_PROCFS | ||
1584 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); | ||
1585 | if (!acpi_thermal_dir) | ||
1586 | return -ENODEV; | ||
1587 | #endif | ||
1588 | |||
1589 | result = acpi_bus_register_driver(&acpi_thermal_driver); | 1163 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
1590 | if (result < 0) { | 1164 | if (result < 0) |
1591 | #ifdef CONFIG_ACPI_PROCFS | ||
1592 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | ||
1593 | #endif | ||
1594 | return -ENODEV; | 1165 | return -ENODEV; |
1595 | } | ||
1596 | 1166 | ||
1597 | return 0; | 1167 | return 0; |
1598 | } | 1168 | } |
@@ -1602,10 +1172,6 @@ static void __exit acpi_thermal_exit(void) | |||
1602 | 1172 | ||
1603 | acpi_bus_unregister_driver(&acpi_thermal_driver); | 1173 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
1604 | 1174 | ||
1605 | #ifdef CONFIG_ACPI_PROCFS | ||
1606 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); | ||
1607 | #endif | ||
1608 | |||
1609 | return; | 1175 | return; |
1610 | } | 1176 | } |
1611 | 1177 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 67dec0c675a..5cd0228d2da 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -30,8 +30,6 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | #include <linux/proc_fs.h> | ||
34 | #include <linux/seq_file.h> | ||
35 | #include <linux/input.h> | 33 | #include <linux/input.h> |
36 | #include <linux/backlight.h> | 34 | #include <linux/backlight.h> |
37 | #include <linux/thermal.h> | 35 | #include <linux/thermal.h> |
@@ -152,9 +150,6 @@ struct acpi_video_bus { | |||
152 | struct acpi_video_bus_flags flags; | 150 | struct acpi_video_bus_flags flags; |
153 | struct list_head video_device_list; | 151 | struct list_head video_device_list; |
154 | struct mutex device_list_lock; /* protects video_device_list */ | 152 | struct mutex device_list_lock; /* protects video_device_list */ |
155 | #ifdef CONFIG_ACPI_PROCFS | ||
156 | struct proc_dir_entry *dir; | ||
157 | #endif | ||
158 | struct input_dev *input; | 153 | struct input_dev *input; |
159 | char phys[32]; /* for input device */ | 154 | char phys[32]; /* for input device */ |
160 | struct notifier_block pm_nb; | 155 | struct notifier_block pm_nb; |
@@ -210,108 +205,6 @@ struct acpi_video_device { | |||
210 | struct output_device *output_dev; | 205 | struct output_device *output_dev; |
211 | }; | 206 | }; |
212 | 207 | ||
213 | #ifdef CONFIG_ACPI_PROCFS | ||
214 | /* bus */ | ||
215 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); | ||
216 | static const struct file_operations acpi_video_bus_info_fops = { | ||
217 | .owner = THIS_MODULE, | ||
218 | .open = acpi_video_bus_info_open_fs, | ||
219 | .read = seq_read, | ||
220 | .llseek = seq_lseek, | ||
221 | .release = single_release, | ||
222 | }; | ||
223 | |||
224 | static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file); | ||
225 | static const struct file_operations acpi_video_bus_ROM_fops = { | ||
226 | .owner = THIS_MODULE, | ||
227 | .open = acpi_video_bus_ROM_open_fs, | ||
228 | .read = seq_read, | ||
229 | .llseek = seq_lseek, | ||
230 | .release = single_release, | ||
231 | }; | ||
232 | |||
233 | static int acpi_video_bus_POST_info_open_fs(struct inode *inode, | ||
234 | struct file *file); | ||
235 | static const struct file_operations acpi_video_bus_POST_info_fops = { | ||
236 | .owner = THIS_MODULE, | ||
237 | .open = acpi_video_bus_POST_info_open_fs, | ||
238 | .read = seq_read, | ||
239 | .llseek = seq_lseek, | ||
240 | .release = single_release, | ||
241 | }; | ||
242 | |||
243 | static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file); | ||
244 | static ssize_t acpi_video_bus_write_POST(struct file *file, | ||
245 | const char __user *buffer, size_t count, loff_t *data); | ||
246 | static const struct file_operations acpi_video_bus_POST_fops = { | ||
247 | .owner = THIS_MODULE, | ||
248 | .open = acpi_video_bus_POST_open_fs, | ||
249 | .read = seq_read, | ||
250 | .write = acpi_video_bus_write_POST, | ||
251 | .llseek = seq_lseek, | ||
252 | .release = single_release, | ||
253 | }; | ||
254 | |||
255 | static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file); | ||
256 | static ssize_t acpi_video_bus_write_DOS(struct file *file, | ||
257 | const char __user *buffer, size_t count, loff_t *data); | ||
258 | static const struct file_operations acpi_video_bus_DOS_fops = { | ||
259 | .owner = THIS_MODULE, | ||
260 | .open = acpi_video_bus_DOS_open_fs, | ||
261 | .read = seq_read, | ||
262 | .write = acpi_video_bus_write_DOS, | ||
263 | .llseek = seq_lseek, | ||
264 | .release = single_release, | ||
265 | }; | ||
266 | |||
267 | /* device */ | ||
268 | static int acpi_video_device_info_open_fs(struct inode *inode, | ||
269 | struct file *file); | ||
270 | static const struct file_operations acpi_video_device_info_fops = { | ||
271 | .owner = THIS_MODULE, | ||
272 | .open = acpi_video_device_info_open_fs, | ||
273 | .read = seq_read, | ||
274 | .llseek = seq_lseek, | ||
275 | .release = single_release, | ||
276 | }; | ||
277 | |||
278 | static int acpi_video_device_state_open_fs(struct inode *inode, | ||
279 | struct file *file); | ||
280 | static ssize_t acpi_video_device_write_state(struct file *file, | ||
281 | const char __user *buffer, size_t count, loff_t *data); | ||
282 | static const struct file_operations acpi_video_device_state_fops = { | ||
283 | .owner = THIS_MODULE, | ||
284 | .open = acpi_video_device_state_open_fs, | ||
285 | .read = seq_read, | ||
286 | .write = acpi_video_device_write_state, | ||
287 | .llseek = seq_lseek, | ||
288 | .release = single_release, | ||
289 | }; | ||
290 | |||
291 | static int acpi_video_device_brightness_open_fs(struct inode *inode, | ||
292 | struct file *file); | ||
293 | static ssize_t acpi_video_device_write_brightness(struct file *file, | ||
294 | const char __user *buffer, size_t count, loff_t *data); | ||
295 | static const struct file_operations acpi_video_device_brightness_fops = { | ||
296 | .owner = THIS_MODULE, | ||
297 | .open = acpi_video_device_brightness_open_fs, | ||
298 | .read = seq_read, | ||
299 | .write = acpi_video_device_write_brightness, | ||
300 | .llseek = seq_lseek, | ||
301 | .release = single_release, | ||
302 | }; | ||
303 | |||
304 | static int acpi_video_device_EDID_open_fs(struct inode *inode, | ||
305 | struct file *file); | ||
306 | static const struct file_operations acpi_video_device_EDID_fops = { | ||
307 | .owner = THIS_MODULE, | ||
308 | .open = acpi_video_device_EDID_open_fs, | ||
309 | .read = seq_read, | ||
310 | .llseek = seq_lseek, | ||
311 | .release = single_release, | ||
312 | }; | ||
313 | #endif /* CONFIG_ACPI_PROCFS */ | ||
314 | |||
315 | static const char device_decode[][30] = { | 208 | static const char device_decode[][30] = { |
316 | "motherboard VGA device", | 209 | "motherboard VGA device", |
317 | "PCI VGA device", | 210 | "PCI VGA device", |
@@ -1111,646 +1004,6 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1111 | } | 1004 | } |
1112 | 1005 | ||
1113 | /* -------------------------------------------------------------------------- | 1006 | /* -------------------------------------------------------------------------- |
1114 | FS Interface (/proc) | ||
1115 | -------------------------------------------------------------------------- */ | ||
1116 | #ifdef CONFIG_ACPI_PROCFS | ||
1117 | |||
1118 | static struct proc_dir_entry *acpi_video_dir; | ||
1119 | |||
1120 | /* video devices */ | ||
1121 | |||
1122 | static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) | ||
1123 | { | ||
1124 | struct acpi_video_device *dev = seq->private; | ||
1125 | |||
1126 | |||
1127 | if (!dev) | ||
1128 | goto end; | ||
1129 | |||
1130 | seq_printf(seq, "device_id: 0x%04x\n", (u32) dev->device_id); | ||
1131 | seq_printf(seq, "type: "); | ||
1132 | if (dev->flags.crt) | ||
1133 | seq_printf(seq, "CRT\n"); | ||
1134 | else if (dev->flags.lcd) | ||
1135 | seq_printf(seq, "LCD\n"); | ||
1136 | else if (dev->flags.tvout) | ||
1137 | seq_printf(seq, "TVOUT\n"); | ||
1138 | else if (dev->flags.dvi) | ||
1139 | seq_printf(seq, "DVI\n"); | ||
1140 | else | ||
1141 | seq_printf(seq, "UNKNOWN\n"); | ||
1142 | |||
1143 | seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); | ||
1144 | |||
1145 | end: | ||
1146 | return 0; | ||
1147 | } | ||
1148 | |||
1149 | static int | ||
1150 | acpi_video_device_info_open_fs(struct inode *inode, struct file *file) | ||
1151 | { | ||
1152 | return single_open(file, acpi_video_device_info_seq_show, | ||
1153 | PDE(inode)->data); | ||
1154 | } | ||
1155 | |||
1156 | static int | ||
1157 | acpi_video_device_query(struct acpi_video_device *device, | ||
1158 | unsigned long long *state) | ||
1159 | { | ||
1160 | int status; | ||
1161 | |||
1162 | status = acpi_evaluate_integer(device->dev->handle, "_DGS", | ||
1163 | NULL, state); | ||
1164 | |||
1165 | return status; | ||
1166 | } | ||
1167 | |||
1168 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) | ||
1169 | { | ||
1170 | int status; | ||
1171 | struct acpi_video_device *dev = seq->private; | ||
1172 | unsigned long long state; | ||
1173 | |||
1174 | |||
1175 | if (!dev) | ||
1176 | goto end; | ||
1177 | |||
1178 | status = acpi_video_device_get_state(dev, &state); | ||
1179 | seq_printf(seq, "state: "); | ||
1180 | if (ACPI_SUCCESS(status)) | ||
1181 | seq_printf(seq, "0x%02llx\n", state); | ||
1182 | else | ||
1183 | seq_printf(seq, "<not supported>\n"); | ||
1184 | |||
1185 | status = acpi_video_device_query(dev, &state); | ||
1186 | seq_printf(seq, "query: "); | ||
1187 | if (ACPI_SUCCESS(status)) | ||
1188 | seq_printf(seq, "0x%02llx\n", state); | ||
1189 | else | ||
1190 | seq_printf(seq, "<not supported>\n"); | ||
1191 | |||
1192 | end: | ||
1193 | return 0; | ||
1194 | } | ||
1195 | |||
1196 | static int | ||
1197 | acpi_video_device_state_open_fs(struct inode *inode, struct file *file) | ||
1198 | { | ||
1199 | return single_open(file, acpi_video_device_state_seq_show, | ||
1200 | PDE(inode)->data); | ||
1201 | } | ||
1202 | |||
1203 | static ssize_t | ||
1204 | acpi_video_device_write_state(struct file *file, | ||
1205 | const char __user * buffer, | ||
1206 | size_t count, loff_t * data) | ||
1207 | { | ||
1208 | int status; | ||
1209 | struct seq_file *m = file->private_data; | ||
1210 | struct acpi_video_device *dev = m->private; | ||
1211 | char str[12] = { 0 }; | ||
1212 | u32 state = 0; | ||
1213 | |||
1214 | |||
1215 | if (!dev || count >= sizeof(str)) | ||
1216 | return -EINVAL; | ||
1217 | |||
1218 | if (copy_from_user(str, buffer, count)) | ||
1219 | return -EFAULT; | ||
1220 | |||
1221 | str[count] = 0; | ||
1222 | state = simple_strtoul(str, NULL, 0); | ||
1223 | state &= ((1ul << 31) | (1ul << 30) | (1ul << 0)); | ||
1224 | |||
1225 | status = acpi_video_device_set_state(dev, state); | ||
1226 | |||
1227 | if (status) | ||
1228 | return -EFAULT; | ||
1229 | |||
1230 | return count; | ||
1231 | } | ||
1232 | |||
1233 | static int | ||
1234 | acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) | ||
1235 | { | ||
1236 | struct acpi_video_device *dev = seq->private; | ||
1237 | int i; | ||
1238 | |||
1239 | |||
1240 | if (!dev || !dev->brightness) { | ||
1241 | seq_printf(seq, "<not supported>\n"); | ||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | seq_printf(seq, "levels: "); | ||
1246 | for (i = 2; i < dev->brightness->count; i++) | ||
1247 | seq_printf(seq, " %d", dev->brightness->levels[i]); | ||
1248 | seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); | ||
1249 | |||
1250 | return 0; | ||
1251 | } | ||
1252 | |||
1253 | static int | ||
1254 | acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file) | ||
1255 | { | ||
1256 | return single_open(file, acpi_video_device_brightness_seq_show, | ||
1257 | PDE(inode)->data); | ||
1258 | } | ||
1259 | |||
1260 | static ssize_t | ||
1261 | acpi_video_device_write_brightness(struct file *file, | ||
1262 | const char __user * buffer, | ||
1263 | size_t count, loff_t * data) | ||
1264 | { | ||
1265 | struct seq_file *m = file->private_data; | ||
1266 | struct acpi_video_device *dev = m->private; | ||
1267 | char str[5] = { 0 }; | ||
1268 | unsigned int level = 0; | ||
1269 | int i; | ||
1270 | |||
1271 | |||
1272 | if (!dev || !dev->brightness || count >= sizeof(str)) | ||
1273 | return -EINVAL; | ||
1274 | |||
1275 | if (copy_from_user(str, buffer, count)) | ||
1276 | return -EFAULT; | ||
1277 | |||
1278 | str[count] = 0; | ||
1279 | level = simple_strtoul(str, NULL, 0); | ||
1280 | |||
1281 | if (level > 100) | ||
1282 | return -EFAULT; | ||
1283 | |||
1284 | /* validate through the list of available levels */ | ||
1285 | for (i = 2; i < dev->brightness->count; i++) | ||
1286 | if (level == dev->brightness->levels[i]) { | ||
1287 | if (!acpi_video_device_lcd_set_level(dev, level)) | ||
1288 | return count; | ||
1289 | break; | ||
1290 | } | ||
1291 | |||
1292 | return -EINVAL; | ||
1293 | } | ||
1294 | |||
1295 | static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) | ||
1296 | { | ||
1297 | struct acpi_video_device *dev = seq->private; | ||
1298 | int status; | ||
1299 | int i; | ||
1300 | union acpi_object *edid = NULL; | ||
1301 | |||
1302 | |||
1303 | if (!dev) | ||
1304 | goto out; | ||
1305 | |||
1306 | status = acpi_video_device_EDID(dev, &edid, 128); | ||
1307 | if (ACPI_FAILURE(status)) { | ||
1308 | status = acpi_video_device_EDID(dev, &edid, 256); | ||
1309 | } | ||
1310 | |||
1311 | if (ACPI_FAILURE(status)) { | ||
1312 | goto out; | ||
1313 | } | ||
1314 | |||
1315 | if (edid && edid->type == ACPI_TYPE_BUFFER) { | ||
1316 | for (i = 0; i < edid->buffer.length; i++) | ||
1317 | seq_putc(seq, edid->buffer.pointer[i]); | ||
1318 | } | ||
1319 | |||
1320 | out: | ||
1321 | if (!edid) | ||
1322 | seq_printf(seq, "<not supported>\n"); | ||
1323 | else | ||
1324 | kfree(edid); | ||
1325 | |||
1326 | return 0; | ||
1327 | } | ||
1328 | |||
1329 | static int | ||
1330 | acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) | ||
1331 | { | ||
1332 | return single_open(file, acpi_video_device_EDID_seq_show, | ||
1333 | PDE(inode)->data); | ||
1334 | } | ||
1335 | |||
1336 | static int acpi_video_device_add_fs(struct acpi_device *device) | ||
1337 | { | ||
1338 | struct proc_dir_entry *entry, *device_dir; | ||
1339 | struct acpi_video_device *vid_dev; | ||
1340 | |||
1341 | vid_dev = acpi_driver_data(device); | ||
1342 | if (!vid_dev) | ||
1343 | return -ENODEV; | ||
1344 | |||
1345 | device_dir = proc_mkdir(acpi_device_bid(device), | ||
1346 | vid_dev->video->dir); | ||
1347 | if (!device_dir) | ||
1348 | return -ENOMEM; | ||
1349 | |||
1350 | /* 'info' [R] */ | ||
1351 | entry = proc_create_data("info", S_IRUGO, device_dir, | ||
1352 | &acpi_video_device_info_fops, acpi_driver_data(device)); | ||
1353 | if (!entry) | ||
1354 | goto err_remove_dir; | ||
1355 | |||
1356 | /* 'state' [R/W] */ | ||
1357 | entry = proc_create_data("state", S_IFREG | S_IRUGO | S_IWUSR, | ||
1358 | device_dir, | ||
1359 | &acpi_video_device_state_fops, | ||
1360 | acpi_driver_data(device)); | ||
1361 | if (!entry) | ||
1362 | goto err_remove_info; | ||
1363 | |||
1364 | /* 'brightness' [R/W] */ | ||
1365 | entry = proc_create_data("brightness", S_IFREG | S_IRUGO | S_IWUSR, | ||
1366 | device_dir, | ||
1367 | &acpi_video_device_brightness_fops, | ||
1368 | acpi_driver_data(device)); | ||
1369 | if (!entry) | ||
1370 | goto err_remove_state; | ||
1371 | |||
1372 | /* 'EDID' [R] */ | ||
1373 | entry = proc_create_data("EDID", S_IRUGO, device_dir, | ||
1374 | &acpi_video_device_EDID_fops, | ||
1375 | acpi_driver_data(device)); | ||
1376 | if (!entry) | ||
1377 | goto err_remove_brightness; | ||
1378 | |||
1379 | acpi_device_dir(device) = device_dir; | ||
1380 | |||
1381 | return 0; | ||
1382 | |||
1383 | err_remove_brightness: | ||
1384 | remove_proc_entry("brightness", device_dir); | ||
1385 | err_remove_state: | ||
1386 | remove_proc_entry("state", device_dir); | ||
1387 | err_remove_info: | ||
1388 | remove_proc_entry("info", device_dir); | ||
1389 | err_remove_dir: | ||
1390 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | ||
1391 | return -ENOMEM; | ||
1392 | } | ||
1393 | |||
1394 | static int acpi_video_device_remove_fs(struct acpi_device *device) | ||
1395 | { | ||
1396 | struct acpi_video_device *vid_dev; | ||
1397 | struct proc_dir_entry *device_dir; | ||
1398 | |||
1399 | vid_dev = acpi_driver_data(device); | ||
1400 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) | ||
1401 | return -ENODEV; | ||
1402 | |||
1403 | device_dir = acpi_device_dir(device); | ||
1404 | if (device_dir) { | ||
1405 | remove_proc_entry("info", device_dir); | ||
1406 | remove_proc_entry("state", device_dir); | ||
1407 | remove_proc_entry("brightness", device_dir); | ||
1408 | remove_proc_entry("EDID", device_dir); | ||
1409 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | ||
1410 | acpi_device_dir(device) = NULL; | ||
1411 | } | ||
1412 | |||
1413 | return 0; | ||
1414 | } | ||
1415 | |||
1416 | /* video bus */ | ||
1417 | static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) | ||
1418 | { | ||
1419 | struct acpi_video_bus *video = seq->private; | ||
1420 | |||
1421 | |||
1422 | if (!video) | ||
1423 | goto end; | ||
1424 | |||
1425 | seq_printf(seq, "Switching heads: %s\n", | ||
1426 | video->flags.multihead ? "yes" : "no"); | ||
1427 | seq_printf(seq, "Video ROM: %s\n", | ||
1428 | video->flags.rom ? "yes" : "no"); | ||
1429 | seq_printf(seq, "Device to be POSTed on boot: %s\n", | ||
1430 | video->flags.post ? "yes" : "no"); | ||
1431 | |||
1432 | end: | ||
1433 | return 0; | ||
1434 | } | ||
1435 | |||
1436 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) | ||
1437 | { | ||
1438 | return single_open(file, acpi_video_bus_info_seq_show, | ||
1439 | PDE(inode)->data); | ||
1440 | } | ||
1441 | |||
1442 | static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) | ||
1443 | { | ||
1444 | struct acpi_video_bus *video = seq->private; | ||
1445 | |||
1446 | |||
1447 | if (!video) | ||
1448 | goto end; | ||
1449 | |||
1450 | printk(KERN_INFO PREFIX "Please implement %s\n", __func__); | ||
1451 | seq_printf(seq, "<TODO>\n"); | ||
1452 | |||
1453 | end: | ||
1454 | return 0; | ||
1455 | } | ||
1456 | |||
1457 | static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) | ||
1458 | { | ||
1459 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); | ||
1460 | } | ||
1461 | |||
1462 | static int | ||
1463 | acpi_video_bus_POST_options(struct acpi_video_bus *video, | ||
1464 | unsigned long long *options) | ||
1465 | { | ||
1466 | int status; | ||
1467 | |||
1468 | status = acpi_evaluate_integer(video->device->handle, "_VPO", | ||
1469 | NULL, options); | ||
1470 | *options &= 3; | ||
1471 | |||
1472 | return status; | ||
1473 | } | ||
1474 | |||
1475 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | ||
1476 | { | ||
1477 | struct acpi_video_bus *video = seq->private; | ||
1478 | unsigned long long options; | ||
1479 | int status; | ||
1480 | |||
1481 | |||
1482 | if (!video) | ||
1483 | goto end; | ||
1484 | |||
1485 | status = acpi_video_bus_POST_options(video, &options); | ||
1486 | if (ACPI_SUCCESS(status)) { | ||
1487 | if (!(options & 1)) { | ||
1488 | printk(KERN_WARNING PREFIX | ||
1489 | "The motherboard VGA device is not listed as a possible POST device.\n"); | ||
1490 | printk(KERN_WARNING PREFIX | ||
1491 | "This indicates a BIOS bug. Please contact the manufacturer.\n"); | ||
1492 | } | ||
1493 | printk(KERN_WARNING "%llx\n", options); | ||
1494 | seq_printf(seq, "can POST: <integrated video>"); | ||
1495 | if (options & 2) | ||
1496 | seq_printf(seq, " <PCI video>"); | ||
1497 | if (options & 4) | ||
1498 | seq_printf(seq, " <AGP video>"); | ||
1499 | seq_putc(seq, '\n'); | ||
1500 | } else | ||
1501 | seq_printf(seq, "<not supported>\n"); | ||
1502 | end: | ||
1503 | return 0; | ||
1504 | } | ||
1505 | |||
1506 | static int | ||
1507 | acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) | ||
1508 | { | ||
1509 | return single_open(file, acpi_video_bus_POST_info_seq_show, | ||
1510 | PDE(inode)->data); | ||
1511 | } | ||
1512 | |||
1513 | static int | ||
1514 | acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) | ||
1515 | { | ||
1516 | int status; | ||
1517 | |||
1518 | status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | ||
1519 | |||
1520 | return status; | ||
1521 | } | ||
1522 | |||
1523 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) | ||
1524 | { | ||
1525 | struct acpi_video_bus *video = seq->private; | ||
1526 | int status; | ||
1527 | unsigned long long id; | ||
1528 | |||
1529 | |||
1530 | if (!video) | ||
1531 | goto end; | ||
1532 | |||
1533 | status = acpi_video_bus_get_POST(video, &id); | ||
1534 | if (!ACPI_SUCCESS(status)) { | ||
1535 | seq_printf(seq, "<not supported>\n"); | ||
1536 | goto end; | ||
1537 | } | ||
1538 | seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]); | ||
1539 | |||
1540 | end: | ||
1541 | return 0; | ||
1542 | } | ||
1543 | |||
1544 | static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) | ||
1545 | { | ||
1546 | struct acpi_video_bus *video = seq->private; | ||
1547 | |||
1548 | |||
1549 | seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); | ||
1550 | |||
1551 | return 0; | ||
1552 | } | ||
1553 | |||
1554 | static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) | ||
1555 | { | ||
1556 | return single_open(file, acpi_video_bus_POST_seq_show, | ||
1557 | PDE(inode)->data); | ||
1558 | } | ||
1559 | |||
1560 | static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) | ||
1561 | { | ||
1562 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); | ||
1563 | } | ||
1564 | |||
1565 | static int | ||
1566 | acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | ||
1567 | { | ||
1568 | int status; | ||
1569 | unsigned long long tmp; | ||
1570 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
1571 | struct acpi_object_list args = { 1, &arg0 }; | ||
1572 | |||
1573 | |||
1574 | arg0.integer.value = option; | ||
1575 | |||
1576 | status = acpi_evaluate_integer(video->device->handle, "_SPD", | ||
1577 | &args, &tmp); | ||
1578 | if (ACPI_SUCCESS(status)) | ||
1579 | status = tmp ? (-EINVAL) : (AE_OK); | ||
1580 | |||
1581 | return status; | ||
1582 | } | ||
1583 | |||
1584 | static ssize_t | ||
1585 | acpi_video_bus_write_POST(struct file *file, | ||
1586 | const char __user * buffer, | ||
1587 | size_t count, loff_t * data) | ||
1588 | { | ||
1589 | int status; | ||
1590 | struct seq_file *m = file->private_data; | ||
1591 | struct acpi_video_bus *video = m->private; | ||
1592 | char str[12] = { 0 }; | ||
1593 | unsigned long long opt, options; | ||
1594 | |||
1595 | |||
1596 | if (!video || count >= sizeof(str)) | ||
1597 | return -EINVAL; | ||
1598 | |||
1599 | status = acpi_video_bus_POST_options(video, &options); | ||
1600 | if (!ACPI_SUCCESS(status)) | ||
1601 | return -EINVAL; | ||
1602 | |||
1603 | if (copy_from_user(str, buffer, count)) | ||
1604 | return -EFAULT; | ||
1605 | |||
1606 | str[count] = 0; | ||
1607 | opt = strtoul(str, NULL, 0); | ||
1608 | if (opt > 3) | ||
1609 | return -EFAULT; | ||
1610 | |||
1611 | /* just in case an OEM 'forgot' the motherboard... */ | ||
1612 | options |= 1; | ||
1613 | |||
1614 | if (options & (1ul << opt)) { | ||
1615 | status = acpi_video_bus_set_POST(video, opt); | ||
1616 | if (!ACPI_SUCCESS(status)) | ||
1617 | return -EFAULT; | ||
1618 | |||
1619 | } | ||
1620 | |||
1621 | return count; | ||
1622 | } | ||
1623 | |||
1624 | static ssize_t | ||
1625 | acpi_video_bus_write_DOS(struct file *file, | ||
1626 | const char __user * buffer, | ||
1627 | size_t count, loff_t * data) | ||
1628 | { | ||
1629 | int status; | ||
1630 | struct seq_file *m = file->private_data; | ||
1631 | struct acpi_video_bus *video = m->private; | ||
1632 | char str[12] = { 0 }; | ||
1633 | unsigned long opt; | ||
1634 | |||
1635 | |||
1636 | if (!video || count >= sizeof(str)) | ||
1637 | return -EINVAL; | ||
1638 | |||
1639 | if (copy_from_user(str, buffer, count)) | ||
1640 | return -EFAULT; | ||
1641 | |||
1642 | str[count] = 0; | ||
1643 | opt = strtoul(str, NULL, 0); | ||
1644 | if (opt > 7) | ||
1645 | return -EFAULT; | ||
1646 | |||
1647 | status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); | ||
1648 | |||
1649 | if (!ACPI_SUCCESS(status)) | ||
1650 | return -EFAULT; | ||
1651 | |||
1652 | return count; | ||
1653 | } | ||
1654 | |||
1655 | static int acpi_video_bus_add_fs(struct acpi_device *device) | ||
1656 | { | ||
1657 | struct acpi_video_bus *video = acpi_driver_data(device); | ||
1658 | struct proc_dir_entry *device_dir; | ||
1659 | struct proc_dir_entry *entry; | ||
1660 | |||
1661 | device_dir = proc_mkdir(acpi_device_bid(device), acpi_video_dir); | ||
1662 | if (!device_dir) | ||
1663 | return -ENOMEM; | ||
1664 | |||
1665 | /* 'info' [R] */ | ||
1666 | entry = proc_create_data("info", S_IRUGO, device_dir, | ||
1667 | &acpi_video_bus_info_fops, | ||
1668 | acpi_driver_data(device)); | ||
1669 | if (!entry) | ||
1670 | goto err_remove_dir; | ||
1671 | |||
1672 | /* 'ROM' [R] */ | ||
1673 | entry = proc_create_data("ROM", S_IRUGO, device_dir, | ||
1674 | &acpi_video_bus_ROM_fops, | ||
1675 | acpi_driver_data(device)); | ||
1676 | if (!entry) | ||
1677 | goto err_remove_info; | ||
1678 | |||
1679 | /* 'POST_info' [R] */ | ||
1680 | entry = proc_create_data("POST_info", S_IRUGO, device_dir, | ||
1681 | &acpi_video_bus_POST_info_fops, | ||
1682 | acpi_driver_data(device)); | ||
1683 | if (!entry) | ||
1684 | goto err_remove_rom; | ||
1685 | |||
1686 | /* 'POST' [R/W] */ | ||
1687 | entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, | ||
1688 | device_dir, | ||
1689 | &acpi_video_bus_POST_fops, | ||
1690 | acpi_driver_data(device)); | ||
1691 | if (!entry) | ||
1692 | goto err_remove_post_info; | ||
1693 | |||
1694 | /* 'DOS' [R/W] */ | ||
1695 | entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, | ||
1696 | device_dir, | ||
1697 | &acpi_video_bus_DOS_fops, | ||
1698 | acpi_driver_data(device)); | ||
1699 | if (!entry) | ||
1700 | goto err_remove_post; | ||
1701 | |||
1702 | video->dir = acpi_device_dir(device) = device_dir; | ||
1703 | return 0; | ||
1704 | |||
1705 | err_remove_post: | ||
1706 | remove_proc_entry("POST", device_dir); | ||
1707 | err_remove_post_info: | ||
1708 | remove_proc_entry("POST_info", device_dir); | ||
1709 | err_remove_rom: | ||
1710 | remove_proc_entry("ROM", device_dir); | ||
1711 | err_remove_info: | ||
1712 | remove_proc_entry("info", device_dir); | ||
1713 | err_remove_dir: | ||
1714 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | ||
1715 | return -ENOMEM; | ||
1716 | } | ||
1717 | |||
1718 | static int acpi_video_bus_remove_fs(struct acpi_device *device) | ||
1719 | { | ||
1720 | struct proc_dir_entry *device_dir = acpi_device_dir(device); | ||
1721 | |||
1722 | if (device_dir) { | ||
1723 | remove_proc_entry("info", device_dir); | ||
1724 | remove_proc_entry("ROM", device_dir); | ||
1725 | remove_proc_entry("POST_info", device_dir); | ||
1726 | remove_proc_entry("POST", device_dir); | ||
1727 | remove_proc_entry("DOS", device_dir); | ||
1728 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | ||
1729 | acpi_device_dir(device) = NULL; | ||
1730 | } | ||
1731 | |||
1732 | return 0; | ||
1733 | } | ||
1734 | #else | ||
1735 | static inline int acpi_video_device_add_fs(struct acpi_device *device) | ||
1736 | { | ||
1737 | return 0; | ||
1738 | } | ||
1739 | static inline int acpi_video_device_remove_fs(struct acpi_device *device) | ||
1740 | { | ||
1741 | return 0; | ||
1742 | } | ||
1743 | static inline int acpi_video_bus_add_fs(struct acpi_device *device) | ||
1744 | { | ||
1745 | return 0; | ||
1746 | } | ||
1747 | static inline int acpi_video_bus_remove_fs(struct acpi_device *device) | ||
1748 | { | ||
1749 | return 0; | ||
1750 | } | ||
1751 | #endif /* CONFIG_ACPI_PROCFS */ | ||
1752 | |||
1753 | /* -------------------------------------------------------------------------- | ||
1754 | Driver Interface | 1007 | Driver Interface |
1755 | -------------------------------------------------------------------------- */ | 1008 | -------------------------------------------------------------------------- */ |
1756 | 1009 | ||
@@ -1877,8 +1130,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1877 | list_add_tail(&data->entry, &video->video_device_list); | 1130 | list_add_tail(&data->entry, &video->video_device_list); |
1878 | mutex_unlock(&video->device_list_lock); | 1131 | mutex_unlock(&video->device_list_lock); |
1879 | 1132 | ||
1880 | acpi_video_device_add_fs(device); | ||
1881 | |||
1882 | return 0; | 1133 | return 0; |
1883 | } | 1134 | } |
1884 | 1135 | ||
@@ -2181,8 +1432,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
2181 | if (!device || !device->video) | 1432 | if (!device || !device->video) |
2182 | return -ENOENT; | 1433 | return -ENOENT; |
2183 | 1434 | ||
2184 | acpi_video_device_remove_fs(device->dev); | ||
2185 | |||
2186 | status = acpi_remove_notify_handler(device->dev->handle, | 1435 | status = acpi_remove_notify_handler(device->dev->handle, |
2187 | ACPI_DEVICE_NOTIFY, | 1436 | ACPI_DEVICE_NOTIFY, |
2188 | acpi_video_device_notify); | 1437 | acpi_video_device_notify); |
@@ -2466,10 +1715,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2466 | if (error) | 1715 | if (error) |
2467 | goto err_free_video; | 1716 | goto err_free_video; |
2468 | 1717 | ||
2469 | error = acpi_video_bus_add_fs(device); | ||
2470 | if (error) | ||
2471 | goto err_free_video; | ||
2472 | |||
2473 | mutex_init(&video->device_list_lock); | 1718 | mutex_init(&video->device_list_lock); |
2474 | INIT_LIST_HEAD(&video->video_device_list); | 1719 | INIT_LIST_HEAD(&video->video_device_list); |
2475 | 1720 | ||
@@ -2522,7 +1767,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2522 | acpi_video_bus_stop_devices(video); | 1767 | acpi_video_bus_stop_devices(video); |
2523 | acpi_video_bus_put_devices(video); | 1768 | acpi_video_bus_put_devices(video); |
2524 | kfree(video->attached_array); | 1769 | kfree(video->attached_array); |
2525 | acpi_video_bus_remove_fs(device); | ||
2526 | err_free_video: | 1770 | err_free_video: |
2527 | kfree(video); | 1771 | kfree(video); |
2528 | device->driver_data = NULL; | 1772 | device->driver_data = NULL; |
@@ -2544,7 +1788,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
2544 | 1788 | ||
2545 | acpi_video_bus_stop_devices(video); | 1789 | acpi_video_bus_stop_devices(video); |
2546 | acpi_video_bus_put_devices(video); | 1790 | acpi_video_bus_put_devices(video); |
2547 | acpi_video_bus_remove_fs(device); | ||
2548 | 1791 | ||
2549 | input_unregister_device(video->input); | 1792 | input_unregister_device(video->input); |
2550 | kfree(video->attached_array); | 1793 | kfree(video->attached_array); |
@@ -2584,17 +1827,9 @@ int acpi_video_register(void) | |||
2584 | return 0; | 1827 | return 0; |
2585 | } | 1828 | } |
2586 | 1829 | ||
2587 | #ifdef CONFIG_ACPI_PROCFS | ||
2588 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | ||
2589 | if (!acpi_video_dir) | ||
2590 | return -ENODEV; | ||
2591 | #endif | ||
2592 | |||
2593 | result = acpi_bus_register_driver(&acpi_video_bus); | 1830 | result = acpi_bus_register_driver(&acpi_video_bus); |
2594 | if (result < 0) { | 1831 | if (result < 0) |
2595 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); | ||
2596 | return -ENODEV; | 1832 | return -ENODEV; |
2597 | } | ||
2598 | 1833 | ||
2599 | /* | 1834 | /* |
2600 | * When the acpi_video_bus is loaded successfully, increase | 1835 | * When the acpi_video_bus is loaded successfully, increase |
@@ -2617,10 +1852,6 @@ void acpi_video_unregister(void) | |||
2617 | } | 1852 | } |
2618 | acpi_bus_unregister_driver(&acpi_video_bus); | 1853 | acpi_bus_unregister_driver(&acpi_video_bus); |
2619 | 1854 | ||
2620 | #ifdef CONFIG_ACPI_PROCFS | ||
2621 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); | ||
2622 | #endif | ||
2623 | |||
2624 | register_count = 0; | 1855 | register_count = 0; |
2625 | 1856 | ||
2626 | return; | 1857 | return; |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index c5fef01b3c9..b8367612659 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -59,8 +59,8 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, | |||
59 | "support\n")); | 59 | "support\n")); |
60 | *cap |= ACPI_VIDEO_BACKLIGHT; | 60 | *cap |= ACPI_VIDEO_BACKLIGHT; |
61 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) | 61 | if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) |
62 | printk(KERN_WARNING FW_BUG PREFIX "ACPI brightness " | 62 | printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " |
63 | "control misses _BQC function\n"); | 63 | "cannot determine initial brightness\n"); |
64 | /* We have backlight support, no need to scan further */ | 64 | /* We have backlight support, no need to scan further */ |
65 | return AE_CTRL_TERMINATE; | 65 | return AE_CTRL_TERMINATE; |
66 | } | 66 | } |
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index ee9ddeb5341..8cb0347dec2 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c | |||
@@ -3156,7 +3156,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3156 | { | 3156 | { |
3157 | struct atm_dev *dev; | 3157 | struct atm_dev *dev; |
3158 | IADEV *iadev; | 3158 | IADEV *iadev; |
3159 | unsigned long flags; | ||
3160 | int ret; | 3159 | int ret; |
3161 | 3160 | ||
3162 | iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); | 3161 | iadev = kzalloc(sizeof(*iadev), GFP_KERNEL); |
@@ -3188,19 +3187,14 @@ static int __devinit ia_init_one(struct pci_dev *pdev, | |||
3188 | ia_dev[iadev_count] = iadev; | 3187 | ia_dev[iadev_count] = iadev; |
3189 | _ia_dev[iadev_count] = dev; | 3188 | _ia_dev[iadev_count] = dev; |
3190 | iadev_count++; | 3189 | iadev_count++; |
3191 | spin_lock_init(&iadev->misc_lock); | ||
3192 | /* First fixes first. I don't want to think about this now. */ | ||
3193 | spin_lock_irqsave(&iadev->misc_lock, flags); | ||
3194 | if (ia_init(dev) || ia_start(dev)) { | 3190 | if (ia_init(dev) || ia_start(dev)) { |
3195 | IF_INIT(printk("IA register failed!\n");) | 3191 | IF_INIT(printk("IA register failed!\n");) |
3196 | iadev_count--; | 3192 | iadev_count--; |
3197 | ia_dev[iadev_count] = NULL; | 3193 | ia_dev[iadev_count] = NULL; |
3198 | _ia_dev[iadev_count] = NULL; | 3194 | _ia_dev[iadev_count] = NULL; |
3199 | spin_unlock_irqrestore(&iadev->misc_lock, flags); | ||
3200 | ret = -EINVAL; | 3195 | ret = -EINVAL; |
3201 | goto err_out_deregister_dev; | 3196 | goto err_out_deregister_dev; |
3202 | } | 3197 | } |
3203 | spin_unlock_irqrestore(&iadev->misc_lock, flags); | ||
3204 | IF_EVENT(printk("iadev_count = %d\n", iadev_count);) | 3198 | IF_EVENT(printk("iadev_count = %d\n", iadev_count);) |
3205 | 3199 | ||
3206 | iadev->next_board = ia_boards; | 3200 | iadev->next_board = ia_boards; |
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index b2cd20f549c..077735e0e04 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h | |||
@@ -1022,7 +1022,7 @@ typedef struct iadev_t { | |||
1022 | struct dle_q rx_dle_q; | 1022 | struct dle_q rx_dle_q; |
1023 | struct free_desc_q *rx_free_desc_qhead; | 1023 | struct free_desc_q *rx_free_desc_qhead; |
1024 | struct sk_buff_head rx_dma_q; | 1024 | struct sk_buff_head rx_dma_q; |
1025 | spinlock_t rx_lock, misc_lock; | 1025 | spinlock_t rx_lock; |
1026 | struct atm_vcc **rx_open; /* list of all open VCs */ | 1026 | struct atm_vcc **rx_open; /* list of all open VCs */ |
1027 | u16 num_rx_desc, rx_buf_sz, rxing; | 1027 | u16 num_rx_desc, rx_buf_sz, rxing; |
1028 | u32 rx_pkt_ram, rx_tmp_cnt; | 1028 | u32 rx_pkt_ram, rx_tmp_cnt; |
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index f916ddf6393..f46138ab38b 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -444,6 +444,7 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, | |||
444 | struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); | 444 | struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev); |
445 | struct solos_card *card = atmdev->dev_data; | 445 | struct solos_card *card = atmdev->dev_data; |
446 | struct sk_buff *skb; | 446 | struct sk_buff *skb; |
447 | unsigned int len; | ||
447 | 448 | ||
448 | spin_lock(&card->cli_queue_lock); | 449 | spin_lock(&card->cli_queue_lock); |
449 | skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); | 450 | skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]); |
@@ -451,11 +452,12 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr, | |||
451 | if(skb == NULL) | 452 | if(skb == NULL) |
452 | return sprintf(buf, "No data.\n"); | 453 | return sprintf(buf, "No data.\n"); |
453 | 454 | ||
454 | memcpy(buf, skb->data, skb->len); | 455 | len = skb->len; |
455 | dev_dbg(&card->dev->dev, "len: %d\n", skb->len); | 456 | memcpy(buf, skb->data, len); |
457 | dev_dbg(&card->dev->dev, "len: %d\n", len); | ||
456 | 458 | ||
457 | kfree_skb(skb); | 459 | kfree_skb(skb); |
458 | return skb->len; | 460 | return len; |
459 | } | 461 | } |
460 | 462 | ||
461 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) | 463 | static int send_command(struct solos_card *card, int dev, const char *buf, size_t size) |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index e9da874d041..03688c2da31 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -113,7 +113,7 @@ static void ps3disk_scatter_gather(struct ps3_storage_device *dev, | |||
113 | memcpy(buf, dev->bounce_buf+offset, size); | 113 | memcpy(buf, dev->bounce_buf+offset, size); |
114 | offset += size; | 114 | offset += size; |
115 | flush_kernel_dcache_page(bvec->bv_page); | 115 | flush_kernel_dcache_page(bvec->bv_page); |
116 | bvec_kunmap_irq(bvec, &flags); | 116 | bvec_kunmap_irq(buf, &flags); |
117 | i++; | 117 | i++; |
118 | } | 118 | } |
119 | } | 119 | } |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 2aafafca2b1..1101e251a62 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -202,6 +202,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
202 | struct virtio_blk *vblk = disk->private_data; | 202 | struct virtio_blk *vblk = disk->private_data; |
203 | struct request *req; | 203 | struct request *req; |
204 | struct bio *bio; | 204 | struct bio *bio; |
205 | int err; | ||
205 | 206 | ||
206 | bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, | 207 | bio = bio_map_kern(vblk->disk->queue, id_str, VIRTIO_BLK_ID_BYTES, |
207 | GFP_KERNEL); | 208 | GFP_KERNEL); |
@@ -215,7 +216,10 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
215 | } | 216 | } |
216 | 217 | ||
217 | req->cmd_type = REQ_TYPE_SPECIAL; | 218 | req->cmd_type = REQ_TYPE_SPECIAL; |
218 | return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); | 219 | err = blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); |
220 | blk_put_request(req); | ||
221 | |||
222 | return err; | ||
219 | } | 223 | } |
220 | 224 | ||
221 | static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, | 225 | static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index c810481a5bc..0f69c5ec0ec 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -459,9 +459,12 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count, | |||
459 | 459 | ||
460 | /* | 460 | /* |
461 | * Wait till the host acknowledges it pushed out the data we | 461 | * Wait till the host acknowledges it pushed out the data we |
462 | * sent. This is done for ports in blocking mode or for data | 462 | * sent. This is done for data from the hvc_console; the tty |
463 | * from the hvc_console; the tty operations are performed with | 463 | * operations are performed with spinlocks held so we can't |
464 | * spinlocks held so we can't sleep here. | 464 | * sleep here. An alternative would be to copy the data to a |
465 | * buffer and relax the spinning requirement. The downside is | ||
466 | * we need to kmalloc a GFP_ATOMIC buffer each time the | ||
467 | * console driver writes something out. | ||
465 | */ | 468 | */ |
466 | while (!virtqueue_get_buf(out_vq, &len)) | 469 | while (!virtqueue_get_buf(out_vq, &len)) |
467 | cpu_relax(); | 470 | cpu_relax(); |
@@ -626,6 +629,14 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
626 | goto free_buf; | 629 | goto free_buf; |
627 | } | 630 | } |
628 | 631 | ||
632 | /* | ||
633 | * We now ask send_buf() to not spin for generic ports -- we | ||
634 | * can re-use the same code path that non-blocking file | ||
635 | * descriptors take for blocking file descriptors since the | ||
636 | * wait is already done and we're certain the write will go | ||
637 | * through to the host. | ||
638 | */ | ||
639 | nonblock = true; | ||
629 | ret = send_buf(port, buf, count, nonblock); | 640 | ret = send_buf(port, buf, count, nonblock); |
630 | 641 | ||
631 | if (nonblock && ret > 0) | 642 | if (nonblock && ret > 0) |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c2408bbe9c2..f508690eb95 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -80,7 +80,7 @@ | |||
80 | * Limiting Performance Impact | 80 | * Limiting Performance Impact |
81 | * --------------------------- | 81 | * --------------------------- |
82 | * C states, especially those with large exit latencies, can have a real | 82 | * C states, especially those with large exit latencies, can have a real |
83 | * noticable impact on workloads, which is not acceptable for most sysadmins, | 83 | * noticeable impact on workloads, which is not acceptable for most sysadmins, |
84 | * and in addition, less performance has a power price of its own. | 84 | * and in addition, less performance has a power price of its own. |
85 | * | 85 | * |
86 | * As a general rule of thumb, menu assumes that the following heuristic | 86 | * As a general rule of thumb, menu assumes that the following heuristic |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 216f9d383b5..effd140fc04 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -879,7 +879,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) | |||
879 | dma->device_issue_pending = ioat2_issue_pending; | 879 | dma->device_issue_pending = ioat2_issue_pending; |
880 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 880 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
881 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 881 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
882 | dma->device_tx_status = ioat_tx_status; | 882 | dma->device_tx_status = ioat_dma_tx_status; |
883 | 883 | ||
884 | err = ioat_probe(device); | 884 | err = ioat_probe(device); |
885 | if (err) | 885 | if (err) |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index fb64cf36ba6..eb6b54dbb80 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -580,7 +580,6 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
580 | 580 | ||
581 | sh_chan = to_sh_chan(chan); | 581 | sh_chan = to_sh_chan(chan); |
582 | param = chan->private; | 582 | param = chan->private; |
583 | slave_addr = param->config->addr; | ||
584 | 583 | ||
585 | /* Someone calling slave DMA on a public channel? */ | 584 | /* Someone calling slave DMA on a public channel? */ |
586 | if (!param || !sg_len) { | 585 | if (!param || !sg_len) { |
@@ -589,6 +588,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg( | |||
589 | return NULL; | 588 | return NULL; |
590 | } | 589 | } |
591 | 590 | ||
591 | slave_addr = param->config->addr; | ||
592 | |||
592 | /* | 593 | /* |
593 | * if (param != NULL), this is a successfully requested slave channel, | 594 | * if (param != NULL), this is a successfully requested slave channel, |
594 | * therefore param->config != NULL too. | 595 | * therefore param->config != NULL too. |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index e0187d16dd7..0fd5b85a0f7 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1140,6 +1140,7 @@ static struct mcidev_sysfs_attribute i7core_udimm_counters_attrs[] = { | |||
1140 | ATTR_COUNTER(0), | 1140 | ATTR_COUNTER(0), |
1141 | ATTR_COUNTER(1), | 1141 | ATTR_COUNTER(1), |
1142 | ATTR_COUNTER(2), | 1142 | ATTR_COUNTER(2), |
1143 | { .attr = { .name = NULL } } | ||
1143 | }; | 1144 | }; |
1144 | 1145 | ||
1145 | static struct mcidev_sysfs_group i7core_udimm_counters = { | 1146 | static struct mcidev_sysfs_group i7core_udimm_counters = { |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 1b05896648b..9dcb17d51ae 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2840,7 +2840,7 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2840 | const struct pci_device_id *ent) | 2840 | const struct pci_device_id *ent) |
2841 | { | 2841 | { |
2842 | struct fw_ohci *ohci; | 2842 | struct fw_ohci *ohci; |
2843 | u32 bus_options, max_receive, link_speed, version, link_enh; | 2843 | u32 bus_options, max_receive, link_speed, version; |
2844 | u64 guid; | 2844 | u64 guid; |
2845 | int i, err, n_ir, n_it; | 2845 | int i, err, n_ir, n_it; |
2846 | size_t size; | 2846 | size_t size; |
@@ -2894,23 +2894,6 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2894 | if (param_quirks) | 2894 | if (param_quirks) |
2895 | ohci->quirks = param_quirks; | 2895 | ohci->quirks = param_quirks; |
2896 | 2896 | ||
2897 | /* TI OHCI-Lynx and compatible: set recommended configuration bits. */ | ||
2898 | if (dev->vendor == PCI_VENDOR_ID_TI) { | ||
2899 | pci_read_config_dword(dev, PCI_CFG_TI_LinkEnh, &link_enh); | ||
2900 | |||
2901 | /* adjust latency of ATx FIFO: use 1.7 KB threshold */ | ||
2902 | link_enh &= ~TI_LinkEnh_atx_thresh_mask; | ||
2903 | link_enh |= TI_LinkEnh_atx_thresh_1_7K; | ||
2904 | |||
2905 | /* use priority arbitration for asynchronous responses */ | ||
2906 | link_enh |= TI_LinkEnh_enab_unfair; | ||
2907 | |||
2908 | /* required for aPhyEnhanceEnable to work */ | ||
2909 | link_enh |= TI_LinkEnh_enab_accel; | ||
2910 | |||
2911 | pci_write_config_dword(dev, PCI_CFG_TI_LinkEnh, link_enh); | ||
2912 | } | ||
2913 | |||
2914 | ar_context_init(&ohci->ar_request_ctx, ohci, | 2897 | ar_context_init(&ohci->ar_request_ctx, ohci, |
2915 | OHCI1394_AsReqRcvContextControlSet); | 2898 | OHCI1394_AsReqRcvContextControlSet); |
2916 | 2899 | ||
diff --git a/drivers/firewire/ohci.h b/drivers/firewire/ohci.h index 0e6c5a46690..ef5e7336da6 100644 --- a/drivers/firewire/ohci.h +++ b/drivers/firewire/ohci.h | |||
@@ -155,12 +155,4 @@ | |||
155 | 155 | ||
156 | #define OHCI1394_phy_tcode 0xe | 156 | #define OHCI1394_phy_tcode 0xe |
157 | 157 | ||
158 | /* TI extensions */ | ||
159 | |||
160 | #define PCI_CFG_TI_LinkEnh 0xf4 | ||
161 | #define TI_LinkEnh_enab_accel 0x00000002 | ||
162 | #define TI_LinkEnh_enab_unfair 0x00000080 | ||
163 | #define TI_LinkEnh_atx_thresh_mask 0x00003000 | ||
164 | #define TI_LinkEnh_atx_thresh_1_7K 0x00001000 | ||
165 | |||
166 | #endif /* _FIREWIRE_OHCI_H */ | 158 | #endif /* _FIREWIRE_OHCI_H */ |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index bf92d07510d..5663d271906 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -148,7 +148,7 @@ int drm_gem_object_init(struct drm_device *dev, | |||
148 | return -ENOMEM; | 148 | return -ENOMEM; |
149 | 149 | ||
150 | kref_init(&obj->refcount); | 150 | kref_init(&obj->refcount); |
151 | kref_init(&obj->handlecount); | 151 | atomic_set(&obj->handle_count, 0); |
152 | obj->size = size; | 152 | obj->size = size; |
153 | 153 | ||
154 | atomic_inc(&dev->object_count); | 154 | atomic_inc(&dev->object_count); |
@@ -462,28 +462,6 @@ drm_gem_object_free(struct kref *kref) | |||
462 | } | 462 | } |
463 | EXPORT_SYMBOL(drm_gem_object_free); | 463 | EXPORT_SYMBOL(drm_gem_object_free); |
464 | 464 | ||
465 | /** | ||
466 | * Called after the last reference to the object has been lost. | ||
467 | * Must be called without holding struct_mutex | ||
468 | * | ||
469 | * Frees the object | ||
470 | */ | ||
471 | void | ||
472 | drm_gem_object_free_unlocked(struct kref *kref) | ||
473 | { | ||
474 | struct drm_gem_object *obj = (struct drm_gem_object *) kref; | ||
475 | struct drm_device *dev = obj->dev; | ||
476 | |||
477 | if (dev->driver->gem_free_object_unlocked != NULL) | ||
478 | dev->driver->gem_free_object_unlocked(obj); | ||
479 | else if (dev->driver->gem_free_object != NULL) { | ||
480 | mutex_lock(&dev->struct_mutex); | ||
481 | dev->driver->gem_free_object(obj); | ||
482 | mutex_unlock(&dev->struct_mutex); | ||
483 | } | ||
484 | } | ||
485 | EXPORT_SYMBOL(drm_gem_object_free_unlocked); | ||
486 | |||
487 | static void drm_gem_object_ref_bug(struct kref *list_kref) | 465 | static void drm_gem_object_ref_bug(struct kref *list_kref) |
488 | { | 466 | { |
489 | BUG(); | 467 | BUG(); |
@@ -496,12 +474,8 @@ static void drm_gem_object_ref_bug(struct kref *list_kref) | |||
496 | * called before drm_gem_object_free or we'll be touching | 474 | * called before drm_gem_object_free or we'll be touching |
497 | * freed memory | 475 | * freed memory |
498 | */ | 476 | */ |
499 | void | 477 | void drm_gem_object_handle_free(struct drm_gem_object *obj) |
500 | drm_gem_object_handle_free(struct kref *kref) | ||
501 | { | 478 | { |
502 | struct drm_gem_object *obj = container_of(kref, | ||
503 | struct drm_gem_object, | ||
504 | handlecount); | ||
505 | struct drm_device *dev = obj->dev; | 479 | struct drm_device *dev = obj->dev; |
506 | 480 | ||
507 | /* Remove any name for this object */ | 481 | /* Remove any name for this object */ |
@@ -528,6 +502,10 @@ void drm_gem_vm_open(struct vm_area_struct *vma) | |||
528 | struct drm_gem_object *obj = vma->vm_private_data; | 502 | struct drm_gem_object *obj = vma->vm_private_data; |
529 | 503 | ||
530 | drm_gem_object_reference(obj); | 504 | drm_gem_object_reference(obj); |
505 | |||
506 | mutex_lock(&obj->dev->struct_mutex); | ||
507 | drm_vm_open_locked(vma); | ||
508 | mutex_unlock(&obj->dev->struct_mutex); | ||
531 | } | 509 | } |
532 | EXPORT_SYMBOL(drm_gem_vm_open); | 510 | EXPORT_SYMBOL(drm_gem_vm_open); |
533 | 511 | ||
@@ -535,7 +513,10 @@ void drm_gem_vm_close(struct vm_area_struct *vma) | |||
535 | { | 513 | { |
536 | struct drm_gem_object *obj = vma->vm_private_data; | 514 | struct drm_gem_object *obj = vma->vm_private_data; |
537 | 515 | ||
538 | drm_gem_object_unreference_unlocked(obj); | 516 | mutex_lock(&obj->dev->struct_mutex); |
517 | drm_vm_close_locked(vma); | ||
518 | drm_gem_object_unreference(obj); | ||
519 | mutex_unlock(&obj->dev->struct_mutex); | ||
539 | } | 520 | } |
540 | EXPORT_SYMBOL(drm_gem_vm_close); | 521 | EXPORT_SYMBOL(drm_gem_vm_close); |
541 | 522 | ||
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 2ef2c782724..974e970ce3f 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -255,7 +255,7 @@ int drm_gem_one_name_info(int id, void *ptr, void *data) | |||
255 | 255 | ||
256 | seq_printf(m, "%6d %8zd %7d %8d\n", | 256 | seq_printf(m, "%6d %8zd %7d %8d\n", |
257 | obj->name, obj->size, | 257 | obj->name, obj->size, |
258 | atomic_read(&obj->handlecount.refcount), | 258 | atomic_read(&obj->handle_count), |
259 | atomic_read(&obj->refcount.refcount)); | 259 | atomic_read(&obj->refcount.refcount)); |
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index fda67468e60..5df450683aa 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -433,15 +433,7 @@ static void drm_vm_open(struct vm_area_struct *vma) | |||
433 | mutex_unlock(&dev->struct_mutex); | 433 | mutex_unlock(&dev->struct_mutex); |
434 | } | 434 | } |
435 | 435 | ||
436 | /** | 436 | void drm_vm_close_locked(struct vm_area_struct *vma) |
437 | * \c close method for all virtual memory types. | ||
438 | * | ||
439 | * \param vma virtual memory area. | ||
440 | * | ||
441 | * Search the \p vma private data entry in drm_device::vmalist, unlink it, and | ||
442 | * free it. | ||
443 | */ | ||
444 | static void drm_vm_close(struct vm_area_struct *vma) | ||
445 | { | 437 | { |
446 | struct drm_file *priv = vma->vm_file->private_data; | 438 | struct drm_file *priv = vma->vm_file->private_data; |
447 | struct drm_device *dev = priv->minor->dev; | 439 | struct drm_device *dev = priv->minor->dev; |
@@ -451,7 +443,6 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
451 | vma->vm_start, vma->vm_end - vma->vm_start); | 443 | vma->vm_start, vma->vm_end - vma->vm_start); |
452 | atomic_dec(&dev->vma_count); | 444 | atomic_dec(&dev->vma_count); |
453 | 445 | ||
454 | mutex_lock(&dev->struct_mutex); | ||
455 | list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { | 446 | list_for_each_entry_safe(pt, temp, &dev->vmalist, head) { |
456 | if (pt->vma == vma) { | 447 | if (pt->vma == vma) { |
457 | list_del(&pt->head); | 448 | list_del(&pt->head); |
@@ -459,6 +450,23 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
459 | break; | 450 | break; |
460 | } | 451 | } |
461 | } | 452 | } |
453 | } | ||
454 | |||
455 | /** | ||
456 | * \c close method for all virtual memory types. | ||
457 | * | ||
458 | * \param vma virtual memory area. | ||
459 | * | ||
460 | * Search the \p vma private data entry in drm_device::vmalist, unlink it, and | ||
461 | * free it. | ||
462 | */ | ||
463 | static void drm_vm_close(struct vm_area_struct *vma) | ||
464 | { | ||
465 | struct drm_file *priv = vma->vm_file->private_data; | ||
466 | struct drm_device *dev = priv->minor->dev; | ||
467 | |||
468 | mutex_lock(&dev->struct_mutex); | ||
469 | drm_vm_close_locked(vma); | ||
462 | mutex_unlock(&dev->struct_mutex); | 470 | mutex_unlock(&dev->struct_mutex); |
463 | } | 471 | } |
464 | 472 | ||
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 61b4caf220f..fb07e73581e 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -116,7 +116,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
116 | static const struct file_operations i810_buffer_fops = { | 116 | static const struct file_operations i810_buffer_fops = { |
117 | .open = drm_open, | 117 | .open = drm_open, |
118 | .release = drm_release, | 118 | .release = drm_release, |
119 | .unlocked_ioctl = drm_ioctl, | 119 | .unlocked_ioctl = i810_ioctl, |
120 | .mmap = i810_mmap_buffers, | 120 | .mmap = i810_mmap_buffers, |
121 | .fasync = drm_fasync, | 121 | .fasync = drm_fasync, |
122 | }; | 122 | }; |
diff --git a/drivers/gpu/drm/i830/i830_dma.c b/drivers/gpu/drm/i830/i830_dma.c index 671aa18415a..cc92c7e6236 100644 --- a/drivers/gpu/drm/i830/i830_dma.c +++ b/drivers/gpu/drm/i830/i830_dma.c | |||
@@ -118,7 +118,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
118 | static const struct file_operations i830_buffer_fops = { | 118 | static const struct file_operations i830_buffer_fops = { |
119 | .open = drm_open, | 119 | .open = drm_open, |
120 | .release = drm_release, | 120 | .release = drm_release, |
121 | .unlocked_ioctl = drm_ioctl, | 121 | .unlocked_ioctl = i830_ioctl, |
122 | .mmap = i830_mmap_buffers, | 122 | .mmap = i830_mmap_buffers, |
123 | .fasync = drm_fasync, | 123 | .fasync = drm_fasync, |
124 | }; | 124 | }; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 9d67b485303..2dd2c93ebfa 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1787,9 +1787,9 @@ unsigned long i915_chipset_val(struct drm_i915_private *dev_priv) | |||
1787 | } | 1787 | } |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | div_u64(diff, diff1); | 1790 | diff = div_u64(diff, diff1); |
1791 | ret = ((m * diff) + c); | 1791 | ret = ((m * diff) + c); |
1792 | div_u64(ret, 10); | 1792 | ret = div_u64(ret, 10); |
1793 | 1793 | ||
1794 | dev_priv->last_count1 = total_count; | 1794 | dev_priv->last_count1 = total_count; |
1795 | dev_priv->last_time1 = now; | 1795 | dev_priv->last_time1 = now; |
@@ -1858,7 +1858,7 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
1858 | 1858 | ||
1859 | /* More magic constants... */ | 1859 | /* More magic constants... */ |
1860 | diff = diff * 1181; | 1860 | diff = diff * 1181; |
1861 | div_u64(diff, diffms * 10); | 1861 | diff = div_u64(diff, diffms * 10); |
1862 | dev_priv->gfx_power = diff; | 1862 | dev_priv->gfx_power = diff; |
1863 | } | 1863 | } |
1864 | 1864 | ||
@@ -2231,6 +2231,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2231 | dev_priv->mchdev_lock = &mchdev_lock; | 2231 | dev_priv->mchdev_lock = &mchdev_lock; |
2232 | spin_unlock(&mchdev_lock); | 2232 | spin_unlock(&mchdev_lock); |
2233 | 2233 | ||
2234 | /* XXX Prevent module unload due to memory corruption bugs. */ | ||
2235 | __module_get(THIS_MODULE); | ||
2236 | |||
2234 | return 0; | 2237 | return 0; |
2235 | 2238 | ||
2236 | out_workqueue_free: | 2239 | out_workqueue_free: |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index bced9b25c71..90b1d6753b9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -136,14 +136,12 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, | |||
136 | return -ENOMEM; | 136 | return -ENOMEM; |
137 | 137 | ||
138 | ret = drm_gem_handle_create(file_priv, obj, &handle); | 138 | ret = drm_gem_handle_create(file_priv, obj, &handle); |
139 | /* drop reference from allocate - handle holds it now */ | ||
140 | drm_gem_object_unreference_unlocked(obj); | ||
139 | if (ret) { | 141 | if (ret) { |
140 | drm_gem_object_unreference_unlocked(obj); | ||
141 | return ret; | 142 | return ret; |
142 | } | 143 | } |
143 | 144 | ||
144 | /* Sink the floating reference from kref_init(handlecount) */ | ||
145 | drm_gem_object_handle_unreference_unlocked(obj); | ||
146 | |||
147 | args->handle = handle; | 145 | args->handle = handle; |
148 | return 0; | 146 | return 0; |
149 | } | 147 | } |
@@ -471,14 +469,17 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
471 | return -ENOENT; | 469 | return -ENOENT; |
472 | obj_priv = to_intel_bo(obj); | 470 | obj_priv = to_intel_bo(obj); |
473 | 471 | ||
474 | /* Bounds check source. | 472 | /* Bounds check source. */ |
475 | * | 473 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
476 | * XXX: This could use review for overflow issues... | 474 | ret = -EINVAL; |
477 | */ | 475 | goto err; |
478 | if (args->offset > obj->size || args->size > obj->size || | 476 | } |
479 | args->offset + args->size > obj->size) { | 477 | |
480 | drm_gem_object_unreference_unlocked(obj); | 478 | if (!access_ok(VERIFY_WRITE, |
481 | return -EINVAL; | 479 | (char __user *)(uintptr_t)args->data_ptr, |
480 | args->size)) { | ||
481 | ret = -EFAULT; | ||
482 | goto err; | ||
482 | } | 483 | } |
483 | 484 | ||
484 | if (i915_gem_object_needs_bit17_swizzle(obj)) { | 485 | if (i915_gem_object_needs_bit17_swizzle(obj)) { |
@@ -490,8 +491,8 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
490 | file_priv); | 491 | file_priv); |
491 | } | 492 | } |
492 | 493 | ||
494 | err: | ||
493 | drm_gem_object_unreference_unlocked(obj); | 495 | drm_gem_object_unreference_unlocked(obj); |
494 | |||
495 | return ret; | 496 | return ret; |
496 | } | 497 | } |
497 | 498 | ||
@@ -580,8 +581,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj, | |||
580 | 581 | ||
581 | user_data = (char __user *) (uintptr_t) args->data_ptr; | 582 | user_data = (char __user *) (uintptr_t) args->data_ptr; |
582 | remain = args->size; | 583 | remain = args->size; |
583 | if (!access_ok(VERIFY_READ, user_data, remain)) | ||
584 | return -EFAULT; | ||
585 | 584 | ||
586 | 585 | ||
587 | mutex_lock(&dev->struct_mutex); | 586 | mutex_lock(&dev->struct_mutex); |
@@ -934,14 +933,17 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
934 | return -ENOENT; | 933 | return -ENOENT; |
935 | obj_priv = to_intel_bo(obj); | 934 | obj_priv = to_intel_bo(obj); |
936 | 935 | ||
937 | /* Bounds check destination. | 936 | /* Bounds check destination. */ |
938 | * | 937 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
939 | * XXX: This could use review for overflow issues... | 938 | ret = -EINVAL; |
940 | */ | 939 | goto err; |
941 | if (args->offset > obj->size || args->size > obj->size || | 940 | } |
942 | args->offset + args->size > obj->size) { | 941 | |
943 | drm_gem_object_unreference_unlocked(obj); | 942 | if (!access_ok(VERIFY_READ, |
944 | return -EINVAL; | 943 | (char __user *)(uintptr_t)args->data_ptr, |
944 | args->size)) { | ||
945 | ret = -EFAULT; | ||
946 | goto err; | ||
945 | } | 947 | } |
946 | 948 | ||
947 | /* We can only do the GTT pwrite on untiled buffers, as otherwise | 949 | /* We can only do the GTT pwrite on untiled buffers, as otherwise |
@@ -975,8 +977,8 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
975 | DRM_INFO("pwrite failed %d\n", ret); | 977 | DRM_INFO("pwrite failed %d\n", ret); |
976 | #endif | 978 | #endif |
977 | 979 | ||
980 | err: | ||
978 | drm_gem_object_unreference_unlocked(obj); | 981 | drm_gem_object_unreference_unlocked(obj); |
979 | |||
980 | return ret; | 982 | return ret; |
981 | } | 983 | } |
982 | 984 | ||
@@ -3258,6 +3260,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3258 | (int) reloc->offset, | 3260 | (int) reloc->offset, |
3259 | reloc->read_domains, | 3261 | reloc->read_domains, |
3260 | reloc->write_domain); | 3262 | reloc->write_domain); |
3263 | drm_gem_object_unreference(target_obj); | ||
3264 | i915_gem_object_unpin(obj); | ||
3261 | return -EINVAL; | 3265 | return -EINVAL; |
3262 | } | 3266 | } |
3263 | if (reloc->write_domain & I915_GEM_DOMAIN_CPU || | 3267 | if (reloc->write_domain & I915_GEM_DOMAIN_CPU || |
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index e85246ef691..5c428fa3e0b 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -93,7 +93,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen | |||
93 | { | 93 | { |
94 | drm_i915_private_t *dev_priv = dev->dev_private; | 94 | drm_i915_private_t *dev_priv = dev->dev_private; |
95 | struct list_head eviction_list, unwind_list; | 95 | struct list_head eviction_list, unwind_list; |
96 | struct drm_i915_gem_object *obj_priv, *tmp_obj_priv; | 96 | struct drm_i915_gem_object *obj_priv; |
97 | struct list_head *render_iter, *bsd_iter; | 97 | struct list_head *render_iter, *bsd_iter; |
98 | int ret = 0; | 98 | int ret = 0; |
99 | 99 | ||
@@ -175,39 +175,34 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen | |||
175 | return -ENOSPC; | 175 | return -ENOSPC; |
176 | 176 | ||
177 | found: | 177 | found: |
178 | /* drm_mm doesn't allow any other other operations while | ||
179 | * scanning, therefore store to be evicted objects on a | ||
180 | * temporary list. */ | ||
178 | INIT_LIST_HEAD(&eviction_list); | 181 | INIT_LIST_HEAD(&eviction_list); |
179 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, | 182 | while (!list_empty(&unwind_list)) { |
180 | &unwind_list, evict_list) { | 183 | obj_priv = list_first_entry(&unwind_list, |
184 | struct drm_i915_gem_object, | ||
185 | evict_list); | ||
181 | if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { | 186 | if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { |
182 | /* drm_mm doesn't allow any other other operations while | ||
183 | * scanning, therefore store to be evicted objects on a | ||
184 | * temporary list. */ | ||
185 | list_move(&obj_priv->evict_list, &eviction_list); | 187 | list_move(&obj_priv->evict_list, &eviction_list); |
186 | } else | 188 | continue; |
187 | drm_gem_object_unreference(&obj_priv->base); | 189 | } |
190 | list_del(&obj_priv->evict_list); | ||
191 | drm_gem_object_unreference(&obj_priv->base); | ||
188 | } | 192 | } |
189 | 193 | ||
190 | /* Unbinding will emit any required flushes */ | 194 | /* Unbinding will emit any required flushes */ |
191 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, | 195 | while (!list_empty(&eviction_list)) { |
192 | &eviction_list, evict_list) { | 196 | obj_priv = list_first_entry(&eviction_list, |
193 | #if WATCH_LRU | 197 | struct drm_i915_gem_object, |
194 | DRM_INFO("%s: evicting %p\n", __func__, &obj_priv->base); | 198 | evict_list); |
195 | #endif | 199 | if (ret == 0) |
196 | ret = i915_gem_object_unbind(&obj_priv->base); | 200 | ret = i915_gem_object_unbind(&obj_priv->base); |
197 | if (ret) | 201 | list_del(&obj_priv->evict_list); |
198 | return ret; | ||
199 | |||
200 | drm_gem_object_unreference(&obj_priv->base); | 202 | drm_gem_object_unreference(&obj_priv->base); |
201 | } | 203 | } |
202 | 204 | ||
203 | /* The just created free hole should be on the top of the free stack | 205 | return ret; |
204 | * maintained by drm_mm, so this BUG_ON actually executes in O(1). | ||
205 | * Furthermore all accessed data has just recently been used, so it | ||
206 | * should be really fast, too. */ | ||
207 | BUG_ON(!drm_mm_search_free(&dev_priv->mm.gtt_space, min_size, | ||
208 | alignment, 0)); | ||
209 | |||
210 | return 0; | ||
211 | } | 206 | } |
212 | 207 | ||
213 | int | 208 | int |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index b5bf51a4502..97922859459 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1013,8 +1013,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) | |||
1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); | 1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /** | 1016 | /* |
1017 | * intel_wait_for_vblank_off - wait for vblank after disabling a pipe | 1017 | * intel_wait_for_pipe_off - wait for pipe to turn off |
1018 | * @dev: drm device | 1018 | * @dev: drm device |
1019 | * @pipe: pipe to wait for | 1019 | * @pipe: pipe to wait for |
1020 | * | 1020 | * |
@@ -1022,25 +1022,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) | |||
1022 | * spinning on the vblank interrupt status bit, since we won't actually | 1022 | * spinning on the vblank interrupt status bit, since we won't actually |
1023 | * see an interrupt when the pipe is disabled. | 1023 | * see an interrupt when the pipe is disabled. |
1024 | * | 1024 | * |
1025 | * So this function waits for the display line value to settle (it | 1025 | * On Gen4 and above: |
1026 | * usually ends up stopping at the start of the next frame). | 1026 | * wait for the pipe register state bit to turn off |
1027 | * | ||
1028 | * Otherwise: | ||
1029 | * wait for the display line value to settle (it usually | ||
1030 | * ends up stopping at the start of the next frame). | ||
1031 | * | ||
1027 | */ | 1032 | */ |
1028 | void intel_wait_for_vblank_off(struct drm_device *dev, int pipe) | 1033 | static void intel_wait_for_pipe_off(struct drm_device *dev, int pipe) |
1029 | { | 1034 | { |
1030 | struct drm_i915_private *dev_priv = dev->dev_private; | 1035 | struct drm_i915_private *dev_priv = dev->dev_private; |
1031 | int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); | 1036 | |
1032 | unsigned long timeout = jiffies + msecs_to_jiffies(100); | 1037 | if (INTEL_INFO(dev)->gen >= 4) { |
1033 | u32 last_line; | 1038 | int pipeconf_reg = (pipe == 0 ? PIPEACONF : PIPEBCONF); |
1034 | 1039 | ||
1035 | /* Wait for the display line to settle */ | 1040 | /* Wait for the Pipe State to go off */ |
1036 | do { | 1041 | if (wait_for((I915_READ(pipeconf_reg) & I965_PIPECONF_ACTIVE) == 0, |
1037 | last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; | 1042 | 100, 0)) |
1038 | mdelay(5); | 1043 | DRM_DEBUG_KMS("pipe_off wait timed out\n"); |
1039 | } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && | 1044 | } else { |
1040 | time_after(timeout, jiffies)); | 1045 | u32 last_line; |
1041 | 1046 | int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL); | |
1042 | if (time_after(jiffies, timeout)) | 1047 | unsigned long timeout = jiffies + msecs_to_jiffies(100); |
1043 | DRM_DEBUG_KMS("vblank wait timed out\n"); | 1048 | |
1049 | /* Wait for the display line to settle */ | ||
1050 | do { | ||
1051 | last_line = I915_READ(pipedsl_reg) & DSL_LINEMASK; | ||
1052 | mdelay(5); | ||
1053 | } while (((I915_READ(pipedsl_reg) & DSL_LINEMASK) != last_line) && | ||
1054 | time_after(timeout, jiffies)); | ||
1055 | if (time_after(jiffies, timeout)) | ||
1056 | DRM_DEBUG_KMS("pipe_off wait timed out\n"); | ||
1057 | } | ||
1044 | } | 1058 | } |
1045 | 1059 | ||
1046 | /* Parameters have changed, update FBC info */ | 1060 | /* Parameters have changed, update FBC info */ |
@@ -2328,13 +2342,13 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2328 | I915_READ(dspbase_reg); | 2342 | I915_READ(dspbase_reg); |
2329 | } | 2343 | } |
2330 | 2344 | ||
2331 | /* Wait for vblank for the disable to take effect */ | ||
2332 | intel_wait_for_vblank_off(dev, pipe); | ||
2333 | |||
2334 | /* Don't disable pipe A or pipe A PLLs if needed */ | 2345 | /* Don't disable pipe A or pipe A PLLs if needed */ |
2335 | if (pipeconf_reg == PIPEACONF && | 2346 | if (pipeconf_reg == PIPEACONF && |
2336 | (dev_priv->quirks & QUIRK_PIPEA_FORCE)) | 2347 | (dev_priv->quirks & QUIRK_PIPEA_FORCE)) { |
2348 | /* Wait for vblank for the disable to take effect */ | ||
2349 | intel_wait_for_vblank(dev, pipe); | ||
2337 | goto skip_pipe_off; | 2350 | goto skip_pipe_off; |
2351 | } | ||
2338 | 2352 | ||
2339 | /* Next, disable display pipes */ | 2353 | /* Next, disable display pipes */ |
2340 | temp = I915_READ(pipeconf_reg); | 2354 | temp = I915_READ(pipeconf_reg); |
@@ -2343,8 +2357,8 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2343 | I915_READ(pipeconf_reg); | 2357 | I915_READ(pipeconf_reg); |
2344 | } | 2358 | } |
2345 | 2359 | ||
2346 | /* Wait for vblank for the disable to take effect. */ | 2360 | /* Wait for the pipe to turn off */ |
2347 | intel_wait_for_vblank_off(dev, pipe); | 2361 | intel_wait_for_pipe_off(dev, pipe); |
2348 | 2362 | ||
2349 | temp = I915_READ(dpll_reg); | 2363 | temp = I915_READ(dpll_reg); |
2350 | if ((temp & DPLL_VCO_ENABLE) != 0) { | 2364 | if ((temp & DPLL_VCO_ENABLE) != 0) { |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 1a51ee07de3..9ab8708ac6b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1138,18 +1138,14 @@ static bool | |||
1138 | intel_dp_set_link_train(struct intel_dp *intel_dp, | 1138 | intel_dp_set_link_train(struct intel_dp *intel_dp, |
1139 | uint32_t dp_reg_value, | 1139 | uint32_t dp_reg_value, |
1140 | uint8_t dp_train_pat, | 1140 | uint8_t dp_train_pat, |
1141 | uint8_t train_set[4], | 1141 | uint8_t train_set[4]) |
1142 | bool first) | ||
1143 | { | 1142 | { |
1144 | struct drm_device *dev = intel_dp->base.enc.dev; | 1143 | struct drm_device *dev = intel_dp->base.enc.dev; |
1145 | struct drm_i915_private *dev_priv = dev->dev_private; | 1144 | struct drm_i915_private *dev_priv = dev->dev_private; |
1146 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc); | ||
1147 | int ret; | 1145 | int ret; |
1148 | 1146 | ||
1149 | I915_WRITE(intel_dp->output_reg, dp_reg_value); | 1147 | I915_WRITE(intel_dp->output_reg, dp_reg_value); |
1150 | POSTING_READ(intel_dp->output_reg); | 1148 | POSTING_READ(intel_dp->output_reg); |
1151 | if (first) | ||
1152 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
1153 | 1149 | ||
1154 | intel_dp_aux_native_write_1(intel_dp, | 1150 | intel_dp_aux_native_write_1(intel_dp, |
1155 | DP_TRAINING_PATTERN_SET, | 1151 | DP_TRAINING_PATTERN_SET, |
@@ -1174,10 +1170,15 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1174 | uint8_t voltage; | 1170 | uint8_t voltage; |
1175 | bool clock_recovery = false; | 1171 | bool clock_recovery = false; |
1176 | bool channel_eq = false; | 1172 | bool channel_eq = false; |
1177 | bool first = true; | ||
1178 | int tries; | 1173 | int tries; |
1179 | u32 reg; | 1174 | u32 reg; |
1180 | uint32_t DP = intel_dp->DP; | 1175 | uint32_t DP = intel_dp->DP; |
1176 | struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.enc.crtc); | ||
1177 | |||
1178 | /* Enable output, wait for it to become active */ | ||
1179 | I915_WRITE(intel_dp->output_reg, intel_dp->DP); | ||
1180 | POSTING_READ(intel_dp->output_reg); | ||
1181 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
1181 | 1182 | ||
1182 | /* Write the link configuration data */ | 1183 | /* Write the link configuration data */ |
1183 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, | 1184 | intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, |
@@ -1210,9 +1211,8 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1210 | reg = DP | DP_LINK_TRAIN_PAT_1; | 1211 | reg = DP | DP_LINK_TRAIN_PAT_1; |
1211 | 1212 | ||
1212 | if (!intel_dp_set_link_train(intel_dp, reg, | 1213 | if (!intel_dp_set_link_train(intel_dp, reg, |
1213 | DP_TRAINING_PATTERN_1, train_set, first)) | 1214 | DP_TRAINING_PATTERN_1, train_set)) |
1214 | break; | 1215 | break; |
1215 | first = false; | ||
1216 | /* Set training pattern 1 */ | 1216 | /* Set training pattern 1 */ |
1217 | 1217 | ||
1218 | udelay(100); | 1218 | udelay(100); |
@@ -1266,8 +1266,7 @@ intel_dp_link_train(struct intel_dp *intel_dp) | |||
1266 | 1266 | ||
1267 | /* channel eq pattern */ | 1267 | /* channel eq pattern */ |
1268 | if (!intel_dp_set_link_train(intel_dp, reg, | 1268 | if (!intel_dp_set_link_train(intel_dp, reg, |
1269 | DP_TRAINING_PATTERN_2, train_set, | 1269 | DP_TRAINING_PATTERN_2, train_set)) |
1270 | false)) | ||
1271 | break; | 1270 | break; |
1272 | 1271 | ||
1273 | udelay(400); | 1272 | udelay(400); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index ad312ca6b3e..8828b3ac641 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -229,7 +229,6 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, | |||
229 | struct drm_crtc *crtc); | 229 | struct drm_crtc *crtc); |
230 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 230 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
231 | struct drm_file *file_priv); | 231 | struct drm_file *file_priv); |
232 | extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe); | ||
233 | extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); | 232 | extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); |
234 | extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); | 233 | extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); |
235 | extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, | 234 | extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 7bdc96256bf..b61966c126d 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -237,8 +237,10 @@ int intel_fbdev_destroy(struct drm_device *dev, | |||
237 | drm_fb_helper_fini(&ifbdev->helper); | 237 | drm_fb_helper_fini(&ifbdev->helper); |
238 | 238 | ||
239 | drm_framebuffer_cleanup(&ifb->base); | 239 | drm_framebuffer_cleanup(&ifb->base); |
240 | if (ifb->obj) | 240 | if (ifb->obj) { |
241 | drm_gem_object_unreference(ifb->obj); | 241 | drm_gem_object_unreference(ifb->obj); |
242 | ifb->obj = NULL; | ||
243 | } | ||
242 | 244 | ||
243 | return 0; | 245 | return 0; |
244 | } | 246 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index ead7b8fc53f..19620a6709f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -167,11 +167,9 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
167 | goto out; | 167 | goto out; |
168 | 168 | ||
169 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); | 169 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); |
170 | /* drop reference from allocate - handle holds it now */ | ||
171 | drm_gem_object_unreference_unlocked(nvbo->gem); | ||
170 | out: | 172 | out: |
171 | drm_gem_object_handle_unreference_unlocked(nvbo->gem); | ||
172 | |||
173 | if (ret) | ||
174 | drm_gem_object_unreference_unlocked(nvbo->gem); | ||
175 | return ret; | 173 | return ret; |
176 | } | 174 | } |
177 | 175 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 79082d4398a..2f93d46ae69 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1137,7 +1137,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1137 | 1137 | ||
1138 | WREG32(RCU_IND_INDEX, 0x203); | 1138 | WREG32(RCU_IND_INDEX, 0x203); |
1139 | efuse_straps_3 = RREG32(RCU_IND_DATA); | 1139 | efuse_straps_3 = RREG32(RCU_IND_DATA); |
1140 | efuse_box_bit_127_124 = (u8)(efuse_straps_3 & 0xF0000000) >> 28; | 1140 | efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28); |
1141 | 1141 | ||
1142 | switch(efuse_box_bit_127_124) { | 1142 | switch(efuse_box_bit_127_124) { |
1143 | case 0x0: | 1143 | case 0x0: |
@@ -1407,6 +1407,7 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
1407 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 1407 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
1408 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 1408 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
1409 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1409 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1410 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1410 | r600_vram_gtt_location(rdev, &rdev->mc); | 1411 | r600_vram_gtt_location(rdev, &rdev->mc); |
1411 | radeon_update_bandwidth_info(rdev); | 1412 | radeon_update_bandwidth_info(rdev); |
1412 | 1413 | ||
@@ -1520,7 +1521,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev) | |||
1520 | { | 1521 | { |
1521 | u32 tmp; | 1522 | u32 tmp; |
1522 | 1523 | ||
1523 | WREG32(CP_INT_CNTL, 0); | 1524 | WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); |
1524 | WREG32(GRBM_INT_CNTL, 0); | 1525 | WREG32(GRBM_INT_CNTL, 0); |
1525 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); | 1526 | WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); |
1526 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); | 1527 | WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index e151f16a8f8..e59422320bb 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1030,6 +1030,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
1030 | return r; | 1030 | return r; |
1031 | } | 1031 | } |
1032 | rdev->cp.ready = true; | 1032 | rdev->cp.ready = true; |
1033 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | ||
1033 | return 0; | 1034 | return 0; |
1034 | } | 1035 | } |
1035 | 1036 | ||
@@ -1047,6 +1048,7 @@ void r100_cp_fini(struct radeon_device *rdev) | |||
1047 | void r100_cp_disable(struct radeon_device *rdev) | 1048 | void r100_cp_disable(struct radeon_device *rdev) |
1048 | { | 1049 | { |
1049 | /* Disable ring */ | 1050 | /* Disable ring */ |
1051 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1050 | rdev->cp.ready = false; | 1052 | rdev->cp.ready = false; |
1051 | WREG32(RADEON_CP_CSQ_MODE, 0); | 1053 | WREG32(RADEON_CP_CSQ_MODE, 0); |
1052 | WREG32(RADEON_CP_CSQ_CNTL, 0); | 1054 | WREG32(RADEON_CP_CSQ_CNTL, 0); |
@@ -2295,6 +2297,7 @@ void r100_vram_init_sizes(struct radeon_device *rdev) | |||
2295 | /* FIXME we don't use the second aperture yet when we could use it */ | 2297 | /* FIXME we don't use the second aperture yet when we could use it */ |
2296 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) | 2298 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) |
2297 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 2299 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
2300 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
2298 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); | 2301 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); |
2299 | if (rdev->flags & RADEON_IS_IGP) { | 2302 | if (rdev->flags & RADEON_IS_IGP) { |
2300 | uint32_t tom; | 2303 | uint32_t tom; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index ddc3adea1dd..7b65e4efe8a 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1248,6 +1248,7 @@ int r600_mc_init(struct radeon_device *rdev) | |||
1248 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 1248 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
1249 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 1249 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
1250 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1250 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1251 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1251 | r600_vram_gtt_location(rdev, &rdev->mc); | 1252 | r600_vram_gtt_location(rdev, &rdev->mc); |
1252 | 1253 | ||
1253 | if (rdev->flags & RADEON_IS_IGP) { | 1254 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -1917,6 +1918,7 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | |||
1917 | */ | 1918 | */ |
1918 | void r600_cp_stop(struct radeon_device *rdev) | 1919 | void r600_cp_stop(struct radeon_device *rdev) |
1919 | { | 1920 | { |
1921 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1920 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); | 1922 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); |
1921 | } | 1923 | } |
1922 | 1924 | ||
@@ -2910,7 +2912,7 @@ static void r600_disable_interrupt_state(struct radeon_device *rdev) | |||
2910 | { | 2912 | { |
2911 | u32 tmp; | 2913 | u32 tmp; |
2912 | 2914 | ||
2913 | WREG32(CP_INT_CNTL, 0); | 2915 | WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE); |
2914 | WREG32(GRBM_INT_CNTL, 0); | 2916 | WREG32(GRBM_INT_CNTL, 0); |
2915 | WREG32(DxMODE_INT_MASK, 0); | 2917 | WREG32(DxMODE_INT_MASK, 0); |
2916 | if (ASIC_IS_DCE3(rdev)) { | 2918 | if (ASIC_IS_DCE3(rdev)) { |
@@ -3528,7 +3530,8 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) | |||
3528 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read | 3530 | /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read |
3529 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL | 3531 | * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL |
3530 | */ | 3532 | */ |
3531 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { | 3533 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && |
3534 | rdev->vram_scratch.ptr) { | ||
3532 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | 3535 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; |
3533 | u32 tmp; | 3536 | u32 tmp; |
3534 | 3537 | ||
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 9ceb2a1ce79..3473c00781f 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -532,6 +532,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
532 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); | 532 | memcpy(ptr + rdev->r600_blit.ps_offset, r6xx_ps, r6xx_ps_size * 4); |
533 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 533 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
534 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 534 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
535 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | ||
535 | return 0; | 536 | return 0; |
536 | } | 537 | } |
537 | 538 | ||
@@ -539,6 +540,7 @@ void r600_blit_fini(struct radeon_device *rdev) | |||
539 | { | 540 | { |
540 | int r; | 541 | int r; |
541 | 542 | ||
543 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
542 | if (rdev->r600_blit.shader_obj == NULL) | 544 | if (rdev->r600_blit.shader_obj == NULL) |
543 | return; | 545 | return; |
544 | /* If we can't reserve the bo, unref should be enough to destroy | 546 | /* If we can't reserve the bo, unref should be enough to destroy |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a168d644bf9..9ff38c99a6e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -344,6 +344,7 @@ struct radeon_mc { | |||
344 | * about vram size near mc fb location */ | 344 | * about vram size near mc fb location */ |
345 | u64 mc_vram_size; | 345 | u64 mc_vram_size; |
346 | u64 visible_vram_size; | 346 | u64 visible_vram_size; |
347 | u64 active_vram_size; | ||
347 | u64 gtt_size; | 348 | u64 gtt_size; |
348 | u64 gtt_start; | 349 | u64 gtt_start; |
349 | u64 gtt_end; | 350 | u64 gtt_end; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index ebae14c4b76..8e43ddae70c 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -317,6 +317,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
317 | *connector_type = DRM_MODE_CONNECTOR_DVID; | 317 | *connector_type = DRM_MODE_CONNECTOR_DVID; |
318 | } | 318 | } |
319 | 319 | ||
320 | /* MSI K9A2GM V2/V3 board has no HDMI or DVI */ | ||
321 | if ((dev->pdev->device == 0x796e) && | ||
322 | (dev->pdev->subsystem_vendor == 0x1462) && | ||
323 | (dev->pdev->subsystem_device == 0x7302)) { | ||
324 | if ((supported_device == ATOM_DEVICE_DFP2_SUPPORT) || | ||
325 | (supported_device == ATOM_DEVICE_DFP3_SUPPORT)) | ||
326 | return false; | ||
327 | } | ||
328 | |||
320 | /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ | 329 | /* a-bit f-i90hd - ciaranm on #radeonhd - this board has no DVI */ |
321 | if ((dev->pdev->device == 0x7941) && | 330 | if ((dev->pdev->device == 0x7941) && |
322 | (dev->pdev->subsystem_vendor == 0x147b) && | 331 | (dev->pdev->subsystem_vendor == 0x147b) && |
@@ -1549,39 +1558,39 @@ radeon_atombios_get_tv_info(struct radeon_device *rdev) | |||
1549 | switch (tv_info->ucTV_BootUpDefaultStandard) { | 1558 | switch (tv_info->ucTV_BootUpDefaultStandard) { |
1550 | case ATOM_TV_NTSC: | 1559 | case ATOM_TV_NTSC: |
1551 | tv_std = TV_STD_NTSC; | 1560 | tv_std = TV_STD_NTSC; |
1552 | DRM_INFO("Default TV standard: NTSC\n"); | 1561 | DRM_DEBUG_KMS("Default TV standard: NTSC\n"); |
1553 | break; | 1562 | break; |
1554 | case ATOM_TV_NTSCJ: | 1563 | case ATOM_TV_NTSCJ: |
1555 | tv_std = TV_STD_NTSC_J; | 1564 | tv_std = TV_STD_NTSC_J; |
1556 | DRM_INFO("Default TV standard: NTSC-J\n"); | 1565 | DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); |
1557 | break; | 1566 | break; |
1558 | case ATOM_TV_PAL: | 1567 | case ATOM_TV_PAL: |
1559 | tv_std = TV_STD_PAL; | 1568 | tv_std = TV_STD_PAL; |
1560 | DRM_INFO("Default TV standard: PAL\n"); | 1569 | DRM_DEBUG_KMS("Default TV standard: PAL\n"); |
1561 | break; | 1570 | break; |
1562 | case ATOM_TV_PALM: | 1571 | case ATOM_TV_PALM: |
1563 | tv_std = TV_STD_PAL_M; | 1572 | tv_std = TV_STD_PAL_M; |
1564 | DRM_INFO("Default TV standard: PAL-M\n"); | 1573 | DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); |
1565 | break; | 1574 | break; |
1566 | case ATOM_TV_PALN: | 1575 | case ATOM_TV_PALN: |
1567 | tv_std = TV_STD_PAL_N; | 1576 | tv_std = TV_STD_PAL_N; |
1568 | DRM_INFO("Default TV standard: PAL-N\n"); | 1577 | DRM_DEBUG_KMS("Default TV standard: PAL-N\n"); |
1569 | break; | 1578 | break; |
1570 | case ATOM_TV_PALCN: | 1579 | case ATOM_TV_PALCN: |
1571 | tv_std = TV_STD_PAL_CN; | 1580 | tv_std = TV_STD_PAL_CN; |
1572 | DRM_INFO("Default TV standard: PAL-CN\n"); | 1581 | DRM_DEBUG_KMS("Default TV standard: PAL-CN\n"); |
1573 | break; | 1582 | break; |
1574 | case ATOM_TV_PAL60: | 1583 | case ATOM_TV_PAL60: |
1575 | tv_std = TV_STD_PAL_60; | 1584 | tv_std = TV_STD_PAL_60; |
1576 | DRM_INFO("Default TV standard: PAL-60\n"); | 1585 | DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); |
1577 | break; | 1586 | break; |
1578 | case ATOM_TV_SECAM: | 1587 | case ATOM_TV_SECAM: |
1579 | tv_std = TV_STD_SECAM; | 1588 | tv_std = TV_STD_SECAM; |
1580 | DRM_INFO("Default TV standard: SECAM\n"); | 1589 | DRM_DEBUG_KMS("Default TV standard: SECAM\n"); |
1581 | break; | 1590 | break; |
1582 | default: | 1591 | default: |
1583 | tv_std = TV_STD_NTSC; | 1592 | tv_std = TV_STD_NTSC; |
1584 | DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); | 1593 | DRM_DEBUG_KMS("Unknown TV standard; defaulting to NTSC\n"); |
1585 | break; | 1594 | break; |
1586 | } | 1595 | } |
1587 | } | 1596 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index a04b7a6ad95..7b7ea269549 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -913,47 +913,47 @@ radeon_combios_get_tv_info(struct radeon_device *rdev) | |||
913 | switch (RBIOS8(tv_info + 7) & 0xf) { | 913 | switch (RBIOS8(tv_info + 7) & 0xf) { |
914 | case 1: | 914 | case 1: |
915 | tv_std = TV_STD_NTSC; | 915 | tv_std = TV_STD_NTSC; |
916 | DRM_INFO("Default TV standard: NTSC\n"); | 916 | DRM_DEBUG_KMS("Default TV standard: NTSC\n"); |
917 | break; | 917 | break; |
918 | case 2: | 918 | case 2: |
919 | tv_std = TV_STD_PAL; | 919 | tv_std = TV_STD_PAL; |
920 | DRM_INFO("Default TV standard: PAL\n"); | 920 | DRM_DEBUG_KMS("Default TV standard: PAL\n"); |
921 | break; | 921 | break; |
922 | case 3: | 922 | case 3: |
923 | tv_std = TV_STD_PAL_M; | 923 | tv_std = TV_STD_PAL_M; |
924 | DRM_INFO("Default TV standard: PAL-M\n"); | 924 | DRM_DEBUG_KMS("Default TV standard: PAL-M\n"); |
925 | break; | 925 | break; |
926 | case 4: | 926 | case 4: |
927 | tv_std = TV_STD_PAL_60; | 927 | tv_std = TV_STD_PAL_60; |
928 | DRM_INFO("Default TV standard: PAL-60\n"); | 928 | DRM_DEBUG_KMS("Default TV standard: PAL-60\n"); |
929 | break; | 929 | break; |
930 | case 5: | 930 | case 5: |
931 | tv_std = TV_STD_NTSC_J; | 931 | tv_std = TV_STD_NTSC_J; |
932 | DRM_INFO("Default TV standard: NTSC-J\n"); | 932 | DRM_DEBUG_KMS("Default TV standard: NTSC-J\n"); |
933 | break; | 933 | break; |
934 | case 6: | 934 | case 6: |
935 | tv_std = TV_STD_SCART_PAL; | 935 | tv_std = TV_STD_SCART_PAL; |
936 | DRM_INFO("Default TV standard: SCART-PAL\n"); | 936 | DRM_DEBUG_KMS("Default TV standard: SCART-PAL\n"); |
937 | break; | 937 | break; |
938 | default: | 938 | default: |
939 | tv_std = TV_STD_NTSC; | 939 | tv_std = TV_STD_NTSC; |
940 | DRM_INFO | 940 | DRM_DEBUG_KMS |
941 | ("Unknown TV standard; defaulting to NTSC\n"); | 941 | ("Unknown TV standard; defaulting to NTSC\n"); |
942 | break; | 942 | break; |
943 | } | 943 | } |
944 | 944 | ||
945 | switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { | 945 | switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { |
946 | case 0: | 946 | case 0: |
947 | DRM_INFO("29.498928713 MHz TV ref clk\n"); | 947 | DRM_DEBUG_KMS("29.498928713 MHz TV ref clk\n"); |
948 | break; | 948 | break; |
949 | case 1: | 949 | case 1: |
950 | DRM_INFO("28.636360000 MHz TV ref clk\n"); | 950 | DRM_DEBUG_KMS("28.636360000 MHz TV ref clk\n"); |
951 | break; | 951 | break; |
952 | case 2: | 952 | case 2: |
953 | DRM_INFO("14.318180000 MHz TV ref clk\n"); | 953 | DRM_DEBUG_KMS("14.318180000 MHz TV ref clk\n"); |
954 | break; | 954 | break; |
955 | case 3: | 955 | case 3: |
956 | DRM_INFO("27.000000000 MHz TV ref clk\n"); | 956 | DRM_DEBUG_KMS("27.000000000 MHz TV ref clk\n"); |
957 | break; | 957 | break; |
958 | default: | 958 | default: |
959 | break; | 959 | break; |
@@ -1324,7 +1324,7 @@ bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, | |||
1324 | 1324 | ||
1325 | if (tmds_info) { | 1325 | if (tmds_info) { |
1326 | ver = RBIOS8(tmds_info); | 1326 | ver = RBIOS8(tmds_info); |
1327 | DRM_INFO("DFP table revision: %d\n", ver); | 1327 | DRM_DEBUG_KMS("DFP table revision: %d\n", ver); |
1328 | if (ver == 3) { | 1328 | if (ver == 3) { |
1329 | n = RBIOS8(tmds_info + 5) + 1; | 1329 | n = RBIOS8(tmds_info + 5) + 1; |
1330 | if (n > 4) | 1330 | if (n > 4) |
@@ -1408,7 +1408,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1408 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); | 1408 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); |
1409 | if (offset) { | 1409 | if (offset) { |
1410 | ver = RBIOS8(offset); | 1410 | ver = RBIOS8(offset); |
1411 | DRM_INFO("External TMDS Table revision: %d\n", ver); | 1411 | DRM_DEBUG_KMS("External TMDS Table revision: %d\n", ver); |
1412 | tmds->slave_addr = RBIOS8(offset + 4 + 2); | 1412 | tmds->slave_addr = RBIOS8(offset + 4 + 2); |
1413 | tmds->slave_addr >>= 1; /* 7 bit addressing */ | 1413 | tmds->slave_addr >>= 1; /* 7 bit addressing */ |
1414 | gpio = RBIOS8(offset + 4 + 3); | 1414 | gpio = RBIOS8(offset + 4 + 3); |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index 5731fc9b1ae..3eef567b042 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
@@ -203,6 +203,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
203 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 203 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
204 | struct radeon_device *rdev = crtc->dev->dev_private; | 204 | struct radeon_device *rdev = crtc->dev->dev_private; |
205 | int xorigin = 0, yorigin = 0; | 205 | int xorigin = 0, yorigin = 0; |
206 | int w = radeon_crtc->cursor_width; | ||
206 | 207 | ||
207 | if (x < 0) | 208 | if (x < 0) |
208 | xorigin = -x + 1; | 209 | xorigin = -x + 1; |
@@ -213,22 +214,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
213 | if (yorigin >= CURSOR_HEIGHT) | 214 | if (yorigin >= CURSOR_HEIGHT) |
214 | yorigin = CURSOR_HEIGHT - 1; | 215 | yorigin = CURSOR_HEIGHT - 1; |
215 | 216 | ||
216 | radeon_lock_cursor(crtc, true); | 217 | if (ASIC_IS_AVIVO(rdev)) { |
217 | if (ASIC_IS_DCE4(rdev)) { | ||
218 | /* cursors are offset into the total surface */ | ||
219 | x += crtc->x; | ||
220 | y += crtc->y; | ||
221 | DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y); | ||
222 | |||
223 | /* XXX: check if evergreen has the same issues as avivo chips */ | ||
224 | WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, | ||
225 | ((xorigin ? 0 : x) << 16) | | ||
226 | (yorigin ? 0 : y)); | ||
227 | WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); | ||
228 | WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, | ||
229 | ((radeon_crtc->cursor_width - 1) << 16) | (radeon_crtc->cursor_height - 1)); | ||
230 | } else if (ASIC_IS_AVIVO(rdev)) { | ||
231 | int w = radeon_crtc->cursor_width; | ||
232 | int i = 0; | 218 | int i = 0; |
233 | struct drm_crtc *crtc_p; | 219 | struct drm_crtc *crtc_p; |
234 | 220 | ||
@@ -260,7 +246,17 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc, | |||
260 | if (w <= 0) | 246 | if (w <= 0) |
261 | w = 1; | 247 | w = 1; |
262 | } | 248 | } |
249 | } | ||
263 | 250 | ||
251 | radeon_lock_cursor(crtc, true); | ||
252 | if (ASIC_IS_DCE4(rdev)) { | ||
253 | WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, | ||
254 | ((xorigin ? 0 : x) << 16) | | ||
255 | (yorigin ? 0 : y)); | ||
256 | WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); | ||
257 | WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, | ||
258 | ((w - 1) << 16) | (radeon_crtc->cursor_height - 1)); | ||
259 | } else if (ASIC_IS_AVIVO(rdev)) { | ||
264 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, | 260 | WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, |
265 | ((xorigin ? 0 : x) << 16) | | 261 | ((xorigin ? 0 : x) << 16) | |
266 | (yorigin ? 0 : y)); | 262 | (yorigin ? 0 : y)); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 127a395f70f..b92d2f2fcbe 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -349,6 +349,8 @@ static void radeon_print_display_setup(struct drm_device *dev) | |||
349 | DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]); | 349 | DRM_INFO(" DFP4: %s\n", encoder_names[radeon_encoder->encoder_id]); |
350 | if (devices & ATOM_DEVICE_DFP5_SUPPORT) | 350 | if (devices & ATOM_DEVICE_DFP5_SUPPORT) |
351 | DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]); | 351 | DRM_INFO(" DFP5: %s\n", encoder_names[radeon_encoder->encoder_id]); |
352 | if (devices & ATOM_DEVICE_DFP6_SUPPORT) | ||
353 | DRM_INFO(" DFP6: %s\n", encoder_names[radeon_encoder->encoder_id]); | ||
352 | if (devices & ATOM_DEVICE_TV1_SUPPORT) | 354 | if (devices & ATOM_DEVICE_TV1_SUPPORT) |
353 | DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]); | 355 | DRM_INFO(" TV1: %s\n", encoder_names[radeon_encoder->encoder_id]); |
354 | if (devices & ATOM_DEVICE_CV_SUPPORT) | 356 | if (devices & ATOM_DEVICE_CV_SUPPORT) |
@@ -841,8 +843,9 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) | |||
841 | { | 843 | { |
842 | struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); | 844 | struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb); |
843 | 845 | ||
844 | if (radeon_fb->obj) | 846 | if (radeon_fb->obj) { |
845 | drm_gem_object_unreference_unlocked(radeon_fb->obj); | 847 | drm_gem_object_unreference_unlocked(radeon_fb->obj); |
848 | } | ||
846 | drm_framebuffer_cleanup(fb); | 849 | drm_framebuffer_cleanup(fb); |
847 | kfree(radeon_fb); | 850 | kfree(radeon_fb); |
848 | } | 851 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index c74a8b20d94..40b0c087b59 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -94,6 +94,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj) | |||
94 | ret = radeon_bo_reserve(rbo, false); | 94 | ret = radeon_bo_reserve(rbo, false); |
95 | if (likely(ret == 0)) { | 95 | if (likely(ret == 0)) { |
96 | radeon_bo_kunmap(rbo); | 96 | radeon_bo_kunmap(rbo); |
97 | radeon_bo_unpin(rbo); | ||
97 | radeon_bo_unreserve(rbo); | 98 | radeon_bo_unreserve(rbo); |
98 | } | 99 | } |
99 | drm_gem_object_unreference_unlocked(gobj); | 100 | drm_gem_object_unreference_unlocked(gobj); |
@@ -325,8 +326,6 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb | |||
325 | { | 326 | { |
326 | struct fb_info *info; | 327 | struct fb_info *info; |
327 | struct radeon_framebuffer *rfb = &rfbdev->rfb; | 328 | struct radeon_framebuffer *rfb = &rfbdev->rfb; |
328 | struct radeon_bo *rbo; | ||
329 | int r; | ||
330 | 329 | ||
331 | if (rfbdev->helper.fbdev) { | 330 | if (rfbdev->helper.fbdev) { |
332 | info = rfbdev->helper.fbdev; | 331 | info = rfbdev->helper.fbdev; |
@@ -338,14 +337,8 @@ static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfb | |||
338 | } | 337 | } |
339 | 338 | ||
340 | if (rfb->obj) { | 339 | if (rfb->obj) { |
341 | rbo = rfb->obj->driver_private; | 340 | radeonfb_destroy_pinned_object(rfb->obj); |
342 | r = radeon_bo_reserve(rbo, false); | 341 | rfb->obj = NULL; |
343 | if (likely(r == 0)) { | ||
344 | radeon_bo_kunmap(rbo); | ||
345 | radeon_bo_unpin(rbo); | ||
346 | radeon_bo_unreserve(rbo); | ||
347 | } | ||
348 | drm_gem_object_unreference_unlocked(rfb->obj); | ||
349 | } | 342 | } |
350 | drm_fb_helper_fini(&rfbdev->helper); | 343 | drm_fb_helper_fini(&rfbdev->helper); |
351 | drm_framebuffer_cleanup(&rfb->base); | 344 | drm_framebuffer_cleanup(&rfb->base); |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index c578f265b24..d1e595d9172 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -201,11 +201,11 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data, | |||
201 | return r; | 201 | return r; |
202 | } | 202 | } |
203 | r = drm_gem_handle_create(filp, gobj, &handle); | 203 | r = drm_gem_handle_create(filp, gobj, &handle); |
204 | /* drop reference from allocate - handle holds it now */ | ||
205 | drm_gem_object_unreference_unlocked(gobj); | ||
204 | if (r) { | 206 | if (r) { |
205 | drm_gem_object_unreference_unlocked(gobj); | ||
206 | return r; | 207 | return r; |
207 | } | 208 | } |
208 | drm_gem_object_handle_unreference_unlocked(gobj); | ||
209 | args->handle = handle; | 209 | args->handle = handle; |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 0afd1e62347..b3b5306bb57 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) | |||
69 | u32 c = 0; | 69 | u32 c = 0; |
70 | 70 | ||
71 | rbo->placement.fpfn = 0; | 71 | rbo->placement.fpfn = 0; |
72 | rbo->placement.lpfn = 0; | 72 | rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; |
73 | rbo->placement.placement = rbo->placements; | 73 | rbo->placement.placement = rbo->placements; |
74 | rbo->placement.busy_placement = rbo->placements; | 74 | rbo->placement.busy_placement = rbo->placements; |
75 | if (domain & RADEON_GEM_DOMAIN_VRAM) | 75 | if (domain & RADEON_GEM_DOMAIN_VRAM) |
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 353998dc2c0..3481bc7f6f5 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h | |||
@@ -124,11 +124,8 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, | |||
124 | int r; | 124 | int r; |
125 | 125 | ||
126 | r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); | 126 | r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); |
127 | if (unlikely(r != 0)) { | 127 | if (unlikely(r != 0)) |
128 | if (r != -ERESTARTSYS) | ||
129 | dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo); | ||
130 | return r; | 128 | return r; |
131 | } | ||
132 | spin_lock(&bo->tbo.lock); | 129 | spin_lock(&bo->tbo.lock); |
133 | if (mem_type) | 130 | if (mem_type) |
134 | *mem_type = bo->tbo.mem.mem_type; | 131 | *mem_type = bo->tbo.mem.mem_type; |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index cc05b230d7e..51d5f7b5ab2 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -693,6 +693,7 @@ void rs600_mc_init(struct radeon_device *rdev) | |||
693 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); | 693 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); |
694 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; | 694 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; |
695 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 695 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
696 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
696 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 697 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
697 | base = RREG32_MC(R_000004_MC_FB_LOCATION); | 698 | base = RREG32_MC(R_000004_MC_FB_LOCATION); |
698 | base = G_000004_MC_FB_START(base) << 16; | 699 | base = G_000004_MC_FB_START(base) << 16; |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 3e3f75718be..4dc2a87ea68 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -157,6 +157,7 @@ void rs690_mc_init(struct radeon_device *rdev) | |||
157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
160 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
160 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); | 161 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
161 | base = G_000100_MC_FB_START(base) << 16; | 162 | base = G_000100_MC_FB_START(base) << 16; |
162 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 163 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index bfa59db374d..9490da70074 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -267,6 +267,7 @@ static void rv770_mc_program(struct radeon_device *rdev) | |||
267 | */ | 267 | */ |
268 | void r700_cp_stop(struct radeon_device *rdev) | 268 | void r700_cp_stop(struct radeon_device *rdev) |
269 | { | 269 | { |
270 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
270 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); | 271 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); |
271 | } | 272 | } |
272 | 273 | ||
@@ -992,6 +993,7 @@ int rv770_mc_init(struct radeon_device *rdev) | |||
992 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 993 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
993 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 994 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
994 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 995 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
996 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
995 | r600_vram_gtt_location(rdev, &rdev->mc); | 997 | r600_vram_gtt_location(rdev, &rdev->mc); |
996 | radeon_update_bandwidth_info(rdev); | 998 | radeon_update_bandwidth_info(rdev); |
997 | 999 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index cb4cf7ef4d1..db809e034cc 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -442,6 +442,43 @@ out_err: | |||
442 | } | 442 | } |
443 | 443 | ||
444 | /** | 444 | /** |
445 | * Call bo::reserved and with the lru lock held. | ||
446 | * Will release GPU memory type usage on destruction. | ||
447 | * This is the place to put in driver specific hooks. | ||
448 | * Will release the bo::reserved lock and the | ||
449 | * lru lock on exit. | ||
450 | */ | ||
451 | |||
452 | static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) | ||
453 | { | ||
454 | struct ttm_bo_global *glob = bo->glob; | ||
455 | |||
456 | if (bo->ttm) { | ||
457 | |||
458 | /** | ||
459 | * Release the lru_lock, since we don't want to have | ||
460 | * an atomic requirement on ttm_tt[unbind|destroy]. | ||
461 | */ | ||
462 | |||
463 | spin_unlock(&glob->lru_lock); | ||
464 | ttm_tt_unbind(bo->ttm); | ||
465 | ttm_tt_destroy(bo->ttm); | ||
466 | bo->ttm = NULL; | ||
467 | spin_lock(&glob->lru_lock); | ||
468 | } | ||
469 | |||
470 | if (bo->mem.mm_node) { | ||
471 | drm_mm_put_block(bo->mem.mm_node); | ||
472 | bo->mem.mm_node = NULL; | ||
473 | } | ||
474 | |||
475 | atomic_set(&bo->reserved, 0); | ||
476 | wake_up_all(&bo->event_queue); | ||
477 | spin_unlock(&glob->lru_lock); | ||
478 | } | ||
479 | |||
480 | |||
481 | /** | ||
445 | * If bo idle, remove from delayed- and lru lists, and unref. | 482 | * If bo idle, remove from delayed- and lru lists, and unref. |
446 | * If not idle, and already on delayed list, do nothing. | 483 | * If not idle, and already on delayed list, do nothing. |
447 | * If not idle, and not on delayed list, put on delayed list, | 484 | * If not idle, and not on delayed list, put on delayed list, |
@@ -456,6 +493,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
456 | int ret; | 493 | int ret; |
457 | 494 | ||
458 | spin_lock(&bo->lock); | 495 | spin_lock(&bo->lock); |
496 | retry: | ||
459 | (void) ttm_bo_wait(bo, false, false, !remove_all); | 497 | (void) ttm_bo_wait(bo, false, false, !remove_all); |
460 | 498 | ||
461 | if (!bo->sync_obj) { | 499 | if (!bo->sync_obj) { |
@@ -464,31 +502,52 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all) | |||
464 | spin_unlock(&bo->lock); | 502 | spin_unlock(&bo->lock); |
465 | 503 | ||
466 | spin_lock(&glob->lru_lock); | 504 | spin_lock(&glob->lru_lock); |
467 | put_count = ttm_bo_del_from_lru(bo); | 505 | ret = ttm_bo_reserve_locked(bo, false, !remove_all, false, 0); |
506 | |||
507 | /** | ||
508 | * Someone else has the object reserved. Bail and retry. | ||
509 | */ | ||
468 | 510 | ||
469 | ret = ttm_bo_reserve_locked(bo, false, false, false, 0); | 511 | if (unlikely(ret == -EBUSY)) { |
470 | BUG_ON(ret); | 512 | spin_unlock(&glob->lru_lock); |
471 | if (bo->ttm) | 513 | spin_lock(&bo->lock); |
472 | ttm_tt_unbind(bo->ttm); | 514 | goto requeue; |
515 | } | ||
516 | |||
517 | /** | ||
518 | * We can re-check for sync object without taking | ||
519 | * the bo::lock since setting the sync object requires | ||
520 | * also bo::reserved. A busy object at this point may | ||
521 | * be caused by another thread starting an accelerated | ||
522 | * eviction. | ||
523 | */ | ||
524 | |||
525 | if (unlikely(bo->sync_obj)) { | ||
526 | atomic_set(&bo->reserved, 0); | ||
527 | wake_up_all(&bo->event_queue); | ||
528 | spin_unlock(&glob->lru_lock); | ||
529 | spin_lock(&bo->lock); | ||
530 | if (remove_all) | ||
531 | goto retry; | ||
532 | else | ||
533 | goto requeue; | ||
534 | } | ||
535 | |||
536 | put_count = ttm_bo_del_from_lru(bo); | ||
473 | 537 | ||
474 | if (!list_empty(&bo->ddestroy)) { | 538 | if (!list_empty(&bo->ddestroy)) { |
475 | list_del_init(&bo->ddestroy); | 539 | list_del_init(&bo->ddestroy); |
476 | ++put_count; | 540 | ++put_count; |
477 | } | 541 | } |
478 | if (bo->mem.mm_node) { | ||
479 | drm_mm_put_block(bo->mem.mm_node); | ||
480 | bo->mem.mm_node = NULL; | ||
481 | } | ||
482 | spin_unlock(&glob->lru_lock); | ||
483 | 542 | ||
484 | atomic_set(&bo->reserved, 0); | 543 | ttm_bo_cleanup_memtype_use(bo); |
485 | 544 | ||
486 | while (put_count--) | 545 | while (put_count--) |
487 | kref_put(&bo->list_kref, ttm_bo_ref_bug); | 546 | kref_put(&bo->list_kref, ttm_bo_ref_bug); |
488 | 547 | ||
489 | return 0; | 548 | return 0; |
490 | } | 549 | } |
491 | 550 | requeue: | |
492 | spin_lock(&glob->lru_lock); | 551 | spin_lock(&glob->lru_lock); |
493 | if (list_empty(&bo->ddestroy)) { | 552 | if (list_empty(&bo->ddestroy)) { |
494 | void *sync_obj = bo->sync_obj; | 553 | void *sync_obj = bo->sync_obj; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 72ec2e2b6e9..a96ed6d9d01 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -148,13 +148,16 @@ static struct pci_device_id vmw_pci_id_list[] = { | |||
148 | {0, 0, 0} | 148 | {0, 0, 0} |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static char *vmw_devname = "vmwgfx"; | 151 | static int enable_fbdev; |
152 | 152 | ||
153 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); | 153 | static int vmw_probe(struct pci_dev *, const struct pci_device_id *); |
154 | static void vmw_master_init(struct vmw_master *); | 154 | static void vmw_master_init(struct vmw_master *); |
155 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, | 155 | static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, |
156 | void *ptr); | 156 | void *ptr); |
157 | 157 | ||
158 | MODULE_PARM_DESC(enable_fbdev, "Enable vmwgfx fbdev"); | ||
159 | module_param_named(enable_fbdev, enable_fbdev, int, 0600); | ||
160 | |||
158 | static void vmw_print_capabilities(uint32_t capabilities) | 161 | static void vmw_print_capabilities(uint32_t capabilities) |
159 | { | 162 | { |
160 | DRM_INFO("Capabilities:\n"); | 163 | DRM_INFO("Capabilities:\n"); |
@@ -192,8 +195,6 @@ static int vmw_request_device(struct vmw_private *dev_priv) | |||
192 | { | 195 | { |
193 | int ret; | 196 | int ret; |
194 | 197 | ||
195 | vmw_kms_save_vga(dev_priv); | ||
196 | |||
197 | ret = vmw_fifo_init(dev_priv, &dev_priv->fifo); | 198 | ret = vmw_fifo_init(dev_priv, &dev_priv->fifo); |
198 | if (unlikely(ret != 0)) { | 199 | if (unlikely(ret != 0)) { |
199 | DRM_ERROR("Unable to initialize FIFO.\n"); | 200 | DRM_ERROR("Unable to initialize FIFO.\n"); |
@@ -206,9 +207,35 @@ static int vmw_request_device(struct vmw_private *dev_priv) | |||
206 | static void vmw_release_device(struct vmw_private *dev_priv) | 207 | static void vmw_release_device(struct vmw_private *dev_priv) |
207 | { | 208 | { |
208 | vmw_fifo_release(dev_priv, &dev_priv->fifo); | 209 | vmw_fifo_release(dev_priv, &dev_priv->fifo); |
209 | vmw_kms_restore_vga(dev_priv); | ||
210 | } | 210 | } |
211 | 211 | ||
212 | int vmw_3d_resource_inc(struct vmw_private *dev_priv) | ||
213 | { | ||
214 | int ret = 0; | ||
215 | |||
216 | mutex_lock(&dev_priv->release_mutex); | ||
217 | if (unlikely(dev_priv->num_3d_resources++ == 0)) { | ||
218 | ret = vmw_request_device(dev_priv); | ||
219 | if (unlikely(ret != 0)) | ||
220 | --dev_priv->num_3d_resources; | ||
221 | } | ||
222 | mutex_unlock(&dev_priv->release_mutex); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | |||
227 | void vmw_3d_resource_dec(struct vmw_private *dev_priv) | ||
228 | { | ||
229 | int32_t n3d; | ||
230 | |||
231 | mutex_lock(&dev_priv->release_mutex); | ||
232 | if (unlikely(--dev_priv->num_3d_resources == 0)) | ||
233 | vmw_release_device(dev_priv); | ||
234 | n3d = (int32_t) dev_priv->num_3d_resources; | ||
235 | mutex_unlock(&dev_priv->release_mutex); | ||
236 | |||
237 | BUG_ON(n3d < 0); | ||
238 | } | ||
212 | 239 | ||
213 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | 240 | static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) |
214 | { | 241 | { |
@@ -228,6 +255,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
228 | dev_priv->last_read_sequence = (uint32_t) -100; | 255 | dev_priv->last_read_sequence = (uint32_t) -100; |
229 | mutex_init(&dev_priv->hw_mutex); | 256 | mutex_init(&dev_priv->hw_mutex); |
230 | mutex_init(&dev_priv->cmdbuf_mutex); | 257 | mutex_init(&dev_priv->cmdbuf_mutex); |
258 | mutex_init(&dev_priv->release_mutex); | ||
231 | rwlock_init(&dev_priv->resource_lock); | 259 | rwlock_init(&dev_priv->resource_lock); |
232 | idr_init(&dev_priv->context_idr); | 260 | idr_init(&dev_priv->context_idr); |
233 | idr_init(&dev_priv->surface_idr); | 261 | idr_init(&dev_priv->surface_idr); |
@@ -244,6 +272,8 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
244 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); | 272 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); |
245 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); | 273 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); |
246 | 274 | ||
275 | dev_priv->enable_fb = enable_fbdev; | ||
276 | |||
247 | mutex_lock(&dev_priv->hw_mutex); | 277 | mutex_lock(&dev_priv->hw_mutex); |
248 | 278 | ||
249 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); | 279 | vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); |
@@ -343,17 +373,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
343 | 373 | ||
344 | dev->dev_private = dev_priv; | 374 | dev->dev_private = dev_priv; |
345 | 375 | ||
346 | if (!dev->devname) | ||
347 | dev->devname = vmw_devname; | ||
348 | |||
349 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
350 | ret = drm_irq_install(dev); | ||
351 | if (unlikely(ret != 0)) { | ||
352 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
353 | goto out_no_irq; | ||
354 | } | ||
355 | } | ||
356 | |||
357 | ret = pci_request_regions(dev->pdev, "vmwgfx probe"); | 376 | ret = pci_request_regions(dev->pdev, "vmwgfx probe"); |
358 | dev_priv->stealth = (ret != 0); | 377 | dev_priv->stealth = (ret != 0); |
359 | if (dev_priv->stealth) { | 378 | if (dev_priv->stealth) { |
@@ -369,26 +388,52 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
369 | goto out_no_device; | 388 | goto out_no_device; |
370 | } | 389 | } |
371 | } | 390 | } |
372 | ret = vmw_request_device(dev_priv); | 391 | ret = vmw_kms_init(dev_priv); |
373 | if (unlikely(ret != 0)) | 392 | if (unlikely(ret != 0)) |
374 | goto out_no_device; | 393 | goto out_no_kms; |
375 | vmw_kms_init(dev_priv); | ||
376 | vmw_overlay_init(dev_priv); | 394 | vmw_overlay_init(dev_priv); |
377 | vmw_fb_init(dev_priv); | 395 | if (dev_priv->enable_fb) { |
396 | ret = vmw_3d_resource_inc(dev_priv); | ||
397 | if (unlikely(ret != 0)) | ||
398 | goto out_no_fifo; | ||
399 | vmw_kms_save_vga(dev_priv); | ||
400 | vmw_fb_init(dev_priv); | ||
401 | DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? | ||
402 | "Detected device 3D availability.\n" : | ||
403 | "Detected no device 3D availability.\n"); | ||
404 | } else { | ||
405 | DRM_INFO("Delayed 3D detection since we're not " | ||
406 | "running the device in SVGA mode yet.\n"); | ||
407 | } | ||
408 | |||
409 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { | ||
410 | ret = drm_irq_install(dev); | ||
411 | if (unlikely(ret != 0)) { | ||
412 | DRM_ERROR("Failed installing irq: %d\n", ret); | ||
413 | goto out_no_irq; | ||
414 | } | ||
415 | } | ||
378 | 416 | ||
379 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; | 417 | dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier; |
380 | register_pm_notifier(&dev_priv->pm_nb); | 418 | register_pm_notifier(&dev_priv->pm_nb); |
381 | 419 | ||
382 | DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n"); | ||
383 | |||
384 | return 0; | 420 | return 0; |
385 | 421 | ||
386 | out_no_device: | ||
387 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
388 | drm_irq_uninstall(dev_priv->dev); | ||
389 | if (dev->devname == vmw_devname) | ||
390 | dev->devname = NULL; | ||
391 | out_no_irq: | 422 | out_no_irq: |
423 | if (dev_priv->enable_fb) { | ||
424 | vmw_fb_close(dev_priv); | ||
425 | vmw_kms_restore_vga(dev_priv); | ||
426 | vmw_3d_resource_dec(dev_priv); | ||
427 | } | ||
428 | out_no_fifo: | ||
429 | vmw_overlay_close(dev_priv); | ||
430 | vmw_kms_close(dev_priv); | ||
431 | out_no_kms: | ||
432 | if (dev_priv->stealth) | ||
433 | pci_release_region(dev->pdev, 2); | ||
434 | else | ||
435 | pci_release_regions(dev->pdev); | ||
436 | out_no_device: | ||
392 | ttm_object_device_release(&dev_priv->tdev); | 437 | ttm_object_device_release(&dev_priv->tdev); |
393 | out_err4: | 438 | out_err4: |
394 | iounmap(dev_priv->mmio_virt); | 439 | iounmap(dev_priv->mmio_virt); |
@@ -415,19 +460,20 @@ static int vmw_driver_unload(struct drm_device *dev) | |||
415 | 460 | ||
416 | unregister_pm_notifier(&dev_priv->pm_nb); | 461 | unregister_pm_notifier(&dev_priv->pm_nb); |
417 | 462 | ||
418 | vmw_fb_close(dev_priv); | 463 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) |
464 | drm_irq_uninstall(dev_priv->dev); | ||
465 | if (dev_priv->enable_fb) { | ||
466 | vmw_fb_close(dev_priv); | ||
467 | vmw_kms_restore_vga(dev_priv); | ||
468 | vmw_3d_resource_dec(dev_priv); | ||
469 | } | ||
419 | vmw_kms_close(dev_priv); | 470 | vmw_kms_close(dev_priv); |
420 | vmw_overlay_close(dev_priv); | 471 | vmw_overlay_close(dev_priv); |
421 | vmw_release_device(dev_priv); | ||
422 | if (dev_priv->stealth) | 472 | if (dev_priv->stealth) |
423 | pci_release_region(dev->pdev, 2); | 473 | pci_release_region(dev->pdev, 2); |
424 | else | 474 | else |
425 | pci_release_regions(dev->pdev); | 475 | pci_release_regions(dev->pdev); |
426 | 476 | ||
427 | if (dev_priv->capabilities & SVGA_CAP_IRQMASK) | ||
428 | drm_irq_uninstall(dev_priv->dev); | ||
429 | if (dev->devname == vmw_devname) | ||
430 | dev->devname = NULL; | ||
431 | ttm_object_device_release(&dev_priv->tdev); | 477 | ttm_object_device_release(&dev_priv->tdev); |
432 | iounmap(dev_priv->mmio_virt); | 478 | iounmap(dev_priv->mmio_virt); |
433 | drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start, | 479 | drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start, |
@@ -500,7 +546,7 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd, | |||
500 | struct drm_ioctl_desc *ioctl = | 546 | struct drm_ioctl_desc *ioctl = |
501 | &vmw_ioctls[nr - DRM_COMMAND_BASE]; | 547 | &vmw_ioctls[nr - DRM_COMMAND_BASE]; |
502 | 548 | ||
503 | if (unlikely(ioctl->cmd != cmd)) { | 549 | if (unlikely(ioctl->cmd_drv != cmd)) { |
504 | DRM_ERROR("Invalid command format, ioctl %d\n", | 550 | DRM_ERROR("Invalid command format, ioctl %d\n", |
505 | nr - DRM_COMMAND_BASE); | 551 | nr - DRM_COMMAND_BASE); |
506 | return -EINVAL; | 552 | return -EINVAL; |
@@ -589,6 +635,16 @@ static int vmw_master_set(struct drm_device *dev, | |||
589 | struct vmw_master *vmaster = vmw_master(file_priv->master); | 635 | struct vmw_master *vmaster = vmw_master(file_priv->master); |
590 | int ret = 0; | 636 | int ret = 0; |
591 | 637 | ||
638 | if (!dev_priv->enable_fb) { | ||
639 | ret = vmw_3d_resource_inc(dev_priv); | ||
640 | if (unlikely(ret != 0)) | ||
641 | return ret; | ||
642 | vmw_kms_save_vga(dev_priv); | ||
643 | mutex_lock(&dev_priv->hw_mutex); | ||
644 | vmw_write(dev_priv, SVGA_REG_TRACES, 0); | ||
645 | mutex_unlock(&dev_priv->hw_mutex); | ||
646 | } | ||
647 | |||
592 | if (active) { | 648 | if (active) { |
593 | BUG_ON(active != &dev_priv->fbdev_master); | 649 | BUG_ON(active != &dev_priv->fbdev_master); |
594 | ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); | 650 | ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); |
@@ -617,7 +673,13 @@ static int vmw_master_set(struct drm_device *dev, | |||
617 | return 0; | 673 | return 0; |
618 | 674 | ||
619 | out_no_active_lock: | 675 | out_no_active_lock: |
620 | vmw_release_device(dev_priv); | 676 | if (!dev_priv->enable_fb) { |
677 | mutex_lock(&dev_priv->hw_mutex); | ||
678 | vmw_write(dev_priv, SVGA_REG_TRACES, 1); | ||
679 | mutex_unlock(&dev_priv->hw_mutex); | ||
680 | vmw_kms_restore_vga(dev_priv); | ||
681 | vmw_3d_resource_dec(dev_priv); | ||
682 | } | ||
621 | return ret; | 683 | return ret; |
622 | } | 684 | } |
623 | 685 | ||
@@ -645,11 +707,23 @@ static void vmw_master_drop(struct drm_device *dev, | |||
645 | 707 | ||
646 | ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); | 708 | ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); |
647 | 709 | ||
710 | if (!dev_priv->enable_fb) { | ||
711 | ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM); | ||
712 | if (unlikely(ret != 0)) | ||
713 | DRM_ERROR("Unable to clean VRAM on master drop.\n"); | ||
714 | mutex_lock(&dev_priv->hw_mutex); | ||
715 | vmw_write(dev_priv, SVGA_REG_TRACES, 1); | ||
716 | mutex_unlock(&dev_priv->hw_mutex); | ||
717 | vmw_kms_restore_vga(dev_priv); | ||
718 | vmw_3d_resource_dec(dev_priv); | ||
719 | } | ||
720 | |||
648 | dev_priv->active_master = &dev_priv->fbdev_master; | 721 | dev_priv->active_master = &dev_priv->fbdev_master; |
649 | ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); | 722 | ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); |
650 | ttm_vt_unlock(&dev_priv->fbdev_master.lock); | 723 | ttm_vt_unlock(&dev_priv->fbdev_master.lock); |
651 | 724 | ||
652 | vmw_fb_on(dev_priv); | 725 | if (dev_priv->enable_fb) |
726 | vmw_fb_on(dev_priv); | ||
653 | } | 727 | } |
654 | 728 | ||
655 | 729 | ||
@@ -722,6 +796,7 @@ static struct drm_driver driver = { | |||
722 | .irq_postinstall = vmw_irq_postinstall, | 796 | .irq_postinstall = vmw_irq_postinstall, |
723 | .irq_uninstall = vmw_irq_uninstall, | 797 | .irq_uninstall = vmw_irq_uninstall, |
724 | .irq_handler = vmw_irq_handler, | 798 | .irq_handler = vmw_irq_handler, |
799 | .get_vblank_counter = vmw_get_vblank_counter, | ||
725 | .reclaim_buffers_locked = NULL, | 800 | .reclaim_buffers_locked = NULL, |
726 | .get_map_ofs = drm_core_get_map_ofs, | 801 | .get_map_ofs = drm_core_get_map_ofs, |
727 | .get_reg_ofs = drm_core_get_reg_ofs, | 802 | .get_reg_ofs = drm_core_get_reg_ofs, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 429f917b60b..58de6393f61 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -277,6 +277,7 @@ struct vmw_private { | |||
277 | 277 | ||
278 | bool stealth; | 278 | bool stealth; |
279 | bool is_opened; | 279 | bool is_opened; |
280 | bool enable_fb; | ||
280 | 281 | ||
281 | /** | 282 | /** |
282 | * Master management. | 283 | * Master management. |
@@ -285,6 +286,9 @@ struct vmw_private { | |||
285 | struct vmw_master *active_master; | 286 | struct vmw_master *active_master; |
286 | struct vmw_master fbdev_master; | 287 | struct vmw_master fbdev_master; |
287 | struct notifier_block pm_nb; | 288 | struct notifier_block pm_nb; |
289 | |||
290 | struct mutex release_mutex; | ||
291 | uint32_t num_3d_resources; | ||
288 | }; | 292 | }; |
289 | 293 | ||
290 | static inline struct vmw_private *vmw_priv(struct drm_device *dev) | 294 | static inline struct vmw_private *vmw_priv(struct drm_device *dev) |
@@ -319,6 +323,9 @@ static inline uint32_t vmw_read(struct vmw_private *dev_priv, | |||
319 | return val; | 323 | return val; |
320 | } | 324 | } |
321 | 325 | ||
326 | int vmw_3d_resource_inc(struct vmw_private *dev_priv); | ||
327 | void vmw_3d_resource_dec(struct vmw_private *dev_priv); | ||
328 | |||
322 | /** | 329 | /** |
323 | * GMR utilities - vmwgfx_gmr.c | 330 | * GMR utilities - vmwgfx_gmr.c |
324 | */ | 331 | */ |
@@ -511,6 +518,7 @@ void vmw_kms_write_svga(struct vmw_private *vmw_priv, | |||
511 | unsigned bbp, unsigned depth); | 518 | unsigned bbp, unsigned depth); |
512 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | 519 | int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, |
513 | struct drm_file *file_priv); | 520 | struct drm_file *file_priv); |
521 | u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc); | ||
514 | 522 | ||
515 | /** | 523 | /** |
516 | * Overlay control - vmwgfx_overlay.c | 524 | * Overlay control - vmwgfx_overlay.c |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index 870967a97c1..409e172f4ab 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
@@ -615,6 +615,11 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *vmw_priv, | |||
615 | if (unlikely(ret != 0)) | 615 | if (unlikely(ret != 0)) |
616 | goto err_unlock; | 616 | goto err_unlock; |
617 | 617 | ||
618 | if (bo->mem.mem_type == TTM_PL_VRAM && | ||
619 | bo->mem.mm_node->start < bo->num_pages) | ||
620 | (void) ttm_bo_validate(bo, &vmw_sys_placement, false, | ||
621 | false, false); | ||
622 | |||
618 | ret = ttm_bo_validate(bo, &ne_placement, false, false, false); | 623 | ret = ttm_bo_validate(bo, &ne_placement, false, false, false); |
619 | 624 | ||
620 | /* Could probably bug on */ | 625 | /* Could probably bug on */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index e6a1eb7ea95..0fe31766e4c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -106,6 +106,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
106 | mutex_lock(&dev_priv->hw_mutex); | 106 | mutex_lock(&dev_priv->hw_mutex); |
107 | dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); | 107 | dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); |
108 | dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); | 108 | dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); |
109 | dev_priv->traces_state = vmw_read(dev_priv, SVGA_REG_TRACES); | ||
109 | vmw_write(dev_priv, SVGA_REG_ENABLE, 1); | 110 | vmw_write(dev_priv, SVGA_REG_ENABLE, 1); |
110 | 111 | ||
111 | min = 4; | 112 | min = 4; |
@@ -175,6 +176,8 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
175 | dev_priv->config_done_state); | 176 | dev_priv->config_done_state); |
176 | vmw_write(dev_priv, SVGA_REG_ENABLE, | 177 | vmw_write(dev_priv, SVGA_REG_ENABLE, |
177 | dev_priv->enable_state); | 178 | dev_priv->enable_state); |
179 | vmw_write(dev_priv, SVGA_REG_TRACES, | ||
180 | dev_priv->traces_state); | ||
178 | 181 | ||
179 | mutex_unlock(&dev_priv->hw_mutex); | 182 | mutex_unlock(&dev_priv->hw_mutex); |
180 | vmw_fence_queue_takedown(&fifo->fence_queue); | 183 | vmw_fence_queue_takedown(&fifo->fence_queue); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 64d7f47df86..e882ba099f0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -898,7 +898,19 @@ int vmw_kms_save_vga(struct vmw_private *vmw_priv) | |||
898 | save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH); | 898 | save->width = vmw_read(vmw_priv, SVGA_REG_DISPLAY_WIDTH); |
899 | save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT); | 899 | save->height = vmw_read(vmw_priv, SVGA_REG_DISPLAY_HEIGHT); |
900 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); | 900 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
901 | if (i == 0 && vmw_priv->num_displays == 1 && | ||
902 | save->width == 0 && save->height == 0) { | ||
903 | |||
904 | /* | ||
905 | * It should be fairly safe to assume that these | ||
906 | * values are uninitialized. | ||
907 | */ | ||
908 | |||
909 | save->width = vmw_priv->vga_width - save->pos_x; | ||
910 | save->height = vmw_priv->vga_height - save->pos_y; | ||
911 | } | ||
901 | } | 912 | } |
913 | |||
902 | return 0; | 914 | return 0; |
903 | } | 915 | } |
904 | 916 | ||
@@ -984,3 +996,8 @@ out_unlock: | |||
984 | ttm_read_unlock(&vmaster->lock); | 996 | ttm_read_unlock(&vmaster->lock); |
985 | return ret; | 997 | return ret; |
986 | } | 998 | } |
999 | |||
1000 | u32 vmw_get_vblank_counter(struct drm_device *dev, int crtc) | ||
1001 | { | ||
1002 | return 0; | ||
1003 | } | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 7083b1a24df..11cb39e3acc 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #include "vmwgfx_kms.h" | 28 | #include "vmwgfx_kms.h" |
29 | 29 | ||
30 | #define VMWGFX_LDU_NUM_DU 8 | ||
31 | |||
30 | #define vmw_crtc_to_ldu(x) \ | 32 | #define vmw_crtc_to_ldu(x) \ |
31 | container_of(x, struct vmw_legacy_display_unit, base.crtc) | 33 | container_of(x, struct vmw_legacy_display_unit, base.crtc) |
32 | #define vmw_encoder_to_ldu(x) \ | 34 | #define vmw_encoder_to_ldu(x) \ |
@@ -536,6 +538,10 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) | |||
536 | 538 | ||
537 | int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) | 539 | int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) |
538 | { | 540 | { |
541 | struct drm_device *dev = dev_priv->dev; | ||
542 | int i; | ||
543 | int ret; | ||
544 | |||
539 | if (dev_priv->ldu_priv) { | 545 | if (dev_priv->ldu_priv) { |
540 | DRM_INFO("ldu system already on\n"); | 546 | DRM_INFO("ldu system already on\n"); |
541 | return -EINVAL; | 547 | return -EINVAL; |
@@ -553,23 +559,24 @@ int vmw_kms_init_legacy_display_system(struct vmw_private *dev_priv) | |||
553 | 559 | ||
554 | drm_mode_create_dirty_info_property(dev_priv->dev); | 560 | drm_mode_create_dirty_info_property(dev_priv->dev); |
555 | 561 | ||
556 | vmw_ldu_init(dev_priv, 0); | ||
557 | /* for old hardware without multimon only enable one display */ | ||
558 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { | 562 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) { |
559 | vmw_ldu_init(dev_priv, 1); | 563 | for (i = 0; i < VMWGFX_LDU_NUM_DU; ++i) |
560 | vmw_ldu_init(dev_priv, 2); | 564 | vmw_ldu_init(dev_priv, i); |
561 | vmw_ldu_init(dev_priv, 3); | 565 | ret = drm_vblank_init(dev, VMWGFX_LDU_NUM_DU); |
562 | vmw_ldu_init(dev_priv, 4); | 566 | } else { |
563 | vmw_ldu_init(dev_priv, 5); | 567 | /* for old hardware without multimon only enable one display */ |
564 | vmw_ldu_init(dev_priv, 6); | 568 | vmw_ldu_init(dev_priv, 0); |
565 | vmw_ldu_init(dev_priv, 7); | 569 | ret = drm_vblank_init(dev, 1); |
566 | } | 570 | } |
567 | 571 | ||
568 | return 0; | 572 | return ret; |
569 | } | 573 | } |
570 | 574 | ||
571 | int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) | 575 | int vmw_kms_close_legacy_display_system(struct vmw_private *dev_priv) |
572 | { | 576 | { |
577 | struct drm_device *dev = dev_priv->dev; | ||
578 | |||
579 | drm_vblank_cleanup(dev); | ||
573 | if (!dev_priv->ldu_priv) | 580 | if (!dev_priv->ldu_priv) |
574 | return -ENOSYS; | 581 | return -ENOSYS; |
575 | 582 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 5f2d5df01e5..c8c40e9979d 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -211,6 +211,7 @@ static void vmw_hw_context_destroy(struct vmw_resource *res) | |||
211 | cmd->body.cid = cpu_to_le32(res->id); | 211 | cmd->body.cid = cpu_to_le32(res->id); |
212 | 212 | ||
213 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 213 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
214 | vmw_3d_resource_dec(dev_priv); | ||
214 | } | 215 | } |
215 | 216 | ||
216 | static int vmw_context_init(struct vmw_private *dev_priv, | 217 | static int vmw_context_init(struct vmw_private *dev_priv, |
@@ -247,6 +248,7 @@ static int vmw_context_init(struct vmw_private *dev_priv, | |||
247 | cmd->body.cid = cpu_to_le32(res->id); | 248 | cmd->body.cid = cpu_to_le32(res->id); |
248 | 249 | ||
249 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 250 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
251 | (void) vmw_3d_resource_inc(dev_priv); | ||
250 | vmw_resource_activate(res, vmw_hw_context_destroy); | 252 | vmw_resource_activate(res, vmw_hw_context_destroy); |
251 | return 0; | 253 | return 0; |
252 | } | 254 | } |
@@ -406,6 +408,7 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res) | |||
406 | cmd->body.sid = cpu_to_le32(res->id); | 408 | cmd->body.sid = cpu_to_le32(res->id); |
407 | 409 | ||
408 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 410 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); |
411 | vmw_3d_resource_dec(dev_priv); | ||
409 | } | 412 | } |
410 | 413 | ||
411 | void vmw_surface_res_free(struct vmw_resource *res) | 414 | void vmw_surface_res_free(struct vmw_resource *res) |
@@ -473,6 +476,7 @@ int vmw_surface_init(struct vmw_private *dev_priv, | |||
473 | } | 476 | } |
474 | 477 | ||
475 | vmw_fifo_commit(dev_priv, submit_size); | 478 | vmw_fifo_commit(dev_priv, submit_size); |
479 | (void) vmw_3d_resource_inc(dev_priv); | ||
476 | vmw_resource_activate(res, vmw_hw_surface_destroy); | 480 | vmw_resource_activate(res, vmw_hw_surface_destroy); |
477 | return 0; | 481 | return 0; |
478 | } | 482 | } |
diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c index 4267a6fdc27..5925bdcd417 100644 --- a/drivers/hid/hid-cando.c +++ b/drivers/hid/hid-cando.c | |||
@@ -237,6 +237,8 @@ static const struct hid_device_id cando_devices[] = { | |||
237 | USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, | 237 | USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
238 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | 238 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, |
239 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, | 239 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, |
240 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | ||
241 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, | ||
240 | { } | 242 | { } |
241 | }; | 243 | }; |
242 | MODULE_DEVICE_TABLE(hid, cando_devices); | 244 | MODULE_DEVICE_TABLE(hid, cando_devices); |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 3f729248602..a0dea3d1296 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1292,6 +1292,7 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1292 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | 1292 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, |
1293 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, | 1293 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
1294 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, | 1294 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, |
1295 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, | ||
1295 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, | 1296 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
1296 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, | 1297 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
1297 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 1298 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 765a4f53eb5..c5ae5f1545b 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -134,6 +134,7 @@ | |||
134 | #define USB_VENDOR_ID_CANDO 0x2087 | 134 | #define USB_VENDOR_ID_CANDO 0x2087 |
135 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 | 135 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 |
136 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 | 136 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6 0x0b03 |
137 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 | ||
137 | 138 | ||
138 | #define USB_VENDOR_ID_CH 0x068e | 139 | #define USB_VENDOR_ID_CH 0x068e |
139 | #define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 | 140 | #define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 |
@@ -503,6 +504,7 @@ | |||
503 | 504 | ||
504 | #define USB_VENDOR_ID_TURBOX 0x062a | 505 | #define USB_VENDOR_ID_TURBOX 0x062a |
505 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 | 506 | #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 |
507 | #define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 | ||
506 | 508 | ||
507 | #define USB_VENDOR_ID_TWINHAN 0x6253 | 509 | #define USB_VENDOR_ID_TWINHAN 0x6253 |
508 | #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 | 510 | #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 47d70c523d9..a3866b5c0c4 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -109,6 +109,12 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t | |||
109 | int ret = 0; | 109 | int ret = 0; |
110 | 110 | ||
111 | mutex_lock(&minors_lock); | 111 | mutex_lock(&minors_lock); |
112 | |||
113 | if (!hidraw_table[minor]) { | ||
114 | ret = -ENODEV; | ||
115 | goto out; | ||
116 | } | ||
117 | |||
112 | dev = hidraw_table[minor]->hid; | 118 | dev = hidraw_table[minor]->hid; |
113 | 119 | ||
114 | if (!dev->hid_output_raw_report) { | 120 | if (!dev->hid_output_raw_report) { |
@@ -244,6 +250,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
244 | 250 | ||
245 | mutex_lock(&minors_lock); | 251 | mutex_lock(&minors_lock); |
246 | dev = hidraw_table[minor]; | 252 | dev = hidraw_table[minor]; |
253 | if (!dev) { | ||
254 | ret = -ENODEV; | ||
255 | goto out; | ||
256 | } | ||
247 | 257 | ||
248 | switch (cmd) { | 258 | switch (cmd) { |
249 | case HIDIOCGRDESCSIZE: | 259 | case HIDIOCGRDESCSIZE: |
@@ -317,6 +327,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, | |||
317 | 327 | ||
318 | ret = -ENOTTY; | 328 | ret = -ENOTTY; |
319 | } | 329 | } |
330 | out: | ||
320 | mutex_unlock(&minors_lock); | 331 | mutex_unlock(&minors_lock); |
321 | return ret; | 332 | return ret; |
322 | } | 333 | } |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 70da3181c8a..f0260c699ad 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -36,6 +36,7 @@ static const struct hid_blacklist { | |||
36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, | 36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, |
37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, | 37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, |
38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, | 38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, |
39 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, | ||
39 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 40 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
40 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 41 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
41 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 42 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 537841ef44b..75afb3b0e07 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -111,7 +111,7 @@ static struct platform_device *f71882fg_pdev; | |||
111 | /* Super-I/O Function prototypes */ | 111 | /* Super-I/O Function prototypes */ |
112 | static inline int superio_inb(int base, int reg); | 112 | static inline int superio_inb(int base, int reg); |
113 | static inline int superio_inw(int base, int reg); | 113 | static inline int superio_inw(int base, int reg); |
114 | static inline void superio_enter(int base); | 114 | static inline int superio_enter(int base); |
115 | static inline void superio_select(int base, int ld); | 115 | static inline void superio_select(int base, int ld); |
116 | static inline void superio_exit(int base); | 116 | static inline void superio_exit(int base); |
117 | 117 | ||
@@ -861,11 +861,20 @@ static int superio_inw(int base, int reg) | |||
861 | return val; | 861 | return val; |
862 | } | 862 | } |
863 | 863 | ||
864 | static inline void superio_enter(int base) | 864 | static inline int superio_enter(int base) |
865 | { | 865 | { |
866 | /* Don't step on other drivers' I/O space by accident */ | ||
867 | if (!request_muxed_region(base, 2, DRVNAME)) { | ||
868 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
869 | base); | ||
870 | return -EBUSY; | ||
871 | } | ||
872 | |||
866 | /* according to the datasheet the key must be send twice! */ | 873 | /* according to the datasheet the key must be send twice! */ |
867 | outb(SIO_UNLOCK_KEY, base); | 874 | outb(SIO_UNLOCK_KEY, base); |
868 | outb(SIO_UNLOCK_KEY, base); | 875 | outb(SIO_UNLOCK_KEY, base); |
876 | |||
877 | return 0; | ||
869 | } | 878 | } |
870 | 879 | ||
871 | static inline void superio_select(int base, int ld) | 880 | static inline void superio_select(int base, int ld) |
@@ -877,6 +886,7 @@ static inline void superio_select(int base, int ld) | |||
877 | static inline void superio_exit(int base) | 886 | static inline void superio_exit(int base) |
878 | { | 887 | { |
879 | outb(SIO_LOCK_KEY, base); | 888 | outb(SIO_LOCK_KEY, base); |
889 | release_region(base, 2); | ||
880 | } | 890 | } |
881 | 891 | ||
882 | static inline int fan_from_reg(u16 reg) | 892 | static inline int fan_from_reg(u16 reg) |
@@ -2175,21 +2185,15 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2175 | static int __init f71882fg_find(int sioaddr, unsigned short *address, | 2185 | static int __init f71882fg_find(int sioaddr, unsigned short *address, |
2176 | struct f71882fg_sio_data *sio_data) | 2186 | struct f71882fg_sio_data *sio_data) |
2177 | { | 2187 | { |
2178 | int err = -ENODEV; | ||
2179 | u16 devid; | 2188 | u16 devid; |
2180 | 2189 | int err = superio_enter(sioaddr); | |
2181 | /* Don't step on other drivers' I/O space by accident */ | 2190 | if (err) |
2182 | if (!request_region(sioaddr, 2, DRVNAME)) { | 2191 | return err; |
2183 | printk(KERN_ERR DRVNAME ": I/O address 0x%04x already in use\n", | ||
2184 | (int)sioaddr); | ||
2185 | return -EBUSY; | ||
2186 | } | ||
2187 | |||
2188 | superio_enter(sioaddr); | ||
2189 | 2192 | ||
2190 | devid = superio_inw(sioaddr, SIO_REG_MANID); | 2193 | devid = superio_inw(sioaddr, SIO_REG_MANID); |
2191 | if (devid != SIO_FINTEK_ID) { | 2194 | if (devid != SIO_FINTEK_ID) { |
2192 | pr_debug(DRVNAME ": Not a Fintek device\n"); | 2195 | pr_debug(DRVNAME ": Not a Fintek device\n"); |
2196 | err = -ENODEV; | ||
2193 | goto exit; | 2197 | goto exit; |
2194 | } | 2198 | } |
2195 | 2199 | ||
@@ -2213,6 +2217,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2213 | default: | 2217 | default: |
2214 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", | 2218 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device: %04x\n", |
2215 | (unsigned int)devid); | 2219 | (unsigned int)devid); |
2220 | err = -ENODEV; | ||
2216 | goto exit; | 2221 | goto exit; |
2217 | } | 2222 | } |
2218 | 2223 | ||
@@ -2223,12 +2228,14 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2223 | 2228 | ||
2224 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { | 2229 | if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) { |
2225 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); | 2230 | printk(KERN_WARNING DRVNAME ": Device not activated\n"); |
2231 | err = -ENODEV; | ||
2226 | goto exit; | 2232 | goto exit; |
2227 | } | 2233 | } |
2228 | 2234 | ||
2229 | *address = superio_inw(sioaddr, SIO_REG_ADDR); | 2235 | *address = superio_inw(sioaddr, SIO_REG_ADDR); |
2230 | if (*address == 0) { | 2236 | if (*address == 0) { |
2231 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); | 2237 | printk(KERN_WARNING DRVNAME ": Base address not set\n"); |
2238 | err = -ENODEV; | ||
2232 | goto exit; | 2239 | goto exit; |
2233 | } | 2240 | } |
2234 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ | 2241 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ |
@@ -2239,7 +2246,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2239 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); | 2246 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); |
2240 | exit: | 2247 | exit: |
2241 | superio_exit(sioaddr); | 2248 | superio_exit(sioaddr); |
2242 | release_region(sioaddr, 2); | ||
2243 | return err; | 2249 | return err; |
2244 | } | 2250 | } |
2245 | 2251 | ||
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index f7bd2613cec..f2de3be35df 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -677,6 +677,11 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev, | |||
677 | dev_dbg(&ofdev->dev, "hw routines for %s registered.\n", | 677 | dev_dbg(&ofdev->dev, "hw routines for %s registered.\n", |
678 | cpm->adap.name); | 678 | cpm->adap.name); |
679 | 679 | ||
680 | /* | ||
681 | * register OF I2C devices | ||
682 | */ | ||
683 | of_i2c_register_devices(&cpm->adap); | ||
684 | |||
680 | return 0; | 685 | return 0; |
681 | out_shut: | 686 | out_shut: |
682 | cpm_i2c_shutdown(cpm); | 687 | cpm_i2c_shutdown(cpm); |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 2222c87876b..5795c8398c7 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -331,21 +331,16 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
331 | INIT_COMPLETION(dev->cmd_complete); | 331 | INIT_COMPLETION(dev->cmd_complete); |
332 | dev->cmd_err = 0; | 332 | dev->cmd_err = 0; |
333 | 333 | ||
334 | /* Take I2C out of reset, configure it as master and set the | 334 | /* Take I2C out of reset and configure it as master */ |
335 | * start bit */ | 335 | flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST; |
336 | flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT; | ||
337 | 336 | ||
338 | /* if the slave address is ten bit address, enable XA bit */ | 337 | /* if the slave address is ten bit address, enable XA bit */ |
339 | if (msg->flags & I2C_M_TEN) | 338 | if (msg->flags & I2C_M_TEN) |
340 | flag |= DAVINCI_I2C_MDR_XA; | 339 | flag |= DAVINCI_I2C_MDR_XA; |
341 | if (!(msg->flags & I2C_M_RD)) | 340 | if (!(msg->flags & I2C_M_RD)) |
342 | flag |= DAVINCI_I2C_MDR_TRX; | 341 | flag |= DAVINCI_I2C_MDR_TRX; |
343 | if (stop) | 342 | if (msg->len == 0) |
344 | flag |= DAVINCI_I2C_MDR_STP; | ||
345 | if (msg->len == 0) { | ||
346 | flag |= DAVINCI_I2C_MDR_RM; | 343 | flag |= DAVINCI_I2C_MDR_RM; |
347 | flag &= ~DAVINCI_I2C_MDR_STP; | ||
348 | } | ||
349 | 344 | ||
350 | /* Enable receive or transmit interrupts */ | 345 | /* Enable receive or transmit interrupts */ |
351 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG); | 346 | w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG); |
@@ -357,7 +352,11 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
357 | 352 | ||
358 | dev->terminate = 0; | 353 | dev->terminate = 0; |
359 | 354 | ||
360 | /* write the data into mode register */ | 355 | /* |
356 | * Write mode register first as needed for correct behaviour | ||
357 | * on OMAP-L138, but don't set STT yet to avoid a race with XRDY | ||
358 | * occuring before we have loaded DXR | ||
359 | */ | ||
361 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | 360 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); |
362 | 361 | ||
363 | /* | 362 | /* |
@@ -365,12 +364,19 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) | |||
365 | * because transmit-data-ready interrupt can come before | 364 | * because transmit-data-ready interrupt can come before |
366 | * NACK-interrupt during sending of previous message and | 365 | * NACK-interrupt during sending of previous message and |
367 | * ICDXR may have wrong data | 366 | * ICDXR may have wrong data |
367 | * It also saves us one interrupt, slightly faster | ||
368 | */ | 368 | */ |
369 | if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) { | 369 | if ((!(msg->flags & I2C_M_RD)) && dev->buf_len) { |
370 | davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++); | 370 | davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG, *dev->buf++); |
371 | dev->buf_len--; | 371 | dev->buf_len--; |
372 | } | 372 | } |
373 | 373 | ||
374 | /* Set STT to begin transmit now DXR is loaded */ | ||
375 | flag |= DAVINCI_I2C_MDR_STT; | ||
376 | if (stop && msg->len != 0) | ||
377 | flag |= DAVINCI_I2C_MDR_STP; | ||
378 | davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag); | ||
379 | |||
374 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 380 | r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, |
375 | dev->adapter.timeout); | 381 | dev->adapter.timeout); |
376 | if (r == 0) { | 382 | if (r == 0) { |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 43ca32fddde..89eedf45d30 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -761,6 +761,9 @@ static int __devinit iic_probe(struct platform_device *ofdev, | |||
761 | dev_info(&ofdev->dev, "using %s mode\n", | 761 | dev_info(&ofdev->dev, "using %s mode\n", |
762 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); | 762 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); |
763 | 763 | ||
764 | /* Now register all the child nodes */ | ||
765 | of_i2c_register_devices(adap); | ||
766 | |||
764 | return 0; | 767 | return 0; |
765 | 768 | ||
766 | error_cleanup: | 769 | error_cleanup: |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index d1ff9408dc1..4c2a62b75b5 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -159,15 +159,9 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) | |||
159 | 159 | ||
160 | static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) | 160 | static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx) |
161 | { | 161 | { |
162 | int result; | 162 | wait_event_timeout(i2c_imx->queue, i2c_imx->i2csr & I2SR_IIF, HZ / 10); |
163 | |||
164 | result = wait_event_interruptible_timeout(i2c_imx->queue, | ||
165 | i2c_imx->i2csr & I2SR_IIF, HZ / 10); | ||
166 | 163 | ||
167 | if (unlikely(result < 0)) { | 164 | if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { |
168 | dev_dbg(&i2c_imx->adapter.dev, "<%s> result < 0\n", __func__); | ||
169 | return result; | ||
170 | } else if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) { | ||
171 | dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); | 165 | dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__); |
172 | return -ETIMEDOUT; | 166 | return -ETIMEDOUT; |
173 | } | 167 | } |
@@ -295,7 +289,7 @@ static irqreturn_t i2c_imx_isr(int irq, void *dev_id) | |||
295 | i2c_imx->i2csr = temp; | 289 | i2c_imx->i2csr = temp; |
296 | temp &= ~I2SR_IIF; | 290 | temp &= ~I2SR_IIF; |
297 | writeb(temp, i2c_imx->base + IMX_I2C_I2SR); | 291 | writeb(temp, i2c_imx->base + IMX_I2C_I2SR); |
298 | wake_up_interruptible(&i2c_imx->queue); | 292 | wake_up(&i2c_imx->queue); |
299 | return IRQ_HANDLED; | 293 | return IRQ_HANDLED; |
300 | } | 294 | } |
301 | 295 | ||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index a1c419a716a..b74e6dc6886 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -632,6 +632,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op, | |||
632 | dev_err(i2c->dev, "failed to add adapter\n"); | 632 | dev_err(i2c->dev, "failed to add adapter\n"); |
633 | goto fail_add; | 633 | goto fail_add; |
634 | } | 634 | } |
635 | of_i2c_register_devices(&i2c->adap); | ||
635 | 636 | ||
636 | return result; | 637 | return result; |
637 | 638 | ||
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c index 0e9f85d0a83..56dbe54e881 100644 --- a/drivers/i2c/busses/i2c-octeon.c +++ b/drivers/i2c/busses/i2c-octeon.c | |||
@@ -218,7 +218,7 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c) | |||
218 | return result; | 218 | return result; |
219 | } else if (result == 0) { | 219 | } else if (result == 0) { |
220 | dev_dbg(i2c->dev, "%s: timeout\n", __func__); | 220 | dev_dbg(i2c->dev, "%s: timeout\n", __func__); |
221 | result = -ETIMEDOUT; | 221 | return -ETIMEDOUT; |
222 | } | 222 | } |
223 | 223 | ||
224 | return 0; | 224 | return 0; |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index bbd77603a41..29933f87d8f 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -71,8 +71,8 @@ static int pca_isa_readbyte(void *pd, int reg) | |||
71 | 71 | ||
72 | static int pca_isa_waitforcompletion(void *pd) | 72 | static int pca_isa_waitforcompletion(void *pd) |
73 | { | 73 | { |
74 | long ret = ~0; | ||
75 | unsigned long timeout; | 74 | unsigned long timeout; |
75 | long ret; | ||
76 | 76 | ||
77 | if (irq > -1) { | 77 | if (irq > -1) { |
78 | ret = wait_event_timeout(pca_wait, | 78 | ret = wait_event_timeout(pca_wait, |
@@ -81,11 +81,15 @@ static int pca_isa_waitforcompletion(void *pd) | |||
81 | } else { | 81 | } else { |
82 | /* Do polling */ | 82 | /* Do polling */ |
83 | timeout = jiffies + pca_isa_ops.timeout; | 83 | timeout = jiffies + pca_isa_ops.timeout; |
84 | while (((pca_isa_readbyte(pd, I2C_PCA_CON) | 84 | do { |
85 | & I2C_PCA_CON_SI) == 0) | 85 | ret = time_before(jiffies, timeout); |
86 | && (ret = time_before(jiffies, timeout))) | 86 | if (pca_isa_readbyte(pd, I2C_PCA_CON) |
87 | & I2C_PCA_CON_SI) | ||
88 | break; | ||
87 | udelay(100); | 89 | udelay(100); |
90 | } while (ret); | ||
88 | } | 91 | } |
92 | |||
89 | return ret > 0; | 93 | return ret > 0; |
90 | } | 94 | } |
91 | 95 | ||
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index ef5c78487eb..5f6d7f89e22 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
@@ -80,8 +80,8 @@ static void i2c_pca_pf_writebyte32(void *pd, int reg, int val) | |||
80 | static int i2c_pca_pf_waitforcompletion(void *pd) | 80 | static int i2c_pca_pf_waitforcompletion(void *pd) |
81 | { | 81 | { |
82 | struct i2c_pca_pf_data *i2c = pd; | 82 | struct i2c_pca_pf_data *i2c = pd; |
83 | long ret = ~0; | ||
84 | unsigned long timeout; | 83 | unsigned long timeout; |
84 | long ret; | ||
85 | 85 | ||
86 | if (i2c->irq) { | 86 | if (i2c->irq) { |
87 | ret = wait_event_timeout(i2c->wait, | 87 | ret = wait_event_timeout(i2c->wait, |
@@ -90,10 +90,13 @@ static int i2c_pca_pf_waitforcompletion(void *pd) | |||
90 | } else { | 90 | } else { |
91 | /* Do polling */ | 91 | /* Do polling */ |
92 | timeout = jiffies + i2c->adap.timeout; | 92 | timeout = jiffies + i2c->adap.timeout; |
93 | while (((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) | 93 | do { |
94 | & I2C_PCA_CON_SI) == 0) | 94 | ret = time_before(jiffies, timeout); |
95 | && (ret = time_before(jiffies, timeout))) | 95 | if (i2c->algo_data.read_byte(i2c, I2C_PCA_CON) |
96 | & I2C_PCA_CON_SI) | ||
97 | break; | ||
96 | udelay(100); | 98 | udelay(100); |
99 | } while (ret); | ||
97 | } | 100 | } |
98 | 101 | ||
99 | return ret > 0; | 102 | return ret > 0; |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 72902e0bbfa..bf831bf8158 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -662,8 +662,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) | |||
662 | unsigned long sda_delay; | 662 | unsigned long sda_delay; |
663 | 663 | ||
664 | if (pdata->sda_delay) { | 664 | if (pdata->sda_delay) { |
665 | sda_delay = (freq / 1000) * pdata->sda_delay; | 665 | sda_delay = clkin * pdata->sda_delay; |
666 | sda_delay /= 1000000; | 666 | sda_delay = DIV_ROUND_UP(sda_delay, 1000000); |
667 | sda_delay = DIV_ROUND_UP(sda_delay, 5); | 667 | sda_delay = DIV_ROUND_UP(sda_delay, 5); |
668 | if (sda_delay > 3) | 668 | if (sda_delay > 3) |
669 | sda_delay = 3; | 669 | sda_delay = 3; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6649176de94..bea4c5021d2 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/idr.h> | 33 | #include <linux/idr.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/of_i2c.h> | ||
36 | #include <linux/of_device.h> | 35 | #include <linux/of_device.h> |
37 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
38 | #include <linux/hardirq.h> | 37 | #include <linux/hardirq.h> |
@@ -197,11 +196,12 @@ static int i2c_device_pm_suspend(struct device *dev) | |||
197 | { | 196 | { |
198 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 197 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
199 | 198 | ||
200 | if (pm_runtime_suspended(dev)) | 199 | if (pm) { |
201 | return 0; | 200 | if (pm_runtime_suspended(dev)) |
202 | 201 | return 0; | |
203 | if (pm) | 202 | else |
204 | return pm->suspend ? pm->suspend(dev) : 0; | 203 | return pm->suspend ? pm->suspend(dev) : 0; |
204 | } | ||
205 | 205 | ||
206 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); | 206 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); |
207 | } | 207 | } |
@@ -216,12 +216,6 @@ static int i2c_device_pm_resume(struct device *dev) | |||
216 | else | 216 | else |
217 | ret = i2c_legacy_resume(dev); | 217 | ret = i2c_legacy_resume(dev); |
218 | 218 | ||
219 | if (!ret) { | ||
220 | pm_runtime_disable(dev); | ||
221 | pm_runtime_set_active(dev); | ||
222 | pm_runtime_enable(dev); | ||
223 | } | ||
224 | |||
225 | return ret; | 219 | return ret; |
226 | } | 220 | } |
227 | 221 | ||
@@ -229,11 +223,12 @@ static int i2c_device_pm_freeze(struct device *dev) | |||
229 | { | 223 | { |
230 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 224 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
231 | 225 | ||
232 | if (pm_runtime_suspended(dev)) | 226 | if (pm) { |
233 | return 0; | 227 | if (pm_runtime_suspended(dev)) |
234 | 228 | return 0; | |
235 | if (pm) | 229 | else |
236 | return pm->freeze ? pm->freeze(dev) : 0; | 230 | return pm->freeze ? pm->freeze(dev) : 0; |
231 | } | ||
237 | 232 | ||
238 | return i2c_legacy_suspend(dev, PMSG_FREEZE); | 233 | return i2c_legacy_suspend(dev, PMSG_FREEZE); |
239 | } | 234 | } |
@@ -242,11 +237,12 @@ static int i2c_device_pm_thaw(struct device *dev) | |||
242 | { | 237 | { |
243 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 238 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
244 | 239 | ||
245 | if (pm_runtime_suspended(dev)) | 240 | if (pm) { |
246 | return 0; | 241 | if (pm_runtime_suspended(dev)) |
247 | 242 | return 0; | |
248 | if (pm) | 243 | else |
249 | return pm->thaw ? pm->thaw(dev) : 0; | 244 | return pm->thaw ? pm->thaw(dev) : 0; |
245 | } | ||
250 | 246 | ||
251 | return i2c_legacy_resume(dev); | 247 | return i2c_legacy_resume(dev); |
252 | } | 248 | } |
@@ -255,11 +251,12 @@ static int i2c_device_pm_poweroff(struct device *dev) | |||
255 | { | 251 | { |
256 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 252 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
257 | 253 | ||
258 | if (pm_runtime_suspended(dev)) | 254 | if (pm) { |
259 | return 0; | 255 | if (pm_runtime_suspended(dev)) |
260 | 256 | return 0; | |
261 | if (pm) | 257 | else |
262 | return pm->poweroff ? pm->poweroff(dev) : 0; | 258 | return pm->poweroff ? pm->poweroff(dev) : 0; |
259 | } | ||
263 | 260 | ||
264 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); | 261 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); |
265 | } | 262 | } |
@@ -876,9 +873,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
876 | if (adap->nr < __i2c_first_dynamic_bus_num) | 873 | if (adap->nr < __i2c_first_dynamic_bus_num) |
877 | i2c_scan_static_board_info(adap); | 874 | i2c_scan_static_board_info(adap); |
878 | 875 | ||
879 | /* Register devices from the device tree */ | ||
880 | of_i2c_register_devices(adap); | ||
881 | |||
882 | /* Notify drivers */ | 876 | /* Notify drivers */ |
883 | mutex_lock(&core_lock); | 877 | mutex_lock(&core_lock); |
884 | bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); | 878 | bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index a10152bb142..c37ef64d146 100755..100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -83,7 +83,7 @@ static unsigned int mwait_substates; | |||
83 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ | 83 | /* Reliable LAPIC Timer States, bit 1 for C1 etc. */ |
84 | static unsigned int lapic_timer_reliable_states; | 84 | static unsigned int lapic_timer_reliable_states; |
85 | 85 | ||
86 | static struct cpuidle_device *intel_idle_cpuidle_devices; | 86 | static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; |
87 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); | 87 | static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); |
88 | 88 | ||
89 | static struct cpuidle_state *cpuidle_state_table; | 89 | static struct cpuidle_state *cpuidle_state_table; |
@@ -108,7 +108,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
108 | .name = "NHM-C3", | 108 | .name = "NHM-C3", |
109 | .desc = "MWAIT 0x10", | 109 | .desc = "MWAIT 0x10", |
110 | .driver_data = (void *) 0x10, | 110 | .driver_data = (void *) 0x10, |
111 | .flags = CPUIDLE_FLAG_TIME_VALID, | 111 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
112 | .exit_latency = 20, | 112 | .exit_latency = 20, |
113 | .power_usage = 500, | 113 | .power_usage = 500, |
114 | .target_residency = 80, | 114 | .target_residency = 80, |
@@ -117,7 +117,7 @@ static struct cpuidle_state nehalem_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
117 | .name = "NHM-C6", | 117 | .name = "NHM-C6", |
118 | .desc = "MWAIT 0x20", | 118 | .desc = "MWAIT 0x20", |
119 | .driver_data = (void *) 0x20, | 119 | .driver_data = (void *) 0x20, |
120 | .flags = CPUIDLE_FLAG_TIME_VALID, | 120 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
121 | .exit_latency = 200, | 121 | .exit_latency = 200, |
122 | .power_usage = 350, | 122 | .power_usage = 350, |
123 | .target_residency = 800, | 123 | .target_residency = 800, |
@@ -149,7 +149,7 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
149 | .name = "ATM-C4", | 149 | .name = "ATM-C4", |
150 | .desc = "MWAIT 0x30", | 150 | .desc = "MWAIT 0x30", |
151 | .driver_data = (void *) 0x30, | 151 | .driver_data = (void *) 0x30, |
152 | .flags = CPUIDLE_FLAG_TIME_VALID, | 152 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
153 | .exit_latency = 100, | 153 | .exit_latency = 100, |
154 | .power_usage = 250, | 154 | .power_usage = 250, |
155 | .target_residency = 400, | 155 | .target_residency = 400, |
@@ -157,13 +157,13 @@ static struct cpuidle_state atom_cstates[MWAIT_MAX_NUM_CSTATES] = { | |||
157 | { /* MWAIT C5 */ }, | 157 | { /* MWAIT C5 */ }, |
158 | { /* MWAIT C6 */ | 158 | { /* MWAIT C6 */ |
159 | .name = "ATM-C6", | 159 | .name = "ATM-C6", |
160 | .desc = "MWAIT 0x40", | 160 | .desc = "MWAIT 0x52", |
161 | .driver_data = (void *) 0x40, | 161 | .driver_data = (void *) 0x52, |
162 | .flags = CPUIDLE_FLAG_TIME_VALID, | 162 | .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED, |
163 | .exit_latency = 200, | 163 | .exit_latency = 140, |
164 | .power_usage = 150, | 164 | .power_usage = 150, |
165 | .target_residency = 800, | 165 | .target_residency = 560, |
166 | .enter = NULL }, /* disabled */ | 166 | .enter = &intel_idle }, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | /** | 169 | /** |
@@ -185,6 +185,16 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state) | |||
185 | 185 | ||
186 | local_irq_disable(); | 186 | local_irq_disable(); |
187 | 187 | ||
188 | /* | ||
189 | * If the state flag indicates that the TLB will be flushed or if this | ||
190 | * is the deepest c-state supported, do a voluntary leave mm to avoid | ||
191 | * costly and mostly unnecessary wakeups for flushing the user TLB's | ||
192 | * associated with the active mm. | ||
193 | */ | ||
194 | if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED || | ||
195 | (&dev->states[dev->state_count - 1] == state)) | ||
196 | leave_mm(cpu); | ||
197 | |||
188 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) | 198 | if (!(lapic_timer_reliable_states & (1 << (cstate)))) |
189 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | 199 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); |
190 | 200 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index c908c5f8364..9ddafc30f43 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -669,6 +669,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
669 | 669 | ||
670 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { | 670 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) { |
671 | 671 | ||
672 | if (!dev->absinfo) | ||
673 | return -EINVAL; | ||
674 | |||
672 | t = _IOC_NR(cmd) & ABS_MAX; | 675 | t = _IOC_NR(cmd) & ABS_MAX; |
673 | abs = dev->absinfo[t]; | 676 | abs = dev->absinfo[t]; |
674 | 677 | ||
@@ -680,10 +683,13 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
680 | } | 683 | } |
681 | } | 684 | } |
682 | 685 | ||
683 | if (_IOC_DIR(cmd) == _IOC_READ) { | 686 | if (_IOC_DIR(cmd) == _IOC_WRITE) { |
684 | 687 | ||
685 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { | 688 | if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) { |
686 | 689 | ||
690 | if (!dev->absinfo) | ||
691 | return -EINVAL; | ||
692 | |||
687 | t = _IOC_NR(cmd) & ABS_MAX; | 693 | t = _IOC_NR(cmd) & ABS_MAX; |
688 | 694 | ||
689 | if (copy_from_user(&abs, p, min_t(size_t, | 695 | if (copy_from_user(&abs, p, min_t(size_t, |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index d85bd8a7967..22239e98849 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -483,6 +483,9 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev, | |||
483 | 483 | ||
484 | memcpy(joydev->abspam, abspam, len); | 484 | memcpy(joydev->abspam, abspam, len); |
485 | 485 | ||
486 | for (i = 0; i < joydev->nabs; i++) | ||
487 | joydev->absmap[joydev->abspam[i]] = i; | ||
488 | |||
486 | out: | 489 | out: |
487 | kfree(abspam); | 490 | kfree(abspam); |
488 | return retval; | 491 | return retval; |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 0d4266a533a..360698553eb 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -404,6 +404,13 @@ static int uinput_setup_device(struct uinput_device *udev, const char __user *bu | |||
404 | retval = uinput_validate_absbits(dev); | 404 | retval = uinput_validate_absbits(dev); |
405 | if (retval < 0) | 405 | if (retval < 0) |
406 | goto exit; | 406 | goto exit; |
407 | if (test_bit(ABS_MT_SLOT, dev->absbit)) { | ||
408 | int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1; | ||
409 | input_mt_create_slots(dev, nslot); | ||
410 | input_set_events_per_packet(dev, 6 * nslot); | ||
411 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { | ||
412 | input_set_events_per_packet(dev, 60); | ||
413 | } | ||
407 | } | 414 | } |
408 | 415 | ||
409 | udev->state = UIST_SETUP_COMPLETE; | 416 | udev->state = UIST_SETUP_COMPLETE; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 42ba3691d90..b35876ee690 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -103,27 +103,26 @@ static void wacom_sys_irq(struct urb *urb) | |||
103 | static int wacom_open(struct input_dev *dev) | 103 | static int wacom_open(struct input_dev *dev) |
104 | { | 104 | { |
105 | struct wacom *wacom = input_get_drvdata(dev); | 105 | struct wacom *wacom = input_get_drvdata(dev); |
106 | int retval = 0; | ||
106 | 107 | ||
107 | mutex_lock(&wacom->lock); | 108 | if (usb_autopm_get_interface(wacom->intf) < 0) |
108 | |||
109 | wacom->irq->dev = wacom->usbdev; | ||
110 | |||
111 | if (usb_autopm_get_interface(wacom->intf) < 0) { | ||
112 | mutex_unlock(&wacom->lock); | ||
113 | return -EIO; | 109 | return -EIO; |
114 | } | 110 | |
111 | mutex_lock(&wacom->lock); | ||
115 | 112 | ||
116 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | 113 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { |
117 | usb_autopm_put_interface(wacom->intf); | 114 | retval = -EIO; |
118 | mutex_unlock(&wacom->lock); | 115 | goto out; |
119 | return -EIO; | ||
120 | } | 116 | } |
121 | 117 | ||
122 | wacom->open = true; | 118 | wacom->open = true; |
123 | wacom->intf->needs_remote_wakeup = 1; | 119 | wacom->intf->needs_remote_wakeup = 1; |
124 | 120 | ||
121 | out: | ||
125 | mutex_unlock(&wacom->lock); | 122 | mutex_unlock(&wacom->lock); |
126 | return 0; | 123 | if (retval) |
124 | usb_autopm_put_interface(wacom->intf); | ||
125 | return retval; | ||
127 | } | 126 | } |
128 | 127 | ||
129 | static void wacom_close(struct input_dev *dev) | 128 | static void wacom_close(struct input_dev *dev) |
@@ -135,6 +134,8 @@ static void wacom_close(struct input_dev *dev) | |||
135 | wacom->open = false; | 134 | wacom->open = false; |
136 | wacom->intf->needs_remote_wakeup = 0; | 135 | wacom->intf->needs_remote_wakeup = 0; |
137 | mutex_unlock(&wacom->lock); | 136 | mutex_unlock(&wacom->lock); |
137 | |||
138 | usb_autopm_put_interface(wacom->intf); | ||
138 | } | 139 | } |
139 | 140 | ||
140 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, | 141 | static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 6e29badb969..47fd7a041c5 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -442,8 +442,10 @@ static void wacom_intuos_general(struct wacom_wac *wacom) | |||
442 | /* general pen packet */ | 442 | /* general pen packet */ |
443 | if ((data[1] & 0xb8) == 0xa0) { | 443 | if ((data[1] & 0xb8) == 0xa0) { |
444 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 444 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
445 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) | 445 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || |
446 | features->type == WACOM_21UX2) { | ||
446 | t = (t << 1) | (data[1] & 1); | 447 | t = (t << 1) | (data[1] & 1); |
448 | } | ||
447 | input_report_abs(input, ABS_PRESSURE, t); | 449 | input_report_abs(input, ABS_PRESSURE, t); |
448 | input_report_abs(input, ABS_TILT_X, | 450 | input_report_abs(input, ABS_TILT_X, |
449 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); | 451 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
diff --git a/drivers/isdn/sc/interrupt.c b/drivers/isdn/sc/interrupt.c index 485be8b1e1b..f0225bc0f26 100644 --- a/drivers/isdn/sc/interrupt.c +++ b/drivers/isdn/sc/interrupt.c | |||
@@ -112,11 +112,19 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
112 | } | 112 | } |
113 | else if(callid>=0x0000 && callid<=0x7FFF) | 113 | else if(callid>=0x0000 && callid<=0x7FFF) |
114 | { | 114 | { |
115 | int len; | ||
116 | |||
115 | pr_debug("%s: Got Incoming Call\n", | 117 | pr_debug("%s: Got Incoming Call\n", |
116 | sc_adapter[card]->devicename); | 118 | sc_adapter[card]->devicename); |
117 | strcpy(setup.phone,&(rcvmsg.msg_data.byte_array[4])); | 119 | len = strlcpy(setup.phone, &(rcvmsg.msg_data.byte_array[4]), |
118 | strcpy(setup.eazmsn, | 120 | sizeof(setup.phone)); |
119 | sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn); | 121 | if (len >= sizeof(setup.phone)) |
122 | continue; | ||
123 | len = strlcpy(setup.eazmsn, | ||
124 | sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, | ||
125 | sizeof(setup.eazmsn)); | ||
126 | if (len >= sizeof(setup.eazmsn)) | ||
127 | continue; | ||
120 | setup.si1 = 7; | 128 | setup.si1 = 7; |
121 | setup.si2 = 0; | 129 | setup.si2 = 0; |
122 | setup.plan = 0; | 130 | setup.plan = 0; |
@@ -176,7 +184,9 @@ irqreturn_t interrupt_handler(int dummy, void *card_inst) | |||
176 | * Handle a GetMyNumber Rsp | 184 | * Handle a GetMyNumber Rsp |
177 | */ | 185 | */ |
178 | if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ | 186 | if (IS_CE_MESSAGE(rcvmsg,Call,0,GetMyNumber)){ |
179 | strcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no-1].dn,rcvmsg.msg_data.byte_array); | 187 | strlcpy(sc_adapter[card]->channel[rcvmsg.phy_link_no - 1].dn, |
188 | rcvmsg.msg_data.byte_array, | ||
189 | sizeof(rcvmsg.msg_data.byte_array)); | ||
180 | continue; | 190 | continue; |
181 | } | 191 | } |
182 | 192 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index ed4900ade93..e4fb58db545 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1000,10 +1000,11 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
1000 | page = bitmap->sb_page; | 1000 | page = bitmap->sb_page; |
1001 | offset = sizeof(bitmap_super_t); | 1001 | offset = sizeof(bitmap_super_t); |
1002 | if (!file) | 1002 | if (!file) |
1003 | read_sb_page(bitmap->mddev, | 1003 | page = read_sb_page( |
1004 | bitmap->mddev->bitmap_info.offset, | 1004 | bitmap->mddev, |
1005 | page, | 1005 | bitmap->mddev->bitmap_info.offset, |
1006 | index, count); | 1006 | page, |
1007 | index, count); | ||
1007 | } else if (file) { | 1008 | } else if (file) { |
1008 | page = read_page(file, index, bitmap, count); | 1009 | page = read_page(file, index, bitmap, count); |
1009 | offset = 0; | 1010 | offset = 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ad83a4dcadc..0b830bbe1d8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1839,7 +1839,9 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1839 | 1839 | ||
1840 | /* take from bio_init */ | 1840 | /* take from bio_init */ |
1841 | bio->bi_next = NULL; | 1841 | bio->bi_next = NULL; |
1842 | bio->bi_flags &= ~(BIO_POOL_MASK-1); | ||
1842 | bio->bi_flags |= 1 << BIO_UPTODATE; | 1843 | bio->bi_flags |= 1 << BIO_UPTODATE; |
1844 | bio->bi_comp_cpu = -1; | ||
1843 | bio->bi_rw = READ; | 1845 | bio->bi_rw = READ; |
1844 | bio->bi_vcnt = 0; | 1846 | bio->bi_vcnt = 0; |
1845 | bio->bi_idx = 0; | 1847 | bio->bi_idx = 0; |
@@ -1912,7 +1914,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1912 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 1914 | !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
1913 | break; | 1915 | break; |
1914 | BUG_ON(sync_blocks < (PAGE_SIZE>>9)); | 1916 | BUG_ON(sync_blocks < (PAGE_SIZE>>9)); |
1915 | if (len > (sync_blocks<<9)) | 1917 | if ((len >> 9) > sync_blocks) |
1916 | len = sync_blocks<<9; | 1918 | len = sync_blocks<<9; |
1917 | } | 1919 | } |
1918 | 1920 | ||
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 7e82a9df726..7961d59f5ca 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -319,7 +319,7 @@ static void ir_timer_keyup(unsigned long cookie) | |||
319 | * a keyup event might follow immediately after the keydown. | 319 | * a keyup event might follow immediately after the keydown. |
320 | */ | 320 | */ |
321 | spin_lock_irqsave(&ir->keylock, flags); | 321 | spin_lock_irqsave(&ir->keylock, flags); |
322 | if (time_is_after_eq_jiffies(ir->keyup_jiffies)) | 322 | if (time_is_before_eq_jiffies(ir->keyup_jiffies)) |
323 | ir_keyup(ir); | 323 | ir_keyup(ir); |
324 | spin_unlock_irqrestore(&ir->keylock, flags); | 324 | spin_unlock_irqrestore(&ir->keylock, flags); |
325 | } | 325 | } |
@@ -510,6 +510,13 @@ int __ir_input_register(struct input_dev *input_dev, | |||
510 | (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? | 510 | (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? |
511 | " in raw mode" : ""); | 511 | " in raw mode" : ""); |
512 | 512 | ||
513 | /* | ||
514 | * Default delay of 250ms is too short for some protocols, expecially | ||
515 | * since the timeout is currently set to 250ms. Increase it to 500ms, | ||
516 | * to avoid wrong repetition of the keycodes. | ||
517 | */ | ||
518 | input_dev->rep[REP_DELAY] = 500; | ||
519 | |||
513 | return 0; | 520 | return 0; |
514 | 521 | ||
515 | out_event: | 522 | out_event: |
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index 77b5946413c..e63f757d5d7 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c | |||
@@ -267,7 +267,7 @@ static int ir_lirc_register(struct input_dev *input_dev) | |||
267 | features |= LIRC_CAN_SET_SEND_CARRIER; | 267 | features |= LIRC_CAN_SET_SEND_CARRIER; |
268 | 268 | ||
269 | if (ir_dev->props->s_tx_duty_cycle) | 269 | if (ir_dev->props->s_tx_duty_cycle) |
270 | features |= LIRC_CAN_SET_REC_DUTY_CYCLE; | 270 | features |= LIRC_CAN_SET_SEND_DUTY_CYCLE; |
271 | } | 271 | } |
272 | 272 | ||
273 | if (ir_dev->props->s_rx_carrier_range) | 273 | if (ir_dev->props->s_rx_carrier_range) |
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 43094e7eccf..8e0e1b1f8c8 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c | |||
@@ -279,9 +279,11 @@ int ir_raw_event_register(struct input_dev *input_dev) | |||
279 | "rc%u", (unsigned int)ir->devno); | 279 | "rc%u", (unsigned int)ir->devno); |
280 | 280 | ||
281 | if (IS_ERR(ir->raw->thread)) { | 281 | if (IS_ERR(ir->raw->thread)) { |
282 | int ret = PTR_ERR(ir->raw->thread); | ||
283 | |||
282 | kfree(ir->raw); | 284 | kfree(ir->raw); |
283 | ir->raw = NULL; | 285 | ir->raw = NULL; |
284 | return PTR_ERR(ir->raw->thread); | 286 | return ret; |
285 | } | 287 | } |
286 | 288 | ||
287 | mutex_lock(&ir_raw_handler_lock); | 289 | mutex_lock(&ir_raw_handler_lock); |
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 96dafc425c8..46d42467f9b 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c | |||
@@ -67,13 +67,14 @@ static ssize_t show_protocols(struct device *d, | |||
67 | char *tmp = buf; | 67 | char *tmp = buf; |
68 | int i; | 68 | int i; |
69 | 69 | ||
70 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | 70 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { |
71 | enabled = ir_dev->rc_tab.ir_type; | 71 | enabled = ir_dev->rc_tab.ir_type; |
72 | allowed = ir_dev->props->allowed_protos; | 72 | allowed = ir_dev->props->allowed_protos; |
73 | } else { | 73 | } else if (ir_dev->raw) { |
74 | enabled = ir_dev->raw->enabled_protocols; | 74 | enabled = ir_dev->raw->enabled_protocols; |
75 | allowed = ir_raw_get_allowed_protocols(); | 75 | allowed = ir_raw_get_allowed_protocols(); |
76 | } | 76 | } else |
77 | return sprintf(tmp, "[builtin]\n"); | ||
77 | 78 | ||
78 | IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", | 79 | IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", |
79 | (long long)allowed, | 80 | (long long)allowed, |
@@ -121,10 +122,14 @@ static ssize_t store_protocols(struct device *d, | |||
121 | int rc, i, count = 0; | 122 | int rc, i, count = 0; |
122 | unsigned long flags; | 123 | unsigned long flags; |
123 | 124 | ||
124 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) | 125 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) |
125 | type = ir_dev->rc_tab.ir_type; | 126 | type = ir_dev->rc_tab.ir_type; |
126 | else | 127 | else if (ir_dev->raw) |
127 | type = ir_dev->raw->enabled_protocols; | 128 | type = ir_dev->raw->enabled_protocols; |
129 | else { | ||
130 | IR_dprintk(1, "Protocol switching not supported\n"); | ||
131 | return -EINVAL; | ||
132 | } | ||
128 | 133 | ||
129 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { | 134 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { |
130 | if (!*tmp) | 135 | if (!*tmp) |
@@ -185,7 +190,7 @@ static ssize_t store_protocols(struct device *d, | |||
185 | } | 190 | } |
186 | } | 191 | } |
187 | 192 | ||
188 | if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | 193 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { |
189 | spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); | 194 | spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); |
190 | ir_dev->rc_tab.ir_type = type; | 195 | ir_dev->rc_tab.ir_type = type; |
191 | spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); | 196 | spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); |
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c index 64264f7f838..39557ad401b 100644 --- a/drivers/media/IR/keymaps/rc-rc6-mce.c +++ b/drivers/media/IR/keymaps/rc-rc6-mce.c | |||
@@ -19,6 +19,7 @@ static struct ir_scancode rc6_mce[] = { | |||
19 | 19 | ||
20 | { 0x800f0416, KEY_PLAY }, | 20 | { 0x800f0416, KEY_PLAY }, |
21 | { 0x800f0418, KEY_PAUSE }, | 21 | { 0x800f0418, KEY_PAUSE }, |
22 | { 0x800f046e, KEY_PLAYPAUSE }, | ||
22 | { 0x800f0419, KEY_STOP }, | 23 | { 0x800f0419, KEY_STOP }, |
23 | { 0x800f0417, KEY_RECORD }, | 24 | { 0x800f0417, KEY_RECORD }, |
24 | 25 | ||
@@ -37,6 +38,8 @@ static struct ir_scancode rc6_mce[] = { | |||
37 | { 0x800f0411, KEY_VOLUMEDOWN }, | 38 | { 0x800f0411, KEY_VOLUMEDOWN }, |
38 | { 0x800f0412, KEY_CHANNELUP }, | 39 | { 0x800f0412, KEY_CHANNELUP }, |
39 | { 0x800f0413, KEY_CHANNELDOWN }, | 40 | { 0x800f0413, KEY_CHANNELDOWN }, |
41 | { 0x800f043a, KEY_BRIGHTNESSUP }, | ||
42 | { 0x800f0480, KEY_BRIGHTNESSDOWN }, | ||
40 | 43 | ||
41 | { 0x800f0401, KEY_NUMERIC_1 }, | 44 | { 0x800f0401, KEY_NUMERIC_1 }, |
42 | { 0x800f0402, KEY_NUMERIC_2 }, | 45 | { 0x800f0402, KEY_NUMERIC_2 }, |
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c index ac6bb2c01a4..bc620e10ef7 100644 --- a/drivers/media/IR/mceusb.c +++ b/drivers/media/IR/mceusb.c | |||
@@ -120,6 +120,10 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
120 | { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, | 120 | { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, |
121 | /* Philips eHome Infrared Transceiver */ | 121 | /* Philips eHome Infrared Transceiver */ |
122 | { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, | 122 | { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, |
123 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
124 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | ||
125 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
126 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | ||
123 | /* Realtek MCE IR Receiver */ | 127 | /* Realtek MCE IR Receiver */ |
124 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, | 128 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, |
125 | /* SMK/Toshiba G83C0004D410 */ | 129 | /* SMK/Toshiba G83C0004D410 */ |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index fe818348b8a..48397f103d3 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
@@ -673,9 +673,6 @@ static int dib0700_probe(struct usb_interface *intf, | |||
673 | else | 673 | else |
674 | dev->props.rc.core.bulk_mode = false; | 674 | dev->props.rc.core.bulk_mode = false; |
675 | 675 | ||
676 | /* Need a higher delay, to avoid wrong repeat */ | ||
677 | dev->rc_input_dev->rep[REP_DELAY] = 500; | ||
678 | |||
679 | dib0700_rc_setup(dev); | 676 | dib0700_rc_setup(dev); |
680 | 677 | ||
681 | return 0; | 678 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index f634d2e784b..e06acd1fecb 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -940,6 +940,58 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) | |||
940 | return adap->fe == NULL ? -ENODEV : 0; | 940 | return adap->fe == NULL ? -ENODEV : 0; |
941 | } | 941 | } |
942 | 942 | ||
943 | /* STK7770P */ | ||
944 | static struct dib7000p_config dib7770p_dib7000p_config = { | ||
945 | .output_mpeg2_in_188_bytes = 1, | ||
946 | |||
947 | .agc_config_count = 1, | ||
948 | .agc = &dib7070_agc_config, | ||
949 | .bw = &dib7070_bw_config_12_mhz, | ||
950 | .tuner_is_baseband = 1, | ||
951 | .spur_protect = 1, | ||
952 | |||
953 | .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, | ||
954 | .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, | ||
955 | .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, | ||
956 | |||
957 | .hostbus_diversity = 1, | ||
958 | .enable_current_mirror = 1, | ||
959 | .disable_sample_and_hold = 0, | ||
960 | }; | ||
961 | |||
962 | static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap) | ||
963 | { | ||
964 | struct usb_device_descriptor *p = &adap->dev->udev->descriptor; | ||
965 | if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) && | ||
966 | p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E)) | ||
967 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); | ||
968 | else | ||
969 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); | ||
970 | msleep(10); | ||
971 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); | ||
972 | dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); | ||
973 | dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); | ||
974 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); | ||
975 | |||
976 | dib0700_ctrl_clock(adap->dev, 72, 1); | ||
977 | |||
978 | msleep(10); | ||
979 | dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); | ||
980 | msleep(10); | ||
981 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); | ||
982 | |||
983 | if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, | ||
984 | &dib7770p_dib7000p_config) != 0) { | ||
985 | err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", | ||
986 | __func__); | ||
987 | return -ENODEV; | ||
988 | } | ||
989 | |||
990 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, | ||
991 | &dib7770p_dib7000p_config); | ||
992 | return adap->fe == NULL ? -ENODEV : 0; | ||
993 | } | ||
994 | |||
943 | /* DIB807x generic */ | 995 | /* DIB807x generic */ |
944 | static struct dibx000_agc_config dib807x_agc_config[2] = { | 996 | static struct dibx000_agc_config dib807x_agc_config[2] = { |
945 | { | 997 | { |
@@ -1781,7 +1833,7 @@ struct usb_device_id dib0700_usb_id_table[] = { | |||
1781 | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, | 1833 | /* 60 */{ USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_XXS_2) }, |
1782 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, | 1834 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XPVR) }, |
1783 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, | 1835 | { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK807XP) }, |
1784 | { USB_DEVICE(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD) }, | 1836 | { USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x000, 0x3f00) }, |
1785 | { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, | 1837 | { USB_DEVICE(USB_VID_EVOLUTEPC, USB_PID_TVWAY_PLUS) }, |
1786 | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, | 1838 | /* 65 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73ESE) }, |
1787 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, | 1839 | { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV282E) }, |
@@ -2406,7 +2458,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
2406 | .pid_filter_count = 32, | 2458 | .pid_filter_count = 32, |
2407 | .pid_filter = stk70x0p_pid_filter, | 2459 | .pid_filter = stk70x0p_pid_filter, |
2408 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 2460 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, |
2409 | .frontend_attach = stk7070p_frontend_attach, | 2461 | .frontend_attach = stk7770p_frontend_attach, |
2410 | .tuner_attach = dib7770p_tuner_attach, | 2462 | .tuner_attach = dib7770p_tuner_attach, |
2411 | 2463 | ||
2412 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | 2464 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 6b22ec64ab0..f896337b453 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -483,9 +483,7 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
483 | } | 483 | } |
484 | } | 484 | } |
485 | kfree(p); | 485 | kfree(p); |
486 | if (fw) { | 486 | release_firmware(fw); |
487 | release_firmware(fw); | ||
488 | } | ||
489 | return ret; | 487 | return ret; |
490 | } | 488 | } |
491 | 489 | ||
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c index 2e28b973dfd..3aed0d43392 100644 --- a/drivers/media/dvb/frontends/dib7000p.c +++ b/drivers/media/dvb/frontends/dib7000p.c | |||
@@ -260,6 +260,9 @@ static void dib7000p_set_adc_state(struct dib7000p_state *state, enum dibx000_ad | |||
260 | 260 | ||
261 | // dprintk( "908: %x, 909: %x\n", reg_908, reg_909); | 261 | // dprintk( "908: %x, 909: %x\n", reg_908, reg_909); |
262 | 262 | ||
263 | reg_909 |= (state->cfg.disable_sample_and_hold & 1) << 4; | ||
264 | reg_908 |= (state->cfg.enable_current_mirror & 1) << 7; | ||
265 | |||
263 | dib7000p_write_word(state, 908, reg_908); | 266 | dib7000p_write_word(state, 908, reg_908); |
264 | dib7000p_write_word(state, 909, reg_909); | 267 | dib7000p_write_word(state, 909, reg_909); |
265 | } | 268 | } |
@@ -778,7 +781,10 @@ static void dib7000p_set_channel(struct dib7000p_state *state, struct dvb_fronte | |||
778 | default: | 781 | default: |
779 | case GUARD_INTERVAL_1_32: value *= 1; break; | 782 | case GUARD_INTERVAL_1_32: value *= 1; break; |
780 | } | 783 | } |
781 | state->div_sync_wait = (value * 3) / 2 + 32; // add 50% SFN margin + compensate for one DVSY-fifo TODO | 784 | if (state->cfg.diversity_delay == 0) |
785 | state->div_sync_wait = (value * 3) / 2 + 48; // add 50% SFN margin + compensate for one DVSY-fifo | ||
786 | else | ||
787 | state->div_sync_wait = (value * 3) / 2 + state->cfg.diversity_delay; // add 50% SFN margin + compensate for one DVSY-fifo | ||
782 | 788 | ||
783 | /* deactive the possibility of diversity reception if extended interleaver */ | 789 | /* deactive the possibility of diversity reception if extended interleaver */ |
784 | state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K; | 790 | state->div_force_off = !1 && ch->u.ofdm.transmission_mode != TRANSMISSION_MODE_8K; |
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h index 805dd13a97e..da17345bf5b 100644 --- a/drivers/media/dvb/frontends/dib7000p.h +++ b/drivers/media/dvb/frontends/dib7000p.h | |||
@@ -33,6 +33,11 @@ struct dib7000p_config { | |||
33 | int (*agc_control) (struct dvb_frontend *, u8 before); | 33 | int (*agc_control) (struct dvb_frontend *, u8 before); |
34 | 34 | ||
35 | u8 output_mode; | 35 | u8 output_mode; |
36 | u8 disable_sample_and_hold : 1; | ||
37 | |||
38 | u8 enable_current_mirror : 1; | ||
39 | u8 diversity_delay; | ||
40 | |||
36 | }; | 41 | }; |
37 | 42 | ||
38 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 | 43 | #define DEFAULT_DIB7000P_I2C_ADDRESS 18 |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index d93468cd3a8..ff3b0fa901b 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
@@ -1098,33 +1098,26 @@ EXPORT_SYMBOL_GPL(smscore_onresponse); | |||
1098 | * | 1098 | * |
1099 | * @return pointer to descriptor on success, NULL on error. | 1099 | * @return pointer to descriptor on success, NULL on error. |
1100 | */ | 1100 | */ |
1101 | struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) | 1101 | |
1102 | struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev) | ||
1102 | { | 1103 | { |
1103 | struct smscore_buffer_t *cb = NULL; | 1104 | struct smscore_buffer_t *cb = NULL; |
1104 | unsigned long flags; | 1105 | unsigned long flags; |
1105 | 1106 | ||
1106 | DEFINE_WAIT(wait); | ||
1107 | |||
1108 | spin_lock_irqsave(&coredev->bufferslock, flags); | 1107 | spin_lock_irqsave(&coredev->bufferslock, flags); |
1109 | 1108 | if (!list_empty(&coredev->buffers)) { | |
1110 | /* This function must return a valid buffer, since the buffer list is | 1109 | cb = (struct smscore_buffer_t *) coredev->buffers.next; |
1111 | * finite, we check that there is an available buffer, if not, we wait | 1110 | list_del(&cb->entry); |
1112 | * until such buffer become available. | ||
1113 | */ | ||
1114 | |||
1115 | prepare_to_wait(&coredev->buffer_mng_waitq, &wait, TASK_INTERRUPTIBLE); | ||
1116 | if (list_empty(&coredev->buffers)) { | ||
1117 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | ||
1118 | schedule(); | ||
1119 | spin_lock_irqsave(&coredev->bufferslock, flags); | ||
1120 | } | 1111 | } |
1112 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | ||
1113 | return cb; | ||
1114 | } | ||
1121 | 1115 | ||
1122 | finish_wait(&coredev->buffer_mng_waitq, &wait); | 1116 | struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev) |
1123 | 1117 | { | |
1124 | cb = (struct smscore_buffer_t *) coredev->buffers.next; | 1118 | struct smscore_buffer_t *cb = NULL; |
1125 | list_del(&cb->entry); | ||
1126 | 1119 | ||
1127 | spin_unlock_irqrestore(&coredev->bufferslock, flags); | 1120 | wait_event(coredev->buffer_mng_waitq, (cb = get_entry(coredev))); |
1128 | 1121 | ||
1129 | return cb; | 1122 | return cb; |
1130 | } | 1123 | } |
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 67a4ec8768a..4ce541a5eb4 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | |||
@@ -395,7 +395,7 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, | |||
395 | radio->registers[POWERCFG] = POWERCFG_ENABLE; | 395 | radio->registers[POWERCFG] = POWERCFG_ENABLE; |
396 | if (si470x_set_register(radio, POWERCFG) < 0) { | 396 | if (si470x_set_register(radio, POWERCFG) < 0) { |
397 | retval = -EIO; | 397 | retval = -EIO; |
398 | goto err_all; | 398 | goto err_video; |
399 | } | 399 | } |
400 | msleep(110); | 400 | msleep(110); |
401 | 401 | ||
diff --git a/drivers/media/video/cx231xx/Makefile b/drivers/media/video/cx231xx/Makefile index 755dd0ce65f..6f2b5738448 100644 --- a/drivers/media/video/cx231xx/Makefile +++ b/drivers/media/video/cx231xx/Makefile | |||
@@ -11,4 +11,5 @@ EXTRA_CFLAGS += -Idrivers/media/video | |||
11 | EXTRA_CFLAGS += -Idrivers/media/common/tuners | 11 | EXTRA_CFLAGS += -Idrivers/media/common/tuners |
12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core | 12 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core |
13 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends | 13 | EXTRA_CFLAGS += -Idrivers/media/dvb/frontends |
14 | EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-usb | ||
14 | 15 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 6bdc0ef1811..f2a4900014b 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <media/v4l2-chip-ident.h> | 32 | #include <media/v4l2-chip-ident.h> |
33 | 33 | ||
34 | #include <media/cx25840.h> | 34 | #include <media/cx25840.h> |
35 | #include "dvb-usb-ids.h" | ||
35 | #include "xc5000.h" | 36 | #include "xc5000.h" |
36 | 37 | ||
37 | #include "cx231xx.h" | 38 | #include "cx231xx.h" |
@@ -175,6 +176,8 @@ struct usb_device_id cx231xx_id_table[] = { | |||
175 | .driver_info = CX231XX_BOARD_CNXT_RDE_250}, | 176 | .driver_info = CX231XX_BOARD_CNXT_RDE_250}, |
176 | {USB_DEVICE(0x0572, 0x58A1), | 177 | {USB_DEVICE(0x0572, 0x58A1), |
177 | .driver_info = CX231XX_BOARD_CNXT_RDU_250}, | 178 | .driver_info = CX231XX_BOARD_CNXT_RDU_250}, |
179 | {USB_DEVICE_VER(USB_VID_PIXELVIEW, USB_PID_PIXELVIEW_SBTVD, 0x4000,0x4fff), | ||
180 | .driver_info = CX231XX_BOARD_UNKNOWN}, | ||
178 | {}, | 181 | {}, |
179 | }; | 182 | }; |
180 | 183 | ||
@@ -226,14 +229,16 @@ void cx231xx_pre_card_setup(struct cx231xx *dev) | |||
226 | dev->board.name, dev->model); | 229 | dev->board.name, dev->model); |
227 | 230 | ||
228 | /* set the direction for GPIO pins */ | 231 | /* set the direction for GPIO pins */ |
229 | cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1); | 232 | if (dev->board.tuner_gpio) { |
230 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); | 233 | cx231xx_set_gpio_direction(dev, dev->board.tuner_gpio->bit, 1); |
231 | cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); | 234 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); |
235 | cx231xx_set_gpio_direction(dev, dev->board.tuner_sif_gpio, 1); | ||
232 | 236 | ||
233 | /* request some modules if any required */ | 237 | /* request some modules if any required */ |
234 | 238 | ||
235 | /* reset the Tuner */ | 239 | /* reset the Tuner */ |
236 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); | 240 | cx231xx_gpio_set(dev, dev->board.tuner_gpio); |
241 | } | ||
237 | 242 | ||
238 | /* set the mode to Analog mode initially */ | 243 | /* set the mode to Analog mode initially */ |
239 | cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); | 244 | cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 86ca8c2359d..f5a3e74c3c7 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1996,7 +1996,7 @@ static int cx25840_probe(struct i2c_client *client, | |||
1996 | 1996 | ||
1997 | state->volume = v4l2_ctrl_new_std(&state->hdl, | 1997 | state->volume = v4l2_ctrl_new_std(&state->hdl, |
1998 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, | 1998 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, |
1999 | 0, 65335, 65535 / 100, default_volume); | 1999 | 0, 65535, 65535 / 100, default_volume); |
2000 | state->mute = v4l2_ctrl_new_std(&state->hdl, | 2000 | state->mute = v4l2_ctrl_new_std(&state->hdl, |
2001 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE, | 2001 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_MUTE, |
2002 | 0, 1, 1, 0); | 2002 | 0, 1, 1, 0); |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 99dbae11759..0fa85cbefbb 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -17,7 +17,7 @@ config VIDEO_CX88 | |||
17 | 17 | ||
18 | config VIDEO_CX88_ALSA | 18 | config VIDEO_CX88_ALSA |
19 | tristate "Conexant 2388x DMA audio support" | 19 | tristate "Conexant 2388x DMA audio support" |
20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL | 20 | depends on VIDEO_CX88 && SND |
21 | select SND_PCM | 21 | select SND_PCM |
22 | ---help--- | 22 | ---help--- |
23 | This is a video4linux driver for direct (DMA) audio on | 23 | This is a video4linux driver for direct (DMA) audio on |
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index b9846106913..78abc1c1f9d 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -223,6 +223,7 @@ static int alloc_and_submit_int_urb(struct gspca_dev *gspca_dev, | |||
223 | usb_rcvintpipe(dev, ep->bEndpointAddress), | 223 | usb_rcvintpipe(dev, ep->bEndpointAddress), |
224 | buffer, buffer_len, | 224 | buffer, buffer_len, |
225 | int_irq, (void *)gspca_dev, interval); | 225 | int_irq, (void *)gspca_dev, interval); |
226 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
226 | gspca_dev->int_urb = urb; | 227 | gspca_dev->int_urb = urb; |
227 | ret = usb_submit_urb(urb, GFP_KERNEL); | 228 | ret = usb_submit_urb(urb, GFP_KERNEL); |
228 | if (ret < 0) { | 229 | if (ret < 0) { |
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 83a718f0f3f..9052d570255 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2357,8 +2357,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
2357 | (data[33] << 10); | 2357 | (data[33] << 10); |
2358 | avg_lum >>= 9; | 2358 | avg_lum >>= 9; |
2359 | atomic_set(&sd->avg_lum, avg_lum); | 2359 | atomic_set(&sd->avg_lum, avg_lum); |
2360 | gspca_frame_add(gspca_dev, LAST_PACKET, | 2360 | gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); |
2361 | data, len); | ||
2362 | return; | 2361 | return; |
2363 | } | 2362 | } |
2364 | if (gspca_dev->last_packet_type == LAST_PACKET) { | 2363 | if (gspca_dev->last_packet_type == LAST_PACKET) { |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index be03a712731..f0316d02f09 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -466,6 +466,8 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar | |||
466 | struct fb_vblank vblank; | 466 | struct fb_vblank vblank; |
467 | u32 trace; | 467 | u32 trace; |
468 | 468 | ||
469 | memset(&vblank, 0, sizeof(struct fb_vblank)); | ||
470 | |||
469 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | | 471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | |
470 | FB_VBLANK_HAVE_VSYNC; | 472 | FB_VBLANK_HAVE_VSYNC; |
471 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; | 473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; |
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index 4525335f9bd..a7210d98138 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c | |||
@@ -239,7 +239,7 @@ static int device_process(struct m2mtest_ctx *ctx, | |||
239 | return -EFAULT; | 239 | return -EFAULT; |
240 | } | 240 | } |
241 | 241 | ||
242 | if (in_buf->vb.size < out_buf->vb.size) { | 242 | if (in_buf->vb.size > out_buf->vb.size) { |
243 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); | 243 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); |
244 | return -EINVAL; | 244 | return -EINVAL; |
245 | } | 245 | } |
@@ -1014,6 +1014,7 @@ static int m2mtest_remove(struct platform_device *pdev) | |||
1014 | v4l2_m2m_release(dev->m2m_dev); | 1014 | v4l2_m2m_release(dev->m2m_dev); |
1015 | del_timer_sync(&dev->timer); | 1015 | del_timer_sync(&dev->timer); |
1016 | video_unregister_device(dev->vfd); | 1016 | video_unregister_device(dev->vfd); |
1017 | video_device_release(dev->vfd); | ||
1017 | v4l2_device_unregister(&dev->v4l2_dev); | 1018 | v4l2_device_unregister(&dev->v4l2_dev); |
1018 | kfree(dev); | 1019 | kfree(dev); |
1019 | 1020 | ||
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 758a4db27d6..c71af4e0e51 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
@@ -447,6 +447,9 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
447 | dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n", | 447 | dev_dbg(&client->dev, "%s left=%d, top=%d, width=%d, height=%d\n", |
448 | __func__, rect.left, rect.top, rect.width, rect.height); | 448 | __func__, rect.left, rect.top, rect.width, rect.height); |
449 | 449 | ||
450 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
451 | return -EINVAL; | ||
452 | |||
450 | ret = mt9m111_make_rect(client, &rect); | 453 | ret = mt9m111_make_rect(client, &rect); |
451 | if (!ret) | 454 | if (!ret) |
452 | mt9m111->rect = rect; | 455 | mt9m111->rect = rect; |
@@ -466,12 +469,14 @@ static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
466 | 469 | ||
467 | static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) | 470 | static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) |
468 | { | 471 | { |
472 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
473 | return -EINVAL; | ||
474 | |||
469 | a->bounds.left = MT9M111_MIN_DARK_COLS; | 475 | a->bounds.left = MT9M111_MIN_DARK_COLS; |
470 | a->bounds.top = MT9M111_MIN_DARK_ROWS; | 476 | a->bounds.top = MT9M111_MIN_DARK_ROWS; |
471 | a->bounds.width = MT9M111_MAX_WIDTH; | 477 | a->bounds.width = MT9M111_MAX_WIDTH; |
472 | a->bounds.height = MT9M111_MAX_HEIGHT; | 478 | a->bounds.height = MT9M111_MAX_HEIGHT; |
473 | a->defrect = a->bounds; | 479 | a->defrect = a->bounds; |
474 | a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
475 | a->pixelaspect.numerator = 1; | 480 | a->pixelaspect.numerator = 1; |
476 | a->pixelaspect.denominator = 1; | 481 | a->pixelaspect.denominator = 1; |
477 | 482 | ||
@@ -487,6 +492,7 @@ static int mt9m111_g_fmt(struct v4l2_subdev *sd, | |||
487 | mf->width = mt9m111->rect.width; | 492 | mf->width = mt9m111->rect.width; |
488 | mf->height = mt9m111->rect.height; | 493 | mf->height = mt9m111->rect.height; |
489 | mf->code = mt9m111->fmt->code; | 494 | mf->code = mt9m111->fmt->code; |
495 | mf->colorspace = mt9m111->fmt->colorspace; | ||
490 | mf->field = V4L2_FIELD_NONE; | 496 | mf->field = V4L2_FIELD_NONE; |
491 | 497 | ||
492 | return 0; | 498 | return 0; |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index e7cd23cd639..b48473c7896 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -402,9 +402,6 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, | |||
402 | if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC) | 402 | if (mt9v022->model != V4L2_IDENT_MT9V022IX7ATC) |
403 | return -EINVAL; | 403 | return -EINVAL; |
404 | break; | 404 | break; |
405 | case 0: | ||
406 | /* No format change, only geometry */ | ||
407 | break; | ||
408 | default: | 405 | default: |
409 | return -EINVAL; | 406 | return -EINVAL; |
410 | } | 407 | } |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 66ff174151b..b6ea67221d1 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -378,6 +378,9 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, | |||
378 | 378 | ||
379 | spin_lock_irqsave(&pcdev->lock, flags); | 379 | spin_lock_irqsave(&pcdev->lock, flags); |
380 | 380 | ||
381 | if (*fb_active == NULL) | ||
382 | goto out; | ||
383 | |||
381 | vb = &(*fb_active)->vb; | 384 | vb = &(*fb_active)->vb; |
382 | dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 385 | dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
383 | vb, vb->baddr, vb->bsize); | 386 | vb, vb->baddr, vb->bsize); |
@@ -402,6 +405,7 @@ static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb, | |||
402 | 405 | ||
403 | *fb_active = buf; | 406 | *fb_active = buf; |
404 | 407 | ||
408 | out: | ||
405 | spin_unlock_irqrestore(&pcdev->lock, flags); | 409 | spin_unlock_irqrestore(&pcdev->lock, flags); |
406 | } | 410 | } |
407 | 411 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 1b992b84719..55ea914c7fc 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c | |||
@@ -513,7 +513,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
513 | if (ret >= 0) { | 513 | if (ret >= 0) { |
514 | ret = pvr2_ctrl_range_check(cptr,*valptr); | 514 | ret = pvr2_ctrl_range_check(cptr,*valptr); |
515 | } | 515 | } |
516 | if (maskptr) *maskptr = ~0; | 516 | *maskptr = ~0; |
517 | } else if (cptr->info->type == pvr2_ctl_bool) { | 517 | } else if (cptr->info->type == pvr2_ctl_bool) { |
518 | ret = parse_token(ptr,len,valptr,boolNames, | 518 | ret = parse_token(ptr,len,valptr,boolNames, |
519 | ARRAY_SIZE(boolNames)); | 519 | ARRAY_SIZE(boolNames)); |
@@ -522,7 +522,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
522 | } else if (ret == 0) { | 522 | } else if (ret == 0) { |
523 | *valptr = (*valptr & 1) ? !0 : 0; | 523 | *valptr = (*valptr & 1) ? !0 : 0; |
524 | } | 524 | } |
525 | if (maskptr) *maskptr = 1; | 525 | *maskptr = 1; |
526 | } else if (cptr->info->type == pvr2_ctl_enum) { | 526 | } else if (cptr->info->type == pvr2_ctl_enum) { |
527 | ret = parse_token( | 527 | ret = parse_token( |
528 | ptr,len,valptr, | 528 | ptr,len,valptr, |
@@ -531,7 +531,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, | |||
531 | if (ret >= 0) { | 531 | if (ret >= 0) { |
532 | ret = pvr2_ctrl_range_check(cptr,*valptr); | 532 | ret = pvr2_ctrl_range_check(cptr,*valptr); |
533 | } | 533 | } |
534 | if (maskptr) *maskptr = ~0; | 534 | *maskptr = ~0; |
535 | } else if (cptr->info->type == pvr2_ctl_bitmask) { | 535 | } else if (cptr->info->type == pvr2_ctl_bitmask) { |
536 | ret = parse_tlist( | 536 | ret = parse_tlist( |
537 | ptr,len,maskptr,valptr, | 537 | ptr,len,maskptr,valptr, |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index b151c7be8a5..6961c55baf9 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -393,6 +393,37 @@ static void fimc_set_yuv_order(struct fimc_ctx *ctx) | |||
393 | dbg("ctx->out_order_1p= %d", ctx->out_order_1p); | 393 | dbg("ctx->out_order_1p= %d", ctx->out_order_1p); |
394 | } | 394 | } |
395 | 395 | ||
396 | static void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f) | ||
397 | { | ||
398 | struct samsung_fimc_variant *variant = ctx->fimc_dev->variant; | ||
399 | |||
400 | f->dma_offset.y_h = f->offs_h; | ||
401 | if (!variant->pix_hoff) | ||
402 | f->dma_offset.y_h *= (f->fmt->depth >> 3); | ||
403 | |||
404 | f->dma_offset.y_v = f->offs_v; | ||
405 | |||
406 | f->dma_offset.cb_h = f->offs_h; | ||
407 | f->dma_offset.cb_v = f->offs_v; | ||
408 | |||
409 | f->dma_offset.cr_h = f->offs_h; | ||
410 | f->dma_offset.cr_v = f->offs_v; | ||
411 | |||
412 | if (!variant->pix_hoff) { | ||
413 | if (f->fmt->planes_cnt == 3) { | ||
414 | f->dma_offset.cb_h >>= 1; | ||
415 | f->dma_offset.cr_h >>= 1; | ||
416 | } | ||
417 | if (f->fmt->color == S5P_FIMC_YCBCR420) { | ||
418 | f->dma_offset.cb_v >>= 1; | ||
419 | f->dma_offset.cr_v >>= 1; | ||
420 | } | ||
421 | } | ||
422 | |||
423 | dbg("in_offset: color= %d, y_h= %d, y_v= %d", | ||
424 | f->fmt->color, f->dma_offset.y_h, f->dma_offset.y_v); | ||
425 | } | ||
426 | |||
396 | /** | 427 | /** |
397 | * fimc_prepare_config - check dimensions, operation and color mode | 428 | * fimc_prepare_config - check dimensions, operation and color mode |
398 | * and pre-calculate offset and the scaling coefficients. | 429 | * and pre-calculate offset and the scaling coefficients. |
@@ -406,7 +437,6 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags) | |||
406 | { | 437 | { |
407 | struct fimc_frame *s_frame, *d_frame; | 438 | struct fimc_frame *s_frame, *d_frame; |
408 | struct fimc_vid_buffer *buf = NULL; | 439 | struct fimc_vid_buffer *buf = NULL; |
409 | struct samsung_fimc_variant *variant = ctx->fimc_dev->variant; | ||
410 | int ret = 0; | 440 | int ret = 0; |
411 | 441 | ||
412 | s_frame = &ctx->s_frame; | 442 | s_frame = &ctx->s_frame; |
@@ -419,61 +449,16 @@ static int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags) | |||
419 | swap(d_frame->width, d_frame->height); | 449 | swap(d_frame->width, d_frame->height); |
420 | } | 450 | } |
421 | 451 | ||
422 | /* Prepare the output offset ratios for scaler. */ | 452 | /* Prepare the DMA offset ratios for scaler. */ |
423 | d_frame->dma_offset.y_h = d_frame->offs_h; | 453 | fimc_prepare_dma_offset(ctx, &ctx->s_frame); |
424 | if (!variant->pix_hoff) | 454 | fimc_prepare_dma_offset(ctx, &ctx->d_frame); |
425 | d_frame->dma_offset.y_h *= (d_frame->fmt->depth >> 3); | ||
426 | |||
427 | d_frame->dma_offset.y_v = d_frame->offs_v; | ||
428 | |||
429 | d_frame->dma_offset.cb_h = d_frame->offs_h; | ||
430 | d_frame->dma_offset.cb_v = d_frame->offs_v; | ||
431 | |||
432 | d_frame->dma_offset.cr_h = d_frame->offs_h; | ||
433 | d_frame->dma_offset.cr_v = d_frame->offs_v; | ||
434 | 455 | ||
435 | if (!variant->pix_hoff && d_frame->fmt->planes_cnt == 3) { | ||
436 | d_frame->dma_offset.cb_h >>= 1; | ||
437 | d_frame->dma_offset.cb_v >>= 1; | ||
438 | d_frame->dma_offset.cr_h >>= 1; | ||
439 | d_frame->dma_offset.cr_v >>= 1; | ||
440 | } | ||
441 | |||
442 | dbg("out offset: color= %d, y_h= %d, y_v= %d", | ||
443 | d_frame->fmt->color, | ||
444 | d_frame->dma_offset.y_h, d_frame->dma_offset.y_v); | ||
445 | |||
446 | /* Prepare the input offset ratios for scaler. */ | ||
447 | s_frame->dma_offset.y_h = s_frame->offs_h; | ||
448 | if (!variant->pix_hoff) | ||
449 | s_frame->dma_offset.y_h *= (s_frame->fmt->depth >> 3); | ||
450 | s_frame->dma_offset.y_v = s_frame->offs_v; | ||
451 | |||
452 | s_frame->dma_offset.cb_h = s_frame->offs_h; | ||
453 | s_frame->dma_offset.cb_v = s_frame->offs_v; | ||
454 | |||
455 | s_frame->dma_offset.cr_h = s_frame->offs_h; | ||
456 | s_frame->dma_offset.cr_v = s_frame->offs_v; | ||
457 | |||
458 | if (!variant->pix_hoff && s_frame->fmt->planes_cnt == 3) { | ||
459 | s_frame->dma_offset.cb_h >>= 1; | ||
460 | s_frame->dma_offset.cb_v >>= 1; | ||
461 | s_frame->dma_offset.cr_h >>= 1; | ||
462 | s_frame->dma_offset.cr_v >>= 1; | ||
463 | } | ||
464 | |||
465 | dbg("in offset: color= %d, y_h= %d, y_v= %d", | ||
466 | s_frame->fmt->color, s_frame->dma_offset.y_h, | ||
467 | s_frame->dma_offset.y_v); | ||
468 | |||
469 | fimc_set_yuv_order(ctx); | ||
470 | |||
471 | /* Check against the scaler ratio. */ | ||
472 | if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) || | 456 | if (s_frame->height > (SCALER_MAX_VRATIO * d_frame->height) || |
473 | s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) { | 457 | s_frame->width > (SCALER_MAX_HRATIO * d_frame->width)) { |
474 | err("out of scaler range"); | 458 | err("out of scaler range"); |
475 | return -EINVAL; | 459 | return -EINVAL; |
476 | } | 460 | } |
461 | fimc_set_yuv_order(ctx); | ||
477 | } | 462 | } |
478 | 463 | ||
479 | /* Input DMA mode is not allowed when the scaler is disabled. */ | 464 | /* Input DMA mode is not allowed when the scaler is disabled. */ |
@@ -822,7 +807,8 @@ static int fimc_m2m_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
822 | } else { | 807 | } else { |
823 | v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, | 808 | v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, |
824 | "Wrong buffer/video queue type (%d)\n", f->type); | 809 | "Wrong buffer/video queue type (%d)\n", f->type); |
825 | return -EINVAL; | 810 | ret = -EINVAL; |
811 | goto s_fmt_out; | ||
826 | } | 812 | } |
827 | 813 | ||
828 | pix = &f->fmt.pix; | 814 | pix = &f->fmt.pix; |
@@ -1414,8 +1400,10 @@ static int fimc_probe(struct platform_device *pdev) | |||
1414 | } | 1400 | } |
1415 | 1401 | ||
1416 | fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev)); | 1402 | fimc->work_queue = create_workqueue(dev_name(&fimc->pdev->dev)); |
1417 | if (!fimc->work_queue) | 1403 | if (!fimc->work_queue) { |
1404 | ret = -ENOMEM; | ||
1418 | goto err_irq; | 1405 | goto err_irq; |
1406 | } | ||
1419 | 1407 | ||
1420 | ret = fimc_register_m2m_device(fimc); | 1408 | ret = fimc_register_m2m_device(fimc); |
1421 | if (ret) | 1409 | if (ret) |
@@ -1492,6 +1480,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = { | |||
1492 | }; | 1480 | }; |
1493 | 1481 | ||
1494 | static struct samsung_fimc_variant fimc01_variant_s5pv210 = { | 1482 | static struct samsung_fimc_variant fimc01_variant_s5pv210 = { |
1483 | .pix_hoff = 1, | ||
1495 | .has_inp_rot = 1, | 1484 | .has_inp_rot = 1, |
1496 | .has_out_rot = 1, | 1485 | .has_out_rot = 1, |
1497 | .min_inp_pixsize = 16, | 1486 | .min_inp_pixsize = 16, |
@@ -1506,6 +1495,7 @@ static struct samsung_fimc_variant fimc01_variant_s5pv210 = { | |||
1506 | }; | 1495 | }; |
1507 | 1496 | ||
1508 | static struct samsung_fimc_variant fimc2_variant_s5pv210 = { | 1497 | static struct samsung_fimc_variant fimc2_variant_s5pv210 = { |
1498 | .pix_hoff = 1, | ||
1509 | .min_inp_pixsize = 16, | 1499 | .min_inp_pixsize = 16, |
1510 | .min_out_pixsize = 32, | 1500 | .min_out_pixsize = 32, |
1511 | 1501 | ||
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index ec697fcd406..bb8d83d8dda 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -4323,13 +4323,13 @@ struct saa7134_board saa7134_boards[] = { | |||
4323 | }, | 4323 | }, |
4324 | [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { | 4324 | [SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM] = { |
4325 | /* Beholder Intl. Ltd. 2008 */ | 4325 | /* Beholder Intl. Ltd. 2008 */ |
4326 | /*Dmitry Belimov <d.belimov@gmail.com> */ | 4326 | /* Dmitry Belimov <d.belimov@gmail.com> */ |
4327 | .name = "Beholder BeholdTV Columbus TVFM", | 4327 | .name = "Beholder BeholdTV Columbus TV/FM", |
4328 | .audio_clock = 0x00187de7, | 4328 | .audio_clock = 0x00187de7, |
4329 | .tuner_type = TUNER_ALPS_TSBE5_PAL, | 4329 | .tuner_type = TUNER_ALPS_TSBE5_PAL, |
4330 | .radio_type = UNSET, | 4330 | .radio_type = TUNER_TEA5767, |
4331 | .tuner_addr = ADDR_UNSET, | 4331 | .tuner_addr = 0xc2 >> 1, |
4332 | .radio_addr = ADDR_UNSET, | 4332 | .radio_addr = 0xc0 >> 1, |
4333 | .tda9887_conf = TDA9887_PRESENT, | 4333 | .tda9887_conf = TDA9887_PRESENT, |
4334 | .gpiomask = 0x000A8004, | 4334 | .gpiomask = 0x000A8004, |
4335 | .inputs = {{ | 4335 | .inputs = {{ |
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c index 5713f3a4b76..ddd25d32723 100644 --- a/drivers/media/video/saa7164/saa7164-buffer.c +++ b/drivers/media/video/saa7164/saa7164-buffer.c | |||
@@ -136,10 +136,11 @@ ret: | |||
136 | int saa7164_buffer_dealloc(struct saa7164_tsport *port, | 136 | int saa7164_buffer_dealloc(struct saa7164_tsport *port, |
137 | struct saa7164_buffer *buf) | 137 | struct saa7164_buffer *buf) |
138 | { | 138 | { |
139 | struct saa7164_dev *dev = port->dev; | 139 | struct saa7164_dev *dev; |
140 | 140 | ||
141 | if ((buf == 0) || (port == 0)) | 141 | if (!buf || !port) |
142 | return SAA_ERR_BAD_PARAMETER; | 142 | return SAA_ERR_BAD_PARAMETER; |
143 | dev = port->dev; | ||
143 | 144 | ||
144 | dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); | 145 | dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf); |
145 | 146 | ||
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 8bdd940f32e..2ac85d8984f 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -486,6 +486,12 @@ static int uvc_parse_format(struct uvc_device *dev, | |||
486 | max(frame->dwFrameInterval[0], | 486 | max(frame->dwFrameInterval[0], |
487 | frame->dwDefaultFrameInterval)); | 487 | frame->dwDefaultFrameInterval)); |
488 | 488 | ||
489 | if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) { | ||
490 | frame->bFrameIntervalType = 1; | ||
491 | frame->dwFrameInterval[0] = | ||
492 | frame->dwDefaultFrameInterval; | ||
493 | } | ||
494 | |||
489 | uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n", | 495 | uvc_trace(UVC_TRACE_DESCR, "- %ux%u (%u.%u fps)\n", |
490 | frame->wWidth, frame->wHeight, | 496 | frame->wWidth, frame->wHeight, |
491 | 10000000/frame->dwDefaultFrameInterval, | 497 | 10000000/frame->dwDefaultFrameInterval, |
@@ -2026,6 +2032,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2026 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | 2032 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, |
2027 | .bInterfaceSubClass = 1, | 2033 | .bInterfaceSubClass = 1, |
2028 | .bInterfaceProtocol = 0 }, | 2034 | .bInterfaceProtocol = 0 }, |
2035 | /* Chicony CNF7129 (Asus EEE 100HE) */ | ||
2036 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2037 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2038 | .idVendor = 0x04f2, | ||
2039 | .idProduct = 0xb071, | ||
2040 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2041 | .bInterfaceSubClass = 1, | ||
2042 | .bInterfaceProtocol = 0, | ||
2043 | .driver_info = UVC_QUIRK_RESTRICT_FRAME_RATE }, | ||
2029 | /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ | 2044 | /* Alcor Micro AU3820 (Future Boy PC USB Webcam) */ |
2030 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2045 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2031 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2046 | | USB_DEVICE_ID_MATCH_INT_INFO, |
@@ -2091,6 +2106,15 @@ static struct usb_device_id uvc_ids[] = { | |||
2091 | .bInterfaceProtocol = 0, | 2106 | .bInterfaceProtocol = 0, |
2092 | .driver_info = UVC_QUIRK_PROBE_MINMAX | 2107 | .driver_info = UVC_QUIRK_PROBE_MINMAX |
2093 | | UVC_QUIRK_PROBE_DEF }, | 2108 | | UVC_QUIRK_PROBE_DEF }, |
2109 | /* IMC Networks (Medion Akoya) */ | ||
2110 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
2111 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
2112 | .idVendor = 0x13d3, | ||
2113 | .idProduct = 0x5103, | ||
2114 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
2115 | .bInterfaceSubClass = 1, | ||
2116 | .bInterfaceProtocol = 0, | ||
2117 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, | ||
2094 | /* Syntek (HP Spartan) */ | 2118 | /* Syntek (HP Spartan) */ |
2095 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2119 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
2096 | | USB_DEVICE_ID_MATCH_INT_INFO, | 2120 | | USB_DEVICE_ID_MATCH_INT_INFO, |
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index bdacf3beabf..892e0e51916 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -182,6 +182,7 @@ struct uvc_xu_control { | |||
182 | #define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 | 182 | #define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020 |
183 | #define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 | 183 | #define UVC_QUIRK_FIX_BANDWIDTH 0x00000080 |
184 | #define UVC_QUIRK_PROBE_DEF 0x00000100 | 184 | #define UVC_QUIRK_PROBE_DEF 0x00000100 |
185 | #define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200 | ||
185 | 186 | ||
186 | /* Format flags */ | 187 | /* Format flags */ |
187 | #define UVC_FMT_FLAG_COMPRESSED 0x00000001 | 188 | #define UVC_FMT_FLAG_COMPRESSED 0x00000001 |
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 073f01390cd..86294ed35c9 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -193,17 +193,24 @@ static int put_video_window32(struct video_window *kp, struct video_window32 __u | |||
193 | struct video_code32 { | 193 | struct video_code32 { |
194 | char loadwhat[16]; /* name or tag of file being passed */ | 194 | char loadwhat[16]; /* name or tag of file being passed */ |
195 | compat_int_t datasize; | 195 | compat_int_t datasize; |
196 | unsigned char *data; | 196 | compat_uptr_t data; |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static int get_microcode32(struct video_code *kp, struct video_code32 __user *up) | 199 | static struct video_code __user *get_microcode32(struct video_code32 *kp) |
200 | { | 200 | { |
201 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || | 201 | struct video_code __user *up; |
202 | copy_from_user(kp->loadwhat, up->loadwhat, sizeof(up->loadwhat)) || | 202 | |
203 | get_user(kp->datasize, &up->datasize) || | 203 | up = compat_alloc_user_space(sizeof(*up)); |
204 | copy_from_user(kp->data, up->data, up->datasize)) | 204 | |
205 | return -EFAULT; | 205 | /* |
206 | return 0; | 206 | * NOTE! We don't actually care if these fail. If the |
207 | * user address is invalid, the native ioctl will do | ||
208 | * the error handling for us | ||
209 | */ | ||
210 | (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); | ||
211 | (void) put_user(kp->datasize, &up->datasize); | ||
212 | (void) put_user(compat_ptr(kp->data), &up->data); | ||
213 | return up; | ||
207 | } | 214 | } |
208 | 215 | ||
209 | #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) | 216 | #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) |
@@ -739,7 +746,7 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
739 | struct video_tuner vt; | 746 | struct video_tuner vt; |
740 | struct video_buffer vb; | 747 | struct video_buffer vb; |
741 | struct video_window vw; | 748 | struct video_window vw; |
742 | struct video_code vc; | 749 | struct video_code32 vc; |
743 | struct video_audio va; | 750 | struct video_audio va; |
744 | #endif | 751 | #endif |
745 | struct v4l2_format v2f; | 752 | struct v4l2_format v2f; |
@@ -818,8 +825,11 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
818 | break; | 825 | break; |
819 | 826 | ||
820 | case VIDIOCSMICROCODE: | 827 | case VIDIOCSMICROCODE: |
821 | err = get_microcode32(&karg.vc, up); | 828 | /* Copy the 32-bit "video_code32" to kernel space */ |
822 | compatible_arg = 0; | 829 | if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) |
830 | return -EFAULT; | ||
831 | /* Convert the 32-bit version to a 64-bit version in user space */ | ||
832 | up = get_microcode32(&karg.vc); | ||
823 | break; | 833 | break; |
824 | 834 | ||
825 | case VIDIOCSFREQ: | 835 | case VIDIOCSFREQ: |
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index 372b87efcd0..6ff9e4bac3e 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
@@ -393,8 +393,10 @@ void videobuf_dma_contig_free(struct videobuf_queue *q, | |||
393 | } | 393 | } |
394 | 394 | ||
395 | /* read() method */ | 395 | /* read() method */ |
396 | dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); | 396 | if (mem->vaddr) { |
397 | mem->vaddr = NULL; | 397 | dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); |
398 | mem->vaddr = NULL; | ||
399 | } | ||
398 | } | 400 | } |
399 | EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); | 401 | EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); |
400 | 402 | ||
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 06f9a9c2a39..2ad0bc252b0 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -94,7 +94,7 @@ err: | |||
94 | * must free the memory. | 94 | * must free the memory. |
95 | */ | 95 | */ |
96 | static struct scatterlist *videobuf_pages_to_sg(struct page **pages, | 96 | static struct scatterlist *videobuf_pages_to_sg(struct page **pages, |
97 | int nr_pages, int offset) | 97 | int nr_pages, int offset, size_t size) |
98 | { | 98 | { |
99 | struct scatterlist *sglist; | 99 | struct scatterlist *sglist; |
100 | int i; | 100 | int i; |
@@ -110,12 +110,14 @@ static struct scatterlist *videobuf_pages_to_sg(struct page **pages, | |||
110 | /* DMA to highmem pages might not work */ | 110 | /* DMA to highmem pages might not work */ |
111 | goto highmem; | 111 | goto highmem; |
112 | sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); | 112 | sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); |
113 | size -= PAGE_SIZE - offset; | ||
113 | for (i = 1; i < nr_pages; i++) { | 114 | for (i = 1; i < nr_pages; i++) { |
114 | if (NULL == pages[i]) | 115 | if (NULL == pages[i]) |
115 | goto nopage; | 116 | goto nopage; |
116 | if (PageHighMem(pages[i])) | 117 | if (PageHighMem(pages[i])) |
117 | goto highmem; | 118 | goto highmem; |
118 | sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0); | 119 | sg_set_page(&sglist[i], pages[i], min(PAGE_SIZE, size), 0); |
120 | size -= min(PAGE_SIZE, size); | ||
119 | } | 121 | } |
120 | return sglist; | 122 | return sglist; |
121 | 123 | ||
@@ -170,7 +172,8 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, | |||
170 | 172 | ||
171 | first = (data & PAGE_MASK) >> PAGE_SHIFT; | 173 | first = (data & PAGE_MASK) >> PAGE_SHIFT; |
172 | last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; | 174 | last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; |
173 | dma->offset = data & ~PAGE_MASK; | 175 | dma->offset = data & ~PAGE_MASK; |
176 | dma->size = size; | ||
174 | dma->nr_pages = last-first+1; | 177 | dma->nr_pages = last-first+1; |
175 | dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); | 178 | dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); |
176 | if (NULL == dma->pages) | 179 | if (NULL == dma->pages) |
@@ -252,7 +255,7 @@ int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma) | |||
252 | 255 | ||
253 | if (dma->pages) { | 256 | if (dma->pages) { |
254 | dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, | 257 | dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages, |
255 | dma->offset); | 258 | dma->offset, dma->size); |
256 | } | 259 | } |
257 | if (dma->vaddr) { | 260 | if (dma->vaddr) { |
258 | dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr, | 261 | dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr, |
diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 04028a9ee08..428377a5a6f 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c | |||
@@ -429,24 +429,25 @@ static void max8925_irq_sync_unlock(unsigned int irq) | |||
429 | irq_tsc = cache_tsc; | 429 | irq_tsc = cache_tsc; |
430 | for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { | 430 | for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { |
431 | irq_data = &max8925_irqs[i]; | 431 | irq_data = &max8925_irqs[i]; |
432 | /* 1 -- disable, 0 -- enable */ | ||
432 | switch (irq_data->mask_reg) { | 433 | switch (irq_data->mask_reg) { |
433 | case MAX8925_CHG_IRQ1_MASK: | 434 | case MAX8925_CHG_IRQ1_MASK: |
434 | irq_chg[0] &= irq_data->enable; | 435 | irq_chg[0] &= ~irq_data->enable; |
435 | break; | 436 | break; |
436 | case MAX8925_CHG_IRQ2_MASK: | 437 | case MAX8925_CHG_IRQ2_MASK: |
437 | irq_chg[1] &= irq_data->enable; | 438 | irq_chg[1] &= ~irq_data->enable; |
438 | break; | 439 | break; |
439 | case MAX8925_ON_OFF_IRQ1_MASK: | 440 | case MAX8925_ON_OFF_IRQ1_MASK: |
440 | irq_on[0] &= irq_data->enable; | 441 | irq_on[0] &= ~irq_data->enable; |
441 | break; | 442 | break; |
442 | case MAX8925_ON_OFF_IRQ2_MASK: | 443 | case MAX8925_ON_OFF_IRQ2_MASK: |
443 | irq_on[1] &= irq_data->enable; | 444 | irq_on[1] &= ~irq_data->enable; |
444 | break; | 445 | break; |
445 | case MAX8925_RTC_IRQ_MASK: | 446 | case MAX8925_RTC_IRQ_MASK: |
446 | irq_rtc &= irq_data->enable; | 447 | irq_rtc &= ~irq_data->enable; |
447 | break; | 448 | break; |
448 | case MAX8925_TSC_IRQ_MASK: | 449 | case MAX8925_TSC_IRQ_MASK: |
449 | irq_tsc &= irq_data->enable; | 450 | irq_tsc &= ~irq_data->enable; |
450 | break; | 451 | break; |
451 | default: | 452 | default: |
452 | dev_err(chip->dev, "wrong IRQ\n"); | 453 | dev_err(chip->dev, "wrong IRQ\n"); |
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index 7dabe4dbd37..294183b6260 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c | |||
@@ -394,8 +394,13 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type) | |||
394 | 394 | ||
395 | irq = irq - wm831x->irq_base; | 395 | irq = irq - wm831x->irq_base; |
396 | 396 | ||
397 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) | 397 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { |
398 | return -EINVAL; | 398 | /* Ignore internal-only IRQs */ |
399 | if (irq >= 0 && irq < WM831X_NUM_IRQS) | ||
400 | return 0; | ||
401 | else | ||
402 | return -EINVAL; | ||
403 | } | ||
399 | 404 | ||
400 | switch (type) { | 405 | switch (type) { |
401 | case IRQ_TYPE_EDGE_BOTH: | 406 | case IRQ_TYPE_EDGE_BOTH: |
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c index 714c6b48731..d5f3a3fd231 100644 --- a/drivers/misc/bh1780gli.c +++ b/drivers/misc/bh1780gli.c | |||
@@ -190,7 +190,6 @@ static int __devexit bh1780_remove(struct i2c_client *client) | |||
190 | 190 | ||
191 | ddata = i2c_get_clientdata(client); | 191 | ddata = i2c_get_clientdata(client); |
192 | sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); | 192 | sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group); |
193 | i2c_set_clientdata(client, NULL); | ||
194 | kfree(ddata); | 193 | kfree(ddata); |
195 | 194 | ||
196 | return 0; | 195 | return 0; |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5db49b124ff..09eee6df065 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1631,6 +1631,19 @@ int mmc_suspend_host(struct mmc_host *host) | |||
1631 | if (host->bus_ops && !host->bus_dead) { | 1631 | if (host->bus_ops && !host->bus_dead) { |
1632 | if (host->bus_ops->suspend) | 1632 | if (host->bus_ops->suspend) |
1633 | err = host->bus_ops->suspend(host); | 1633 | err = host->bus_ops->suspend(host); |
1634 | if (err == -ENOSYS || !host->bus_ops->resume) { | ||
1635 | /* | ||
1636 | * We simply "remove" the card in this case. | ||
1637 | * It will be redetected on resume. | ||
1638 | */ | ||
1639 | if (host->bus_ops->remove) | ||
1640 | host->bus_ops->remove(host); | ||
1641 | mmc_claim_host(host); | ||
1642 | mmc_detach_bus(host); | ||
1643 | mmc_release_host(host); | ||
1644 | host->pm_flags = 0; | ||
1645 | err = 0; | ||
1646 | } | ||
1634 | } | 1647 | } |
1635 | mmc_bus_put(host); | 1648 | mmc_bus_put(host); |
1636 | 1649 | ||
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index b2828e84d24..214b03afdd4 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
31 | #include <linux/err.h> | 31 | #include <linux/err.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/irq.h> | ||
34 | #include <linux/completion.h> | ||
33 | 35 | ||
34 | #include <asm/mach/flash.h> | 36 | #include <asm/mach/flash.h> |
35 | #include <mach/mxc_nand.h> | 37 | #include <mach/mxc_nand.h> |
@@ -151,7 +153,7 @@ struct mxc_nand_host { | |||
151 | int irq; | 153 | int irq; |
152 | int eccsize; | 154 | int eccsize; |
153 | 155 | ||
154 | wait_queue_head_t irq_waitq; | 156 | struct completion op_completion; |
155 | 157 | ||
156 | uint8_t *data_buf; | 158 | uint8_t *data_buf; |
157 | unsigned int buf_start; | 159 | unsigned int buf_start; |
@@ -164,6 +166,7 @@ struct mxc_nand_host { | |||
164 | void (*send_read_id)(struct mxc_nand_host *); | 166 | void (*send_read_id)(struct mxc_nand_host *); |
165 | uint16_t (*get_dev_status)(struct mxc_nand_host *); | 167 | uint16_t (*get_dev_status)(struct mxc_nand_host *); |
166 | int (*check_int)(struct mxc_nand_host *); | 168 | int (*check_int)(struct mxc_nand_host *); |
169 | void (*irq_control)(struct mxc_nand_host *, int); | ||
167 | }; | 170 | }; |
168 | 171 | ||
169 | /* OOB placement block for use with hardware ecc generation */ | 172 | /* OOB placement block for use with hardware ecc generation */ |
@@ -216,9 +219,12 @@ static irqreturn_t mxc_nfc_irq(int irq, void *dev_id) | |||
216 | { | 219 | { |
217 | struct mxc_nand_host *host = dev_id; | 220 | struct mxc_nand_host *host = dev_id; |
218 | 221 | ||
219 | disable_irq_nosync(irq); | 222 | if (!host->check_int(host)) |
223 | return IRQ_NONE; | ||
220 | 224 | ||
221 | wake_up(&host->irq_waitq); | 225 | host->irq_control(host, 0); |
226 | |||
227 | complete(&host->op_completion); | ||
222 | 228 | ||
223 | return IRQ_HANDLED; | 229 | return IRQ_HANDLED; |
224 | } | 230 | } |
@@ -245,11 +251,54 @@ static int check_int_v1_v2(struct mxc_nand_host *host) | |||
245 | if (!(tmp & NFC_V1_V2_CONFIG2_INT)) | 251 | if (!(tmp & NFC_V1_V2_CONFIG2_INT)) |
246 | return 0; | 252 | return 0; |
247 | 253 | ||
248 | writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); | 254 | if (!cpu_is_mx21()) |
255 | writew(tmp & ~NFC_V1_V2_CONFIG2_INT, NFC_V1_V2_CONFIG2); | ||
249 | 256 | ||
250 | return 1; | 257 | return 1; |
251 | } | 258 | } |
252 | 259 | ||
260 | /* | ||
261 | * It has been observed that the i.MX21 cannot read the CONFIG2:INT bit | ||
262 | * if interrupts are masked (CONFIG1:INT_MSK is set). To handle this, the | ||
263 | * driver can enable/disable the irq line rather than simply masking the | ||
264 | * interrupts. | ||
265 | */ | ||
266 | static void irq_control_mx21(struct mxc_nand_host *host, int activate) | ||
267 | { | ||
268 | if (activate) | ||
269 | enable_irq(host->irq); | ||
270 | else | ||
271 | disable_irq_nosync(host->irq); | ||
272 | } | ||
273 | |||
274 | static void irq_control_v1_v2(struct mxc_nand_host *host, int activate) | ||
275 | { | ||
276 | uint16_t tmp; | ||
277 | |||
278 | tmp = readw(NFC_V1_V2_CONFIG1); | ||
279 | |||
280 | if (activate) | ||
281 | tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK; | ||
282 | else | ||
283 | tmp |= NFC_V1_V2_CONFIG1_INT_MSK; | ||
284 | |||
285 | writew(tmp, NFC_V1_V2_CONFIG1); | ||
286 | } | ||
287 | |||
288 | static void irq_control_v3(struct mxc_nand_host *host, int activate) | ||
289 | { | ||
290 | uint32_t tmp; | ||
291 | |||
292 | tmp = readl(NFC_V3_CONFIG2); | ||
293 | |||
294 | if (activate) | ||
295 | tmp &= ~NFC_V3_CONFIG2_INT_MSK; | ||
296 | else | ||
297 | tmp |= NFC_V3_CONFIG2_INT_MSK; | ||
298 | |||
299 | writel(tmp, NFC_V3_CONFIG2); | ||
300 | } | ||
301 | |||
253 | /* This function polls the NANDFC to wait for the basic operation to | 302 | /* This function polls the NANDFC to wait for the basic operation to |
254 | * complete by checking the INT bit of config2 register. | 303 | * complete by checking the INT bit of config2 register. |
255 | */ | 304 | */ |
@@ -259,10 +308,9 @@ static void wait_op_done(struct mxc_nand_host *host, int useirq) | |||
259 | 308 | ||
260 | if (useirq) { | 309 | if (useirq) { |
261 | if (!host->check_int(host)) { | 310 | if (!host->check_int(host)) { |
262 | 311 | INIT_COMPLETION(host->op_completion); | |
263 | enable_irq(host->irq); | 312 | host->irq_control(host, 1); |
264 | 313 | wait_for_completion(&host->op_completion); | |
265 | wait_event(host->irq_waitq, host->check_int(host)); | ||
266 | } | 314 | } |
267 | } else { | 315 | } else { |
268 | while (max_retries-- > 0) { | 316 | while (max_retries-- > 0) { |
@@ -799,6 +847,7 @@ static void preset_v3(struct mtd_info *mtd) | |||
799 | NFC_V3_CONFIG2_2CMD_PHASES | | 847 | NFC_V3_CONFIG2_2CMD_PHASES | |
800 | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | | 848 | NFC_V3_CONFIG2_SPAS(mtd->oobsize >> 1) | |
801 | NFC_V3_CONFIG2_ST_CMD(0x70) | | 849 | NFC_V3_CONFIG2_ST_CMD(0x70) | |
850 | NFC_V3_CONFIG2_INT_MSK | | ||
802 | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; | 851 | NFC_V3_CONFIG2_NUM_ADDR_PHASE0; |
803 | 852 | ||
804 | if (chip->ecc.mode == NAND_ECC_HW) | 853 | if (chip->ecc.mode == NAND_ECC_HW) |
@@ -1024,6 +1073,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1024 | host->send_read_id = send_read_id_v1_v2; | 1073 | host->send_read_id = send_read_id_v1_v2; |
1025 | host->get_dev_status = get_dev_status_v1_v2; | 1074 | host->get_dev_status = get_dev_status_v1_v2; |
1026 | host->check_int = check_int_v1_v2; | 1075 | host->check_int = check_int_v1_v2; |
1076 | if (cpu_is_mx21()) | ||
1077 | host->irq_control = irq_control_mx21; | ||
1078 | else | ||
1079 | host->irq_control = irq_control_v1_v2; | ||
1027 | } | 1080 | } |
1028 | 1081 | ||
1029 | if (nfc_is_v21()) { | 1082 | if (nfc_is_v21()) { |
@@ -1062,6 +1115,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1062 | host->send_read_id = send_read_id_v3; | 1115 | host->send_read_id = send_read_id_v3; |
1063 | host->check_int = check_int_v3; | 1116 | host->check_int = check_int_v3; |
1064 | host->get_dev_status = get_dev_status_v3; | 1117 | host->get_dev_status = get_dev_status_v3; |
1118 | host->irq_control = irq_control_v3; | ||
1065 | oob_smallpage = &nandv2_hw_eccoob_smallpage; | 1119 | oob_smallpage = &nandv2_hw_eccoob_smallpage; |
1066 | oob_largepage = &nandv2_hw_eccoob_largepage; | 1120 | oob_largepage = &nandv2_hw_eccoob_largepage; |
1067 | } else | 1121 | } else |
@@ -1093,14 +1147,34 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1093 | this->options |= NAND_USE_FLASH_BBT; | 1147 | this->options |= NAND_USE_FLASH_BBT; |
1094 | } | 1148 | } |
1095 | 1149 | ||
1096 | init_waitqueue_head(&host->irq_waitq); | 1150 | init_completion(&host->op_completion); |
1097 | 1151 | ||
1098 | host->irq = platform_get_irq(pdev, 0); | 1152 | host->irq = platform_get_irq(pdev, 0); |
1099 | 1153 | ||
1154 | /* | ||
1155 | * mask the interrupt. For i.MX21 explicitely call | ||
1156 | * irq_control_v1_v2 to use the mask bit. We can't call | ||
1157 | * disable_irq_nosync() for an interrupt we do not own yet. | ||
1158 | */ | ||
1159 | if (cpu_is_mx21()) | ||
1160 | irq_control_v1_v2(host, 0); | ||
1161 | else | ||
1162 | host->irq_control(host, 0); | ||
1163 | |||
1100 | err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host); | 1164 | err = request_irq(host->irq, mxc_nfc_irq, IRQF_DISABLED, DRIVER_NAME, host); |
1101 | if (err) | 1165 | if (err) |
1102 | goto eirq; | 1166 | goto eirq; |
1103 | 1167 | ||
1168 | host->irq_control(host, 0); | ||
1169 | |||
1170 | /* | ||
1171 | * Now that the interrupt is disabled make sure the interrupt | ||
1172 | * mask bit is cleared on i.MX21. Otherwise we can't read | ||
1173 | * the interrupt status bit on this machine. | ||
1174 | */ | ||
1175 | if (cpu_is_mx21()) | ||
1176 | irq_control_v1_v2(host, 1); | ||
1177 | |||
1104 | /* first scan to find the device and get the page size */ | 1178 | /* first scan to find the device and get the page size */ |
1105 | if (nand_scan_ident(mtd, 1, NULL)) { | 1179 | if (nand_scan_ident(mtd, 1, NULL)) { |
1106 | err = -ENXIO; | 1180 | err = -ENXIO; |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 133d51528f8..513e0a76a4a 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -413,7 +413,7 @@ static inline int omap_nand_dma_transfer(struct mtd_info *mtd, void *addr, | |||
413 | prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT); | 413 | prefetch_status = gpmc_read_status(GPMC_PREFETCH_COUNT); |
414 | } while (prefetch_status); | 414 | } while (prefetch_status); |
415 | /* disable and stop the PFPW engine */ | 415 | /* disable and stop the PFPW engine */ |
416 | gpmc_prefetch_reset(); | 416 | gpmc_prefetch_reset(info->gpmc_cs); |
417 | 417 | ||
418 | dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); | 418 | dma_unmap_single(&info->pdev->dev, dma_addr, len, dir); |
419 | return 0; | 419 | return 0; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2cc81a54cbf..5db667c0b37 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2428,7 +2428,7 @@ config UGETH_TX_ON_DEMAND | |||
2428 | 2428 | ||
2429 | config MV643XX_ETH | 2429 | config MV643XX_ETH |
2430 | tristate "Marvell Discovery (643XX) and Orion ethernet support" | 2430 | tristate "Marvell Discovery (643XX) and Orion ethernet support" |
2431 | depends on MV64X60 || PPC32 || PLAT_ORION | 2431 | depends on (MV64X60 || PPC32 || PLAT_ORION) && INET |
2432 | select INET_LRO | 2432 | select INET_LRO |
2433 | select PHYLIB | 2433 | select PHYLIB |
2434 | help | 2434 | help |
@@ -2803,7 +2803,7 @@ config NIU | |||
2803 | 2803 | ||
2804 | config PASEMI_MAC | 2804 | config PASEMI_MAC |
2805 | tristate "PA Semi 1/10Gbit MAC" | 2805 | tristate "PA Semi 1/10Gbit MAC" |
2806 | depends on PPC_PASEMI && PCI | 2806 | depends on PPC_PASEMI && PCI && INET |
2807 | select PHYLIB | 2807 | select PHYLIB |
2808 | select INET_LRO | 2808 | select INET_LRO |
2809 | help | 2809 | help |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 1e620e287ae..efeffdf9e5f 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -2170,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2170 | dev->irq = sdev->irq; | 2170 | dev->irq = sdev->irq; |
2171 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); | 2171 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); |
2172 | 2172 | ||
2173 | netif_carrier_off(dev); | ||
2174 | |||
2175 | err = ssb_bus_powerup(sdev->bus, 0); | 2173 | err = ssb_bus_powerup(sdev->bus, 0); |
2176 | if (err) { | 2174 | if (err) { |
2177 | dev_err(sdev->dev, | 2175 | dev_err(sdev->dev, |
@@ -2213,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2213 | goto err_out_powerdown; | 2211 | goto err_out_powerdown; |
2214 | } | 2212 | } |
2215 | 2213 | ||
2214 | netif_carrier_off(dev); | ||
2215 | |||
2216 | ssb_set_drvdata(sdev, dev); | 2216 | ssb_set_drvdata(sdev, dev); |
2217 | 2217 | ||
2218 | /* Chip reset provides power to the b44 MAC & PCI cores, which | 2218 | /* Chip reset provides power to the b44 MAC & PCI cores, which |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3b16f62d560..e953c6ad6e6 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -5164,6 +5164,15 @@ int bond_create(struct net *net, const char *name) | |||
5164 | res = dev_alloc_name(bond_dev, "bond%d"); | 5164 | res = dev_alloc_name(bond_dev, "bond%d"); |
5165 | if (res < 0) | 5165 | if (res < 0) |
5166 | goto out; | 5166 | goto out; |
5167 | } else { | ||
5168 | /* | ||
5169 | * If we're given a name to register | ||
5170 | * we need to ensure that its not already | ||
5171 | * registered | ||
5172 | */ | ||
5173 | res = -EEXIST; | ||
5174 | if (__dev_get_by_name(net, name) != NULL) | ||
5175 | goto out; | ||
5167 | } | 5176 | } |
5168 | 5177 | ||
5169 | res = register_netdevice(bond_dev); | 5178 | res = register_netdevice(bond_dev); |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index a333b42111b..6372610ed24 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev, | |||
533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ | 533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ |
534 | 534 | ||
535 | skb_put(skb, length); | 535 | skb_put(skb, length); |
536 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
537 | skb->protocol = eth_type_trans(skb, dev); | 536 | skb->protocol = eth_type_trans(skb, dev); |
537 | |||
538 | /* The packet was not an IPV4 packet so a complemented checksum was | ||
539 | calculated. The value is found in the Internet Checksum field. */ | ||
540 | if (cqe->status & EHEA_CQE_BLIND_CKSUM) { | ||
541 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
542 | skb->csum = csum_unfold(~cqe->inet_checksum_value); | ||
543 | } else | ||
544 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
538 | } | 545 | } |
539 | 546 | ||
540 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, | 547 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index f608a6c54af..38104734a3b 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -150,6 +150,7 @@ struct ehea_rwqe { | |||
150 | #define EHEA_CQE_TYPE_RQ 0x60 | 150 | #define EHEA_CQE_TYPE_RQ 0x60 |
151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F | 151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F |
152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF | 152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF |
153 | #define EHEA_CQE_BLIND_CKSUM 0x8000 | ||
153 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 | 154 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 |
154 | #define EHEA_CQE_STAT_ERR_IP 0x2000 | 155 | #define EHEA_CQE_STAT_ERR_IP 0x2000 |
155 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 | 156 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 768b840aeb6..cce32d43175 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
678 | { | 678 | { |
679 | struct fec_enet_private *fep = netdev_priv(dev); | 679 | struct fec_enet_private *fep = netdev_priv(dev); |
680 | struct phy_device *phy_dev = NULL; | 680 | struct phy_device *phy_dev = NULL; |
681 | int ret; | 681 | char mdio_bus_id[MII_BUS_ID_SIZE]; |
682 | char phy_name[MII_BUS_ID_SIZE + 3]; | ||
683 | int phy_id; | ||
682 | 684 | ||
683 | fep->phy_dev = NULL; | 685 | fep->phy_dev = NULL; |
684 | 686 | ||
685 | /* find the first phy */ | 687 | /* check for attached phy */ |
686 | phy_dev = phy_find_first(fep->mii_bus); | 688 | for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { |
687 | if (!phy_dev) { | 689 | if ((fep->mii_bus->phy_mask & (1 << phy_id))) |
688 | printk(KERN_ERR "%s: no PHY found\n", dev->name); | 690 | continue; |
689 | return -ENODEV; | 691 | if (fep->mii_bus->phy_map[phy_id] == NULL) |
692 | continue; | ||
693 | if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) | ||
694 | continue; | ||
695 | strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); | ||
696 | break; | ||
690 | } | 697 | } |
691 | 698 | ||
692 | /* attach the mac to the phy */ | 699 | if (phy_id >= PHY_MAX_ADDR) { |
693 | ret = phy_connect_direct(dev, phy_dev, | 700 | printk(KERN_INFO "%s: no PHY, assuming direct connection " |
694 | &fec_enet_adjust_link, 0, | 701 | "to switch\n", dev->name); |
695 | PHY_INTERFACE_MODE_MII); | 702 | strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); |
696 | if (ret) { | 703 | phy_id = 0; |
697 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 704 | } |
698 | return ret; | 705 | |
706 | snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | ||
707 | phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0, | ||
708 | PHY_INTERFACE_MODE_MII); | ||
709 | if (IS_ERR(phy_dev)) { | ||
710 | printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); | ||
711 | return PTR_ERR(phy_dev); | ||
699 | } | 712 | } |
700 | 713 | ||
701 | /* mask with MAC supported features */ | 714 | /* mask with MAC supported features */ |
@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
738 | fep->mii_bus->read = fec_enet_mdio_read; | 751 | fep->mii_bus->read = fec_enet_mdio_read; |
739 | fep->mii_bus->write = fec_enet_mdio_write; | 752 | fep->mii_bus->write = fec_enet_mdio_write; |
740 | fep->mii_bus->reset = fec_enet_mdio_reset; | 753 | fep->mii_bus->reset = fec_enet_mdio_reset; |
741 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); | 754 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1); |
742 | fep->mii_bus->priv = fep; | 755 | fep->mii_bus->priv = fep; |
743 | fep->mii_bus->parent = &pdev->dev; | 756 | fep->mii_bus->parent = &pdev->dev; |
744 | 757 | ||
@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev) | |||
1311 | if (ret) | 1324 | if (ret) |
1312 | goto failed_mii_init; | 1325 | goto failed_mii_init; |
1313 | 1326 | ||
1327 | /* Carrier starts down, phylib will bring it up */ | ||
1328 | netif_carrier_off(ndev); | ||
1329 | |||
1314 | ret = register_netdev(ndev); | 1330 | ret = register_netdev(ndev); |
1315 | if (ret) | 1331 | if (ret) |
1316 | goto failed_register; | 1332 | goto failed_register; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index a0da4a17b02..992db2fa136 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) | 1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) |
1213 | return; | 1213 | return; |
1214 | 1214 | ||
1215 | counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); | 1215 | counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters), |
1216 | &paddr, GFP_KERNEL); | ||
1216 | if (!counters) | 1217 | if (!counters) |
1217 | return; | 1218 | return; |
1218 | 1219 | ||
@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1233 | RTL_W32(CounterAddrLow, 0); | 1234 | RTL_W32(CounterAddrLow, 0); |
1234 | RTL_W32(CounterAddrHigh, 0); | 1235 | RTL_W32(CounterAddrHigh, 0); |
1235 | 1236 | ||
1236 | pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); | 1237 | dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters, |
1238 | paddr); | ||
1237 | } | 1239 | } |
1238 | 1240 | ||
1239 | static void rtl8169_get_ethtool_stats(struct net_device *dev, | 1241 | static void rtl8169_get_ethtool_stats(struct net_device *dev, |
@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev) | |||
3292 | 3294 | ||
3293 | /* | 3295 | /* |
3294 | * Rx and Tx desscriptors needs 256 bytes alignment. | 3296 | * Rx and Tx desscriptors needs 256 bytes alignment. |
3295 | * pci_alloc_consistent provides more. | 3297 | * dma_alloc_coherent provides more. |
3296 | */ | 3298 | */ |
3297 | tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, | 3299 | tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES, |
3298 | &tp->TxPhyAddr); | 3300 | &tp->TxPhyAddr, GFP_KERNEL); |
3299 | if (!tp->TxDescArray) | 3301 | if (!tp->TxDescArray) |
3300 | goto err_pm_runtime_put; | 3302 | goto err_pm_runtime_put; |
3301 | 3303 | ||
3302 | tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, | 3304 | tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES, |
3303 | &tp->RxPhyAddr); | 3305 | &tp->RxPhyAddr, GFP_KERNEL); |
3304 | if (!tp->RxDescArray) | 3306 | if (!tp->RxDescArray) |
3305 | goto err_free_tx_0; | 3307 | goto err_free_tx_0; |
3306 | 3308 | ||
@@ -3334,12 +3336,12 @@ out: | |||
3334 | err_release_ring_2: | 3336 | err_release_ring_2: |
3335 | rtl8169_rx_clear(tp); | 3337 | rtl8169_rx_clear(tp); |
3336 | err_free_rx_1: | 3338 | err_free_rx_1: |
3337 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 3339 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
3338 | tp->RxPhyAddr); | 3340 | tp->RxPhyAddr); |
3339 | tp->RxDescArray = NULL; | 3341 | tp->RxDescArray = NULL; |
3340 | err_free_tx_0: | 3342 | err_free_tx_0: |
3341 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 3343 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
3342 | tp->TxPhyAddr); | 3344 | tp->TxPhyAddr); |
3343 | tp->TxDescArray = NULL; | 3345 | tp->TxDescArray = NULL; |
3344 | err_pm_runtime_put: | 3346 | err_pm_runtime_put: |
3345 | pm_runtime_put_noidle(&pdev->dev); | 3347 | pm_runtime_put_noidle(&pdev->dev); |
@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp, | |||
3975 | { | 3977 | { |
3976 | struct pci_dev *pdev = tp->pci_dev; | 3978 | struct pci_dev *pdev = tp->pci_dev; |
3977 | 3979 | ||
3978 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, | 3980 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz, |
3979 | PCI_DMA_FROMDEVICE); | 3981 | PCI_DMA_FROMDEVICE); |
3980 | dev_kfree_skb(*sk_buff); | 3982 | dev_kfree_skb(*sk_buff); |
3981 | *sk_buff = NULL; | 3983 | *sk_buff = NULL; |
@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, | |||
4000 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | 4002 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, |
4001 | struct net_device *dev, | 4003 | struct net_device *dev, |
4002 | struct RxDesc *desc, int rx_buf_sz, | 4004 | struct RxDesc *desc, int rx_buf_sz, |
4003 | unsigned int align) | 4005 | unsigned int align, gfp_t gfp) |
4004 | { | 4006 | { |
4005 | struct sk_buff *skb; | 4007 | struct sk_buff *skb; |
4006 | dma_addr_t mapping; | 4008 | dma_addr_t mapping; |
@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | |||
4008 | 4010 | ||
4009 | pad = align ? align : NET_IP_ALIGN; | 4011 | pad = align ? align : NET_IP_ALIGN; |
4010 | 4012 | ||
4011 | skb = netdev_alloc_skb(dev, rx_buf_sz + pad); | 4013 | skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp); |
4012 | if (!skb) | 4014 | if (!skb) |
4013 | goto err_out; | 4015 | goto err_out; |
4014 | 4016 | ||
4015 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); | 4017 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); |
4016 | 4018 | ||
4017 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, | 4019 | mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz, |
4018 | PCI_DMA_FROMDEVICE); | 4020 | PCI_DMA_FROMDEVICE); |
4019 | 4021 | ||
4020 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); | 4022 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); |
@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) | |||
4039 | } | 4041 | } |
4040 | 4042 | ||
4041 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | 4043 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, |
4042 | u32 start, u32 end) | 4044 | u32 start, u32 end, gfp_t gfp) |
4043 | { | 4045 | { |
4044 | u32 cur; | 4046 | u32 cur; |
4045 | 4047 | ||
@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | |||
4054 | 4056 | ||
4055 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, | 4057 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, |
4056 | tp->RxDescArray + i, | 4058 | tp->RxDescArray + i, |
4057 | tp->rx_buf_sz, tp->align); | 4059 | tp->rx_buf_sz, tp->align, gfp); |
4058 | if (!skb) | 4060 | if (!skb) |
4059 | break; | 4061 | break; |
4060 | 4062 | ||
@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev) | |||
4082 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); | 4084 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); |
4083 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); | 4085 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); |
4084 | 4086 | ||
4085 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) | 4087 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC) |
4086 | goto err_out; | 4088 | goto err_out; |
4087 | 4089 | ||
4088 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); | 4090 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); |
@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, | |||
4099 | { | 4101 | { |
4100 | unsigned int len = tx_skb->len; | 4102 | unsigned int len = tx_skb->len; |
4101 | 4103 | ||
4102 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); | 4104 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, |
4105 | PCI_DMA_TODEVICE); | ||
4103 | desc->opts1 = 0x00; | 4106 | desc->opts1 = 0x00; |
4104 | desc->opts2 = 0x00; | 4107 | desc->opts2 = 0x00; |
4105 | desc->addr = 0x00; | 4108 | desc->addr = 0x00; |
@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, | |||
4243 | txd = tp->TxDescArray + entry; | 4246 | txd = tp->TxDescArray + entry; |
4244 | len = frag->size; | 4247 | len = frag->size; |
4245 | addr = ((void *) page_address(frag->page)) + frag->page_offset; | 4248 | addr = ((void *) page_address(frag->page)) + frag->page_offset; |
4246 | mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); | 4249 | mapping = dma_map_single(&tp->pci_dev->dev, addr, len, |
4250 | PCI_DMA_TODEVICE); | ||
4247 | 4251 | ||
4248 | /* anti gcc 2.95.3 bugware (sic) */ | 4252 | /* anti gcc 2.95.3 bugware (sic) */ |
4249 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); | 4253 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
4313 | tp->tx_skb[entry].skb = skb; | 4317 | tp->tx_skb[entry].skb = skb; |
4314 | } | 4318 | } |
4315 | 4319 | ||
4316 | mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); | 4320 | mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, |
4321 | PCI_DMA_TODEVICE); | ||
4317 | 4322 | ||
4318 | tp->tx_skb[entry].len = len; | 4323 | tp->tx_skb[entry].len = len; |
4319 | txd->addr = cpu_to_le64(mapping); | 4324 | txd->addr = cpu_to_le64(mapping); |
@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, | |||
4477 | if (!skb) | 4482 | if (!skb) |
4478 | goto out; | 4483 | goto out; |
4479 | 4484 | ||
4480 | pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, | 4485 | dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size, |
4481 | PCI_DMA_FROMDEVICE); | 4486 | PCI_DMA_FROMDEVICE); |
4482 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); | 4487 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); |
4483 | *sk_buff = skb; | 4488 | *sk_buff = skb; |
4484 | done = true; | 4489 | done = true; |
@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4549 | rtl8169_rx_csum(skb, desc); | 4554 | rtl8169_rx_csum(skb, desc); |
4550 | 4555 | ||
4551 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { | 4556 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
4552 | pci_dma_sync_single_for_device(pdev, addr, | 4557 | dma_sync_single_for_device(&pdev->dev, addr, |
4553 | pkt_size, PCI_DMA_FROMDEVICE); | 4558 | pkt_size, PCI_DMA_FROMDEVICE); |
4554 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); | 4559 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
4555 | } else { | 4560 | } else { |
4556 | pci_unmap_single(pdev, addr, tp->rx_buf_sz, | 4561 | dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz, |
4557 | PCI_DMA_FROMDEVICE); | 4562 | PCI_DMA_FROMDEVICE); |
4558 | tp->Rx_skbuff[entry] = NULL; | 4563 | tp->Rx_skbuff[entry] = NULL; |
4559 | } | 4564 | } |
@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4583 | count = cur_rx - tp->cur_rx; | 4588 | count = cur_rx - tp->cur_rx; |
4584 | tp->cur_rx = cur_rx; | 4589 | tp->cur_rx = cur_rx; |
4585 | 4590 | ||
4586 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); | 4591 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC); |
4587 | if (!delta && count) | 4592 | if (!delta && count) |
4588 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); | 4593 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); |
4589 | tp->dirty_rx += delta; | 4594 | tp->dirty_rx += delta; |
@@ -4769,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev) | |||
4769 | 4774 | ||
4770 | free_irq(dev->irq, dev); | 4775 | free_irq(dev->irq, dev); |
4771 | 4776 | ||
4772 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 4777 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
4773 | tp->RxPhyAddr); | 4778 | tp->RxPhyAddr); |
4774 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 4779 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
4775 | tp->TxPhyAddr); | 4780 | tp->TxPhyAddr); |
4776 | tp->TxDescArray = NULL; | 4781 | tp->TxDescArray = NULL; |
4777 | tp->RxDescArray = NULL; | 4782 | tp->RxDescArray = NULL; |
4778 | 4783 | ||
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 40e5c46e757..465ae7e8450 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
44 | #include <linux/mii.h> | 44 | #include <linux/mii.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/dmi.h> | ||
46 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
47 | 48 | ||
48 | #include "skge.h" | 49 | #include "skge.h" |
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev) | |||
3868 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); | 3869 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); |
3869 | } | 3870 | } |
3870 | 3871 | ||
3872 | static int only_32bit_dma; | ||
3873 | |||
3871 | static int __devinit skge_probe(struct pci_dev *pdev, | 3874 | static int __devinit skge_probe(struct pci_dev *pdev, |
3872 | const struct pci_device_id *ent) | 3875 | const struct pci_device_id *ent) |
3873 | { | 3876 | { |
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3889 | 3892 | ||
3890 | pci_set_master(pdev); | 3893 | pci_set_master(pdev); |
3891 | 3894 | ||
3892 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 3895 | if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
3893 | using_dac = 1; | 3896 | using_dac = 1; |
3894 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 3897 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
3895 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { | 3898 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { |
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = { | |||
4147 | .shutdown = skge_shutdown, | 4150 | .shutdown = skge_shutdown, |
4148 | }; | 4151 | }; |
4149 | 4152 | ||
4153 | static struct dmi_system_id skge_32bit_dma_boards[] = { | ||
4154 | { | ||
4155 | .ident = "Gigabyte nForce boards", | ||
4156 | .matches = { | ||
4157 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"), | ||
4158 | DMI_MATCH(DMI_BOARD_NAME, "nForce"), | ||
4159 | }, | ||
4160 | }, | ||
4161 | {} | ||
4162 | }; | ||
4163 | |||
4150 | static int __init skge_init_module(void) | 4164 | static int __init skge_init_module(void) |
4151 | { | 4165 | { |
4166 | if (dmi_check_system(skge_32bit_dma_boards)) | ||
4167 | only_32bit_dma = 1; | ||
4152 | skge_debug_init(); | 4168 | skge_debug_init(); |
4153 | return pci_register_driver(&skge_driver); | 4169 | return pci_register_driver(&skge_driver); |
4154 | } | 4170 | } |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index bc3af78a869..1ec4b9e0239 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4666 | desc_idx, *post_ptr); | 4666 | desc_idx, *post_ptr); |
4667 | drop_it_no_recycle: | 4667 | drop_it_no_recycle: |
4668 | /* Other statistics kept track of by card. */ | 4668 | /* Other statistics kept track of by card. */ |
4669 | tp->net_stats.rx_dropped++; | 4669 | tp->rx_dropped++; |
4670 | goto next_pkt; | 4670 | goto next_pkt; |
4671 | } | 4671 | } |
4672 | 4672 | ||
@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4726 | if (len > (tp->dev->mtu + ETH_HLEN) && | 4726 | if (len > (tp->dev->mtu + ETH_HLEN) && |
4727 | skb->protocol != htons(ETH_P_8021Q)) { | 4727 | skb->protocol != htons(ETH_P_8021Q)) { |
4728 | dev_kfree_skb(skb); | 4728 | dev_kfree_skb(skb); |
4729 | goto next_pkt; | 4729 | goto drop_it_no_recycle; |
4730 | } | 4730 | } |
4731 | 4731 | ||
4732 | if (desc->type_flags & RXD_FLAG_VLAN && | 4732 | if (desc->type_flags & RXD_FLAG_VLAN && |
@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, | |||
9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + | 9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + |
9241 | get_stat64(&hw_stats->rx_discards); | 9241 | get_stat64(&hw_stats->rx_discards); |
9242 | 9242 | ||
9243 | stats->rx_dropped = tp->rx_dropped; | ||
9244 | |||
9243 | return stats; | 9245 | return stats; |
9244 | } | 9246 | } |
9245 | 9247 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 4937bd19096..be7ff138a7f 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2759,7 +2759,7 @@ struct tg3 { | |||
2759 | 2759 | ||
2760 | 2760 | ||
2761 | /* begin "everything else" cacheline(s) section */ | 2761 | /* begin "everything else" cacheline(s) section */ |
2762 | struct rtnl_link_stats64 net_stats; | 2762 | unsigned long rx_dropped; |
2763 | struct rtnl_link_stats64 net_stats_prev; | 2763 | struct rtnl_link_stats64 net_stats_prev; |
2764 | struct tg3_ethtool_stats estats; | 2764 | struct tg3_ethtool_stats estats; |
2765 | struct tg3_ethtool_stats estats_prev; | 2765 | struct tg3_ethtool_stats estats_prev; |
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c index 8cc9e319f43..1737d1488b3 100644 --- a/drivers/net/wimax/i2400m/rx.c +++ b/drivers/net/wimax/i2400m/rx.c | |||
@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1244 | int i, result; | 1244 | int i, result; |
1245 | struct device *dev = i2400m_dev(i2400m); | 1245 | struct device *dev = i2400m_dev(i2400m); |
1246 | const struct i2400m_msg_hdr *msg_hdr; | 1246 | const struct i2400m_msg_hdr *msg_hdr; |
1247 | size_t pl_itr, pl_size, skb_len; | 1247 | size_t pl_itr, pl_size; |
1248 | unsigned long flags; | 1248 | unsigned long flags; |
1249 | unsigned num_pls, single_last; | 1249 | unsigned num_pls, single_last, skb_len; |
1250 | 1250 | ||
1251 | skb_len = skb->len; | 1251 | skb_len = skb->len; |
1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", | 1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n", |
1253 | i2400m, skb, skb_len); | 1253 | i2400m, skb, skb_len); |
1254 | result = -EIO; | 1254 | result = -EIO; |
1255 | msg_hdr = (void *) skb->data; | 1255 | msg_hdr = (void *) skb->data; |
1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); | 1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len); |
1257 | if (result < 0) | 1257 | if (result < 0) |
1258 | goto error_msg_hdr_check; | 1258 | goto error_msg_hdr_check; |
1259 | result = -EIO; | 1259 | result = -EIO; |
@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ | 1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ |
1262 | num_pls * sizeof(msg_hdr->pld[0]); | 1262 | num_pls * sizeof(msg_hdr->pld[0]); |
1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); | 1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); |
1264 | if (pl_itr > skb->len) { /* got all the payload descriptors? */ | 1264 | if (pl_itr > skb_len) { /* got all the payload descriptors? */ |
1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " | 1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " |
1266 | "%u payload descriptors (%zu each, total %zu)\n", | 1266 | "%u payload descriptors (%zu each, total %zu)\n", |
1267 | skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); | 1267 | skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); |
1268 | goto error_pl_descr_short; | 1268 | goto error_pl_descr_short; |
1269 | } | 1269 | } |
1270 | /* Walk each payload payload--check we really got it */ | 1270 | /* Walk each payload payload--check we really got it */ |
@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1272 | /* work around old gcc warnings */ | 1272 | /* work around old gcc warnings */ |
1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); | 1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); |
1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], | 1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], |
1275 | pl_itr, skb->len); | 1275 | pl_itr, skb_len); |
1276 | if (result < 0) | 1276 | if (result < 0) |
1277 | goto error_pl_descr_check; | 1277 | goto error_pl_descr_check; |
1278 | single_last = num_pls == 1 || i == num_pls - 1; | 1278 | single_last = num_pls == 1 || i == num_pls - 1; |
@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1290 | if (i < i2400m->rx_pl_min) | 1290 | if (i < i2400m->rx_pl_min) |
1291 | i2400m->rx_pl_min = i; | 1291 | i2400m->rx_pl_min = i; |
1292 | i2400m->rx_num++; | 1292 | i2400m->rx_num++; |
1293 | i2400m->rx_size_acc += skb->len; | 1293 | i2400m->rx_size_acc += skb_len; |
1294 | if (skb->len < i2400m->rx_size_min) | 1294 | if (skb_len < i2400m->rx_size_min) |
1295 | i2400m->rx_size_min = skb->len; | 1295 | i2400m->rx_size_min = skb_len; |
1296 | if (skb->len > i2400m->rx_size_max) | 1296 | if (skb_len > i2400m->rx_size_max) |
1297 | i2400m->rx_size_max = skb->len; | 1297 | i2400m->rx_size_max = skb_len; |
1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); | 1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); |
1299 | error_pl_descr_check: | 1299 | error_pl_descr_check: |
1300 | error_pl_descr_short: | 1300 | error_pl_descr_short: |
1301 | error_msg_hdr_check: | 1301 | error_msg_hdr_check: |
1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", | 1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n", |
1303 | i2400m, skb, skb_len, result); | 1303 | i2400m, skb, skb_len, result); |
1304 | return result; | 1304 | return result; |
1305 | } | 1305 | } |
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index cc648b6ae31..a3d95cca8f0 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -543,7 +543,7 @@ static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah) | |||
543 | if (conf_is_ht40(conf)) | 543 | if (conf_is_ht40(conf)) |
544 | return clockrate * 2; | 544 | return clockrate * 2; |
545 | 545 | ||
546 | return clockrate * 2; | 546 | return clockrate; |
547 | } | 547 | } |
548 | 548 | ||
549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) | 549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 9dd9e64c2b0..8fd00a6e512 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1411,7 +1411,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1411 | clear_bit(STATUS_SCAN_HW, &priv->status); | 1411 | clear_bit(STATUS_SCAN_HW, &priv->status); |
1412 | clear_bit(STATUS_SCANNING, &priv->status); | 1412 | clear_bit(STATUS_SCANNING, &priv->status); |
1413 | /* inform mac80211 scan aborted */ | 1413 | /* inform mac80211 scan aborted */ |
1414 | queue_work(priv->workqueue, &priv->scan_completed); | 1414 | queue_work(priv->workqueue, &priv->abort_scan); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | 1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 59a308b02f9..d31661c1ce7 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3018,7 +3018,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3018 | clear_bit(STATUS_SCANNING, &priv->status); | 3018 | clear_bit(STATUS_SCANNING, &priv->status); |
3019 | 3019 | ||
3020 | /* inform mac80211 scan aborted */ | 3020 | /* inform mac80211 scan aborted */ |
3021 | queue_work(priv->workqueue, &priv->scan_completed); | 3021 | queue_work(priv->workqueue, &priv->abort_scan); |
3022 | } | 3022 | } |
3023 | 3023 | ||
3024 | static void iwl3945_bg_restart(struct work_struct *data) | 3024 | static void iwl3945_bg_restart(struct work_struct *data) |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 89ed181cd90..857ae01734a 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -163,6 +163,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_d | |||
163 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); | 163 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear | ||
167 | * for some HT machines to use C4 w/o hanging. | ||
168 | */ | ||
169 | static void __devinit quirk_tigerpoint_bm_sts(struct pci_dev *dev) | ||
170 | { | ||
171 | u32 pmbase; | ||
172 | u16 pm1a; | ||
173 | |||
174 | pci_read_config_dword(dev, 0x40, &pmbase); | ||
175 | pmbase = pmbase & 0xff80; | ||
176 | pm1a = inw(pmbase); | ||
177 | |||
178 | if (pm1a & 0x10) { | ||
179 | dev_info(&dev->dev, FW_BUG "TigerPoint LPC.BM_STS cleared\n"); | ||
180 | outw(0x10, pmbase); | ||
181 | } | ||
182 | } | ||
183 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts); | ||
184 | |||
185 | /* | ||
166 | * Chipsets where PCI->PCI transfers vanish or hang | 186 | * Chipsets where PCI->PCI transfers vanish or hang |
167 | */ | 187 | */ |
168 | static void __devinit quirk_nopcipci(struct pci_dev *dev) | 188 | static void __devinit quirk_nopcipci(struct pci_dev *dev) |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index 9024480a822..c44a5e8b8b8 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -51,7 +51,6 @@ | |||
51 | * TODO: | 51 | * TODO: |
52 | * - handle CPU hotplug | 52 | * - handle CPU hotplug |
53 | * - provide turbo enable/disable api | 53 | * - provide turbo enable/disable api |
54 | * - make sure we can write turbo enable/disable reg based on MISC_EN | ||
55 | * | 54 | * |
56 | * Related documents: | 55 | * Related documents: |
57 | * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2 | 56 | * - CDI 403777, 403778 - Auburndale EDS vol 1 & 2 |
@@ -230,7 +229,7 @@ | |||
230 | #define THM_TC2 0xac | 229 | #define THM_TC2 0xac |
231 | #define THM_DTV 0xb0 | 230 | #define THM_DTV 0xb0 |
232 | #define THM_ITV 0xd8 | 231 | #define THM_ITV 0xd8 |
233 | #define ITV_ME_SEQNO_MASK 0x000f0000 /* ME should update every ~200ms */ | 232 | #define ITV_ME_SEQNO_MASK 0x00ff0000 /* ME should update every ~200ms */ |
234 | #define ITV_ME_SEQNO_SHIFT (16) | 233 | #define ITV_ME_SEQNO_SHIFT (16) |
235 | #define ITV_MCH_TEMP_MASK 0x0000ff00 | 234 | #define ITV_MCH_TEMP_MASK 0x0000ff00 |
236 | #define ITV_MCH_TEMP_SHIFT (8) | 235 | #define ITV_MCH_TEMP_SHIFT (8) |
@@ -325,6 +324,7 @@ struct ips_driver { | |||
325 | bool gpu_preferred; | 324 | bool gpu_preferred; |
326 | bool poll_turbo_status; | 325 | bool poll_turbo_status; |
327 | bool second_cpu; | 326 | bool second_cpu; |
327 | bool turbo_toggle_allowed; | ||
328 | struct ips_mcp_limits *limits; | 328 | struct ips_mcp_limits *limits; |
329 | 329 | ||
330 | /* Optional MCH interfaces for if i915 is in use */ | 330 | /* Optional MCH interfaces for if i915 is in use */ |
@@ -415,7 +415,7 @@ static void ips_cpu_lower(struct ips_driver *ips) | |||
415 | new_limit = cur_limit - 8; /* 1W decrease */ | 415 | new_limit = cur_limit - 8; /* 1W decrease */ |
416 | 416 | ||
417 | /* Clamp to SKU TDP limit */ | 417 | /* Clamp to SKU TDP limit */ |
418 | if (((new_limit * 10) / 8) < (ips->orig_turbo_limit & TURBO_TDP_MASK)) | 418 | if (new_limit < (ips->orig_turbo_limit & TURBO_TDP_MASK)) |
419 | new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK; | 419 | new_limit = ips->orig_turbo_limit & TURBO_TDP_MASK; |
420 | 420 | ||
421 | thm_writew(THM_MPCPC, (new_limit * 10) / 8); | 421 | thm_writew(THM_MPCPC, (new_limit * 10) / 8); |
@@ -461,7 +461,8 @@ static void ips_enable_cpu_turbo(struct ips_driver *ips) | |||
461 | if (ips->__cpu_turbo_on) | 461 | if (ips->__cpu_turbo_on) |
462 | return; | 462 | return; |
463 | 463 | ||
464 | on_each_cpu(do_enable_cpu_turbo, ips, 1); | 464 | if (ips->turbo_toggle_allowed) |
465 | on_each_cpu(do_enable_cpu_turbo, ips, 1); | ||
465 | 466 | ||
466 | ips->__cpu_turbo_on = true; | 467 | ips->__cpu_turbo_on = true; |
467 | } | 468 | } |
@@ -498,7 +499,8 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) | |||
498 | if (!ips->__cpu_turbo_on) | 499 | if (!ips->__cpu_turbo_on) |
499 | return; | 500 | return; |
500 | 501 | ||
501 | on_each_cpu(do_disable_cpu_turbo, ips, 1); | 502 | if (ips->turbo_toggle_allowed) |
503 | on_each_cpu(do_disable_cpu_turbo, ips, 1); | ||
502 | 504 | ||
503 | ips->__cpu_turbo_on = false; | 505 | ips->__cpu_turbo_on = false; |
504 | } | 506 | } |
@@ -598,17 +600,29 @@ static bool mcp_exceeded(struct ips_driver *ips) | |||
598 | { | 600 | { |
599 | unsigned long flags; | 601 | unsigned long flags; |
600 | bool ret = false; | 602 | bool ret = false; |
603 | u32 temp_limit; | ||
604 | u32 avg_power; | ||
605 | const char *msg = "MCP limit exceeded: "; | ||
601 | 606 | ||
602 | spin_lock_irqsave(&ips->turbo_status_lock, flags); | 607 | spin_lock_irqsave(&ips->turbo_status_lock, flags); |
603 | if (ips->mcp_avg_temp > (ips->mcp_temp_limit * 100)) | 608 | |
604 | ret = true; | 609 | temp_limit = ips->mcp_temp_limit * 100; |
605 | if (ips->cpu_avg_power + ips->mch_avg_power > ips->mcp_power_limit) | 610 | if (ips->mcp_avg_temp > temp_limit) { |
611 | dev_info(&ips->dev->dev, | ||
612 | "%sAvg temp %u, limit %u\n", msg, ips->mcp_avg_temp, | ||
613 | temp_limit); | ||
606 | ret = true; | 614 | ret = true; |
607 | spin_unlock_irqrestore(&ips->turbo_status_lock, flags); | 615 | } |
608 | 616 | ||
609 | if (ret) | 617 | avg_power = ips->cpu_avg_power + ips->mch_avg_power; |
618 | if (avg_power > ips->mcp_power_limit) { | ||
610 | dev_info(&ips->dev->dev, | 619 | dev_info(&ips->dev->dev, |
611 | "MCP power or thermal limit exceeded\n"); | 620 | "%sAvg power %u, limit %u\n", msg, avg_power, |
621 | ips->mcp_power_limit); | ||
622 | ret = true; | ||
623 | } | ||
624 | |||
625 | spin_unlock_irqrestore(&ips->turbo_status_lock, flags); | ||
612 | 626 | ||
613 | return ret; | 627 | return ret; |
614 | } | 628 | } |
@@ -663,6 +677,27 @@ static bool mch_exceeded(struct ips_driver *ips) | |||
663 | } | 677 | } |
664 | 678 | ||
665 | /** | 679 | /** |
680 | * verify_limits - verify BIOS provided limits | ||
681 | * @ips: IPS structure | ||
682 | * | ||
683 | * BIOS can optionally provide non-default limits for power and temp. Check | ||
684 | * them here and use the defaults if the BIOS values are not provided or | ||
685 | * are otherwise unusable. | ||
686 | */ | ||
687 | static void verify_limits(struct ips_driver *ips) | ||
688 | { | ||
689 | if (ips->mcp_power_limit < ips->limits->mcp_power_limit || | ||
690 | ips->mcp_power_limit > 35000) | ||
691 | ips->mcp_power_limit = ips->limits->mcp_power_limit; | ||
692 | |||
693 | if (ips->mcp_temp_limit < ips->limits->core_temp_limit || | ||
694 | ips->mcp_temp_limit < ips->limits->mch_temp_limit || | ||
695 | ips->mcp_temp_limit > 150) | ||
696 | ips->mcp_temp_limit = min(ips->limits->core_temp_limit, | ||
697 | ips->limits->mch_temp_limit); | ||
698 | } | ||
699 | |||
700 | /** | ||
666 | * update_turbo_limits - get various limits & settings from regs | 701 | * update_turbo_limits - get various limits & settings from regs |
667 | * @ips: IPS driver struct | 702 | * @ips: IPS driver struct |
668 | * | 703 | * |
@@ -680,12 +715,21 @@ static void update_turbo_limits(struct ips_driver *ips) | |||
680 | u32 hts = thm_readl(THM_HTS); | 715 | u32 hts = thm_readl(THM_HTS); |
681 | 716 | ||
682 | ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS); | 717 | ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS); |
683 | ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS); | 718 | /* |
719 | * Disable turbo for now, until we can figure out why the power figures | ||
720 | * are wrong | ||
721 | */ | ||
722 | ips->cpu_turbo_enabled = false; | ||
723 | |||
724 | if (ips->gpu_busy) | ||
725 | ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS); | ||
726 | |||
684 | ips->core_power_limit = thm_readw(THM_MPCPC); | 727 | ips->core_power_limit = thm_readw(THM_MPCPC); |
685 | ips->mch_power_limit = thm_readw(THM_MMGPC); | 728 | ips->mch_power_limit = thm_readw(THM_MMGPC); |
686 | ips->mcp_temp_limit = thm_readw(THM_PTL); | 729 | ips->mcp_temp_limit = thm_readw(THM_PTL); |
687 | ips->mcp_power_limit = thm_readw(THM_MPPC); | 730 | ips->mcp_power_limit = thm_readw(THM_MPPC); |
688 | 731 | ||
732 | verify_limits(ips); | ||
689 | /* Ignore BIOS CPU vs GPU pref */ | 733 | /* Ignore BIOS CPU vs GPU pref */ |
690 | } | 734 | } |
691 | 735 | ||
@@ -858,7 +902,7 @@ static u32 get_cpu_power(struct ips_driver *ips, u32 *last, int period) | |||
858 | ret = (ret * 1000) / 65535; | 902 | ret = (ret * 1000) / 65535; |
859 | *last = val; | 903 | *last = val; |
860 | 904 | ||
861 | return ret; | 905 | return 0; |
862 | } | 906 | } |
863 | 907 | ||
864 | static const u16 temp_decay_factor = 2; | 908 | static const u16 temp_decay_factor = 2; |
@@ -940,7 +984,6 @@ static int ips_monitor(void *data) | |||
940 | kfree(mch_samples); | 984 | kfree(mch_samples); |
941 | kfree(cpu_samples); | 985 | kfree(cpu_samples); |
942 | kfree(mchp_samples); | 986 | kfree(mchp_samples); |
943 | kthread_stop(ips->adjust); | ||
944 | return -ENOMEM; | 987 | return -ENOMEM; |
945 | } | 988 | } |
946 | 989 | ||
@@ -948,7 +991,7 @@ static int ips_monitor(void *data) | |||
948 | ITV_ME_SEQNO_SHIFT; | 991 | ITV_ME_SEQNO_SHIFT; |
949 | seqno_timestamp = get_jiffies_64(); | 992 | seqno_timestamp = get_jiffies_64(); |
950 | 993 | ||
951 | old_cpu_power = thm_readl(THM_CEC) / 65535; | 994 | old_cpu_power = thm_readl(THM_CEC); |
952 | schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); | 995 | schedule_timeout_interruptible(msecs_to_jiffies(IPS_SAMPLE_PERIOD)); |
953 | 996 | ||
954 | /* Collect an initial average */ | 997 | /* Collect an initial average */ |
@@ -1150,11 +1193,18 @@ static irqreturn_t ips_irq_handler(int irq, void *arg) | |||
1150 | STS_GPL_SHIFT; | 1193 | STS_GPL_SHIFT; |
1151 | /* ignore EC CPU vs GPU pref */ | 1194 | /* ignore EC CPU vs GPU pref */ |
1152 | ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS); | 1195 | ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS); |
1153 | ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS); | 1196 | /* |
1197 | * Disable turbo for now, until we can figure | ||
1198 | * out why the power figures are wrong | ||
1199 | */ | ||
1200 | ips->cpu_turbo_enabled = false; | ||
1201 | if (ips->gpu_busy) | ||
1202 | ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS); | ||
1154 | ips->mcp_temp_limit = (sts & STS_PTL_MASK) >> | 1203 | ips->mcp_temp_limit = (sts & STS_PTL_MASK) >> |
1155 | STS_PTL_SHIFT; | 1204 | STS_PTL_SHIFT; |
1156 | ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> | 1205 | ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> |
1157 | STS_PPL_SHIFT; | 1206 | STS_PPL_SHIFT; |
1207 | verify_limits(ips); | ||
1158 | spin_unlock(&ips->turbo_status_lock); | 1208 | spin_unlock(&ips->turbo_status_lock); |
1159 | 1209 | ||
1160 | thm_writeb(THM_SEC, SEC_ACK); | 1210 | thm_writeb(THM_SEC, SEC_ACK); |
@@ -1333,8 +1383,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips) | |||
1333 | * turbo manually or we'll get an illegal MSR access, even though | 1383 | * turbo manually or we'll get an illegal MSR access, even though |
1334 | * turbo will still be available. | 1384 | * turbo will still be available. |
1335 | */ | 1385 | */ |
1336 | if (!(misc_en & IA32_MISC_TURBO_EN)) | 1386 | if (misc_en & IA32_MISC_TURBO_EN) |
1337 | ; /* add turbo MSR write allowed flag if necessary */ | 1387 | ips->turbo_toggle_allowed = true; |
1388 | else | ||
1389 | ips->turbo_toggle_allowed = false; | ||
1338 | 1390 | ||
1339 | if (strstr(boot_cpu_data.x86_model_id, "CPU M")) | 1391 | if (strstr(boot_cpu_data.x86_model_id, "CPU M")) |
1340 | limits = &ips_sv_limits; | 1392 | limits = &ips_sv_limits; |
@@ -1351,9 +1403,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips) | |||
1351 | tdp = turbo_power & TURBO_TDP_MASK; | 1403 | tdp = turbo_power & TURBO_TDP_MASK; |
1352 | 1404 | ||
1353 | /* Sanity check TDP against CPU */ | 1405 | /* Sanity check TDP against CPU */ |
1354 | if (limits->mcp_power_limit != (tdp / 8) * 1000) { | 1406 | if (limits->core_power_limit != (tdp / 8) * 1000) { |
1355 | dev_warn(&ips->dev->dev, "Warning: CPU TDP doesn't match expected value (found %d, expected %d)\n", | 1407 | dev_info(&ips->dev->dev, "CPU TDP doesn't match expected value (found %d, expected %d)\n", |
1356 | tdp / 8, limits->mcp_power_limit / 1000); | 1408 | tdp / 8, limits->core_power_limit / 1000); |
1409 | limits->core_power_limit = (tdp / 8) * 1000; | ||
1357 | } | 1410 | } |
1358 | 1411 | ||
1359 | out: | 1412 | out: |
@@ -1390,7 +1443,7 @@ static bool ips_get_i915_syms(struct ips_driver *ips) | |||
1390 | return true; | 1443 | return true; |
1391 | 1444 | ||
1392 | out_put_busy: | 1445 | out_put_busy: |
1393 | symbol_put(i915_gpu_turbo_disable); | 1446 | symbol_put(i915_gpu_busy); |
1394 | out_put_lower: | 1447 | out_put_lower: |
1395 | symbol_put(i915_gpu_lower); | 1448 | symbol_put(i915_gpu_lower); |
1396 | out_put_raise: | 1449 | out_put_raise: |
@@ -1532,22 +1585,27 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1532 | /* Save turbo limits & ratios */ | 1585 | /* Save turbo limits & ratios */ |
1533 | rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit); | 1586 | rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit); |
1534 | 1587 | ||
1535 | ips_enable_cpu_turbo(ips); | 1588 | ips_disable_cpu_turbo(ips); |
1536 | ips->cpu_turbo_enabled = true; | 1589 | ips->cpu_turbo_enabled = false; |
1537 | 1590 | ||
1538 | /* Set up the work queue and monitor/adjust threads */ | 1591 | /* Create thermal adjust thread */ |
1539 | ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor"); | 1592 | ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust"); |
1540 | if (IS_ERR(ips->monitor)) { | 1593 | if (IS_ERR(ips->adjust)) { |
1541 | dev_err(&dev->dev, | 1594 | dev_err(&dev->dev, |
1542 | "failed to create thermal monitor thread, aborting\n"); | 1595 | "failed to create thermal adjust thread, aborting\n"); |
1543 | ret = -ENOMEM; | 1596 | ret = -ENOMEM; |
1544 | goto error_free_irq; | 1597 | goto error_free_irq; |
1598 | |||
1545 | } | 1599 | } |
1546 | 1600 | ||
1547 | ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust"); | 1601 | /* |
1548 | if (IS_ERR(ips->adjust)) { | 1602 | * Set up the work queue and monitor thread. The monitor thread |
1603 | * will wake up ips_adjust thread. | ||
1604 | */ | ||
1605 | ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor"); | ||
1606 | if (IS_ERR(ips->monitor)) { | ||
1549 | dev_err(&dev->dev, | 1607 | dev_err(&dev->dev, |
1550 | "failed to create thermal adjust thread, aborting\n"); | 1608 | "failed to create thermal monitor thread, aborting\n"); |
1551 | ret = -ENOMEM; | 1609 | ret = -ENOMEM; |
1552 | goto error_thread_cleanup; | 1610 | goto error_thread_cleanup; |
1553 | } | 1611 | } |
@@ -1566,7 +1624,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1566 | return ret; | 1624 | return ret; |
1567 | 1625 | ||
1568 | error_thread_cleanup: | 1626 | error_thread_cleanup: |
1569 | kthread_stop(ips->monitor); | 1627 | kthread_stop(ips->adjust); |
1570 | error_free_irq: | 1628 | error_free_irq: |
1571 | free_irq(ips->dev->irq, ips); | 1629 | free_irq(ips->dev->irq, ips); |
1572 | error_unmap: | 1630 | error_unmap: |
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 0bab84ebb15..19bc7369547 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h | |||
@@ -12,11 +12,12 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol); | |||
12 | 12 | ||
13 | #define PNP_EISA_ID_MASK 0x7fffffff | 13 | #define PNP_EISA_ID_MASK 0x7fffffff |
14 | void pnp_eisa_id_to_string(u32 id, char *str); | 14 | void pnp_eisa_id_to_string(u32 id, char *str); |
15 | struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, char *pnpid); | 15 | struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id, |
16 | const char *pnpid); | ||
16 | struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); | 17 | struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid); |
17 | 18 | ||
18 | int pnp_add_device(struct pnp_dev *dev); | 19 | int pnp_add_device(struct pnp_dev *dev); |
19 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); | 20 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id); |
20 | 21 | ||
21 | int pnp_add_card(struct pnp_card *card); | 22 | int pnp_add_card(struct pnp_card *card); |
22 | void pnp_remove_card(struct pnp_card *card); | 23 | void pnp_remove_card(struct pnp_card *card); |
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index 88b3cde5259..c79ee1ded68 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c | |||
@@ -124,7 +124,8 @@ static void pnp_release_device(struct device *dmdev) | |||
124 | kfree(dev); | 124 | kfree(dev); |
125 | } | 125 | } |
126 | 126 | ||
127 | struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid) | 127 | struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, |
128 | const char *pnpid) | ||
128 | { | 129 | { |
129 | struct pnp_dev *dev; | 130 | struct pnp_dev *dev; |
130 | struct pnp_id *dev_id; | 131 | struct pnp_id *dev_id; |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index cd11b113494..d1dbb9df53f 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -236,7 +236,7 @@ void pnp_unregister_driver(struct pnp_driver *drv) | |||
236 | * @dev: pointer to the desired device | 236 | * @dev: pointer to the desired device |
237 | * @id: pointer to an EISA id string | 237 | * @id: pointer to an EISA id string |
238 | */ | 238 | */ |
239 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id) | 239 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id) |
240 | { | 240 | { |
241 | struct pnp_id *dev_id, *ptr; | 241 | struct pnp_id *dev_id, *ptr; |
242 | 242 | ||
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index dc4e32e031e..4aafcf89b03 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -59,7 +59,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev) | |||
59 | #define TEST_ALPHA(c) \ | 59 | #define TEST_ALPHA(c) \ |
60 | if (!('@' <= (c) || (c) <= 'Z')) \ | 60 | if (!('@' <= (c) || (c) <= 'Z')) \ |
61 | return 0 | 61 | return 0 |
62 | static int __init ispnpidacpi(char *id) | 62 | static int __init ispnpidacpi(const char *id) |
63 | { | 63 | { |
64 | TEST_ALPHA(id[0]); | 64 | TEST_ALPHA(id[0]); |
65 | TEST_ALPHA(id[1]); | 65 | TEST_ALPHA(id[1]); |
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index df1fb53c09d..a4be41614ee 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -256,7 +256,6 @@ static int __devexit ad5398_remove(struct i2c_client *client) | |||
256 | 256 | ||
257 | regulator_unregister(chip->rdev); | 257 | regulator_unregister(chip->rdev); |
258 | kfree(chip); | 258 | kfree(chip); |
259 | i2c_set_clientdata(client, NULL); | ||
260 | 259 | ||
261 | return 0; | 260 | return 0; |
262 | } | 261 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 422a709d271..cc8b337b911 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -700,7 +700,7 @@ static void print_constraints(struct regulator_dev *rdev) | |||
700 | constraints->min_uA != constraints->max_uA) { | 700 | constraints->min_uA != constraints->max_uA) { |
701 | ret = _regulator_get_current_limit(rdev); | 701 | ret = _regulator_get_current_limit(rdev); |
702 | if (ret > 0) | 702 | if (ret > 0) |
703 | count += sprintf(buf + count, "at %d uA ", ret / 1000); | 703 | count += sprintf(buf + count, "at %d mA ", ret / 1000); |
704 | } | 704 | } |
705 | 705 | ||
706 | if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) | 706 | if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) |
@@ -2302,8 +2302,10 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, | |||
2302 | dev_set_name(&rdev->dev, "regulator.%d", | 2302 | dev_set_name(&rdev->dev, "regulator.%d", |
2303 | atomic_inc_return(®ulator_no) - 1); | 2303 | atomic_inc_return(®ulator_no) - 1); |
2304 | ret = device_register(&rdev->dev); | 2304 | ret = device_register(&rdev->dev); |
2305 | if (ret != 0) | 2305 | if (ret != 0) { |
2306 | put_device(&rdev->dev); | ||
2306 | goto clean; | 2307 | goto clean; |
2308 | } | ||
2307 | 2309 | ||
2308 | dev_set_drvdata(&rdev->dev, rdev); | 2310 | dev_set_drvdata(&rdev->dev, rdev); |
2309 | 2311 | ||
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index d61ecb885a8..b8cc6389a54 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c | |||
@@ -191,8 +191,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c) | |||
191 | struct isl_pmic *pmic = i2c_get_clientdata(i2c); | 191 | struct isl_pmic *pmic = i2c_get_clientdata(i2c); |
192 | int i; | 192 | int i; |
193 | 193 | ||
194 | i2c_set_clientdata(i2c, NULL); | ||
195 | |||
196 | for (i = 0; i < 3; i++) | 194 | for (i = 0; i < 3; i++) |
197 | regulator_unregister(pmic->rdev[i]); | 195 | regulator_unregister(pmic->rdev[i]); |
198 | 196 | ||
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 4520ace3f7e..6b60a9c0366 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -330,7 +330,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, | |||
330 | /* set external clock frequency */ | 330 | /* set external clock frequency */ |
331 | info->extclk_freq = pdata->extclk_freq; | 331 | info->extclk_freq = pdata->extclk_freq; |
332 | max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK, | 332 | max8649_set_bits(info->i2c, MAX8649_SYNC, MAX8649_EXT_MASK, |
333 | info->extclk_freq); | 333 | info->extclk_freq << 6); |
334 | } | 334 | } |
335 | 335 | ||
336 | if (pdata->ramp_timing) { | 336 | if (pdata->ramp_timing) { |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 9daed8db83d..9de8516e353 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -268,7 +268,6 @@ out_irq: | |||
268 | free_irq(client->irq, client); | 268 | free_irq(client->irq, client); |
269 | 269 | ||
270 | out_free: | 270 | out_free: |
271 | i2c_set_clientdata(client, NULL); | ||
272 | kfree(ds3232); | 271 | kfree(ds3232); |
273 | return ret; | 272 | return ret; |
274 | } | 273 | } |
@@ -287,7 +286,6 @@ static int __devexit ds3232_remove(struct i2c_client *client) | |||
287 | } | 286 | } |
288 | 287 | ||
289 | rtc_device_unregister(ds3232->rtc); | 288 | rtc_device_unregister(ds3232->rtc); |
290 | i2c_set_clientdata(client, NULL); | ||
291 | kfree(ds3232); | 289 | kfree(ds3232); |
292 | return 0; | 290 | return 0; |
293 | } | 291 | } |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index ad0ed212db4..348fba0a897 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1046,13 +1046,13 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, | |||
1046 | 1046 | ||
1047 | /* If the user actually wanted this page, we can skip the rest */ | 1047 | /* If the user actually wanted this page, we can skip the rest */ |
1048 | if (page == 0) | 1048 | if (page == 0) |
1049 | return -EINVAL; | 1049 | return 0; |
1050 | 1050 | ||
1051 | for (i = 0; i < min((int)buf[3], buf_len - 4); i++) | 1051 | for (i = 0; i < min((int)buf[3], buf_len - 4); i++) |
1052 | if (buf[i + 4] == page) | 1052 | if (buf[i + 4] == page) |
1053 | goto found; | 1053 | goto found; |
1054 | 1054 | ||
1055 | if (i < buf[3] && i > buf_len) | 1055 | if (i < buf[3] && i >= buf_len - 4) |
1056 | /* ran off the end of the buffer, give us benefit of doubt */ | 1056 | /* ran off the end of the buffer, give us benefit of doubt */ |
1057 | goto found; | 1057 | goto found; |
1058 | /* The device claims it doesn't support the requested page */ | 1058 | /* The device claims it doesn't support the requested page */ |
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c index 93de907b120..800c5460233 100644 --- a/drivers/serial/ioc3_serial.c +++ b/drivers/serial/ioc3_serial.c | |||
@@ -2044,6 +2044,7 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd) | |||
2044 | if (!port) { | 2044 | if (!port) { |
2045 | printk(KERN_WARNING | 2045 | printk(KERN_WARNING |
2046 | "IOC3 serial memory not available for port\n"); | 2046 | "IOC3 serial memory not available for port\n"); |
2047 | ret = -ENOMEM; | ||
2047 | goto out4; | 2048 | goto out4; |
2048 | } | 2049 | } |
2049 | spin_lock_init(&port->ip_lock); | 2050 | spin_lock_init(&port->ip_lock); |
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index 324c385a653..5dff45c76d3 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
29 | #include <linux/sysrq.h> | 29 | #include <linux/sysrq.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/serial_reg.h> | 31 | #include <linux/serial_reg.h> |
31 | #include <linux/circ_buf.h> | 32 | #include <linux/circ_buf.h> |
32 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
diff --git a/drivers/serial/mrst_max3110.c b/drivers/serial/mrst_max3110.c index f6ad1ecbff7..51c15f58e01 100644 --- a/drivers/serial/mrst_max3110.c +++ b/drivers/serial/mrst_max3110.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
32 | #include <linux/irq.h> | ||
32 | #include <linux/init.h> | 33 | #include <linux/init.h> |
33 | #include <linux/console.h> | 34 | #include <linux/console.h> |
34 | #include <linux/sysrq.h> | 35 | #include <linux/sysrq.h> |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0bcf4c1601a..b5a78a1f442 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/of_device.h> | ||
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
27 | #include <linux/mod_devicetable.h> | 28 | #include <linux/mod_devicetable.h> |
28 | #include <linux/spi/spi.h> | 29 | #include <linux/spi/spi.h> |
@@ -86,6 +87,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv) | |||
86 | const struct spi_device *spi = to_spi_device(dev); | 87 | const struct spi_device *spi = to_spi_device(dev); |
87 | const struct spi_driver *sdrv = to_spi_driver(drv); | 88 | const struct spi_driver *sdrv = to_spi_driver(drv); |
88 | 89 | ||
90 | /* Attempt an OF style match */ | ||
91 | if (of_driver_match_device(dev, drv)) | ||
92 | return 1; | ||
93 | |||
89 | if (sdrv->id_table) | 94 | if (sdrv->id_table) |
90 | return !!spi_match_id(sdrv->id_table, spi); | 95 | return !!spi_match_id(sdrv->id_table, spi); |
91 | 96 | ||
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c index e24a63498ac..63e51b011d5 100644 --- a/drivers/spi/spi_gpio.c +++ b/drivers/spi/spi_gpio.c | |||
@@ -350,7 +350,7 @@ static int __init spi_gpio_probe(struct platform_device *pdev) | |||
350 | spi_gpio->bitbang.master = spi_master_get(master); | 350 | spi_gpio->bitbang.master = spi_master_get(master); |
351 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; | 351 | spi_gpio->bitbang.chipselect = spi_gpio_chipselect; |
352 | 352 | ||
353 | if ((master_flags & (SPI_MASTER_NO_RX | SPI_MASTER_NO_RX)) == 0) { | 353 | if ((master_flags & (SPI_MASTER_NO_TX | SPI_MASTER_NO_RX)) == 0) { |
354 | spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; | 354 | spi_gpio->bitbang.txrx_word[SPI_MODE_0] = spi_gpio_txrx_word_mode0; |
355 | spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; | 355 | spi_gpio->bitbang.txrx_word[SPI_MODE_1] = spi_gpio_txrx_word_mode1; |
356 | spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; | 356 | spi_gpio->bitbang.txrx_word[SPI_MODE_2] = spi_gpio_txrx_word_mode2; |
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c index d31b57f7baa..1dd86b835cd 100644 --- a/drivers/spi/spi_mpc8xxx.c +++ b/drivers/spi/spi_mpc8xxx.c | |||
@@ -408,11 +408,17 @@ static void mpc8xxx_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi) | |||
408 | 408 | ||
409 | xfer_ofs = mspi->xfer_in_progress->len - mspi->count; | 409 | xfer_ofs = mspi->xfer_in_progress->len - mspi->count; |
410 | 410 | ||
411 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); | 411 | if (mspi->rx_dma == mspi->dma_dummy_rx) |
412 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma); | ||
413 | else | ||
414 | out_be32(&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); | ||
412 | out_be16(&rx_bd->cbd_datlen, 0); | 415 | out_be16(&rx_bd->cbd_datlen, 0); |
413 | out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP); | 416 | out_be16(&rx_bd->cbd_sc, BD_SC_EMPTY | BD_SC_INTRPT | BD_SC_WRAP); |
414 | 417 | ||
415 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); | 418 | if (mspi->tx_dma == mspi->dma_dummy_tx) |
419 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma); | ||
420 | else | ||
421 | out_be32(&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); | ||
416 | out_be16(&tx_bd->cbd_datlen, xfer_len); | 422 | out_be16(&tx_bd->cbd_datlen, xfer_len); |
417 | out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | | 423 | out_be16(&tx_bd->cbd_sc, BD_SC_READY | BD_SC_INTRPT | BD_SC_WRAP | |
418 | BD_SC_LAST); | 424 | BD_SC_LAST); |
diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index c725356cc34..de7ebb99d8f 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_TM6000 | 1 | config VIDEO_TM6000 |
2 | tristate "TV Master TM5600/6000/6010 driver" | 2 | tristate "TV Master TM5600/6000/6010 driver" |
3 | depends on VIDEO_DEV && I2C && INPUT && USB && EXPERIMENTAL | 3 | depends on VIDEO_DEV && I2C && INPUT && IR_CORE && USB && EXPERIMENTAL |
4 | select VIDEO_TUNER | 4 | select VIDEO_TUNER |
5 | select MEDIA_TUNER_XC2028 | 5 | select MEDIA_TUNER_XC2028 |
6 | select MEDIA_TUNER_XC5000 | 6 | select MEDIA_TUNER_XC5000 |
diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c index 32f7a0af693..54f7667cc70 100644 --- a/drivers/staging/tm6000/tm6000-input.c +++ b/drivers/staging/tm6000/tm6000-input.c | |||
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(enable_ir, "enable ir (default is enable"); | |||
46 | } | 46 | } |
47 | 47 | ||
48 | struct tm6000_ir_poll_result { | 48 | struct tm6000_ir_poll_result { |
49 | u8 rc_data[4]; | 49 | u16 rc_data; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct tm6000_IR { | 52 | struct tm6000_IR { |
@@ -60,9 +60,9 @@ struct tm6000_IR { | |||
60 | int polling; | 60 | int polling; |
61 | struct delayed_work work; | 61 | struct delayed_work work; |
62 | u8 wait:1; | 62 | u8 wait:1; |
63 | u8 key:1; | ||
63 | struct urb *int_urb; | 64 | struct urb *int_urb; |
64 | u8 *urb_data; | 65 | u8 *urb_data; |
65 | u8 key:1; | ||
66 | 66 | ||
67 | int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); | 67 | int (*get_key) (struct tm6000_IR *, struct tm6000_ir_poll_result *); |
68 | 68 | ||
@@ -122,13 +122,14 @@ static void tm6000_ir_urb_received(struct urb *urb) | |||
122 | 122 | ||
123 | if (urb->status != 0) | 123 | if (urb->status != 0) |
124 | printk(KERN_INFO "not ready\n"); | 124 | printk(KERN_INFO "not ready\n"); |
125 | else if (urb->actual_length > 0) | 125 | else if (urb->actual_length > 0) { |
126 | memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); | 126 | memcpy(ir->urb_data, urb->transfer_buffer, urb->actual_length); |
127 | 127 | ||
128 | dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], | 128 | dprintk("data %02x %02x %02x %02x\n", ir->urb_data[0], |
129 | ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); | 129 | ir->urb_data[1], ir->urb_data[2], ir->urb_data[3]); |
130 | 130 | ||
131 | ir->key = 1; | 131 | ir->key = 1; |
132 | } | ||
132 | 133 | ||
133 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 134 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
134 | } | 135 | } |
@@ -140,30 +141,47 @@ static int default_polling_getkey(struct tm6000_IR *ir, | |||
140 | int rc; | 141 | int rc; |
141 | u8 buf[2]; | 142 | u8 buf[2]; |
142 | 143 | ||
143 | if (ir->wait && !&dev->int_in) { | 144 | if (ir->wait && !&dev->int_in) |
144 | poll_result->rc_data[0] = 0xff; | ||
145 | return 0; | 145 | return 0; |
146 | } | ||
147 | 146 | ||
148 | if (&dev->int_in) { | 147 | if (&dev->int_in) { |
149 | poll_result->rc_data[0] = ir->urb_data[0]; | 148 | if (ir->ir.ir_type == IR_TYPE_RC5) |
150 | poll_result->rc_data[1] = ir->urb_data[1]; | 149 | poll_result->rc_data = ir->urb_data[0]; |
150 | else | ||
151 | poll_result->rc_data = ir->urb_data[0] | ir->urb_data[1] << 8; | ||
151 | } else { | 152 | } else { |
152 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); | 153 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 0); |
153 | msleep(10); | 154 | msleep(10); |
154 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1); | 155 | tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 2, 1); |
155 | msleep(10); | 156 | msleep(10); |
156 | 157 | ||
157 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | | 158 | if (ir->ir.ir_type == IR_TYPE_RC5) { |
158 | USB_RECIP_DEVICE, REQ_02_GET_IR_CODE, 0, 0, buf, 1); | 159 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | |
160 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
161 | REQ_02_GET_IR_CODE, 0, 0, buf, 1); | ||
159 | 162 | ||
160 | msleep(10); | 163 | msleep(10); |
161 | 164 | ||
162 | dprintk("read data=%02x\n", buf[0]); | 165 | dprintk("read data=%02x\n", buf[0]); |
163 | if (rc < 0) | 166 | if (rc < 0) |
164 | return rc; | 167 | return rc; |
165 | 168 | ||
166 | poll_result->rc_data[0] = buf[0]; | 169 | poll_result->rc_data = buf[0]; |
170 | } else { | ||
171 | rc = tm6000_read_write_usb(dev, USB_DIR_IN | | ||
172 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
173 | REQ_02_GET_IR_CODE, 0, 0, buf, 2); | ||
174 | |||
175 | msleep(10); | ||
176 | |||
177 | dprintk("read data=%04x\n", buf[0] | buf[1] << 8); | ||
178 | if (rc < 0) | ||
179 | return rc; | ||
180 | |||
181 | poll_result->rc_data = buf[0] | buf[1] << 8; | ||
182 | } | ||
183 | if ((poll_result->rc_data & 0x00ff) != 0xff) | ||
184 | ir->key = 1; | ||
167 | } | 185 | } |
168 | return 0; | 186 | return 0; |
169 | } | 187 | } |
@@ -180,12 +198,11 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir) | |||
180 | return; | 198 | return; |
181 | } | 199 | } |
182 | 200 | ||
183 | dprintk("ir->get_key result data=%02x %02x\n", | 201 | dprintk("ir->get_key result data=%04x\n", poll_result.rc_data); |
184 | poll_result.rc_data[0], poll_result.rc_data[1]); | ||
185 | 202 | ||
186 | if (poll_result.rc_data[0] != 0xff && ir->key == 1) { | 203 | if (ir->key) { |
187 | ir_input_keydown(ir->input->input_dev, &ir->ir, | 204 | ir_input_keydown(ir->input->input_dev, &ir->ir, |
188 | poll_result.rc_data[0] | poll_result.rc_data[1] << 8); | 205 | (u32)poll_result.rc_data); |
189 | 206 | ||
190 | ir_input_nokey(ir->input->input_dev, &ir->ir); | 207 | ir_input_nokey(ir->input->input_dev, &ir->ir); |
191 | ir->key = 0; | 208 | ir->key = 0; |
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 29bac511887..d409495876f 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -755,7 +755,10 @@ int register_xenstore_notifier(struct notifier_block *nb) | |||
755 | { | 755 | { |
756 | int ret = 0; | 756 | int ret = 0; |
757 | 757 | ||
758 | blocking_notifier_chain_register(&xenstore_chain, nb); | 758 | if (xenstored_ready > 0) |
759 | ret = nb->notifier_call(nb, 0, NULL); | ||
760 | else | ||
761 | blocking_notifier_chain_register(&xenstore_chain, nb); | ||
759 | 762 | ||
760 | return ret; | 763 | return ret; |
761 | } | 764 | } |
@@ -769,7 +772,7 @@ EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); | |||
769 | 772 | ||
770 | void xenbus_probe(struct work_struct *unused) | 773 | void xenbus_probe(struct work_struct *unused) |
771 | { | 774 | { |
772 | BUG_ON((xenstored_ready <= 0)); | 775 | xenstored_ready = 1; |
773 | 776 | ||
774 | /* Enumerate devices in xenstore and watch for changes. */ | 777 | /* Enumerate devices in xenstore and watch for changes. */ |
775 | xenbus_probe_devices(&xenbus_frontend); | 778 | xenbus_probe_devices(&xenbus_frontend); |
@@ -835,8 +838,8 @@ static int __init xenbus_init(void) | |||
835 | xen_store_evtchn = xen_start_info->store_evtchn; | 838 | xen_store_evtchn = xen_start_info->store_evtchn; |
836 | xen_store_mfn = xen_start_info->store_mfn; | 839 | xen_store_mfn = xen_start_info->store_mfn; |
837 | xen_store_interface = mfn_to_virt(xen_store_mfn); | 840 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
841 | xenstored_ready = 1; | ||
838 | } | 842 | } |
839 | xenstored_ready = 1; | ||
840 | } | 843 | } |
841 | 844 | ||
842 | /* Initialize the interface to xenstore. */ | 845 | /* Initialize the interface to xenstore. */ |